From 8f7f4d34df1e5a74bda3f1c35d13b8ea0d8589d1 Mon Sep 17 00:00:00 2001 From: Vladimir Kaltyrin Date: Fri, 6 Dec 2024 21:17:11 +0300 Subject: [PATCH] feat(sdds-components): styles api migration --- .../SDDSComponents.xcodeproj/project.pbxproj | 404 +++++++++------- .../SDDSAvatar/AvatarAppearance.swift | 17 - .../SDDSAvatar/SDDSAvatarPreview.swift | 122 +---- .../SDDSAvatarGroupPreview.swift | 12 +- .../CheckboxAppearance+Extensions.swift | 16 - .../SDDSCheckbox/SDDSCheckbox+Preview.swift | 84 ---- .../SDDSCheckbox/SDDSCheckboxPreview.swift | 20 + .../SDDSCheckboxGroup+Preview.swift | 6 +- .../SDDSChip/SDDSChip+Preview.swift | 103 ---- .../Components/SDDSChip/SDDSChipPreview.swift | 20 + .../SDDSChipGroup/SDDSChipGroup+Preview.swift | 4 +- .../ProgressBarAppearance+Extensions.swift | 21 - .../SDDSProgress+Preview.swift | 92 ---- .../SDDSProgressBarPreview.swift | 17 + .../RadioboxAppearance+Extensions.swift | 33 -- .../SDDSRadiobox/SDDSRadiobox+Preview.swift | 84 ---- .../SDDSRadiobox/SDDSRadioboxPreview.swift | 20 + .../SDDSRadioboxGroup+Preview.swift | 3 +- .../SDDSSwitch/SDDSSwitch+Preview.swift | 78 --- .../SDDSSwitch/SDDSSwitchPreview.swift | 20 + .../SDDSTextArea/SDDSTextArea+Preview.swift | 1 - .../SDDSTextAreaAppearance+Extensions.swift | 1 + .../SDDSTextField/SDDSTextField+Preview.swift | 1 - .../Utilities/Image+Extensions.swift | 0 .../Common/AppearanceVariation.swift | 19 + .../AvatarAccessibility.swift | 11 + .../AvatarAppearance+Extensions.swift | 100 ++++ .../AvatarAppearance/AvatarAppearance.swift | 51 ++ .../AvatarAppearance/AvatarImageSource.swift | 14 + .../AvatarSizeConfiguration.swift | 23 + .../AvatarAppearance/AvatarStatus.swift | 7 + .../Components/SDDSAvatar/SDDSAvatar.swift | 125 +---- .../SDDSAvatar/SDDSAvatarData.swift | 4 - .../SDDSAvatar/SDDSAvatarModifiers.swift | 7 - .../SDDSCheckbox/CheckboxAppearance.swift | 21 - .../CheckboxAppearance+Extensions.swift | 99 ++++ .../CheckboxAppearance.swift | 39 ++ .../SDDSCheckbox/CheckboxData.swift | 53 +++ .../SDDSCheckbox/SDDSCheckbox.swift | 60 --- .../SDDSCheckboxGroup/SDDSCheckboxGroup.swift | 3 - .../ChipAppearance/ChipAccessibility.swift | 25 + .../ChipAppearance+Extensions.swift | 100 ++++ .../{ => ChipAppearance}/ChipAppearance.swift | 16 +- .../ChipAppearance/ChipBorderStyle.swift | 22 + .../ChipSizeConfiguration.swift | 35 ++ .../Components/SDDSChip/ChipData.swift | 45 ++ .../Components/SDDSChip/SDDSChip.swift | 96 +--- .../SDDSChipGroup/SDDSChipGroup.swift | 62 +-- .../ProgressBarAppearance.swift | 18 - .../ProgressBarAccessibility.swift | 30 ++ .../ProgressBarAppearance+Extensions.swift | 35 ++ .../ProgressBarAppearance.swift | 30 ++ .../ProgressBarSizeConfiguration.swift | 28 ++ .../SDDSProgressBar/SDDSProgressBar.swift | 60 +-- .../SDDSRadiobox/RadioboxAppearance.swift | 21 - .../RadioboxAppearance+Extensions.swift | 99 ++++ .../RadioboxAppearance.swift | 39 ++ .../SDDSRadiobox/RadioboxData.swift | 46 ++ .../SDDSRadiobox/SDDSRadiobox.swift | 4 - .../SDDSRadioboxGroup/SDDSRadioboxGroup.swift | 49 -- .../Components/SDDSSwitch/SDDSSwitch.swift | 142 +----- .../SwitchAccessibility.swift | 53 +++ .../SwitchAppearance+Extensions.swift | 100 ++++ .../SwitchAppearance/SwitchAppearance.swift | 82 ++++ .../SwitchSizeConfiguration.swift | 25 + .../SDDSTextArea/SDDSTextArea.swift | 2 +- .../SDDSTextField/SDDSTextField.swift | 13 +- .../TextFieldSizeConfiguration.swift | 3 +- .../SelectionControl/SelectionControl.swift | 23 +- .../SelectionControlAppearance.swift | 1 + .../AvatarGroupViewModel.swift | 12 +- .../Views/AvatarView/AvatarView.swift | 27 +- .../Views/AvatarView/AvatarViewModel.swift | 35 +- .../CheckboxGroupViewModel.swift | 4 +- .../Views/CheckboxView/CheckboxView.swift | 54 +-- .../CheckboxView/CheckboxViewModel.swift | 91 +--- .../Views/ChipGroupView/ChipGroupView.swift | 18 +- .../ChipGroupView/ChipGroupViewModel.swift | 30 +- .../SDDSDemoApp/Views/ChipView/ChipView.swift | 36 +- .../Views/ChipView/ChipViewModel.swift | 32 +- .../ProgressBarView/ProgressBarView.swift | 75 +-- .../ProgressBarViewModel.swift | 71 +-- .../RadioboxGroupViewModel.swift | 4 +- .../Views/RadioboxView/RadioboxView.swift | 53 +-- .../RadioboxView/RadioboxViewModel.swift | 78 ++- .../Views/SwitchView/SwitchView.swift | 71 +-- .../Views/SwitchView/SwitchViewModel.swift | 106 ++--- .../TextAreaView/TextAreaViewModel.swift | 9 +- .../TextFieldView/TextFieldViewModel.swift | 6 +- .../contents.xcworkspacedata | 7 + .../xcshareddata/swiftpm/Package.resolved | 96 ++-- .../Stencil/LinkButtonTypography.stencil | 2 +- .../BasicButton+ColorVariations.swift | 445 ++++++++++++++++++ .../BasicButton+SizeVariations.swift | 54 +++ .../SDDSButton/BasicButton+Typography.swift | 27 ++ ...icButtonSize+ButtonSizeConfiguration.swift | 80 ++++ Themes/SDDSButton/BasicButtonTypography.swift | 41 ++ .../IconButton+ColorVariations.swift | 425 +++++++++++++++++ .../IconButton+SizeVariations.swift | 46 ++ ...onButtonSize+ButtonSizeConfiguration.swift | 80 ++++ .../LinkButton+ColorVariations.swift | 272 +++++++++++ .../LinkButton+SizeVariations.swift | 50 ++ Themes/SDDSButton/LinkButton+Typography.swift | 17 + ...nkButtonSize+ButtonSizeConfiguration.swift | 75 +++ Themes/SDDSButton/LinkButtonTypography.swift | 41 ++ .../SDDSAvatar/AvatarTypography.swift | 4 +- .../SDDSAvatar+ColorVariations.swift | 34 ++ .../SDDSAvatar+SizeVariations.swift | 69 +++ .../SDDSAvatar/SDDSAvatarSize.swift | 2 +- .../BasicButton+ColorVariations.swift | 2 + .../BasicButton+SizeVariations.swift | 2 + .../SDDSButton/BasicButton+Typography.swift | 9 +- ...icButtonSize+ButtonSizeConfiguration.swift | 2 + .../SDDSButton/BasicButtonTypography.swift | 28 +- .../IconButton+ColorVariations.swift | 2 + .../IconButton+SizeVariations.swift | 2 + ...onButtonSize+ButtonSizeConfiguration.swift | 2 + .../LinkButton+ColorVariations.swift | 2 + .../LinkButton+SizeVariations.swift | 2 + .../SDDSButton/LinkButton+Typography.swift | 6 +- ...nkButtonSize+ButtonSizeConfiguration.swift | 2 + .../SDDSButton/LinkButtonTypography.swift | 29 +- .../SDDSCheckbox+ColorVariations.swift | 33 ++ .../SDDSCheckbox+SizeVariations.swift | 34 ++ .../SDDSCheckbox+Typography.swift | 6 +- .../SDDSCheckbox/SDDSCheckboxSize.swift | 2 +- .../SDDSChip/ChipTypography.swift | 17 +- .../SDDSChip/SDDSChip+ColorVariations.swift | 140 ++++++ .../SDDSChip/SDDSChip+Pilled.swift | 19 + .../SDDSChip/SDDSChip+SizeVariations.swift | 59 +++ .../SDDSChip/SDDSChipSize.swift | 16 +- .../SDDSProgressView+ColorVariations.swift | 164 +++++++ .../SDDSProgressViewSize.swift | 5 +- .../SDDSRadiobox+ColorVariations.swift | 33 ++ .../SDDSRadiobox+SizeVariations.swift | 34 ++ .../SDDSRadiobox+Typography.swift | 16 + .../SDDSRadiobox/SDDSRadioboxSize.swift | 4 +- .../SDDSSwitch+ColorVariations.swift | 33 ++ .../SDDSSwitch+SizeVariations.swift | 48 ++ .../SDDSSwitch/SDDSSwitch+Typography.swift | 1 + .../SDDSSwitch/SDDSSwitchSize.swift | 4 +- .../SDDSSwitch/SwitchTypography.swift | 0 142 files changed, 4406 insertions(+), 2150 deletions(-) delete mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/AvatarAppearance.swift delete mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/CheckboxAppearance+Extensions.swift delete mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/SDDSCheckbox+Preview.swift create mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/SDDSCheckboxPreview.swift delete mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/SDDSChip+Preview.swift create mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/SDDSChipPreview.swift delete mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/ProgressBarAppearance+Extensions.swift delete mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/SDDSProgress+Preview.swift create mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/SDDSProgressBarPreview.swift delete mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/RadioboxAppearance+Extensions.swift delete mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/SDDSRadiobox+Preview.swift create mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/SDDSRadioboxPreview.swift delete mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SDDSSwitch+Preview.swift create mode 100644 SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SDDSSwitchPreview.swift rename SDDSComponents/SDDSComponentsPreview/{ => Components}/Utilities/Image+Extensions.swift (100%) create mode 100644 SDDSComponents/Sources/SDDSComponents/Common/AppearanceVariation.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAccessibility.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAppearance+Extensions.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAppearance.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarImageSource.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarSizeConfiguration.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarStatus.swift delete mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance/CheckboxAppearance+Extensions.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance/CheckboxAppearance.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxData.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipAccessibility.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipAppearance+Extensions.swift rename SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/{ => ChipAppearance}/ChipAppearance.swift (73%) create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipBorderStyle.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipSizeConfiguration.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipData.swift delete mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAccessibility.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAppearance+Extensions.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAppearance.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarSizeConfiguration.swift delete mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance/RadioboxAppearance+Extensions.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance/RadioboxAppearance.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxData.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAccessibility.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAppearance+Extensions.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAppearance.swift create mode 100644 SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchSizeConfiguration.swift create mode 100644 SDDSIcons/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata create mode 100644 Themes/SDDSButton/BasicButton+ColorVariations.swift create mode 100644 Themes/SDDSButton/BasicButton+SizeVariations.swift create mode 100644 Themes/SDDSButton/BasicButton+Typography.swift create mode 100644 Themes/SDDSButton/BasicButtonSize+ButtonSizeConfiguration.swift create mode 100644 Themes/SDDSButton/BasicButtonTypography.swift create mode 100644 Themes/SDDSButton/IconButton+ColorVariations.swift create mode 100644 Themes/SDDSButton/IconButton+SizeVariations.swift create mode 100644 Themes/SDDSButton/IconButtonSize+ButtonSizeConfiguration.swift create mode 100644 Themes/SDDSButton/LinkButton+ColorVariations.swift create mode 100644 Themes/SDDSButton/LinkButton+SizeVariations.swift create mode 100644 Themes/SDDSButton/LinkButton+Typography.swift create mode 100644 Themes/SDDSButton/LinkButtonSize+ButtonSizeConfiguration.swift create mode 100644 Themes/SDDSButton/LinkButtonTypography.swift rename {SDDSComponents/SDDSComponentsPreview/Components => Themes/SDDSservTheme}/SDDSAvatar/AvatarTypography.swift (93%) create mode 100644 Themes/SDDSservTheme/SDDSAvatar/SDDSAvatar+ColorVariations.swift create mode 100644 Themes/SDDSservTheme/SDDSAvatar/SDDSAvatar+SizeVariations.swift rename SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/DefaultAvatarSize.swift => Themes/SDDSservTheme/SDDSAvatar/SDDSAvatarSize.swift (96%) create mode 100644 Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+ColorVariations.swift create mode 100644 Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+SizeVariations.swift rename SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/CheckboxTypography.swift => Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+Typography.swift (91%) rename {SDDSComponents/SDDSComponentsPreview/Components => Themes/SDDSservTheme}/SDDSCheckbox/SDDSCheckboxSize.swift (95%) rename SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/ChipAppearance+Extensions.swift => Themes/SDDSservTheme/SDDSChip/ChipTypography.swift (68%) create mode 100644 Themes/SDDSservTheme/SDDSChip/SDDSChip+ColorVariations.swift create mode 100644 Themes/SDDSservTheme/SDDSChip/SDDSChip+Pilled.swift create mode 100644 Themes/SDDSservTheme/SDDSChip/SDDSChip+SizeVariations.swift rename {SDDSComponents/SDDSComponentsPreview/Components => Themes/SDDSservTheme}/SDDSChip/SDDSChipSize.swift (88%) create mode 100644 Themes/SDDSservTheme/SDDSProgressBar/SDDSProgressView+ColorVariations.swift rename SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/DefaultProgressBarSize.swift => Themes/SDDSservTheme/SDDSProgressBar/SDDSProgressViewSize.swift (74%) create mode 100644 Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+ColorVariations.swift create mode 100644 Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+SizeVariations.swift rename SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/RadioboxTypography.swift => Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+Typography.swift (57%) rename {SDDSComponents/SDDSComponentsPreview/Components => Themes/SDDSservTheme}/SDDSRadiobox/SDDSRadioboxSize.swift (84%) create mode 100644 Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+ColorVariations.swift create mode 100644 Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+SizeVariations.swift rename SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SwitchAppearance+Extensions.swift => Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+Typography.swift (96%) rename {SDDSComponents/SDDSComponentsPreview/Components => Themes/SDDSservTheme}/SDDSSwitch/SDDSSwitchSize.swift (85%) rename {SDDSComponents/SDDSComponentsPreview/Components => Themes/SDDSservTheme}/SDDSSwitch/SwitchTypography.swift (100%) diff --git a/SDDSComponents/SDDSComponents.xcodeproj/project.pbxproj b/SDDSComponents/SDDSComponents.xcodeproj/project.pbxproj index 3aa87011c..e2a48308f 100644 --- a/SDDSComponents/SDDSComponents.xcodeproj/project.pbxproj +++ b/SDDSComponents/SDDSComponents.xcodeproj/project.pbxproj @@ -13,6 +13,23 @@ 8102BA322CBE9B3300C589D3 /* TextAreaSizeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8102BA2D2CBE9B3300C589D3 /* TextAreaSizeConfiguration.swift */; }; 8102BA3A2CBEAFB800C589D3 /* PlaceholderTextEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8102BA392CBEAFB800C589D3 /* PlaceholderTextEditor.swift */; }; 8102BA3C2CBEB32700C589D3 /* ExpandingTextEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8102BA3B2CBEB32700C589D3 /* ExpandingTextEditor.swift */; }; + 811D2E122D10A4BA001C0F48 /* TextFieldAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E0C2D10A4BA001C0F48 /* TextFieldAppearance+Extensions.swift */; }; + 811D2E132D10A4BA001C0F48 /* TextFieldDefaultSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E0D2D10A4BA001C0F48 /* TextFieldDefaultSize.swift */; }; + 811D2E142D10A4BA001C0F48 /* TextFieldTypography.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E0E2D10A4BA001C0F48 /* TextFieldTypography.swift */; }; + 811D2E152D10A4BA001C0F48 /* SDDSTextField+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E0F2D10A4BA001C0F48 /* SDDSTextField+Preview.swift */; }; + 811D2E162D10A4BA001C0F48 /* ChipAppearance+SDDSTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E102D10A4BA001C0F48 /* ChipAppearance+SDDSTextField.swift */; }; + 811D2E172D10A4BA001C0F48 /* TextFieldChipSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E112D10A4BA001C0F48 /* TextFieldChipSize.swift */; }; + 811D2E1D2D10A59F001C0F48 /* TextAreaChipSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E182D10A59F001C0F48 /* TextAreaChipSize.swift */; }; + 811D2E1E2D10A59F001C0F48 /* SDDSTextAreaSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E192D10A59F001C0F48 /* SDDSTextAreaSize.swift */; }; + 811D2E1F2D10A59F001C0F48 /* SDDSTextAreaAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E1A2D10A59F001C0F48 /* SDDSTextAreaAppearance+Extensions.swift */; }; + 811D2E202D10A59F001C0F48 /* SDDSTextAreaChipGroupSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E1B2D10A59F001C0F48 /* SDDSTextAreaChipGroupSize.swift */; }; + 811D2E212D10A59F001C0F48 /* SDDSTextArea+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E1C2D10A59F001C0F48 /* SDDSTextArea+Preview.swift */; }; + 811D2E232D10A5B4001C0F48 /* SDDSAvatarGroupPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E222D10A5B4001C0F48 /* SDDSAvatarGroupPreview.swift */; }; + 811D2E252D10A64C001C0F48 /* SDDSCheckboxGroup+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E242D10A64C001C0F48 /* SDDSCheckboxGroup+Preview.swift */; }; + 811D2E282D10A6CF001C0F48 /* SDDSChipGroup+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E262D10A6CF001C0F48 /* SDDSChipGroup+Preview.swift */; }; + 811D2E292D10A6CF001C0F48 /* DefaultChipGroupSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E272D10A6CF001C0F48 /* DefaultChipGroupSize.swift */; }; + 811D2E2B2D10A7B9001C0F48 /* SDDSRadioboxGroup+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E2A2D10A7B9001C0F48 /* SDDSRadioboxGroup+Preview.swift */; }; + 811D2E2D2D115FDD001C0F48 /* AppearanceVariation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811D2E2C2D115FDD001C0F48 /* AppearanceVariation.swift */; }; 811DE1542C50098D000DD354 /* SDDSChip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811DE1532C50098D000DD354 /* SDDSChip.swift */; }; 811DE1562C50179F000DD354 /* ChipAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811DE1552C50179F000DD354 /* ChipAppearance.swift */; }; 811DE1582C5017C3000DD354 /* ProgressBarAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811DE1572C5017C3000DD354 /* ProgressBarAppearance.swift */; }; @@ -21,15 +38,11 @@ 811DE1732C57868F000DD354 /* SDDSCheckboxGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811DE1722C57868F000DD354 /* SDDSCheckboxGroup.swift */; }; 814185CA2C34260300D8E524 /* ButtonSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 814185C92C34260300D8E524 /* ButtonSize.swift */; }; 814E30202C999469004601F7 /* SDDSThemeUtilities in Frameworks */ = {isa = PBXBuildFile; productRef = 814E301F2C999469004601F7 /* SDDSThemeUtilities */; }; - 814E30272C99A502004601F7 /* TextFieldChipSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 814E30262C99A502004601F7 /* TextFieldChipSize.swift */; }; - 814E30292C99A58B004601F7 /* ChipAppearance+SDDSTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 814E30282C99A58B004601F7 /* ChipAppearance+SDDSTextField.swift */; }; 814E30362C99AFAB004601F7 /* SDDSAvatar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81CBC08E2C821A5600FBDAC8 /* SDDSAvatar.swift */; }; 814E30372C99AFAE004601F7 /* SDDSAvatarData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81CBC09E2C82334100FBDAC8 /* SDDSAvatarData.swift */; }; 814E30382C99AFB0004601F7 /* SDDSAvatarModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81CBC0A22C82368300FBDAC8 /* SDDSAvatarModifiers.swift */; }; 814E30392C99AFB3004601F7 /* SDDSAvatarGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81CBC0A02C82350300FBDAC8 /* SDDSAvatarGroup.swift */; }; 814E303A2C99AFBD004601F7 /* BackportAsyncImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81CBC0932C82244000FBDAC8 /* BackportAsyncImage.swift */; }; - 814E303D2C99B013004601F7 /* SDDSAvatarPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 814E303C2C99B013004601F7 /* SDDSAvatarPreview.swift */; }; - 814E30402C99B067004601F7 /* SDDSAvatarGroupPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 814E303F2C99B067004601F7 /* SDDSAvatarGroupPreview.swift */; }; 814E30412C99B090004601F7 /* Text+FillModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81CBC0972C82273100FBDAC8 /* Text+FillModifier.swift */; }; 814E307E2C99CEE1004601F7 /* View+DebugModifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 814E307D2C99CEE1004601F7 /* View+DebugModifiers.swift */; }; 815142892C99942E00E6A00D /* SDDSThemeCore in Frameworks */ = {isa = PBXBuildFile; productRef = 815142882C99942E00E6A00D /* SDDSThemeCore */; }; @@ -37,41 +50,43 @@ 8154644B2C96FDE600DAD8EA /* ViewProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8154644A2C96FDE600DAD8EA /* ViewProvider.swift */; }; 8159F7302C5D1CFE00622836 /* FillStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8159F72F2C5D1CFE00622836 /* FillStyle.swift */; }; 816243412CB81A4300506E1C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 816243402CB81A4300506E1C /* Assets.xcassets */; }; + 81685C252CFF881300278446 /* SwitchAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81685C242CFF881300278446 /* SwitchAppearance.swift */; }; + 81685C272CFF883900278446 /* SwitchSizeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81685C262CFF883900278446 /* SwitchSizeConfiguration.swift */; }; + 81685C292CFF884B00278446 /* SwitchAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81685C282CFF884B00278446 /* SwitchAccessibility.swift */; }; + 81685C2B2CFF898D00278446 /* SwitchAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81685C2A2CFF898D00278446 /* SwitchAppearance+Extensions.swift */; }; 816AA9A72C97280400C3347C /* PlaceholderTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816AA9A62C97280400C3347C /* PlaceholderTextField.swift */; }; 816AA9AC2C97419A00C3347C /* TextFieldDebugConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816AA9AB2C97419A00C3347C /* TextFieldDebugConfiguration.swift */; }; 816AA9AE2C97421F00C3347C /* TextFieldAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816AA9AD2C97421F00C3347C /* TextFieldAppearance.swift */; }; 816AA9B02C97424000C3347C /* TextFieldSizeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816AA9AF2C97424000C3347C /* TextFieldSizeConfiguration.swift */; }; 816AA9B22C97425F00C3347C /* TextFieldAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816AA9B12C97425F00C3347C /* TextFieldAccessibility.swift */; }; 816C62A22CB80EC400352891 /* Opacity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81998FFF2C3555D4009074B7 /* Opacity.swift */; }; + 817339D52D033BF50092608A /* ProgressBarSizeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339D42D033BF50092608A /* ProgressBarSizeConfiguration.swift */; }; + 817339D72D033C0A0092608A /* ProgressBarAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339D62D033C0A0092608A /* ProgressBarAccessibility.swift */; }; + 817339DB2D033D3A0092608A /* CheckboxData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339DA2D033D3A0092608A /* CheckboxData.swift */; }; + 817339DE2D033D860092608A /* ChipAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339DD2D033D860092608A /* ChipAccessibility.swift */; }; + 817339E02D033D940092608A /* ChipSizeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339DF2D033D940092608A /* ChipSizeConfiguration.swift */; }; + 817339E22D033DA30092608A /* ChipBorderStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339E12D033DA30092608A /* ChipBorderStyle.swift */; }; + 817339E42D033E310092608A /* ChipData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339E32D033E310092608A /* ChipData.swift */; }; + 817339E62D033E650092608A /* RadioboxData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339E52D033E650092608A /* RadioboxData.swift */; }; + 817339E92D033E8E0092608A /* AvatarAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339E82D033E8E0092608A /* AvatarAppearance.swift */; }; + 817339EB2D033EB90092608A /* AvatarStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339EA2D033EB90092608A /* AvatarStatus.swift */; }; + 817339ED2D033EC90092608A /* AvatarSizeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339EC2D033EC90092608A /* AvatarSizeConfiguration.swift */; }; + 817339EF2D033EE40092608A /* AvatarAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339EE2D033EE40092608A /* AvatarAccessibility.swift */; }; + 817339F12D033EF30092608A /* AvatarImageSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339F02D033EF30092608A /* AvatarImageSource.swift */; }; + 817339F32D035D2D0092608A /* CheckboxAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339F22D035D2D0092608A /* CheckboxAppearance+Extensions.swift */; }; + 817339FC2D03628F0092608A /* RadioboxAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817339FB2D03628F0092608A /* RadioboxAppearance+Extensions.swift */; }; + 81733A062D0362D00092608A /* SDDSCheckboxPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81733A052D0362D00092608A /* SDDSCheckboxPreview.swift */; }; + 81733A082D03633A0092608A /* SDDSRadioboxPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81733A072D03633A0092608A /* SDDSRadioboxPreview.swift */; }; + 81733A0D2D0367BD0092608A /* ProgressBarAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81733A0B2D0367930092608A /* ProgressBarAppearance+Extensions.swift */; }; + 81733A2B2D072FB70092608A /* AvatarAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81733A262D072E0F0092608A /* AvatarAppearance+Extensions.swift */; }; + 81733A2D2D0730A10092608A /* SDDSProgressBarPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81733A2C2D0730A10092608A /* SDDSProgressBarPreview.swift */; }; + 81733A2F2D0731420092608A /* SDDSAvatarPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81733A2E2D0731420092608A /* SDDSAvatarPreview.swift */; }; + 81733A3A2D0733460092608A /* ChipAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81733A382D07332C0092608A /* ChipAppearance+Extensions.swift */; }; + 81733A402D0738300092608A /* SDDSChipPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81733A3F2D0738300092608A /* SDDSChipPreview.swift */; }; 81737DC92CF84F24002A6A74 /* SDDSServTheme in Frameworks */ = {isa = PBXBuildFile; productRef = 81737DC82CF84F24002A6A74 /* SDDSServTheme */; }; 817580E92C37E04000E45207 /* SpinnerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817580E82C37E04000E45207 /* SpinnerView.swift */; }; - 817AE50F2C99925A00F427DE /* SDDSCheckboxGroup+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4DE2C99925900F427DE /* SDDSCheckboxGroup+Preview.swift */; }; - 817AE5102C99925A00F427DE /* SDDSRadiobox+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4E02C99925900F427DE /* SDDSRadiobox+Preview.swift */; }; - 817AE5112C99925A00F427DE /* RadioboxAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4E12C99925900F427DE /* RadioboxAppearance+Extensions.swift */; }; - 817AE5122C99925A00F427DE /* SDDSRadioboxSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4E22C99925900F427DE /* SDDSRadioboxSize.swift */; }; - 817AE5132C99925A00F427DE /* RadioboxTypography.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4E32C99925900F427DE /* RadioboxTypography.swift */; }; - 817AE5142C99925A00F427DE /* TextFieldAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4E52C99925900F427DE /* TextFieldAppearance+Extensions.swift */; }; - 817AE5152C99925A00F427DE /* SDDSTextField+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4E62C99925900F427DE /* SDDSTextField+Preview.swift */; }; - 817AE5162C99925A00F427DE /* TextFieldDefaultSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4E72C99925900F427DE /* TextFieldDefaultSize.swift */; }; - 817AE5172C99925A00F427DE /* TextFieldTypography.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4E82C99925900F427DE /* TextFieldTypography.swift */; }; - 817AE5252C99925A00F427DE /* SwitchTypography.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4F82C99925A00F427DE /* SwitchTypography.swift */; }; - 817AE5262C99925A00F427DE /* SDDSSwitch+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4F92C99925A00F427DE /* SDDSSwitch+Preview.swift */; }; - 817AE5272C99925A00F427DE /* SDDSSwitchSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4FA2C99925A00F427DE /* SDDSSwitchSize.swift */; }; - 817AE5282C99925A00F427DE /* SwitchAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4FB2C99925A00F427DE /* SwitchAppearance+Extensions.swift */; }; - 817AE5292C99925A00F427DE /* SDDSCheckbox+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4FD2C99925A00F427DE /* SDDSCheckbox+Preview.swift */; }; - 817AE52A2C99925A00F427DE /* CheckboxTypography.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4FE2C99925A00F427DE /* CheckboxTypography.swift */; }; - 817AE52B2C99925A00F427DE /* CheckboxAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4FF2C99925A00F427DE /* CheckboxAppearance+Extensions.swift */; }; - 817AE52C2C99925A00F427DE /* SDDSCheckboxSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE5002C99925A00F427DE /* SDDSCheckboxSize.swift */; }; - 817AE52D2C99925A00F427DE /* DefaultProgressBarSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE5022C99925A00F427DE /* DefaultProgressBarSize.swift */; }; - 817AE52E2C99925A00F427DE /* SDDSProgress+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE5032C99925A00F427DE /* SDDSProgress+Preview.swift */; }; - 817AE52F2C99925A00F427DE /* ProgressBarAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE5042C99925A00F427DE /* ProgressBarAppearance+Extensions.swift */; }; + 817AE5262C99925A00F427DE /* SDDSSwitchPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE4F92C99925A00F427DE /* SDDSSwitchPreview.swift */; }; 817AE5302C99925A00F427DE /* SDDSComponentsPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE5052C99925A00F427DE /* SDDSComponentsPreview.swift */; }; - 817AE5312C99925A00F427DE /* DefaultChipGroupSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE5072C99925A00F427DE /* DefaultChipGroupSize.swift */; }; - 817AE5322C99925A00F427DE /* SDDSChipGroup+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE5082C99925A00F427DE /* SDDSChipGroup+Preview.swift */; }; - 817AE5332C99925A00F427DE /* SDDSRadioboxGroup+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE50A2C99925A00F427DE /* SDDSRadioboxGroup+Preview.swift */; }; - 817AE5342C99925A00F427DE /* SDDSChipSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE50C2C99925A00F427DE /* SDDSChipSize.swift */; }; - 817AE5352C99925A00F427DE /* SDDSChip+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE50D2C99925A00F427DE /* SDDSChip+Preview.swift */; }; - 817AE5362C99925A00F427DE /* ChipAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817AE50E2C99925A00F427DE /* ChipAppearance+Extensions.swift */; }; 818C03B22C418A90002C6D0A /* SDDSSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818C03B12C418A90002C6D0A /* SDDSSwitch.swift */; }; 818C03B52C418C50002C6D0A /* TypographyConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818C03B42C418C50002C6D0A /* TypographyConfiguration.swift */; }; 818C03B92C43B99B002C6D0A /* ColorToken+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818C03B82C43B99B002C6D0A /* ColorToken+Extensions.swift */; }; @@ -97,18 +112,10 @@ 81BBC5952C862764009616CE /* Spacing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 814185C62C33080400D8E524 /* Spacing.swift */; }; 81BBC59A2C862817009616CE /* SDDSServeStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81BBC5992C862817009616CE /* SDDSServeStyle.swift */; }; 81BBC5C92C8639CC009616CE /* Image+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81BBC5C82C8639CC009616CE /* Image+Extensions.swift */; }; - 81C01F9A2CA59C9400D7363E /* AvatarAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C01F972CA59C9300D7363E /* AvatarAppearance.swift */; }; - 81C01F9B2CA59C9400D7363E /* AvatarTypography.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C01F982CA59C9400D7363E /* AvatarTypography.swift */; }; - 81C01F9C2CA59C9400D7363E /* DefaultAvatarSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C01F992CA59C9400D7363E /* DefaultAvatarSize.swift */; }; 81CF12192C6E686D0074174F /* SDDSRadioboxGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81CF12182C6E686D0074174F /* SDDSRadioboxGroup.swift */; }; 81CF12202C6E74180074174F /* RoundedCornersMask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81CF121F2C6E74180074174F /* RoundedCornersMask.swift */; }; 81D2B1912C32B39B00CAA7FD /* SDDSComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = 81D2B1902C32B39B00CAA7FD /* SDDSComponents.h */; settings = {ATTRIBUTES = (Public, ); }; }; 81D2B1992C32B3E400CAA7FD /* SDDSButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81D2B1982C32B3E400CAA7FD /* SDDSButton.swift */; }; - 81D73C462CC952A900B7025C /* SDDSTextAreaSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81D73C452CC952A900B7025C /* SDDSTextAreaSize.swift */; }; - 81D73C482CC952E700B7025C /* SDDSTextAreaAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81D73C472CC952E700B7025C /* SDDSTextAreaAppearance+Extensions.swift */; }; - 81D73C492CC9530C00B7025C /* SDDSTextArea+Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8102BA372CBEAC1600C589D3 /* SDDSTextArea+Preview.swift */; }; - 81D73C4A2CC9530F00B7025C /* SDDSTextAreaChipGroupSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81CA2C4C2CC69406002AF2DF /* SDDSTextAreaChipGroupSize.swift */; }; - 81D73C4C2CC9547500B7025C /* TextAreaChipSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81D73C4B2CC9547500B7025C /* TextAreaChipSize.swift */; }; 81E968142CBD194F00256968 /* FocusableTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81E968132CBD194F00256968 /* FocusableTextField.swift */; }; 81E9FA8F2C92B13E0041B5FF /* SDDSTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81E9FA8E2C92B13E0041B5FF /* SDDSTextField.swift */; }; 81F752E22CECD40A000156D9 /* BasicButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81F752E12CECD40A000156D9 /* BasicButton.swift */; }; @@ -143,9 +150,25 @@ 8102BA2B2CBE9B3300C589D3 /* TextAreaAccessibility.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextAreaAccessibility.swift; sourceTree = ""; }; 8102BA2C2CBE9B3300C589D3 /* TextAreaAppearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextAreaAppearance.swift; sourceTree = ""; }; 8102BA2D2CBE9B3300C589D3 /* TextAreaSizeConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextAreaSizeConfiguration.swift; sourceTree = ""; }; - 8102BA372CBEAC1600C589D3 /* SDDSTextArea+Preview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SDDSTextArea+Preview.swift"; sourceTree = ""; }; 8102BA392CBEAFB800C589D3 /* PlaceholderTextEditor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceholderTextEditor.swift; sourceTree = ""; }; 8102BA3B2CBEB32700C589D3 /* ExpandingTextEditor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpandingTextEditor.swift; sourceTree = ""; }; + 811D2E0C2D10A4BA001C0F48 /* TextFieldAppearance+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TextFieldAppearance+Extensions.swift"; sourceTree = ""; }; + 811D2E0D2D10A4BA001C0F48 /* TextFieldDefaultSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldDefaultSize.swift; sourceTree = ""; }; + 811D2E0E2D10A4BA001C0F48 /* TextFieldTypography.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldTypography.swift; sourceTree = ""; }; + 811D2E0F2D10A4BA001C0F48 /* SDDSTextField+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSTextField+Preview.swift"; sourceTree = ""; }; + 811D2E102D10A4BA001C0F48 /* ChipAppearance+SDDSTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ChipAppearance+SDDSTextField.swift"; sourceTree = ""; }; + 811D2E112D10A4BA001C0F48 /* TextFieldChipSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldChipSize.swift; sourceTree = ""; }; + 811D2E182D10A59F001C0F48 /* TextAreaChipSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextAreaChipSize.swift; sourceTree = ""; }; + 811D2E192D10A59F001C0F48 /* SDDSTextAreaSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSTextAreaSize.swift; sourceTree = ""; }; + 811D2E1A2D10A59F001C0F48 /* SDDSTextAreaAppearance+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSTextAreaAppearance+Extensions.swift"; sourceTree = ""; }; + 811D2E1B2D10A59F001C0F48 /* SDDSTextAreaChipGroupSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSTextAreaChipGroupSize.swift; sourceTree = ""; }; + 811D2E1C2D10A59F001C0F48 /* SDDSTextArea+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSTextArea+Preview.swift"; sourceTree = ""; }; + 811D2E222D10A5B4001C0F48 /* SDDSAvatarGroupPreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSAvatarGroupPreview.swift; sourceTree = ""; }; + 811D2E242D10A64C001C0F48 /* SDDSCheckboxGroup+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSCheckboxGroup+Preview.swift"; sourceTree = ""; }; + 811D2E262D10A6CF001C0F48 /* SDDSChipGroup+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSChipGroup+Preview.swift"; sourceTree = ""; }; + 811D2E272D10A6CF001C0F48 /* DefaultChipGroupSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultChipGroupSize.swift; sourceTree = ""; }; + 811D2E2A2D10A7B9001C0F48 /* SDDSRadioboxGroup+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSRadioboxGroup+Preview.swift"; sourceTree = ""; }; + 811D2E2C2D115FDD001C0F48 /* AppearanceVariation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppearanceVariation.swift; sourceTree = ""; }; 811DE1532C50098D000DD354 /* SDDSChip.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSChip.swift; sourceTree = ""; }; 811DE1552C50179F000DD354 /* ChipAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipAppearance.swift; sourceTree = ""; }; 811DE1572C5017C3000DD354 /* ProgressBarAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarAppearance.swift; sourceTree = ""; }; @@ -157,49 +180,48 @@ 811DE1742C5787EF000DD354 /* SDDSCheckboxGroup.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = SDDSCheckboxGroup.md; sourceTree = ""; }; 814185C62C33080400D8E524 /* Spacing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Spacing.swift; sourceTree = ""; }; 814185C92C34260300D8E524 /* ButtonSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonSize.swift; sourceTree = ""; }; - 814E30262C99A502004601F7 /* TextFieldChipSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldChipSize.swift; sourceTree = ""; }; - 814E30282C99A58B004601F7 /* ChipAppearance+SDDSTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ChipAppearance+SDDSTextField.swift"; sourceTree = ""; }; - 814E303C2C99B013004601F7 /* SDDSAvatarPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSAvatarPreview.swift; sourceTree = ""; }; - 814E303F2C99B067004601F7 /* SDDSAvatarGroupPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSAvatarGroupPreview.swift; sourceTree = ""; }; 814E307D2C99CEE1004601F7 /* View+DebugModifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+DebugModifiers.swift"; sourceTree = ""; }; 8154644A2C96FDE600DAD8EA /* ViewProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewProvider.swift; sourceTree = ""; }; 8159F72F2C5D1CFE00622836 /* FillStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FillStyle.swift; sourceTree = ""; }; 816243402CB81A4300506E1C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 81685C222CFF87CA00278446 /* AppearanceVariation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearanceVariation.swift; sourceTree = ""; }; + 81685C242CFF881300278446 /* SwitchAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwitchAppearance.swift; sourceTree = ""; }; + 81685C262CFF883900278446 /* SwitchSizeConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwitchSizeConfiguration.swift; sourceTree = ""; }; + 81685C282CFF884B00278446 /* SwitchAccessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwitchAccessibility.swift; sourceTree = ""; }; + 81685C2A2CFF898D00278446 /* SwitchAppearance+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SwitchAppearance+Extensions.swift"; sourceTree = ""; }; 816AA9A62C97280400C3347C /* PlaceholderTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceholderTextField.swift; sourceTree = ""; }; 816AA9AB2C97419A00C3347C /* TextFieldDebugConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldDebugConfiguration.swift; sourceTree = ""; }; 816AA9AD2C97421F00C3347C /* TextFieldAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldAppearance.swift; sourceTree = ""; }; 816AA9AF2C97424000C3347C /* TextFieldSizeConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldSizeConfiguration.swift; sourceTree = ""; }; 816AA9B12C97425F00C3347C /* TextFieldAccessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldAccessibility.swift; sourceTree = ""; }; + 817339D42D033BF50092608A /* ProgressBarSizeConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarSizeConfiguration.swift; sourceTree = ""; }; + 817339D62D033C0A0092608A /* ProgressBarAccessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarAccessibility.swift; sourceTree = ""; }; + 817339DA2D033D3A0092608A /* CheckboxData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckboxData.swift; sourceTree = ""; }; + 817339DD2D033D860092608A /* ChipAccessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipAccessibility.swift; sourceTree = ""; }; + 817339DF2D033D940092608A /* ChipSizeConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipSizeConfiguration.swift; sourceTree = ""; }; + 817339E12D033DA30092608A /* ChipBorderStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipBorderStyle.swift; sourceTree = ""; }; + 817339E32D033E310092608A /* ChipData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipData.swift; sourceTree = ""; }; + 817339E52D033E650092608A /* RadioboxData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioboxData.swift; sourceTree = ""; }; + 817339E82D033E8E0092608A /* AvatarAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarAppearance.swift; sourceTree = ""; }; + 817339EA2D033EB90092608A /* AvatarStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarStatus.swift; sourceTree = ""; }; + 817339EC2D033EC90092608A /* AvatarSizeConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarSizeConfiguration.swift; sourceTree = ""; }; + 817339EE2D033EE40092608A /* AvatarAccessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarAccessibility.swift; sourceTree = ""; }; + 817339F02D033EF30092608A /* AvatarImageSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarImageSource.swift; sourceTree = ""; }; + 817339F22D035D2D0092608A /* CheckboxAppearance+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CheckboxAppearance+Extensions.swift"; sourceTree = ""; }; + 817339FB2D03628F0092608A /* RadioboxAppearance+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RadioboxAppearance+Extensions.swift"; sourceTree = ""; }; + 81733A052D0362D00092608A /* SDDSCheckboxPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSCheckboxPreview.swift; sourceTree = ""; }; + 81733A072D03633A0092608A /* SDDSRadioboxPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSRadioboxPreview.swift; sourceTree = ""; }; + 81733A0B2D0367930092608A /* ProgressBarAppearance+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProgressBarAppearance+Extensions.swift"; sourceTree = ""; }; + 81733A262D072E0F0092608A /* AvatarAppearance+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AvatarAppearance+Extensions.swift"; sourceTree = ""; }; + 81733A2C2D0730A10092608A /* SDDSProgressBarPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSProgressBarPreview.swift; sourceTree = ""; }; + 81733A2E2D0731420092608A /* SDDSAvatarPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSAvatarPreview.swift; sourceTree = ""; }; + 81733A382D07332C0092608A /* ChipAppearance+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ChipAppearance+Extensions.swift"; sourceTree = ""; }; + 81733A3F2D0738300092608A /* SDDSChipPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSChipPreview.swift; sourceTree = ""; }; 817580E82C37E04000E45207 /* SpinnerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpinnerView.swift; sourceTree = ""; }; 8178A7392C733C5000DFDA61 /* SDDSThemeCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDDSThemeCore.framework; path = "../../Library/Developer/Xcode/DerivedData/SDDSThemeBuilder-fqfdpznjjmrsjyexwtopazivejlq/Build/Products/Debug-iphoneos/SDDSThemeCore.framework"; sourceTree = ""; }; 8178A73D2C733C5900DFDA61 /* SDDSThemeUtilities.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDDSThemeUtilities.framework; path = "../../Library/Developer/Xcode/DerivedData/SDDSThemeBuilder-fqfdpznjjmrsjyexwtopazivejlq/Build/Products/Debug-iphoneos/SDDSThemeUtilities.framework"; sourceTree = ""; }; - 817AE4DE2C99925900F427DE /* SDDSCheckboxGroup+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSCheckboxGroup+Preview.swift"; sourceTree = ""; }; - 817AE4E02C99925900F427DE /* SDDSRadiobox+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSRadiobox+Preview.swift"; sourceTree = ""; }; - 817AE4E12C99925900F427DE /* RadioboxAppearance+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "RadioboxAppearance+Extensions.swift"; sourceTree = ""; }; - 817AE4E22C99925900F427DE /* SDDSRadioboxSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSRadioboxSize.swift; sourceTree = ""; }; - 817AE4E32C99925900F427DE /* RadioboxTypography.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadioboxTypography.swift; sourceTree = ""; }; - 817AE4E52C99925900F427DE /* TextFieldAppearance+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TextFieldAppearance+Extensions.swift"; sourceTree = ""; }; - 817AE4E62C99925900F427DE /* SDDSTextField+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSTextField+Preview.swift"; sourceTree = ""; }; - 817AE4E72C99925900F427DE /* TextFieldDefaultSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldDefaultSize.swift; sourceTree = ""; }; - 817AE4E82C99925900F427DE /* TextFieldTypography.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldTypography.swift; sourceTree = ""; }; - 817AE4F82C99925A00F427DE /* SwitchTypography.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwitchTypography.swift; sourceTree = ""; }; - 817AE4F92C99925A00F427DE /* SDDSSwitch+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSSwitch+Preview.swift"; sourceTree = ""; }; - 817AE4FA2C99925A00F427DE /* SDDSSwitchSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSSwitchSize.swift; sourceTree = ""; }; - 817AE4FB2C99925A00F427DE /* SwitchAppearance+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwitchAppearance+Extensions.swift"; sourceTree = ""; }; - 817AE4FD2C99925A00F427DE /* SDDSCheckbox+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSCheckbox+Preview.swift"; sourceTree = ""; }; - 817AE4FE2C99925A00F427DE /* CheckboxTypography.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxTypography.swift; sourceTree = ""; }; - 817AE4FF2C99925A00F427DE /* CheckboxAppearance+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CheckboxAppearance+Extensions.swift"; sourceTree = ""; }; - 817AE5002C99925A00F427DE /* SDDSCheckboxSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSCheckboxSize.swift; sourceTree = ""; }; - 817AE5022C99925A00F427DE /* DefaultProgressBarSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultProgressBarSize.swift; sourceTree = ""; }; - 817AE5032C99925A00F427DE /* SDDSProgress+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSProgress+Preview.swift"; sourceTree = ""; }; - 817AE5042C99925A00F427DE /* ProgressBarAppearance+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ProgressBarAppearance+Extensions.swift"; sourceTree = ""; }; + 817AE4F92C99925A00F427DE /* SDDSSwitchPreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSSwitchPreview.swift; sourceTree = ""; }; 817AE5052C99925A00F427DE /* SDDSComponentsPreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSComponentsPreview.swift; sourceTree = ""; }; - 817AE5072C99925A00F427DE /* DefaultChipGroupSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultChipGroupSize.swift; sourceTree = ""; }; - 817AE5082C99925A00F427DE /* SDDSChipGroup+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSChipGroup+Preview.swift"; sourceTree = ""; }; - 817AE50A2C99925A00F427DE /* SDDSRadioboxGroup+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSRadioboxGroup+Preview.swift"; sourceTree = ""; }; - 817AE50C2C99925A00F427DE /* SDDSChipSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSChipSize.swift; sourceTree = ""; }; - 817AE50D2C99925A00F427DE /* SDDSChip+Preview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SDDSChip+Preview.swift"; sourceTree = ""; }; - 817AE50E2C99925A00F427DE /* ChipAppearance+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ChipAppearance+Extensions.swift"; sourceTree = ""; }; 817D9F182C37078F006C4814 /* SDDSIcons.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SDDSIcons.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 818C03B12C418A90002C6D0A /* SDDSSwitch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSSwitch.swift; sourceTree = ""; }; 818C03B42C418C50002C6D0A /* TypographyConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypographyConfiguration.swift; sourceTree = ""; }; @@ -234,11 +256,7 @@ 81BBC5992C862817009616CE /* SDDSServeStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSServeStyle.swift; sourceTree = ""; }; 81BBC5C82C8639CC009616CE /* Image+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Image+Extensions.swift"; sourceTree = ""; }; 81BC36812C591B0B00A363D0 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; - 81C01F972CA59C9300D7363E /* AvatarAppearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvatarAppearance.swift; sourceTree = ""; }; - 81C01F982CA59C9400D7363E /* AvatarTypography.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvatarTypography.swift; sourceTree = ""; }; - 81C01F992CA59C9400D7363E /* DefaultAvatarSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultAvatarSize.swift; sourceTree = ""; }; 81CA2C4A2CC693E6002AF2DF /* ScrollViewWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScrollViewWrapper.swift; sourceTree = ""; }; - 81CA2C4C2CC69406002AF2DF /* SDDSTextAreaChipGroupSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSTextAreaChipGroupSize.swift; sourceTree = ""; }; 81CBC08E2C821A5600FBDAC8 /* SDDSAvatar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSAvatar.swift; sourceTree = ""; }; 81CBC0932C82244000FBDAC8 /* BackportAsyncImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackportAsyncImage.swift; sourceTree = ""; }; 81CBC0972C82273100FBDAC8 /* Text+FillModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Text+FillModifier.swift"; sourceTree = ""; }; @@ -255,9 +273,6 @@ 81D2B18D2C32B39B00CAA7FD /* SDDSComponents.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDDSComponents.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 81D2B1902C32B39B00CAA7FD /* SDDSComponents.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDDSComponents.h; sourceTree = ""; }; 81D2B1982C32B3E400CAA7FD /* SDDSButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSButton.swift; sourceTree = ""; }; - 81D73C452CC952A900B7025C /* SDDSTextAreaSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSTextAreaSize.swift; sourceTree = ""; }; - 81D73C472CC952E700B7025C /* SDDSTextAreaAppearance+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SDDSTextAreaAppearance+Extensions.swift"; sourceTree = ""; }; - 81D73C4B2CC9547500B7025C /* TextAreaChipSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextAreaChipSize.swift; sourceTree = ""; }; 81E968132CBD194F00256968 /* FocusableTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusableTextField.swift; sourceTree = ""; }; 81E9FA8E2C92B13E0041B5FF /* SDDSTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSTextField.swift; sourceTree = ""; }; 81F752E12CECD40A000156D9 /* BasicButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicButton.swift; sourceTree = ""; }; @@ -320,12 +335,21 @@ path = SDDSTextArea; sourceTree = ""; }; + 811D2E0B2D10A31E001C0F48 /* Recovered References */ = { + isa = PBXGroup; + children = ( + 81685C222CFF87CA00278446 /* AppearanceVariation.swift */, + ); + name = "Recovered References"; + sourceTree = ""; + }; 811DE1522C500980000DD354 /* SDDSChip */ = { isa = PBXGroup; children = ( 811DE1532C50098D000DD354 /* SDDSChip.swift */, - 811DE1552C50179F000DD354 /* ChipAppearance.swift */, + 817339E32D033E310092608A /* ChipData.swift */, 811DE15C2C51167A000DD354 /* SDDSChip.md */, + 817339DC2D033D740092608A /* ChipAppearance */, ); path = SDDSChip; sourceTree = ""; @@ -382,10 +406,7 @@ 814E303B2C99AFF2004601F7 /* SDDSAvatar */ = { isa = PBXGroup; children = ( - 81C01F972CA59C9300D7363E /* AvatarAppearance.swift */, - 81C01F982CA59C9400D7363E /* AvatarTypography.swift */, - 81C01F992CA59C9400D7363E /* DefaultAvatarSize.swift */, - 814E303C2C99B013004601F7 /* SDDSAvatarPreview.swift */, + 81733A2E2D0731420092608A /* SDDSAvatarPreview.swift */, ); path = SDDSAvatar; sourceTree = ""; @@ -393,11 +414,22 @@ 814E303E2C99B04C004601F7 /* SDDSAvatarGroup */ = { isa = PBXGroup; children = ( - 814E303F2C99B067004601F7 /* SDDSAvatarGroupPreview.swift */, + 811D2E222D10A5B4001C0F48 /* SDDSAvatarGroupPreview.swift */, ); path = SDDSAvatarGroup; sourceTree = ""; }; + 81685C212CFF87AD00278446 /* SwitchAppearance */ = { + isa = PBXGroup; + children = ( + 81685C242CFF881300278446 /* SwitchAppearance.swift */, + 81685C262CFF883900278446 /* SwitchSizeConfiguration.swift */, + 81685C282CFF884B00278446 /* SwitchAccessibility.swift */, + 81685C2A2CFF898D00278446 /* SwitchAppearance+Extensions.swift */, + ); + path = SwitchAppearance; + sourceTree = ""; + }; 816C62A32CB80ED600352891 /* Constants */ = { isa = PBXGroup; children = ( @@ -406,6 +438,60 @@ path = Constants; sourceTree = ""; }; + 817339D32D033BD20092608A /* ProgressBarAppearance */ = { + isa = PBXGroup; + children = ( + 811DE1572C5017C3000DD354 /* ProgressBarAppearance.swift */, + 817339D42D033BF50092608A /* ProgressBarSizeConfiguration.swift */, + 817339D62D033C0A0092608A /* ProgressBarAccessibility.swift */, + 81733A0B2D0367930092608A /* ProgressBarAppearance+Extensions.swift */, + ); + path = ProgressBarAppearance; + sourceTree = ""; + }; + 817339D82D033C870092608A /* RadioboxAppearance */ = { + isa = PBXGroup; + children = ( + 818C03C82C451424002C6D0A /* RadioboxAppearance.swift */, + 817339FB2D03628F0092608A /* RadioboxAppearance+Extensions.swift */, + ); + path = RadioboxAppearance; + sourceTree = ""; + }; + 817339D92D033CF50092608A /* CheckboxAppearance */ = { + isa = PBXGroup; + children = ( + 818C03C62C45140B002C6D0A /* CheckboxAppearance.swift */, + 817339F22D035D2D0092608A /* CheckboxAppearance+Extensions.swift */, + ); + path = CheckboxAppearance; + sourceTree = ""; + }; + 817339DC2D033D740092608A /* ChipAppearance */ = { + isa = PBXGroup; + children = ( + 811DE1552C50179F000DD354 /* ChipAppearance.swift */, + 817339DD2D033D860092608A /* ChipAccessibility.swift */, + 817339DF2D033D940092608A /* ChipSizeConfiguration.swift */, + 817339E12D033DA30092608A /* ChipBorderStyle.swift */, + 81733A382D07332C0092608A /* ChipAppearance+Extensions.swift */, + ); + path = ChipAppearance; + sourceTree = ""; + }; + 817339E72D033E7E0092608A /* AvatarAppearance */ = { + isa = PBXGroup; + children = ( + 817339E82D033E8E0092608A /* AvatarAppearance.swift */, + 817339EA2D033EB90092608A /* AvatarStatus.swift */, + 817339EC2D033EC90092608A /* AvatarSizeConfiguration.swift */, + 817339EE2D033EE40092608A /* AvatarAccessibility.swift */, + 817339F02D033EF30092608A /* AvatarImageSource.swift */, + 81733A262D072E0F0092608A /* AvatarAppearance+Extensions.swift */, + ); + path = AvatarAppearance; + sourceTree = ""; + }; 817580E72C37E02800E45207 /* Spinner */ = { isa = PBXGroup; children = ( @@ -417,19 +503,20 @@ 817AE4DC2C99925900F427DE /* Components */ = { isa = PBXGroup; children = ( + 817AE5052C99925A00F427DE /* SDDSComponentsPreview.swift */, + 817AE4E42C99925900F427DE /* SDDSTextField */, 81D73C442CC9528300B7025C /* SDDSTextArea */, 814E303E2C99B04C004601F7 /* SDDSAvatarGroup */, 814E303B2C99AFF2004601F7 /* SDDSAvatar */, 817AE4DD2C99925900F427DE /* SDDSCheckboxGroup */, 817AE4DF2C99925900F427DE /* SDDSRadiobox */, - 817AE4E42C99925900F427DE /* SDDSTextField */, 817AE4E92C99925900F427DE /* SDDSButton */, 817AE4F72C99925A00F427DE /* SDDSSwitch */, 817AE4FC2C99925A00F427DE /* SDDSCheckbox */, 817AE5012C99925A00F427DE /* SDDSProgressBar */, - 817AE5052C99925A00F427DE /* SDDSComponentsPreview.swift */, 817AE5062C99925A00F427DE /* SDDSChipGroup */, 817AE5092C99925A00F427DE /* SDDSRadioboxGroup */, + 81BBC5C72C8639BB009616CE /* Utilities */, 817AE50B2C99925A00F427DE /* SDDSChip */, ); path = Components; @@ -438,7 +525,7 @@ 817AE4DD2C99925900F427DE /* SDDSCheckboxGroup */ = { isa = PBXGroup; children = ( - 817AE4DE2C99925900F427DE /* SDDSCheckboxGroup+Preview.swift */, + 811D2E242D10A64C001C0F48 /* SDDSCheckboxGroup+Preview.swift */, ); path = SDDSCheckboxGroup; sourceTree = ""; @@ -446,10 +533,7 @@ 817AE4DF2C99925900F427DE /* SDDSRadiobox */ = { isa = PBXGroup; children = ( - 817AE4E02C99925900F427DE /* SDDSRadiobox+Preview.swift */, - 817AE4E12C99925900F427DE /* RadioboxAppearance+Extensions.swift */, - 817AE4E22C99925900F427DE /* SDDSRadioboxSize.swift */, - 817AE4E32C99925900F427DE /* RadioboxTypography.swift */, + 81733A072D03633A0092608A /* SDDSRadioboxPreview.swift */, ); path = SDDSRadiobox; sourceTree = ""; @@ -457,12 +541,12 @@ 817AE4E42C99925900F427DE /* SDDSTextField */ = { isa = PBXGroup; children = ( - 817AE4E52C99925900F427DE /* TextFieldAppearance+Extensions.swift */, - 817AE4E62C99925900F427DE /* SDDSTextField+Preview.swift */, - 817AE4E72C99925900F427DE /* TextFieldDefaultSize.swift */, - 817AE4E82C99925900F427DE /* TextFieldTypography.swift */, - 814E30262C99A502004601F7 /* TextFieldChipSize.swift */, - 814E30282C99A58B004601F7 /* ChipAppearance+SDDSTextField.swift */, + 811D2E102D10A4BA001C0F48 /* ChipAppearance+SDDSTextField.swift */, + 811D2E0F2D10A4BA001C0F48 /* SDDSTextField+Preview.swift */, + 811D2E0C2D10A4BA001C0F48 /* TextFieldAppearance+Extensions.swift */, + 811D2E112D10A4BA001C0F48 /* TextFieldChipSize.swift */, + 811D2E0D2D10A4BA001C0F48 /* TextFieldDefaultSize.swift */, + 811D2E0E2D10A4BA001C0F48 /* TextFieldTypography.swift */, ); path = SDDSTextField; sourceTree = ""; @@ -478,10 +562,7 @@ 817AE4F72C99925A00F427DE /* SDDSSwitch */ = { isa = PBXGroup; children = ( - 817AE4F82C99925A00F427DE /* SwitchTypography.swift */, - 817AE4F92C99925A00F427DE /* SDDSSwitch+Preview.swift */, - 817AE4FA2C99925A00F427DE /* SDDSSwitchSize.swift */, - 817AE4FB2C99925A00F427DE /* SwitchAppearance+Extensions.swift */, + 817AE4F92C99925A00F427DE /* SDDSSwitchPreview.swift */, ); path = SDDSSwitch; sourceTree = ""; @@ -489,10 +570,7 @@ 817AE4FC2C99925A00F427DE /* SDDSCheckbox */ = { isa = PBXGroup; children = ( - 817AE4FD2C99925A00F427DE /* SDDSCheckbox+Preview.swift */, - 817AE4FE2C99925A00F427DE /* CheckboxTypography.swift */, - 817AE4FF2C99925A00F427DE /* CheckboxAppearance+Extensions.swift */, - 817AE5002C99925A00F427DE /* SDDSCheckboxSize.swift */, + 81733A052D0362D00092608A /* SDDSCheckboxPreview.swift */, ); path = SDDSCheckbox; sourceTree = ""; @@ -500,9 +578,7 @@ 817AE5012C99925A00F427DE /* SDDSProgressBar */ = { isa = PBXGroup; children = ( - 817AE5022C99925A00F427DE /* DefaultProgressBarSize.swift */, - 817AE5032C99925A00F427DE /* SDDSProgress+Preview.swift */, - 817AE5042C99925A00F427DE /* ProgressBarAppearance+Extensions.swift */, + 81733A2C2D0730A10092608A /* SDDSProgressBarPreview.swift */, ); path = SDDSProgressBar; sourceTree = ""; @@ -510,8 +586,8 @@ 817AE5062C99925A00F427DE /* SDDSChipGroup */ = { isa = PBXGroup; children = ( - 817AE5072C99925A00F427DE /* DefaultChipGroupSize.swift */, - 817AE5082C99925A00F427DE /* SDDSChipGroup+Preview.swift */, + 811D2E272D10A6CF001C0F48 /* DefaultChipGroupSize.swift */, + 811D2E262D10A6CF001C0F48 /* SDDSChipGroup+Preview.swift */, ); path = SDDSChipGroup; sourceTree = ""; @@ -519,7 +595,7 @@ 817AE5092C99925A00F427DE /* SDDSRadioboxGroup */ = { isa = PBXGroup; children = ( - 817AE50A2C99925A00F427DE /* SDDSRadioboxGroup+Preview.swift */, + 811D2E2A2D10A7B9001C0F48 /* SDDSRadioboxGroup+Preview.swift */, ); path = SDDSRadioboxGroup; sourceTree = ""; @@ -527,9 +603,7 @@ 817AE50B2C99925A00F427DE /* SDDSChip */ = { isa = PBXGroup; children = ( - 817AE50C2C99925A00F427DE /* SDDSChipSize.swift */, - 817AE50D2C99925A00F427DE /* SDDSChip+Preview.swift */, - 817AE50E2C99925A00F427DE /* ChipAppearance+Extensions.swift */, + 81733A3F2D0738300092608A /* SDDSChipPreview.swift */, ); path = SDDSChip; sourceTree = ""; @@ -559,6 +633,7 @@ children = ( 818C03B12C418A90002C6D0A /* SDDSSwitch.swift */, 818C03C02C43CD4C002C6D0A /* SDDSSwitch.md */, + 81685C212CFF87AD00278446 /* SwitchAppearance */, ); path = SDDSSwitch; sourceTree = ""; @@ -566,6 +641,7 @@ 818C03B32C418C3E002C6D0A /* Common */ = { isa = PBXGroup; children = ( + 811D2E2C2D115FDD001C0F48 /* AppearanceVariation.swift */, 81CA2C4A2CC693E6002AF2DF /* ScrollViewWrapper.swift */, 81CBC0922C82241100FBDAC8 /* BackportAsyncImage */, 818C03B42C418C50002C6D0A /* TypographyConfiguration.swift */, @@ -587,9 +663,10 @@ 818C03C22C45126B002C6D0A /* SDDSCheckbox */ = { isa = PBXGroup; children = ( + 817339DA2D033D3A0092608A /* CheckboxData.swift */, 818C03CA2C45158A002C6D0A /* SDDSCheckbox.swift */, 818C03D32C455763002C6D0A /* SDDSCheckbox.md */, - 818C03C62C45140B002C6D0A /* CheckboxAppearance.swift */, + 817339D92D033CF50092608A /* CheckboxAppearance */, ); path = SDDSCheckbox; sourceTree = ""; @@ -609,8 +686,9 @@ isa = PBXGroup; children = ( 818C03CD2C4515ED002C6D0A /* SDDSRadiobox.swift */, + 817339E52D033E650092608A /* RadioboxData.swift */, 818C03D42C4557BF002C6D0A /* SDDSRadiobox.md */, - 818C03C82C451424002C6D0A /* RadioboxAppearance.swift */, + 817339D82D033C870092608A /* RadioboxAppearance */, ); path = SDDSRadiobox; sourceTree = ""; @@ -619,8 +697,8 @@ isa = PBXGroup; children = ( 818C03E52C47BCDC002C6D0A /* SDDSProgressBar.swift */, - 811DE1572C5017C3000DD354 /* ProgressBarAppearance.swift */, 818C03E72C47C3C4002C6D0A /* SDDSProgressBar.md */, + 817339D32D033BD20092608A /* ProgressBarAppearance */, ); path = SDDSProgressBar; sourceTree = ""; @@ -669,7 +747,6 @@ 816243402CB81A4300506E1C /* Assets.xcassets */, 816C62A32CB80ED600352891 /* Constants */, 817AE4DC2C99925900F427DE /* Components */, - 81BBC5C72C8639BB009616CE /* Utilities */, 81BBC5742C862492009616CE /* SDDSComponentsPreview.h */, 81BBC5992C862817009616CE /* SDDSServeStyle.swift */, ); @@ -715,6 +792,7 @@ 81CBC0A22C82368300FBDAC8 /* SDDSAvatarModifiers.swift */, 81CBC0992C82325400FBDAC8 /* SDDSAvatar.md */, 81CBC0A62C8238CA00FBDAC8 /* SDDSAvatarModifiers.sourcery */, + 817339E72D033E7E0092608A /* AvatarAppearance */, ); path = SDDSAvatar; sourceTree = ""; @@ -763,6 +841,7 @@ 81BBC5732C862492009616CE /* SDDSComponentsPreview */, 81D2B18E2C32B39B00CAA7FD /* Products */, 81998FD32C3436E1009074B7 /* Frameworks */, + 811D2E0B2D10A31E001C0F48 /* Recovered References */, ); sourceTree = ""; }; @@ -779,11 +858,11 @@ 81D73C442CC9528300B7025C /* SDDSTextArea */ = { isa = PBXGroup; children = ( - 8102BA372CBEAC1600C589D3 /* SDDSTextArea+Preview.swift */, - 81CA2C4C2CC69406002AF2DF /* SDDSTextAreaChipGroupSize.swift */, - 81D73C452CC952A900B7025C /* SDDSTextAreaSize.swift */, - 81D73C472CC952E700B7025C /* SDDSTextAreaAppearance+Extensions.swift */, - 81D73C4B2CC9547500B7025C /* TextAreaChipSize.swift */, + 811D2E1C2D10A59F001C0F48 /* SDDSTextArea+Preview.swift */, + 811D2E1A2D10A59F001C0F48 /* SDDSTextAreaAppearance+Extensions.swift */, + 811D2E1B2D10A59F001C0F48 /* SDDSTextAreaChipGroupSize.swift */, + 811D2E192D10A59F001C0F48 /* SDDSTextAreaSize.swift */, + 811D2E182D10A59F001C0F48 /* TextAreaChipSize.swift */, ); path = SDDSTextArea; sourceTree = ""; @@ -1024,49 +1103,33 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 81C01F9A2CA59C9400D7363E /* AvatarAppearance.swift in Sources */, - 817AE5112C99925A00F427DE /* RadioboxAppearance+Extensions.swift in Sources */, - 817AE5142C99925A00F427DE /* TextFieldAppearance+Extensions.swift in Sources */, 817AE5302C99925A00F427DE /* SDDSComponentsPreview.swift in Sources */, - 81C01F9B2CA59C9400D7363E /* AvatarTypography.swift in Sources */, - 817AE5282C99925A00F427DE /* SwitchAppearance+Extensions.swift in Sources */, - 81D73C4C2CC9547500B7025C /* TextAreaChipSize.swift in Sources */, - 817AE5162C99925A00F427DE /* TextFieldDefaultSize.swift in Sources */, - 81D73C462CC952A900B7025C /* SDDSTextAreaSize.swift in Sources */, - 817AE5252C99925A00F427DE /* SwitchTypography.swift in Sources */, - 81C01F9C2CA59C9400D7363E /* DefaultAvatarSize.swift in Sources */, - 817AE5332C99925A00F427DE /* SDDSRadioboxGroup+Preview.swift in Sources */, - 817AE5322C99925A00F427DE /* SDDSChipGroup+Preview.swift in Sources */, + 811D2E1E2D10A59F001C0F48 /* SDDSTextAreaSize.swift in Sources */, + 811D2E132D10A4BA001C0F48 /* TextFieldDefaultSize.swift in Sources */, + 811D2E252D10A64C001C0F48 /* SDDSCheckboxGroup+Preview.swift in Sources */, + 81733A082D03633A0092608A /* SDDSRadioboxPreview.swift in Sources */, + 811D2E1F2D10A59F001C0F48 /* SDDSTextAreaAppearance+Extensions.swift in Sources */, + 811D2E2B2D10A7B9001C0F48 /* SDDSRadioboxGroup+Preview.swift in Sources */, + 811D2E282D10A6CF001C0F48 /* SDDSChipGroup+Preview.swift in Sources */, + 81733A2F2D0731420092608A /* SDDSAvatarPreview.swift in Sources */, 81BBC5C92C8639CC009616CE /* Image+Extensions.swift in Sources */, - 814E303D2C99B013004601F7 /* SDDSAvatarPreview.swift in Sources */, - 817AE5122C99925A00F427DE /* SDDSRadioboxSize.swift in Sources */, - 817AE5342C99925A00F427DE /* SDDSChipSize.swift in Sources */, - 814E30402C99B067004601F7 /* SDDSAvatarGroupPreview.swift in Sources */, - 81D73C4A2CC9530F00B7025C /* SDDSTextAreaChipGroupSize.swift in Sources */, - 817AE5172C99925A00F427DE /* TextFieldTypography.swift in Sources */, - 817AE52C2C99925A00F427DE /* SDDSCheckboxSize.swift in Sources */, - 817AE5312C99925A00F427DE /* DefaultChipGroupSize.swift in Sources */, - 81D73C482CC952E700B7025C /* SDDSTextAreaAppearance+Extensions.swift in Sources */, - 817AE52A2C99925A00F427DE /* CheckboxTypography.swift in Sources */, - 814E30272C99A502004601F7 /* TextFieldChipSize.swift in Sources */, + 81733A2D2D0730A10092608A /* SDDSProgressBarPreview.swift in Sources */, + 811D2E172D10A4BA001C0F48 /* TextFieldChipSize.swift in Sources */, + 811D2E142D10A4BA001C0F48 /* TextFieldTypography.swift in Sources */, 81A9015B2CF6EBD300992B04 /* SDDSButtonPreview.swift in Sources */, - 814E30292C99A58B004601F7 /* ChipAppearance+SDDSTextField.swift in Sources */, - 817AE52B2C99925A00F427DE /* CheckboxAppearance+Extensions.swift in Sources */, + 811D2E212D10A59F001C0F48 /* SDDSTextArea+Preview.swift in Sources */, + 811D2E292D10A6CF001C0F48 /* DefaultChipGroupSize.swift in Sources */, 81BBC59A2C862817009616CE /* SDDSServeStyle.swift in Sources */, - 817AE52D2C99925A00F427DE /* DefaultProgressBarSize.swift in Sources */, - 817AE5102C99925A00F427DE /* SDDSRadiobox+Preview.swift in Sources */, - 81D73C492CC9530C00B7025C /* SDDSTextArea+Preview.swift in Sources */, - 817AE52F2C99925A00F427DE /* ProgressBarAppearance+Extensions.swift in Sources */, - 817AE5362C99925A00F427DE /* ChipAppearance+Extensions.swift in Sources */, - 817AE52E2C99925A00F427DE /* SDDSProgress+Preview.swift in Sources */, - 817AE5262C99925A00F427DE /* SDDSSwitch+Preview.swift in Sources */, - 817AE5352C99925A00F427DE /* SDDSChip+Preview.swift in Sources */, - 817AE5272C99925A00F427DE /* SDDSSwitchSize.swift in Sources */, - 817AE5152C99925A00F427DE /* SDDSTextField+Preview.swift in Sources */, - 817AE5292C99925A00F427DE /* SDDSCheckbox+Preview.swift in Sources */, + 811D2E122D10A4BA001C0F48 /* TextFieldAppearance+Extensions.swift in Sources */, + 811D2E162D10A4BA001C0F48 /* ChipAppearance+SDDSTextField.swift in Sources */, + 817AE5262C99925A00F427DE /* SDDSSwitchPreview.swift in Sources */, + 811D2E232D10A5B4001C0F48 /* SDDSAvatarGroupPreview.swift in Sources */, + 811D2E1D2D10A59F001C0F48 /* TextAreaChipSize.swift in Sources */, + 81733A062D0362D00092608A /* SDDSCheckboxPreview.swift in Sources */, + 81733A402D0738300092608A /* SDDSChipPreview.swift in Sources */, + 811D2E152D10A4BA001C0F48 /* SDDSTextField+Preview.swift in Sources */, 81BBC5952C862764009616CE /* Spacing.swift in Sources */, - 817AE50F2C99925A00F427DE /* SDDSCheckboxGroup+Preview.swift in Sources */, - 817AE5132C99925A00F427DE /* RadioboxTypography.swift in Sources */, + 811D2E202D10A59F001C0F48 /* SDDSTextAreaChipGroupSize.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1074,15 +1137,24 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 811D2E2D2D115FDD001C0F48 /* AppearanceVariation.swift in Sources */, 8102BA322CBE9B3300C589D3 /* TextAreaSizeConfiguration.swift in Sources */, 818C03E62C47BCDC002C6D0A /* SDDSProgressBar.swift in Sources */, + 817339DE2D033D860092608A /* ChipAccessibility.swift in Sources */, + 817339F12D033EF30092608A /* AvatarImageSource.swift in Sources */, 818C03BF2C43C371002C6D0A /* DebugModifier.swift in Sources */, + 817339D72D033C0A0092608A /* ProgressBarAccessibility.swift in Sources */, 814E30392C99AFB3004601F7 /* SDDSAvatarGroup.swift in Sources */, 814E307E2C99CEE1004601F7 /* View+DebugModifiers.swift in Sources */, + 817339D52D033BF50092608A /* ProgressBarSizeConfiguration.swift in Sources */, 818FE9312C3C1CDC00F64958 /* Components.swift in Sources */, + 817339E42D033E310092608A /* ChipData.swift in Sources */, 818C03CB2C45158A002C6D0A /* SDDSCheckbox.swift in Sources */, 811DE1732C57868F000DD354 /* SDDSCheckboxGroup.swift in Sources */, + 817339FC2D03628F0092608A /* RadioboxAppearance+Extensions.swift in Sources */, 818C03B22C418A90002C6D0A /* SDDSSwitch.swift in Sources */, + 817339DB2D033D3A0092608A /* CheckboxData.swift in Sources */, + 81685C272CFF883900278446 /* SwitchSizeConfiguration.swift in Sources */, 81E968142CBD194F00256968 /* FocusableTextField.swift in Sources */, 816AA9AC2C97419A00C3347C /* TextFieldDebugConfiguration.swift in Sources */, 818C03E32C479003002C6D0A /* Image+Extensions.swift in Sources */, @@ -1090,19 +1162,25 @@ 814E303A2C99AFBD004601F7 /* BackportAsyncImage.swift in Sources */, 81CF12192C6E686D0074174F /* SDDSRadioboxGroup.swift in Sources */, 814185CA2C34260300D8E524 /* ButtonSize.swift in Sources */, + 817339ED2D033EC90092608A /* AvatarSizeConfiguration.swift in Sources */, + 81733A3A2D0733460092608A /* ChipAppearance+Extensions.swift in Sources */, 81F753422CF505DE000156D9 /* IconButton+Extensions.swift in Sources */, 81F752E22CECD40A000156D9 /* BasicButton.swift in Sources */, 814E30412C99B090004601F7 /* Text+FillModifier.swift in Sources */, + 817339E62D033E650092608A /* RadioboxData.swift in Sources */, 816C62A22CB80EC400352891 /* Opacity.swift in Sources */, 814E30382C99AFB0004601F7 /* SDDSAvatarModifiers.swift in Sources */, 81D2B1992C32B3E400CAA7FD /* SDDSButton.swift in Sources */, + 817339E22D033DA30092608A /* ChipBorderStyle.swift in Sources */, 81F753222CF467CC000156D9 /* ButtonLayoutMode.swift in Sources */, 81F753262CF467F6000156D9 /* ButtonIconAttributes.swift in Sources */, + 817339EB2D033EB90092608A /* AvatarStatus.swift in Sources */, 81F7532C2CF46885000156D9 /* ButtonShapeStyle.swift in Sources */, 81A901532CF6EAA800992B04 /* LinkButton.swift in Sources */, 81F7531C2CF46755000156D9 /* ButtonStyle.swift in Sources */, 81F753282CF46831000156D9 /* ButtonColor.swift in Sources */, 811DE1582C5017C3000DD354 /* ProgressBarAppearance.swift in Sources */, + 817339F32D035D2D0092608A /* CheckboxAppearance+Extensions.swift in Sources */, 811DE1562C50179F000DD354 /* ChipAppearance.swift in Sources */, 81CF12202C6E74180074174F /* RoundedCornersMask.swift in Sources */, 8102BA2F2CBE9B3300C589D3 /* SDDSTextArea.swift in Sources */, @@ -1117,8 +1195,11 @@ 811DE1542C50098D000DD354 /* SDDSChip.swift in Sources */, 8102BA3C2CBEB32700C589D3 /* ExpandingTextEditor.swift in Sources */, 81F7531E2CF46793000156D9 /* ButtonAlignment.swift in Sources */, + 81733A0D2D0367BD0092608A /* ProgressBarAppearance+Extensions.swift in Sources */, 81F7532E2CF4689C000156D9 /* ButtonAccessibility.swift in Sources */, + 81685C2B2CFF898D00278446 /* SwitchAppearance+Extensions.swift in Sources */, 818C03B92C43B99B002C6D0A /* ColorToken+Extensions.swift in Sources */, + 817339E92D033E8E0092608A /* AvatarAppearance.swift in Sources */, 811DE1712C5783B6000DD354 /* HierarchicalList.swift in Sources */, 818C03D02C451651002C6D0A /* SelectionControlAppearance.swift in Sources */, 814E30362C99AFAB004601F7 /* SDDSAvatar.swift in Sources */, @@ -1127,17 +1208,22 @@ 8154644B2C96FDE600DAD8EA /* ViewProvider.swift in Sources */, 81F7532A2CF4684F000156D9 /* ButtonAppearance.swift in Sources */, 818C03C52C4512A6002C6D0A /* SelectionControl.swift in Sources */, + 817339E02D033D940092608A /* ChipSizeConfiguration.swift in Sources */, + 817339EF2D033EE40092608A /* AvatarAccessibility.swift in Sources */, + 81733A2B2D072FB70092608A /* AvatarAppearance+Extensions.swift in Sources */, 811DE15B2C5017FE000DD354 /* SDDSChipGroup.swift in Sources */, 81E9FA8F2C92B13E0041B5FF /* SDDSTextField.swift in Sources */, 8102BA3A2CBEAFB800C589D3 /* PlaceholderTextEditor.swift in Sources */, 818C03C72C45140B002C6D0A /* CheckboxAppearance.swift in Sources */, 814E30372C99AFAE004601F7 /* SDDSAvatarData.swift in Sources */, 81A9014F2CF6E8E400992B04 /* ButtonAppearance+Extensions.swift in Sources */, + 81685C292CFF884B00278446 /* SwitchAccessibility.swift in Sources */, 8102BA302CBE9B3300C589D3 /* TextAreaAccessibility.swift in Sources */, 81F753382CF4FFFD000156D9 /* String+Variations.swift in Sources */, 81F7533D2CF501AF000156D9 /* ButtonAppearanceVariation.swift in Sources */, 81F752E42CECD4B1000156D9 /* IconButton.swift in Sources */, 817580E92C37E04000E45207 /* SpinnerView.swift in Sources */, + 81685C252CFF881300278446 /* SwitchAppearance.swift in Sources */, 818C03B52C418C50002C6D0A /* TypographyConfiguration.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/AvatarAppearance.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/AvatarAppearance.swift deleted file mode 100644 index 4cdc4dc19..000000000 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/AvatarAppearance.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Foundation -import SDDSComponents -import SDDSServTheme -import SwiftUI - -public extension AvatarAppearance { - static var `default`: AvatarAppearance { - AvatarAppearance( - textFillStyle: .gradient(Gradients.textDefaultAccentGradient), - backgroundFillStyle: .gradient(Gradients.surfaceDefaultAccentGradient), - backgroundOpacity: 0.2, - onlineStatusColor: Colors.textDefaultAccent, - offlineStatusColor: Colors.surfaceOnLightSolidTertiary, - textTypography: AvatarTypography.title - ) - } -} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/SDDSAvatarPreview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/SDDSAvatarPreview.swift index 5594c9983..d94cbdd83 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/SDDSAvatarPreview.swift +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/SDDSAvatarPreview.swift @@ -1,120 +1,20 @@ import Foundation -import SwiftUI import SDDSComponents import SDDSServTheme +import SwiftUI // MARK: - Preview - struct SDDSAvatarPreview: PreviewProvider { static var previews: some View { - Group { - // Online Status Previews - SDDSAvatar( - text: "JD", - image: nil, - placeholderImage: nil, - status: .online, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, - accessibility: defaultAccessibility - ) - .previewDisplayName("Online - Text Only") - - SDDSAvatar( - text: "", - image: .image(Image.image("checker")), - placeholderImage: nil, - status: .online, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, - accessibility: defaultAccessibility - ) - .previewDisplayName("Online - Image") - - SDDSAvatar( - text: "JD", - image: nil, - placeholderImage: .image(Image.image("checker")), - status: .online, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, - accessibility: defaultAccessibility - ) - .previewDisplayName("Online - Placeholder with Text") - - // Offline Status Previews - SDDSAvatar( - text: "JD", - image: nil, - placeholderImage: nil, - status: .offline, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, - accessibility: defaultAccessibility - ) - .previewDisplayName("Offline - Text Only") - - SDDSAvatar( - text: "", - image: .image(Image.image("checker")), - placeholderImage: nil, - status: .offline, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, - accessibility: defaultAccessibility - ) - .previewDisplayName("Offline - Image") - - SDDSAvatar( - text: "JD", - image: nil, - placeholderImage: .image(Image.image("checker")), - status: .offline, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, - accessibility: defaultAccessibility - ) - .previewDisplayName("Offline - Placeholder with Text") - - // Hidden Status Previews - SDDSAvatar( - text: "JD", - image: nil, - placeholderImage: nil, - status: .hidden, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, - accessibility: defaultAccessibility - ) - .previewDisplayName("Hidden - Text Only") - - SDDSAvatar( - text: "", - image: .image(Image.image("checker")), - placeholderImage: nil, - status: .hidden, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, - accessibility: defaultAccessibility - ) - .previewDisplayName("Hidden - Image") - - SDDSAvatar( - text: "JD", - image: nil, - placeholderImage: .image(Image.image("checker")), - status: .hidden, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, - accessibility: defaultAccessibility - ) - .previewDisplayName("Hidden - Placeholder with Text") - } - .previewLayout(.sizeThatFits) - .padding() - } - - private static var defaultAccessibility: AvatarAccessibility { - AvatarAccessibility(label: "User Avatar", hint: "Displays user status and initials or image") + SDDSAvatar( + text: "", + image: .image(Image.image("checker")), + placeholderImage: nil, + status: .online, + appearance: SDDSAvatar.extraExtraLarge.medium.appearance, + accessibility: AvatarAccessibility() + ) + .previewLayout(PreviewLayout.sizeThatFits) + .previewDisplayName("Default") } } diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatarGroup/SDDSAvatarGroupPreview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatarGroup/SDDSAvatarGroupPreview.swift index 238c99c66..f4143c071 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatarGroup/SDDSAvatarGroupPreview.swift +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatarGroup/SDDSAvatarGroupPreview.swift @@ -22,8 +22,7 @@ struct SDDSAvatarGroupPreview: PreviewProvider { image: nil, placeholderImage: nil, status: .online, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, + appearance: SDDSAvatar.large.default.appearance, accessibility: defaultAccessibility ), SDDSAvatarData( @@ -31,8 +30,7 @@ struct SDDSAvatarGroupPreview: PreviewProvider { image: .image(Image(systemName: "person.fill")), placeholderImage: nil, status: .offline, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, + appearance: SDDSAvatar.large.default.appearance, accessibility: defaultAccessibility ), SDDSAvatarData( @@ -40,8 +38,7 @@ struct SDDSAvatarGroupPreview: PreviewProvider { image: .image(Image(systemName: "person.fill")), placeholderImage: nil, status: .offline, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, + appearance: SDDSAvatar.large.default.appearance, accessibility: defaultAccessibility ) ] @@ -53,8 +50,7 @@ struct SDDSAvatarGroupPreview: PreviewProvider { image: nil, placeholderImage: nil, status: .hidden, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, + appearance: SDDSAvatar.large.default.appearance, accessibility: defaultAccessibility ) } diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/CheckboxAppearance+Extensions.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/CheckboxAppearance+Extensions.swift deleted file mode 100644 index 14d7c2aec..000000000 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/CheckboxAppearance+Extensions.swift +++ /dev/null @@ -1,16 +0,0 @@ -import Foundation -import SwiftUI -import SDDSServTheme -import SDDSComponents - -public extension CheckboxAppearance { - static var `default`: Self { - .init( - titleTypography: RadioboxTypography.label, - subtitleTypography: RadioboxTypography.description, - titleColor: .backgroundInversePrimary, - subtitleColor: .surfaceInverseSolidPrimary.withOpacity(0.56), - disabledAlpha: 0.4 - ) - } -} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/SDDSCheckbox+Preview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/SDDSCheckbox+Preview.swift deleted file mode 100644 index 394d6354e..000000000 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/SDDSCheckbox+Preview.swift +++ /dev/null @@ -1,84 +0,0 @@ -import Foundation -import SDDSComponents -import SwiftUI - -// MARK: - Preview -struct SDDSCheckboxPreview: PreviewProvider { - static var previews: some View { - Group { - SDDSCheckbox.defaultExample - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Default") - .debug() - - SDDSCheckbox.withoutDescription - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Without Description") - .debug() - - SDDSCheckbox.withoutLabel - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Without Label") - .debug() - - SDDSCheckbox.withoutLabelAndDescription - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Without Label and Description") - .debug() - } - } -} - -extension SDDSCheckbox { - static var defaultExample: SDDSCheckbox { - .init( - state: .constant(.selected), - title: "Label", - subtitle: "Description", - isEnabled: true, - images: .checkbox, - size: SDDSCheckboxSize.medium, - appearance: .default, - accessibility: SelectionControlAccessibility() - ) - } - - static var withoutDescription: SDDSCheckbox { - .init( - state: .constant(.selected), - title: "Label", - subtitle: nil, - isEnabled: true, - images: .checkbox, - size: SDDSCheckboxSize.medium, - appearance: .default, - accessibility: SelectionControlAccessibility() - ) - } - - static var withoutLabel: SDDSCheckbox { - .init( - state: .constant(.selected), - title: "", - subtitle: "Description", - isEnabled: true, - images: .checkbox, - size: SDDSCheckboxSize.medium, - appearance: .default, - accessibility: SelectionControlAccessibility() - ) - } - - static var withoutLabelAndDescription: SDDSCheckbox { - .init( - state: .constant(.selected), - title: "", - subtitle: nil, - isEnabled: true, - images: .checkbox, - size: SDDSCheckboxSize.medium, - appearance: .default, - accessibility: SelectionControlAccessibility() - ) - } -} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/SDDSCheckboxPreview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/SDDSCheckboxPreview.swift new file mode 100644 index 000000000..78c6e31b7 --- /dev/null +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/SDDSCheckboxPreview.swift @@ -0,0 +1,20 @@ +import Foundation +import SDDSComponents +import SDDSServTheme +import SwiftUI + +// MARK: - Preview +struct SDDSCheckboxPreview: PreviewProvider { + static var previews: some View { + SDDSCheckbox( + state: .constant(.indeterminate), + title: "Valur", + subtitle: "Description", + isEnabled: true, + images: .checkbox, + appearance: SDDSCheckbox.medium.default.appearance + ) + .previewLayout(PreviewLayout.sizeThatFits) + .previewDisplayName("Default") + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckboxGroup/SDDSCheckboxGroup+Preview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckboxGroup/SDDSCheckboxGroup+Preview.swift index 041772af8..0fe45e17c 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckboxGroup/SDDSCheckboxGroup+Preview.swift +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckboxGroup/SDDSCheckboxGroup+Preview.swift @@ -12,8 +12,7 @@ struct SDDSCheckboxGroupPreview: PreviewProvider { subtitle: "Parent Description", isEnabled: true, images: SelectionControlStateImages.checkbox, - size: SDDSCheckboxSize.medium, - appearance: CheckboxAppearance.default, + appearance: SDDSCheckbox.medium.default.appearance, accessibility: SelectionControlAccessibility() ) @@ -24,8 +23,7 @@ struct SDDSCheckboxGroupPreview: PreviewProvider { subtitle: "Description \(index + 1)", isEnabled: true, images: SelectionControlStateImages.checkbox, - size: SDDSCheckboxSize.medium, - appearance: CheckboxAppearance.default, + appearance: SDDSCheckbox.medium.default.appearance, accessibility: SelectionControlAccessibility() ) } diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/SDDSChip+Preview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/SDDSChip+Preview.swift deleted file mode 100644 index 52c12ec39..000000000 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/SDDSChip+Preview.swift +++ /dev/null @@ -1,103 +0,0 @@ -import Foundation -import SwiftUI -import SDDSComponents -import SDDSServTheme - -extension SDDSChip { - static var defaultExample: SDDSChip { - SDDSChip( - title: "Label", - isEnabled: true, - iconImage: Image.image("chipIcon"), - buttonImage: Image.image("chipClose"), - appearance: .default, - size: SDDSChipSize.large(.pilled), - removeAction: {} - ) - } - - static var defaultBorderExample: SDDSChip { - SDDSChip( - title: "Label", - isEnabled: true, - iconImage: Image.image("chipIcon"), - buttonImage: Image.image("chipClose"), - appearance: ChipAppearance.default, - size: SDDSChipSize.medium(.pilled), - removeAction: {} - ) - } - - static var noButtonImageExample: SDDSChip { - SDDSChip( - title: "Label", - isEnabled: true, - iconImage: Image.image("chipIcon"), - buttonImage: nil, - appearance: ChipAppearance.default, - size: SDDSChipSize.medium(.pilled), - removeAction: {} - ) - } - - static var noIconImageExample: SDDSChip { - SDDSChip( - title: "Label", - isEnabled: true, - iconImage: nil, - buttonImage: Image.image("chipClose"), - appearance: .default, - size: SDDSChipSize.medium(.pilled), - removeAction: {} - ) - } - - static var onlyTitleExample: SDDSChip { - SDDSChip( - title: "Label", - isEnabled: true, - iconImage: nil, - buttonImage: nil, - appearance: .default, - size: SDDSChipSize.medium(.pilled), - removeAction: {} - ) - } -} - -// MARK: - Preview -struct SDDSChipPreview: PreviewProvider { - static var previews: some View { - Group { - SDDSChip.defaultExample - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Default") - .padding() - .debug() - - SDDSChip.defaultBorderExample - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Default Border") - .padding() - .debug() - - SDDSChip.noButtonImageExample - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("No Button Image") - .padding() - .debug() - - SDDSChip.noIconImageExample - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("No Icon Image") - .padding() - .debug() - - SDDSChip.onlyTitleExample - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Only Title") - .padding() - .debug() - } - } -} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/SDDSChipPreview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/SDDSChipPreview.swift new file mode 100644 index 000000000..8add92895 --- /dev/null +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/SDDSChipPreview.swift @@ -0,0 +1,20 @@ +import Foundation +import SDDSComponents +import SDDSServTheme +import SwiftUI + +// MARK: - Preview +struct SDDSChipPreview: PreviewProvider { + static var previews: some View { + SDDSChip( + title: "Label", + isEnabled: true, + iconImage: Image.image("chipIcon"), + buttonImage: Image.image("chipClose"), + appearance: SDDSChip.accent.medium.pilled.appearance, + removeAction: {} + ) + .previewLayout(PreviewLayout.sizeThatFits) + .previewDisplayName("Default") + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSChipGroup/SDDSChipGroup+Preview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSChipGroup/SDDSChipGroup+Preview.swift index 9e7c2f64b..1f373c11c 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSChipGroup/SDDSChipGroup+Preview.swift +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSChipGroup/SDDSChipGroup+Preview.swift @@ -5,7 +5,6 @@ import SwiftUI // Пример данных и конфигурации для предварительного просмотра struct SDDSChipGroupPreview: PreviewProvider { static var previews: some View { - let chipSize = SDDSChipSize.medium(.pilled) let chipAccessibility = ChipAccessibility() let chipData = (1...32).map { index in @@ -14,8 +13,7 @@ struct SDDSChipGroupPreview: PreviewProvider { isEnabled: true, iconImage: Image.image("chipIcon"), buttonImage: Image.image("chipClose"), - appearance: .default, - size: chipSize, + appearance: SDDSChip.medium.accent.pilled.appearance, accessibility: chipAccessibility, removeAction: {} ) diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/ProgressBarAppearance+Extensions.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/ProgressBarAppearance+Extensions.swift deleted file mode 100644 index 92e35e29c..000000000 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/ProgressBarAppearance+Extensions.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Foundation -import SDDSComponents -import SDDSServTheme -import SwiftUI - -public extension ProgressBarAppearance { - static var accent: ProgressBarAppearance { - .init( - tintFillStyle: .color(ColorToken.surfaceDefaultAccent), - trackColor: ColorToken.surfaceDefaultTransparentSecondary - ) - } - - static var gradientAccent: ProgressBarAppearance { - .init( - tintFillStyle: .gradient(GradientToken.surfaceDefaultAccentGradient), - trackColor: ColorToken.surfaceDefaultTransparentSecondary - ) - } -} - diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/SDDSProgress+Preview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/SDDSProgress+Preview.swift deleted file mode 100644 index 117345cf9..000000000 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/SDDSProgress+Preview.swift +++ /dev/null @@ -1,92 +0,0 @@ -import Foundation -import SwiftUI -import SDDSComponents - -// MARK: - Preview -struct SDDSProgressViewPreview: PreviewProvider { - static var previews: some View { - Group { - SDDSProgressView.accent(progress: 0) - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("0%") - .padding() - .debug() - - SDDSProgressView.accent(progress: 0.3) - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("30%") - .padding() - .debug() - - SDDSProgressView.accent(progress: 0.5) - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("50%") - .padding() - .debug() - - SDDSProgressView.accent(progress: 0.8) - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("80%") - .padding() - .debug() - - SDDSProgressView.accent(progress: 1.0) - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("100%") - .padding() - .debug() - - SDDSProgressView.gradientAccent(progress: 0) - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Gradient 0%") - .padding() - .debug() - - SDDSProgressView.gradientAccent(progress: 0.3) - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Gradient 30%") - .padding() - .debug() - - SDDSProgressView.gradientAccent(progress: 0.5) - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Gradient 50%") - .padding() - .debug() - - SDDSProgressView.gradientAccent(progress: 0.8) - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Gradient 80%") - .padding() - .debug() - - SDDSProgressView.gradientAccent(progress: 1.0) - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Gradient 100%") - .padding() - .debug() - } - } -} - -extension SDDSProgressView { - static func accent(progress: CGFloat) -> SDDSProgressView { - .init( - progress: .constant(progress), - isEnabled: true, - appearance: .accent, - size: DefaultProgressBarSize(), - accessibility: ProgressBarAccessibility() - ) - } - - static func gradientAccent(progress: CGFloat) -> SDDSProgressView { - .init( - progress: .constant(progress), - isEnabled: true, - appearance: .gradientAccent, - size: DefaultProgressBarSize(), - accessibility: ProgressBarAccessibility() - ) - } -} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/SDDSProgressBarPreview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/SDDSProgressBarPreview.swift new file mode 100644 index 000000000..0fc00adcf --- /dev/null +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/SDDSProgressBarPreview.swift @@ -0,0 +1,17 @@ +import Foundation +import SDDSComponents +import SDDSServTheme +import SwiftUI + +// MARK: - Preview +struct SDDSProgressBarPreview: PreviewProvider { + static var previews: some View { + SDDSProgressView( + progress: .constant(0.5), + isEnabled: true, + appearance: SDDSProgressView.accent.appearance + ) + .previewLayout(PreviewLayout.sizeThatFits) + .previewDisplayName("Default") + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/RadioboxAppearance+Extensions.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/RadioboxAppearance+Extensions.swift deleted file mode 100644 index e259d233c..000000000 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/RadioboxAppearance+Extensions.swift +++ /dev/null @@ -1,33 +0,0 @@ -import Foundation -import SwiftUI -import SDDSComponents -import SDDSServTheme - -public extension RadioboxAppearance { - static var `default`: Self { - .init( - titleTypography: RadioboxTypography.label, - subtitleTypography: RadioboxTypography.description, - titleColor: .backgroundInversePrimary, - subtitleColor: .surfaceInverseSolidPrimary.withOpacity(0.56), - disabledAlpha: 0.4, - imageTintColor: nil - ) - } -} - -public extension RadioboxTypography { - static var label: TypographyConfiguration { - RadioboxTypography( - medium: Typographies.bodyMNormal.typography, - small: Typographies.bodySNormal.typography - ).asContainer - } - - static var description: TypographyConfiguration { - RadioboxTypography( - medium: Typographies.bodyMNormal.typography, - small: Typographies.bodyXsNormal.typography - ).asContainer - } -} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/SDDSRadiobox+Preview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/SDDSRadiobox+Preview.swift deleted file mode 100644 index 20367de9c..000000000 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/SDDSRadiobox+Preview.swift +++ /dev/null @@ -1,84 +0,0 @@ -import Foundation -import SwiftUI -import SDDSComponents - -// MARK: - Preview -struct SDDSRadioboxPreview: PreviewProvider { - static var previews: some View { - Group { - SDDSRadiobox.defaultExample - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Default") - .debug() - - SDDSRadiobox.withoutDescription - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Without Description") - .debug() - - SDDSRadiobox.withoutLabel - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Without Label") - .debug() - - SDDSRadiobox.withoutLabelAndDescription - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Without Label and Description") - .debug() - } - } -} - -public extension SDDSRadiobox { - static var defaultExample: SDDSRadiobox { - .init( - isSelected: .constant(true), - title: "Label", - subtitle: "Description", - isEnabled: true, - images: .defaultImages, - size: SDDSRadioboxSize.medium, - appearance: .default, - accessibility: SelectionControlAccessibility() - ) - } - - static var withoutDescription: SDDSRadiobox { - .init( - isSelected: .constant(true), - title: "Label", - subtitle: nil, - isEnabled: true, - images: .defaultImages, - size: SDDSRadioboxSize.medium, - appearance: .default, - accessibility: SelectionControlAccessibility() - ) - } - - static var withoutLabel: SDDSRadiobox { - .init( - isSelected: .constant(true), - title: "", - subtitle: "Description", - isEnabled: true, - images: .defaultImages, - size: SDDSRadioboxSize.medium, - appearance: .default, - accessibility: SelectionControlAccessibility() - ) - } - - static var withoutLabelAndDescription: SDDSRadiobox { - .init( - isSelected: .constant(true), - title: "", - subtitle: nil, - isEnabled: true, - images: .defaultImages, - size: SDDSRadioboxSize.medium, - appearance: .default, - accessibility: SelectionControlAccessibility() - ) - } -} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/SDDSRadioboxPreview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/SDDSRadioboxPreview.swift new file mode 100644 index 000000000..fc3782119 --- /dev/null +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/SDDSRadioboxPreview.swift @@ -0,0 +1,20 @@ +import Foundation +import SDDSComponents +import SDDSServTheme +import SwiftUI + +// MARK: - Preview +struct SDDSRadioboxPreview: PreviewProvider { + static var previews: some View { + SDDSRadiobox( + isSelected: .constant(true), + title: "Value", + subtitle: "Description", + isEnabled: true, + images: .defaultImages, + appearance: SDDSRadiobox.medium.default.appearance + ) + .previewLayout(PreviewLayout.sizeThatFits) + .previewDisplayName("Default") + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadioboxGroup/SDDSRadioboxGroup+Preview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadioboxGroup/SDDSRadioboxGroup+Preview.swift index d5064284f..f1ec91edc 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadioboxGroup/SDDSRadioboxGroup+Preview.swift +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadioboxGroup/SDDSRadioboxGroup+Preview.swift @@ -13,8 +13,7 @@ struct SDDSRadioboxGroupPreview: PreviewProvider { subtitle: "Description \(index + 1)", isSelected: .constant(index == 0), images: RadioboxImages.defaultImages, - size: SDDSRadioboxSize.medium, - appearance: RadioboxAppearance.default, + appearance: SDDSRadiobox.medium.default.appearance, accessibility: SelectionControlAccessibility() ) } diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SDDSSwitch+Preview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SDDSSwitch+Preview.swift deleted file mode 100644 index 62d28eded..000000000 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SDDSSwitch+Preview.swift +++ /dev/null @@ -1,78 +0,0 @@ -import Foundation -import SDDSComponents -import SwiftUI - -// MARK: - Preview -struct SDDSSwitchPreview: PreviewProvider { - static var previews: some View { - SDDSSwitch.defaultExample - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Default") - .debug() - - SDDSSwitch.emptyDescription - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Empty Description") - .debug() - - SDDSSwitch.emptyTitle - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Empty Title") - .debug() - - SDDSSwitch.onlyToggle - .previewLayout(PreviewLayout.sizeThatFits) - .previewDisplayName("Only Toggle") - .debug() - } -} - -extension SDDSSwitch { - static var defaultExample: SDDSSwitch { - SDDSSwitch( - title: "Title", - subtitle: "Description", - isOn: .constant(true), - isEnabled: true, - size: SDDSSwitchSize.medium, - appearance: SwitchAppearance.defaultAppearance, - switchAccessibility: SwitchAccessibility() - ) - } - - static var emptyDescription: SDDSSwitch { - SDDSSwitch( - title: "Title", - subtitle: "", - isOn: .constant(true), - isEnabled: true, - size: SDDSSwitchSize.medium, - appearance: SwitchAppearance.defaultAppearance, - switchAccessibility: SwitchAccessibility() - ) - } - - static var emptyTitle: SDDSSwitch { - SDDSSwitch( - title: "", - subtitle: "Description", - isOn: .constant(true), - isEnabled: true, - size: SDDSSwitchSize.medium, - appearance: SwitchAppearance.defaultAppearance, - switchAccessibility: SwitchAccessibility() - ) - } - - static var onlyToggle: SDDSSwitch { - SDDSSwitch( - title: "", - subtitle: "", - isOn: .constant(true), - isEnabled: true, - size: SDDSSwitchSize.medium, - appearance: SwitchAppearance.defaultAppearance, - switchAccessibility: SwitchAccessibility() - ) - } -} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SDDSSwitchPreview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SDDSSwitchPreview.swift new file mode 100644 index 000000000..edbcd8066 --- /dev/null +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SDDSSwitchPreview.swift @@ -0,0 +1,20 @@ +import Foundation +import SDDSComponents +import SDDSServTheme +import SwiftUI + +// MARK: - Preview +struct SDDSSwitchPreview: PreviewProvider { + static var previews: some View { + SDDSSwitch( + title: "Label", + subtitle: "Description", + isOn: .constant(true), + isEnabled: true, + appearance: SDDSSwitch.large.default.appearance, + switchAccessibility: SwitchAccessibility() + ) + .previewLayout(PreviewLayout.sizeThatFits) + .previewDisplayName("Default") + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextArea/SDDSTextArea+Preview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextArea/SDDSTextArea+Preview.swift index 32d250a56..806507231 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextArea/SDDSTextArea+Preview.swift +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextArea/SDDSTextArea+Preview.swift @@ -14,7 +14,6 @@ struct SDDSTextAreaPreview: PreviewProvider { iconImage: nil, buttonImage: Image.image("textFieldChipIcon"), appearance: .textArea, - size: TextAreaChipSize.medium, accessibility: ChipAccessibility(), removeAction: {} ) diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextArea/SDDSTextAreaAppearance+Extensions.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextArea/SDDSTextAreaAppearance+Extensions.swift index 95f7deba6..a9496ecf7 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextArea/SDDSTextAreaAppearance+Extensions.swift +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextArea/SDDSTextAreaAppearance+Extensions.swift @@ -124,6 +124,7 @@ extension TextAreaTypography { public extension ChipAppearance { static var textArea: ChipAppearance { ChipAppearance( + size: ZeroChipSize(), titleColor: .surfaceInverseSolidPrimary.withOpacity(0.96), titleTypography: ChipTextAreaTypography.text, imageTintColor: Color.clear.token, diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextField/SDDSTextField+Preview.swift b/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextField/SDDSTextField+Preview.swift index 0fa9756a3..2a40e1648 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextField/SDDSTextField+Preview.swift +++ b/SDDSComponents/SDDSComponentsPreview/Components/SDDSTextField/SDDSTextField+Preview.swift @@ -14,7 +14,6 @@ struct SDDSTextFieldPreview: PreviewProvider { iconImage: nil, buttonImage: Image.image("textFieldChipIcon"), appearance: .textField, - size: TextFieldChipSize.large, accessibility: ChipAccessibility(), removeAction: {} ) diff --git a/SDDSComponents/SDDSComponentsPreview/Utilities/Image+Extensions.swift b/SDDSComponents/SDDSComponentsPreview/Components/Utilities/Image+Extensions.swift similarity index 100% rename from SDDSComponents/SDDSComponentsPreview/Utilities/Image+Extensions.swift rename to SDDSComponents/SDDSComponentsPreview/Components/Utilities/Image+Extensions.swift diff --git a/SDDSComponents/Sources/SDDSComponents/Common/AppearanceVariation.swift b/SDDSComponents/Sources/SDDSComponents/Common/AppearanceVariation.swift new file mode 100644 index 000000000..44e5b1872 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Common/AppearanceVariation.swift @@ -0,0 +1,19 @@ +import Foundation + +public struct AppearanceVariation: Hashable { + public let name: String + public let appearance: Appearance + + public init(name: String = "", appearance: Appearance) { + self.name = name + self.appearance = appearance + } + + public static func == (lhs: AppearanceVariation, rhs: AppearanceVariation) -> Bool { + return lhs.name == rhs.name + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(name) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAccessibility.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAccessibility.swift new file mode 100644 index 000000000..bf598deb1 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAccessibility.swift @@ -0,0 +1,11 @@ +import Foundation + +public struct AvatarAccessibility { + public let label: String + public let hint: String + + public init(label: String = "", hint: String = "") { + self.label = label + self.hint = hint + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAppearance+Extensions.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAppearance+Extensions.swift new file mode 100644 index 000000000..48baa397b --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAppearance+Extensions.swift @@ -0,0 +1,100 @@ +import Foundation + +// MARK: - AvatarAppearance Extension +public extension AvatarAppearance { + func size(_ size: AvatarSizeConfiguration) -> AvatarAppearance { + return AvatarAppearance( + size: size, + textFillStyle: self.textFillStyle, + backgroundFillStyle: self.backgroundFillStyle, + backgroundOpacity: self.backgroundOpacity, + onlineStatusColor: self.onlineStatusColor, + offlineStatusColor: self.offlineStatusColor, + textTypography: self.textTypography + ) + } + + func textFillStyle(_ textFillStyle: FillStyle) -> AvatarAppearance { + return AvatarAppearance( + size: self.size, + textFillStyle: textFillStyle, + backgroundFillStyle: self.backgroundFillStyle, + backgroundOpacity: self.backgroundOpacity, + onlineStatusColor: self.onlineStatusColor, + offlineStatusColor: self.offlineStatusColor, + textTypography: self.textTypography + ) + } + + func backgroundFillStyle(_ backgroundFillStyle: FillStyle) -> AvatarAppearance { + return AvatarAppearance( + size: self.size, + textFillStyle: self.textFillStyle, + backgroundFillStyle: backgroundFillStyle, + backgroundOpacity: self.backgroundOpacity, + onlineStatusColor: self.onlineStatusColor, + offlineStatusColor: self.offlineStatusColor, + textTypography: self.textTypography + ) + } + + func backgroundOpacity(_ backgroundOpacity: CGFloat) -> AvatarAppearance { + return AvatarAppearance( + size: self.size, + textFillStyle: self.textFillStyle, + backgroundFillStyle: self.backgroundFillStyle, + backgroundOpacity: backgroundOpacity, + onlineStatusColor: self.onlineStatusColor, + offlineStatusColor: self.offlineStatusColor, + textTypography: self.textTypography + ) + } + + func onlineStatusColor(_ onlineStatusColor: ColorToken) -> AvatarAppearance { + return AvatarAppearance( + size: self.size, + textFillStyle: self.textFillStyle, + backgroundFillStyle: self.backgroundFillStyle, + backgroundOpacity: self.backgroundOpacity, + onlineStatusColor: onlineStatusColor, + offlineStatusColor: self.offlineStatusColor, + textTypography: self.textTypography + ) + } + + func offlineStatusColor(_ offlineStatusColor: ColorToken) -> AvatarAppearance { + return AvatarAppearance( + size: self.size, + textFillStyle: self.textFillStyle, + backgroundFillStyle: self.backgroundFillStyle, + backgroundOpacity: self.backgroundOpacity, + onlineStatusColor: self.onlineStatusColor, + offlineStatusColor: offlineStatusColor, + textTypography: self.textTypography + ) + } + + func textTypography(_ textTypography: TypographyConfiguration) -> AvatarAppearance { + return AvatarAppearance( + size: self.size, + textFillStyle: self.textFillStyle, + backgroundFillStyle: self.backgroundFillStyle, + backgroundOpacity: self.backgroundOpacity, + onlineStatusColor: self.onlineStatusColor, + offlineStatusColor: self.offlineStatusColor, + textTypography: textTypography + ) + } + + func applyColorVariation(variation: AvatarAppearance) -> AvatarAppearance { + return AvatarAppearance( + size: size, + textFillStyle: variation.textFillStyle, + backgroundFillStyle: variation.backgroundFillStyle, + backgroundOpacity: variation.backgroundOpacity, + onlineStatusColor: variation.onlineStatusColor, + offlineStatusColor: variation.offlineStatusColor, + textTypography: textTypography + ) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAppearance.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAppearance.swift new file mode 100644 index 000000000..4e6e44d5b --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarAppearance.swift @@ -0,0 +1,51 @@ +import Foundation +import SDDSThemeCore + + +/** + `AvatarAppearance` определяет внешний вид аватара, включая цвет текста, фона, цвета статусов и типографику. + + - Properties: + - size: Конфигурация размеров для аватара. + - textFillStyle: Стиль заливки текста (цвет или градиент). + - backgroundFillStyle: Стиль заливки фона (цвет или градиент). + - onlineStatusColor: Цвет индикатора статуса "онлайн". + - offlineStatusColor: Цвет индикатора статуса "оффлайн". + - textTypography: Типографика текста. + */ +public struct AvatarAppearance: Hashable { + let id = UUID() + public let size: AvatarSizeConfiguration + public let textFillStyle: FillStyle + public let backgroundFillStyle: FillStyle + public let backgroundOpacity: CGFloat + public let onlineStatusColor: ColorToken + public let offlineStatusColor: ColorToken + public let textTypography: TypographyConfiguration + + public init( + size: AvatarSizeConfiguration = ZeroAvatarSize(), + textFillStyle: FillStyle = .color(.clearColor), + backgroundFillStyle: FillStyle = .color(.clearColor), + backgroundOpacity: CGFloat = 0, + onlineStatusColor: ColorToken = .clearColor, + offlineStatusColor: ColorToken = .clearColor, + textTypography: TypographyConfiguration = .default + ) { + self.size = size + self.textFillStyle = textFillStyle + self.backgroundFillStyle = backgroundFillStyle + self.backgroundOpacity = backgroundOpacity + self.onlineStatusColor = onlineStatusColor + self.offlineStatusColor = offlineStatusColor + self.textTypography = textTypography + } + + public static func == (lhs: AvatarAppearance, rhs: AvatarAppearance) -> Bool { + return lhs.id == rhs.id + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(id) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarImageSource.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarImageSource.swift new file mode 100644 index 000000000..31ef0b1f7 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarImageSource.swift @@ -0,0 +1,14 @@ +import Foundation +import SwiftUI + +/** + `AvatarImageSource` определяет источник изображения для аватара. + + - Cases: + - url: URL изображения, загружаемого асинхронно. + - image: Локальное изображение типа `Image`. + */ +public enum AvatarImageSource { + case url(URL) + case image(Image) +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarSizeConfiguration.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarSizeConfiguration.swift new file mode 100644 index 000000000..3572b2b97 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarSizeConfiguration.swift @@ -0,0 +1,23 @@ +import Foundation +import SwiftUI + +/** + `AvatarSizeConfiguration` определяет размеры и отступы для аватара. + + - Properties: + - avatarSize: Размер аватара. + - statusSize: Размер иконки статуса. + - statusInsets: Отступы иконки статуса относительно нижнего правого угла. + */ +public protocol AvatarSizeConfiguration { + var avatarSize: CGSize { get } + var statusSize: CGSize { get } + var statusInsets: EdgeInsets { get } +} + +public struct ZeroAvatarSize: AvatarSizeConfiguration { + public var avatarSize: CGSize { .zero } + public var statusSize: CGSize { .zero } + public var statusInsets: EdgeInsets { .init() } + public init() {} +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarStatus.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarStatus.swift new file mode 100644 index 000000000..548511b37 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/AvatarAppearance/AvatarStatus.swift @@ -0,0 +1,7 @@ +import Foundation + +public enum AvatarStatus: String { + case hidden + case online + case offline +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatar.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatar.swift index 9e26c94e9..9d0b2277a 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatar.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatar.swift @@ -1,5 +1,4 @@ import SwiftUI -import SDDSThemeCore // MARK: - SDDSAvatar @@ -12,7 +11,6 @@ import SDDSThemeCore - placeholderImage: Изображение-заглушка, отображаемое при отсутствии основного изображения. - status: Статус аватара (`hidden`, `online`, `offline`). - appearance: Параметры внешнего вида аватара. - - size: Конфигурация размеров для аватара. - accessibility: Параметры доступности для аватара. */ public struct SDDSAvatar: View { @@ -21,7 +19,6 @@ public struct SDDSAvatar: View { let placeholderImage: AvatarImageSource? let status: AvatarStatus let appearance: AvatarAppearance - let size: AvatarSizeConfiguration let accessibility: AvatarAccessibility @Environment(\.colorScheme) var colorScheme @@ -31,14 +28,12 @@ public struct SDDSAvatar: View { placeholderImage: AvatarImageSource?, status: AvatarStatus, appearance: AvatarAppearance, - size: AvatarSizeConfiguration, accessibility: AvatarAccessibility) { self.text = text self.image = image self.placeholderImage = placeholderImage self.status = status self.appearance = appearance - self.size = size self.accessibility = accessibility } @@ -48,7 +43,6 @@ public struct SDDSAvatar: View { self.placeholderImage = data.placeholderImage self.status = data.status self.appearance = data.appearance - self.size = data.size self.accessibility = data.accessibility } @@ -56,14 +50,14 @@ public struct SDDSAvatar: View { ZStack { if let placeholderImage = placeholderImage { avatarImage(for: placeholderImage) - .frame(width: size.avatarSize.width, height: size.avatarSize.height) + .frame(width: appearance.size.avatarSize.width, height: appearance.size.avatarSize.height) } else { backgroundView } if let image = image { avatarImage(for: image) - .frame(width: size.avatarSize.width, height: size.avatarSize.height) + .frame(width: appearance.size.avatarSize.width, height: appearance.size.avatarSize.height) } else { Text(text) .typography(textTypography) @@ -73,16 +67,16 @@ public struct SDDSAvatar: View { if status != .hidden { statusView .frame( - width: size.statusSize.width, - height: size.statusSize.height + width: appearance.size.statusSize.width, + height: appearance.size.statusSize.height ) .position( - x: size.statusInsets.leading + size.statusSize.width / 2, - y: size.statusInsets.top + size.statusSize.height / 2 + x: appearance.size.statusInsets.leading + appearance.size.statusSize.width / 2, + y: appearance.size.statusInsets.top + appearance.size.statusSize.height / 2 ) } } - .frame(width: size.avatarSize.width, height: size.avatarSize.height) + .frame(width: appearance.size.avatarSize.width, height: appearance.size.avatarSize.height) .accessibilityElement() .accessibilityLabel(accessibility.label) .accessibilityHint(accessibility.hint) @@ -146,113 +140,10 @@ public struct SDDSAvatar: View { } private var textTypography: TypographyToken { - if let typography = appearance.textTypography.typography(with: size) { + if let typography = appearance.textTypography.typography(with: appearance.size) { return typography } else { fatalError("Undefined Avatar Typography") } } } - -// MARK: - AvatarStatus - -public enum AvatarStatus: String { - case hidden - case online - case offline -} - -// MARK: - AvatarSizeConfiguration - -/** - `AvatarSizeConfiguration` определяет размеры и отступы для аватара. - - - Properties: - - avatarSize: Размер аватара. - - statusSize: Размер иконки статуса. - - statusInsets: Отступы иконки статуса относительно нижнего правого угла. - */ -public protocol AvatarSizeConfiguration { - var avatarSize: CGSize { get } - var statusSize: CGSize { get } - var statusInsets: EdgeInsets { get } -} - -// MARK: - AvatarAppearance - -/** - `AvatarAppearance` определяет внешний вид аватара, включая цвет текста, фона, цвета статусов и типографику. - - - Properties: - - textFillStyle: Стиль заливки текста (цвет или градиент). - - backgroundFillStyle: Стиль заливки фона (цвет или градиент). - - onlineStatusColor: Цвет индикатора статуса "онлайн". - - offlineStatusColor: Цвет индикатора статуса "оффлайн". - - textTypography: Типографика текста. - */ -public struct AvatarAppearance: Hashable { - let id = UUID() - public let textFillStyle: FillStyle - public let backgroundFillStyle: FillStyle - public let backgroundOpacity: CGFloat - public let onlineStatusColor: ColorToken - public let offlineStatusColor: ColorToken - public let textTypography: TypographyConfiguration - - public init( - textFillStyle: FillStyle, - backgroundFillStyle: FillStyle, - backgroundOpacity: CGFloat, - onlineStatusColor: ColorToken, - offlineStatusColor: ColorToken, - textTypography: TypographyConfiguration - ) { - self.textFillStyle = textFillStyle - self.backgroundFillStyle = backgroundFillStyle - self.backgroundOpacity = backgroundOpacity - self.onlineStatusColor = onlineStatusColor - self.offlineStatusColor = offlineStatusColor - self.textTypography = textTypography - } - - public static func == (lhs: AvatarAppearance, rhs: AvatarAppearance) -> Bool { - return lhs.id == rhs.id - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id) - } -} - -// MARK: - AvatarImageSource - -/** - `AvatarImageSource` определяет источник изображения для аватара. - - - Cases: - - url: URL изображения, загружаемого асинхронно. - - image: Локальное изображение типа `Image`. - */ -public enum AvatarImageSource { - case url(URL) - case image(Image) -} - -// MARK: - AvatarAccessibility - -/** - `AvatarAccessibility` предоставляет параметры доступности для аватара. - - - Properties: - - label: Метка доступности для аватара. - - hint: Подсказка доступности для аватара. - */ -public struct AvatarAccessibility { - public let label: String - public let hint: String - - public init(label: String = "", hint: String = "") { - self.label = label - self.hint = hint - } -} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatarData.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatarData.swift index 2202bd8bf..c0394bacc 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatarData.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatarData.swift @@ -20,7 +20,6 @@ public struct SDDSAvatarData { public let placeholderImage: AvatarImageSource? public let status: AvatarStatus public let appearance: AvatarAppearance - public let size: AvatarSizeConfiguration public let accessibility: AvatarAccessibility /** @@ -32,7 +31,6 @@ public struct SDDSAvatarData { - placeholderImage: Изображение-заглушка, отображаемое при отсутствии основного изображения. - status: Статус аватара (`hidden`, `online`, `offline`). - appearance: Параметры внешнего вида аватара. - - size: Конфигурация размеров для аватара. - accessibility: Параметры доступности для аватара. */ public init( @@ -41,7 +39,6 @@ public struct SDDSAvatarData { placeholderImage: AvatarImageSource? = nil, status: AvatarStatus = .hidden, appearance: AvatarAppearance, - size: AvatarSizeConfiguration, accessibility: AvatarAccessibility = AvatarAccessibility() ) { self.text = text @@ -49,7 +46,6 @@ public struct SDDSAvatarData { self.placeholderImage = placeholderImage self.status = status self.appearance = appearance - self.size = size self.accessibility = accessibility } } diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatarModifiers.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatarModifiers.swift index edae33a33..f2c2a1677 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatarModifiers.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSAvatar/SDDSAvatarModifiers.swift @@ -10,7 +10,6 @@ public extension View where Self == SDDSAvatar { placeholderImage: self.placeholderImage, status: self.status, appearance: self.appearance, - size: self.size, accessibility: self.accessibility ) } @@ -22,7 +21,6 @@ public extension View where Self == SDDSAvatar { placeholderImage: self.placeholderImage, status: self.status, appearance: self.appearance, - size: self.size, accessibility: self.accessibility ) } @@ -34,7 +32,6 @@ public extension View where Self == SDDSAvatar { placeholderImage: newPlaceholderImage, status: self.status, appearance: self.appearance, - size: self.size, accessibility: self.accessibility ) } @@ -46,7 +43,6 @@ public extension View where Self == SDDSAvatar { placeholderImage: self.placeholderImage, status: newStatus, appearance: self.appearance, - size: self.size, accessibility: self.accessibility ) } @@ -58,7 +54,6 @@ public extension View where Self == SDDSAvatar { placeholderImage: self.placeholderImage, status: self.status, appearance: newAppearance, - size: self.size, accessibility: self.accessibility ) } @@ -70,7 +65,6 @@ public extension View where Self == SDDSAvatar { placeholderImage: self.placeholderImage, status: self.status, appearance: self.appearance, - size: newSize, accessibility: self.accessibility ) } @@ -82,7 +76,6 @@ public extension View where Self == SDDSAvatar { placeholderImage: self.placeholderImage, status: self.status, appearance: self.appearance, - size: self.size, accessibility: newAccessibility ) } diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance.swift deleted file mode 100644 index 2628fd043..000000000 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Foundation -import SwiftUI -@_exported import SDDSThemeCore - -public struct CheckboxAppearance: SelectionControlAppearance { - public let titleTypography: TypographyConfiguration - public let subtitleTypography: TypographyConfiguration - public let titleColor: ColorToken - public let subtitleColor: ColorToken - public let disabledAlpha: CGFloat - public let imageTintColor: ColorToken? - - public init(titleTypography: TypographyConfiguration, subtitleTypography: TypographyConfiguration, titleColor: ColorToken, subtitleColor: ColorToken, disabledAlpha: CGFloat, imageTintColor: ColorToken? = nil) { - self.titleTypography = titleTypography - self.subtitleTypography = subtitleTypography - self.titleColor = titleColor - self.subtitleColor = subtitleColor - self.disabledAlpha = disabledAlpha - self.imageTintColor = imageTintColor - } -} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance/CheckboxAppearance+Extensions.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance/CheckboxAppearance+Extensions.swift new file mode 100644 index 000000000..f24e6b369 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance/CheckboxAppearance+Extensions.swift @@ -0,0 +1,99 @@ +import Foundation + +public extension CheckboxAppearance { + func size(_ size: SelectionControlSizeConfiguration) -> CheckboxAppearance { + return CheckboxAppearance( + size: size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func titleTypography(_ titleTypography: TypographyConfiguration) -> CheckboxAppearance { + return CheckboxAppearance( + size: self.size, + titleTypography: titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func subtitleTypography(_ subtitleTypography: TypographyConfiguration) -> CheckboxAppearance { + return CheckboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func titleColor(_ titleColor: ColorToken) -> CheckboxAppearance { + return CheckboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func subtitleColor(_ subtitleColor: ColorToken) -> CheckboxAppearance { + return CheckboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func disabledAlpha(_ disabledAlpha: CGFloat) -> CheckboxAppearance { + return CheckboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func imageTintColor(_ imageTintColor: ColorToken?) -> CheckboxAppearance { + return CheckboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: imageTintColor + ) + } + + func applyColorVariation(variation: CheckboxAppearance) -> CheckboxAppearance { + return CheckboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: variation.titleColor, + subtitleColor: variation.subtitleColor, + disabledAlpha: variation.disabledAlpha, + imageTintColor: variation.imageTintColor + ) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance/CheckboxAppearance.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance/CheckboxAppearance.swift new file mode 100644 index 000000000..68a61e68e --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxAppearance/CheckboxAppearance.swift @@ -0,0 +1,39 @@ +import Foundation +import SwiftUI +@_exported import SDDSThemeCore + +public struct CheckboxAppearance: SelectionControlAppearance, Hashable { + let id = UUID() + public let size: SelectionControlSizeConfiguration + public let titleTypography: TypographyConfiguration + public let subtitleTypography: TypographyConfiguration + public let titleColor: ColorToken + public let subtitleColor: ColorToken + public let disabledAlpha: CGFloat + public let imageTintColor: ColorToken? + + public init( + size: SelectionControlSizeConfiguration = ZeroSelectionControlSize(), + titleTypography: TypographyConfiguration = .default, + subtitleTypography: TypographyConfiguration = .default, + titleColor: ColorToken = .clearColor, + subtitleColor: ColorToken = .clearColor, + disabledAlpha: CGFloat = 0, + imageTintColor: ColorToken? = nil) { + self.size = size + self.titleTypography = titleTypography + self.subtitleTypography = subtitleTypography + self.titleColor = titleColor + self.subtitleColor = subtitleColor + self.disabledAlpha = disabledAlpha + self.imageTintColor = imageTintColor + } + + public static func == (lhs: CheckboxAppearance, rhs: CheckboxAppearance) -> Bool { + lhs.id == rhs.id + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(id) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxData.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxData.swift new file mode 100644 index 000000000..4cd866e4c --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/CheckboxData.swift @@ -0,0 +1,53 @@ +import Foundation +import SwiftUI + +/** + `CheckboxData` представляет собой структуру, содержащую данные для чекбокса. + + - Properties: + - state: Состояние чекбокса. + - title: Текст заголовка для чекбокса. + - subtitle: Текст подзаголовка для чекбокса. + - isEnabled: Флаг, указывающий, включен ли чекбокс. + - images: Изображения для различных состояний чекбокса. + - size: Конфигурация размеров для чекбокса. + - appearance: Параметры внешнего вида чекбокса. + - accessibility: Параметры доступности для чекбокса. + */ +public struct CheckboxData: Hashable { + let id = UUID() + let state: Binding + let title: String + let subtitle: String? + let isEnabled: Bool + let images: SelectionControlStateImages + let appearance: CheckboxAppearance + let accessibility: SelectionControlAccessibility + + public init( + state: Binding, + title: String, + subtitle: String? = nil, + isEnabled: Bool, + images: SelectionControlStateImages, + appearance: CheckboxAppearance, + accessibility: SelectionControlAccessibility = SelectionControlAccessibility() + ) { + self.state = state + self.title = title + self.subtitle = subtitle + self.isEnabled = isEnabled + self.images = images + self.appearance = appearance + self.accessibility = accessibility + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(id.uuidString) + hasher.combine(state.wrappedValue.rawValue) + } + + public static func == (lhs: CheckboxData, rhs: CheckboxData) -> Bool { + lhs.id == rhs.id && lhs.state.wrappedValue == rhs.state.wrappedValue + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/SDDSCheckbox.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/SDDSCheckbox.swift index 78cdccf87..b59692b1a 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/SDDSCheckbox.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckbox/SDDSCheckbox.swift @@ -1,60 +1,6 @@ import Foundation import SwiftUI -/** - `CheckboxData` представляет собой структуру, содержащую данные для чекбокса. - - - Properties: - - state: Состояние чекбокса. - - title: Текст заголовка для чекбокса. - - subtitle: Текст подзаголовка для чекбокса. - - isEnabled: Флаг, указывающий, включен ли чекбокс. - - images: Изображения для различных состояний чекбокса. - - size: Конфигурация размеров для чекбокса. - - appearance: Параметры внешнего вида чекбокса. - - accessibility: Параметры доступности для чекбокса. - */ -public struct CheckboxData: Hashable { - let id = UUID() - let state: Binding - let title: String - let subtitle: String? - let isEnabled: Bool - let images: SelectionControlStateImages - let size: SelectionControlSizeConfiguration - let appearance: CheckboxAppearance - let accessibility: SelectionControlAccessibility - - public init( - state: Binding, - title: String, - subtitle: String? = nil, - isEnabled: Bool, - images: SelectionControlStateImages, - size: SelectionControlSizeConfiguration, - appearance: CheckboxAppearance, - accessibility: SelectionControlAccessibility = SelectionControlAccessibility() - ) { - self.state = state - self.title = title - self.subtitle = subtitle - self.isEnabled = isEnabled - self.images = images - self.size = size - self.appearance = appearance - self.accessibility = accessibility - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id.uuidString) - hasher.combine(state.wrappedValue.rawValue) - } - - public static func == (lhs: CheckboxData, rhs: CheckboxData) -> Bool { - lhs.id == rhs.id && lhs.state.wrappedValue == rhs.state.wrappedValue - } -} - /** `SDDSCheckbox` представляет собой настраиваемый чекбокс, который может быть настроен с помощью различных параметров. @@ -64,7 +10,6 @@ public struct CheckboxData: Hashable { - subtitle: Текст подзаголовка для чекбокса. - isEnabled: Флаг, указывающий, включен ли чекбокс. - images: Изображения для различных состояний чекбокса. - - size: Конфигурация размеров для чекбокса. - appearance: Параметры внешнего вида чекбокса. - accessibility: Параметры доступности для чекбокса. */ @@ -74,7 +19,6 @@ public struct SDDSCheckbox: View { let subtitle: String? let isEnabled: Bool let images: SelectionControlStateImages - let size: SelectionControlSizeConfiguration let appearance: CheckboxAppearance let accessibility: SelectionControlAccessibility @@ -97,7 +41,6 @@ public struct SDDSCheckbox: View { subtitle: String? = nil, isEnabled: Bool, images: SelectionControlStateImages, - size: SelectionControlSizeConfiguration, appearance: CheckboxAppearance, accessibility: SelectionControlAccessibility = SelectionControlAccessibility() ) { @@ -106,7 +49,6 @@ public struct SDDSCheckbox: View { self.subtitle = subtitle self.isEnabled = isEnabled self.images = images - self.size = size self.appearance = appearance self.accessibility = accessibility } @@ -123,7 +65,6 @@ public struct SDDSCheckbox: View { self.subtitle = data.subtitle self.isEnabled = data.isEnabled self.images = data.images - self.size = data.size self.appearance = data.appearance self.accessibility = data.accessibility } @@ -135,7 +76,6 @@ public struct SDDSCheckbox: View { title: title, subtitle: subtitle, isEnabled: isEnabled, - size: size, appearance: appearance, images: images, accessibility: accessibility diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckboxGroup/SDDSCheckboxGroup.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckboxGroup/SDDSCheckboxGroup.swift index ff3757cc7..7c39657b6 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckboxGroup/SDDSCheckboxGroup.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSCheckboxGroup/SDDSCheckboxGroup.swift @@ -77,7 +77,6 @@ public struct SDDSCheckboxGroup: View { subtitle: parent.subtitle, isEnabled: parent.isEnabled, images: parent.images, - size: parent.size, appearance: parent.appearance, accessibility: parent.accessibility ) @@ -94,7 +93,6 @@ public struct SDDSCheckboxGroup: View { subtitle: child.subtitle, isEnabled: child.isEnabled, images: child.images, - size: child.size, appearance: child.appearance, accessibility: child.accessibility ) @@ -114,7 +112,6 @@ public struct SDDSCheckboxGroup: View { subtitle: item.subtitle, isEnabled: item.isEnabled, images: item.images, - size: item.size, appearance: item.appearance, accessibility: item.accessibility ) diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipAccessibility.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipAccessibility.swift new file mode 100644 index 000000000..17a076994 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipAccessibility.swift @@ -0,0 +1,25 @@ +import Foundation + +/** + `ChipAccessibility` определяет параметры доступности для чипа. + + - Properties: + - titleLabel: Метка доступности для заголовка. + - removeButtonLabel: Метка доступности для кнопки удаления. + - removeButtonHint: Подсказка для кнопки удаления. + */ +public struct ChipAccessibility { + public var titleLabel: String + public var removeButtonLabel: String + public var removeButtonHint: String + + public init( + titleLabel: String = "Chip Label", + removeButtonLabel: String = "Remove", + removeButtonHint: String = "Double-tap to remove the chip." + ) { + self.titleLabel = titleLabel + self.removeButtonLabel = removeButtonLabel + self.removeButtonHint = removeButtonHint + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipAppearance+Extensions.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipAppearance+Extensions.swift new file mode 100644 index 000000000..0eb75750c --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipAppearance+Extensions.swift @@ -0,0 +1,100 @@ +// MARK: - ChipAppearance Extension +import Foundation + +public extension ChipAppearance { + func size(_ size: ChipSizeConfiguration) -> ChipAppearance { + return ChipAppearance( + size: size, + titleColor: self.titleColor, + titleTypography: self.titleTypography, + imageTintColor: self.imageTintColor, + buttonTintColor: self.buttonTintColor, + backgroundColor: self.backgroundColor, + disabledAlpha: self.disabledAlpha + ) + } + + func titleColor(_ titleColor: ColorToken) -> ChipAppearance { + return ChipAppearance( + size: self.size, + titleColor: titleColor, + titleTypography: self.titleTypography, + imageTintColor: self.imageTintColor, + buttonTintColor: self.buttonTintColor, + backgroundColor: self.backgroundColor, + disabledAlpha: self.disabledAlpha + ) + } + + func titleTypography(_ titleTypography: TypographyConfiguration) -> ChipAppearance { + return ChipAppearance( + size: self.size, + titleColor: self.titleColor, + titleTypography: titleTypography, + imageTintColor: self.imageTintColor, + buttonTintColor: self.buttonTintColor, + backgroundColor: self.backgroundColor, + disabledAlpha: self.disabledAlpha + ) + } + + func imageTintColor(_ imageTintColor: ColorToken) -> ChipAppearance { + return ChipAppearance( + size: self.size, + titleColor: self.titleColor, + titleTypography: self.titleTypography, + imageTintColor: imageTintColor, + buttonTintColor: self.buttonTintColor, + backgroundColor: self.backgroundColor, + disabledAlpha: self.disabledAlpha + ) + } + + func buttonTintColor(_ buttonTintColor: ColorToken) -> ChipAppearance { + return ChipAppearance( + size: self.size, + titleColor: self.titleColor, + titleTypography: self.titleTypography, + imageTintColor: self.imageTintColor, + buttonTintColor: buttonTintColor, + backgroundColor: self.backgroundColor, + disabledAlpha: self.disabledAlpha + ) + } + + func backgroundColor(_ backgroundColor: ColorToken) -> ChipAppearance { + return ChipAppearance( + size: self.size, + titleColor: self.titleColor, + titleTypography: self.titleTypography, + imageTintColor: self.imageTintColor, + buttonTintColor: self.buttonTintColor, + backgroundColor: backgroundColor, + disabledAlpha: self.disabledAlpha + ) + } + + func disabledAlpha(_ disabledAlpha: CGFloat) -> ChipAppearance { + return ChipAppearance( + size: self.size, + titleColor: self.titleColor, + titleTypography: self.titleTypography, + imageTintColor: self.imageTintColor, + buttonTintColor: self.buttonTintColor, + backgroundColor: self.backgroundColor, + disabledAlpha: disabledAlpha + ) + } + + func applyColorVariation(variation: ChipAppearance) -> ChipAppearance { + return ChipAppearance( + size: self.size, + titleColor: variation.titleColor, + titleTypography: self.titleTypography, + imageTintColor: variation.imageTintColor, + buttonTintColor: variation.buttonTintColor, + backgroundColor: variation.backgroundColor, + disabledAlpha: variation.disabledAlpha + ) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipAppearance.swift similarity index 73% rename from SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance.swift rename to SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipAppearance.swift index 4afef70c9..3094fc698 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipAppearance.swift @@ -5,6 +5,7 @@ import Foundation `ChipAppearance` определяет внешний вид чипа, включая цвета и типографику. - Properties: + - size: Конфигурация размеров для чипа. - titleColor: Цвет текста заголовка. - titleTypography: Типографика заголовка. - imageTintColor: Цвет иконки. @@ -14,6 +15,7 @@ import Foundation */ public struct ChipAppearance: Hashable { let id = UUID() + public let size: ChipSizeConfiguration public let titleColor: ColorToken public let titleTypography: TypographyConfiguration public let imageTintColor: ColorToken @@ -22,13 +24,15 @@ public struct ChipAppearance: Hashable { public let disabledAlpha: CGFloat public init( - titleColor: ColorToken, - titleTypography: TypographyConfiguration, - imageTintColor: ColorToken, - buttonTintColor: ColorToken, - backgroundColor: ColorToken, - disabledAlpha: CGFloat + size: ChipSizeConfiguration = ZeroChipSize(), + titleColor: ColorToken = .clearColor, + titleTypography: TypographyConfiguration = .default, + imageTintColor: ColorToken = .clearColor, + buttonTintColor: ColorToken = .clearColor, + backgroundColor: ColorToken = .clearColor, + disabledAlpha: CGFloat = 0 ) { + self.size = size self.titleColor = titleColor self.titleTypography = titleTypography self.imageTintColor = imageTintColor diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipBorderStyle.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipBorderStyle.swift new file mode 100644 index 000000000..b677e71c0 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipBorderStyle.swift @@ -0,0 +1,22 @@ +import Foundation + +/** + `ChipBorderStyle` определяет стиль границы для чипа. + + - `default`: Стиль по умолчанию с заданным радиусом скругления. + - `pilled`: Закругленный стиль с максимальным радиусом скругления. + */ +public enum ChipBorderStyle: Hashable { + case `default`(_ cornerRadius: CGFloat) + case pilled + + public func hash(into hasher: inout Hasher) { + switch self { + case .default(let cornerRadius): + hasher.combine("default") + hasher.combine(cornerRadius) + case .pilled: + hasher.combine("pilled") + } + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipSizeConfiguration.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipSizeConfiguration.swift new file mode 100644 index 000000000..2e28edd68 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipAppearance/ChipSizeConfiguration.swift @@ -0,0 +1,35 @@ +import Foundation + +/** + `ChipSizeConfiguration` определяет конфигурацию размеров для чипа. + + - Properties: + - iconImageSize: Размер изображения иконки. + - buttonImageSize: Размер изображения кнопки. + - leadingInset: Внутренний отступ слева. + - trailingInset: Внутренний отступ справа. + - spacing: Расстояние между элементами. + - borderStyle: Стиль границы чипа. + - height: Высота чипа. + */ +public protocol ChipSizeConfiguration: SizeConfiguration, CustomDebugStringConvertible { + var iconImageSize: CGSize? { get } + var buttonImageSize: CGSize? { get } + var leadingInset: CGFloat { get } + var trailingInset: CGFloat { get } + var spacing: CGFloat { get } + var borderStyle: ChipBorderStyle { get } + var height: CGFloat { get } +} + +public struct ZeroChipSize: ChipSizeConfiguration { + public var iconImageSize: CGSize? { nil } + public var buttonImageSize: CGSize? { nil } + public var leadingInset: CGFloat { 0 } + public var trailingInset: CGFloat { 0 } + public var spacing: CGFloat { 0 } + public var borderStyle: ChipBorderStyle { .default(0) } + public var height: CGFloat { 0 } + public var debugDescription: String { "ZeroChipSize" } + public init() {} +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipData.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipData.swift new file mode 100644 index 000000000..3eb7d9fb8 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/ChipData.swift @@ -0,0 +1,45 @@ +import Foundation +import SwiftUI + +/** + Структура, представляющая данные для чипа. + + - Properties: + - id: Уникальный идентификатор чипа. + - title: Текст заголовка чипа. + - isEnabled: Флаг, указывающий, включен ли чип. + - iconImage: Изображение иконки для чипа. + - buttonImage: Изображение кнопки для чипа. + - appearance: Параметры внешнего вида чипа. + - accessibility: Параметры доступности для чипа. + - removeAction: Действие при нажатии на кнопку удаления. + */ +public struct ChipData: Hashable { + public let id: UUID + public let title: String + public let isEnabled: Bool + public let iconImage: Image? + public let buttonImage: Image? + public let appearance: ChipAppearance + public let accessibility: ChipAccessibility + public let removeAction: () -> Void + + public init(id: UUID = UUID(), title: String, isEnabled: Bool, iconImage: Image?, buttonImage: Image?, appearance: ChipAppearance, accessibility: ChipAccessibility, removeAction: @escaping () -> Void) { + self.id = id + self.title = title + self.isEnabled = isEnabled + self.iconImage = iconImage + self.buttonImage = buttonImage + self.appearance = appearance + self.accessibility = accessibility + self.removeAction = removeAction + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(id.uuidString) + } + + public static func == (lhs: ChipData, rhs: ChipData) -> Bool { + lhs.id == rhs.id + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/SDDSChip.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/SDDSChip.swift index 7f89cef27..41b0daa6d 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/SDDSChip.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChip/SDDSChip.swift @@ -2,73 +2,6 @@ import Foundation import SwiftUI @_exported import SDDSThemeCore -/** - `ChipBorderStyle` определяет стиль границы для чипа. - - - `default`: Стиль по умолчанию с заданным радиусом скругления. - - `pilled`: Закругленный стиль с максимальным радиусом скругления. - */ -public enum ChipBorderStyle: Hashable { - case `default`(_ cornerRadius: CGFloat) - case pilled - - public func hash(into hasher: inout Hasher) { - switch self { - case .default(let cornerRadius): - hasher.combine("default") - hasher.combine(cornerRadius) - case .pilled: - hasher.combine("pilled") - } - } -} - -/** - `ChipSizeConfiguration` определяет конфигурацию размеров для чипа. - - - Properties: - - iconImageSize: Размер изображения иконки. - - buttonImageSize: Размер изображения кнопки. - - leadingInset: Внутренний отступ слева. - - trailingInset: Внутренний отступ справа. - - spacing: Расстояние между элементами. - - borderStyle: Стиль границы чипа. - - height: Высота чипа. - */ -public protocol ChipSizeConfiguration: SizeConfiguration, CustomDebugStringConvertible { - var iconImageSize: CGSize? { get } - var buttonImageSize: CGSize? { get } - var leadingInset: CGFloat { get } - var trailingInset: CGFloat { get } - var spacing: CGFloat { get } - var borderStyle: ChipBorderStyle { get } - var height: CGFloat { get } -} - -/** - `ChipAccessibility` определяет параметры доступности для чипа. - - - Properties: - - titleLabel: Метка доступности для заголовка. - - removeButtonLabel: Метка доступности для кнопки удаления. - - removeButtonHint: Подсказка для кнопки удаления. - */ -public struct ChipAccessibility { - public var titleLabel: String - public var removeButtonLabel: String - public var removeButtonHint: String - - public init( - titleLabel: String = "Chip Label", - removeButtonLabel: String = "Remove", - removeButtonHint: String = "Double-tap to remove the chip." - ) { - self.titleLabel = titleLabel - self.removeButtonLabel = removeButtonLabel - self.removeButtonHint = removeButtonHint - } -} - /** `SDDSChip` представляет собой настраиваемый чип, который может быть настроен с помощью различных параметров. @@ -78,7 +11,6 @@ public struct ChipAccessibility { - iconImage: Изображение иконки для чипа. - buttonImage: Изображение кнопки для чипа. - appearance: Параметры внешнего вида чипа. - - size: Конфигурация размеров для чипа. - accessibility: Параметры доступности для чипа. - removeAction: Действие при нажатии на кнопку удаления. */ @@ -88,7 +20,6 @@ public struct SDDSChip: View { let iconImage: Image? let buttonImage: Image? let appearance: ChipAppearance - let size: ChipSizeConfiguration let accessibility: ChipAccessibility let removeAction: () -> Void @@ -103,17 +34,15 @@ public struct SDDSChip: View { - iconImage: Изображение иконки для чипа (по умолчанию nil). - buttonImage: Изображение кнопки для чипа (по умолчанию nil). - appearance: Параметры внешнего вида чипа. - - size: Конфигурация размеров для чипа. - accessibility: Параметры доступности для чипа (по умолчанию `ChipAccessibility`). - removeAction: Действие при нажатии на кнопку удаления. */ - public init(title: String, isEnabled: Bool, iconImage: Image? = nil, buttonImage: Image? = nil, appearance: ChipAppearance, size: ChipSizeConfiguration, accessibility: ChipAccessibility = ChipAccessibility(), removeAction: @escaping () -> Void) { + public init(title: String, isEnabled: Bool, iconImage: Image? = nil, buttonImage: Image? = nil, appearance: ChipAppearance, accessibility: ChipAccessibility = ChipAccessibility(), removeAction: @escaping () -> Void) { self.title = title self.isEnabled = isEnabled self.iconImage = iconImage self.buttonImage = buttonImage self.appearance = appearance - self.size = size self.accessibility = accessibility self.removeAction = removeAction } @@ -130,7 +59,6 @@ public struct SDDSChip: View { self.iconImage = data.iconImage self.buttonImage = data.buttonImage self.appearance = data.appearance - self.size = data.size self.accessibility = data.accessibility self.removeAction = data.removeAction } @@ -138,8 +66,8 @@ public struct SDDSChip: View { public var body: some View { HStack(spacing: 0) { Spacer() - .frame(width: size.leadingInset) - if let iconImage = iconImage, let iconImageSize = size.iconImageSize { + .frame(width: appearance.size.leadingInset) + if let iconImage = iconImage, let iconImageSize = appearance.size.iconImageSize { iconImage .resizable() .renderingMode(.template) @@ -148,20 +76,20 @@ public struct SDDSChip: View { .foregroundColor(appearance.imageTintColor.color(for: colorScheme)) .accessibilityHidden(true) Spacer() - .frame(width: size.spacing) + .frame(width: appearance.size.spacing) } Text(title) .lineLimit(1) - .typography(appearance.titleTypography.typography(with: size) ?? .undefined) + .typography(appearance.titleTypography.typography(with: appearance.size) ?? .undefined) .frame(width: textWidth) .foregroundColor(appearance.titleColor.color(for: colorScheme)) .accessibilityLabel(Text(accessibility.titleLabel)) .accessibilityValue(Text(title)) - if let buttonImageSize = size.buttonImageSize, let buttonImage = buttonImage { + if let buttonImageSize = appearance.size.buttonImageSize, let buttonImage = buttonImage { Spacer() - .frame(width: size.spacing) + .frame(width: appearance.size.spacing) Button(action: handleRemove) { buttonImage .resizable() @@ -175,10 +103,10 @@ public struct SDDSChip: View { } } Spacer() - .frame(width: size.trailingInset) + .frame(width: appearance.size.trailingInset) } .onTapGesture(perform: handleRemove) - .frame(height: size.height) + .frame(height: appearance.size.height) .background( RoundedRectangle(cornerRadius: borderRadius) .fill(appearance.backgroundColor.color(for: colorScheme)) @@ -188,18 +116,18 @@ public struct SDDSChip: View { } private var textWidth: CGFloat { - let titleTypography = appearance.titleTypography.typography(with: size) ?? .undefined + let titleTypography = appearance.titleTypography.typography(with: appearance.size) ?? .undefined let textWidth = title.size(withAttributes: [.font: titleTypography.uiFont]).width return textWidth } private var borderRadius: CGFloat { - switch size.borderStyle { + switch appearance.size.borderStyle { case .default(let cornerRadius): return cornerRadius case .pilled: - return size.height / 2 + return appearance.size.height / 2 } } diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSChipGroup/SDDSChipGroup.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChipGroup/SDDSChipGroup.swift index 5f543a7e3..ac419cd78 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSChipGroup/SDDSChipGroup.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSChipGroup/SDDSChipGroup.swift @@ -1,52 +1,6 @@ import Foundation import SwiftUI -/** - Структура, представляющая данные для чипа. - - - Properties: - - id: Уникальный идентификатор чипа. - - title: Текст заголовка чипа. - - isEnabled: Флаг, указывающий, включен ли чип. - - iconImage: Изображение иконки для чипа. - - buttonImage: Изображение кнопки для чипа. - - appearance: Параметры внешнего вида чипа. - - size: Конфигурация размеров для чипа. - - accessibility: Параметры доступности для чипа. - - removeAction: Действие при нажатии на кнопку удаления. - */ -public struct ChipData: Hashable { - public let id: UUID - public let title: String - public let isEnabled: Bool - public let iconImage: Image? - public let buttonImage: Image? - public let appearance: ChipAppearance - public let size: ChipSizeConfiguration - public let accessibility: ChipAccessibility - public let removeAction: () -> Void - - public init(id: UUID = UUID(), title: String, isEnabled: Bool, iconImage: Image?, buttonImage: Image?, appearance: ChipAppearance, size: ChipSizeConfiguration, accessibility: ChipAccessibility, removeAction: @escaping () -> Void) { - self.id = id - self.title = title - self.isEnabled = isEnabled - self.iconImage = iconImage - self.buttonImage = buttonImage - self.appearance = appearance - self.size = size - self.accessibility = accessibility - self.removeAction = removeAction - } - - public func hash(into hasher: inout Hasher) { - hasher.combine(id.uuidString) - } - - public static func == (lhs: ChipData, rhs: ChipData) -> Bool { - lhs.id == rhs.id - } -} - /** Перечисление, определяющее варианты выравнивания группы чипов. @@ -169,21 +123,21 @@ public struct SDDSChipGroup: View { private func calculateChipWidth(for chipData: ChipData) -> CGFloat { var totalWidth = CGFloat(0) - totalWidth += chipData.size.leadingInset - if let _ = chipData.iconImage, let iconImageSize = chipData.size.iconImageSize { + totalWidth += chipData.appearance.size.leadingInset + if let _ = chipData.iconImage, let iconImageSize = chipData.appearance.size.iconImageSize { totalWidth += iconImageSize.width - totalWidth += chipData.size.spacing + totalWidth += chipData.appearance.size.spacing } - let titleTypography = chipData.appearance.titleTypography.typography(with: chipData.size) ?? .undefined + let titleTypography = chipData.appearance.titleTypography.typography(with: chipData.appearance.size) ?? .undefined let textWidth = chipData.title.size(withAttributes: [.font: titleTypography.uiFont]).width totalWidth += textWidth - if let _ = chipData.buttonImage, let buttomImageSize = chipData.size.buttonImageSize { + if let _ = chipData.buttonImage, let buttomImageSize = chipData.appearance.size.buttonImageSize { totalWidth += buttomImageSize.width - totalWidth += chipData.size.spacing + totalWidth += chipData.appearance.size.spacing } - totalWidth += chipData.size.trailingInset + totalWidth += chipData.appearance.size.trailingInset return totalWidth } @@ -202,6 +156,6 @@ public struct SDDSChipGroup: View { guard let chipData = data.first else { return 0 } - return chipData.size.height + return chipData.appearance.size.height } } diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance.swift deleted file mode 100644 index c7351d4ca..000000000 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Foundation - -/** - `ProgressBarAppearance` определяет внешний вид прогресс-бара, включая цвет индикатора и фона. - - - Properties: - - tintColor: Цвет индикатора прогресса. - - trackColor: Цвет фона прогресс-бара. - */ -public struct ProgressBarAppearance { - public let tintFillStyle: FillStyle - public let trackColor: ColorToken - - public init(tintFillStyle: FillStyle, trackColor: ColorToken) { - self.tintFillStyle = tintFillStyle - self.trackColor = trackColor - } -} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAccessibility.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAccessibility.swift new file mode 100644 index 000000000..211f19666 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAccessibility.swift @@ -0,0 +1,30 @@ +import Foundation +import SwiftUI +@_exported import SDDSThemeCore + +/** + `ProgressBarAccessibility` определяет параметры доступности для прогресс-бара. + + - Properties: + - progressLabel: Метка доступности для прогресс-бара. + - progressHint: Подсказка для прогресс-бара. + */ +public struct ProgressBarAccessibility { + public let progressLabel: String + public let progressHint: String + + /** + Инициализатор для создания параметров доступности прогресс-бара. + + - Parameters: + - progressLabel: Метка доступности для прогресс-бара. + - progressHint: Подсказка для прогресс-бара. + */ + public init( + progressLabel: String = "Progress", + progressHint: String = "Shows the current progress." + ) { + self.progressLabel = progressLabel + self.progressHint = progressHint + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAppearance+Extensions.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAppearance+Extensions.swift new file mode 100644 index 000000000..545d0ef0d --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAppearance+Extensions.swift @@ -0,0 +1,35 @@ +import Foundation + +public extension ProgressBarAppearance { + func size(_ size: ProgressBarSizeConfiguration) -> ProgressBarAppearance { + return ProgressBarAppearance( + size: size, + tintFillStyle: self.tintFillStyle, + trackColor: self.trackColor + ) + } + + func tintFillStyle(_ tintFillStyle: FillStyle) -> ProgressBarAppearance { + return ProgressBarAppearance( + size: self.size, + tintFillStyle: tintFillStyle, + trackColor: self.trackColor + ) + } + + func trackColor(_ trackColor: ColorToken) -> ProgressBarAppearance { + return ProgressBarAppearance( + size: self.size, + tintFillStyle: self.tintFillStyle, + trackColor: trackColor + ) + } + + func applyColorVariation(variation: ProgressBarAppearance) -> ProgressBarAppearance { + return ProgressBarAppearance( + size: self.size, + tintFillStyle: variation.tintFillStyle, + trackColor: variation.trackColor + ) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAppearance.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAppearance.swift new file mode 100644 index 000000000..c8cee2e35 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarAppearance.swift @@ -0,0 +1,30 @@ +import Foundation + +/** + `ProgressBarAppearance` определяет внешний вид прогресс-бара, включая цвет индикатора и фона. + + - Properties: + - size: Конфигурация размеров для прогресс-бара. + - tintColor: Цвет индикатора прогресса. + - trackColor: Цвет фона прогресс-бара. + */ +public struct ProgressBarAppearance: Hashable { + let id = UUID() + public let size: ProgressBarSizeConfiguration + public let tintFillStyle: FillStyle + public let trackColor: ColorToken + + public init(size: ProgressBarSizeConfiguration = ZeroProgressBarSize(), tintFillStyle: FillStyle = .color(.clearColor), trackColor: ColorToken = .clearColor) { + self.size = size + self.tintFillStyle = tintFillStyle + self.trackColor = trackColor + } + + public static func == (lhs: ProgressBarAppearance, rhs: ProgressBarAppearance) -> Bool { + lhs.id == rhs.id + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(id) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarSizeConfiguration.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarSizeConfiguration.swift new file mode 100644 index 000000000..86a9e632e --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/ProgressBarAppearance/ProgressBarSizeConfiguration.swift @@ -0,0 +1,28 @@ +import Foundation +import SwiftUI +@_exported import SDDSThemeCore + +/** + `ProgressBarSizeConfiguration` определяет конфигурацию размеров для прогресс-бара. + + - Properties: + - height: Высота прогресс-бара. + - indicatorHeight: Высота индикатора прогресса. + - cornerRadius: Радиус скругления углов прогресс-бара. + - indicatorCornerRadius: Радиус скругления углов индикатора прогресса. + */ +public protocol ProgressBarSizeConfiguration: SizeConfiguration, CustomDebugStringConvertible { + var height: CGFloat { get } + var indicatorHeight: CGFloat { get } + var cornerRadius: CGFloat { get } + var indicatorCornerRadius: CGFloat { get } +} + +public struct ZeroProgressBarSize: ProgressBarSizeConfiguration { + public var debugDescription: String { "ZeroProgressBarSize" } + public var height: CGFloat { 0 } + public var indicatorHeight: CGFloat { 0 } + public var cornerRadius: CGFloat { 0 } + public var indicatorCornerRadius: CGFloat { 0 } + public init() {} +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/SDDSProgressBar.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/SDDSProgressBar.swift index f20025d60..6620c0b14 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/SDDSProgressBar.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSProgressBar/SDDSProgressBar.swift @@ -2,49 +2,6 @@ import Foundation import SwiftUI @_exported import SDDSThemeCore -/** - `ProgressBarSizeConfiguration` определяет конфигурацию размеров для прогресс-бара. - - - Properties: - - height: Высота прогресс-бара. - - indicatorHeight: Высота индикатора прогресса. - - cornerRadius: Радиус скругления углов прогресс-бара. - - indicatorCornerRadius: Радиус скругления углов индикатора прогресса. - */ -public protocol ProgressBarSizeConfiguration: SizeConfiguration, CustomDebugStringConvertible { - var height: CGFloat { get } - var indicatorHeight: CGFloat { get } - var cornerRadius: CGFloat { get } - var indicatorCornerRadius: CGFloat { get } -} - -/** - `ProgressBarAccessibility` определяет параметры доступности для прогресс-бара. - - - Properties: - - progressLabel: Метка доступности для прогресс-бара. - - progressHint: Подсказка для прогресс-бара. - */ -public struct ProgressBarAccessibility { - public let progressLabel: String - public let progressHint: String - - /** - Инициализатор для создания параметров доступности прогресс-бара. - - - Parameters: - - progressLabel: Метка доступности для прогресс-бара. - - progressHint: Подсказка для прогресс-бара. - */ - public init( - progressLabel: String = "Progress", - progressHint: String = "Shows the current progress." - ) { - self.progressLabel = progressLabel - self.progressHint = progressHint - } -} - /** `SDDSProgressView` представляет собой настраиваемый прогресс-бар, который может быть настроен с помощью различных параметров. @@ -52,14 +9,12 @@ public struct ProgressBarAccessibility { - progress: Значение прогресса (от 0 до 1), отображаемое в виде заполняющейся полосы. - isEnabled: Флаг, указывающий, доступен ли прогресс-бар для взаимодействия. - appearance: Параметры внешнего вида прогресс-бара. - - size: Конфигурация размеров для прогресс-бара. - accessibility: Параметры доступности для прогресс-бара. */ public struct SDDSProgressView: View { @Binding var progress: Double let isEnabled: Bool let appearance: ProgressBarAppearance - let size: ProgressBarSizeConfiguration let accessibility: ProgressBarAccessibility @Environment(\.colorScheme) var colorScheme @@ -71,20 +26,17 @@ public struct SDDSProgressView: View { - progress: Значение прогресса (от 0 до 1), отображаемое в виде заполняющейся полосы. - isEnabled: Флаг, указывающий, доступен ли прогресс-бар для взаимодействия. - appearance: Параметры внешнего вида прогресс-бара. - - size: Конфигурация размеров для прогресс-бара. - accessibility: Параметры доступности для прогресс-бара. */ public init( progress: Binding, isEnabled: Bool = true, appearance: ProgressBarAppearance, - size: ProgressBarSizeConfiguration, accessibility: ProgressBarAccessibility = ProgressBarAccessibility() ) { self._progress = progress self.isEnabled = isEnabled self.appearance = appearance - self.size = size self.accessibility = accessibility } @@ -92,17 +44,17 @@ public struct SDDSProgressView: View { GeometryReader { geometry in ZStack(alignment: .leading) { // Background track - RoundedRectangle(cornerRadius: size.cornerRadius) + RoundedRectangle(cornerRadius: appearance.size.cornerRadius) .fill(appearance.trackColor.color(for: colorScheme)) - .frame(width: geometry.size.width, height: size.height) + .frame(width: geometry.size.width, height: appearance.size.height) // Progress indicator rectangle - .frame(width: CGFloat(normalizedProgress) * geometry.size.width, height: size.indicatorHeight) + .frame(width: CGFloat(normalizedProgress) * geometry.size.width, height: appearance.size.indicatorHeight) .position(x: CGFloat(normalizedProgress) * geometry.size.width / 2, y: geometry.size.height / 2) } } - .frame(height: size.indicatorHeight) + .frame(height: appearance.size.indicatorHeight) .accessibilityLabel(Text(accessibility.progressLabel)) .accessibilityValue(Text("\(Int(normalizedProgress * 100))%")) .accessibilityHint(Text(accessibility.progressHint)) @@ -113,11 +65,11 @@ public struct SDDSProgressView: View { private var rectangle: some View { switch appearance.tintFillStyle { case .color(let colorToken): - RoundedRectangle(cornerRadius: size.indicatorCornerRadius) + RoundedRectangle(cornerRadius: appearance.size.indicatorCornerRadius) .fill(colorToken.color(for: colorScheme)) case .gradient(let gradientToken): RoundedCornersMask( - cornerRadius: size.indicatorCornerRadius, + cornerRadius: appearance.size.indicatorCornerRadius, content: Rectangle().gradient(gradientToken) ) } diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance.swift deleted file mode 100644 index 6fa9f05f4..000000000 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Foundation -import SwiftUI -@_exported import SDDSThemeCore - -public struct RadioboxAppearance: SelectionControlAppearance { - public let titleTypography: TypographyConfiguration - public let subtitleTypography: TypographyConfiguration - public let titleColor: ColorToken - public let subtitleColor: ColorToken - public let disabledAlpha: CGFloat - public let imageTintColor: ColorToken? - - public init(titleTypography: TypographyConfiguration, subtitleTypography: TypographyConfiguration, titleColor: ColorToken, subtitleColor: ColorToken, disabledAlpha: CGFloat, imageTintColor: ColorToken?) { - self.titleTypography = titleTypography - self.subtitleTypography = subtitleTypography - self.titleColor = titleColor - self.subtitleColor = subtitleColor - self.disabledAlpha = disabledAlpha - self.imageTintColor = imageTintColor - } -} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance/RadioboxAppearance+Extensions.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance/RadioboxAppearance+Extensions.swift new file mode 100644 index 000000000..5d8884cb1 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance/RadioboxAppearance+Extensions.swift @@ -0,0 +1,99 @@ +import Foundation + +public extension RadioboxAppearance { + func size(_ size: SelectionControlSizeConfiguration) -> RadioboxAppearance { + return RadioboxAppearance( + size: size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func titleTypography(_ titleTypography: TypographyConfiguration) -> RadioboxAppearance { + return RadioboxAppearance( + size: self.size, + titleTypography: titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func subtitleTypography(_ subtitleTypography: TypographyConfiguration) -> RadioboxAppearance { + return RadioboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func titleColor(_ titleColor: ColorToken) -> RadioboxAppearance { + return RadioboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func subtitleColor(_ subtitleColor: ColorToken) -> RadioboxAppearance { + return RadioboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func disabledAlpha(_ disabledAlpha: CGFloat) -> RadioboxAppearance { + return RadioboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: disabledAlpha, + imageTintColor: self.imageTintColor + ) + } + + func imageTintColor(_ imageTintColor: ColorToken?) -> RadioboxAppearance { + return RadioboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + disabledAlpha: self.disabledAlpha, + imageTintColor: imageTintColor + ) + } + + func applyColorVariation(variation: RadioboxAppearance) -> RadioboxAppearance { + return RadioboxAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: variation.titleColor, + subtitleColor: variation.subtitleColor, + disabledAlpha: variation.disabledAlpha, + imageTintColor: variation.imageTintColor + ) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance/RadioboxAppearance.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance/RadioboxAppearance.swift new file mode 100644 index 000000000..db422a521 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxAppearance/RadioboxAppearance.swift @@ -0,0 +1,39 @@ +import Foundation +import SwiftUI +@_exported import SDDSThemeCore + +public struct RadioboxAppearance: SelectionControlAppearance, Hashable { + let id = UUID() + public let size: SelectionControlSizeConfiguration + public let titleTypography: TypographyConfiguration + public let subtitleTypography: TypographyConfiguration + public let titleColor: ColorToken + public let subtitleColor: ColorToken + public let disabledAlpha: CGFloat + public let imageTintColor: ColorToken? + + public init( + size: SelectionControlSizeConfiguration = ZeroSelectionControlSize(), + titleTypography: TypographyConfiguration = .default, + subtitleTypography: TypographyConfiguration = .default, + titleColor: ColorToken = .clearColor, + subtitleColor: ColorToken = .clearColor, + disabledAlpha: CGFloat = 0, + imageTintColor: ColorToken? = nil) { + self.size = size + self.titleTypography = titleTypography + self.subtitleTypography = subtitleTypography + self.titleColor = titleColor + self.subtitleColor = subtitleColor + self.disabledAlpha = disabledAlpha + self.imageTintColor = imageTintColor + } + + public static func == (lhs: RadioboxAppearance, rhs: RadioboxAppearance) -> Bool { + lhs.id == rhs.id + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(id) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxData.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxData.swift new file mode 100644 index 000000000..95d43c752 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/RadioboxData.swift @@ -0,0 +1,46 @@ +import Foundation +import SwiftUI + +/** + `RadioboxData` представляет собой данные для одного радиобокса. + + - Properties: + - id: Уникальный идентификатор радиобокса. + - title: Название радиобокса, отображаемое пользователю. + - subtitle: Подзаголовок радиобокса, отображаемый под названием (опционально). + - isSelected: Состояние выбранности радиобокса, привязанное к Binding. + - isEnabled: Указывает, включен ли радиобокс. + - images: Изображения для состояния выбранности и невыбранности радиобокса. + - appearance: Внешний вид радиобокса, определяемый `RadioboxAppearance`. + - accessibility: Параметры доступности для радиобокса. + */ +public struct RadioboxData: Identifiable { + public let id: UUID + public let title: String + public let subtitle: String? + public let isSelected: Binding + public let isEnabled: Bool + public let images: RadioboxImages + public let appearance: RadioboxAppearance + public let accessibility: SelectionControlAccessibility + + public init( + id: UUID = UUID(), + title: String, + subtitle: String? = nil, + isSelected: Binding, + isEnabled: Bool = true, + images: RadioboxImages, + appearance: RadioboxAppearance, + accessibility: SelectionControlAccessibility + ) { + self.id = id + self.title = title + self.subtitle = subtitle + self.isSelected = isSelected + self.isEnabled = isEnabled + self.images = images + self.appearance = appearance + self.accessibility = accessibility + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/SDDSRadiobox.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/SDDSRadiobox.swift index 5eeb2df0b..fb5875f15 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/SDDSRadiobox.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadiobox/SDDSRadiobox.swift @@ -18,7 +18,6 @@ public struct SDDSRadiobox: View { let subtitle: String? let isEnabled: Bool let images: RadioboxImages - let size: SelectionControlSizeConfiguration let appearance: RadioboxAppearance let accessibility: SelectionControlAccessibility @@ -28,7 +27,6 @@ public struct SDDSRadiobox: View { subtitle: String? = nil, isEnabled: Bool, images: RadioboxImages, - size: SelectionControlSizeConfiguration, appearance: RadioboxAppearance, accessibility: SelectionControlAccessibility = SelectionControlAccessibility() ) { @@ -37,7 +35,6 @@ public struct SDDSRadiobox: View { self.subtitle = subtitle self.isEnabled = isEnabled self.images = images - self.size = size self.appearance = appearance self.accessibility = accessibility } @@ -56,7 +53,6 @@ public struct SDDSRadiobox: View { title: title, subtitle: subtitle, isEnabled: isEnabled, - size: size, appearance: appearance, images: .init( selectedImage: images.selectedImage, diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadioboxGroup/SDDSRadioboxGroup.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadioboxGroup/SDDSRadioboxGroup.swift index cb95d89c9..df3a2d4a8 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadioboxGroup/SDDSRadioboxGroup.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSRadioboxGroup/SDDSRadioboxGroup.swift @@ -1,53 +1,5 @@ import SwiftUI -/** - `RadioboxData` представляет собой данные для одного радиобокса. - - - Properties: - - id: Уникальный идентификатор радиобокса. - - title: Название радиобокса, отображаемое пользователю. - - subtitle: Подзаголовок радиобокса, отображаемый под названием (опционально). - - isSelected: Состояние выбранности радиобокса, привязанное к Binding. - - isEnabled: Указывает, включен ли радиобокс. - - images: Изображения для состояния выбранности и невыбранности радиобокса. - - size: Конфигурация размера радиобокса. - - appearance: Внешний вид радиобокса, определяемый `RadioboxAppearance`. - - accessibility: Параметры доступности для радиобокса. - */ -public struct RadioboxData: Identifiable { - public let id: UUID - public let title: String - public let subtitle: String? - public let isSelected: Binding - public let isEnabled: Bool - public let images: RadioboxImages - public let size: SelectionControlSizeConfiguration - public let appearance: RadioboxAppearance - public let accessibility: SelectionControlAccessibility - - public init( - id: UUID = UUID(), - title: String, - subtitle: String? = nil, - isSelected: Binding, - isEnabled: Bool = true, - images: RadioboxImages, - size: SelectionControlSizeConfiguration, - appearance: RadioboxAppearance, - accessibility: SelectionControlAccessibility - ) { - self.id = id - self.title = title - self.subtitle = subtitle - self.isSelected = isSelected - self.isEnabled = isEnabled - self.images = images - self.size = size - self.appearance = appearance - self.accessibility = accessibility - } -} - /** `RadioboxGroupSizeConfiguration` задает конфигурацию размеров`. @@ -86,7 +38,6 @@ public struct SDDSRadioboxGroup: View { subtitle: data.subtitle, isEnabled: data.isEnabled, images: data.images, - size: data.size, appearance: data.appearance, accessibility: data.accessibility ) diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SDDSSwitch.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SDDSSwitch.swift index 84a1f2cde..e1fe664c8 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SDDSSwitch.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SDDSSwitch.swift @@ -2,131 +2,6 @@ import Foundation import SwiftUI @_exported import SDDSThemeCore -/** - `SwitchSizeConfiguration` определяет конфигурацию размеров для переключателя. - - - Properties: - - width: Ширина переключателя. - - verticalGap: Вертикальный зазор между элементами. - */ -public protocol SwitchSizeConfiguration: SizeConfiguration, CustomDebugStringConvertible { - var width: CGFloat? { get } - var verticalGap: CGFloat { get } -} - -/** - `SwitchAppearance` определяет внешний вид переключателя, включая типографику и цвета для различных состояний. - - - Properties: - - titleTypography: Типографика для заголовка переключателя. - - subtitleTypography: Типографика для подзаголовка переключателя. - - titleColor: Цвет заголовка, когда переключатель включен. - - subtitleColor: Цвет подзаголовка, когда переключатель включен. - - tintColor: Цвет переключателя, когда он включен. - */ -public struct SwitchAppearance { - public let titleTypography: TypographyConfiguration - public let subtitleTypography: TypographyConfiguration - public let titleColor: ColorToken - public let subtitleColor: ColorToken - public let tintColor: ColorToken - public let disabledAlpha: CGFloat - - public init(titleTypography: TypographyConfiguration, subtitleTypography: TypographyConfiguration, titleColor: ColorToken, subtitleColor: ColorToken, tintColor: ColorToken, disabledAlpha: CGFloat) { - self.titleTypography = titleTypography - self.subtitleTypography = subtitleTypography - self.titleColor = titleColor - self.subtitleColor = subtitleColor - self.tintColor = tintColor - self.disabledAlpha = disabledAlpha - } - -} - -public extension SwitchAppearance { - /** - Возвращает цвет переключателя в зависимости от его состояния (включен/выключен). - - - Parameter isEnabled: Флаг, указывающий, включен ли переключатель. - - Returns: Цвет переключателя. - */ - func tintColor(for isEnabled: Bool) -> ColorToken { - return isEnabled ? tintColor : tintColor.withOpacity(disabledAlpha) - } - - /** - Возвращает цвет заголовка в зависимости от состояния переключателя (включен/выключен). - - - Parameter isEnabled: Флаг, указывающий, включен ли переключатель. - - Returns: Цвет заголовка. - */ - func titleColor(for isEnabled: Bool) -> ColorToken { - return isEnabled ? titleColor : titleColor.withOpacity(disabledAlpha) - } - - /** - Возвращает цвет подзаголовка в зависимости от состояния переключателя (включен/выключен). - - - Parameter isEnabled: Флаг, указывающий, включен ли переключатель. - - Returns: Цвет подзаголовка. - */ - func subtitleColor(for isEnabled: Bool) -> ColorToken { - return isEnabled ? subtitleColor : subtitleColor.withOpacity(disabledAlpha) - } -} - -/** - `SwitchAccessibility` определяет параметры доступности для переключателя. - - - Properties: - - titleLabel: Метка доступности для заголовка. - - subtitleLabel: Метка доступности для подзаголовка. - - toggleLabel: Метка доступности для переключателя. - - toggleHint: Подсказка для переключателя. - - switchLabel: Метка доступности для всего переключателя. - - switchEnabledValue: Значение доступности, когда переключатель включен. - - switchDisabledValue: Значение доступности, когда переключатель выключен. - */ -public struct SwitchAccessibility { - public var titleLabel: String - public var subtitleLabel: String - public var toggleLabel: String - public var toggleHint: String - public var switchLabel: String - public var switchEnabledValue: String - public var switchDisabledValue: String - - /** - Инициализатор для создания параметров доступности переключателя. - - - Parameters: - - titleLabel: Метка доступности для заголовка. - - subtitleLabel: Метка доступности для подзаголовка. - - toggleLabel: Метка доступности для переключателя. - - toggleHint: Подсказка для переключателя. - - switchLabel: Метка доступности для всего переключателя. - - switchEnabledValue: Значение доступности, когда переключатель включен. - - switchDisabledValue: Значение доступности, когда переключатель выключен. - */ - public init( - titleLabel: String = "Title", - subtitleLabel: String = "Subtitle", - toggleLabel: String = "Toggle", - toggleHint: String = "Double-tap to toggle the switch.", - switchLabel: String = "Switch", - switchEnabledValue: String = "Enabled", - switchDisabledValue: String = "Disabled" - ) { - self.titleLabel = titleLabel - self.subtitleLabel = subtitleLabel - self.toggleLabel = toggleLabel - self.toggleHint = toggleHint - self.switchLabel = switchLabel - self.switchEnabledValue = switchEnabledValue - self.switchDisabledValue = switchDisabledValue - } -} - /** `SDDSSwitch` представляет собой настраиваемый переключатель, который может быть настроен с помощью различных параметров. @@ -135,7 +10,6 @@ public struct SwitchAccessibility { - subtitle: Текст подзаголовка для переключателя. - isOn: Связка состояния включения/выключения переключателя. - isEnabled: Флаг, указывающий, включен ли переключатель. - - size: Конфигурация размеров для переключателя. - appearance: Параметры внешнего вида переключателя. - switchAccessibility: Параметры доступности для переключателя. */ @@ -144,7 +18,6 @@ public struct SDDSSwitch: View { public let subtitle: String @Binding public var isOn: Bool public let isEnabled: Bool - public let size: SwitchSizeConfiguration public let appearance: SwitchAppearance public let switchAccessibility: SwitchAccessibility @@ -158,7 +31,6 @@ public struct SDDSSwitch: View { - subtitle: Текст подзаголовка для переключателя. - isOn: Связка состояния включения/выключения переключателя. - isEnabled: Флаг, указывающий, включен ли переключатель. - - size: Конфигурация размеров для переключателя. - appearance: Параметры внешнего вида переключателя. - switchAccessibility: Параметры доступности для переключателя. */ @@ -167,7 +39,6 @@ public struct SDDSSwitch: View { subtitle: String = "", isOn: Binding = .constant(true), isEnabled: Bool = true, - size: SwitchSizeConfiguration, appearance: SwitchAppearance, switchAccessibility: SwitchAccessibility ) { @@ -175,13 +46,12 @@ public struct SDDSSwitch: View { self.subtitle = subtitle self._isOn = isOn self.isEnabled = isEnabled - self.size = size self.appearance = appearance self.switchAccessibility = switchAccessibility } public var body: some View { - if let width = size.width { + if let width = appearance.size.width { content .frame(width: width) } else { @@ -191,7 +61,7 @@ public struct SDDSSwitch: View { } private var content: some View { - VStack(alignment: .leading, spacing: size.verticalGap) { + VStack(alignment: .leading, spacing: appearance.size.verticalGap) { HStack { if !title.isEmpty { Text(title) @@ -224,18 +94,18 @@ public struct SDDSSwitch: View { } var titleTypography: TypographyToken { - if let typography = appearance.titleTypography.typography(with: size) { + if let typography = appearance.titleTypography.typography(with: appearance.size) { return typography } else { - fatalError("Undefined Switch Typography for size \(size.debugDescription).") + fatalError("Undefined Switch Typography for size \(appearance.size.debugDescription).") } } var subtitleTypography: TypographyToken { - if let typography = appearance.subtitleTypography.typography(with: size) { + if let typography = appearance.subtitleTypography.typography(with: appearance.size) { return typography } else { - fatalError("Undefined Switch Typography for size \(size.debugDescription). Using a default value.") + fatalError("Undefined Switch Typography for size \(appearance.size.debugDescription). Using a default value.") } } diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAccessibility.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAccessibility.swift new file mode 100644 index 000000000..2af2606b3 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAccessibility.swift @@ -0,0 +1,53 @@ +import Foundation + +/** + `SwitchAccessibility` определяет параметры доступности для переключателя. + + - Properties: + - titleLabel: Метка доступности для заголовка. + - subtitleLabel: Метка доступности для подзаголовка. + - toggleLabel: Метка доступности для переключателя. + - toggleHint: Подсказка для переключателя. + - switchLabel: Метка доступности для всего переключателя. + - switchEnabledValue: Значение доступности, когда переключатель включен. + - switchDisabledValue: Значение доступности, когда переключатель выключен. + */ +public struct SwitchAccessibility { + public var titleLabel: String + public var subtitleLabel: String + public var toggleLabel: String + public var toggleHint: String + public var switchLabel: String + public var switchEnabledValue: String + public var switchDisabledValue: String + + /** + Инициализатор для создания параметров доступности переключателя. + + - Parameters: + - titleLabel: Метка доступности для заголовка. + - subtitleLabel: Метка доступности для подзаголовка. + - toggleLabel: Метка доступности для переключателя. + - toggleHint: Подсказка для переключателя. + - switchLabel: Метка доступности для всего переключателя. + - switchEnabledValue: Значение доступности, когда переключатель включен. + - switchDisabledValue: Значение доступности, когда переключатель выключен. + */ + public init( + titleLabel: String = "Title", + subtitleLabel: String = "Subtitle", + toggleLabel: String = "Toggle", + toggleHint: String = "Double-tap to toggle the switch.", + switchLabel: String = "Switch", + switchEnabledValue: String = "Enabled", + switchDisabledValue: String = "Disabled" + ) { + self.titleLabel = titleLabel + self.subtitleLabel = subtitleLabel + self.toggleLabel = toggleLabel + self.toggleHint = toggleHint + self.switchLabel = switchLabel + self.switchEnabledValue = switchEnabledValue + self.switchDisabledValue = switchDisabledValue + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAppearance+Extensions.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAppearance+Extensions.swift new file mode 100644 index 000000000..117b8ff06 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAppearance+Extensions.swift @@ -0,0 +1,100 @@ +// MARK: - SwitchAppearance Extension +import Foundation + +public extension SwitchAppearance { + func size(_ size: SwitchSizeConfiguration) -> SwitchAppearance { + return SwitchAppearance( + size: size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + tintColor: self.tintColor, + disabledAlpha: self.disabledAlpha + ) + } + + func titleTypography(_ titleTypography: TypographyConfiguration) -> SwitchAppearance { + return SwitchAppearance( + size: self.size, + titleTypography: titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + tintColor: self.tintColor, + disabledAlpha: self.disabledAlpha + ) + } + + func subtitleTypography(_ subtitleTypography: TypographyConfiguration) -> SwitchAppearance { + return SwitchAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + tintColor: self.tintColor, + disabledAlpha: self.disabledAlpha + ) + } + + func titleColor(_ titleColor: ColorToken) -> SwitchAppearance { + return SwitchAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: titleColor, + subtitleColor: self.subtitleColor, + tintColor: self.tintColor, + disabledAlpha: self.disabledAlpha + ) + } + + func subtitleColor(_ subtitleColor: ColorToken) -> SwitchAppearance { + return SwitchAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: subtitleColor, + tintColor: self.tintColor, + disabledAlpha: self.disabledAlpha + ) + } + + func tintColor(_ tintColor: ColorToken) -> SwitchAppearance { + return SwitchAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + tintColor: tintColor, + disabledAlpha: self.disabledAlpha + ) + } + + func disabledAlpha(_ disabledAlpha: CGFloat) -> SwitchAppearance { + return SwitchAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: self.titleColor, + subtitleColor: self.subtitleColor, + tintColor: self.tintColor, + disabledAlpha: disabledAlpha + ) + } + + func applyColorVariation(variation: SwitchAppearance) -> SwitchAppearance { + return SwitchAppearance( + size: self.size, + titleTypography: self.titleTypography, + subtitleTypography: self.subtitleTypography, + titleColor: variation.titleColor, + subtitleColor: variation.subtitleColor, + tintColor: variation.tintColor, + disabledAlpha: disabledAlpha + ) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAppearance.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAppearance.swift new file mode 100644 index 000000000..23e9265cc --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchAppearance.swift @@ -0,0 +1,82 @@ +import Foundation +@_exported import SDDSThemeCore + +/** + `SwitchAppearance` определяет внешний вид переключателя, включая типографику и цвета для различных состояний. + + - Properties: + - size: Конфигурация размеров для переключателя. + - titleTypography: Типографика для заголовка переключателя. + - subtitleTypography: Типографика для подзаголовка переключателя. + - titleColor: Цвет заголовка, когда переключатель включен. + - subtitleColor: Цвет подзаголовка, когда переключатель включен. + - tintColor: Цвет переключателя, когда он включен. + */ +public struct SwitchAppearance: Hashable { + let id = UUID() + public let size: SwitchSizeConfiguration + public let titleTypography: TypographyConfiguration + public let subtitleTypography: TypographyConfiguration + public let titleColor: ColorToken + public let subtitleColor: ColorToken + public let tintColor: ColorToken + public let disabledAlpha: CGFloat + + public init( + size: SwitchSizeConfiguration = DefaultSwitchSize(), + titleTypography: TypographyConfiguration = .default, + subtitleTypography: TypographyConfiguration = .default, + titleColor: ColorToken = .clearColor, + subtitleColor: ColorToken = .clearColor, + tintColor: ColorToken = .clearColor, + disabledAlpha: CGFloat = 0 + ) { + self.size = size + self.titleTypography = titleTypography + self.subtitleTypography = subtitleTypography + self.titleColor = titleColor + self.subtitleColor = subtitleColor + self.tintColor = tintColor + self.disabledAlpha = disabledAlpha + } + + public static func == (lhs: SwitchAppearance, rhs: SwitchAppearance) -> Bool { + lhs.id == rhs.id + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(id) + } +} + +public extension SwitchAppearance { + /** + Возвращает цвет переключателя в зависимости от его состояния (включен/выключен). + + - Parameter isEnabled: Флаг, указывающий, включен ли переключатель. + - Returns: Цвет переключателя. + */ + func tintColor(for isEnabled: Bool) -> ColorToken { + return isEnabled ? tintColor : tintColor.withOpacity(disabledAlpha) + } + + /** + Возвращает цвет заголовка в зависимости от состояния переключателя (включен/выключен). + + - Parameter isEnabled: Флаг, указывающий, включен ли переключатель. + - Returns: Цвет заголовка. + */ + func titleColor(for isEnabled: Bool) -> ColorToken { + return isEnabled ? titleColor : titleColor.withOpacity(disabledAlpha) + } + + /** + Возвращает цвет подзаголовка в зависимости от состояния переключателя (включен/выключен). + + - Parameter isEnabled: Флаг, указывающий, включен ли переключатель. + - Returns: Цвет подзаголовка. + */ + func subtitleColor(for isEnabled: Bool) -> ColorToken { + return isEnabled ? subtitleColor : subtitleColor.withOpacity(disabledAlpha) + } +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchSizeConfiguration.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchSizeConfiguration.swift new file mode 100644 index 000000000..28d655e97 --- /dev/null +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSSwitch/SwitchAppearance/SwitchSizeConfiguration.swift @@ -0,0 +1,25 @@ +import Foundation +@_exported import SDDSThemeCore + +/** + `SwitchSizeConfiguration` определяет конфигурацию размеров для переключателя. + + - Properties: + - width: Ширина переключателя. + - verticalGap: Вертикальный зазор между элементами. + */ +public protocol SwitchSizeConfiguration: SizeConfiguration, CustomDebugStringConvertible { + var width: CGFloat? { get } + var verticalGap: CGFloat { get } +} + +public struct DefaultSwitchSize: SwitchSizeConfiguration { + public var width: CGFloat? = nil + public var verticalGap: CGFloat = 0 + + public var debugDescription: String { + return "Default Size" + } + + public init() {} +} diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextArea/SDDSTextArea.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextArea/SDDSTextArea.swift index dcbca010a..b3491c0bc 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextArea/SDDSTextArea.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextArea/SDDSTextArea.swift @@ -774,7 +774,7 @@ public struct SDDSTextArea: View { case .single: return 0 case .multiple(_, let chips): - guard let chipSize = chips.first?.size else { + guard let chipSize = chips.first?.appearance.size else { return 0 } switch chipSize.borderStyle { diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextField/SDDSTextField.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextField/SDDSTextField.swift index b027d789a..5280f11dd 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextField/SDDSTextField.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextField/SDDSTextField.swift @@ -545,7 +545,7 @@ public struct SDDSTextField: View { private var backgroundColor: Color { if readOnly { - appearance.backgroundColorDefault.color(for: colorScheme) + return appearance.backgroundColorDefault.color(for: colorScheme) } return appearance.backgroundColor(for: style, isFocused: isFocused, readOnly: readOnly).color(for: colorScheme) } @@ -645,10 +645,11 @@ public struct SDDSTextField: View { // MARK: - Computed Properties for Conditions private func calculateTextWidth(text: String, placeholder: String, proxy: GeometryProxy) -> CGFloat { + let deltaPadding: CGFloat = 1.0 let textSize = (text as NSString).size(withAttributes: [NSAttributedString.Key.font: textTypography.uiFont]) if displayChips { if !text.isEmpty { - return textSize.width + size.textHorizontalPadding + return textSize.width + deltaPadding } else { let placeholderSize = (placeholder as NSString).size(withAttributes: [NSAttributedString.Key.font: textTypography.uiFont]) return placeholderSize.width @@ -659,17 +660,17 @@ public struct SDDSTextField: View { maxWidth -= size.textInputPaddings.leading + size.textInputPaddings.trailing if !textBefore.isEmpty && !displayChips { let textBeforeSize = (textBefore as NSString).size(withAttributes: [NSAttributedString.Key.font: textBeforeTypography.uiFont]) - maxWidth -= (textBeforeSize.width + size.textHorizontalPadding) + maxWidth -= (textBeforeSize.width + deltaPadding) maxWidth -= (size.textBeforeLeadingPadding + size.textBeforeTrailingPadding) } if !textAfter.isEmpty && !displayChips { let textBeforeSize = (textAfter as NSString).size(withAttributes: [NSAttributedString.Key.font: textAfterTypography.uiFont]) - maxWidth -= (textBeforeSize.width + size.textHorizontalPadding) + maxWidth -= (textBeforeSize.width + deltaPadding) maxWidth -= (size.textAfterLeadingPadding + size.textAfterTrailingPadding) } return min( - textSize.width + size.textHorizontalPadding, + textSize.width + deltaPadding, maxWidth ) } @@ -768,7 +769,7 @@ public struct SDDSTextField: View { case .single: return 0 case .multiple(_, let chips): - guard let chipSize = chips.first?.size else { + guard let chipSize = chips.first?.appearance.size else { return 0 } switch chipSize.borderStyle { diff --git a/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextField/TextFieldSizeConfiguration.swift b/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextField/TextFieldSizeConfiguration.swift index 4b1d307b0..702744c78 100644 --- a/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextField/TextFieldSizeConfiguration.swift +++ b/SDDSComponents/Sources/SDDSComponents/Components/SDDSTextField/TextFieldSizeConfiguration.swift @@ -22,8 +22,7 @@ public protocol TextFieldSizeConfiguration: CustomDebugStringConvertible { var textBeforeLeadingPadding: CGFloat { get } var textBeforeTrailingPadding: CGFloat { get } var textAfterLeadingPadding: CGFloat { get } - var textAfterTrailingPadding: CGFloat { get } - var textHorizontalPadding: CGFloat { get } + var textAfterTrailingPadding: CGFloat { get } func indicatorPadding(labelPlacement: TextFieldLabelPlacement, requiredPlacement: TextFieldRequiredPlacement, layout: TextFieldLayout) -> CGFloat func indicatorYOffset(labelPlacement: TextFieldLabelPlacement, requiredPlacement: TextFieldRequiredPlacement, layout: TextFieldLayout) -> CGFloat diff --git a/SDDSComponents/Sources/SDDSComponents/Views/SelectionControl/SelectionControl.swift b/SDDSComponents/Sources/SDDSComponents/Views/SelectionControl/SelectionControl.swift index 3ff8edd0b..3729724f0 100644 --- a/SDDSComponents/Sources/SDDSComponents/Views/SelectionControl/SelectionControl.swift +++ b/SDDSComponents/Sources/SDDSComponents/Views/SelectionControl/SelectionControl.swift @@ -19,6 +19,14 @@ public protocol SelectionControlSizeConfiguration: SizeConfiguration, CustomDebu var verticalGap: CGFloat { get } } +public struct ZeroSelectionControlSize: SelectionControlSizeConfiguration { + public var debugDescription: String { "ZeroSelectionControlSize "} + public var imageSize: CGSize { .zero } + public var horizontalGap: CGFloat { 0 } + public var verticalGap: CGFloat { 0 } + public init() {} +} + public struct SelectionControlStateImages { public let selectedImage: Image public let deselectedImage: Image @@ -62,7 +70,6 @@ struct SelectionControl: View { let title: String let subtitle: String? let isEnabled: Bool - let size: SelectionControlSizeConfiguration let appearance: AppearanceType let images: SelectionControlStateImages let accessibility: SelectionControlAccessibility @@ -70,8 +77,8 @@ struct SelectionControl: View { @Environment(\.colorScheme) var colorScheme var body: some View { - VStack(alignment: .leading, spacing: size.verticalGap) { - HStack(spacing: size.horizontalGap) { + VStack(alignment: .leading, spacing: appearance.size.verticalGap) { + HStack(spacing: appearance.size.horizontalGap) { controlView .accessibilityElement(children: .ignore) .accessibilityLabel(Text(accessibility.controlLabel)) @@ -85,8 +92,8 @@ struct SelectionControl: View { titleText } } - HStack(spacing: size.horizontalGap) { - Spacer().frame(width: size.imageSize.width) + HStack(spacing: appearance.size.horizontalGap) { + Spacer().frame(width: appearance.size.imageSize.width) if !title.isEmpty { subtitleText @@ -104,7 +111,7 @@ struct SelectionControl: View { @ViewBuilder private var titleText: some View { Text(title) - .typography(appearance.titleTypography.typography(with: size) ?? .undefined) + .typography(appearance.titleTypography.typography(with: appearance.size) ?? .undefined) .foregroundColor(appearance.titleColor(for: isEnabled).color(for: colorScheme)) .accessibilityLabel(Text(accessibility.titleLabel)) .accessibilityValue(Text(title)) @@ -114,7 +121,7 @@ struct SelectionControl: View { private var subtitleText: some View { if let subtitle = subtitle { Text(subtitle) - .typography(appearance.subtitleTypography.typography(with: size) ?? .undefined) + .typography(appearance.subtitleTypography.typography(with: appearance.size) ?? .undefined) .foregroundColor(appearance.subtitleColor(for: isEnabled).color(for: colorScheme)) .accessibilityLabel(Text(accessibility.subtitleLabel)) .accessibilityValue(Text(subtitle)) @@ -154,7 +161,7 @@ struct SelectionControl: View { private var controlView: some View { if let image = image { tintImage(image: image) - .frame(width: size.imageSize.width, height: size.imageSize.height) + .frame(width: appearance.size.imageSize.width, height: appearance.size.imageSize.height) .applyIf(!isEnabled) { $0.opacity(appearance.disabledAlpha) } } else { EmptyView() diff --git a/SDDSComponents/Sources/SDDSComponents/Views/SelectionControl/SelectionControlAppearance.swift b/SDDSComponents/Sources/SDDSComponents/Views/SelectionControl/SelectionControlAppearance.swift index de6233674..814f494ba 100644 --- a/SDDSComponents/Sources/SDDSComponents/Views/SelectionControl/SelectionControlAppearance.swift +++ b/SDDSComponents/Sources/SDDSComponents/Views/SelectionControl/SelectionControlAppearance.swift @@ -3,6 +3,7 @@ import SwiftUI @_exported import SDDSThemeCore public protocol SelectionControlAppearance { + var size: SelectionControlSizeConfiguration { get } var titleTypography: TypographyConfiguration { get } var subtitleTypography: TypographyConfiguration { get } var titleColor: ColorToken { get } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/AvatarGroupView/AvatarGroupViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/AvatarGroupView/AvatarGroupViewModel.swift index d39c01bd6..18e669b0c 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/AvatarGroupView/AvatarGroupViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/AvatarGroupView/AvatarGroupViewModel.swift @@ -25,8 +25,7 @@ final class AvatarGroupViewModel: ObservableObject { image: nil, placeholderImage: nil, status: .online, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, + appearance: SDDSAvatar.default.extraExtraLarge.appearance, accessibility: defaultAccessibility ), SDDSAvatarData( @@ -34,8 +33,7 @@ final class AvatarGroupViewModel: ObservableObject { image: .image(Image.image("checker")), placeholderImage: nil, status: .offline, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, + appearance: SDDSAvatar.default.extraExtraLarge.appearance, accessibility: defaultAccessibility ), SDDSAvatarData( @@ -43,8 +41,7 @@ final class AvatarGroupViewModel: ObservableObject { image: nil, placeholderImage: nil, status: .online, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, + appearance: SDDSAvatar.default.extraExtraLarge.appearance, accessibility: defaultAccessibility ), ] @@ -56,8 +53,7 @@ final class AvatarGroupViewModel: ObservableObject { image: nil, placeholderImage: nil, status: .hidden, - appearance: .default, - size: DefaultAvatarSize.extraExtraLarge, + appearance: SDDSAvatar.default.extraExtraLarge.appearance, accessibility: defaultAccessibility ) } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/AvatarView/AvatarView.swift b/SDDSDemoApp/SDDSDemoApp/Views/AvatarView/AvatarView.swift index e27110f25..0441eca65 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/AvatarView/AvatarView.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/AvatarView/AvatarView.swift @@ -3,6 +3,7 @@ import SDDSComponentsPreview import Combine import SDDSComponents import PhotosUI +import SDDSServTheme struct AvatarView: View { @ObservedObject private var viewModel: AvatarViewModel @@ -24,7 +25,6 @@ struct AvatarView: View { placeholderImage: viewModel.placeholderImage, status: viewModel.status, appearance: viewModel.appearance, - size: viewModel.size, accessibility: viewModel.accessibility ) Spacer() @@ -79,23 +79,20 @@ struct AvatarView: View { .buttonStyle(.borderless) .foregroundColor(.red) } - - HStack { - Text("Avatar Size") - Spacer() - Picker("Size", selection: $viewModel.size) { - ForEach(DefaultAvatarSize.allCases, id: \.self) { size in - Text(size.description).tag(size) + + Picker("Size", selection: $viewModel.size) { + ForEach(SDDSAvatarSize.allCases, id: \.self) { size in + Button(size.description) { + viewModel.size = size } } } - - HStack { - Text("Appearance") - Spacer() - Picker("Appearance", selection: $viewModel.appearance) { - ForEach(AvatarAppearance.allCases, id: \.self) { appearance in - Text(appearance.name).tag(appearance) + + Picker("Appearance", selection: $viewModel.appearance) { + ForEach(SDDSAvatar.all, id: \.self) { variation in + Button(variation.name) { + viewModel.appearance = variation.appearance.size(viewModel.size) + viewModel.variationName = variation.name } } } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/AvatarView/AvatarViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/AvatarView/AvatarViewModel.swift index e31a265ff..a5e40340d 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/AvatarView/AvatarViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/AvatarView/AvatarViewModel.swift @@ -2,27 +2,34 @@ import SwiftUI import Combine import SDDSComponents import SDDSComponentsPreview +import SDDSServTheme final class AvatarViewModel: ObservableObject { @Published var text: String = "AB" @Published var image: AvatarImageSource? = nil @Published var placeholderImage: AvatarImageSource? = nil @Published var status: AvatarStatus = .online - @Published var appearance: AvatarAppearance = .default - @Published var size: DefaultAvatarSize = .large + @Published var appearance: AvatarAppearance = SDDSAvatar.default.appearance + @Published var variationName: String = SDDSAvatar.default.name + @Published var size: SDDSAvatarSize = .medium @Published var accessibility: AvatarAccessibility = AvatarAccessibility() @Published var isPlaceholder = false + + private var cancellables: Set = [] - init() {} -} - -extension AvatarAppearance: CaseIterable { - public static var allCases: [AvatarAppearance] { - [.default] + init() { + observeSizeChange() } - - public var name: String { - return "Default" + + private func observeSizeChange() { + $size + .sink { [weak self] value in + guard let self = self else { + return + } + self.appearance = self.appearance.size(value) + } + .store(in: &cancellables) } } @@ -34,12 +41,12 @@ extension AvatarStatus: CaseIterable, Identifiable { } } -extension DefaultAvatarSize: CaseIterable, Hashable { - public static func == (lhs: DefaultAvatarSize, rhs: DefaultAvatarSize) -> Bool { +extension SDDSAvatarSize: CaseIterable, Hashable { + public static func == (lhs: SDDSAvatarSize, rhs: SDDSAvatarSize) -> Bool { lhs.hashValue == rhs.hashValue } - public static var allCases: [DefaultAvatarSize] { + public static var allCases: [SDDSAvatarSize] { [.extraExtraLarge, .large, .medium, .small] } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/CheckboxGroupView/CheckboxGroupViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/CheckboxGroupView/CheckboxGroupViewModel.swift index b20314de3..a9caf1102 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/CheckboxGroupView/CheckboxGroupViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/CheckboxGroupView/CheckboxGroupViewModel.swift @@ -2,6 +2,7 @@ import SwiftUI import Combine import SDDSComponents import SDDSComponentsPreview +import SDDSServTheme final class CheckboxGroupViewModel: ObservableObject { @Published var checkboxViewModels: [CheckboxItemViewModel] = [] @@ -63,8 +64,7 @@ struct CheckboxItemViewModel: Identifiable { subtitle: subtitle, isEnabled: isEnabled, images: CheckboxView.checkbox, - size: size, - appearance: .default, + appearance: SDDSCheckbox.default.appearance.size(size), accessibility: .init() ) } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/CheckboxView/CheckboxView.swift b/SDDSDemoApp/SDDSDemoApp/Views/CheckboxView/CheckboxView.swift index d8baea21f..c4fc94adb 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/CheckboxView/CheckboxView.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/CheckboxView/CheckboxView.swift @@ -1,4 +1,5 @@ import Foundation +import SDDSServTheme import SwiftUI import Combine import SDDSComponents @@ -21,7 +22,6 @@ struct CheckboxView: View { subtitle: viewModel.subtitle, isEnabled: viewModel.isEnabled, images: CheckboxView.checkbox, - size: viewModel.size, appearance: viewModel.appearance ) Spacer() @@ -61,54 +61,22 @@ struct CheckboxView: View { Toggle("Enabled", isOn: $viewModel.isEnabled) } - HStack { - Text("Tint Color") - Spacer() - Menu { - ForEach(ColorStyle.allCases, id: \.self) { style in - Button(style.rawValue) { - viewModel.tintColor = style - } - } - } label: { - HStack { - Rectangle() - .frame(width: 24, height: 24) - .foregroundColor(viewModel.tintColor.color) - - Text(viewModel.tintColor.rawValue) + Picker("Size", selection: $viewModel.size) { + ForEach(SDDSCheckboxSize.allCases, id: \.self) { size in + Button(size.description) { + viewModel.size = size } } } - HStack { - Text("Image Size") - Spacer() - VStack { - TextField("Width", value: $viewModel.imageWidth, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) - TextField("Height", value: $viewModel.imageHeight, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) + Picker("Appearance", selection: $viewModel.appearance) { + ForEach(SDDSCheckbox.all, id: \.self) { variation in + Button(variation.name) { + viewModel.appearance = variation.appearance.size(viewModel.size) + viewModel.variationName = variation.name + } } } - - HStack { - Text("Horizontal Gap") - Spacer() - TextField("Gap", value: $viewModel.horizontalGap, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) - } - - HStack { - Text("Vertical Gap") - Spacer() - TextField("Gap", value: $viewModel.verticalGap, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) - } } } .navigationTitle("SDDSCheckbox") diff --git a/SDDSDemoApp/SDDSDemoApp/Views/CheckboxView/CheckboxViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/CheckboxView/CheckboxViewModel.swift index 69943b676..4f43b67d4 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/CheckboxView/CheckboxViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/CheckboxView/CheckboxViewModel.swift @@ -3,6 +3,7 @@ import Combine import SwiftUI import SDDSComponents import SDDSComponentsPreview +import SDDSServTheme final class CheckboxViewModel: ObservableObject { // MARK: - Checkbox Properties @@ -10,88 +11,48 @@ final class CheckboxViewModel: ObservableObject { @Published var subtitle: String = "" @Published var state: SelectionControlState = .deselected @Published var isEnabled: Bool = true - @Published var size: SelectionControlSizeConfiguration = SDDSCheckboxSize.medium - @Published var appearance: CheckboxAppearance = CheckboxAppearance.default + @Published var size: SDDSCheckboxSize = SDDSCheckboxSize.medium + @Published var appearance: CheckboxAppearance = SDDSCheckbox.default.appearance + @Published var variationName: String = SDDSCheckbox.default.name // MARK: - Screen properties - @Published var tintColor: ColorStyle = .none - @Published var imageWidth: CGFloat = 20 - @Published var imageHeight: CGFloat = 20 - @Published var horizontalGap: CGFloat = 8 - @Published var verticalGap: CGFloat = 0 - private var cancellables: Set = [] init() { - observeColors() - observeSize() - } - - private func observeColors() { - $tintColor - .sink { [weak self] style in - self?.appearance = self?.appearance.withTintColor(style == .none ? nil : style.color.token) ?? .default - } - .store(in: &cancellables) + observeSizeChange() } - private func observeSize() { - Publishers.CombineLatest3($imageWidth, $imageHeight, $horizontalGap) - .combineLatest($verticalGap) - .sink { [weak self] (sizeValues, verticalGap) in - let (width, height, horizontalGap) = sizeValues - self?.size = CustomCheckboxSize( - imageSize: CGSize(width: width, height: height), - horizontalGap: horizontalGap, - verticalGap: verticalGap - ) + private func observeSizeChange() { + $size + .sink { [weak self] value in + guard let self = self else { + return + } + self.appearance = self.appearance.size(value) } .store(in: &cancellables) } } -// Custom Size Configuration -struct CustomCheckboxSize: SelectionControlSizeConfiguration { - var imageSize: CGSize - var horizontalGap: CGFloat - var verticalGap: CGFloat - - var debugDescription: String { - String(reflecting: self) +extension SDDSCheckboxSize: Hashable { + public static func == (lhs: SDDSCheckboxSize, rhs: SDDSCheckboxSize) -> Bool { + lhs.rawValue == rhs.rawValue } -} -// Extension for Appearance to update colors -extension CheckboxAppearance { - func withTintColor(_ color: ColorToken?) -> CheckboxAppearance { - .init( - titleTypography: titleTypography, - subtitleTypography: subtitleTypography, - titleColor: titleColor, - subtitleColor: subtitleColor, - disabledAlpha: disabledAlpha, - imageTintColor: color - ) + public static var allCases: [SDDSCheckboxSize] { + [.medium, .small] } -} -enum ColorStyle: String, CaseIterable { - case none, blue, green, red, gray, black - - var color: Color { + var description: String { switch self { - case .none: - return .clear - case .blue: - return .blue - case .green: - return .green - case .red: - return .red - case .gray: - return .gray - case .black: - return .black + case .medium: + return "Medium" + case .small: + return "Small" } } + + public func hash(into hasher: inout Hasher) { + hasher.combine(description) + } } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/ChipGroupView/ChipGroupView.swift b/SDDSDemoApp/SDDSDemoApp/Views/ChipGroupView/ChipGroupView.swift index cdc016dd9..818428589 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/ChipGroupView/ChipGroupView.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/ChipGroupView/ChipGroupView.swift @@ -2,6 +2,7 @@ import SwiftUI import SDDSComponentsPreview import Combine import SDDSComponents +import SDDSServTheme struct ChipGroupView: View { @ObservedObject private var viewModel: ChipGroupViewModel @@ -35,9 +36,20 @@ struct ChipGroupView: View { Text(size.debugDescription).tag(size.debugDescription) } } - Picker("Appearance", selection: $viewModel.appearance) { - ForEach(ChipAppearance.allCases, id: \.self) { appearance in - Text(appearance.name).tag(appearance) + + HStack { + Text("Appearance") + Spacer() + .frame(maxWidth: .infinity) + Menu { + ForEach(SDDSChip.all, id: \.self) { variation in + Button(variation.name) { + viewModel.appearance = variation.appearance.size(viewModel.chipSize) + viewModel.variationName = variation.name + } + } + } label: { + Text(viewModel.variationName.capitalized) } } } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/ChipGroupView/ChipGroupViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/ChipGroupView/ChipGroupViewModel.swift index 2cf4aa713..e317d2b8d 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/ChipGroupView/ChipGroupViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/ChipGroupView/ChipGroupViewModel.swift @@ -9,7 +9,12 @@ final class ChipGroupViewModel: ObservableObject { @Published var chipSize: SDDSChipSize = .medium(.pilled) @Published var chipGroupSize: DefaultChipGroupSize = .init(alignment: .left) @Published var chips: [ChipData] = [] - @Published var appearance: ChipAppearance = .default + @Published var appearance: ChipAppearance = SDDSChip.default.appearance { + didSet { + updateChips(appearance: appearance, size: chipSize) + } + } + @Published var variationName: String = SDDSChip.default.name private var cancellables: Set = [] @@ -32,8 +37,21 @@ final class ChipGroupViewModel: ObservableObject { isEnabled: chip.isEnabled, iconImage: chip.iconImage, buttonImage: chip.buttonImage, - appearance: chip.appearance, - size: size, + appearance: chip.appearance.size(size), + accessibility: chip.accessibility, + removeAction: chip.removeAction + ) + } + } + + private func updateChips(appearance: ChipAppearance, size: SDDSChipSize) { + chips = chips.map { chip in + ChipData( + title: chip.title, + isEnabled: chip.isEnabled, + iconImage: chip.iconImage, + buttonImage: chip.buttonImage, + appearance: appearance.size(size), accessibility: chip.accessibility, removeAction: chip.removeAction ) @@ -46,8 +64,7 @@ final class ChipGroupViewModel: ObservableObject { isEnabled: true, iconImage: Image.image("chipIcon"), buttonImage: Image.image("chipClose"), - appearance: .default, - size: chipSize, + appearance: appearance.size(chipSize), accessibility: ChipAccessibility(), removeAction: {} ) @@ -62,8 +79,7 @@ final class ChipGroupViewModel: ObservableObject { isEnabled: updatedChip.isEnabled, iconImage: updatedChip.iconImage, buttonImage: updatedChip.buttonImage, - appearance: updatedChip.appearance, - size: updatedChip.size, + appearance: updatedChip.appearance.size(updatedChip.appearance.size), accessibility: updatedChip.accessibility, removeAction: updatedChip.removeAction ) diff --git a/SDDSDemoApp/SDDSDemoApp/Views/ChipView/ChipView.swift b/SDDSDemoApp/SDDSDemoApp/Views/ChipView/ChipView.swift index 6fd79b842..8c5932094 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/ChipView/ChipView.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/ChipView/ChipView.swift @@ -21,7 +21,6 @@ struct ChipView: View { iconImage: viewModel.iconImage, buttonImage: viewModel.buttonImage, appearance: viewModel.appearance, - size: viewModel.size, removeAction: viewModel.removeAction ) } @@ -39,10 +38,19 @@ struct ChipView: View { Toggle("Enabled", isOn: $viewModel.isEnabled) Toggle("Icon Image", isOn: $viewModel.iconImageEnabled) Toggle("Button Image", isOn: $viewModel.buttomImageEnabled) - - Picker("Size", selection: $viewModel.size) { - ForEach(SDDSChipSize.allCases, id: \.self) { size in - Text(size.debugDescription).tag(size) + + HStack { + Text("Size") + Spacer() + .frame(maxWidth: .infinity) + Menu { + ForEach(SDDSChipSize.allCases, id: \.self) { size in + Button(size.debugDescription) { + viewModel.size = size + } + } + } label: { + Text(viewModel.size.debugDescription) } } @@ -50,10 +58,20 @@ struct ChipView: View { Text("Default").tag(ChipBorderStyle.default(viewModel.size.shapeToken.cornerRadius)) Text("Pilled").tag(ChipBorderStyle.pilled) } - - Picker("Appearance", selection: $viewModel.appearance) { - ForEach(ChipAppearance.allCases, id: \.self) { appearance in - Text(appearance.name).tag(appearance) + + HStack { + Text("Appearance") + Spacer() + .frame(maxWidth: .infinity) + Menu { + ForEach(SDDSChip.all, id: \.self) { variation in + Button(variation.name) { + viewModel.appearance = variation.appearance.size(viewModel.size) + viewModel.variationName = variation.name + } + } + } label: { + Text(viewModel.variationName.capitalized) } } } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/ChipView/ChipViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/ChipView/ChipViewModel.swift index 93c855122..e64f61415 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/ChipView/ChipViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/ChipView/ChipViewModel.swift @@ -11,13 +11,29 @@ final class ChipViewModel: ObservableObject { @Published var buttomImageEnabled: Bool = true @Published var size: SDDSChipSize = .medium(.default(8)) @Published var borderStyle: ChipBorderStyle = .default(8) - @Published var appearance: ChipAppearance = .default + @Published var appearance: ChipAppearance = SDDSChip.accent.appearance + @Published var variationName: String = SDDSChip.accent.name @Published var iconImage: Image? = nil @Published var buttonImage: Image? = nil + private var cancellables: Set = [] + init() { setIconImage() setButtonImage() + + observeSizeChange() + } + + private func observeSizeChange() { + $size + .sink { [weak self] value in + guard let self = self else { + return + } + self.appearance = self.appearance.size(value) + } + .store(in: &cancellables) } var removeAction: () -> Void { @@ -46,21 +62,9 @@ final class ChipViewModel: ObservableObject { } } -// MARK: - ChipAppearance Extensions - -extension ChipAppearance: CaseIterable { - public static var allCases: [ChipAppearance] { - [.default] - } - - public var name: String { - return "Default" - } -} - // MARK: - SDDSChipSize Extensions -extension SDDSChipSize: CaseIterable { +extension SDDSChipSize: Hashable, CaseIterable { public static var allCases: [SDDSChipSize] { [.large(.default(8)), .medium(.default(8)), .small(.default(8)), .extraSmall(.default(8))] } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/ProgressBarView/ProgressBarView.swift b/SDDSDemoApp/SDDSDemoApp/Views/ProgressBarView/ProgressBarView.swift index b7ee0dc2e..9e8b3a57d 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/ProgressBarView/ProgressBarView.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/ProgressBarView/ProgressBarView.swift @@ -18,8 +18,7 @@ struct ProgressBarView: View { SDDSProgressView( progress: $viewModel.progress, isEnabled: viewModel.isEnabled, - appearance: viewModel.appearance, - size: viewModel.size + appearance: viewModel.variation.appearance ) Spacer() } @@ -44,77 +43,11 @@ struct ProgressBarView: View { Toggle("Enabled", isOn: $viewModel.isEnabled) } - HStack { - Text("Tint Color") - Spacer() - Menu { - ForEach(ColorStyle.allCases, id: \.self) { style in - Button(style.rawValue) { - viewModel.tintColor = style - } - } - } label: { - HStack { - Rectangle() - .frame(width: 24, height: 24) - .foregroundColor(viewModel.tintColor.color) - - Text(viewModel.tintColor.rawValue) - } - } - } - - HStack { - Text("Track Color") - Spacer() - Menu { - ForEach(ColorStyle.allCases, id: \.self) { style in - Button(style.rawValue) { - viewModel.trackColor = style - } - } - } label: { - HStack { - Rectangle() - .frame(width: 24, height: 24) - .foregroundColor(viewModel.trackColor.color) - - Text(viewModel.trackColor.rawValue) - } + Picker("Appearance", selection: $viewModel.variation) { + ForEach(SDDSProgressView.all, id: \.appearance) { variation in + Text(variation.name).tag(variation) } } - - HStack { - Text("Height") - Spacer() - TextField("Height", value: $viewModel.height, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) - } - - HStack { - Text("Indicator Height") - Spacer() - TextField("Height", value: $viewModel.indicatorHeight, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) - } - - HStack { - Text("Corner Radius") - Spacer() - TextField("Radius", value: $viewModel.cornerRadius, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) - } - - HStack { - Text("Indicator Corner Radius") - Spacer() - TextField("Radius", value: $viewModel.indicatorCornerRadius, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) - } } } .navigationTitle("SDDSProgressView") diff --git a/SDDSDemoApp/SDDSDemoApp/Views/ProgressBarView/ProgressBarViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/ProgressBarView/ProgressBarViewModel.swift index a1cdcfd45..ebcc40dee 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/ProgressBarView/ProgressBarViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/ProgressBarView/ProgressBarViewModel.swift @@ -3,6 +3,7 @@ import Combine import SwiftUI import SDDSComponents import SDDSComponentsPreview +import SDDSServTheme final class ProgressBarViewModel: ObservableObject { // MARK: - Progress Bar Properties @@ -28,78 +29,10 @@ final class ProgressBarViewModel: ObservableObject { } } @Published var isEnabled: Bool = true - @Published var appearance: ProgressBarAppearance = .accent - @Published var size: ProgressBarSizeConfiguration = DefaultProgressBarSize() + @Published var variation: AppearanceVariation = SDDSProgressView.accent // MARK: - Screen properties - @Published var tintColor: ColorStyle = .green - @Published var trackColor: ColorStyle = .gray - @Published var height: CGFloat = 4.0 - @Published var indicatorHeight: CGFloat = 6.0 - @Published var cornerRadius: CGFloat = 2.0 - @Published var indicatorCornerRadius: CGFloat = 6.0 - private var cancellables: Set = [] private var isUpdatingProgress = false private var isUpdatingProgressString = false - - init() { - observeColors() - observeSize() - } - - private func observeColors() { - $tintColor - .sink { [weak self] style in - self?.appearance = self?.appearance.withTintColor(style.color.token) ?? .accent - } - .store(in: &cancellables) - - $trackColor - .sink { [weak self] style in - self?.appearance = self?.appearance.withTrackColor(style.color.token) ?? .accent - } - .store(in: &cancellables) - } - - private func observeSize() { - Publishers.CombineLatest4($height, $indicatorHeight, $cornerRadius, $indicatorCornerRadius) - .sink { [weak self] (height, indicatorHeight, cornerRadius, indicatorCornerRadius) in - self?.size = CustomProgressBarSize( - height: height, - indicatorHeight: indicatorHeight, - cornerRadius: cornerRadius, - indicatorCornerRadius: indicatorCornerRadius - ) - } - .store(in: &cancellables) - } -} - -// Custom Size Configuration -struct CustomProgressBarSize: ProgressBarSizeConfiguration { - var height: CGFloat - var indicatorHeight: CGFloat - var cornerRadius: CGFloat - var indicatorCornerRadius: CGFloat - - var debugDescription: String { - String(reflecting: self) - } -} - -extension ProgressBarAppearance { - func withTintColor(_ color: ColorToken) -> ProgressBarAppearance { - .init( - tintFillStyle: .color(color), - trackColor: trackColor - ) - } - - func withTrackColor(_ color: ColorToken) -> ProgressBarAppearance { - .init( - tintFillStyle: .color(color), - trackColor: color - ) - } } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/RadioboxGroupView/RadioboxGroupViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/RadioboxGroupView/RadioboxGroupViewModel.swift index c022c5f54..771c76a5f 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/RadioboxGroupView/RadioboxGroupViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/RadioboxGroupView/RadioboxGroupViewModel.swift @@ -2,6 +2,7 @@ import SwiftUI import Combine import SDDSComponents import SDDSComponentsPreview +import SDDSServTheme final class RadioboxGroupViewModel: ObservableObject { @Published var radioboxViewModels: [RadioboxItemViewModel] @@ -36,8 +37,7 @@ struct RadioboxItemViewModel { isSelected: .constant(isSelected), isEnabled: isEnabled, images: RadioboxView.radiobox, - size: size, - appearance: .default, + appearance: SDDSRadiobox.default.appearance.size(size), accessibility: .init() ) } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/RadioboxView/RadioboxView.swift b/SDDSDemoApp/SDDSDemoApp/Views/RadioboxView/RadioboxView.swift index 2383030da..2a6620e8c 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/RadioboxView/RadioboxView.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/RadioboxView/RadioboxView.swift @@ -2,6 +2,7 @@ import Foundation import SwiftUI import Combine import SDDSComponents +import SDDSServTheme struct RadioboxView: View { @ObservedObject private var viewModel: RadioboxViewModel @@ -21,7 +22,6 @@ struct RadioboxView: View { subtitle: viewModel.subtitle, isEnabled: viewModel.isEnabled, images: RadioboxView.radiobox, - size: viewModel.size, appearance: viewModel.appearance ) Spacer() @@ -53,54 +53,23 @@ struct RadioboxView: View { Toggle("Enabled", isOn: $viewModel.isEnabled) } - HStack { - Text("Tint Color") - Spacer() - Menu { - ForEach(ColorStyle.allCases, id: \.self) { style in - Button(style.rawValue) { - viewModel.tintColor = style - } - } - } label: { - HStack { - Rectangle() - .frame(width: 24, height: 24) - .foregroundColor(viewModel.tintColor.color) - - Text(viewModel.tintColor.rawValue) + Picker("Size", selection: $viewModel.size) { + ForEach(SDDSRadioboxSize.allCases, id: \.self) { size in + Button(size.description) { + viewModel.size = size } } } - HStack { - Text("Image Size") - Spacer() - VStack { - TextField("Width", value: $viewModel.imageWidth, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) - TextField("Height", value: $viewModel.imageHeight, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) + Picker("Appearance", selection: $viewModel.appearance) { + ForEach(SDDSRadiobox.all, id: \.self) { variation in + Button(variation.name) { + viewModel.appearance = variation.appearance.size(viewModel.size) + viewModel.variationName = variation.name + } } } - HStack { - Text("Horizontal Gap") - Spacer() - TextField("Gap", value: $viewModel.horizontalGap, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) - } - - HStack { - Text("Vertical Gap") - Spacer() - TextField("Gap", value: $viewModel.verticalGap, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) - } } } .navigationTitle("SDDSRadiobox") diff --git a/SDDSDemoApp/SDDSDemoApp/Views/RadioboxView/RadioboxViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/RadioboxView/RadioboxViewModel.swift index 54d359f54..ac1ee3522 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/RadioboxView/RadioboxViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/RadioboxView/RadioboxViewModel.swift @@ -3,72 +3,54 @@ import Combine import SwiftUI import SDDSComponents import SDDSComponentsPreview +import SDDSServTheme final class RadioboxViewModel: ObservableObject { @Published var title: String = "" @Published var subtitle: String = "" @Published var isSelected: Bool = false @Published var isEnabled: Bool = true - @Published var size: SelectionControlSizeConfiguration = SDDSRadioboxSize.medium - @Published var appearance: RadioboxAppearance = .default - - @Published var tintColor: ColorStyle = .none - @Published var imageWidth: CGFloat = 20 - @Published var imageHeight: CGFloat = 20 - @Published var horizontalGap: CGFloat = 8 - @Published var verticalGap: CGFloat = 0 + @Published var size: SDDSRadioboxSize = SDDSRadioboxSize.medium + @Published var appearance: RadioboxAppearance = SDDSRadiobox.default.appearance + @Published var variationName: String = SDDSRadiobox.default.name private var cancellables: Set = [] init() { - observeColors() - observeSize() - } - - private func observeColors() { - $tintColor - .sink { [weak self] style in - self?.appearance = self?.appearance.withTintColor(style == .none ? nil : style.color.token) ?? .default - } - .store(in: &cancellables) + observeSizeChange() } - private func observeSize() { - Publishers.CombineLatest3($imageWidth, $imageHeight, $horizontalGap) - .combineLatest($verticalGap) - .sink { [weak self] (sizeValues, verticalGap) in - let (width, height, horizontalGap) = sizeValues - self?.size = CustomRadioboxSize( - imageSize: CGSize(width: width, height: height), - horizontalGap: horizontalGap, - verticalGap: verticalGap - ) + private func observeSizeChange() { + $size + .sink { [weak self] value in + guard let self = self else { + return + } + self.appearance = self.appearance.size(value) } .store(in: &cancellables) } } -// Custom Size Configuration -struct CustomRadioboxSize: SelectionControlSizeConfiguration { - var imageSize: CGSize - var horizontalGap: CGFloat - var verticalGap: CGFloat - - var debugDescription: String { - String(reflecting: self) +extension SDDSRadioboxSize: Hashable { + public static func == (lhs: SDDSRadioboxSize, rhs: SDDSRadioboxSize) -> Bool { + lhs.rawValue == rhs.rawValue + } + + public static var allCases: [SDDSRadioboxSize] { + [.medium, .small] + } + + var description: String { + switch self { + case .medium: + return "Medium" + case .small: + return "Small" + } } -} -// Extension for Appearance to update colors -extension RadioboxAppearance { - func withTintColor(_ color: ColorToken?) -> RadioboxAppearance { - .init( - titleTypography: titleTypography, - subtitleTypography: subtitleTypography, - titleColor: titleColor, - subtitleColor: subtitleColor, - disabledAlpha: disabledAlpha, - imageTintColor: color - ) + public func hash(into hasher: inout Hasher) { + hasher.combine(description) } } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/SwitchView/SwitchView.swift b/SDDSDemoApp/SDDSDemoApp/Views/SwitchView/SwitchView.swift index 726f9d849..658a06626 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/SwitchView/SwitchView.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/SwitchView/SwitchView.swift @@ -2,6 +2,7 @@ import Foundation import SwiftUI import Combine import SDDSComponents +import SDDSServTheme struct SwitchView: View { @ObservedObject private var viewModel: SwitchViewModel @@ -20,7 +21,6 @@ struct SwitchView: View { subtitle: viewModel.subtitle, isOn: $viewModel.isOn, isEnabled: viewModel.isEnabled, - size: viewModel.size, appearance: viewModel.appearance, switchAccessibility: viewModel.switchAccessibility ) @@ -51,73 +51,22 @@ struct SwitchView: View { Toggle("On/Off", isOn: $viewModel.isOn) } - HStack { - Text("Tint Color") - Spacer() - Menu { - ForEach(ColorStyle.allCases, id: \.self) { style in - Button(style.rawValue) { - viewModel.tintColor = style - } - } - } label: { - HStack { - Rectangle() - .frame(width: 24, height: 24) - .foregroundColor(viewModel.tintColor.color) - - Text(viewModel.tintColor.rawValue) + Picker("Size", selection: $viewModel.size) { + ForEach(SDDSSwitchSize.allCases, id: \.self) { size in + Button(size.description) { + viewModel.size = size } } } - HStack { - Text("Title Color") - Spacer() - Menu { - ForEach(ColorStyle.allCases, id: \.self) { style in - Button(style.rawValue) { - viewModel.titleColor = style - } - } - } label: { - HStack { - Rectangle() - .frame(width: 24, height: 24) - .foregroundColor(viewModel.titleColor.color) - - Text(viewModel.titleColor.rawValue) + Picker("Appearance", selection: $viewModel.appearance) { + ForEach(SDDSSwitch.all, id: \.self) { variation in + Button(variation.name) { + viewModel.appearance = variation.appearance.size(viewModel.size) + viewModel.variationName = variation.name } } } - - HStack { - Text("Subtitle Color") - Spacer() - Menu { - ForEach(ColorStyle.allCases, id: \.self) { style in - Button(style.rawValue) { - viewModel.subtitleColor = style - } - } - } label: { - HStack { - Rectangle() - .frame(width: 24, height: 24) - .foregroundColor(viewModel.subtitleColor.color) - - Text(viewModel.subtitleColor.rawValue) - } - } - } - - HStack { - Text("Vertical Gap") - Spacer() - TextField("Gap", value: $viewModel.verticalGap, formatter: NumberFormatter()) - .keyboardType(.decimalPad) - .frame(maxWidth: 100) - } } } .navigationTitle("SDDSSwitch") diff --git a/SDDSDemoApp/SDDSDemoApp/Views/SwitchView/SwitchViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/SwitchView/SwitchViewModel.swift index 4eee86d9a..caf17707f 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/SwitchView/SwitchViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/SwitchView/SwitchViewModel.swift @@ -3,6 +3,7 @@ import Combine import SwiftUI import SDDSComponents import SDDSComponentsPreview +import SDDSServTheme final class SwitchViewModel: ObservableObject { // MARK: - Switch Properties @@ -10,99 +11,50 @@ final class SwitchViewModel: ObservableObject { @Published var subtitle: String = "Switch Subtitle" @Published var isOn: Bool = true @Published var isEnabled: Bool = true - @Published var size: SwitchSizeConfiguration = SwitchSize() - @Published var appearance: SwitchAppearance = .defaultAppearance + @Published var size: SDDSSwitchSize = .medium + @Published var appearance: SwitchAppearance = SDDSSwitch.default.appearance + @Published var variationName: String = SDDSSwitch.default.name @Published var switchAccessibility: SwitchAccessibility = SwitchAccessibility() - // MARK: - Screen properties - @Published var tintColor: ColorStyle = .green - @Published var titleColor: ColorStyle = .black - @Published var subtitleColor: ColorStyle = .gray - @Published var verticalGap: CGFloat = 0 - private var cancellables: Set = [] init() { - observeColors() - observeSize() + observeSizeChange() } - private func observeColors() { - $tintColor - .sink { [weak self] style in - self?.appearance = self?.appearance.withTintColor(style.color.token) ?? .defaultAppearance - } - .store(in: &cancellables) - - $titleColor - .sink { [weak self] style in - self?.appearance = self?.appearance.withTitleColor(style.color.token) ?? .defaultAppearance - } - .store(in: &cancellables) - - $subtitleColor - .sink { [weak self] style in - self?.appearance = self?.appearance.withSubtitleColor(style.color.token) ?? .defaultAppearance - } - .store(in: &cancellables) - } - - private func observeSize() { - $verticalGap - .sink { [weak self] gap in - self?.size = SwitchSize(verticalGap: gap) + private func observeSizeChange() { + $size + .sink { [weak self] value in + guard let self = self else { + return + } + self.appearance = self.appearance.size(value) } .store(in: &cancellables) } } -// Custom Size Configuration -struct SwitchSize: SwitchSizeConfiguration { - var debugDescription: String { - String(reflecting: self) +extension SDDSSwitchSize: Hashable, CaseIterable { + public static func == (lhs: SDDSSwitchSize, rhs: SDDSSwitchSize) -> Bool { + lhs.hashValue == rhs.hashValue } - var width: CGFloat? - var verticalGap: CGFloat - - init(width: CGFloat? = 170, verticalGap: CGFloat = 0) { - self.width = width - self.verticalGap = verticalGap + public static var allCases: [SDDSSwitchSize] { + [.large, .medium, .small] } -} -// Extension for Appearance to update colors -extension SwitchAppearance { - func withTintColor(_ color: ColorToken) -> SwitchAppearance { - .init( - titleTypography: titleTypography, - subtitleTypography: subtitleTypography, - titleColor: titleColor, - subtitleColor: subtitleColor, - tintColor: color, - disabledAlpha: disabledAlpha - ) + var description: String { + switch self { + case .large: + return "Large" + case .medium: + return "Medium" + case .small: + return "Small" + } } - - func withTitleColor(_ color: ColorToken) -> SwitchAppearance { - .init( - titleTypography: titleTypography, - subtitleTypography: subtitleTypography, - titleColor: color, - subtitleColor: subtitleColor, - tintColor: tintColor, - disabledAlpha: disabledAlpha - ) - } - - func withSubtitleColor(_ color: ColorToken) -> SwitchAppearance { - .init( - titleTypography: titleTypography, - subtitleTypography: subtitleTypography, - titleColor: titleColor, - subtitleColor: color, - tintColor: tintColor, - disabledAlpha: disabledAlpha - ) + + public func hash(into hasher: inout Hasher) { + hasher.combine(description) } } diff --git a/SDDSDemoApp/SDDSDemoApp/Views/TextAreaView/TextAreaViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/TextAreaView/TextAreaViewModel.swift index 703c66ec5..e71881c08 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/TextAreaView/TextAreaViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/TextAreaView/TextAreaViewModel.swift @@ -55,8 +55,7 @@ final class TextAreaViewModel: ObservableObject { isEnabled: true, iconImage: nil, buttonImage: Image.image("textFieldChipIcon"), - appearance: .textField, - size: chipSize, + appearance: .textField.size(chipSize), accessibility: ChipAccessibility(), removeAction: { [weak self] in self?.removeChip(with: id) @@ -73,8 +72,7 @@ final class TextAreaViewModel: ObservableObject { isEnabled: updatedChip.isEnabled, iconImage: updatedChip.iconImage, buttonImage: updatedChip.buttonImage, - appearance: updatedChip.appearance, - size: updatedChip.size, + appearance: updatedChip.appearance.size(updatedChip.appearance.size), accessibility: updatedChip.accessibility, removeAction: updatedChip.removeAction ) @@ -93,8 +91,7 @@ final class TextAreaViewModel: ObservableObject { isEnabled: chip.isEnabled, iconImage: chip.iconImage, buttonImage: chip.buttonImage, - appearance: chip.appearance, - size: chipSize, + appearance: chip.appearance.size(chipSize), accessibility: chip.accessibility, removeAction: chip.removeAction ) diff --git a/SDDSDemoApp/SDDSDemoApp/Views/TextFieldView/TextFieldViewModel.swift b/SDDSDemoApp/SDDSDemoApp/Views/TextFieldView/TextFieldViewModel.swift index 65c047298..ef622de64 100644 --- a/SDDSDemoApp/SDDSDemoApp/Views/TextFieldView/TextFieldViewModel.swift +++ b/SDDSDemoApp/SDDSDemoApp/Views/TextFieldView/TextFieldViewModel.swift @@ -54,8 +54,7 @@ final class TextFieldViewModel: ObservableObject { isEnabled: true, iconImage: nil, buttonImage: Image.image("textFieldChipIcon"), - appearance: .textField, - size: chipSize, + appearance: .textField.size(chipSize), accessibility: ChipAccessibility(), removeAction: {} ) @@ -70,8 +69,7 @@ final class TextFieldViewModel: ObservableObject { isEnabled: updatedChip.isEnabled, iconImage: updatedChip.iconImage, buttonImage: updatedChip.buttonImage, - appearance: updatedChip.appearance, - size: updatedChip.size, + appearance: updatedChip.appearance.size(updatedChip.appearance.size), accessibility: updatedChip.accessibility, removeAction: updatedChip.removeAction ) diff --git a/SDDSIcons/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/SDDSIcons/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..919434a62 --- /dev/null +++ b/SDDSIcons/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SDDSThemeBuilder/SDDSThemeBuilder.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/SDDSThemeBuilder/SDDSThemeBuilder.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 884d043b6..b8b285627 100644 --- a/SDDSThemeBuilder/SDDSThemeBuilder.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/SDDSThemeBuilder/SDDSThemeBuilder.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,50 +1,52 @@ { - "pins" : [ - { - "identity" : "ohhttpstubs", - "kind" : "remoteSourceControl", - "location" : "https://github.com/AliSoftware/OHHTTPStubs", - "state" : { - "revision" : "12f19662426d0434d6c330c6974d53e2eb10ecd9", - "version" : "9.1.0" + "object": { + "pins": [ + { + "package": "OHHTTPStubs", + "repositoryURL": "https://github.com/AliSoftware/OHHTTPStubs", + "state": { + "branch": null, + "revision": "12f19662426d0434d6c330c6974d53e2eb10ecd9", + "version": "9.1.0" + } + }, + { + "package": "PathKit", + "repositoryURL": "https://github.com/kylef/PathKit.git", + "state": { + "branch": null, + "revision": "3bfd2737b700b9a36565a8c94f4ad2b050a5e574", + "version": "1.0.1" + } + }, + { + "package": "Spectre", + "repositoryURL": "https://github.com/kylef/Spectre.git", + "state": { + "branch": null, + "revision": "26cc5e9ae0947092c7139ef7ba612e34646086c7", + "version": "0.10.1" + } + }, + { + "package": "Stencil", + "repositoryURL": "https://github.com/stencilproject/Stencil.git", + "state": { + "branch": null, + "revision": "4f222ac85d673f35df29962fc4c36ccfdaf9da5b", + "version": "0.15.1" + } + }, + { + "package": "swift-argument-parser", + "repositoryURL": "https://github.com/apple/swift-argument-parser.git", + "state": { + "branch": null, + "revision": "46989693916f56d1186bd59ac15124caef896560", + "version": "1.3.1" + } } - }, - { - "identity" : "pathkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/kylef/PathKit.git", - "state" : { - "revision" : "3bfd2737b700b9a36565a8c94f4ad2b050a5e574", - "version" : "1.0.1" - } - }, - { - "identity" : "spectre", - "kind" : "remoteSourceControl", - "location" : "https://github.com/kylef/Spectre.git", - "state" : { - "revision" : "26cc5e9ae0947092c7139ef7ba612e34646086c7", - "version" : "0.10.1" - } - }, - { - "identity" : "stencil", - "kind" : "remoteSourceControl", - "location" : "https://github.com/stencilproject/Stencil.git", - "state" : { - "revision" : "4f222ac85d673f35df29962fc4c36ccfdaf9da5b", - "version" : "0.15.1" - } - }, - { - "identity" : "swift-argument-parser", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-argument-parser.git", - "state" : { - "revision" : "46989693916f56d1186bd59ac15124caef896560", - "version" : "1.3.1" - } - } - ], - "version" : 2 + ] + }, + "version": 1 } diff --git a/SDDSThemeBuilder/SDDSThemeBuilderCore/Stencil/LinkButtonTypography.stencil b/SDDSThemeBuilder/SDDSThemeBuilderCore/Stencil/LinkButtonTypography.stencil index 3770dbf28..d7d740173 100644 --- a/SDDSThemeBuilder/SDDSThemeBuilderCore/Stencil/LinkButtonTypography.stencil +++ b/SDDSThemeBuilder/SDDSThemeBuilderCore/Stencil/LinkButtonTypography.stencil @@ -29,7 +29,7 @@ public struct LinkButtonTypography: GeneralTypographyConfiguration { - Returns: Типографика для заданного размера кнопки или nil, если не задана. */ public func typography(with size: ButtonSizeConfiguration) -> TypographyToken? { - switch size as? BasicButtonSize { + switch size as? LinkButtonSize { {%- for variation, config in variations.size %} case .{{ variation | sizeKey }}: return {{ variation | sizeKey }} {%- endfor %} diff --git a/Themes/SDDSButton/BasicButton+ColorVariations.swift b/Themes/SDDSButton/BasicButton+ColorVariations.swift new file mode 100644 index 000000000..83303c6bb --- /dev/null +++ b/Themes/SDDSButton/BasicButton+ColorVariations.swift @@ -0,0 +1,445 @@ +import Foundation +import SDDSComponents +import SDDSThemeCore + +public extension ButtonAppearanceVariation { + var accent: Self { + .init( + appearance: appearance.applyColorVariation(variation: BasicButton.accent.appearance) + ) + } + var black: Self { + .init( + appearance: appearance.applyColorVariation(variation: BasicButton.black.appearance) + ) + } + var clear: Self { + .init( + appearance: appearance.applyColorVariation(variation: BasicButton.clear.appearance) + ) + } + var dark: Self { + .init( + appearance: appearance.applyColorVariation(variation: BasicButton.dark.appearance) + ) + } + var `default`: Self { + .init( + appearance: appearance.applyColorVariation(variation: BasicButton.default.appearance) + ) + } + var negative: Self { + .init( + appearance: appearance.applyColorVariation(variation: BasicButton.negative.appearance) + ) + } + var positive: Self { + .init( + appearance: appearance.applyColorVariation(variation: BasicButton.positive.appearance) + ) + } + var secondary: Self { + .init( + appearance: appearance.applyColorVariation(variation: BasicButton.secondary.appearance) + ) + } + var warning: Self { + .init( + appearance: appearance.applyColorVariation(variation: BasicButton.warning.appearance) + ) + } + var white: Self { + .init( + appearance: appearance.applyColorVariation(variation: BasicButton.white.appearance) + ) + } +} + +public extension BasicButton { + static var accent: ButtonAppearanceVariation { + .init( + name: "accent", + appearance: ButtonAppearance( + titleTypography: BasicButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleTypography: BasicButton.subtitleTypography, + subtitleColor: ButtonColor( + defaultColor: .textOnDarkSecondary, + highlightedColor: .textOnDarkSecondaryActive, + hoveredColor: .textOnDarkSecondaryHover + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultAccent, + highlightedColor: .surfaceDefaultAccentActive, + hoveredColor: .surfaceDefaultAccentHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var black: ButtonAppearanceVariation { + .init( + name: "black", + appearance: ButtonAppearance( + titleTypography: BasicButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleTypography: BasicButton.subtitleTypography, + subtitleColor: ButtonColor( + defaultColor: .textOnDarkSecondary, + highlightedColor: .textOnDarkSecondaryActive, + hoveredColor: .textOnDarkSecondaryHover + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceOnLightSolidDefault, + highlightedColor: .surfaceOnLightSolidDefaultActive, + hoveredColor: .surfaceOnLightSolidDefaultHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var clear: ButtonAppearanceVariation { + .init( + name: "clear", + appearance: ButtonAppearance( + titleTypography: BasicButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + subtitleTypography: BasicButton.subtitleTypography, + subtitleColor: ButtonColor( + defaultColor: .textDefaultSecondary, + highlightedColor: .textDefaultSecondaryActive, + hoveredColor: .textDefaultSecondaryHover + ), + iconColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultClear, + highlightedColor: .surfaceDefaultClearActive, + hoveredColor: .surfaceDefaultClearHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0.06 + ) + ) + } + static var dark: ButtonAppearanceVariation { + .init( + name: "dark", + appearance: ButtonAppearance( + titleTypography: BasicButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleTypography: BasicButton.subtitleTypography, + subtitleColor: ButtonColor( + defaultColor: .textOnDarkSecondary, + highlightedColor: .textOnDarkSecondaryActive, + hoveredColor: .textOnDarkSecondaryHover + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceOnLightTransparentDeep, + highlightedColor: .surfaceOnLightTransparentDeepActive, + hoveredColor: .surfaceOnLightTransparentDeepHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var `default`: ButtonAppearanceVariation { + .init( + name: "default", + appearance: ButtonAppearance( + titleTypography: BasicButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textInversePrimary, + highlightedColor: .textInversePrimaryActive, + hoveredColor: .textInversePrimaryHover + ), + subtitleTypography: BasicButton.subtitleTypography, + subtitleColor: ButtonColor( + defaultColor: .textInverseSecondary, + highlightedColor: .textInverseSecondaryActive, + hoveredColor: .textInverseSecondaryHover + ), + iconColor: ButtonColor( + defaultColor: .textInversePrimary, + highlightedColor: .textInversePrimaryActive, + hoveredColor: .textInversePrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textInversePrimary, + highlightedColor: .textInversePrimaryActive, + hoveredColor: .textInversePrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultSolidDefault, + highlightedColor: .surfaceDefaultSolidDefaultActive, + hoveredColor: .surfaceDefaultSolidDefaultHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var negative: ButtonAppearanceVariation { + .init( + name: "negative", + appearance: ButtonAppearance( + titleTypography: BasicButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleTypography: BasicButton.subtitleTypography, + subtitleColor: ButtonColor( + defaultColor: .textOnDarkSecondary, + highlightedColor: .textOnDarkSecondaryActive, + hoveredColor: .textOnDarkSecondaryHover + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultNegative, + highlightedColor: .surfaceDefaultNegativeActive, + hoveredColor: .surfaceDefaultNegativeHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var positive: ButtonAppearanceVariation { + .init( + name: "positive", + appearance: ButtonAppearance( + titleTypography: BasicButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleTypography: BasicButton.subtitleTypography, + subtitleColor: ButtonColor( + defaultColor: .textOnDarkSecondary, + highlightedColor: .textOnDarkSecondaryActive, + hoveredColor: .textOnDarkSecondaryHover + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultPositive, + highlightedColor: .surfaceDefaultPositiveActive, + hoveredColor: .surfaceDefaultPositiveHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var secondary: ButtonAppearanceVariation { + .init( + name: "secondary", + appearance: ButtonAppearance( + titleTypography: BasicButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + subtitleTypography: BasicButton.subtitleTypography, + subtitleColor: ButtonColor( + defaultColor: .textDefaultSecondary, + highlightedColor: .textDefaultSecondaryActive, + hoveredColor: .textDefaultSecondaryHover + ), + iconColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultTransparentSecondary, + highlightedColor: .surfaceDefaultTransparentSecondaryActive, + hoveredColor: .surfaceDefaultTransparentSecondaryHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var warning: ButtonAppearanceVariation { + .init( + name: "warning", + appearance: ButtonAppearance( + titleTypography: BasicButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleTypography: BasicButton.subtitleTypography, + subtitleColor: ButtonColor( + defaultColor: .textOnDarkSecondary, + highlightedColor: .textOnDarkSecondaryActive, + hoveredColor: .textOnDarkSecondaryHover + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultWarning, + highlightedColor: .surfaceDefaultWarningActive, + hoveredColor: .surfaceDefaultWarningHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var white: ButtonAppearanceVariation { + .init( + name: "white", + appearance: ButtonAppearance( + titleTypography: BasicButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textOnLightPrimary, + highlightedColor: .textOnLightPrimaryActive, + hoveredColor: .textOnLightPrimaryHover + ), + subtitleTypography: BasicButton.subtitleTypography, + subtitleColor: ButtonColor( + defaultColor: .textOnLightSecondary, + highlightedColor: .textOnLightSecondaryActive, + hoveredColor: .textOnLightSecondaryHover + ), + iconColor: ButtonColor( + defaultColor: .textOnLightPrimary, + highlightedColor: .textOnLightPrimaryActive, + hoveredColor: .textOnLightPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnLightPrimary, + highlightedColor: .textOnLightPrimaryActive, + hoveredColor: .textOnLightPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceOnLightSolidDefault, + highlightedColor: .surfaceOnLightSolidDefaultActive, + hoveredColor: .surfaceOnLightSolidDefaultHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + + static var all: [ButtonAppearanceVariation] { + [ + + BasicButton.accent, + + BasicButton.black, + + BasicButton.clear, + + BasicButton.dark, + + BasicButton.`default`, + + BasicButton.negative, + + BasicButton.positive, + + BasicButton.secondary, + + BasicButton.warning, + + BasicButton.white + + ] + } +} diff --git a/Themes/SDDSButton/BasicButton+SizeVariations.swift b/Themes/SDDSButton/BasicButton+SizeVariations.swift new file mode 100644 index 000000000..6fbc4916d --- /dev/null +++ b/Themes/SDDSButton/BasicButton+SizeVariations.swift @@ -0,0 +1,54 @@ +import Foundation +import SDDSComponents +import SDDSThemeCore + +// MARK: - Size +public extension ButtonAppearanceVariation { + var large: Self { + .init( + appearance: appearance + .size(BasicButtonSize.large) + .titleTypography(BasicButton.titleTypography) + .subtitleTypography(BasicButton.subtitleTypography) + ) + } + var medium: Self { + .init( + appearance: appearance + .size(BasicButtonSize.medium) + .titleTypography(BasicButton.titleTypography) + .subtitleTypography(BasicButton.subtitleTypography) + ) + } + var small: Self { + .init( + appearance: appearance + .size(BasicButtonSize.small) + .titleTypography(BasicButton.titleTypography) + .subtitleTypography(BasicButton.subtitleTypography) + ) + } + var extraSmall: Self { + .init( + appearance: appearance + .size(BasicButtonSize.extraSmall) + .titleTypography(BasicButton.titleTypography) + .subtitleTypography(BasicButton.subtitleTypography) + ) + } +} + +public extension BasicButton { + static var large: ButtonAppearanceVariation { + return ButtonAppearanceVariation().large + } + static var medium: ButtonAppearanceVariation { + return ButtonAppearanceVariation().medium + } + static var small: ButtonAppearanceVariation { + return ButtonAppearanceVariation().small + } + static var extraSmall: ButtonAppearanceVariation { + return ButtonAppearanceVariation().extraSmall + } +} diff --git a/Themes/SDDSButton/BasicButton+Typography.swift b/Themes/SDDSButton/BasicButton+Typography.swift new file mode 100644 index 000000000..46befed22 --- /dev/null +++ b/Themes/SDDSButton/BasicButton+Typography.swift @@ -0,0 +1,27 @@ +import Foundation +import SDDSServTheme +import SDDSComponents +import SDDSThemeCore + +public extension BasicButton { + static var titleTypography: TypographyConfiguration { + BasicButtonTypography( + large: AdaptiveTypographyToken.bodyLBold.typography, + medium: AdaptiveTypographyToken.bodyMBold.typography, + small: AdaptiveTypographyToken.bodySBold.typography, + extraSmall: AdaptiveTypographyToken.bodyXsBold.typography, + extraExtraSmall: AdaptiveTypographyToken.bodyXsBold.typography + ) + .asContainer + } + static var subtitleTypography: TypographyConfiguration { + BasicButtonTypography( + large: AdaptiveTypographyToken.bodyLBold.typography, + medium: AdaptiveTypographyToken.bodyMBold.typography, + small: AdaptiveTypographyToken.bodySBold.typography, + extraSmall: AdaptiveTypographyToken.bodyXsBold.typography, + extraExtraSmall: AdaptiveTypographyToken.bodyXsBold.typography + ) + .asContainer + } +} diff --git a/Themes/SDDSButton/BasicButtonSize+ButtonSizeConfiguration.swift b/Themes/SDDSButton/BasicButtonSize+ButtonSizeConfiguration.swift new file mode 100644 index 000000000..bfe360e6e --- /dev/null +++ b/Themes/SDDSButton/BasicButtonSize+ButtonSizeConfiguration.swift @@ -0,0 +1,80 @@ +import Foundation +import SDDSComponents +import SwiftUI + +public enum BasicButtonSize: String, CaseIterable { + case large + case medium + case small + case extraSmall +} + +extension BasicButtonSize: ButtonSizeConfiguration { + + public var height: CGFloat { + switch self { + case .large: return 56 + case .medium: return 48 + case .small: return 40 + case .extraSmall: return 32 + } + } + + public var cornerRadius: CGFloat { + switch self { + case .large: return ShapeToken.roundL.cornerRadius - 2.0 + case .medium: return ShapeToken.roundM.cornerRadius + case .small: return ShapeToken.roundM.cornerRadius - 2.0 + case .extraSmall: return ShapeToken.roundS.cornerRadius + } + } + + public var paddings: EdgeInsets { + switch self { + case .large: return EdgeInsets(top: 0, leading: 24, bottom: 0, trailing: 24) + case .medium: return EdgeInsets(top: 0, leading: 20, bottom: 0, trailing: 20) + case .small: return EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16) + case .extraSmall: return EdgeInsets(top: 0, leading: 12, bottom: 0, trailing: 12) + } + } + + public var iconSize: CGSize { + switch self { + case .large: return CGSize(width: 24, height: 24) + case .medium: return CGSize(width: 24, height: 24) + case .small: return CGSize(width: 24, height: 24) + case .extraSmall: return CGSize(width: 16, height: 16) + } + } + + public var spinnerSize: CGSize { + switch self { + case .large: return CGSize(width: 22, height: 22) + case .medium: return CGSize(width: 22, height: 22) + case .small: return CGSize(width: 22, height: 22) + case .extraSmall: return CGSize(width: 16, height: 16) + } + } + + public var titleHorizontalGap: CGFloat { + switch self { + case .large: return 4 + case .medium: return 4 + case .small: return 4 + case .extraSmall: return 2 + } + } + + public var iconHorizontalGap: CGFloat { + switch self { + case .large: return 8 + case .medium: return 6 + case .small: return 4 + case .extraSmall: return 4 + } + } + + public var debugDescription: String { + return "BasicButtonSize" + } +} diff --git a/Themes/SDDSButton/BasicButtonTypography.swift b/Themes/SDDSButton/BasicButtonTypography.swift new file mode 100644 index 000000000..337b386da --- /dev/null +++ b/Themes/SDDSButton/BasicButtonTypography.swift @@ -0,0 +1,41 @@ +import Foundation +import SDDSComponents + +public struct BasicButtonTypography: GeneralTypographyConfiguration { + typealias S = ButtonSizeConfiguration + + let large: TypographyToken? + let medium: TypographyToken? + let small: TypographyToken? + let extraSmall: TypographyToken? + let extraExtraSmall: TypographyToken? + + init(large: TypographyToken?, medium: TypographyToken?, small: TypographyToken?, extraSmall: TypographyToken?, extraExtraSmall: TypographyToken?) { + self.large = large + self.medium = medium + self.small = small + self.extraSmall = extraSmall + self.extraExtraSmall = extraExtraSmall + } + + /** + Возвращает типографику для заданного размера кнопки. + + - Parameter size: Размер кнопки. + - Returns: Типографика для заданного размера кнопки или nil, если не задана. + */ + public func typography(with size: ButtonSizeConfiguration) -> TypographyToken? { + switch size as? BasicButtonSize { + case .large: + return large + case .medium: + return medium + case .small: + return small + case .extraSmall: + return extraSmall + case .none: + return medium + } + } +} diff --git a/Themes/SDDSButton/IconButton+ColorVariations.swift b/Themes/SDDSButton/IconButton+ColorVariations.swift new file mode 100644 index 000000000..bed453dee --- /dev/null +++ b/Themes/SDDSButton/IconButton+ColorVariations.swift @@ -0,0 +1,425 @@ +// MARK: - Colors +import Foundation +import SDDSComponents +import SDDSThemeCore + +public extension ButtonAppearanceVariation { + var accent: Self { + .init( + appearance: appearance.applyColorVariation(variation: IconButton.accent.appearance) + ) + } + var black: Self { + .init( + appearance: appearance.applyColorVariation(variation: IconButton.black.appearance) + ) + } + var clear: Self { + .init( + appearance: appearance.applyColorVariation(variation: IconButton.clear.appearance) + ) + } + var dark: Self { + .init( + appearance: appearance.applyColorVariation(variation: IconButton.dark.appearance) + ) + } + var `default`: Self { + .init( + appearance: appearance.applyColorVariation(variation: IconButton.`default`.appearance) + ) + } + var negative: Self { + .init( + appearance: appearance.applyColorVariation(variation: IconButton.negative.appearance) + ) + } + var positive: Self { + .init( + appearance: appearance.applyColorVariation(variation: IconButton.positive.appearance) + ) + } + var secondary: Self { + .init( + appearance: appearance.applyColorVariation(variation: IconButton.secondary.appearance) + ) + } + var warning: Self { + .init( + appearance: appearance.applyColorVariation(variation: IconButton.warning.appearance) + ) + } + var white: Self { + .init( + appearance: appearance.applyColorVariation(variation: IconButton.white.appearance) + ) + } +} + +public extension IconButton { + static var accent: ButtonAppearanceVariation { + .init( + name: "accent", + appearance: ButtonAppearance( + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultAccent, + highlightedColor: .surfaceDefaultAccentActive, + hoveredColor: .surfaceDefaultAccentHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var black: ButtonAppearanceVariation { + .init( + name: "black", + appearance: ButtonAppearance( + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceOnLightSolidDefault, + highlightedColor: .surfaceOnLightSolidDefaultActive, + hoveredColor: .surfaceOnLightSolidDefaultHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var clear: ButtonAppearanceVariation { + .init( + name: "clear", + appearance: ButtonAppearance( + titleColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultClear, + highlightedColor: .surfaceDefaultClearActive, + hoveredColor: .surfaceDefaultClearHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var dark: ButtonAppearanceVariation { + .init( + name: "dark", + appearance: ButtonAppearance( + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceOnLightTransparentDeep, + highlightedColor: .surfaceOnLightTransparentDeepActive, + hoveredColor: .surfaceOnLightTransparentDeepHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var `default`: ButtonAppearanceVariation { + .init( + name: "default", + appearance: ButtonAppearance( + titleColor: ButtonColor( + defaultColor: .textInversePrimary, + highlightedColor: .textInversePrimaryActive, + hoveredColor: .textInversePrimaryHover + ), + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textInversePrimary, + highlightedColor: .textInversePrimaryActive, + hoveredColor: .textInversePrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textInversePrimary, + highlightedColor: .textInversePrimaryActive, + hoveredColor: .textInversePrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultSolidDefault, + highlightedColor: .surfaceDefaultSolidDefaultActive, + hoveredColor: .surfaceDefaultSolidDefaultHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var negative: ButtonAppearanceVariation { + .init( + name: "negative", + appearance: ButtonAppearance( + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultNegative, + highlightedColor: .surfaceDefaultNegativeActive, + hoveredColor: .surfaceDefaultNegativeHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var positive: ButtonAppearanceVariation { + .init( + name: "positive", + appearance: ButtonAppearance( + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultPositive, + highlightedColor: .surfaceDefaultPositiveActive, + hoveredColor: .surfaceDefaultPositiveHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var secondary: ButtonAppearanceVariation { + .init( + name: "secondary", + appearance: ButtonAppearance( + titleColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultTransparentSecondary, + highlightedColor: .surfaceDefaultTransparentSecondaryActive, + hoveredColor: .surfaceDefaultTransparentSecondaryHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var warning: ButtonAppearanceVariation { + .init( + name: "warning", + appearance: ButtonAppearance( + titleColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnDarkPrimary, + highlightedColor: .textOnDarkPrimaryActive, + hoveredColor: .textOnDarkPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultWarning, + highlightedColor: .surfaceDefaultWarningActive, + hoveredColor: .surfaceDefaultWarningHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var white: ButtonAppearanceVariation { + .init( + name: "white", + appearance: ButtonAppearance( + titleColor: ButtonColor( + defaultColor: .textOnLightPrimary, + highlightedColor: .textOnLightPrimaryActive, + hoveredColor: .textOnLightPrimaryHover + ), + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textOnLightPrimary, + highlightedColor: .textOnLightPrimaryActive, + hoveredColor: .textOnLightPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textOnLightPrimary, + highlightedColor: .textOnLightPrimaryActive, + hoveredColor: .textOnLightPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceOnLightSolidDefault, + highlightedColor: .surfaceOnLightSolidDefaultActive, + hoveredColor: .surfaceOnLightSolidDefaultHover + ), + disabledAlpha: 0.4, + loadingAlpha: 0 + ) + ) + } + static var all: [ButtonAppearanceVariation] { + [ + + IconButton.accent, + + IconButton.black, + + IconButton.clear, + + IconButton.dark, + + IconButton.`default`, + + IconButton.negative, + + IconButton.positive, + + IconButton.secondary, + + IconButton.warning, + + IconButton.white + + ] + } +} diff --git a/Themes/SDDSButton/IconButton+SizeVariations.swift b/Themes/SDDSButton/IconButton+SizeVariations.swift new file mode 100644 index 000000000..e9faa3f6b --- /dev/null +++ b/Themes/SDDSButton/IconButton+SizeVariations.swift @@ -0,0 +1,46 @@ +import Foundation +import SDDSComponents +import SDDSThemeCore + +// MARK: - Size +public extension ButtonAppearanceVariation { + var large: Self { + .init( + appearance: appearance + .size(IconButtonSize.large) + ) + } + var medium: Self { + .init( + appearance: appearance + .size(IconButtonSize.medium) + ) + } + var small: Self { + .init( + appearance: appearance + .size(IconButtonSize.small) + ) + } + var extraSmall: Self { + .init( + appearance: appearance + .size(IconButtonSize.extraSmall) + ) + } +} + +public extension IconButton { + static var large: ButtonAppearanceVariation { + return ButtonAppearanceVariation().large + } + static var medium: ButtonAppearanceVariation { + return ButtonAppearanceVariation().medium + } + static var small: ButtonAppearanceVariation { + return ButtonAppearanceVariation().small + } + static var extraSmall: ButtonAppearanceVariation { + return ButtonAppearanceVariation().extraSmall + } +} diff --git a/Themes/SDDSButton/IconButtonSize+ButtonSizeConfiguration.swift b/Themes/SDDSButton/IconButtonSize+ButtonSizeConfiguration.swift new file mode 100644 index 000000000..3dc0b954f --- /dev/null +++ b/Themes/SDDSButton/IconButtonSize+ButtonSizeConfiguration.swift @@ -0,0 +1,80 @@ +import Foundation +import SDDSComponents +import SwiftUI + +public enum IconButtonSize: String, CaseIterable { + case large + case medium + case small + case extraSmall +} + +extension IconButtonSize: ButtonSizeConfiguration { + + public var height: CGFloat { + switch self { + case .large: return 56 + case .medium: return 48 + case .small: return 40 + case .extraSmall: return 32 + } + } + + public var cornerRadius: CGFloat { + switch self { + case .large: return ShapeToken.roundL.cornerRadius - 2.0 + case .medium: return ShapeToken.roundM.cornerRadius + case .small: return ShapeToken.roundM.cornerRadius - 2.0 + case .extraSmall: return ShapeToken.roundS.cornerRadius + } + } + + public var paddings: EdgeInsets { + switch self { + case .large: return EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16) + case .medium: return EdgeInsets(top: 0, leading: 12, bottom: 0, trailing: 12) + case .small: return EdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8) + case .extraSmall: return EdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8) + } + } + + public var iconSize: CGSize { + switch self { + case .large: return CGSize(width: 24, height: 24) + case .medium: return CGSize(width: 24, height: 24) + case .small: return CGSize(width: 24, height: 24) + case .extraSmall: return CGSize(width: 16, height: 16) + } + } + + public var spinnerSize: CGSize { + switch self { + case .large: return CGSize(width: 22, height: 22) + case .medium: return CGSize(width: 22, height: 22) + case .small: return CGSize(width: 22, height: 22) + case .extraSmall: return CGSize(width: 16, height: 16) + } + } + + public var titleHorizontalGap: CGFloat { + switch self { + case .large: return 0 + case .medium: return 0 + case .small: return 0 + case .extraSmall: return 0 + } + } + + public var iconHorizontalGap: CGFloat { + switch self { + case .large: return 0 + case .medium: return 0 + case .small: return 0 + case .extraSmall: return 0 + } + } + + public var debugDescription: String { + return "IconButtonSize" + } +} diff --git a/Themes/SDDSButton/LinkButton+ColorVariations.swift b/Themes/SDDSButton/LinkButton+ColorVariations.swift new file mode 100644 index 000000000..6c519d5be --- /dev/null +++ b/Themes/SDDSButton/LinkButton+ColorVariations.swift @@ -0,0 +1,272 @@ +import Foundation +import SDDSComponents +import SDDSThemeCore + +public extension ButtonAppearanceVariation { + var accent: Self { + .init( + appearance: appearance.applyColorVariation(variation: LinkButton.accent.appearance) + ) + } + var `default`: Self { + .init( + appearance: appearance.applyColorVariation(variation: LinkButton.`default`.appearance) + ) + } + var negative: Self { + .init( + appearance: appearance.applyColorVariation(variation: LinkButton.negative.appearance) + ) + } + var positive: Self { + .init( + appearance: appearance.applyColorVariation(variation: LinkButton.positive.appearance) + ) + } + var secondary: Self { + .init( + appearance: appearance.applyColorVariation(variation: LinkButton.secondary.appearance) + ) + } + var warning: Self { + .init( + appearance: appearance.applyColorVariation(variation: LinkButton.warning.appearance) + ) + } +} + +public extension LinkButton { + static var accent: ButtonAppearanceVariation { + .init( + name: "accent", + appearance: ButtonAppearance( + titleTypography: LinkButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textDefaultAccent, + highlightedColor: .textDefaultAccentActive, + hoveredColor: .textDefaultAccentHover + ), + subtitleTypography: .default, + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textDefaultAccent, + highlightedColor: .textDefaultAccentActive, + hoveredColor: .textDefaultAccentHover + ), + spinnerColor: ButtonColor( + defaultColor: .textDefaultAccent, + highlightedColor: .textDefaultAccentActive, + hoveredColor: .textDefaultAccentHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultClear, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + disabledAlpha: 0.4, + loadingAlpha: 0.06 + ) + ) + } + static var `default`: ButtonAppearanceVariation { + .init( + name: "default", + appearance: ButtonAppearance( + titleTypography: LinkButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + subtitleTypography: .default, + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textDefaultPrimary, + highlightedColor: .textDefaultPrimaryActive, + hoveredColor: .textDefaultPrimaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultClear, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + disabledAlpha: 0.4, + loadingAlpha: 0.06 + ) + ) + } + static var negative: ButtonAppearanceVariation { + .init( + name: "negative", + appearance: ButtonAppearance( + titleTypography: LinkButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textDefaultNegative, + highlightedColor: .textDefaultNegativeActive, + hoveredColor: .textDefaultNegativeHover + ), + subtitleTypography: .default, + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textDefaultNegative, + highlightedColor: .textDefaultNegativeActive, + hoveredColor: .textDefaultNegativeHover + ), + spinnerColor: ButtonColor( + defaultColor: .textDefaultNegative, + highlightedColor: .textDefaultNegativeActive, + hoveredColor: .textDefaultNegativeHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultClear, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + disabledAlpha: 0.4, + loadingAlpha: 0.06 + ) + ) + } + static var positive: ButtonAppearanceVariation { + .init( + name: "positive", + appearance: ButtonAppearance( + titleTypography: LinkButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textDefaultPositive, + highlightedColor: .textDefaultPositiveActive, + hoveredColor: .textDefaultPositiveHover + ), + subtitleTypography: .default, + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textDefaultPositive, + highlightedColor: .textDefaultPositiveActive, + hoveredColor: .textDefaultPositiveHover + ), + spinnerColor: ButtonColor( + defaultColor: .textDefaultPositive, + highlightedColor: .textDefaultPositiveActive, + hoveredColor: .textDefaultPositiveHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultClear, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + disabledAlpha: 0.4, + loadingAlpha: 0.06 + ) + ) + } + static var secondary: ButtonAppearanceVariation { + .init( + name: "secondary", + appearance: ButtonAppearance( + titleTypography: LinkButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textDefaultSecondary, + highlightedColor: .textDefaultSecondaryActive, + hoveredColor: .textDefaultSecondaryHover + ), + subtitleTypography: .default, + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textDefaultSecondary, + highlightedColor: .textDefaultSecondaryActive, + hoveredColor: .textDefaultSecondaryHover + ), + spinnerColor: ButtonColor( + defaultColor: .textDefaultSecondary, + highlightedColor: .textDefaultSecondaryActive, + hoveredColor: .textDefaultSecondaryHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultClear, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + disabledAlpha: 0.4, + loadingAlpha: 0.06 + ) + ) + } + static var warning: ButtonAppearanceVariation { + .init( + name: "warning", + appearance: ButtonAppearance( + titleTypography: LinkButton.titleTypography, + titleColor: ButtonColor( + defaultColor: .textDefaultWarning, + highlightedColor: .textDefaultWarningActive, + hoveredColor: .textDefaultWarningHover + ), + subtitleTypography: .default, + subtitleColor: ButtonColor( + defaultColor: .clearColor, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + iconColor: ButtonColor( + defaultColor: .textDefaultWarning, + highlightedColor: .textDefaultWarningActive, + hoveredColor: .textDefaultWarningHover + ), + spinnerColor: ButtonColor( + defaultColor: .textDefaultWarning, + highlightedColor: .textDefaultWarningActive, + hoveredColor: .textDefaultWarningHover + ), + backgroundColor: ButtonColor( + defaultColor: .surfaceDefaultClear, + highlightedColor: .clearColor, + hoveredColor: .clearColor + ), + disabledAlpha: 0.4, + loadingAlpha: 0.06 + ) + ) + } + static var all: [ButtonAppearanceVariation] { + [ + + LinkButton.accent, + + LinkButton.`default`, + + LinkButton.negative, + + LinkButton.positive, + + LinkButton.secondary, + + LinkButton.warning + + ] + } +} diff --git a/Themes/SDDSButton/LinkButton+SizeVariations.swift b/Themes/SDDSButton/LinkButton+SizeVariations.swift new file mode 100644 index 000000000..a8edfacb7 --- /dev/null +++ b/Themes/SDDSButton/LinkButton+SizeVariations.swift @@ -0,0 +1,50 @@ +import Foundation +import SDDSComponents +import SDDSThemeCore + +// MARK: - Size +public extension ButtonAppearanceVariation { + var large: Self { + .init( + appearance: appearance + .size(LinkButtonSize.large) + .titleTypography(LinkButton.titleTypography) + ) + } + var medium: Self { + .init( + appearance: appearance + .size(LinkButtonSize.medium) + .titleTypography(LinkButton.titleTypography) + ) + } + var small: Self { + .init( + appearance: appearance + .size(LinkButtonSize.small) + .titleTypography(LinkButton.titleTypography) + ) + } + var extraSmall: Self { + .init( + appearance: appearance + .size(LinkButtonSize.extraSmall) + .titleTypography(LinkButton.titleTypography) + ) + } +} + +public extension LinkButton { + static var large: ButtonAppearanceVariation { + return ButtonAppearanceVariation().large + } + static var medium: ButtonAppearanceVariation { + return ButtonAppearanceVariation().medium + } + static var small: ButtonAppearanceVariation { + return ButtonAppearanceVariation().small + } + static var extraSmall: ButtonAppearanceVariation { + return ButtonAppearanceVariation().extraSmall + } +} diff --git a/Themes/SDDSButton/LinkButton+Typography.swift b/Themes/SDDSButton/LinkButton+Typography.swift new file mode 100644 index 000000000..b24e3b07c --- /dev/null +++ b/Themes/SDDSButton/LinkButton+Typography.swift @@ -0,0 +1,17 @@ +import Foundation +import SDDSServTheme +import SDDSComponents +import SDDSThemeCore + +public extension LinkButton { + static var titleTypography: TypographyConfiguration { + LinkButtonTypography( + large: AdaptiveTypographyToken.bodyLBold.typography, + medium: AdaptiveTypographyToken.bodyMBold.typography, + small: AdaptiveTypographyToken.bodySBold.typography, + extraSmall: AdaptiveTypographyToken.bodyXsBold.typography, + extraExtraSmall: AdaptiveTypographyToken.bodyXsBold.typography + ) + .asContainer + } +} diff --git a/Themes/SDDSButton/LinkButtonSize+ButtonSizeConfiguration.swift b/Themes/SDDSButton/LinkButtonSize+ButtonSizeConfiguration.swift new file mode 100644 index 000000000..ea85dec20 --- /dev/null +++ b/Themes/SDDSButton/LinkButtonSize+ButtonSizeConfiguration.swift @@ -0,0 +1,75 @@ +import Foundation +import SDDSComponents +import SwiftUI + +public enum LinkButtonSize: String, CaseIterable { + case large + case medium + case small + case extraSmall +} + +extension LinkButtonSize: ButtonSizeConfiguration { + + public var height: CGFloat { + switch self { + case .large: return 56 + case .medium: return 48 + case .small: return 40 + case .extraSmall: return 32 + } + } + + public var cornerRadius: CGFloat { + 0 + } + + public var paddings: EdgeInsets { + switch self { + case .large: return EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0) + case .medium: return EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0) + case .small: return EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0) + case .extraSmall: return EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0) + } + } + + public var iconSize: CGSize { + switch self { + case .large: return CGSize(width: 24, height: 24) + case .medium: return CGSize(width: 24, height: 24) + case .small: return CGSize(width: 24, height: 24) + case .extraSmall: return CGSize(width: 16, height: 16) + } + } + + public var spinnerSize: CGSize { + switch self { + case .large: return CGSize(width: 22, height: 22) + case .medium: return CGSize(width: 22, height: 22) + case .small: return CGSize(width: 22, height: 22) + case .extraSmall: return CGSize(width: 16, height: 16) + } + } + + public var titleHorizontalGap: CGFloat { + switch self { + case .large: return 4 + case .medium: return 4 + case .small: return 4 + case .extraSmall: return 2 + } + } + + public var iconHorizontalGap: CGFloat { + switch self { + case .large: return 8 + case .medium: return 6 + case .small: return 4 + case .extraSmall: return 4 + } + } + + public var debugDescription: String { + return "LinkButtonSize" + } +} diff --git a/Themes/SDDSButton/LinkButtonTypography.swift b/Themes/SDDSButton/LinkButtonTypography.swift new file mode 100644 index 000000000..76a3aba18 --- /dev/null +++ b/Themes/SDDSButton/LinkButtonTypography.swift @@ -0,0 +1,41 @@ +import Foundation +import SDDSComponents + +public struct LinkButtonTypography: GeneralTypographyConfiguration { + typealias S = ButtonSizeConfiguration + + let large: TypographyToken? + let medium: TypographyToken? + let small: TypographyToken? + let extraSmall: TypographyToken? + let extraExtraSmall: TypographyToken? + + init(large: TypographyToken?, medium: TypographyToken?, small: TypographyToken?, extraSmall: TypographyToken?, extraExtraSmall: TypographyToken?) { + self.large = large + self.medium = medium + self.small = small + self.extraSmall = extraSmall + self.extraExtraSmall = extraExtraSmall + } + + /** + Возвращает типографику для заданного размера кнопки. + + - Parameter size: Размер кнопки. + - Returns: Типографика для заданного размера кнопки или nil, если не задана. + */ + public func typography(with size: ButtonSizeConfiguration) -> TypographyToken? { + switch size as? LinkButtonSize { + case .large: + return large + case .medium: + return medium + case .small: + return small + case .extraSmall: + return extraSmall + case .none: + return medium + } + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/AvatarTypography.swift b/Themes/SDDSservTheme/SDDSAvatar/AvatarTypography.swift similarity index 93% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/AvatarTypography.swift rename to Themes/SDDSservTheme/SDDSAvatar/AvatarTypography.swift index 66dfeed0d..329819d10 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/AvatarTypography.swift +++ b/Themes/SDDSservTheme/SDDSAvatar/AvatarTypography.swift @@ -10,7 +10,7 @@ struct AvatarTypography: GeneralTypographyConfiguration { let small: TypographyToken? func typography(with size: AvatarSizeConfiguration) -> TypographyToken? { - switch size as? DefaultAvatarSize { + switch size as? SDDSAvatarSize { case .extraExtraLarge: return extraExtraLarge case .large: @@ -20,7 +20,7 @@ struct AvatarTypography: GeneralTypographyConfiguration { case .small: return small case .scalable, .none: - return nil + return medium } } } diff --git a/Themes/SDDSservTheme/SDDSAvatar/SDDSAvatar+ColorVariations.swift b/Themes/SDDSservTheme/SDDSAvatar/SDDSAvatar+ColorVariations.swift new file mode 100644 index 000000000..8e3f09201 --- /dev/null +++ b/Themes/SDDSservTheme/SDDSAvatar/SDDSAvatar+ColorVariations.swift @@ -0,0 +1,34 @@ +import Foundation +import SDDSComponents +import SDDSServTheme + +public extension AppearanceVariation { + var `default`: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSAvatar.default.appearance) + ) + } +} + +public extension SDDSAvatar { + static var `default`: AppearanceVariation { + .init( + name: "default", + appearance: + .init( + textFillStyle: .gradient(Gradients.textDefaultAccentGradient), + backgroundFillStyle: .gradient(Gradients.surfaceDefaultAccentGradient), + backgroundOpacity: 0.2, + onlineStatusColor: Colors.textDefaultAccent, + offlineStatusColor: Colors.surfaceOnLightSolidTertiary, + textTypography: AvatarTypography.title + ) + ) + } + + static var all: [AppearanceVariation] { + [ + SDDSAvatar.default + ] + } +} diff --git a/Themes/SDDSservTheme/SDDSAvatar/SDDSAvatar+SizeVariations.swift b/Themes/SDDSservTheme/SDDSAvatar/SDDSAvatar+SizeVariations.swift new file mode 100644 index 000000000..5272244d6 --- /dev/null +++ b/Themes/SDDSservTheme/SDDSAvatar/SDDSAvatar+SizeVariations.swift @@ -0,0 +1,69 @@ +// MARK: - Size +import Foundation +import SDDSComponents +import SDDSThemeCore + +// MARK: - Size +public extension AppearanceVariation { + var extraExtraLarge: Self { + .init( + appearance: appearance + .size(SDDSAvatarSize.extraExtraLarge) + .textTypography(AvatarTypography.title) + ) + } + + var large: Self { + .init( + appearance: appearance + .size(SDDSAvatarSize.large) + .textTypography(AvatarTypography.title) + ) + } + + var medium: Self { + .init( + appearance: appearance + .size(SDDSAvatarSize.medium) + .textTypography(AvatarTypography.title) + ) + } + + var small: Self { + .init( + appearance: appearance + .size(SDDSAvatarSize.small) + .textTypography(AvatarTypography.title) + ) + } + + func scallable(height: CGFloat) -> Self { + .init( + appearance: appearance + .size(SDDSAvatarSize.scalable(height: height)) + .textTypography(AvatarTypography.title) + ) + } +} + +public extension SDDSAvatar { + static var extraExtraLarge: AppearanceVariation { + return AppearanceVariation(appearance: AvatarAppearance()).extraExtraLarge + } + + static var large: AppearanceVariation { + return AppearanceVariation(appearance: AvatarAppearance()).large + } + + static var medium: AppearanceVariation { + return AppearanceVariation(appearance: AvatarAppearance()).medium + } + + static var small: AppearanceVariation { + return AppearanceVariation(appearance: AvatarAppearance()).small + } + + static func scallable(height: CGFloat) -> AppearanceVariation { + return AppearanceVariation(appearance: AvatarAppearance()).scallable(height: height) + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/DefaultAvatarSize.swift b/Themes/SDDSservTheme/SDDSAvatar/SDDSAvatarSize.swift similarity index 96% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/DefaultAvatarSize.swift rename to Themes/SDDSservTheme/SDDSAvatar/SDDSAvatarSize.swift index 5e92d4862..00eba36d4 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSAvatar/DefaultAvatarSize.swift +++ b/Themes/SDDSservTheme/SDDSAvatar/SDDSAvatarSize.swift @@ -3,7 +3,7 @@ import SwiftUI import SDDSComponents import SDDSServTheme -public enum DefaultAvatarSize: AvatarSizeConfiguration { +public enum SDDSAvatarSize: AvatarSizeConfiguration { case extraExtraLarge case large case medium diff --git a/Themes/SDDSservTheme/SDDSButton/BasicButton+ColorVariations.swift b/Themes/SDDSservTheme/SDDSButton/BasicButton+ColorVariations.swift index 83303c6bb..05fe99fc9 100644 --- a/Themes/SDDSservTheme/SDDSButton/BasicButton+ColorVariations.swift +++ b/Themes/SDDSservTheme/SDDSButton/BasicButton+ColorVariations.swift @@ -1,3 +1,5 @@ +/* This file is code generated. */ + import Foundation import SDDSComponents import SDDSThemeCore diff --git a/Themes/SDDSservTheme/SDDSButton/BasicButton+SizeVariations.swift b/Themes/SDDSservTheme/SDDSButton/BasicButton+SizeVariations.swift index 6fbc4916d..468cc5c89 100644 --- a/Themes/SDDSservTheme/SDDSButton/BasicButton+SizeVariations.swift +++ b/Themes/SDDSservTheme/SDDSButton/BasicButton+SizeVariations.swift @@ -1,3 +1,5 @@ +/* This file is code generated. */ + import Foundation import SDDSComponents import SDDSThemeCore diff --git a/Themes/SDDSservTheme/SDDSButton/BasicButton+Typography.swift b/Themes/SDDSservTheme/SDDSButton/BasicButton+Typography.swift index 46befed22..ea694003b 100644 --- a/Themes/SDDSservTheme/SDDSButton/BasicButton+Typography.swift +++ b/Themes/SDDSservTheme/SDDSButton/BasicButton+Typography.swift @@ -1,5 +1,6 @@ +/* This file is code generated. */ + import Foundation -import SDDSServTheme import SDDSComponents import SDDSThemeCore @@ -9,8 +10,7 @@ public extension BasicButton { large: AdaptiveTypographyToken.bodyLBold.typography, medium: AdaptiveTypographyToken.bodyMBold.typography, small: AdaptiveTypographyToken.bodySBold.typography, - extraSmall: AdaptiveTypographyToken.bodyXsBold.typography, - extraExtraSmall: AdaptiveTypographyToken.bodyXsBold.typography + extraSmall: AdaptiveTypographyToken.bodyXsBold.typography ) .asContainer } @@ -19,8 +19,7 @@ public extension BasicButton { large: AdaptiveTypographyToken.bodyLBold.typography, medium: AdaptiveTypographyToken.bodyMBold.typography, small: AdaptiveTypographyToken.bodySBold.typography, - extraSmall: AdaptiveTypographyToken.bodyXsBold.typography, - extraExtraSmall: AdaptiveTypographyToken.bodyXsBold.typography + extraSmall: AdaptiveTypographyToken.bodyXsBold.typography ) .asContainer } diff --git a/Themes/SDDSservTheme/SDDSButton/BasicButtonSize+ButtonSizeConfiguration.swift b/Themes/SDDSservTheme/SDDSButton/BasicButtonSize+ButtonSizeConfiguration.swift index bfe360e6e..d02fa4bc4 100644 --- a/Themes/SDDSservTheme/SDDSButton/BasicButtonSize+ButtonSizeConfiguration.swift +++ b/Themes/SDDSservTheme/SDDSButton/BasicButtonSize+ButtonSizeConfiguration.swift @@ -1,3 +1,5 @@ +/* This file is code generated. */ + import Foundation import SDDSComponents import SwiftUI diff --git a/Themes/SDDSservTheme/SDDSButton/BasicButtonTypography.swift b/Themes/SDDSservTheme/SDDSButton/BasicButtonTypography.swift index 337b386da..3e9c95d25 100644 --- a/Themes/SDDSservTheme/SDDSButton/BasicButtonTypography.swift +++ b/Themes/SDDSservTheme/SDDSButton/BasicButtonTypography.swift @@ -1,23 +1,25 @@ +/* This file is code generated. */ + import Foundation import SDDSComponents public struct BasicButtonTypography: GeneralTypographyConfiguration { typealias S = ButtonSizeConfiguration - let large: TypographyToken? let medium: TypographyToken? let small: TypographyToken? let extraSmall: TypographyToken? - let extraExtraSmall: TypographyToken? - - init(large: TypographyToken?, medium: TypographyToken?, small: TypographyToken?, extraSmall: TypographyToken?, extraExtraSmall: TypographyToken?) { + init( + large: TypographyToken?, + medium: TypographyToken?, + small: TypographyToken?, + extraSmall: TypographyToken? + ) { self.large = large self.medium = medium self.small = small self.extraSmall = extraSmall - self.extraExtraSmall = extraExtraSmall } - /** Возвращает типографику для заданного размера кнопки. @@ -26,16 +28,12 @@ public struct BasicButtonTypography: GeneralTypographyConfiguration { */ public func typography(with size: ButtonSizeConfiguration) -> TypographyToken? { switch size as? BasicButtonSize { - case .large: - return large - case .medium: - return medium - case .small: - return small - case .extraSmall: - return extraSmall + case .large: return large + case .medium: return medium + case .small: return small + case .extraSmall: return extraSmall case .none: - return medium + return nil } } } diff --git a/Themes/SDDSservTheme/SDDSButton/IconButton+ColorVariations.swift b/Themes/SDDSservTheme/SDDSButton/IconButton+ColorVariations.swift index bed453dee..93f0047de 100644 --- a/Themes/SDDSservTheme/SDDSButton/IconButton+ColorVariations.swift +++ b/Themes/SDDSservTheme/SDDSButton/IconButton+ColorVariations.swift @@ -1,3 +1,5 @@ +/* This file is code generated. */ + // MARK: - Colors import Foundation import SDDSComponents diff --git a/Themes/SDDSservTheme/SDDSButton/IconButton+SizeVariations.swift b/Themes/SDDSservTheme/SDDSButton/IconButton+SizeVariations.swift index e9faa3f6b..9d6df4723 100644 --- a/Themes/SDDSservTheme/SDDSButton/IconButton+SizeVariations.swift +++ b/Themes/SDDSservTheme/SDDSButton/IconButton+SizeVariations.swift @@ -1,3 +1,5 @@ +/* This file is code generated. */ + import Foundation import SDDSComponents import SDDSThemeCore diff --git a/Themes/SDDSservTheme/SDDSButton/IconButtonSize+ButtonSizeConfiguration.swift b/Themes/SDDSservTheme/SDDSButton/IconButtonSize+ButtonSizeConfiguration.swift index 3dc0b954f..2ff196f20 100644 --- a/Themes/SDDSservTheme/SDDSButton/IconButtonSize+ButtonSizeConfiguration.swift +++ b/Themes/SDDSservTheme/SDDSButton/IconButtonSize+ButtonSizeConfiguration.swift @@ -1,3 +1,5 @@ +/* This file is code generated. */ + import Foundation import SDDSComponents import SwiftUI diff --git a/Themes/SDDSservTheme/SDDSButton/LinkButton+ColorVariations.swift b/Themes/SDDSservTheme/SDDSButton/LinkButton+ColorVariations.swift index 6c519d5be..b5eeb2678 100644 --- a/Themes/SDDSservTheme/SDDSButton/LinkButton+ColorVariations.swift +++ b/Themes/SDDSservTheme/SDDSButton/LinkButton+ColorVariations.swift @@ -1,3 +1,5 @@ +/* This file is code generated. */ + import Foundation import SDDSComponents import SDDSThemeCore diff --git a/Themes/SDDSservTheme/SDDSButton/LinkButton+SizeVariations.swift b/Themes/SDDSservTheme/SDDSButton/LinkButton+SizeVariations.swift index a8edfacb7..b5d423bc8 100644 --- a/Themes/SDDSservTheme/SDDSButton/LinkButton+SizeVariations.swift +++ b/Themes/SDDSservTheme/SDDSButton/LinkButton+SizeVariations.swift @@ -1,3 +1,5 @@ +/* This file is code generated. */ + import Foundation import SDDSComponents import SDDSThemeCore diff --git a/Themes/SDDSservTheme/SDDSButton/LinkButton+Typography.swift b/Themes/SDDSservTheme/SDDSButton/LinkButton+Typography.swift index b24e3b07c..54c6f1430 100644 --- a/Themes/SDDSservTheme/SDDSButton/LinkButton+Typography.swift +++ b/Themes/SDDSservTheme/SDDSButton/LinkButton+Typography.swift @@ -1,5 +1,6 @@ +/* This file is code generated. */ + import Foundation -import SDDSServTheme import SDDSComponents import SDDSThemeCore @@ -9,8 +10,7 @@ public extension LinkButton { large: AdaptiveTypographyToken.bodyLBold.typography, medium: AdaptiveTypographyToken.bodyMBold.typography, small: AdaptiveTypographyToken.bodySBold.typography, - extraSmall: AdaptiveTypographyToken.bodyXsBold.typography, - extraExtraSmall: AdaptiveTypographyToken.bodyXsBold.typography + extraSmall: AdaptiveTypographyToken.bodyXsBold.typography ) .asContainer } diff --git a/Themes/SDDSservTheme/SDDSButton/LinkButtonSize+ButtonSizeConfiguration.swift b/Themes/SDDSservTheme/SDDSButton/LinkButtonSize+ButtonSizeConfiguration.swift index ea85dec20..24244b1cc 100644 --- a/Themes/SDDSservTheme/SDDSButton/LinkButtonSize+ButtonSizeConfiguration.swift +++ b/Themes/SDDSservTheme/SDDSButton/LinkButtonSize+ButtonSizeConfiguration.swift @@ -1,3 +1,5 @@ +/* This file is code generated. */ + import Foundation import SDDSComponents import SwiftUI diff --git a/Themes/SDDSservTheme/SDDSButton/LinkButtonTypography.swift b/Themes/SDDSservTheme/SDDSButton/LinkButtonTypography.swift index 76a3aba18..7100f53a4 100644 --- a/Themes/SDDSservTheme/SDDSButton/LinkButtonTypography.swift +++ b/Themes/SDDSservTheme/SDDSButton/LinkButtonTypography.swift @@ -1,23 +1,25 @@ +/* This file is code generated. */ + import Foundation import SDDSComponents public struct LinkButtonTypography: GeneralTypographyConfiguration { typealias S = ButtonSizeConfiguration - let large: TypographyToken? let medium: TypographyToken? let small: TypographyToken? let extraSmall: TypographyToken? - let extraExtraSmall: TypographyToken? - - init(large: TypographyToken?, medium: TypographyToken?, small: TypographyToken?, extraSmall: TypographyToken?, extraExtraSmall: TypographyToken?) { + init( + large: TypographyToken?, + medium: TypographyToken?, + small: TypographyToken?, + extraSmall: TypographyToken? + ) { self.large = large self.medium = medium self.small = small self.extraSmall = extraSmall - self.extraExtraSmall = extraExtraSmall } - /** Возвращает типографику для заданного размера кнопки. @@ -26,16 +28,13 @@ public struct LinkButtonTypography: GeneralTypographyConfiguration { */ public func typography(with size: ButtonSizeConfiguration) -> TypographyToken? { switch size as? LinkButtonSize { - case .large: - return large - case .medium: - return medium - case .small: - return small - case .extraSmall: - return extraSmall + case .large: return large + case .medium: return medium + case .small: return small + case .extraSmall: return extraSmall case .none: - return medium + return nil } } } + diff --git a/Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+ColorVariations.swift b/Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+ColorVariations.swift new file mode 100644 index 000000000..0ff8d81d3 --- /dev/null +++ b/Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+ColorVariations.swift @@ -0,0 +1,33 @@ +import Foundation +import SDDSComponents +import SDDSServTheme + +public extension AppearanceVariation { + var `default`: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSCheckbox.default.appearance) + ) + } +} + +public extension SDDSCheckbox { + static var `default`: AppearanceVariation { + .init( + name: "default", + appearance: + .init( + titleTypography: CheckboxTypography.label, + subtitleTypography: CheckboxTypography.description, + titleColor: .backgroundInversePrimary, + subtitleColor: .surfaceInverseSolidPrimary.withOpacity(0.56), + disabledAlpha: 0.4 + ) + ) + } + + static var all: [AppearanceVariation] { + [ + SDDSCheckbox.default + ] + } +} diff --git a/Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+SizeVariations.swift b/Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+SizeVariations.swift new file mode 100644 index 000000000..237d6afdc --- /dev/null +++ b/Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+SizeVariations.swift @@ -0,0 +1,34 @@ +import Foundation +import SDDSComponents +import SDDSThemeCore + +// MARK: - Size +public extension AppearanceVariation { + var medium: Self { + .init( + appearance: appearance + .size(SDDSCheckbox.medium.appearance.size) + .titleTypography(CheckboxTypography.label) + .subtitleTypography(CheckboxTypography.description) + ) + } + + var small: Self { + .init( + appearance: appearance + .size(SDDSCheckbox.small.appearance.size) + .titleTypography(CheckboxTypography.label) + .subtitleTypography(CheckboxTypography.description) + ) + } +} + +public extension SDDSCheckbox { + static var medium: AppearanceVariation { + return AppearanceVariation(appearance: CheckboxAppearance()).medium + } + + static var small: AppearanceVariation { + return AppearanceVariation(appearance: CheckboxAppearance()).small + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/CheckboxTypography.swift b/Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+Typography.swift similarity index 91% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/CheckboxTypography.swift rename to Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+Typography.swift index fe61c9fd9..a94691aa0 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/CheckboxTypography.swift +++ b/Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckbox+Typography.swift @@ -14,7 +14,7 @@ struct CheckboxTypography: GeneralTypographyConfiguration { } func typography(with size: SelectionControlSizeConfiguration) -> TypographyToken? { - switch size as? SDDSRadioboxSize { + switch size as? SDDSCheckboxSize { case .medium: return medium case .small, .none: @@ -25,14 +25,14 @@ struct CheckboxTypography: GeneralTypographyConfiguration { extension CheckboxTypography { static var label: TypographyConfiguration { - RadioboxTypography( + CheckboxTypography( medium: Typographies.bodyMNormal.typography, small: Typographies.bodySNormal.typography ).asContainer } static var description: TypographyConfiguration { - RadioboxTypography( + CheckboxTypography( medium: Typographies.bodyMNormal.typography, small: Typographies.bodyXsNormal.typography ).asContainer diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/SDDSCheckboxSize.swift b/Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckboxSize.swift similarity index 95% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/SDDSCheckboxSize.swift rename to Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckboxSize.swift index 9e2ed26b5..21d297471 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSCheckbox/SDDSCheckboxSize.swift +++ b/Themes/SDDSservTheme/SDDSCheckbox/SDDSCheckboxSize.swift @@ -7,7 +7,7 @@ public enum SDDSCheckboxSize: String, SelectionControlSizeConfiguration, CaseIte case small public var debugDescription: String { - String(reflecting: self) + rawValue } public var imageSize: CGSize { diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/ChipAppearance+Extensions.swift b/Themes/SDDSservTheme/SDDSChip/ChipTypography.swift similarity index 68% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/ChipAppearance+Extensions.swift rename to Themes/SDDSservTheme/SDDSChip/ChipTypography.swift index 11d0faab4..328720ba7 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/ChipAppearance+Extensions.swift +++ b/Themes/SDDSservTheme/SDDSChip/ChipTypography.swift @@ -1,21 +1,6 @@ import Foundation -import SwiftUI -import SDDSServTheme import SDDSComponents -import SDDSThemeCore - -public extension ChipAppearance { - static var `default`: ChipAppearance { - .init( - titleColor: ColorToken.textInversePrimary, - titleTypography: ChipTypography.title, - imageTintColor: ColorToken.textInversePrimary, - buttonTintColor: ColorToken.textInversePrimary, - backgroundColor: ColorToken.backgroundInversePrimary, - disabledAlpha: 0.5 - ) - } -} +import SDDSServTheme public struct ChipTypography: GeneralTypographyConfiguration { public let large: TypographyToken? diff --git a/Themes/SDDSservTheme/SDDSChip/SDDSChip+ColorVariations.swift b/Themes/SDDSservTheme/SDDSChip/SDDSChip+ColorVariations.swift new file mode 100644 index 000000000..86840ab84 --- /dev/null +++ b/Themes/SDDSservTheme/SDDSChip/SDDSChip+ColorVariations.swift @@ -0,0 +1,140 @@ +import Foundation +import SDDSComponents +import SDDSServTheme + +public extension AppearanceVariation { + var accent: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSChip.accent.appearance) + ) + } + var `default`: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSChip.default.appearance) + ) + } + var negative: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSChip.negative.appearance) + ) + } + var positive: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSChip.positive.appearance) + ) + } + var secondary: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSChip.secondary.appearance) + ) + } + var warning: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSChip.warning.appearance) + ) + } +} + +public extension SDDSChip { + static var accent: AppearanceVariation { + .init( + name: "accent", + appearance: .init( + titleColor: ColorToken.textOnDarkPrimary, + titleTypography: ChipTypography.title, + imageTintColor: ColorToken.textOnDarkPrimary, + buttonTintColor: ColorToken.textOnDarkPrimary, + backgroundColor: ColorToken.surfaceDefaultAccent, + disabledAlpha: 0.4 + ) + ) + } + + static var `default`: AppearanceVariation { + .init( + name: "default", + appearance: .init( + titleColor: ColorToken.textInversePrimary, + titleTypography: ChipTypography.title, + imageTintColor: ColorToken.textInversePrimary, + buttonTintColor: ColorToken.textInversePrimary, + backgroundColor: ColorToken.surfaceDefaultSolidDefault, + disabledAlpha: 0.4 + ) + ) + } + + static var negative: AppearanceVariation { + .init( + name: "negative", + appearance: .init( + titleColor: ColorToken.textOnDarkPrimary, + titleTypography: ChipTypography.title, + imageTintColor: ColorToken.textOnDarkPrimary, + buttonTintColor: ColorToken.textOnDarkPrimary, + backgroundColor: ColorToken.surfaceDefaultNegative, + disabledAlpha: 0.4 + ) + ) + } + + static var positive: AppearanceVariation { + .init( + name: "positive", + appearance: .init( + titleColor: ColorToken.textOnDarkPrimary, + titleTypography: ChipTypography.title, + imageTintColor: ColorToken.textOnDarkPrimary, + buttonTintColor: ColorToken.textOnDarkPrimary, + backgroundColor: ColorToken.surfaceDefaultPositive, + disabledAlpha: 0.4 + ) + ) + } + + static var secondary: AppearanceVariation { + .init( + name: "secondary", + appearance: .init( + titleColor: ColorToken.textDefaultPrimary, + titleTypography: ChipTypography.title, + imageTintColor: ColorToken.textDefaultPrimary, + buttonTintColor: ColorToken.textDefaultPrimary, + backgroundColor: ColorToken.surfaceDefaultTransparentSecondary, + disabledAlpha: 0.4 + ) + ) + } + + static var warning: AppearanceVariation { + .init( + name: "warning", + appearance: .init( + titleColor: ColorToken.textOnDarkPrimary, + titleTypography: ChipTypography.title, + imageTintColor: ColorToken.textOnDarkPrimary, + buttonTintColor: ColorToken.textOnDarkPrimary, + backgroundColor: ColorToken.surfaceDefaultWarning, + disabledAlpha: 0.4 + ) + ) + } + + static var all: [AppearanceVariation] { + [ + + SDDSChip.accent, + + SDDSChip.`default`, + + SDDSChip.negative, + + SDDSChip.positive, + + SDDSChip.secondary, + + SDDSChip.warning + + ] + } +} diff --git a/Themes/SDDSservTheme/SDDSChip/SDDSChip+Pilled.swift b/Themes/SDDSservTheme/SDDSChip/SDDSChip+Pilled.swift new file mode 100644 index 000000000..f8bcc93e4 --- /dev/null +++ b/Themes/SDDSservTheme/SDDSChip/SDDSChip+Pilled.swift @@ -0,0 +1,19 @@ +import Foundation +import SDDSComponents +import SDDSServTheme + +public extension AppearanceVariation { + var pilled: Self { + .init( + appearance: .init( + size: (appearance.size as? SDDSChipSize)?.pilled ?? .extraSmall(.pilled), + titleColor: appearance.titleColor, + titleTypography: appearance.titleTypography, + imageTintColor: appearance.imageTintColor, + buttonTintColor: appearance.buttonTintColor, + backgroundColor: appearance.backgroundColor, + disabledAlpha: appearance.disabledAlpha + ) + ) + } +} diff --git a/Themes/SDDSservTheme/SDDSChip/SDDSChip+SizeVariations.swift b/Themes/SDDSservTheme/SDDSChip/SDDSChip+SizeVariations.swift new file mode 100644 index 000000000..703f7a557 --- /dev/null +++ b/Themes/SDDSservTheme/SDDSChip/SDDSChip+SizeVariations.swift @@ -0,0 +1,59 @@ +// MARK: - Size +import Foundation +import SDDSComponents +import SDDSThemeCore + +// MARK: - Size +public extension AppearanceVariation { + var large: Self { + .init( + appearance: appearance + .size(SDDSChipSize.large(.default(12))) + .titleTypography(AvatarTypography.title) + ) + } + + var medium: Self { + .init( + appearance: appearance + .size(SDDSChipSize.medium(.default(10))) + .titleTypography(AvatarTypography.title) + ) + } + + var small: Self { + .init( + appearance: appearance + .size(SDDSChipSize.small(.default(8))) + .titleTypography(AvatarTypography.title) + ) + } + + var extraSmall: Self { + .init( + appearance: appearance + .size(SDDSChipSize.extraSmall(.default(6))) + .titleTypography(AvatarTypography.title) + ) + } +} + +public extension SDDSChip { + static var large: AppearanceVariation { + return AppearanceVariation(appearance: ChipAppearance()).large + } + + static var medium: AppearanceVariation { + return AppearanceVariation(appearance: ChipAppearance()).medium + } + + static var small: AppearanceVariation { + return AppearanceVariation(appearance: ChipAppearance()).small + } + + static var extraSmall: AppearanceVariation { + return AppearanceVariation(appearance: ChipAppearance()).extraSmall + } +} + + diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/SDDSChipSize.swift b/Themes/SDDSservTheme/SDDSChip/SDDSChipSize.swift similarity index 88% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/SDDSChipSize.swift rename to Themes/SDDSservTheme/SDDSChip/SDDSChipSize.swift index d26b1be1e..50837c2ae 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSChip/SDDSChipSize.swift +++ b/Themes/SDDSservTheme/SDDSChip/SDDSChipSize.swift @@ -110,12 +110,24 @@ public enum SDDSChipSize: ChipSizeConfiguration { return style } } - + + public var pilled: SDDSChipSize { + switch self { + case .large: + return .large(.pilled) + case .medium: + return .medium(.pilled) + case .small: + return .small(.pilled) + case .extraSmall: + return .extraSmall(.pilled) + } + } } extension SDDSChipSize: Hashable { public static func == (lhs: SDDSChipSize, rhs: SDDSChipSize) -> Bool { - return lhs.hashValue == rhs.hashValue + return lhs.debugDescription == rhs.debugDescription } public func hash(into hasher: inout Hasher) { diff --git a/Themes/SDDSservTheme/SDDSProgressBar/SDDSProgressView+ColorVariations.swift b/Themes/SDDSservTheme/SDDSProgressBar/SDDSProgressView+ColorVariations.swift new file mode 100644 index 000000000..edcb05326 --- /dev/null +++ b/Themes/SDDSservTheme/SDDSProgressBar/SDDSProgressView+ColorVariations.swift @@ -0,0 +1,164 @@ +import Foundation +import SDDSComponents +import SDDSServTheme + +public extension AppearanceVariation { + var `default`: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSProgressView.default.appearance) + ) + } + + var secondary: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSProgressView.secondary.appearance) + ) + } + + var accent: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSProgressView.accent.appearance) + ) + } + + var gradientAccent: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSProgressView.gradientAccent.appearance) + ) + } + + var positive: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSProgressView.positive.appearance) + ) + } + + var warning: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSProgressView.warning.appearance) + ) + } + + var negative: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSProgressView.negative.appearance) + ) + } + + var info: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSProgressView.info.appearance) + ) + } +} + +public extension SDDSProgressView { + static var `default`: AppearanceVariation { + .init( + name: "default", + appearance: + .init( + size: SDDSProgressViewSize(), + tintFillStyle: .color(ColorToken.surfaceDefaultSolidPrimary), + trackColor: ColorToken.surfaceDefaultTransparentSecondary + ) + ) + } + + static var secondary: AppearanceVariation { + .init( + name: "secondary", + appearance: + .init( + size: SDDSProgressViewSize(), + tintFillStyle: .color(ColorToken.surfaceDefaultSolidSecondary), + trackColor: ColorToken.surfaceDefaultTransparentSecondary + ) + ) + } + + static var accent: AppearanceVariation { + .init( + name: "accent", + appearance: + .init( + size: SDDSProgressViewSize(), + tintFillStyle: .color(ColorToken.surfaceDefaultAccent), + trackColor: ColorToken.surfaceDefaultTransparentSecondary + ) + ) + } + + static var gradientAccent: AppearanceVariation { + .init( + name: "gradientAccent", + appearance: + .init( + size: SDDSProgressViewSize(), + tintFillStyle: .gradient(GradientToken.surfaceDefaultAccentGradient), + trackColor: ColorToken.surfaceDefaultTransparentSecondary + ) + ) + } + + static var positive: AppearanceVariation { + .init( + name: "positive", + appearance: + .init( + size: SDDSProgressViewSize(), + tintFillStyle: .color(ColorToken.surfaceDefaultPositive), + trackColor: ColorToken.surfaceDefaultTransparentSecondary + ) + ) + } + + static var warning: AppearanceVariation { + .init( + name: "warning", + appearance: + .init( + size: SDDSProgressViewSize(), + tintFillStyle: .color(ColorToken.surfaceDefaultWarning), + trackColor: ColorToken.surfaceDefaultTransparentSecondary + ) + ) + } + + static var negative: AppearanceVariation { + .init( + name: "negative", + appearance: + .init( + size: SDDSProgressViewSize(), + tintFillStyle: .color(ColorToken.surfaceDefaultNegative), + trackColor: ColorToken.surfaceDefaultTransparentSecondary + ) + ) + } + + static var info: AppearanceVariation { + .init( + name: "info", + appearance: + .init( + size: SDDSProgressViewSize(), + tintFillStyle: .color(ColorToken.surfaceDefaultInfo), + trackColor: ColorToken.surfaceDefaultTransparentSecondary + ) + ) + } + + static var all: [AppearanceVariation] { + [ + SDDSProgressView.default, + SDDSProgressView.accent, + SDDSProgressView.secondary, + SDDSProgressView.gradientAccent, + SDDSProgressView.positive, + SDDSProgressView.warning, + SDDSProgressView.negative, + SDDSProgressView.info + ] + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/DefaultProgressBarSize.swift b/Themes/SDDSservTheme/SDDSProgressBar/SDDSProgressViewSize.swift similarity index 74% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/DefaultProgressBarSize.swift rename to Themes/SDDSservTheme/SDDSProgressBar/SDDSProgressViewSize.swift index 3e11ee3ad..cbe6334b9 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSProgressBar/DefaultProgressBarSize.swift +++ b/Themes/SDDSservTheme/SDDSProgressBar/SDDSProgressViewSize.swift @@ -1,10 +1,9 @@ import Foundation import SDDSComponents -// Size configuration -public struct DefaultProgressBarSize: ProgressBarSizeConfiguration { +public struct SDDSProgressViewSize: ProgressBarSizeConfiguration { public var debugDescription: String { - String(reflecting: self) + "SDDSProgressViewSize" } public var height: CGFloat { diff --git a/Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+ColorVariations.swift b/Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+ColorVariations.swift new file mode 100644 index 000000000..1c1b6dcfa --- /dev/null +++ b/Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+ColorVariations.swift @@ -0,0 +1,33 @@ +import Foundation +import SDDSComponents +import SDDSServTheme + +public extension AppearanceVariation { + var `default`: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSRadiobox.default.appearance) + ) + } +} + +public extension SDDSRadiobox { + static var `default`: AppearanceVariation { + .init( + name: "default", + appearance: + .init( + titleTypography: RadioboxTypography.label, + subtitleTypography: RadioboxTypography.description, + titleColor: .backgroundInversePrimary, + subtitleColor: .surfaceInverseSolidPrimary.withOpacity(0.56), + disabledAlpha: 0.4 + ) + ) + } + + static var all: [AppearanceVariation] { + [ + SDDSRadiobox.default + ] + } +} diff --git a/Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+SizeVariations.swift b/Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+SizeVariations.swift new file mode 100644 index 000000000..5fe0c9d27 --- /dev/null +++ b/Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+SizeVariations.swift @@ -0,0 +1,34 @@ +import Foundation +import SDDSComponents +import SDDSThemeCore + +// MARK: - Size +public extension AppearanceVariation { + var medium: Self { + .init( + appearance: appearance + .size(SDDSRadiobox.medium.appearance.size) + .titleTypography(RadioboxTypography.label) + .subtitleTypography(RadioboxTypography.description) + ) + } + + var small: Self { + .init( + appearance: appearance + .size(SDDSRadiobox.small.appearance.size) + .titleTypography(RadioboxTypography.label) + .subtitleTypography(RadioboxTypography.description) + ) + } +} + +public extension SDDSRadiobox { + static var medium: AppearanceVariation { + return AppearanceVariation(appearance: RadioboxAppearance()).medium + } + + static var small: AppearanceVariation { + return AppearanceVariation(appearance: RadioboxAppearance()).small + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/RadioboxTypography.swift b/Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+Typography.swift similarity index 57% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/RadioboxTypography.swift rename to Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+Typography.swift index cb0806478..8b81d5cb1 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/RadioboxTypography.swift +++ b/Themes/SDDSservTheme/SDDSRadiobox/SDDSRadiobox+Typography.swift @@ -22,3 +22,19 @@ public struct RadioboxTypography: GeneralTypographyConfiguration { } } } + +public extension RadioboxTypography { + static var label: TypographyConfiguration { + RadioboxTypography( + medium: Typographies.bodyMNormal.typography, + small: Typographies.bodySNormal.typography + ).asContainer + } + + static var description: TypographyConfiguration { + RadioboxTypography( + medium: Typographies.bodyMNormal.typography, + small: Typographies.bodyXsNormal.typography + ).asContainer + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/SDDSRadioboxSize.swift b/Themes/SDDSservTheme/SDDSRadiobox/SDDSRadioboxSize.swift similarity index 84% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/SDDSRadioboxSize.swift rename to Themes/SDDSservTheme/SDDSRadiobox/SDDSRadioboxSize.swift index 09389900b..0893d6539 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSRadiobox/SDDSRadioboxSize.swift +++ b/Themes/SDDSservTheme/SDDSRadiobox/SDDSRadioboxSize.swift @@ -1,12 +1,12 @@ import Foundation import SDDSComponents -public enum SDDSRadioboxSize: SelectionControlSizeConfiguration { +public enum SDDSRadioboxSize: String, SelectionControlSizeConfiguration { case medium case small public var debugDescription: String { - String(reflecting: self) + rawValue } public var imageSize: CGSize { diff --git a/Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+ColorVariations.swift b/Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+ColorVariations.swift new file mode 100644 index 000000000..0a7dadd6f --- /dev/null +++ b/Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+ColorVariations.swift @@ -0,0 +1,33 @@ +import Foundation +import SDDSComponents +import SDDSServTheme + +public extension AppearanceVariation { + var `default`: Self { + .init( + appearance: appearance.applyColorVariation(variation: SDDSSwitch.default.appearance) + ) + } +} + +public extension SDDSSwitch { + static var `default`: AppearanceVariation { + .init( + name: "default", + appearance: SwitchAppearance( + titleTypography: SwitchTypography.label, + subtitleTypography: SwitchTypography.description, + titleColor: .backgroundInversePrimary, + subtitleColor: .surfaceInverseSolidPrimary.withOpacity(0.56), + tintColor: .surfaceDefaultAccent, + disabledAlpha: 0.4 + ) + ) + } + + static var all: [AppearanceVariation] { + [ + SDDSSwitch.default + ] + } +} diff --git a/Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+SizeVariations.swift b/Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+SizeVariations.swift new file mode 100644 index 000000000..ef95bdecd --- /dev/null +++ b/Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+SizeVariations.swift @@ -0,0 +1,48 @@ +// MARK: - Size +import Foundation +import SDDSComponents +import SDDSThemeCore + +// MARK: - Size +public extension AppearanceVariation { + var large: Self { + .init( + appearance: appearance + .size(SDDSSwitchSize.large) + .titleTypography(SwitchTypography.label) + .titleTypography(SwitchTypography.description) + ) + } + + var medium: Self { + .init( + appearance: appearance + .size(SDDSSwitchSize.medium) + .titleTypography(SwitchTypography.label) + .titleTypography(SwitchTypography.description) + ) + } + + var small: Self { + .init( + appearance: appearance + .size(SDDSSwitchSize.small) + .titleTypography(SwitchTypography.label) + .titleTypography(SwitchTypography.description) + ) + } +} + +public extension SDDSSwitch { + static var large: AppearanceVariation { + return AppearanceVariation(appearance: SwitchAppearance()).large + } + + static var medium: AppearanceVariation { + return AppearanceVariation(appearance: SwitchAppearance()).medium + } + + static var small: AppearanceVariation { + return AppearanceVariation(appearance: SwitchAppearance()).small + } +} diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SwitchAppearance+Extensions.swift b/Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+Typography.swift similarity index 96% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SwitchAppearance+Extensions.swift rename to Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+Typography.swift index 3cc190b14..4befbdafe 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SwitchAppearance+Extensions.swift +++ b/Themes/SDDSservTheme/SDDSSwitch/SDDSSwitch+Typography.swift @@ -5,6 +5,7 @@ import SDDSServTheme public extension SwitchAppearance { static var defaultAppearance: SwitchAppearance { .init( + size: SDDSSwitchSize.medium, titleTypography: SwitchTypography.label, subtitleTypography: SwitchTypography.description, titleColor: .backgroundInversePrimary, diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SDDSSwitchSize.swift b/Themes/SDDSservTheme/SDDSSwitch/SDDSSwitchSize.swift similarity index 85% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SDDSSwitchSize.swift rename to Themes/SDDSservTheme/SDDSSwitch/SDDSSwitchSize.swift index 770eecb68..98f0304d1 100644 --- a/SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SDDSSwitchSize.swift +++ b/Themes/SDDSservTheme/SDDSSwitch/SDDSSwitchSize.swift @@ -7,7 +7,7 @@ public enum SDDSSwitchSize: SwitchSizeConfiguration { case small public var debugDescription: String { - String(reflecting: self) + return "SDDSSwitchSize" } public var width: CGFloat? { @@ -15,6 +15,6 @@ public enum SDDSSwitchSize: SwitchSizeConfiguration { } public var verticalGap: CGFloat { - return 0 + return 4 } } diff --git a/SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SwitchTypography.swift b/Themes/SDDSservTheme/SDDSSwitch/SwitchTypography.swift similarity index 100% rename from SDDSComponents/SDDSComponentsPreview/Components/SDDSSwitch/SwitchTypography.swift rename to Themes/SDDSservTheme/SDDSSwitch/SwitchTypography.swift