Merge branch 'develop' into feature/tileletEnhancements

This commit is contained in:
Krishna Kishore Bandaru 2024-03-07 14:00:28 +05:30
commit cb40014395
5 changed files with 47 additions and 21 deletions

View File

@ -16,7 +16,6 @@ class LoaderViewController: BaseViewController<Loader>, LoaderLaunchable {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
contentTopView.height(constant: 80)
addContentTopView(view: component) addContentTopView(view: component)
setupPicker() setupPicker()
} }

View File

@ -88,7 +88,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable {
MenuComponent(title: "RadioButtonGroup", completed: true, viewController: RadioButtonGroupViewController.self), MenuComponent(title: "RadioButtonGroup", completed: true, viewController: RadioButtonGroupViewController.self),
// //MenuComponent(title: "TabsContainer", completed: false, viewController: TabsContainerViewController.self), // //MenuComponent(title: "TabsContainer", completed: false, viewController: TabsContainerViewController.self),
MenuComponent(title: "Tabs", completed: true, viewController: TabsViewController.self), MenuComponent(title: "Tabs", completed: true, viewController: TabsViewController.self),
MenuComponent(title: "TextArea", completed: false, viewController: TextAreaViewController.self), MenuComponent(title: "TextArea", completed: true, viewController: TextAreaViewController.self),
MenuComponent(title: "TextLink", completed: true, viewController: TextLinkViewController.self), MenuComponent(title: "TextLink", completed: true, viewController: TextLinkViewController.self),
MenuComponent(title: "TextLinkCaret", completed: true, viewController: TextLinkCaretViewController.self), MenuComponent(title: "TextLinkCaret", completed: true, viewController: TextLinkCaretViewController.self),
MenuComponent(title: "TileContainer", completed: true, viewController: TileContainerViewController.self), MenuComponent(title: "TileContainer", completed: true, viewController: TileContainerViewController.self),

View File

@ -5,7 +5,6 @@
// Created by Matt Bruce on 1/10/23. // Created by Matt Bruce on 1/10/23.
// //
import Foundation
import Foundation import Foundation
import UIKit import UIKit
import VDS import VDS
@ -23,28 +22,38 @@ class TextAreaViewController: BaseViewController<TextArea> {
var showErrorSwitch = Toggle() var showErrorSwitch = Toggle()
var tooltipTitleTextField = TextField() var tooltipTitleTextField = TextField()
var tooltipContentTextField = TextField() var tooltipContentTextField = TextField()
var maxLengthTextField = NumericField()
var readOnlySwitch = Toggle()
lazy var heightPickerSelectorView = {
PickerSelectorView(title: "2X",
picker: self.picker,
items: TextArea.Height.allCases)
}()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
addContentTopView(view: component) addContentTopView(view: component)
component.text = "Starting Text"
setupPicker() setupPicker()
setupModel() setupModel()
} }
override func setupForm(){ override func setupForm(){
super.setupForm() super.setupForm()
addFormRow(label: "Disabled", view: disabledSwitch) addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Required", view: requiredSwitch) addFormRow(label: "Required", view: requiredSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView) addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField) addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Helper Text", view: helperTextField) addFormRow(label: "Helper Text", view: helperTextField)
addFormRow(label: "Read Only", view: readOnlySwitch)
addFormRow(label: "Error", view: showErrorSwitch) addFormRow(label: "Error", view: showErrorSwitch)
addFormRow(label: "Error Text", view: errorTextField) addFormRow(label: "Error Text", view: errorTextField)
addFormRow(label: "Width", view: widthTextField)
addFormRow(label: "ToolTip Title", view: tooltipTitleTextField) addFormRow(label: "ToolTip Title", view: tooltipTitleTextField)
addFormRow(label: "ToolTip Content", view: tooltipContentTextField) addFormRow(label: "ToolTip Content", view: tooltipContentTextField)
addFormRow(label: "Character Count", view: maxLengthTextField)
addFormRow(label: "Min Height", view: heightPickerSelectorView)
requiredSwitch.onChange = { [weak self] sender in requiredSwitch.onChange = { [weak self] sender in
self?.component.required = sender.isOn self?.component.required = sender.isOn
} }
@ -61,6 +70,10 @@ class TextAreaViewController: BaseViewController<TextArea> {
self?.component.isEnabled = !sender.isOn self?.component.isEnabled = !sender.isOn
} }
readOnlySwitch.onChange = { [weak self] sender in
self?.component.readOnly = sender.isOn
}
labelTextField labelTextField
.textPublisher .textPublisher
.sink { [weak self] text in .sink { [weak self] text in
@ -82,7 +95,10 @@ class TextAreaViewController: BaseViewController<TextArea> {
widthTextField widthTextField
.numberPublisher .numberPublisher
.sink { [weak self] number in .sink { [weak self] number in
guard let number else { return } guard let number else {
self?.component.width = nil
return
}
self?.component.width = number.cgFloatValue self?.component.width = number.cgFloatValue
}.store(in: &subscribers) }.store(in: &subscribers)
@ -98,6 +114,15 @@ class TextAreaViewController: BaseViewController<TextArea> {
self?.updateTooltip() self?.updateTooltip()
}.store(in: &subscribers) }.store(in: &subscribers)
maxLengthTextField
.numberPublisher
.sink { [weak self] number in
guard let number else {
self?.component.maxLength = nil
return
}
self?.component.maxLength = number.intValue
}.store(in: &subscribers)
} }
func setupModel() { func setupModel() {
@ -106,15 +131,14 @@ class TextAreaViewController: BaseViewController<TextArea> {
component.helperText = "For example: 123 Verizon St" component.helperText = "For example: 123 Verizon St"
component.errorText = "Enter a valid address." component.errorText = "Enter a valid address."
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name") component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
component component
.publisher(for: .valueChanged) .publisher(for: .valueChanged)
.sink { component in .sink { component in
if let text = component.value { // if let text = component.value {
print("text entry: \(text)") // print("text entry: \(text)")
} else { // } else {
print("text entry: null") // print("text entry: null")
} // }
}.store(in: &subscribers) }.store(in: &subscribers)
//setup UI //setup UI
@ -135,6 +159,10 @@ class TextAreaViewController: BaseViewController<TextArea> {
self?.component.surface = item self?.component.surface = item
self?.contentTopView.backgroundColor = item.color self?.contentTopView.backgroundColor = item.color
} }
heightPickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.minHeight = item
}
} }
func updateTooltip() { func updateTooltip() {

View File

@ -22,7 +22,7 @@ class TileletViewController: BaseViewController<Tilelet> {
lazy var otherStandardStylePickerSelectorView = { lazy var otherStandardStylePickerSelectorView = {
PickerSelectorView(title: "", PickerSelectorView(title: "",
picker: self.picker, picker: self.picker,
items: Tilelet.SubTitleModel.StandardStyle.allCases.sorted{ $0.rawValue < $1.rawValue }) items: Tilelet.SubTitleModel.OtherStandardStyle.allCases.sorted{ $0.rawValue < $1.rawValue })
}() }()
lazy var subtitleColorPickerSelectorView = { lazy var subtitleColorPickerSelectorView = {
@ -195,8 +195,7 @@ class TileletViewController: BaseViewController<Tilelet> {
//setup UI //setup UI
surfacePickerSelectorView.text = component.surface.rawValue surfacePickerSelectorView.text = component.surface.rawValue
paddingPickerSelectorView.text = component.padding.rawValue otherStandardStylePickerSelectorView.text = subTitleModel.otherStandardStyle.rawValue
otherStandardStylePickerSelectorView.text = subTitleModel.standardStyle.rawValue
titleStandardStylePickerSelectorView.text = titleModel.standardStyle.rawValue titleStandardStylePickerSelectorView.text = titleModel.standardStyle.rawValue
subtitleColorPickerSelectorView.text = subTitleModel.textColor.rawValue subtitleColorPickerSelectorView.text = subTitleModel.textColor.rawValue
titleTextField.text = titleModel.text titleTextField.text = titleModel.text
@ -225,7 +224,7 @@ class TileletViewController: BaseViewController<Tilelet> {
func setSubTitleModel() { func setSubTitleModel() {
if let text = subTitleTextField.text, !text.isEmpty { if let text = subTitleTextField.text, !text.isEmpty {
component.subTitleModel = Tilelet.SubTitleModel(text: text, standardStyle: otherStandardStylePickerSelectorView.selectedItem) component.subTitleModel = Tilelet.SubTitleModel(text: text, otherStandardStyle: otherStandardStylePickerSelectorView.selectedItem)
} else { } else {
component.subTitleModel = nil component.subTitleModel = nil
} }
@ -233,7 +232,7 @@ class TileletViewController: BaseViewController<Tilelet> {
func updateOtherTextStyles() { func updateOtherTextStyles() {
let items = component.titleLockup.standardStyleConfiguration.configuration(for: titleStandardStylePickerSelectorView.selectedItem.value)!.allOtherStandardStyles let items = component.titleLockup.standardStyleConfiguration.configuration(for: titleStandardStylePickerSelectorView.selectedItem.value)!.allOtherStandardStyles
let otheritems = items.compactMap { Tilelet.SubTitleModel.StandardStyle(rawValue: $0.rawValue)! } let otheritems = items.compactMap { Tilelet.SubTitleModel.OtherStandardStyle(rawValue: $0.rawValue)! }
otherStandardStylePickerSelectorView.items = otheritems otherStandardStylePickerSelectorView.items = otheritems
otherStandardStylePickerSelectorView.text = otheritems.first?.rawValue ?? "" otherStandardStylePickerSelectorView.text = otheritems.first?.rawValue ?? ""
setSubTitleModel() setSubTitleModel()

View File

@ -106,7 +106,7 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
//setup UI //setup UI
surfacePickerSelectorView.text = component.surface.rawValue surfacePickerSelectorView.text = component.surface.rawValue
textAlignmentPickerSelectorView.text = TextAlignment.left.rawValue textAlignmentPickerSelectorView.text = TextAlignment.left.rawValue
otherStandardStylePickerSelectorView.text = subTitleModel.standardStyle.rawValue otherStandardStylePickerSelectorView.text = subTitleModel.otherStandardStyle.rawValue
titleStandardStylePickerSelectorView.text = titleModel.standardStyle.rawValue titleStandardStylePickerSelectorView.text = titleModel.standardStyle.rawValue
subtitleColorPickerSelectorView.text = subTitleModel.textColor.rawValue subtitleColorPickerSelectorView.text = subTitleModel.textColor.rawValue
eyebrowTextField.text = eyebrowModel.text eyebrowTextField.text = eyebrowModel.text
@ -139,7 +139,7 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
let style = otherStandardStylePickerSelectorView.selectedItem let style = otherStandardStylePickerSelectorView.selectedItem
if let text = subTitleTextField.text, !text.isEmpty { if let text = subTitleTextField.text, !text.isEmpty {
component.subTitleModel = TitleLockup.SubTitleModel(text: text, standardStyle: style, textColor: subtitleColorPickerSelectorView.selectedItem) component.subTitleModel = TitleLockup.SubTitleModel(text: text, otherStandardStyle: style, textColor: subtitleColorPickerSelectorView.selectedItem)
debug(type: "SubTitle", textStyle: style.value.regular) debug(type: "SubTitle", textStyle: style.value.regular)
} else { } else {
component.subTitleModel = nil component.subTitleModel = nil