convert forms to use Toggle/Button instead of native

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-11-18 14:44:50 -06:00
parent 17aa07ee1c
commit 8d6c744ae4
13 changed files with 51 additions and 50 deletions

View File

@ -37,9 +37,10 @@ public class PickerSelectorView<EnumType: RawRepresentable>: UIStackView, Picker
fileprivate var selectedIndex = 0
private var subscribers = Set<AnyCancellable>()
private var label = UILabel()
private var button = UIButton(type: .system).with { instance in
instance.configuration = .filled()
instance.setTitle("Select", for: .normal)
private var button = Button().with { instance in
instance.size = .small
instance.use = .secondary
instance.text = "Select"
}
public var text: String = "" {

View File

@ -19,7 +19,7 @@ class ButtonGroupViewController: BaseViewController {
items: ButtonPosition.allCases)
}()
var disabledSwitch = UISwitch()
var disabledSwitch = Toggle()
var widthTextField = TextField()
let buttonGroup = ButtonGroup()
@ -42,7 +42,7 @@ class ButtonGroupViewController: BaseViewController {
func setupForm(){
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Position", view: buttonPositionSelectorView)
// addFormRow(label: "Width", view: widthTextField)

View File

@ -24,7 +24,7 @@ class ButtonViewController: BaseViewController {
items: ButtonSize.allCases)
}()
var disabledSwitch = UISwitch()
var disabledSwitch = Toggle()
var textField = TextField()
var widthTextField = TextField()
@ -43,7 +43,7 @@ class ButtonViewController: BaseViewController {
func setupForm(){
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Use", view: usePickerSelectorView)
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Label", view: textField)
addFormRow(label: "Width", view: widthTextField)
addFormRow(label: "Size", view: buttonSizePickerSelectorView)

View File

@ -13,10 +13,10 @@ import Combine
class CheckboxGroupViewController: BaseViewController {
var disabledSwitch = UISwitch()
var disabledSwitch = Toggle()
var labelTextField = TextField()
var childTextField = TextField()
var showErrorSwitch = UISwitch()
var showErrorSwitch = Toggle()
var checkboxGroup = CheckboxGroup()
@ -30,11 +30,11 @@ class CheckboxGroupViewController: BaseViewController {
}
func setupForm() {
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Child Text", view: childTextField)
addFormRow(label: "Error", view: showErrorSwitch)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
showErrorSwitch
.publisher(for: .valueChanged)

View File

@ -13,11 +13,11 @@ import Combine
class CheckboxViewController: BaseViewController {
var disabledSwitch = UISwitch()
var disabledSwitch = Toggle()
var labelTextField = TextField()
var childTextField = TextField()
var errorTextField = TextField()
var showErrorSwitch = UISwitch()
var showErrorSwitch = Toggle()
var checkbox = SoloCheckbox()
@ -31,11 +31,11 @@ class CheckboxViewController: BaseViewController {
}
func setupForm(){
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Child Text", view: childTextField)
addFormRow(label: "Error", view: showErrorSwitch)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
addFormRow(label: "Error Text", view: errorTextField)
showErrorSwitch

View File

@ -22,8 +22,8 @@ class LabelViewController: BaseViewController {
picker: self.picker)
}()
var boldSwitch = UISwitch()
var disabledSwitch = UISwitch()
var boldSwitch = Toggle()
var disabledSwitch = Toggle()
var textField = TextField()
private var isBold: Bool = false
@ -39,8 +39,8 @@ class LabelViewController: BaseViewController {
}
func setupForm(){
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Bold", view: boldSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Bold", view: .makeWrapper(for: boldSwitch))
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Font Category", view: fontCategoryPickerSelectorView)
addFormRow(label: "Text Size", view: textSizePickerSelectorView)

View File

@ -13,12 +13,12 @@ import Combine
class RadioBoxGroupViewController: BaseViewController {
var disabledSwitch = UISwitch()
var strikeThroughSwitch = UISwitch()
var disabledSwitch = Toggle()
var strikeThroughSwitch = Toggle()
var textField = TextField()
var subTextField = TextField()
var subTextRightField = TextField()
var showErrorSwitch = UISwitch()
var showErrorSwitch = Toggle()
var radioBoxGroup = RadioBoxGroup()
@ -32,9 +32,9 @@ class RadioBoxGroupViewController: BaseViewController {
}
func setupForm() {
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Strikethrough", view: strikeThroughSwitch)
addFormRow(label: "Strikethrough", view: .makeWrapper(for: strikeThroughSwitch))
addFormRow(label: "Text", view: textField)
addFormRow(label: "Sub Text", view: subTextField)
addFormRow(label: "Sub Text Right", view: subTextRightField)

View File

@ -13,10 +13,10 @@ import Combine
class RadioButtonViewController: BaseViewController {
var disabledSwitch = UISwitch()
var disabledSwitch = Toggle()
var labelTextField = TextField()
var childTextField = TextField()
var showErrorSwitch = UISwitch()
var showErrorSwitch = Toggle()
var radioButtonGroup = RadioButtonGroup()
@ -30,11 +30,11 @@ class RadioButtonViewController: BaseViewController {
}
func setupForm() {
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Child Text", view: childTextField)
addFormRow(label: "Error", view: showErrorSwitch)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
showErrorSwitch
.publisher(for: .valueChanged)

View File

@ -13,8 +13,8 @@ import Combine
class RadioSwatchGroupViewController: BaseViewController {
var disabledSwitch = UISwitch()
var strikeThroughSwitch = UISwitch()
var disabledSwitch = Toggle()
var strikeThroughSwitch = Toggle()
var radioSwatchGroup = RadioSwatchGroup()
override func viewDidLoad() {
@ -26,9 +26,9 @@ class RadioSwatchGroupViewController: BaseViewController {
}
func setupForm() {
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Strikethrough", view: strikeThroughSwitch)
addFormRow(label: "Strikethrough", view: .makeWrapper(for: strikeThroughSwitch))
disabledSwitch
.publisher(for: .valueChanged)

View File

@ -19,15 +19,15 @@ class TextEntryFieldViewController: BaseViewController {
items: HelperTextPlacement.allCases)
}()
var disabledSwitch = UISwitch()
var requiredSwitch = UISwitch()
var disabledSwitch = Toggle()
var requiredSwitch = Toggle()
var labelTextField = TextField()
var errorTextField = TextField()
var successTextField = TextField()
var helperTextField = TextField()
var widthTextField = TextField()
var showErrorSwitch = UISwitch()
var showSuccessSwitch = UISwitch()
var showErrorSwitch = Toggle()
var showSuccessSwitch = Toggle()
var tooltipTitleTextField = TextField()
var tooltipContentTextField = TextField()
@ -42,15 +42,15 @@ class TextEntryFieldViewController: BaseViewController {
}
func setupForm(){
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Required", view: requiredSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Required", view: .makeWrapper(for: requiredSwitch))
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Label Text", view: labelTextField)
addFormRow(label: "Helper Text Placement", view: helperTextPlacementPickerSelectorView)
addFormRow(label: "Helper Text", view: helperTextField)
addFormRow(label: "Error", view: showErrorSwitch)
addFormRow(label: "Error", view: .makeWrapper(for: showErrorSwitch))
addFormRow(label: "Error Text", view: errorTextField)
addFormRow(label: "Success", view: showSuccessSwitch)
addFormRow(label: "Success", view: .makeWrapper(for: showSuccessSwitch))
addFormRow(label: "Success Text", view: successTextField)
addFormRow(label: "Width", view: widthTextField)
addFormRow(label: "ToolTip Title", view: tooltipTitleTextField)

View File

@ -18,7 +18,7 @@ class TextLinkCaretViewController: BaseViewController {
items: TextLinkCaretPosition.allCases)
}()
var disabledSwitch = UISwitch()
var disabledSwitch = Toggle()
var textField = TextField()
lazy var textLinkCaret: TextLinkCaret = {
makeTextLinkCaret("Text Link Caret")
@ -35,7 +35,7 @@ class TextLinkCaretViewController: BaseViewController {
func setupForm(){
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Label", view: textField)
addFormRow(label: "Caret Position", view: caretPositionPickerSelectorView)

View File

@ -18,7 +18,7 @@ class TextLinkViewController: BaseViewController {
items: ButtonSize.allCases)
}()
var disabledSwitch = UISwitch()
var disabledSwitch = Toggle()
var textField = TextField()
lazy var textLink: TextLink = {
makeTextLink("Text Link")
@ -36,7 +36,7 @@ class TextLinkViewController: BaseViewController {
func setupForm(){
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
addFormRow(label: "Label", view: textField)
addFormRow(label: "Size", view: buttonSizePickerSelectorView)

View File

@ -25,8 +25,8 @@ class ToggleViewController: BaseViewController {
items: ToggleTextPosition.allCases)
}()
var disabledSwitch = UISwitch()
var showTextSwitch = UISwitch()
var disabledSwitch = Toggle()
var showTextSwitch = Toggle()
var textFormStackView: UIStackView = {
return UIStackView().with {
@ -38,7 +38,7 @@ class ToggleViewController: BaseViewController {
}
}()
var boldSwitch = UISwitch()
var boldSwitch = Toggle()
var onTextField = TextField()
var offTextField = TextField()
@ -54,12 +54,12 @@ class ToggleViewController: BaseViewController {
func setupForm() {
addFormRow(label: "Show Text", view: showTextSwitch)
addFormRow(label: "Show Text", view: .makeWrapper(for: showTextSwitch))
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch))
//add the hidden elements to textFormStackView
addFormRow(label: "Bold", view: boldSwitch, stackView: textFormStackView)
addFormRow(label: "Bold", view: .makeWrapper(for: boldSwitch), stackView: textFormStackView)
addFormRow(label: "Text Size", view: textSizePickerSelectorView, stackView: textFormStackView)
addFormRow(label: "Text Position", view: textPositionPickerSelectorView, stackView: textFormStackView)
addFormRow(label: "On Text", view: onTextField, stackView: textFormStackView)