Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PBIOS-552] Typeahead view more buttons #461

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
90ea3e6
fix colors for pill kit
RachelRadford21 Jun 24, 2024
6244830
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Jun 27, 2024
2d26fe6
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Jul 1, 2024
30185d4
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Jul 11, 2024
0ce7f96
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Jul 19, 2024
4d691ae
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Jul 31, 2024
fba282c
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Aug 2, 2024
3f7f99c
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Aug 7, 2024
03ffde2
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Aug 12, 2024
b88c77c
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Aug 14, 2024
8645719
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Aug 26, 2024
2764aeb
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Aug 29, 2024
d1cfd33
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Sep 4, 2024
60d92a1
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Sep 20, 2024
9d7e62c
Merge remote-tracking branch 'refs/remotes/origin/main'
RachelRadford21 Sep 30, 2024
119e5a1
add no options to dropdown
RachelRadford21 Oct 2, 2024
f63e123
commit to allow user no options text
RachelRadford21 Oct 8, 2024
9daaed4
no message
isismsilva Oct 9, 2024
5e57925
converted data
isismsilva Oct 15, 2024
dda8321
fix pbuser
isismsilva Oct 15, 2024
8ce8fb7
add view more section button
isismsilva Oct 16, 2024
c39e497
resolved conflicts
isismsilva Oct 17, 2024
434ebcf
fix macos version
isismsilva Oct 17, 2024
b1bbdcb
Merge commit 'b44fa1e3dbb91840c64fe180fd9ef9dc7d0d7625' into PBIOS-56…
isismsilva Oct 17, 2024
b8495bd
Merge branch 'PBIOS-569-typeahead-section-list' into typeahead-sectio…
isismsilva Oct 17, 2024
43be5ef
Merge branch 'main' into PBIOS-569-typeahead-section-list
isismsilva Oct 25, 2024
dd99c3c
Merge branch 'PBIOS-569-typeahead-section-list' into typeahead-sectio…
isismsilva Oct 28, 2024
3378cee
Merge branch 'main' into typeahead-section-buttons
isismsilva Dec 10, 2024
ff48760
removed warnings
isismsilva Dec 10, 2024
ac41531
turn data flat
isismsilva Dec 11, 2024
60c6a3f
removed duplicated code
isismsilva Dec 11, 2024
21f31ad
removed section from hover index
isismsilva Dec 11, 2024
5c08e05
wip
isismsilva Dec 16, 2024
de7694a
Fix show typeahead popover
isismsilva Dec 17, 2024
2a4d1e3
code polishes
isismsilva Dec 17, 2024
c065bc3
wip
isismsilva Dec 17, 2024
6e3a658
add list expanding logic.
isismsilva Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public struct PBToast: View {
if let dismiss = actionView {
switch dismiss {
case .withTimer(let time):
_ = DispatchQueue.main.asyncAfter(deadline: .now() + time) { dismissAction()
}
DispatchQueue.main.asyncAfter(deadline: .now() + time) { dismissAction() }
default: break
}
}
Expand Down
11 changes: 6 additions & 5 deletions Sources/Playbook/Components/Popover/PBPopover.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,27 @@ public struct Popover<T: View>: ViewModifier {
close: clickToClose
)
}
.onChange(of: isPresented) { newValue in
.onChange(of: isPresented) { _, newValue in
popoverManager.presentPopover(with: id, value: newValue)
updateViewFrame()
}
.onChange(of: popoverPosition) { position in
.onChange(of: popoverPosition) {
updateViewFrame()
}
.onChange(of: contentFrame) { frame in
.onChange(of: contentFrame) {
updateViewFrame()
}
.onChange(of: refreshView) { _ in
.onChange(of: refreshView) {
updateViewFrame()
}
.onChange(of: isHovering) { _ in
.onChange(of: isHovering) {
updateViewFrame()
}
.onReceive(popoverManager.$isPresented) { newValue in
if let value = newValue[id] {
isPresented = value
}
updateViewFrame()
}
.onDisappear {
isPresented = false
Expand Down
10 changes: 5 additions & 5 deletions Sources/Playbook/Components/Popover/Popover+Position.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public extension Position {
}

func calculateFrame(from originFrame: CGRect?, size: CGSize?) -> CGRect {
var popoverFrame = self.absoluteFrame(
let popoverFrame = self.absoluteFrame(
position: self,
originFrame: originFrame ?? .zero,
popoverSize: size ?? .zero
)
let screenEdgePadding = EdgeInsets(top: 8, leading: 8, bottom: 8, trailing: 8)
let safeWindowFrame = Screen.rect
let maxX = safeWindowFrame.maxX - screenEdgePadding.trailing
let maxY = safeWindowFrame.maxY - screenEdgePadding.bottom
// let screenEdgePadding = EdgeInsets(top: 8, leading: 8, bottom: 8, trailing: 8)
// let safeWindowFrame = Screen.rect
// let maxX = safeWindowFrame.maxX - screenEdgePadding.trailing
// let maxY = safeWindowFrame.maxY - screenEdgePadding.bottom
// #if os(macOS)
// if popoverFrame.origin.x < screenEdgePadding.leading {
// popoverFrame.origin.x = screenEdgePadding.leading
Expand Down
21 changes: 13 additions & 8 deletions Sources/Playbook/Components/Popover/PopoverManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,28 @@ public class PopoverManager: ObservableObject {
isPresented[id] = nil
}

func removeValues() {
popovers.removeAll()
isPresented.removeAll()
}

func presentPopover(with id: Int, value: Bool) {
isPresented.updateValue(value, forKey: id)
DispatchQueue.main.async {
self.isPresented.updateValue(value, forKey: id)
}
}

private func dismissPopover(with id: Int) {
isPresented[id] = false
}


func dismissPopovers() {
isPresented.keys.forEach {
isPresented[$0] = false
}
}

func updatePopover(with id: Int, view: AnyView, position: CGPoint?) {
if let popover = popovers.first(where: { $0.key == id })?.value, let position = position {
let newPopover = Popover(view: view, position: position, close: popover.close)
popovers.updateValue(newPopover, forKey: id)
DispatchQueue.main.async {
self.popovers.updateValue(newPopover, forKey: id)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public struct PBProgressStep: View {

public var body: some View {
progressVariantView
.onChange(of: progress) { newValue in
.onChange(of: progress) { _, newValue in
if newValue >= steps {
progress = steps
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Playbook/Components/Select/PBSelect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public struct PBSelect: View {
}
.buttonStyle(.plain)
.disabled(style == .disabled)
.onChange(of: selected, perform: { newValue in
.onChange(of: selected) { _, newValue in
selectedOption(newValue)
})
}

if let errorMessage = style.errorMessage {
Text(errorMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ extension PBSelectableCard {
}
}
}
.onChange(of: radioId) { newValue in
.onChange(of: radioId) { _, newValue in
isSelected = (newValue == id)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Playbook/Components/Text Area/PBTextArea.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public struct PBTextArea: View {
error = text.count >= maxCount ? message : nil
}
}
.onChange(of: text) { text in
.onChange(of: text) { _, text in
if case let .maxCharacterCountError(maxCount, message) = characterCount {
error = text.count >= maxCount ? message : nil
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Playbook/Components/Tooltip/PBTooltip.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public struct PBTooltip: ViewModifier {
if self.canPresent {
content
.onHover(disabled: false) { handleOnHover(hovering: $0) }
.onChange(of: shouldPresentPopover, perform: handleOnChange)
.onChange(of: shouldPresentPopover) { handleOnChange() }
.popover(isPresented: $presentPopover, arrowEdge: self.placement, content: { popoverView })
} else {
content
Expand All @@ -63,7 +63,7 @@ public extension PBTooltip {
shouldPresentPopover = hovering
}

private func handleOnChange(_: Bool) {
private func handleOnChange() {
if delay > 0.0 {
handleDelay
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private extension GridInputField {
.pbFont(.body, color: placeholderTextColor)
}
TextField("", text: $searchText)
.onChange(of: searchText) { _ in
.onChange(of: searchText) {
if searchText.first == " " {
searchText = searchText.replacingOccurrences(of: " ", with: "")
}
Expand Down
Loading