From 7b6334f28d7a1fd5a381ff66f73c60729bdfc3b7 Mon Sep 17 00:00:00 2001 From: vasavk Date: Wed, 13 Mar 2024 07:24:27 +0530 Subject: [PATCH 01/19] Digital ACT-191 ONEAPP-6827 story: added new breadcrumbItem component --- VDS.xcodeproj/project.pbxproj | 20 +++ .../Breadcrumbs/BreadcrumbCellItem.swift | 17 +++ .../Breadcrumbs/BreadcrumbItem.swift | 125 ++++++++++++++++++ VDS/Components/Breadcrumbs/Breadcrumbs.swift | 18 +++ 4 files changed, 180 insertions(+) create mode 100644 VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift create mode 100644 VDS/Components/Breadcrumbs/BreadcrumbItem.swift create mode 100644 VDS/Components/Breadcrumbs/Breadcrumbs.swift diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index 366fca71..66ac0ba3 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -7,8 +7,11 @@ objects = { /* Begin PBXBuildFile section */ + 1832AC572BA0791D008AE476 /* BreadcrumbCellItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC562BA0791D008AE476 /* BreadcrumbCellItem.swift */; }; 186B2A8A2B88DA7F001AB71F /* TextAreaChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = 186B2A892B88DA7F001AB71F /* TextAreaChangeLog.txt */; }; 18792A902B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18792A8F2B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift */; }; + 18A65A022B96E848006602CC /* Breadcrumbs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A65A012B96E848006602CC /* Breadcrumbs.swift */; }; + 18A65A042B96F050006602CC /* BreadcrumbItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A65A032B96F050006602CC /* BreadcrumbItem.swift */; }; 18BDEE822B75316E00452358 /* ButtonIconChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = 18BDEE812B75316E00452358 /* ButtonIconChangeLog.txt */; }; 445BA07829C07B3D0036A7C5 /* Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 445BA07729C07B3D0036A7C5 /* Notification.swift */; }; 44604AD429CE186A00E62B51 /* NotificationButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD329CE186A00E62B51 /* NotificationButtonModel.swift */; }; @@ -175,8 +178,11 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 1832AC562BA0791D008AE476 /* BreadcrumbCellItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbCellItem.swift; sourceTree = ""; }; 186B2A892B88DA7F001AB71F /* TextAreaChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = TextAreaChangeLog.txt; sourceTree = ""; }; 18792A8F2B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonIconBadgeIndicatorModel.swift; sourceTree = ""; }; + 18A65A012B96E848006602CC /* Breadcrumbs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Breadcrumbs.swift; sourceTree = ""; }; + 18A65A032B96F050006602CC /* BreadcrumbItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbItem.swift; sourceTree = ""; }; 18BDEE812B75316E00452358 /* ButtonIconChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = ButtonIconChangeLog.txt; sourceTree = ""; }; 445BA07729C07B3D0036A7C5 /* Notification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notification.swift; sourceTree = ""; }; 44604AD329CE186A00E62B51 /* NotificationButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationButtonModel.swift; sourceTree = ""; }; @@ -356,6 +362,16 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 18A65A002B96E7E1006602CC /* Breadcrumbs */ = { + isa = PBXGroup; + children = ( + 18A65A012B96E848006602CC /* Breadcrumbs.swift */, + 18A65A032B96F050006602CC /* BreadcrumbItem.swift */, + 1832AC562BA0791D008AE476 /* BreadcrumbCellItem.swift */, + ); + path = Breadcrumbs; + sourceTree = ""; + }; 445BA07629C07ABA0036A7C5 /* Notification */ = { isa = PBXGroup; children = ( @@ -489,6 +505,7 @@ children = ( EA4DB2FE28DCBC1900103EE3 /* Badge */, EAD062AE2A3B87210015965D /* BadgeIndicator */, + 18A65A002B96E7E1006602CC /* Breadcrumbs */, EA0FC2BE2912D18200DF80B4 /* Buttons */, EAF7F092289985E200B287F5 /* Checkbox */, EA985BF3296C609E00F2FF2E /* Icon */, @@ -994,10 +1011,12 @@ EAF7F0A6289B0CE000B287F5 /* Resetable.swift in Sources */, EA985C2D296F03FE00F2FF2E /* TileletIconModels.swift in Sources */, EA89200428AECF4B006B9984 /* UITextField+Publisher.swift in Sources */, + 18A65A022B96E848006602CC /* Breadcrumbs.swift in Sources */, EA0D1C3F2A6AD5E200E5C127 /* Typography+ContentSizeCategory.swift in Sources */, EA5F86C82A1BD99100BC83E4 /* TabModel.swift in Sources */, EA0D1C432A6AD70900E5C127 /* VDSTypography.swift in Sources */, EA297A5729FB0A360031ED56 /* AppleGuidelinesTouchable.swift in Sources */, + 1832AC572BA0791D008AE476 /* BreadcrumbCellItem.swift in Sources */, EA3361C328902D960071C351 /* Toggle.swift in Sources */, EAF7F0A0289AB7EC00B287F5 /* View.swift in Sources */, EA89201328B568D8006B9984 /* RadioBoxItem.swift in Sources */, @@ -1005,6 +1024,7 @@ EA3362402892EF6C0071C351 /* Label.swift in Sources */, EAB2376229E9880400AABE9A /* TrailingTooltipLabel.swift in Sources */, EAB2376A29E9E59100AABE9A /* TooltipLaunchable.swift in Sources */, + 18A65A042B96F050006602CC /* BreadcrumbItem.swift in Sources */, EAB2375D29E8789100AABE9A /* Tooltip.swift in Sources */, 71BFA70A2B7F70E6000DCE33 /* Dropshadowable.swift in Sources */, EA0D1C452A6AD73000E5C127 /* RawRepresentable.swift in Sources */, diff --git a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift new file mode 100644 index 00000000..5bb6b03a --- /dev/null +++ b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift @@ -0,0 +1,17 @@ +// +// BreadcrumbCellItem.swift +// VDS +// +// Created by Kanamarlapudi, Vasavi on 11/03/24. +// + +import UIKit +import VDSColorTokens + +///This is customised view for Breadcrumb cell item +final class BreadcrumbCellItem: UICollectionViewCell { + + ///Identifier for the PaginationCellItem + static let identifier: String = String(describing: BreadcrumbCellItem.self) + +} diff --git a/VDS/Components/Breadcrumbs/BreadcrumbItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbItem.swift new file mode 100644 index 00000000..ac8951cb --- /dev/null +++ b/VDS/Components/Breadcrumbs/BreadcrumbItem.swift @@ -0,0 +1,125 @@ +// +// BreadcrumbItem.swift +// VDS +// +// Created by Kanamarlapudi, Vasavi on 05/03/24. +// + +import Foundation +import VDSColorTokens +import VDSFormControlsTokens +import Combine + +/// A Breadcrumb Item contains href(link) and selected flag. +/// Breadcrumb links to its respective page if it is not disabled. +/// Breadcrumb contains text with a separator by default, highlights text in bold without a separator if selected. +@objc (VDSBreadcrumbItem) +open class BreadcrumbItem: ButtonBase { + + //-------------------------------------------------- + // MARK: - Initializers + //-------------------------------------------------- + required public init() { + super.init(frame: .zero) + } + + public override init(frame: CGRect) { + super.init(frame: .zero) + } + + public required init?(coder: NSCoder) { + super.init(coder: coder) + } + + //-------------------------------------------------- + // MARK: - Public Properties + //-------------------------------------------------- + /// The Breadcrumb link to links to its respective page. + open var link: String? { didSet { setNeedsUpdate() } } + + /// TextStyle used on the titleLabel. + open override var textStyle: TextStyle { isSelected ? TextStyle.boldBodySmall : TextStyle.bodySmall } + + /// If true, it will be rendered as selected. + open var selectable: Bool = false { + didSet { + //update selected state + if selectable{ + isSelected = true + } else { + isSelected = false + } + setNeedsUpdate() + } + } + + /// UIColor used on the titleLabel text. + open override var textColor: UIColor { + textColorConfiguration.getColor(self) + } + + /// The natural size for the receiving view, considering only properties of the view itself. + open override var intrinsicContentSize: CGSize { + return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize + } + + //-------------------------------------------------- + // MARK: - Private Properties + //-------------------------------------------------- + var separator = " /" + + private var textColorConfiguration = ControlColorConfiguration().with { + $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .normal) + $0.setSurfaceColors(VDSColor.interactiveActiveOnlight, VDSColor.interactiveActiveOndark, forState: .highlighted) + $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .selected) + } + + //-------------------------------------------------- + // MARK: - Overrides + //-------------------------------------------------- + /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. + open override func setup() { + super.setup() + isAccessibilityElement = true + accessibilityTraits = .button + accessibilityLabel = "Breadcrumb" + } + + /// Used to make changes to the View based off a change events or from local properties. + open override func updateView() { + //always call last so the label is rendered + if (text != nil) { + var newText: String = text ?? "" + if isSelected { + if newText.contains(separator) { + let result = newText.dropLast(2) + newText = String(result) + } + } else { + if !newText.contains(separator) { + newText = (text ?? "") + separator + } + } + print("newText:\(newText), isSelected: \(isSelected)") + text = newText + if let titleLabel { + titleLabel.text = text + } + } + super.updateView() + + } + + /// Resets to default settings. + open override func reset() { + super.reset() + shouldUpdateView = false + text = nil + link = nil + accessibilityCustomActions = [] + isAccessibilityElement = true + accessibilityTraits = .button + shouldUpdateView = true + setNeedsUpdate() + } +} diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift new file mode 100644 index 00000000..a8269ac9 --- /dev/null +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -0,0 +1,18 @@ +// +// Breadcrumbs.swift +// VDS +// +// Created by Kanamarlapudi, Vasavi on 11/03/24. +// + +import Foundation +import VDSColorTokens +import Combine + +/// A Breadcrumbs contains BreadcrumbItems. +/// It contains Breadcrumb Item Default, Breadcrumb Item Selected, Separator. +/// Breadcrumbs are secondary navigation that use a hierarchy of internal links to tell customers where they are in an experience. Each breadcrumb links to its respective page, except for that of current page. +@objc(VDSBreadcrumbs) +open class Breadcrumbs: View { + +} From 28e9f79f40e9cd10c75b45423a3513b05b0473b0 Mon Sep 17 00:00:00 2001 From: vasavk Date: Wed, 13 Mar 2024 07:33:36 +0530 Subject: [PATCH 02/19] Digital ACT-191 ONEAPP-6827 story: added Breadcrumbs in VDS.md --- VDS/VDS.docc/VDS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/VDS/VDS.docc/VDS.md b/VDS/VDS.docc/VDS.md index 8beb9255..6b6dbeb6 100755 --- a/VDS/VDS.docc/VDS.md +++ b/VDS/VDS.docc/VDS.md @@ -21,6 +21,7 @@ Using the system allows designers and developers to collaborate more easily and ### Components - ``Badge`` - ``BadgeIndicator`` +- ``Breadcrumbs`` - ``Button`` - ``ButtonIcon`` - ``ButtonGroup`` From 663b1b1fede334e29432a5c02e882a6f2115ecc6 Mon Sep 17 00:00:00 2001 From: vasavk Date: Wed, 13 Mar 2024 16:41:21 +0530 Subject: [PATCH 03/19] Digital ACT-191 ONEAPP-6827 story: added Breadcrumbs change log, modified BreadcrumbCellItem --- VDS.xcodeproj/project.pbxproj | 4 + .../Breadcrumbs/BreadcrumbCellItem.swift | 68 +++++++++++++- VDS/Components/Breadcrumbs/Breadcrumbs.swift | 94 +++++++++++++++++++ .../Breadcrumbs/BreadcrumbsChangeLog.txt | 36 +++++++ 4 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 VDS/Components/Breadcrumbs/BreadcrumbsChangeLog.txt diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index 66ac0ba3..c86f3116 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 1832AC572BA0791D008AE476 /* BreadcrumbCellItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC562BA0791D008AE476 /* BreadcrumbCellItem.swift */; }; + 18450CF12BA1B19C009FDF2A /* BreadcrumbsChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = 18450CF02BA1B19C009FDF2A /* BreadcrumbsChangeLog.txt */; }; 186B2A8A2B88DA7F001AB71F /* TextAreaChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = 186B2A892B88DA7F001AB71F /* TextAreaChangeLog.txt */; }; 18792A902B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18792A8F2B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift */; }; 18A65A022B96E848006602CC /* Breadcrumbs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A65A012B96E848006602CC /* Breadcrumbs.swift */; }; @@ -179,6 +180,7 @@ /* Begin PBXFileReference section */ 1832AC562BA0791D008AE476 /* BreadcrumbCellItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbCellItem.swift; sourceTree = ""; }; + 18450CF02BA1B19C009FDF2A /* BreadcrumbsChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = BreadcrumbsChangeLog.txt; sourceTree = ""; }; 186B2A892B88DA7F001AB71F /* TextAreaChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = TextAreaChangeLog.txt; sourceTree = ""; }; 18792A8F2B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonIconBadgeIndicatorModel.swift; sourceTree = ""; }; 18A65A012B96E848006602CC /* Breadcrumbs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Breadcrumbs.swift; sourceTree = ""; }; @@ -368,6 +370,7 @@ 18A65A012B96E848006602CC /* Breadcrumbs.swift */, 18A65A032B96F050006602CC /* BreadcrumbItem.swift */, 1832AC562BA0791D008AE476 /* BreadcrumbCellItem.swift */, + 18450CF02BA1B19C009FDF2A /* BreadcrumbsChangeLog.txt */, ); path = Breadcrumbs; sourceTree = ""; @@ -982,6 +985,7 @@ 18BDEE822B75316E00452358 /* ButtonIconChangeLog.txt in Resources */, EA3362062891E14D0071C351 /* VerizonNHGeTX-Regular.otf in Resources */, EA3362052891E14D0071C351 /* VerizonNHGeDS-Bold.otf in Resources */, + 18450CF12BA1B19C009FDF2A /* BreadcrumbsChangeLog.txt in Resources */, EAEEECA02B1F908200531FC2 /* BadgeIndicatorChangeLog.txt in Resources */, EAA5EEB928ECD24B003B3210 /* Icons.xcassets in Resources */, EAEEECA92B1F969700531FC2 /* TooltipChangeLog.txt in Resources */, diff --git a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift index 5bb6b03a..91cd9945 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift @@ -11,7 +11,73 @@ import VDSColorTokens ///This is customised view for Breadcrumb cell item final class BreadcrumbCellItem: UICollectionViewCell { - ///Identifier for the PaginationCellItem + ///Identifier for the BreadcrumbCellItem static let identifier: String = String(describing: BreadcrumbCellItem.self) + + //-------------------------------------------------- + // MARK: - Private Properties + //-------------------------------------------------- + + internal var stackView: UIStackView = { + return UIStackView().with { + $0.translatesAutoresizingMaskIntoConstraints = false + $0.axis = .horizontal + $0.distribution = .fill + $0.alignment = .top + } + }() + + internal var breadcrumb = BreadcrumbItem().with { + $0.translatesAutoresizingMaskIntoConstraints = false + $0.titleLabel?.numberOfLines = 0 + } + + ///separator label + private var separator: Label = Label().with { + $0.translatesAutoresizingMaskIntoConstraints = false + $0.textAlignment = .left + $0.numberOfLines = 0 + $0.text = "/" + } + + private let textColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark) + //-------------------------------------------------- + // MARK: - Initializers + //-------------------------------------------------- + override init(frame: CGRect) { + super.init(frame: frame) + setUp() + } + + required init?(coder: NSCoder) { + super.init(coder: coder) + setUp() + } + + ///Configuring the cell with default setup + private func setUp() { + //add stackview + //this is the horizontal stack that contains breadcrumb and separator + stackView.addArrangedSubview(breadcrumb) + stackView.addArrangedSubview(separator) + stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: breadcrumb) + stackView + .pinTop() + .pinLeading() + .pinTrailing(0, .defaultHigh) + .pinBottom(0, .defaultHigh) + contentView.addSubview(stackView) + separator.backgroundColor = .clear + + stackView.backgroundColor = .red + breadcrumb.backgroundColor = .green + separator.backgroundColor = .yellow + } + + ///Updating UI based on selected index, current index along with surface + func update(_ selectedIndex: Int, currentIndex: Int, surface: Surface, showSlash: Bool) { + separator.textColor = textColorConfiguration.getColor(surface) + separator.isHidden = showSlash + } } diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift index a8269ac9..4777d3c6 100644 --- a/VDS/Components/Breadcrumbs/Breadcrumbs.swift +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -15,4 +15,98 @@ import Combine @objc(VDSBreadcrumbs) open class Breadcrumbs: View { + //-------------------------------------------------- + // MARK: - Private Properties + //-------------------------------------------------- + ///Collectionview width anchor + private var collectionViewWidthAnchor: NSLayoutConstraint? + ///Selected page index + private var _selectedPageIndex: Int = 0 + ///A root view for the Breadcrumbs + private let containerView: View = View().with { + $0.translatesAutoresizingMaskIntoConstraints = false + } + + let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout() + + ///Collectionview to render Breadcrumbs indexes + private lazy var collectionView: UICollectionView = { + let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) + layout.itemSize = CGSize(width: 50, height: 25) + layout.minimumInteritemSpacing = VDSLayout.Spacing.space1X.value + collectionView.isScrollEnabled = false + collectionView.translatesAutoresizingMaskIntoConstraints = false + collectionView.delegate = self + collectionView.dataSource = self + collectionView.showsHorizontalScrollIndicator = false + collectionView.showsVerticalScrollIndicator = false + collectionView.register(BreadcrumbCellItem.self, forCellWithReuseIdentifier: BreadcrumbCellItem.identifier) + collectionView.backgroundColor = .clear + return collectionView + }() + + + //-------------------------------------------------- + // MARK: - Public Properties + //-------------------------------------------------- +// /// Array of Breadcrumb Items Titles that are shown as Breadcrumbs. +// open var breadcrumbs: [String?] = [] { didSet { setNeedsUpdate() } } + + /// Array of Breadcrumb Items that are shown in the group. + open var breadcrumbItems: [ButtonBase] = [] { didSet { setNeedsUpdate() } } + + /// Whether this object is enabled or not + open var selected: Bool = false { didSet { setNeedsUpdate() } } + + /// Current Surface and this is used to pass down to child objects that implement Surfacable + override open var surface: Surface { + didSet { + breadcrumbItems.forEach { $0.surface = surface } + } + } + + //-------------------------------------------------- + // MARK: - Overrides + //-------------------------------------------------- + /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. + open override func setup() { + super.setup() + } + + /// Executed on initialization for this View. + open override func initialSetup() { + super.initialSetup() + } + + /// Resets to default settings. + open override func reset() { + super.reset() + setNeedsUpdate() + } + + /// Used to make changes to the View based off a change events or from local properties. + open override func updateView() { + super.updateView() + } +} + +extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { + //-------------------------------------------------- + // MARK: - UICollectionView Delegate & Datasource + //-------------------------------------------------- + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { breadcrumbItems.count } + + public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: BreadcrumbCellItem.identifier, for: indexPath) as? BreadcrumbCellItem else { return UICollectionViewCell() } + + var showSlash = (indexPath.row == (breadcrumbItems.count - 1)) + cell.update(_selectedPageIndex, currentIndex: indexPath.row, surface: surface, showSlash: showSlash) + return cell + } + + public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { +// _selectedPageIndex = indexPath.row +// updateSelection() +// onPageDidSelect?(selectedPage) + } } diff --git a/VDS/Components/Breadcrumbs/BreadcrumbsChangeLog.txt b/VDS/Components/Breadcrumbs/BreadcrumbsChangeLog.txt new file mode 100644 index 00000000..3fae7754 --- /dev/null +++ b/VDS/Components/Breadcrumbs/BreadcrumbsChangeLog.txt @@ -0,0 +1,36 @@ +MM/DD/YYYY +---------------- +- Initial Brand 3.0 handoff + +12/17/2021 +---------------- +- Replaced focusring colors (previously interactive/onlight/ondark) with accessibility/onlight/ondark colors +- Updated focus border name (previously interactive.focusring.onlight) with focusring.onlight/ondark + +2/28/2022 +---------------- +- Changed Last Breadcrumb Item to Selected Item + +03/08/2022 +---------------- +- Added dev note for Active and Hover states. + +08/04/2022 +---------------- +- Updated default and inverted prop to light and dark surface. + +11/30/2022 +---------------- +- Added "(web only)" to any instance of "keyboard focus" + +12/13/2022 +---------------- +- Replaced focus border pixel and style & spacing values with tokens. + +01/03/2022 +---------------- +- Updated Specs to use new SPEC Templates and SPEC DOC Components. + +01/06/2023 +---------------- +- Tweaked anatomy element naming to align with design doc and dev doc From f25e9af766b216724ae882c8fb27a4e9c3252d6f Mon Sep 17 00:00:00 2001 From: vasavk Date: Wed, 13 Mar 2024 17:50:19 +0530 Subject: [PATCH 04/19] Digital ACT-191 ONEAPP-6827 story: minor changes to see form fields --- VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift | 7 +++---- VDS/Components/Breadcrumbs/Breadcrumbs.swift | 9 ++++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift index 91cd9945..74e35961 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift @@ -17,7 +17,6 @@ final class BreadcrumbCellItem: UICollectionViewCell { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- - internal var stackView: UIStackView = { return UIStackView().with { $0.translatesAutoresizingMaskIntoConstraints = false @@ -70,9 +69,9 @@ final class BreadcrumbCellItem: UICollectionViewCell { contentView.addSubview(stackView) separator.backgroundColor = .clear - stackView.backgroundColor = .red - breadcrumb.backgroundColor = .green - separator.backgroundColor = .yellow +// stackView.backgroundColor = .red +// breadcrumb.backgroundColor = .green +// separator.backgroundColor = .yellow } ///Updating UI based on selected index, current index along with surface diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift index 4777d3c6..cfef9936 100644 --- a/VDS/Components/Breadcrumbs/Breadcrumbs.swift +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -76,6 +76,13 @@ open class Breadcrumbs: View { /// Executed on initialization for this View. open override func initialSetup() { super.initialSetup() + + addSubview(containerView) + containerView.pinToSuperView() + //for TEST + containerView.widthAnchor.constraint(greaterThanOrEqualToConstant: 288).activate() + containerView.heightAnchor.constraint(equalToConstant: 150).activate() + containerView.addSubview(collectionView) } /// Resets to default settings. @@ -99,7 +106,7 @@ extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource, UIC public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: BreadcrumbCellItem.identifier, for: indexPath) as? BreadcrumbCellItem else { return UICollectionViewCell() } - var showSlash = (indexPath.row == (breadcrumbItems.count - 1)) + let showSlash = (indexPath.row == (breadcrumbItems.count - 1)) cell.update(_selectedPageIndex, currentIndex: indexPath.row, surface: surface, showSlash: showSlash) return cell } From 812fac5a597be52e41f13cbb71b797f317ece61b Mon Sep 17 00:00:00 2001 From: vasavk Date: Thu, 14 Mar 2024 12:15:36 +0530 Subject: [PATCH 05/19] Digital ACT-191 ONEAPP-6827 story: updating cell data --- .../Breadcrumbs/BreadcrumbCellItem.swift | 41 ++++++++++------ .../Breadcrumbs/BreadcrumbItem.swift | 36 +++++++------- VDS/Components/Breadcrumbs/Breadcrumbs.swift | 48 ++++++++----------- 3 files changed, 64 insertions(+), 61 deletions(-) diff --git a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift index 74e35961..c5175001 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift @@ -13,16 +13,28 @@ final class BreadcrumbCellItem: UICollectionViewCell { ///Identifier for the BreadcrumbCellItem static let identifier: String = String(describing: BreadcrumbCellItem.self) - + //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- + internal var crumbWidthConstraint: NSLayoutConstraint? + + var crumb : BreadcrumbItem? { + didSet { + guard let crumb = crumb else { return } + breadcrumb = crumb + crumbWidthConstraint?.constant = crumb.intrinsicContentSize.width + crumbWidthConstraint?.isActive = true + } + } + internal var stackView: UIStackView = { return UIStackView().with { $0.translatesAutoresizingMaskIntoConstraints = false $0.axis = .horizontal $0.distribution = .fill $0.alignment = .top + $0.spacing = VDSLayout.Spacing.space1X.value } }() @@ -41,6 +53,12 @@ final class BreadcrumbCellItem: UICollectionViewCell { private let textColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark) + private var crumbTextColorConfiguration = ControlColorConfiguration().with { + $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .normal) + $0.setSurfaceColors(VDSColor.interactiveActiveOnlight, VDSColor.interactiveActiveOndark, forState: .highlighted) + $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .selected) + } + //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- @@ -56,27 +74,22 @@ final class BreadcrumbCellItem: UICollectionViewCell { ///Configuring the cell with default setup private func setUp() { - //add stackview - //this is the horizontal stack that contains breadcrumb and separator + //add stackview - this is the horizontal stack that contains breadcrumb and separator stackView.addArrangedSubview(breadcrumb) + crumbWidthConstraint = breadcrumb.widthAnchor.constraint(greaterThanOrEqualToConstant: 0).activate() stackView.addArrangedSubview(separator) stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: breadcrumb) - stackView - .pinTop() - .pinLeading() - .pinTrailing(0, .defaultHigh) - .pinBottom(0, .defaultHigh) + stackView.pinToSuperView() contentView.addSubview(stackView) separator.backgroundColor = .clear - -// stackView.backgroundColor = .red -// breadcrumb.backgroundColor = .green -// separator.backgroundColor = .yellow } ///Updating UI based on selected index, current index along with surface - func update(_ selectedIndex: Int, currentIndex: Int, surface: Surface, showSlash: Bool) { + func update(surface: Surface, hideSlash: Bool, breadCrumbItem: BreadcrumbItem) { + breadcrumb = breadCrumbItem + breadcrumb.text = breadCrumbItem.text separator.textColor = textColorConfiguration.getColor(surface) - separator.isHidden = showSlash + separator.isHidden = hideSlash + print("selected: \(breadcrumb.isSelected), hideSlash: \(hideSlash), text: \(String(describing: breadCrumbItem.text)))") } } diff --git a/VDS/Components/Breadcrumbs/BreadcrumbItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbItem.swift index ac8951cb..a5972496 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbItem.swift @@ -88,24 +88,24 @@ open class BreadcrumbItem: ButtonBase { /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { //always call last so the label is rendered - if (text != nil) { - var newText: String = text ?? "" - if isSelected { - if newText.contains(separator) { - let result = newText.dropLast(2) - newText = String(result) - } - } else { - if !newText.contains(separator) { - newText = (text ?? "") + separator - } - } - print("newText:\(newText), isSelected: \(isSelected)") - text = newText - if let titleLabel { - titleLabel.text = text - } - } +// if (text != nil) { +// var newText: String = text ?? "" +// if isSelected { +// if newText.contains(separator) { +// let result = newText.dropLast(2) +// newText = String(result) +// } +// } else { +// if !newText.contains(separator) { +// newText = (text ?? "") + separator +// } +// } +// print("newText:\(newText), isSelected: \(isSelected)") +// text = newText +// if let titleLabel { +// titleLabel.text = text +// } +// } super.updateView() } diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift index cfef9936..d6325629 100644 --- a/VDS/Components/Breadcrumbs/Breadcrumbs.swift +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -18,21 +18,11 @@ open class Breadcrumbs: View { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- - ///Collectionview width anchor - private var collectionViewWidthAnchor: NSLayoutConstraint? - ///Selected page index - private var _selectedPageIndex: Int = 0 - ///A root view for the Breadcrumbs - private let containerView: View = View().with { - $0.translatesAutoresizingMaskIntoConstraints = false - } - let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout() ///Collectionview to render Breadcrumbs indexes private lazy var collectionView: UICollectionView = { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) - layout.itemSize = CGSize(width: 50, height: 25) layout.minimumInteritemSpacing = VDSLayout.Spacing.space1X.value collectionView.isScrollEnabled = false collectionView.translatesAutoresizingMaskIntoConstraints = false @@ -49,15 +39,15 @@ open class Breadcrumbs: View { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- -// /// Array of Breadcrumb Items Titles that are shown as Breadcrumbs. -// open var breadcrumbs: [String?] = [] { didSet { setNeedsUpdate() } } - /// Array of Breadcrumb Items that are shown in the group. open var breadcrumbItems: [ButtonBase] = [] { didSet { setNeedsUpdate() } } /// Whether this object is enabled or not - open var selected: Bool = false { didSet { setNeedsUpdate() } } - + override open var isEnabled: Bool { + didSet { + breadcrumbItems.forEach { $0.isEnabled = isEnabled } + } + } /// Current Surface and this is used to pass down to child objects that implement Surfacable override open var surface: Surface { didSet { @@ -76,13 +66,9 @@ open class Breadcrumbs: View { /// Executed on initialization for this View. open override func initialSetup() { super.initialSetup() - - addSubview(containerView) - containerView.pinToSuperView() - //for TEST - containerView.widthAnchor.constraint(greaterThanOrEqualToConstant: 288).activate() - containerView.heightAnchor.constraint(equalToConstant: 150).activate() - containerView.addSubview(collectionView) + addSubview(collectionView) + collectionView.pinToSuperView() + collectionView.heightAnchor.constraint(equalToConstant: 100).activate() } /// Resets to default settings. @@ -94,6 +80,7 @@ open class Breadcrumbs: View { /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() + collectionView.reloadData() } } @@ -101,19 +88,22 @@ extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource, UIC //-------------------------------------------------- // MARK: - UICollectionView Delegate & Datasource //-------------------------------------------------- - public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { breadcrumbItems.count } + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { breadcrumbItems.count + } public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: BreadcrumbCellItem.identifier, for: indexPath) as? BreadcrumbCellItem else { return UICollectionViewCell() } - - let showSlash = (indexPath.row == (breadcrumbItems.count - 1)) - cell.update(_selectedPageIndex, currentIndex: indexPath.row, surface: surface, showSlash: showSlash) + let breadcrumb : BreadcrumbItem = breadcrumbItems[indexPath.row] as! BreadcrumbItem + let hideSlash = (indexPath.row == (breadcrumbItems.count - 1)) + cell.crumb = breadcrumb + cell.update(surface: surface, hideSlash: hideSlash, breadCrumbItem: breadcrumb) return cell } + public func collectionView(_ collectionView: UICollectionView, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize { + breadcrumbItems[indexPath.row].intrinsicContentSize + } + public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { -// _selectedPageIndex = indexPath.row -// updateSelection() -// onPageDidSelect?(selectedPage) } } From a39e08871156b9bd853e00ad18f693884493d2c5 Mon Sep 17 00:00:00 2001 From: Krishna Kishore Bandaru Date: Thu, 14 Mar 2024 13:02:32 +0530 Subject: [PATCH 06/19] Digital ACT-191 ONEAPP-6827 story: fixed layout issues --- .../Breadcrumbs/BreadcrumbCellItem.swift | 41 ++++++++++++------- VDS/Components/Breadcrumbs/Breadcrumbs.swift | 18 ++++---- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift index c5175001..c9d66327 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift @@ -22,7 +22,7 @@ final class BreadcrumbCellItem: UICollectionViewCell { var crumb : BreadcrumbItem? { didSet { guard let crumb = crumb else { return } - breadcrumb = crumb + breadCrumbItem = crumb crumbWidthConstraint?.constant = crumb.intrinsicContentSize.width crumbWidthConstraint?.isActive = true } @@ -33,15 +33,12 @@ final class BreadcrumbCellItem: UICollectionViewCell { $0.translatesAutoresizingMaskIntoConstraints = false $0.axis = .horizontal $0.distribution = .fill - $0.alignment = .top + $0.alignment = .fill $0.spacing = VDSLayout.Spacing.space1X.value } }() - internal var breadcrumb = BreadcrumbItem().with { - $0.translatesAutoresizingMaskIntoConstraints = false - $0.titleLabel?.numberOfLines = 0 - } + internal var breadCrumbItem: BreadcrumbItem? ///separator label private var separator: Label = Label().with { @@ -74,22 +71,36 @@ final class BreadcrumbCellItem: UICollectionViewCell { ///Configuring the cell with default setup private func setUp() { - //add stackview - this is the horizontal stack that contains breadcrumb and separator - stackView.addArrangedSubview(breadcrumb) - crumbWidthConstraint = breadcrumb.widthAnchor.constraint(greaterThanOrEqualToConstant: 0).activate() - stackView.addArrangedSubview(separator) - stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: breadcrumb) - stackView.pinToSuperView() contentView.addSubview(stackView) + stackView.pinToSuperView() separator.backgroundColor = .clear } ///Updating UI based on selected index, current index along with surface func update(surface: Surface, hideSlash: Bool, breadCrumbItem: BreadcrumbItem) { - breadcrumb = breadCrumbItem - breadcrumb.text = breadCrumbItem.text + stackView.removeAllArrangedSubviews() + stackView.addArrangedSubview(separator) + stackView.addArrangedSubview(breadCrumbItem) + stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: breadCrumbItem) separator.textColor = textColorConfiguration.getColor(surface) separator.isHidden = hideSlash - print("selected: \(breadcrumb.isSelected), hideSlash: \(hideSlash), text: \(String(describing: breadCrumbItem.text)))") + print("selected: \(breadCrumbItem.isSelected), hideSlash: \(hideSlash), text: \(String(describing: breadCrumbItem.text)))") + self.breadCrumbItem = breadCrumbItem + layoutIfNeeded() + } +} + +extension UIStackView { + + @discardableResult + func removeAllArrangedSubviews() -> [UIView] { + return arrangedSubviews.reduce([UIView]()) { $0 + [removeArrangedSubViewProperly($1)] } + } + + func removeArrangedSubViewProperly(_ view: UIView) -> UIView { + removeArrangedSubview(view) + NSLayoutConstraint.deactivate(view.constraints) + view.removeFromSuperview() + return view } } diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift index d6325629..cd48c012 100644 --- a/VDS/Components/Breadcrumbs/Breadcrumbs.swift +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -18,12 +18,17 @@ open class Breadcrumbs: View { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- - let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout() + let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout().with { + $0.estimatedItemSize = UICollectionViewFlowLayout.automaticSize + $0.minimumInteritemSpacing = VDSLayout.Spacing.space1X.value + $0.minimumLineSpacing = VDSLayout.Spacing.space1X.value + $0.sectionInset = .zero + $0.scrollDirection = .vertical + } ///Collectionview to render Breadcrumbs indexes private lazy var collectionView: UICollectionView = { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) - layout.minimumInteritemSpacing = VDSLayout.Spacing.space1X.value collectionView.isScrollEnabled = false collectionView.translatesAutoresizingMaskIntoConstraints = false collectionView.delegate = self @@ -84,7 +89,7 @@ open class Breadcrumbs: View { } } -extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { +extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource { //-------------------------------------------------- // MARK: - UICollectionView Delegate & Datasource //-------------------------------------------------- @@ -94,16 +99,11 @@ extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource, UIC public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: BreadcrumbCellItem.identifier, for: indexPath) as? BreadcrumbCellItem else { return UICollectionViewCell() } let breadcrumb : BreadcrumbItem = breadcrumbItems[indexPath.row] as! BreadcrumbItem - let hideSlash = (indexPath.row == (breadcrumbItems.count - 1)) - cell.crumb = breadcrumb + let hideSlash = (indexPath.row == 0) cell.update(surface: surface, hideSlash: hideSlash, breadCrumbItem: breadcrumb) return cell } - public func collectionView(_ collectionView: UICollectionView, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize { - breadcrumbItems[indexPath.row].intrinsicContentSize - } - public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { } } From 2703112148b2631611e4eb2d7a9eecfb36a79847 Mon Sep 17 00:00:00 2001 From: vasavk Date: Thu, 14 Mar 2024 15:05:01 +0530 Subject: [PATCH 07/19] Digital ACT-191 ONEAPP-6827 story: removed unused and commented code --- .../Breadcrumbs/BreadcrumbCellItem.swift | 22 +--------- .../Breadcrumbs/BreadcrumbItem.swift | 20 --------- VDS/Components/Breadcrumbs/Breadcrumbs.swift | 44 +++++++++---------- 3 files changed, 23 insertions(+), 63 deletions(-) diff --git a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift index c9d66327..84111e11 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift @@ -17,17 +17,6 @@ final class BreadcrumbCellItem: UICollectionViewCell { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- - internal var crumbWidthConstraint: NSLayoutConstraint? - - var crumb : BreadcrumbItem? { - didSet { - guard let crumb = crumb else { return } - breadCrumbItem = crumb - crumbWidthConstraint?.constant = crumb.intrinsicContentSize.width - crumbWidthConstraint?.isActive = true - } - } - internal var stackView: UIStackView = { return UIStackView().with { $0.translatesAutoresizingMaskIntoConstraints = false @@ -50,12 +39,6 @@ final class BreadcrumbCellItem: UICollectionViewCell { private let textColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark) - private var crumbTextColorConfiguration = ControlColorConfiguration().with { - $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .normal) - $0.setSurfaceColors(VDSColor.interactiveActiveOnlight, VDSColor.interactiveActiveOndark, forState: .highlighted) - $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .selected) - } - //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- @@ -76,15 +59,14 @@ final class BreadcrumbCellItem: UICollectionViewCell { separator.backgroundColor = .clear } - ///Updating UI based on selected index, current index along with surface + ///Updating the breadCrumbItem and UI based on the selected flag along with the surface func update(surface: Surface, hideSlash: Bool, breadCrumbItem: BreadcrumbItem) { stackView.removeAllArrangedSubviews() stackView.addArrangedSubview(separator) stackView.addArrangedSubview(breadCrumbItem) - stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: breadCrumbItem) + stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: separator) separator.textColor = textColorConfiguration.getColor(surface) separator.isHidden = hideSlash - print("selected: \(breadCrumbItem.isSelected), hideSlash: \(hideSlash), text: \(String(describing: breadCrumbItem.text)))") self.breadCrumbItem = breadCrumbItem layoutIfNeeded() } diff --git a/VDS/Components/Breadcrumbs/BreadcrumbItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbItem.swift index a5972496..856099b8 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbItem.swift @@ -66,8 +66,6 @@ open class BreadcrumbItem: ButtonBase { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- - var separator = " /" - private var textColorConfiguration = ControlColorConfiguration().with { $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .normal) $0.setSurfaceColors(VDSColor.interactiveActiveOnlight, VDSColor.interactiveActiveOndark, forState: .highlighted) @@ -88,24 +86,6 @@ open class BreadcrumbItem: ButtonBase { /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { //always call last so the label is rendered -// if (text != nil) { -// var newText: String = text ?? "" -// if isSelected { -// if newText.contains(separator) { -// let result = newText.dropLast(2) -// newText = String(result) -// } -// } else { -// if !newText.contains(separator) { -// newText = (text ?? "") + separator -// } -// } -// print("newText:\(newText), isSelected: \(isSelected)") -// text = newText -// if let titleLabel { -// titleLabel.text = text -// } -// } super.updateView() } diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift index cd48c012..5a7e05d0 100644 --- a/VDS/Components/Breadcrumbs/Breadcrumbs.swift +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -15,6 +15,25 @@ import Combine @objc(VDSBreadcrumbs) open class Breadcrumbs: View { + //-------------------------------------------------- + // MARK: - Public Properties + //-------------------------------------------------- + /// Array of Breadcrumb Items that are shown in the group. + open var breadcrumbItems: [BreadcrumbItem] = [] { didSet { setNeedsUpdate() } } + + /// Whether this object is enabled or not + override open var isEnabled: Bool { + didSet { + breadcrumbItems.forEach { $0.isEnabled = isEnabled } + } + } + /// Current Surface and this is used to pass down to child objects that implement Surfacable + override open var surface: Surface { + didSet { + breadcrumbItems.forEach { $0.surface = surface } + } + } + //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- @@ -40,26 +59,6 @@ open class Breadcrumbs: View { return collectionView }() - - //-------------------------------------------------- - // MARK: - Public Properties - //-------------------------------------------------- - /// Array of Breadcrumb Items that are shown in the group. - open var breadcrumbItems: [ButtonBase] = [] { didSet { setNeedsUpdate() } } - - /// Whether this object is enabled or not - override open var isEnabled: Bool { - didSet { - breadcrumbItems.forEach { $0.isEnabled = isEnabled } - } - } - /// Current Surface and this is used to pass down to child objects that implement Surfacable - override open var surface: Surface { - didSet { - breadcrumbItems.forEach { $0.surface = surface } - } - } - //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- @@ -73,7 +72,7 @@ open class Breadcrumbs: View { super.initialSetup() addSubview(collectionView) collectionView.pinToSuperView() - collectionView.heightAnchor.constraint(equalToConstant: 100).activate() + collectionView.heightAnchor.constraint(equalToConstant: 80).activate() } /// Resets to default settings. @@ -98,9 +97,8 @@ extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource { public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: BreadcrumbCellItem.identifier, for: indexPath) as? BreadcrumbCellItem else { return UICollectionViewCell() } - let breadcrumb : BreadcrumbItem = breadcrumbItems[indexPath.row] as! BreadcrumbItem let hideSlash = (indexPath.row == 0) - cell.update(surface: surface, hideSlash: hideSlash, breadCrumbItem: breadcrumb) + cell.update(surface: surface, hideSlash: hideSlash, breadCrumbItem: breadcrumbItems[indexPath.row]) return cell } From 4c9c844b1d770b43aaac52bdf3167a3ec6d83f10 Mon Sep 17 00:00:00 2001 From: vasavk Date: Tue, 19 Mar 2024 14:31:16 +0530 Subject: [PATCH 08/19] Digital ACT-191 ONEAPP-6827 story: alignment issue fix on surface change --- .../Breadcrumbs/BreadcrumbCellItem.swift | 37 ++++++++++++------- VDS/Components/Breadcrumbs/Breadcrumbs.swift | 20 ++++++++-- 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift index 84111e11..f8899577 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift @@ -33,7 +33,9 @@ final class BreadcrumbCellItem: UICollectionViewCell { private var separator: Label = Label().with { $0.translatesAutoresizingMaskIntoConstraints = false $0.textAlignment = .left - $0.numberOfLines = 0 + $0.numberOfLines = 1 + $0.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) + $0.setContentHuggingPriority(.defaultHigh, for: .horizontal) $0.text = "/" } @@ -54,6 +56,7 @@ final class BreadcrumbCellItem: UICollectionViewCell { ///Configuring the cell with default setup private func setUp() { + separator.textColorConfiguration = textColorConfiguration.eraseToAnyColorable() contentView.addSubview(stackView) stackView.pinToSuperView() separator.backgroundColor = .clear @@ -61,7 +64,8 @@ final class BreadcrumbCellItem: UICollectionViewCell { ///Updating the breadCrumbItem and UI based on the selected flag along with the surface func update(surface: Surface, hideSlash: Bool, breadCrumbItem: BreadcrumbItem) { - stackView.removeAllArrangedSubviews() + separator.surface = surface + breadCrumbItem.surface = surface stackView.addArrangedSubview(separator) stackView.addArrangedSubview(breadCrumbItem) stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: separator) @@ -72,17 +76,24 @@ final class BreadcrumbCellItem: UICollectionViewCell { } } -extension UIStackView { - - @discardableResult - func removeAllArrangedSubviews() -> [UIView] { - return arrangedSubviews.reduce([UIView]()) { $0 + [removeArrangedSubViewProperly($1)] } - } +class LeftAlignedCollectionViewFlowLayout: UICollectionViewFlowLayout { - func removeArrangedSubViewProperly(_ view: UIView) -> UIView { - removeArrangedSubview(view) - NSLayoutConstraint.deactivate(view.constraints) - view.removeFromSuperview() - return view + override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { + let attributes = super.layoutAttributesForElements(in: rect) + + var leftMargin = sectionInset.left + var maxY: CGFloat = -1.0 + attributes?.forEach { layoutAttribute in + if layoutAttribute.frame.origin.y >= maxY { + leftMargin = sectionInset.left + } + + layoutAttribute.frame.origin.x = leftMargin + + leftMargin += layoutAttribute.frame.width + minimumInteritemSpacing + maxY = max(layoutAttribute.frame.maxY , maxY) + } + + return attributes } } diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift index 5a7e05d0..b69e5ead 100644 --- a/VDS/Components/Breadcrumbs/Breadcrumbs.swift +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -27,6 +27,7 @@ open class Breadcrumbs: View { breadcrumbItems.forEach { $0.isEnabled = isEnabled } } } + /// Current Surface and this is used to pass down to child objects that implement Surfacable override open var surface: Surface { didSet { @@ -37,7 +38,7 @@ open class Breadcrumbs: View { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- - let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout().with { + let layout: UICollectionViewFlowLayout = LeftAlignedCollectionViewFlowLayout().with { $0.estimatedItemSize = UICollectionViewFlowLayout.automaticSize $0.minimumInteritemSpacing = VDSLayout.Spacing.space1X.value $0.minimumLineSpacing = VDSLayout.Spacing.space1X.value @@ -45,7 +46,7 @@ open class Breadcrumbs: View { $0.scrollDirection = .vertical } - ///Collectionview to render Breadcrumbs indexes + ///Collectionview to render Breadcrumb Items private lazy var collectionView: UICollectionView = { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) collectionView.isScrollEnabled = false @@ -78,6 +79,9 @@ open class Breadcrumbs: View { /// Resets to default settings. open override func reset() { super.reset() + shouldUpdateView = false + breadcrumbItems.forEach { $0.reset() } + shouldUpdateView = true setNeedsUpdate() } @@ -86,6 +90,15 @@ open class Breadcrumbs: View { super.updateView() collectionView.reloadData() } + + open override func layoutSubviews() { + super.layoutSubviews() + // Accounts for any collection size changes + DispatchQueue.main.async { [weak self] in + guard let self else { return } + self.collectionView.collectionViewLayout.invalidateLayout() + } + } } extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource { @@ -102,6 +115,7 @@ extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource { return cell } - public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + public func collectionView(_ collectionView: UICollectionView, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize { + breadcrumbItems[indexPath.row].intrinsicContentSize } } From 868c728f63a40b3a66eb38185b934154cefe9b88 Mon Sep 17 00:00:00 2001 From: vasavk Date: Tue, 19 Mar 2024 17:33:19 +0530 Subject: [PATCH 09/19] Digital ACT-191 ONEAPP-6827 story: container size changes --- VDS/Components/Breadcrumbs/Breadcrumbs.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift index b69e5ead..94d6e6fe 100644 --- a/VDS/Components/Breadcrumbs/Breadcrumbs.swift +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -38,6 +38,11 @@ open class Breadcrumbs: View { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- + // Sizes are from InVision design specs. + internal var containerSize: CGSize { CGSize(width: 45, height: 44) } + + internal var heightConstraint: NSLayoutConstraint? + let layout: UICollectionViewFlowLayout = LeftAlignedCollectionViewFlowLayout().with { $0.estimatedItemSize = UICollectionViewFlowLayout.automaticSize $0.minimumInteritemSpacing = VDSLayout.Spacing.space1X.value @@ -60,12 +65,16 @@ open class Breadcrumbs: View { return collectionView }() - //-------------------------------------------------- + //------------------------------------------s-------- // MARK: - Overrides //-------------------------------------------------- /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. open override func setup() { super.setup() + //create the wrapping view + heightConstraint = self.heightAnchor.constraint(equalToConstant: containerSize.height) + heightConstraint?.priority = .defaultHigh + heightConstraint?.isActive = true } /// Executed on initialization for this View. @@ -73,7 +82,6 @@ open class Breadcrumbs: View { super.initialSetup() addSubview(collectionView) collectionView.pinToSuperView() - collectionView.heightAnchor.constraint(equalToConstant: 80).activate() } /// Resets to default settings. @@ -89,6 +97,8 @@ open class Breadcrumbs: View { open override func updateView() { super.updateView() collectionView.reloadData() + heightConstraint?.constant = collectionView.collectionViewLayout.collectionViewContentSize.height + heightConstraint?.isActive = true } open override func layoutSubviews() { From e0d1fd844d19d2ce66d651a88776fabf150755c5 Mon Sep 17 00:00:00 2001 From: vasavk Date: Wed, 20 Mar 2024 17:20:58 +0530 Subject: [PATCH 10/19] Digital ACT-191 ONEAPP-6827 story: Updated code as per review feedback --- VDS.xcodeproj/project.pbxproj | 6 +- .../Breadcrumbs/BreadcrumbCellItem.swift | 4 +- .../Breadcrumbs/BreadcrumbItem.swift | 14 +---- .../Breadcrumbs/BreadcrumbItemModel.swift | 32 +++++++++++ VDS/Components/Breadcrumbs/Breadcrumbs.swift | 56 ++++++++++++++++--- 5 files changed, 88 insertions(+), 24 deletions(-) create mode 100644 VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index 39250df1..5557e118 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 1832AC572BA0791D008AE476 /* BreadcrumbCellItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC562BA0791D008AE476 /* BreadcrumbCellItem.swift */; }; 18450CF12BA1B19C009FDF2A /* BreadcrumbsChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = 18450CF02BA1B19C009FDF2A /* BreadcrumbsChangeLog.txt */; }; + 1855EC662BAABF2A002ACAC2 /* BreadcrumbItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1855EC652BAABF2A002ACAC2 /* BreadcrumbItemModel.swift */; }; 186B2A8A2B88DA7F001AB71F /* TextAreaChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = 186B2A892B88DA7F001AB71F /* TextAreaChangeLog.txt */; }; 18792A902B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18792A8F2B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift */; }; 18A65A022B96E848006602CC /* Breadcrumbs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A65A012B96E848006602CC /* Breadcrumbs.swift */; }; @@ -184,6 +185,7 @@ /* Begin PBXFileReference section */ 1832AC562BA0791D008AE476 /* BreadcrumbCellItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbCellItem.swift; sourceTree = ""; }; 18450CF02BA1B19C009FDF2A /* BreadcrumbsChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = BreadcrumbsChangeLog.txt; sourceTree = ""; }; + 1855EC652BAABF2A002ACAC2 /* BreadcrumbItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbItemModel.swift; sourceTree = ""; }; 186B2A892B88DA7F001AB71F /* TextAreaChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = TextAreaChangeLog.txt; sourceTree = ""; }; 18792A8F2B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonIconBadgeIndicatorModel.swift; sourceTree = ""; }; 18A65A012B96E848006602CC /* Breadcrumbs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Breadcrumbs.swift; sourceTree = ""; }; @@ -373,8 +375,9 @@ 18A65A002B96E7E1006602CC /* Breadcrumbs */ = { isa = PBXGroup; children = ( - 18A65A012B96E848006602CC /* Breadcrumbs.swift */, 18A65A032B96F050006602CC /* BreadcrumbItem.swift */, + 1855EC652BAABF2A002ACAC2 /* BreadcrumbItemModel.swift */, + 18A65A012B96E848006602CC /* Breadcrumbs.swift */, 1832AC562BA0791D008AE476 /* BreadcrumbCellItem.swift */, 18450CF02BA1B19C009FDF2A /* BreadcrumbsChangeLog.txt */, ); @@ -1043,6 +1046,7 @@ EA0D1C452A6AD73000E5C127 /* RawRepresentable.swift in Sources */, EA985C23296E033A00F2FF2E /* TextArea.swift in Sources */, EAF7F0B3289B1ADC00B287F5 /* ActionLabelAttribute.swift in Sources */, + 1855EC662BAABF2A002ACAC2 /* BreadcrumbItemModel.swift in Sources */, EAC925832911B35400091998 /* TextLinkCaret.swift in Sources */, EA33622E2891EA3C0071C351 /* DispatchQueue+Once.swift in Sources */, EA4DB2FD28D3D0CA00103EE3 /* AnyEquatable.swift in Sources */, diff --git a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift index f8899577..888ade37 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift @@ -66,9 +66,9 @@ final class BreadcrumbCellItem: UICollectionViewCell { func update(surface: Surface, hideSlash: Bool, breadCrumbItem: BreadcrumbItem) { separator.surface = surface breadCrumbItem.surface = surface - stackView.addArrangedSubview(separator) stackView.addArrangedSubview(breadCrumbItem) - stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: separator) + stackView.addArrangedSubview(separator) + stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: breadCrumbItem) separator.textColor = textColorConfiguration.getColor(surface) separator.isHidden = hideSlash self.breadCrumbItem = breadCrumbItem diff --git a/VDS/Components/Breadcrumbs/BreadcrumbItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbItem.swift index 856099b8..7d936d65 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbItem.swift @@ -40,18 +40,8 @@ open class BreadcrumbItem: ButtonBase { /// TextStyle used on the titleLabel. open override var textStyle: TextStyle { isSelected ? TextStyle.boldBodySmall : TextStyle.bodySmall } - /// If true, it will be rendered as selected. - open var selectable: Bool = false { - didSet { - //update selected state - if selectable{ - isSelected = true - } else { - isSelected = false - } - setNeedsUpdate() - } - } + /// Whether the Control is selected or not. + open override var isSelected: Bool { didSet { setNeedsUpdate() } } /// UIColor used on the titleLabel text. open override var textColor: UIColor { diff --git a/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift b/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift new file mode 100644 index 00000000..f792df3f --- /dev/null +++ b/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift @@ -0,0 +1,32 @@ +// +// BreadcrumbItemModel.swift +// VDS +// +// Created by Kanamarlapudi, Vasavi on 20/03/24. +// + +import Foundation + +extension Breadcrumbs { + public struct BreadcrumbItemModel { + + ///Text that goes in the breadcrumb item + public var text: String + + /// The Breadcrumb link to links to its respective page. + public var link: String + + /// The Breadcrumb link to links to its respective page. + public var isSelected: Bool? + + ///Click event when you click on a breadcrumb item + public var onClick: ((BreadcrumbItem) -> Void)? + + public init(text: String, link: String, isSelected: Bool? = false, onClick: ((BreadcrumbItem) -> Void)? = nil) { + self.text = text + self.isSelected = isSelected + self.onClick = onClick + self.link = link + } + } +} diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift index 94d6e6fe..ca6afaa1 100644 --- a/VDS/Components/Breadcrumbs/Breadcrumbs.swift +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -18,23 +18,32 @@ open class Breadcrumbs: View { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- - /// Array of Breadcrumb Items that are shown in the group. - open var breadcrumbItems: [BreadcrumbItem] = [] { didSet { setNeedsUpdate() } } + /// Array of ``BreadcrumbItem`` views for the Breadcrumbs. + open var breadcrumbs: [BreadcrumbItem] = [] + + /// Array of ``BreadcurmbItemModel`` you are wanting to show. + open var breadcrumbModels: [BreadcrumbItemModel] = [] { didSet { updateBreadcrumbItems() } } /// Whether this object is enabled or not override open var isEnabled: Bool { didSet { - breadcrumbItems.forEach { $0.isEnabled = isEnabled } + breadcrumbs.forEach { $0.isEnabled = isEnabled } } } /// Current Surface and this is used to pass down to child objects that implement Surfacable override open var surface: Surface { didSet { - breadcrumbItems.forEach { $0.surface = surface } + breadcrumbs.forEach { $0.surface = surface } } } + /// A callback when the selected item changes. Passes parameters (crumb). + open var onBreadcrumbDidSelect: ((BreadcrumbItem) -> Void)? + + /// A callback when the Tab determine if a item should be selected. + open var onBreadcrumbShouldSelect:((BreadcrumbItem) -> Bool)? + //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- @@ -65,6 +74,35 @@ open class Breadcrumbs: View { return collectionView }() + //-------------------------------------------------- + // MARK: - Private Methods + //-------------------------------------------------- + /// Removes all of the Breadcrumbs and creates new ones from the Breadcrumb Models property. + private func updateBreadcrumbItems() { + // Clear existing breadcrumbs + for breadcrumbItem in breadcrumbs { + breadcrumbItem.removeFromSuperview() + } + + breadcrumbs.removeAll() + // Create new breadcrumb items from the models + for model in breadcrumbModels { + let breadcrumbItem = BreadcrumbItem() + breadcrumbItem.text = model.text + breadcrumbItem.link = model.link + breadcrumbItem.isSelected = model.isSelected ?? false + breadcrumbs.append(breadcrumbItem) + breadcrumbItem.onClick = { [weak self] breadcrumb in + guard let self else { return } + if self.onBreadcrumbShouldSelect?(breadcrumb) ?? true { + model.onClick?(breadcrumb) + self.onBreadcrumbDidSelect?(breadcrumb) + } + } + } + setNeedsUpdate() + } + //------------------------------------------s-------- // MARK: - Overrides //-------------------------------------------------- @@ -88,7 +126,7 @@ open class Breadcrumbs: View { open override func reset() { super.reset() shouldUpdateView = false - breadcrumbItems.forEach { $0.reset() } + breadcrumbs.forEach { $0.reset() } shouldUpdateView = true setNeedsUpdate() } @@ -115,17 +153,17 @@ extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource { //-------------------------------------------------- // MARK: - UICollectionView Delegate & Datasource //-------------------------------------------------- - public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { breadcrumbItems.count + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { breadcrumbs.count } public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: BreadcrumbCellItem.identifier, for: indexPath) as? BreadcrumbCellItem else { return UICollectionViewCell() } - let hideSlash = (indexPath.row == 0) - cell.update(surface: surface, hideSlash: hideSlash, breadCrumbItem: breadcrumbItems[indexPath.row]) + let hideSlash = (indexPath.row == breadcrumbs.count - 1 || breadcrumbs.count == 1) + cell.update(surface: surface, hideSlash: hideSlash, breadCrumbItem: breadcrumbs[indexPath.row]) return cell } public func collectionView(_ collectionView: UICollectionView, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize { - breadcrumbItems[indexPath.row].intrinsicContentSize + breadcrumbs[indexPath.row].intrinsicContentSize } } From d11ef82a4a48c0b1fdab9b58e6e216daf0162911 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 21 Mar 2024 11:16:17 -0500 Subject: [PATCH 11/19] refactored out flowlayout into a class and renamed Signed-off-by: Matt Bruce --- VDS.xcodeproj/project.pbxproj | 6 +++- .../Breadcrumbs/BreadcrumbsFlowLayout.swift | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 VDS/Components/Breadcrumbs/BreadcrumbsFlowLayout.swift diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index 5557e118..1454090c 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -154,6 +154,7 @@ EAEEECAF2B1FC2BA00531FC2 /* ToggleViewChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAEEECAE2B1FC2BA00531FC2 /* ToggleViewChangeLog.txt */; }; EAF1FE9929D4850E00101452 /* Clickable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF1FE9829D4850E00101452 /* Clickable.swift */; }; EAF1FE9B29DB1A6000101452 /* Changeable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF1FE9A29DB1A6000101452 /* Changeable.swift */; }; + EAF4A6A12BAC8B94006BCC2C /* BreadcrumbsFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF4A6A02BAC8B94006BCC2C /* BreadcrumbsFlowLayout.swift */; }; EAF7F0952899861000B287F5 /* CheckboxItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0932899861000B287F5 /* CheckboxItem.swift */; }; EAF7F09A2899B17200B287F5 /* CATransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F0992899B17200B287F5 /* CATransaction.swift */; }; EAF7F0A0289AB7EC00B287F5 /* View.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F09F289AB7EC00B287F5 /* View.swift */; }; @@ -332,6 +333,7 @@ EAEEECAE2B1FC2BA00531FC2 /* ToggleViewChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = ToggleViewChangeLog.txt; sourceTree = ""; }; EAF1FE9829D4850E00101452 /* Clickable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Clickable.swift; sourceTree = ""; }; EAF1FE9A29DB1A6000101452 /* Changeable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Changeable.swift; sourceTree = ""; }; + EAF4A6A02BAC8B94006BCC2C /* BreadcrumbsFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsFlowLayout.swift; sourceTree = ""; }; EAF7F0932899861000B287F5 /* CheckboxItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxItem.swift; sourceTree = ""; }; EAF7F0992899B17200B287F5 /* CATransaction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CATransaction.swift; sourceTree = ""; }; EAF7F09F289AB7EC00B287F5 /* View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = View.swift; sourceTree = ""; }; @@ -375,9 +377,10 @@ 18A65A002B96E7E1006602CC /* Breadcrumbs */ = { isa = PBXGroup; children = ( + 18A65A012B96E848006602CC /* Breadcrumbs.swift */, + EAF4A6A02BAC8B94006BCC2C /* BreadcrumbsFlowLayout.swift */, 18A65A032B96F050006602CC /* BreadcrumbItem.swift */, 1855EC652BAABF2A002ACAC2 /* BreadcrumbItemModel.swift */, - 18A65A012B96E848006602CC /* Breadcrumbs.swift */, 1832AC562BA0791D008AE476 /* BreadcrumbCellItem.swift */, 18450CF02BA1B19C009FDF2A /* BreadcrumbsChangeLog.txt */, ); @@ -1085,6 +1088,7 @@ EAD068922A560B65002E3A2D /* LoaderViewController.swift in Sources */, EABFEB642A26473700C4C106 /* NSAttributedString.swift in Sources */, EAF7F13328A2A16500B287F5 /* AttachmentLabelAttributeModel.swift in Sources */, + EAF4A6A12BAC8B94006BCC2C /* BreadcrumbsFlowLayout.swift in Sources */, EA0FC2C62914222900DF80B4 /* ButtonGroup.swift in Sources */, EA89200628B526D6006B9984 /* CheckboxGroup.swift in Sources */, EA8E40932A82889500934ED3 /* TooltipDialog.swift in Sources */, diff --git a/VDS/Components/Breadcrumbs/BreadcrumbsFlowLayout.swift b/VDS/Components/Breadcrumbs/BreadcrumbsFlowLayout.swift new file mode 100644 index 00000000..d6daf151 --- /dev/null +++ b/VDS/Components/Breadcrumbs/BreadcrumbsFlowLayout.swift @@ -0,0 +1,31 @@ +// +// BreadcrumsFlowLayout.swift +// VDS +// +// Created by Matt Bruce on 3/21/24. +// + +import Foundation +import UIKit + +class BreadcrumbsFlowLayout: UICollectionViewFlowLayout { + + override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { + let attributes = super.layoutAttributesForElements(in: rect) + + var leftMargin = sectionInset.left + var maxY: CGFloat = -1.0 + attributes?.forEach { layoutAttribute in + if layoutAttribute.frame.origin.y >= maxY { + leftMargin = sectionInset.left + } + + layoutAttribute.frame.origin.x = leftMargin + + leftMargin += layoutAttribute.frame.width + minimumInteritemSpacing + maxY = max(layoutAttribute.frame.maxY , maxY) + } + + return attributes + } +} From 5ce775a8856f221e76b907ceb25a6393047399ca Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 21 Mar 2024 11:16:31 -0500 Subject: [PATCH 12/19] added isSelected to buttonBase Signed-off-by: Matt Bruce --- VDS/Components/Buttons/ButtonBase.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/VDS/Components/Buttons/ButtonBase.swift b/VDS/Components/Buttons/ButtonBase.swift index 46f72c55..a1cb39dc 100644 --- a/VDS/Components/Buttons/ButtonBase.swift +++ b/VDS/Components/Buttons/ButtonBase.swift @@ -97,6 +97,9 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable { /// Whether the Control is enabled or not. open override var isEnabled: Bool { didSet { setNeedsUpdate() } } + /// Whether the Control is selected or not. + open override var isSelected: Bool { didSet { setNeedsUpdate() } } + //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- From c23e7f700b29eca2d2b24fae75d48e62dd45ac17 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 21 Mar 2024 11:16:43 -0500 Subject: [PATCH 13/19] refactored model to correct properties Signed-off-by: Matt Bruce --- .../Breadcrumbs/BreadcrumbItemModel.swift | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift b/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift index f792df3f..507212de 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift @@ -12,21 +12,20 @@ extension Breadcrumbs { ///Text that goes in the breadcrumb item public var text: String - - /// The Breadcrumb link to links to its respective page. - public var link: String + public var enabled: Bool + /// The Breadcrumb link to links to its respective page. - public var isSelected: Bool? + public var selected: Bool ///Click event when you click on a breadcrumb item public var onClick: ((BreadcrumbItem) -> Void)? - public init(text: String, link: String, isSelected: Bool? = false, onClick: ((BreadcrumbItem) -> Void)? = nil) { + public init(text: String, enabeled: Bool = true, selected: Bool = false, onClick: ((BreadcrumbItem) -> Void)? = nil) { self.text = text - self.isSelected = isSelected + self.enabled = enabeled + self.selected = selected self.onClick = onClick - self.link = link } } } From b9f17f2af4a1fe0706ee19da5f74f459a9a3b45b Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 21 Mar 2024 11:17:18 -0500 Subject: [PATCH 14/19] added disabled state removed link Signed-off-by: Matt Bruce --- VDS/Components/Breadcrumbs/BreadcrumbItem.swift | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/VDS/Components/Breadcrumbs/BreadcrumbItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbItem.swift index 7d936d65..3b279551 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbItem.swift @@ -34,15 +34,9 @@ open class BreadcrumbItem: ButtonBase { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- - /// The Breadcrumb link to links to its respective page. - open var link: String? { didSet { setNeedsUpdate() } } - /// TextStyle used on the titleLabel. open override var textStyle: TextStyle { isSelected ? TextStyle.boldBodySmall : TextStyle.bodySmall } - - /// Whether the Control is selected or not. - open override var isSelected: Bool { didSet { setNeedsUpdate() } } - + /// UIColor used on the titleLabel text. open override var textColor: UIColor { textColorConfiguration.getColor(self) @@ -58,6 +52,7 @@ open class BreadcrumbItem: ButtonBase { //-------------------------------------------------- private var textColorConfiguration = ControlColorConfiguration().with { $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .normal) + $0.setSurfaceColors(VDSColor.interactiveActiveOnlight, VDSColor.interactiveActiveOndark, forState: .disabled) $0.setSurfaceColors(VDSColor.interactiveActiveOnlight, VDSColor.interactiveActiveOndark, forState: .highlighted) $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .selected) } @@ -85,7 +80,6 @@ open class BreadcrumbItem: ButtonBase { super.reset() shouldUpdateView = false text = nil - link = nil accessibilityCustomActions = [] isAccessibilityElement = true accessibilityTraits = .button From e9bd1614ec60d77c2b02e9859fe765c122aade95 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 21 Mar 2024 11:17:26 -0500 Subject: [PATCH 15/19] refactored cell Signed-off-by: Matt Bruce --- .../Breadcrumbs/BreadcrumbCellItem.swift | 26 ++----------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift index 888ade37..7026c885 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift @@ -66,34 +66,12 @@ final class BreadcrumbCellItem: UICollectionViewCell { func update(surface: Surface, hideSlash: Bool, breadCrumbItem: BreadcrumbItem) { separator.surface = surface breadCrumbItem.surface = surface - stackView.addArrangedSubview(breadCrumbItem) stackView.addArrangedSubview(separator) - stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: breadCrumbItem) + stackView.addArrangedSubview(breadCrumbItem) + stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: separator) separator.textColor = textColorConfiguration.getColor(surface) separator.isHidden = hideSlash self.breadCrumbItem = breadCrumbItem layoutIfNeeded() } } - -class LeftAlignedCollectionViewFlowLayout: UICollectionViewFlowLayout { - - override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { - let attributes = super.layoutAttributesForElements(in: rect) - - var leftMargin = sectionInset.left - var maxY: CGFloat = -1.0 - attributes?.forEach { layoutAttribute in - if layoutAttribute.frame.origin.y >= maxY { - leftMargin = sectionInset.left - } - - layoutAttribute.frame.origin.x = leftMargin - - leftMargin += layoutAttribute.frame.width + minimumInteritemSpacing - maxY = max(layoutAttribute.frame.maxY , maxY) - } - - return attributes - } -} From 7a533944b81fce491d264a5766e21730d2fbd814 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 21 Mar 2024 11:17:44 -0500 Subject: [PATCH 16/19] refactored breadcrumbs to use selfsizing cv Signed-off-by: Matt Bruce --- VDS/Components/Breadcrumbs/Breadcrumbs.swift | 54 +++++++------------- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift index ca6afaa1..ad2f20de 100644 --- a/VDS/Components/Breadcrumbs/Breadcrumbs.swift +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -19,7 +19,7 @@ open class Breadcrumbs: View { // MARK: - Public Properties //-------------------------------------------------- /// Array of ``BreadcrumbItem`` views for the Breadcrumbs. - open var breadcrumbs: [BreadcrumbItem] = [] + open var breadcrumbs: [BreadcrumbItem] = [] { didSet { setNeedsUpdate() } } /// Array of ``BreadcurmbItemModel`` you are wanting to show. open var breadcrumbModels: [BreadcrumbItemModel] = [] { didSet { updateBreadcrumbItems() } } @@ -47,12 +47,7 @@ open class Breadcrumbs: View { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- - // Sizes are from InVision design specs. - internal var containerSize: CGSize { CGSize(width: 45, height: 44) } - - internal var heightConstraint: NSLayoutConstraint? - - let layout: UICollectionViewFlowLayout = LeftAlignedCollectionViewFlowLayout().with { + let layout: UICollectionViewFlowLayout = BreadcrumbsFlowLayout().with { $0.estimatedItemSize = UICollectionViewFlowLayout.automaticSize $0.minimumInteritemSpacing = VDSLayout.Spacing.space1X.value $0.minimumLineSpacing = VDSLayout.Spacing.space1X.value @@ -61,8 +56,8 @@ open class Breadcrumbs: View { } ///Collectionview to render Breadcrumb Items - private lazy var collectionView: UICollectionView = { - let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) + private lazy var collectionView: SelfSizingCollectionView = { + let collectionView = SelfSizingCollectionView(frame: .zero, collectionViewLayout: layout) collectionView.isScrollEnabled = false collectionView.translatesAutoresizingMaskIntoConstraints = false collectionView.delegate = self @@ -84,37 +79,26 @@ open class Breadcrumbs: View { breadcrumbItem.removeFromSuperview() } - breadcrumbs.removeAll() // Create new breadcrumb items from the models - for model in breadcrumbModels { + breadcrumbs = breadcrumbModels.compactMap({ model in let breadcrumbItem = BreadcrumbItem() breadcrumbItem.text = model.text - breadcrumbItem.link = model.link - breadcrumbItem.isSelected = model.isSelected ?? false - breadcrumbs.append(breadcrumbItem) + breadcrumbItem.isEnabled = model.enabled + breadcrumbItem.isSelected = model.selected breadcrumbItem.onClick = { [weak self] breadcrumb in - guard let self else { return } + guard let self, breadcrumb.isEnabled else { return } if self.onBreadcrumbShouldSelect?(breadcrumb) ?? true { model.onClick?(breadcrumb) self.onBreadcrumbDidSelect?(breadcrumb) } } - } - setNeedsUpdate() + return breadcrumbItem + }) } //------------------------------------------s-------- // MARK: - Overrides //-------------------------------------------------- - /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. - open override func setup() { - super.setup() - //create the wrapping view - heightConstraint = self.heightAnchor.constraint(equalToConstant: containerSize.height) - heightConstraint?.priority = .defaultHigh - heightConstraint?.isActive = true - } - /// Executed on initialization for this View. open override func initialSetup() { super.initialSetup() @@ -135,17 +119,17 @@ open class Breadcrumbs: View { open override func updateView() { super.updateView() collectionView.reloadData() - heightConstraint?.constant = collectionView.collectionViewLayout.collectionViewContentSize.height - heightConstraint?.isActive = true } open override func layoutSubviews() { - super.layoutSubviews() + //Don't call super since we don't want an infinite loop + //super.layoutSubviews() + // Accounts for any collection size changes DispatchQueue.main.async { [weak self] in guard let self else { return } self.collectionView.collectionViewLayout.invalidateLayout() - } + } } } @@ -153,17 +137,15 @@ extension Breadcrumbs: UICollectionViewDelegate, UICollectionViewDataSource { //-------------------------------------------------- // MARK: - UICollectionView Delegate & Datasource //-------------------------------------------------- - public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { breadcrumbs.count + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + breadcrumbs.count } - + public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: BreadcrumbCellItem.identifier, for: indexPath) as? BreadcrumbCellItem else { return UICollectionViewCell() } - let hideSlash = (indexPath.row == breadcrumbs.count - 1 || breadcrumbs.count == 1) + let hideSlash = indexPath.row == 0 cell.update(surface: surface, hideSlash: hideSlash, breadCrumbItem: breadcrumbs[indexPath.row]) return cell } - public func collectionView(_ collectionView: UICollectionView, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize { - breadcrumbs[indexPath.row].intrinsicContentSize - } } From f862c8bd1ce326aefdecf20fa7c54b6749331dff Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 21 Mar 2024 11:20:11 -0500 Subject: [PATCH 17/19] fix bug, must find other solution later Signed-off-by: Matt Bruce --- VDS/Components/Breadcrumbs/Breadcrumbs.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift index ad2f20de..0ed7585d 100644 --- a/VDS/Components/Breadcrumbs/Breadcrumbs.swift +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -122,14 +122,17 @@ open class Breadcrumbs: View { } open override func layoutSubviews() { - //Don't call super since we don't want an infinite loop - //super.layoutSubviews() - + //Turn off the ability to execute updateView() in the super + //since we don't want an infinite loop + shouldUpdateView = false + super.layoutSubviews() + shouldUpdateView = true + // Accounts for any collection size changes DispatchQueue.main.async { [weak self] in guard let self else { return } self.collectionView.collectionViewLayout.invalidateLayout() - } + } } } From e139a0a0b8ff32e51e3bad99f4a6ff3dd0ef9618 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 21 Mar 2024 14:15:41 -0500 Subject: [PATCH 18/19] refactor cell some more Signed-off-by: Matt Bruce --- .../Breadcrumbs/BreadcrumbCellItem.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift index 7026c885..9f0ea68b 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbCellItem.swift @@ -64,14 +64,31 @@ final class BreadcrumbCellItem: UICollectionViewCell { ///Updating the breadCrumbItem and UI based on the selected flag along with the surface func update(surface: Surface, hideSlash: Bool, breadCrumbItem: BreadcrumbItem) { + //remove views from stack + separator.removeFromSuperview() + self.breadCrumbItem?.removeFromSuperview() + + //update surface separator.surface = surface breadCrumbItem.surface = surface + + //add to stack stackView.addArrangedSubview(separator) stackView.addArrangedSubview(breadCrumbItem) stackView.setCustomSpacing(VDSLayout.Spacing.space1X.value, after: separator) + + //update separator separator.textColor = textColorConfiguration.getColor(surface) separator.isHidden = hideSlash + self.breadCrumbItem = breadCrumbItem layoutIfNeeded() } + + /// Remove views from StackView. + override func prepareForReuse() { + super.prepareForReuse() + separator.removeFromSuperview() + breadCrumbItem?.removeFromSuperview() + } } From 37d43fbb62b5e90581b11b4e149951c60caf8fce Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 21 Mar 2024 14:15:48 -0500 Subject: [PATCH 19/19] added comments Signed-off-by: Matt Bruce --- VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift b/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift index 507212de..75c97c86 100644 --- a/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift +++ b/VDS/Components/Breadcrumbs/BreadcrumbItemModel.swift @@ -13,6 +13,7 @@ extension Breadcrumbs { ///Text that goes in the breadcrumb item public var text: String + /// Whether the Item can be clicked. public var enabled: Bool /// The Breadcrumb link to links to its respective page.