Skip to content

Commit

Permalink
Release/22 08 2024 (#85)
Browse files Browse the repository at this point in the history
* chore: Added an initial Xcode project structure. Added license, readme.

* fix(sdds-icore): Updated minimum deployment target

* chore: Updated minimum deployment target

* feat(sdds-icore): implemented building and archiving of XCFrameworks (#2)

* feat(sdds-icore): added workflows to run SwiftLint and unit tests (#4)

* Added swiftgen and added workflow to release icons (#8)

* feat(sdds-icore): added workflow to publish icons release

* feat(sdds-icore): added generation of assets

* feat(sdds-icore): added swiftgen and added workflow to release icons (#8)

* Added workflow to update icons (#5)

* feat(sdds-icore): added workflows to release icons

* feat(sdds-icore): added workflow to publish icons release

* build: utilized ref from payload

* build: added workflow to create and push release tag (#17)

* build: added workflow to create and push release tag

* build: set ubuntu instead of macos

* build: bump version (#20)

* chore: improved release name (#22)

* feat(sdds-theme-builder): implemented macOS CLI utility for the tokens generation (#25)

* feat(sdds-theme-builder): implemented color token generation (#26)

* feat(sdds-theme-builder): shadows, shapes generation, tests, unpacking of theme (#27)

* feat(sdds-theme-builder): added shadow, shapes token generation, improved color token generation, added support of light&dark theme

* chore: added documentation

* feat(sdds-theme-builder): improved stencil tempaltes

* feat(sdds-theme-builder): implemented typography token generation

* chore: updated xcodeproj

* chore: added tokens to both targets

* feat(sdds-theme-builder): added AdaptiveTypographyToken

* chore: updated meta json naming

* feat(sdds-theme-builder): implemented typography token generation

* feat(sdds-theme-builder): added theme

* feat(sdds-theme-builder): added stencil template to generate gradients

* feat(sdds-theme-builder): added gradients generaton

* feat(sdds-theme-builder): added tests for GradientContextBuilder

* feat(sdds-theme-builder): added gradients to demo app

* chore: rewrote bash scripts in ruby

* chore: improved naming, divided stencil templates

* chore: added tests for context builders

* fix(sdds-theme-builder): updated scheme (#34)

* feat(sdds-theme-builder): implemented gradient locations

* feat(sdds-theme-builder): built themes for all the verticals

* feat(sdds-theme-builder): added fallback color for colors and gradients

* chore: fixed tests

* feat(sdds-theme-builder): added fallback screen sizes for typography token

* feat(sdds-theme-builder): implemented alpha channel parsing for colors and gradients

* feat(sdds-theme-builder): improved logger

* chore(sdds-theme-builder): fixed alpha channel

* chore: fixed tests

* Scheme validation  (#42)

* feat(sdds-theme-builder): implemented alpha channel parsing for colors and gradients

* feat(sdds-theme-builder): improved logger

* chore(sdds-theme-builder): fixed alpha channel

* feat(sdds-theme-builder): added validation on stencil templates

* chore: fixed code validation

* feat(sdds-theme-builder): implemented meta validation

* chore: clean code

* chore: implemented tests

* feat(sdds-theme-builder): regenerated themes, fixed templates

* chore: removed default theme generation

* fix(sdds-theme-builder): added two decimals format in code generation

* chore: applied formatter to all stencil filter

* feat(sdds-theme-builder): added github actions to release themes

* chore: added script to build themes, updated themes versions

* chore: fixed script

* chore: updated workflow

* chore: bump version

* chore: create output directory automatically

* Main to develop (#56)

* Release SDDSIcons-v0.1.0 (#24)

* chore: Added an initial Xcode project structure. Added license, readme.

* fix(sdds-icore): Updated minimum deployment target

* chore: Updated minimum deployment target

* feat(sdds-icore): implemented building and archiving of XCFrameworks (#2)

* feat(sdds-icore): added workflows to run SwiftLint and unit tests (#4)

* Added swiftgen and added workflow to release icons (#8)

* feat(sdds-icore): added workflow to publish icons release

* feat(sdds-icore): added generation of assets

* feat(sdds-icore): added swiftgen and added workflow to release icons (#8)

* Added workflow to update icons (#5)

* feat(sdds-icore): added workflows to release icons

* feat(sdds-icore): added workflow to publish icons release

* build: utilized ref from payload

* build: added workflow to create and push release tag (#17)

* build: added workflow to create and push release tag

* build: set ubuntu instead of macos

* build: bump version (#20)

* chore: improved release name (#22)

* feat(sdds-acore/icons): New icons were added from plasma v0.9.0

---------

Co-authored-by: Salute iOS Team <[email protected]>

* chore: bump icons versions

* Release SDDSIcons-v0.2.0 (#55)

* chore: Added an initial Xcode project structure. Added license, readme.

* fix(sdds-icore): Updated minimum deployment target

* chore: Updated minimum deployment target

* feat(sdds-icore): implemented building and archiving of XCFrameworks (#2)

* feat(sdds-icore): added workflows to run SwiftLint and unit tests (#4)

* Added swiftgen and added workflow to release icons (#8)

* feat(sdds-icore): added workflow to publish icons release

* feat(sdds-icore): added generation of assets

* feat(sdds-icore): added swiftgen and added workflow to release icons (#8)

* Added workflow to update icons (#5)

* feat(sdds-icore): added workflows to release icons

* feat(sdds-icore): added workflow to publish icons release

* build: utilized ref from payload

* build: added workflow to create and push release tag (#17)

* build: added workflow to create and push release tag

* build: set ubuntu instead of macos

* build: bump version (#20)

* chore: improved release name (#22)

* feat(sdds-theme-builder): implemented macOS CLI utility for the tokens generation (#25)

* feat(sdds-theme-builder): implemented color token generation (#26)

* feat(sdds-theme-builder): shadows, shapes generation, tests, unpacking of theme (#27)

* feat(sdds-theme-builder): added shadow, shapes token generation, improved color token generation, added support of light&dark theme

* chore: added documentation

* feat(sdds-theme-builder): improved stencil tempaltes

* feat(sdds-theme-builder): implemented typography token generation

* chore: updated xcodeproj

* chore: added tokens to both targets

* feat(sdds-theme-builder): added AdaptiveTypographyToken

* chore: updated meta json naming

* feat(sdds-theme-builder): implemented typography token generation

* feat(sdds-theme-builder): added theme

* feat(sdds-theme-builder): added stencil template to generate gradients

* feat(sdds-theme-builder): added gradients generaton

* feat(sdds-theme-builder): added tests for GradientContextBuilder

* feat(sdds-theme-builder): added gradients to demo app

* chore: rewrote bash scripts in ruby

* chore: improved naming, divided stencil templates

* chore: added tests for context builders

* fix(sdds-theme-builder): updated scheme (#34)

* feat(sdds-theme-builder): implemented gradient locations

* feat(sdds-theme-builder): built themes for all the verticals

* feat(sdds-theme-builder): added fallback color for colors and gradients

* chore: fixed tests

* feat(sdds-theme-builder): added fallback screen sizes for typography token

* feat(sdds-theme-builder): implemented alpha channel parsing for colors and gradients

* feat(sdds-theme-builder): improved logger

* chore(sdds-theme-builder): fixed alpha channel

* chore: fixed tests

* Scheme validation  (#42)

* feat(sdds-theme-builder): implemented alpha channel parsing for colors and gradients

* feat(sdds-theme-builder): improved logger

* chore(sdds-theme-builder): fixed alpha channel

* feat(sdds-theme-builder): added validation on stencil templates

* chore: fixed code validation

* feat(sdds-theme-builder): implemented meta validation

* chore: clean code

* chore: implemented tests

* feat(sdds-theme-builder): regenerated themes, fixed templates

* chore: removed default theme generation

* fix(sdds-theme-builder): added two decimals format in code generation

* chore: applied formatter to all stencil filter

* feat(sdds-theme-builder): added github actions to release themes

* chore: added script to build themes, updated themes versions

* chore: fixed script

* chore: updated workflow

* chore: bump version

* feat(sdds-acore/icons): New icons were added from plasma v0.2.0

---------

Co-authored-by: Salute iOS Team <[email protected]>

* fix(sdds-icons): fixed generated icon assets

---------

Co-authored-by: Salute iOS Team <[email protected]>

* fix(sdds-icons): fixed icons generation

* chore: fixed tests

* SDDSButton (#57)

* chore: improved project structure

* feat(sdds-components): added button

* chore: updated previews

* chore: added previews for states

* chore: implemented button states

* chore: added previews for circle and square buttons

* chore: added comments, added basic button preview in the demo app

* chore: fixed layout

* chore: improved demo app

* chore: added color schemes, updated docs

* chore: reverted icons

* chore: added ButtonTypographyConfiguration and ButtonSizeConfiguration protocols

* chore: removed unused constants

* feat(sdds-uikit): added iconHorizontalGap, titleHorizontalGap, fixed colors in demo app

* fix(sdds-theme-builder): added count validation for colors and locations

* chore: utilized GradientDictionaryKey

* feat(sdds-uikit): added SDDSSwitch

* chore: utilized let instead of bindings, removed `*md` from bundle

* chore: added docs for SDDSButton

* feat(sdds-uikit): implemented SDDSCheckbox and SDDSRadiobox

* feat(sdds-uikit): implemented SDDSProgressBar

* fix(sdds-theme-builder): added validations

* chore: updated unit tests

* feat(sdds-theme-builder): added hex validation

* feat(sdds-theme-builder): added support of 3 byte hex

* feat(sdds-uikit): added demo screens for switch, radiobox, checkbox, progress

* feat(sdds-uikit): added Chip and ChipGroup

* feat(sdds-uikit): implemented SDDSCheckboxGroup

* chore: fixed padding

* Added SPM support (#67)

* feat(sdds-uikit): added spm support to sddsicons

* feat(sdds-core): added spm

* feat(sdds-uikit): added Package.swift for PlasmaB2CTheme (#69)

* feat(sdds-uikit): added parent-child relationship for checkboxgroup (#68)

* Feature/button accessibility (#70)

* feat(sdds-uikit): added Package.swift for PlasmaB2CTheme

* feat(sdds-uikit): added button accessability

* feat(sdds-uikit): updated alignment (#72)

* Merged main into develop (#74)

* Release SDDSIcons-v0.1.0 (#24)

* chore: Added an initial Xcode project structure. Added license, readme.

* fix(sdds-icore): Updated minimum deployment target

* chore: Updated minimum deployment target

* feat(sdds-icore): implemented building and archiving of XCFrameworks (#2)

* feat(sdds-icore): added workflows to run SwiftLint and unit tests (#4)

* Added swiftgen and added workflow to release icons (#8)

* feat(sdds-icore): added workflow to publish icons release

* feat(sdds-icore): added generation of assets

* feat(sdds-icore): added swiftgen and added workflow to release icons (#8)

* Added workflow to update icons (#5)

* feat(sdds-icore): added workflows to release icons

* feat(sdds-icore): added workflow to publish icons release

* build: utilized ref from payload

* build: added workflow to create and push release tag (#17)

* build: added workflow to create and push release tag

* build: set ubuntu instead of macos

* build: bump version (#20)

* chore: improved release name (#22)

* feat(sdds-acore/icons): New icons were added from plasma v0.9.0

---------

Co-authored-by: Salute iOS Team <[email protected]>

* chore: bump icons versions

* Release SDDSIcons-v0.2.0 (#55)

* chore: Added an initial Xcode project structure. Added license, readme.

* fix(sdds-icore): Updated minimum deployment target

* chore: Updated minimum deployment target

* feat(sdds-icore): implemented building and archiving of XCFrameworks (#2)

* feat(sdds-icore): added workflows to run SwiftLint and unit tests (#4)

* Added swiftgen and added workflow to release icons (#8)

* feat(sdds-icore): added workflow to publish icons release

* feat(sdds-icore): added generation of assets

* feat(sdds-icore): added swiftgen and added workflow to release icons (#8)

* Added workflow to update icons (#5)

* feat(sdds-icore): added workflows to release icons

* feat(sdds-icore): added workflow to publish icons release

* build: utilized ref from payload

* build: added workflow to create and push release tag (#17)

* build: added workflow to create and push release tag

* build: set ubuntu instead of macos

* build: bump version (#20)

* chore: improved release name (#22)

* feat(sdds-theme-builder): implemented macOS CLI utility for the tokens generation (#25)

* feat(sdds-theme-builder): implemented color token generation (#26)

* feat(sdds-theme-builder): shadows, shapes generation, tests, unpacking of theme (#27)

* feat(sdds-theme-builder): added shadow, shapes token generation, improved color token generation, added support of light&dark theme

* chore: added documentation

* feat(sdds-theme-builder): improved stencil tempaltes

* feat(sdds-theme-builder): implemented typography token generation

* chore: updated xcodeproj

* chore: added tokens to both targets

* feat(sdds-theme-builder): added AdaptiveTypographyToken

* chore: updated meta json naming

* feat(sdds-theme-builder): implemented typography token generation

* feat(sdds-theme-builder): added theme

* feat(sdds-theme-builder): added stencil template to generate gradients

* feat(sdds-theme-builder): added gradients generaton

* feat(sdds-theme-builder): added tests for GradientContextBuilder

* feat(sdds-theme-builder): added gradients to demo app

* chore: rewrote bash scripts in ruby

* chore: improved naming, divided stencil templates

* chore: added tests for context builders

* fix(sdds-theme-builder): updated scheme (#34)

* feat(sdds-theme-builder): implemented gradient locations

* feat(sdds-theme-builder): built themes for all the verticals

* feat(sdds-theme-builder): added fallback color for colors and gradients

* chore: fixed tests

* feat(sdds-theme-builder): added fallback screen sizes for typography token

* feat(sdds-theme-builder): implemented alpha channel parsing for colors and gradients

* feat(sdds-theme-builder): improved logger

* chore(sdds-theme-builder): fixed alpha channel

* chore: fixed tests

* Scheme validation  (#42)

* feat(sdds-theme-builder): implemented alpha channel parsing for colors and gradients

* feat(sdds-theme-builder): improved logger

* chore(sdds-theme-builder): fixed alpha channel

* feat(sdds-theme-builder): added validation on stencil templates

* chore: fixed code validation

* feat(sdds-theme-builder): implemented meta validation

* chore: clean code

* chore: implemented tests

* feat(sdds-theme-builder): regenerated themes, fixed templates

* chore: removed default theme generation

* fix(sdds-theme-builder): added two decimals format in code generation

* chore: applied formatter to all stencil filter

* feat(sdds-theme-builder): added github actions to release themes

* chore: added script to build themes, updated themes versions

* chore: fixed script

* chore: updated workflow

* chore: bump version

* feat(sdds-acore/icons): New icons were added from plasma v0.2.0

---------

Co-authored-by: Salute iOS Team <[email protected]>

---------

Co-authored-by: Salute iOS Team <[email protected]>

* fix(sdds-core): fixed build script (#77)

* feat(sdds-uikit): implemented radioboxgroup (#80)

* Fixed chip behaviour (#81)

* Feature/button previews (#78)

* feat(sdds-uikit): added previews for buttons

* chore: fixed checkbox icon

* feat(sdds-uikit): added link preview for button

* chore: added warning to indicate that font is not accessible

* feat(sdds-uikit): added FillStyle to ProgressBar (#71)

* feat(sdds-uikit): added FillStyle to ProgressBar

* chore: clean code

* chore: clean code

* feat(sdds-uikit): implemented RoundedCornersMask

* feat(sdds-core): improved fonts service, removed themestyle

* feat(sdds-uikit): implemented radioboxgroup (#80)

* fix(sdds-core): fixed project structure and versions

* fix(sdds-uikit): fixed chip

* chore: utilized spm, removed unused files

* fix(sdds-uikit): replaced icons for raidoboxgroup

* feat(sdds-core): added build script

* fix(sdds-uikit): fixed chipgroup layout

---------

Co-authored-by: Salute iOS Team <[email protected]>
  • Loading branch information
vkaltyrin and Salute iOS Team authored Aug 28, 2024
1 parent 6fac378 commit 90bcab1
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 93 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/release_components.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: 'Build and Publish SDDS Components'

on:
push:
tags:
- "SDDS-v[0-9]+.[0-9]+.[0-9]+"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
build-and-publish:
name: Build and Publish
runs-on: ubuntu-latest
environment: sdds
strategy:
matrix:
module:
- name: SDDSComponents
project_path: SDDSComponents/SDDSComponents.xcodeproj
- name: SDDSThemeCore
project_path: SDDSThemeBuilder/SDDSThemeBuilder.xcodeproj

steps:
- name: Checkout the code
uses: actions/checkout@v4

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 'latest'

- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Install dependencies
run: gem install xcodeproj

- name: Run build script for ${{ matrix.module.name }}
run: |
chmod +x ./scripts/build_xcframeworks.rb
ruby ./scripts/build_xcframeworks.rb -d . -p ${{ matrix.module.project_path }} -m ${{ matrix.module.name }}
- name: Generate ${{ matrix.module.name }} zip
id: zip_artifact
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
cd ${{ matrix.module.name }}/build
zip -r ../../${{ matrix.module.name }}-${TAG_NAME}.zip .
cd ../..
echo "::set-output name=zip_path::${{ matrix.module.name }}-${TAG_NAME}.zip"
- name: Release ${{ matrix.module.name }}
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.zip_artifact.outputs.zip_path }}
tag_name: ${{ github.ref_name }}
token: ${{ secrets.GH_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "RadioBoxOn.svg",
"filename" : "RadioBoxOn-2.svg",
"idiom" : "universal"
}
],
Expand Down
50 changes: 14 additions & 36 deletions SDDSComponents/SDDSComponents.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@
811DE1732C57868F000DD354 /* SDDSCheckboxGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 811DE1722C57868F000DD354 /* SDDSCheckboxGroup.swift */; };
814185C72C33080400D8E524 /* Spacing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 814185C62C33080400D8E524 /* Spacing.swift */; };
814185CA2C34260300D8E524 /* ButtonSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 814185C92C34260300D8E524 /* ButtonSize.swift */; };
814F71972C58CC59006385E4 /* SDDSIcons in Frameworks */ = {isa = PBXBuildFile; productRef = 814F71962C58CC59006385E4 /* SDDSIcons */; };
814F719A2C58CE07006385E4 /* SDDSIcons in Frameworks */ = {isa = PBXBuildFile; productRef = 814F71992C58CE07006385E4 /* SDDSIcons */; };
8159F7302C5D1CFE00622836 /* FillStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8159F72F2C5D1CFE00622836 /* FillStyle.swift */; };
816846D12C6656260089E02D /* SDDSButtonPreviewLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816846D02C6656260089E02D /* SDDSButtonPreviewLink.swift */; };
817580E92C37E04000E45207 /* SpinnerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817580E82C37E04000E45207 /* SpinnerView.swift */; };
8178A7712C7493AA00DFDA61 /* SDDSThemeCore in Frameworks */ = {isa = PBXBuildFile; productRef = 8178A7702C7493AA00DFDA61 /* SDDSThemeCore */; };
8178A7742C7493D300DFDA61 /* SDDSThemeUtilities in Frameworks */ = {isa = PBXBuildFile; productRef = 8178A7732C7493D300DFDA61 /* SDDSThemeUtilities */; };
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 */; };
Expand All @@ -47,7 +43,7 @@
81998FF42C354C7F009074B7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 81998FF32C354C7F009074B7 /* Assets.xcassets */; };
81998FF92C35503D009074B7 /* View+Modifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81998FF82C35503D009074B7 /* View+Modifiers.swift */; };
819990002C3555D4009074B7 /* Opacity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81998FFF2C3555D4009074B7 /* Opacity.swift */; };
81BC36802C58E83100A363D0 /* SDDSThemeCore in Frameworks */ = {isa = PBXBuildFile; productRef = 81BC367F2C58E83100A363D0 /* SDDSThemeCore */; };
819CB7FD2C7CC34A00B4FBF4 /* SDDSThemeCore in Frameworks */ = {isa = PBXBuildFile; productRef = 819CB7FC2C7CC34A00B4FBF4 /* SDDSThemeCore */; };
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, ); }; };
Expand Down Expand Up @@ -137,10 +133,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
814F719A2C58CE07006385E4 /* SDDSIcons in Frameworks */,
814F71972C58CC59006385E4 /* SDDSIcons in Frameworks */,
8178A7712C7493AA00DFDA61 /* SDDSThemeCore in Frameworks */,
8178A7742C7493D300DFDA61 /* SDDSThemeUtilities in Frameworks */,
819CB7FD2C7CC34A00B4FBF4 /* SDDSThemeCore in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -446,13 +439,11 @@
buildRules = (
);
dependencies = (
819CB7FF2C7CC35E00B4FBF4 /* PBXTargetDependency */,
);
name = SDDSComponents;
packageProductDependencies = (
814F71962C58CC59006385E4 /* SDDSIcons */,
814F71992C58CE07006385E4 /* SDDSIcons */,
8178A7702C7493AA00DFDA61 /* SDDSThemeCore */,
8178A7732C7493D300DFDA61 /* SDDSThemeUtilities */,
819CB7FC2C7CC34A00B4FBF4 /* SDDSThemeCore */,
);
productName = SDDSComponents;
productReference = 81D2B18D2C32B39B00CAA7FD /* SDDSComponents.framework */;
Expand Down Expand Up @@ -487,9 +478,7 @@
);
mainGroup = 81D2B1832C32B39B00CAA7FD;
packageReferences = (
814F71982C58CE07006385E4 /* XCLocalSwiftPackageReference "../SDDSIcons" */,
8178A76F2C7493AA00DFDA61 /* XCLocalSwiftPackageReference "../SDDSThemeBuilder/SDDSThemeCore" */,
8178A7722C7493D300DFDA61 /* XCLocalSwiftPackageReference "../SDDSThemeBuilder/SDDSThemeUtilities" */,
819CB7FB2C7CC34A00B4FBF4 /* XCLocalSwiftPackageReference "../SDDSThemeBuilder/SDDSThemeCore" */,
);
productRefGroup = 81D2B18E2C32B39B00CAA7FD /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -580,6 +569,10 @@
target = 81D2B18C2C32B39B00CAA7FD /* SDDSComponents */;
targetProxy = 818FE9412C3C403F00F64958 /* PBXContainerItemProxy */;
};
819CB7FF2C7CC35E00B4FBF4 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = 819CB7FE2C7CC35E00B4FBF4 /* SDDSThemeCore */;
};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
Expand Down Expand Up @@ -852,36 +845,21 @@
/* End XCConfigurationList section */

/* Begin XCLocalSwiftPackageReference section */
814F71982C58CE07006385E4 /* XCLocalSwiftPackageReference "../SDDSIcons" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = ../SDDSIcons;
};
8178A76F2C7493AA00DFDA61 /* XCLocalSwiftPackageReference "../SDDSThemeBuilder/SDDSThemeCore" */ = {
819CB7FB2C7CC34A00B4FBF4 /* XCLocalSwiftPackageReference "../SDDSThemeBuilder/SDDSThemeCore" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = ../SDDSThemeBuilder/SDDSThemeCore;
};
8178A7722C7493D300DFDA61 /* XCLocalSwiftPackageReference "../SDDSThemeBuilder/SDDSThemeUtilities" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = ../SDDSThemeBuilder/SDDSThemeUtilities;
};
/* End XCLocalSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
814F71962C58CC59006385E4 /* SDDSIcons */ = {
isa = XCSwiftPackageProductDependency;
productName = SDDSIcons;
};
814F71992C58CE07006385E4 /* SDDSIcons */ = {
isa = XCSwiftPackageProductDependency;
productName = SDDSIcons;
};
8178A7702C7493AA00DFDA61 /* SDDSThemeCore */ = {
819CB7FC2C7CC34A00B4FBF4 /* SDDSThemeCore */ = {
isa = XCSwiftPackageProductDependency;
productName = SDDSThemeCore;
};
8178A7732C7493D300DFDA61 /* SDDSThemeUtilities */ = {
819CB7FE2C7CC35E00B4FBF4 /* SDDSThemeCore */ = {
isa = XCSwiftPackageProductDependency;
productName = SDDSThemeUtilities;
package = 819CB7FB2C7CC34A00B4FBF4 /* XCLocalSwiftPackageReference "../SDDSThemeBuilder/SDDSThemeCore" */;
productName = SDDSThemeCore;
};
/* End XCSwiftPackageProductDependency section */
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Foundation
import SwiftUI
import Combine
import SDDSIcons
@_exported import SDDSThemeCore

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,26 @@ public struct SDDSChipGroup: View {
let size: ChipGroupSizeConfiguration

public var body: some View {
VStack(spacing: size.insets.top) {
ForEach(layoutRows(), id: \.self) { row in
HStack(spacing: size.insets.leading) {
if size.alignment == .right || size.alignment == .decreasingRight {
Spacer()
}
ForEach(row, id: \.self) { chipData in
SDDSChip(data: chipData)
}
if size.alignment == .left || size.alignment == .decreasingLeft {
Spacer()
GeometryReader { geometry in
let maxWidth = geometry.size.width - size.insets.leading - size.insets.trailing
VStack(spacing: size.insets.top) {
ForEach(layoutRows(maxWidth: maxWidth), id: \.self) { row in
HStack(spacing: size.insets.leading) {
if size.alignment == .right || size.alignment == .decreasingRight {
Spacer()
}
ForEach(row, id: \.self) { chipData in
SDDSChip(data: chipData)
}
if size.alignment == .left || size.alignment == .decreasingLeft {
Spacer()
}
}
.frame(maxWidth: .infinity, alignment: alignment)
}
.frame(maxWidth: .infinity, alignment: alignment)
}
.padding(size.insets)
}
.padding(size.insets)
}

private var alignment: SwiftUI.Alignment {
Expand All @@ -149,29 +152,44 @@ public struct SDDSChipGroup: View {
}
}

private func layoutRows() -> [[ChipData]] {
private func layoutRows(maxWidth: CGFloat) -> [[ChipData]] {
var rows: [[ChipData]] = []
var startIndex = 0
var currentMaxColumns = size.maxColumns

while startIndex < data.count {
let endIndex = min(startIndex + currentMaxColumns, data.count)
var row = Array(data[startIndex..<endIndex])
if size.alignment == .decreasingRight {
row.reverse()
}
rows.append(row)
startIndex = endIndex
if size.alignment == .decreasingLeft || size.alignment == .decreasingRight {
currentMaxColumns -= 1
if currentMaxColumns <= 0 {
break
}
var currentRow: [ChipData] = []
var currentRowWidth: CGFloat = 0

for chipData in data {
let chipWidth = calculateChipWidth(for: chipData)

if currentRowWidth + chipWidth > maxWidth {
rows.append(currentRow)
currentRow = [chipData]
currentRowWidth = chipWidth
} else {
currentRow.append(chipData)
currentRowWidth += chipWidth
}
}


if !currentRow.isEmpty {
rows.append(currentRow)
}

return rows
}

private func calculateChipWidth(for chipData: ChipData) -> CGFloat {
let textWidth = chipData.title.size(withAttributes: [.font: chipData.appearance.titleTypography.uiFont]).width
let iconWidth: CGFloat = chipData.size.iconImageSize?.width ?? 0
let buttonWidth: CGFloat = chipData.size.buttonImageSize?.width ?? 0
var totalWidth = textWidth + iconWidth + buttonWidth + chipData.size.leadingInset + chipData.size.trailingInset + 2 * chipData.size.spacing
if iconWidth > 0 {
totalWidth += chipData.size.spacing
}
if buttonWidth > 0 {
totalWidth += chipData.size.spacing
}
return totalWidth
}
}

// Пример данных и конфигурации для предварительного просмотра
Expand All @@ -188,12 +206,12 @@ struct SDDSChipGroupPreview: PreviewProvider {
let chipSize = DefaultChipSize()
let chipAccessibility = ChipAccessibility()

let chipData = (1...36).map { index in
let chipData = (1...12).map { index in
ChipData(
title: "Label",
isEnabled: true,
iconImage: nil,
buttonImage: nil,
iconImage: Image.image("chipIcon"),
buttonImage: Image.image("chipClose"),
appearance: chipAppearance,
size: chipSize,
accessibility: chipAccessibility,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ struct SDDSRadioboxGroupPreview: PreviewProvider {
}

return SDDSRadioboxGroup(radioboxData: radioboxData, verticalSpacing: 8)

.previewLayout(.sizeThatFits)
.previewDisplayName("SDDSRadioboxGroup Preview")
}
Expand Down
Loading

0 comments on commit 90bcab1

Please sign in to comment.