From dc7dbffcf6dffa676168e1c0c5f7bd3cfe36ac23 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Wed, 16 Oct 2024 14:23:30 +0530 Subject: [PATCH 1/6] Digital ACT-191 ONEAPP-11355 story: added new file for List Unordered --- .../ListUnordered/ListUnordered.swift | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 VDS/Components/ListUnordered/ListUnordered.swift diff --git a/VDS/Components/ListUnordered/ListUnordered.swift b/VDS/Components/ListUnordered/ListUnordered.swift new file mode 100644 index 00000000..7fd869b6 --- /dev/null +++ b/VDS/Components/ListUnordered/ListUnordered.swift @@ -0,0 +1,187 @@ +// +// ListUnordered.swift +// VDS +// +// Created by Vasavi Kanamarlapudi on 16/10/24. +// + +import Foundation +import UIKit +import VDSCoreTokens + +/// List unordered breaks up related content into distinct phrases or sentences, which improves scannability. +/// This component should be used when the text items don’t need to be in numeric order. +@objcMembers +@objc(VDSListUnordered) +open class ListUnordered: View { + + //-------------------------------------------------- + // 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: - Enums + //-------------------------------------------------- + /// Enum that represents the size availble for the component. + public enum Size: String, DefaultValuing, CaseIterable { + case large + case medium + case small + case micro + + public static var defaultValue: Self { .large } + + /// TextStyle relative to Size. + public var textStyle: TextStyle.StandardStyle { + switch self { + case .large: + return .bodyLarge + case .medium: + return .bodyMedium + case .small: + return .bodySmall + case .micro: + return .micro + } + } + } + + /// Enum that represents the type of spacing available for the component. + public enum Spacing: String, CaseIterable { + case standard, compact + } + + //-------------------------------------------------- + // MARK: - Public Properties + //-------------------------------------------------- + /// Size of the component. The default size is Large. + open var size: Size = .defaultValue { didSet { setNeedsUpdate() } } + + /// Spacing type of the component. + open var spacing: Spacing = .standard { didSet { setNeedsUpdate() } } + + /// Lead-in text that shows as the top text for the component. This is optional. + open var leadInText: String? + + /// Array of unordered list items to show for the component. + open var unorderedList: [ListUnorderedItemModel] = [] { didSet { setNeedsUpdate() }} + + //-------------------------------------------------- + // MARK: - Configuration Properties + //-------------------------------------------------- + // It can be used for Glyph level 1. + private var disc = "•" + + // It can be used for Glyph Level 2. + private var endash = "–" + + // Spacing between unordered list items. + private var spaceBetweenItems: CGFloat { + switch (size, spacing) { + case (.large, .standard): + return VDSLayout.space4X + case (.medium, .standard), (.small, .standard), (.micro, .standard): + return VDSLayout.space3X + case (.large, .compact): + return VDSLayout.space2X + case (.medium, .compact), (.small, .compact), (.micro, .compact): + return VDSLayout.space1X + } + } + + // Padding that can be used in an item between the glyph and the item text. + private var padding: CGFloat { + switch (size, spacing) { + case (.large, .standard), (.large, .compact): + return VDSLayout.space3X + case (.medium, .standard), (.small, .standard), (.micro, .standard), (.medium, .compact), (.small, .compact), (.micro, .compact): + return VDSLayout.space2X + } + } + + private let textColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark) + + //-------------------------------------------------- + // MARK: - Private Properties + //-------------------------------------------------- + private lazy var listStackView = UIStackView().with { + $0.translatesAutoresizingMaskIntoConstraints = false + $0.axis = .vertical + $0.distribution = .fill + $0.spacing = VDSLayout.space3X + $0.backgroundColor = .clear + } + + private lazy var itemStackView = UIStackView().with { + $0.translatesAutoresizingMaskIntoConstraints = false + $0.axis = .horizontal + $0.alignment = .leading + $0.distribution = .fill + $0.spacing = padding + $0.backgroundColor = .clear + } + + internal var symbolLabel = Label().with { + $0.isAccessibilityElement = true + $0.numberOfLines = 1 + $0.sizeToFit() + } + + internal var textLabel = Label().with { + $0.isAccessibilityElement = true + $0.lineBreakMode = .byWordWrapping + } + + //-------------------------------------------------- + // MARK: - Overrides + //-------------------------------------------------- + /// Called once when a view is initialized and is used to Setup additional UI or other constants and config.texturations. + open override func setup() { + super.setup() + + // add stackview + addSubview(listStackView) + listStackView.pinToSuperView() + } + + open override func setDefaults() { + super.setDefaults() + leadInText = nil + unorderedList = [] + } + + /// Resets to default settings. + open override func reset() { + symbolLabel.reset() + textLabel.reset() + super.reset() + } + + /// Used to make changes to the View based off a change events or from local properties. + open override func updateView() { + super.updateView() + if leadInText != nil { + textLabel.text = leadInText + textLabel.textStyle = size.textStyle.regular + textLabel.textColor = textColorConfiguration.getColor(surface) + textLabel.surface = surface + listStackView.addArrangedSubview(textLabel) + } + } + + //-------------------------------------------------- + // MARK: - Private Methods + //-------------------------------------------------- + +} From 759ef0db5bfcd3f37cfed03cc69d3ef0b015bc28 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Wed, 16 Oct 2024 14:24:45 +0530 Subject: [PATCH 2/6] Digital ACT-191 ONEAPP-11355 story: added change log and added class for docs --- .../ListUnordered/ListUnordered.txt | 41 +++++++++++++++++++ VDS/VDS.docc/VDS.md | 1 + 2 files changed, 42 insertions(+) create mode 100644 VDS/Components/ListUnordered/ListUnordered.txt diff --git a/VDS/Components/ListUnordered/ListUnordered.txt b/VDS/Components/ListUnordered/ListUnordered.txt new file mode 100644 index 00000000..001ac437 --- /dev/null +++ b/VDS/Components/ListUnordered/ListUnordered.txt @@ -0,0 +1,41 @@ +MM/DD/YYYY +---------------- +- Initial Brand 3.0 handoff + +05/2/2022 +---------------- +- Added Body Medium to size configuration + +05/5/2022 +---------------- +- Added Spacing configuration (Standard, Compact) Web handoff + +08/2/2022 +---------------- +- Included a VDS Note about the Spacing prop naming rationale + +08/10/2022 +---------------- +- Updated default and inverted prop to light and dark surface. + +12/13/2022 +---------------- +- Replaced focus border pixel and style & spacing values with tokens. + +01/10/2023 +---------------- +- Removed from Anatomy section: “List item text” +- Updated “Glyph level 1” to “List Item Level 1” +- Updated “Glyph level 2” to “List Item Level 2” +- Updated image markers to reflect changes + +02/02/2023 +---------------- +- Reduced left padding for all Level 2 sizes so that the Glyph aligns with the text in Level 1. +- Added dashed line on all sizes to indicate Level 2 alignment under Level 1. +- Changed “endash” to “endash, regular” under Size section. +- Updated all Level 1 and Level 2 glyph widths to “Hug” + +12/26/23 +---------------- +- Deleted Decisions log diff --git a/VDS/VDS.docc/VDS.md b/VDS/VDS.docc/VDS.md index e1fda159..07db49b5 100755 --- a/VDS/VDS.docc/VDS.md +++ b/VDS/VDS.docc/VDS.md @@ -39,6 +39,7 @@ Using the system allows designers and developers to collaborate more easily and - ``InputField`` - ``Label`` - ``Line`` +- ``ListUnordered`` - ``Loader`` - ``Modal`` - ``Notification`` From c352fbaac9bdbb25e283615cf21891185c52934f Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Wed, 16 Oct 2024 14:26:01 +0530 Subject: [PATCH 3/6] Digital ACT-191 ONEAPP-11355 story: added list unordered item model --- VDS.xcodeproj/project.pbxproj | 18 +++++++++++++++ .../ListUnorderedItemModel.swift | 23 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 VDS/Components/ListUnordered/ListUnorderedItemModel.swift diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index bb3a0e44..f4b6cbe8 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -23,6 +23,8 @@ 1842B1E12BECE7B70021AFCA /* CalendarHeaderReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1842B1E02BECE7B70021AFCA /* CalendarHeaderReusableView.swift */; }; 1842B1E32BECF0A20021AFCA /* CalendarFooterReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1842B1E22BECF0A10021AFCA /* CalendarFooterReusableView.swift */; }; 1855EC662BAABF2A002ACAC2 /* BreadcrumbItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1855EC652BAABF2A002ACAC2 /* BreadcrumbItemModel.swift */; }; + 1859B30F2CBF6FEB0031CD70 /* ListUnordered.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1859B30E2CBF6FDD0031CD70 /* ListUnordered.swift */; }; + 1859B31B2CBFA0180031CD70 /* ListUnorderedItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1859B31A2CBFA0180031CD70 /* ListUnorderedItemModel.swift */; }; 186D13CB2BBA8B1500986B53 /* DropdownSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 186D13CA2BBA8B1500986B53 /* DropdownSelect.swift */; }; 18792A902B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18792A8F2B7431F2008C0D29 /* ButtonIconBadgeIndicatorModel.swift */; }; 18926F5B2C7616A500C55BF6 /* FootnoteItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18926F5A2C7616A500C55BF6 /* FootnoteItem.swift */; }; @@ -241,6 +243,9 @@ 1842B1E22BECF0A10021AFCA /* CalendarFooterReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarFooterReusableView.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 = ""; }; + 1859B30E2CBF6FDD0031CD70 /* ListUnordered.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListUnordered.swift; sourceTree = ""; }; + 1859B3122CBF70AB0031CD70 /* ListUnordered.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = ListUnordered.txt; sourceTree = ""; }; + 1859B31A2CBFA0180031CD70 /* ListUnorderedItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListUnorderedItemModel.swift; sourceTree = ""; }; 186B2A892B88DA7F001AB71F /* TextAreaChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = TextAreaChangeLog.txt; sourceTree = ""; }; 186D13CA2BBA8B1500986B53 /* DropdownSelect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropdownSelect.swift; sourceTree = ""; }; 186D13CE2BBC36EE00986B53 /* DropdownSelectChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = DropdownSelectChangeLog.txt; sourceTree = ""; }; @@ -508,6 +513,16 @@ path = PriceLockup; sourceTree = ""; }; + 1859B30D2CBF6EF80031CD70 /* ListUnordered */ = { + isa = PBXGroup; + children = ( + 1859B30E2CBF6FDD0031CD70 /* ListUnordered.swift */, + 1859B31A2CBFA0180031CD70 /* ListUnorderedItemModel.swift */, + 1859B3122CBF70AB0031CD70 /* ListUnordered.txt */, + ); + path = ListUnordered; + sourceTree = ""; + }; 186D13C92BBA8A3500986B53 /* DropdownSelect */ = { isa = PBXGroup; children = ( @@ -759,6 +774,7 @@ 180636C52C29B06200C92D86 /* InputStepper */, EA3362412892EF700071C351 /* Label */, 44604AD529CE195300E62B51 /* Line */, + 1859B30D2CBF6EF80031CD70 /* ListUnordered */, EAD0688C2A55F801002E3A2D /* Loader */, 18C0F9442C980CE500E1DD71 /* Modal */, 445BA07629C07ABA0036A7C5 /* Notification */, @@ -1347,6 +1363,7 @@ EA6642952BCEBF9500D81DC4 /* TextLinkModel.swift in Sources */, 71FC86E22B97483000700965 /* Clamping.swift in Sources */, EAF7F0B3289B1ADC00B287F5 /* ActionLabelAttribute.swift in Sources */, + 1859B30F2CBF6FEB0031CD70 /* ListUnordered.swift in Sources */, 1855EC662BAABF2A002ACAC2 /* BreadcrumbItemModel.swift in Sources */, EAC925832911B35400091998 /* TextLinkCaret.swift in Sources */, EA33622E2891EA3C0071C351 /* DispatchQueue+Once.swift in Sources */, @@ -1414,6 +1431,7 @@ EAD8D2C128BFDE8B006EB6A6 /* UIGestureRecognizer+Publisher.swift in Sources */, 18B42AC62C09D197008D6262 /* CarouselSlotAlignmentModel.swift in Sources */, 71B23C2D2B91FA690027F7D9 /* Pagination.swift in Sources */, + 1859B31B2CBFA0180031CD70 /* ListUnorderedItemModel.swift in Sources */, EA0D1C372A681CCE00E5C127 /* ToggleView.swift in Sources */, EAF7F0B9289C139800B287F5 /* ColorConfiguration.swift in Sources */, EA3361BD288B2C760071C351 /* TypeAlias.swift in Sources */, diff --git a/VDS/Components/ListUnordered/ListUnorderedItemModel.swift b/VDS/Components/ListUnordered/ListUnorderedItemModel.swift new file mode 100644 index 00000000..e2a3298b --- /dev/null +++ b/VDS/Components/ListUnordered/ListUnorderedItemModel.swift @@ -0,0 +1,23 @@ +// +// ListUnorderedItemModel.swift +// VDS +// +// Created by Vasavi Kanamarlapudi on 16/10/24. +// + +import Foundation +extension ListUnordered { + public struct ListUnorderedItemModel: Equatable { + + /// Item Level 1 that shows text with glyph - disc, bold. + public var itemLevelOneText: String + + /// Item Level 2 that shows text (one or many) with glyph - en dash. This is optional. + public var itemLevelTwoText: [String] + + public init(itemLevelOneText: String, itemLevelTwoTexts: [String]? = nil) { + self.itemLevelOneText = itemLevelOneText + self.itemLevelTwoText = itemLevelTwoTexts ?? [] + } + } +} From 62aedc7c5afa79c64259952c01611ff09d3d547a Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Fri, 18 Oct 2024 19:52:55 +0530 Subject: [PATCH 4/6] Digital ACT-191 ONEAPP-11355 story: changes done as per anatomy --- .../ListUnordered/ListUnordered.swift | 117 ++++++++++++------ .../ListUnorderedItemModel.swift | 8 +- 2 files changed, 85 insertions(+), 40 deletions(-) diff --git a/VDS/Components/ListUnordered/ListUnordered.swift b/VDS/Components/ListUnordered/ListUnordered.swift index 7fd869b6..5808abe7 100644 --- a/VDS/Components/ListUnordered/ListUnordered.swift +++ b/VDS/Components/ListUnordered/ListUnordered.swift @@ -14,7 +14,7 @@ import VDSCoreTokens @objcMembers @objc(VDSListUnordered) open class ListUnordered: View { - + //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- @@ -39,7 +39,7 @@ open class ListUnordered: View { case medium case small case micro - + public static var defaultValue: Self { .large } /// TextStyle relative to Size. @@ -67,16 +67,16 @@ open class ListUnordered: View { //-------------------------------------------------- /// Size of the component. The default size is Large. open var size: Size = .defaultValue { didSet { setNeedsUpdate() } } - + /// Spacing type of the component. open var spacing: Spacing = .standard { didSet { setNeedsUpdate() } } /// Lead-in text that shows as the top text for the component. This is optional. - open var leadInText: String? - + open var leadInText: String? = nil { didSet { setNeedsUpdate() } } + /// Array of unordered list items to show for the component. open var unorderedList: [ListUnorderedItemModel] = [] { didSet { setNeedsUpdate() }} - + //-------------------------------------------------- // MARK: - Configuration Properties //-------------------------------------------------- @@ -86,7 +86,7 @@ open class ListUnordered: View { // It can be used for Glyph Level 2. private var endash = "–" - // Spacing between unordered list items. + // Spacing between the list items. private var spaceBetweenItems: CGFloat { switch (size, spacing) { case (.large, .standard): @@ -119,30 +119,10 @@ open class ListUnordered: View { $0.translatesAutoresizingMaskIntoConstraints = false $0.axis = .vertical $0.distribution = .fill - $0.spacing = VDSLayout.space3X + $0.spacing = spaceBetweenItems $0.backgroundColor = .clear } - private lazy var itemStackView = UIStackView().with { - $0.translatesAutoresizingMaskIntoConstraints = false - $0.axis = .horizontal - $0.alignment = .leading - $0.distribution = .fill - $0.spacing = padding - $0.backgroundColor = .clear - } - - internal var symbolLabel = Label().with { - $0.isAccessibilityElement = true - $0.numberOfLines = 1 - $0.sizeToFit() - } - - internal var textLabel = Label().with { - $0.isAccessibilityElement = true - $0.lineBreakMode = .byWordWrapping - } - //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- @@ -152,6 +132,7 @@ open class ListUnordered: View { // add stackview addSubview(listStackView) + listStackView.heightGreaterThanEqualTo(constant:0) listStackView.pinToSuperView() } @@ -163,25 +144,89 @@ open class ListUnordered: View { /// Resets to default settings. open override func reset() { - symbolLabel.reset() - textLabel.reset() super.reset() } /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() + listStackView.removeArrangedSubviews() + listStackView.spacing = spaceBetweenItems + if leadInText != nil { - textLabel.text = leadInText - textLabel.textStyle = size.textStyle.regular - textLabel.textColor = textColorConfiguration.getColor(surface) - textLabel.surface = surface - listStackView.addArrangedSubview(textLabel) + let listItem = getListItem(with:self.leadInText, surface: surface) + listStackView.addArrangedSubview(listItem) } + + unorderedList.forEach { item in + let listItem = getListItem(levelOneText: item.levelOneText, surface: surface) + listStackView.addArrangedSubview(listItem) + + item.levelTwoText?.forEach { text in + let listItem = getListItem(levelTwoText: text, surface: surface) + listStackView.addArrangedSubview(listItem) + } + } + setNeedsLayout() + layoutIfNeeded() } //-------------------------------------------------- // MARK: - Private Methods //-------------------------------------------------- - + // Get Label with the required text and text formats. + func getLabel(with text: String?, surface: Surface) -> Label { + let textLabel = Label().with { + $0.isAccessibilityElement = true + $0.lineBreakMode = .byWordWrapping + $0.text = text + $0.textStyle = size.textStyle.regular + $0.textColor = textColorConfiguration.getColor(surface) + $0.surface = surface + } + return textLabel + } + + // Get the list item with the required text (LeadInText, Level 1 Text, Level 2 Text). + func getListItem(with leadInText:String? = nil, levelOneText: String? = nil, levelTwoText: String? = nil, surface:Surface) -> UIView { + let itemStackView = UIStackView().with { + $0.translatesAutoresizingMaskIntoConstraints = false + $0.axis = .horizontal + $0.alignment = .leading + $0.distribution = .fill + $0.spacing = padding + $0.backgroundColor = .clear + } + itemStackView.removeArrangedSubviews() + + // StackView with LeadIntext if provided. + if leadInText != nil { + let leadTextLabel = getLabel(with: leadInText, surface: surface) + itemStackView.addArrangedSubview(leadTextLabel) + } + + // StackView with Level 1 Text if provided. + if levelOneText != nil { + let discLabel = getLabel(with: disc, surface: surface) + discLabel.widthAnchor.constraint(equalToConstant: discLabel.intrinsicContentSize.width).activate() + itemStackView.addArrangedSubview(discLabel) + let levelOneLabel = getLabel(with: levelOneText, surface: surface) + itemStackView.addArrangedSubview(levelOneLabel) + } + + // StackView with Level 2 Text if provided. + if levelTwoText != nil { + let discLabel = getLabel(with: disc, surface: surface) + let discSpaceView = View() + discSpaceView.widthAnchor.constraint(equalToConstant: discLabel.intrinsicContentSize.width).activate() + discSpaceView.backgroundColor = .red + itemStackView.addArrangedSubview(discSpaceView) + let endashLabel = getLabel(with: endash, surface: surface) + endashLabel.widthAnchor.constraint(equalToConstant: endashLabel.intrinsicContentSize.width).activate() + itemStackView.addArrangedSubview(endashLabel) + let levelTwoLabel = getLabel(with: levelTwoText, surface: surface) + itemStackView.addArrangedSubview(levelTwoLabel) + } + return itemStackView + } } diff --git a/VDS/Components/ListUnordered/ListUnorderedItemModel.swift b/VDS/Components/ListUnordered/ListUnorderedItemModel.swift index e2a3298b..94c88e02 100644 --- a/VDS/Components/ListUnordered/ListUnorderedItemModel.swift +++ b/VDS/Components/ListUnordered/ListUnorderedItemModel.swift @@ -10,14 +10,14 @@ extension ListUnordered { public struct ListUnorderedItemModel: Equatable { /// Item Level 1 that shows text with glyph - disc, bold. - public var itemLevelOneText: String + public var levelOneText: String /// Item Level 2 that shows text (one or many) with glyph - en dash. This is optional. - public var itemLevelTwoText: [String] + public var levelTwoText: [String]? public init(itemLevelOneText: String, itemLevelTwoTexts: [String]? = nil) { - self.itemLevelOneText = itemLevelOneText - self.itemLevelTwoText = itemLevelTwoTexts ?? [] + self.levelOneText = itemLevelOneText + self.levelTwoText = itemLevelTwoTexts ?? [] } } } From 4797e5a7f7b423e8386efc59028659bcafe82f81 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Sat, 19 Oct 2024 14:38:03 +0530 Subject: [PATCH 5/6] Digital ACT-191 ONEAPP-11355 story: adjusted alignments --- .../ListUnordered/ListUnordered.swift | 17 ++++++++++++----- .../ListUnordered/ListUnorderedItemModel.swift | 6 +++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/VDS/Components/ListUnordered/ListUnordered.swift b/VDS/Components/ListUnordered/ListUnordered.swift index 5808abe7..e9349a0b 100644 --- a/VDS/Components/ListUnordered/ListUnordered.swift +++ b/VDS/Components/ListUnordered/ListUnordered.swift @@ -151,6 +151,7 @@ open class ListUnordered: View { open override func updateView() { super.updateView() listStackView.removeArrangedSubviews() + listStackView.subviews.forEach { $0.removeFromSuperview() } listStackView.spacing = spaceBetweenItems if leadInText != nil { @@ -167,8 +168,6 @@ open class ListUnordered: View { listStackView.addArrangedSubview(listItem) } } - setNeedsLayout() - layoutIfNeeded() } //-------------------------------------------------- @@ -197,7 +196,6 @@ open class ListUnordered: View { $0.spacing = padding $0.backgroundColor = .clear } - itemStackView.removeArrangedSubviews() // StackView with LeadIntext if provided. if leadInText != nil { @@ -207,23 +205,32 @@ open class ListUnordered: View { // StackView with Level 1 Text if provided. if levelOneText != nil { + + // Add level 1 glyph: 'disc, bold' let discLabel = getLabel(with: disc, surface: surface) discLabel.widthAnchor.constraint(equalToConstant: discLabel.intrinsicContentSize.width).activate() itemStackView.addArrangedSubview(discLabel) + + // Add level 1 Text let levelOneLabel = getLabel(with: levelOneText, surface: surface) itemStackView.addArrangedSubview(levelOneLabel) } // StackView with Level 2 Text if provided. if levelTwoText != nil { - let discLabel = getLabel(with: disc, surface: surface) + + // Set level 2 leading space as needed for alignment. let discSpaceView = View() + let discLabel = getLabel(with: disc, surface: surface) discSpaceView.widthAnchor.constraint(equalToConstant: discLabel.intrinsicContentSize.width).activate() - discSpaceView.backgroundColor = .red itemStackView.addArrangedSubview(discSpaceView) + + // Add level 2 glyph: 'en dash, regular' let endashLabel = getLabel(with: endash, surface: surface) endashLabel.widthAnchor.constraint(equalToConstant: endashLabel.intrinsicContentSize.width).activate() itemStackView.addArrangedSubview(endashLabel) + + // Add level 2 Text let levelTwoLabel = getLabel(with: levelTwoText, surface: surface) itemStackView.addArrangedSubview(levelTwoLabel) } diff --git a/VDS/Components/ListUnordered/ListUnorderedItemModel.swift b/VDS/Components/ListUnordered/ListUnorderedItemModel.swift index 94c88e02..9726e92b 100644 --- a/VDS/Components/ListUnordered/ListUnorderedItemModel.swift +++ b/VDS/Components/ListUnordered/ListUnorderedItemModel.swift @@ -13,11 +13,11 @@ extension ListUnordered { public var levelOneText: String /// Item Level 2 that shows text (one or many) with glyph - en dash. This is optional. - public var levelTwoText: [String]? + public var levelTwoText: [String?]? - public init(itemLevelOneText: String, itemLevelTwoTexts: [String]? = nil) { + public init(itemLevelOneText: String, itemLevelTwoTexts: [String?]? = nil) { self.levelOneText = itemLevelOneText - self.levelTwoText = itemLevelTwoTexts ?? [] + self.levelTwoText = itemLevelTwoTexts } } } From 16516fbeed2566e4c07855e1ec63b3cabd800a7d Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Mon, 21 Oct 2024 12:47:43 +0530 Subject: [PATCH 6/6] Digital ACT-191 ONEAPP-11355 story: updated release notes --- VDS/SupportingFiles/ReleaseNotes.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 6c854af8..9a571773 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,3 +1,7 @@ +1.0.76 +---------------- +- ONEAPP-11355 - ListUnordered - Finished Development + 1.0.75 ---------------- - CXTDT-624895 - Badge - Custom FillColor and TextColor