Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added supported themes in libraries #166

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions SDDSComponents/SDDSComponents.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
6969429F2D6F0D8C00F43C38 /* CellSizeConfigurations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 696942992D6F0D8C00F43C38 /* CellSizeConfigurations.swift */; };
696942A02D6F0D8C00F43C38 /* CellContentAlignment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 696942982D6F0D8C00F43C38 /* CellContentAlignment.swift */; };
696942A12D6F0D8C00F43C38 /* CellAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 696942972D6F0D8C00F43C38 /* CellAppearance.swift */; };
696942A22D6F0D8C00F43C38 /* SDDSCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 696942962D6F0D8C00F43C38 /* SDDSCell.swift */; };
697736FF2D26C23F0077D1A4 /* CounterAppearance+Variation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 697736FE2D26C2310077D1A4 /* CounterAppearance+Variation.swift */; };
697737852D2EB8030077D1A4 /* View+ErrorString.swift in Sources */ = {isa = PBXBuildFile; fileRef = 697737842D2EB7F80077D1A4 /* View+ErrorString.swift */; };
697970DD2D63A622008306A8 /* SDDSCellPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 697970DC2D63A61A008306A8 /* SDDSCellPreview.swift */; };
697970DF2D63A633008306A8 /* SDDSCellPreview+Extansion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 697970DE2D63A625008306A8 /* SDDSCellPreview+Extansion.swift */; };
6987445F2D1C367700559ABA /* SDDSCounter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6987445D2D1C367700559ABA /* SDDSCounter.swift */; };
698744612D1C367700559ABA /* CounterSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 698744582D1C367700559ABA /* CounterSize.swift */; };
Expand All @@ -48,6 +46,8 @@
69B975282D511A1300CAF208 /* CounterWidthCalculatorImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69B975272D511A0E00CAF208 /* CounterWidthCalculatorImpl.swift */; };
69C0356C2D4F8AC4005D3B95 /* SegmentSizeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69C0356B2D4F8AAB005D3B95 /* SegmentSizeConfiguration.swift */; };
69C0356E2D4F8B1F005D3B95 /* SegmentLayoutOrientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69C0356D2D4F8AFF005D3B95 /* SegmentLayoutOrientation.swift */; };
69ED5C0F2D7847E00019EE99 /* SDDSCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69ED5C0E2D7847E00019EE99 /* SDDSCell.swift */; };
69ED5C112D7848020019EE99 /* SDDSCellPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69ED5C102D7848020019EE99 /* SDDSCellPreview.swift */; };
69F967B32D4CC9FC00C0B50F /* SDDSSegmentPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69F967B22D4CC9F700C0B50F /* SDDSSegmentPreview.swift */; };
69F967BB2D4E6EAA00C0B50F /* SDDSCounterPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69F967BA2D4E6EA400C0B50F /* SDDSCounterPreview.swift */; };
8102BA2F2CBE9B3300C589D3 /* SDDSTextArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8102BA2A2CBE9B3300C589D3 /* SDDSTextArea.swift */; };
Expand Down Expand Up @@ -224,7 +224,6 @@
6925101A2D7632CA00545542 /* SDDSBadge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSBadge.swift; sourceTree = "<group>"; };
695F43892D41158F00FF936B /* SegmentItem+Equatable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SegmentItem+Equatable.swift"; sourceTree = "<group>"; };
695F438C2D412A9D00FF936B /* SegmentAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentAppearance.swift; sourceTree = "<group>"; };
696942962D6F0D8C00F43C38 /* SDDSCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSCell.swift; sourceTree = "<group>"; };
696942972D6F0D8C00F43C38 /* CellAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CellAppearance.swift; sourceTree = "<group>"; };
696942982D6F0D8C00F43C38 /* CellContentAlignment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CellContentAlignment.swift; sourceTree = "<group>"; };
696942992D6F0D8C00F43C38 /* CellSizeConfigurations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CellSizeConfigurations.swift; sourceTree = "<group>"; };
Expand All @@ -245,7 +244,6 @@
697970D52D63A55B008306A8 /* CellAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CellAppearance.swift; sourceTree = "<group>"; };
697970D72D63A566008306A8 /* CellContentAlignment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CellContentAlignment.swift; sourceTree = "<group>"; };
697970D92D63A582008306A8 /* CellSizeConfigurations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CellSizeConfigurations.swift; sourceTree = "<group>"; };
697970DC2D63A61A008306A8 /* SDDSCellPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSCellPreview.swift; sourceTree = "<group>"; };
697970DE2D63A625008306A8 /* SDDSCellPreview+Extansion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SDDSCellPreview+Extansion.swift"; sourceTree = "<group>"; };
698744562D1C367700559ABA /* CounterAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterAppearance.swift; sourceTree = "<group>"; };
698744582D1C367700559ABA /* CounterSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterSize.swift; sourceTree = "<group>"; };
Expand All @@ -260,6 +258,8 @@
69B975272D511A0E00CAF208 /* CounterWidthCalculatorImpl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterWidthCalculatorImpl.swift; sourceTree = "<group>"; };
69C0356B2D4F8AAB005D3B95 /* SegmentSizeConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentSizeConfiguration.swift; sourceTree = "<group>"; };
69C0356D2D4F8AFF005D3B95 /* SegmentLayoutOrientation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentLayoutOrientation.swift; sourceTree = "<group>"; };
69ED5C0E2D7847E00019EE99 /* SDDSCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSCell.swift; sourceTree = "<group>"; };
69ED5C102D7848020019EE99 /* SDDSCellPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSCellPreview.swift; sourceTree = "<group>"; };
69F967B22D4CC9F700C0B50F /* SDDSSegmentPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSSegmentPreview.swift; sourceTree = "<group>"; };
69F967BA2D4E6EA400C0B50F /* SDDSCounterPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSCounterPreview.swift; sourceTree = "<group>"; };
8102BA2A2CBE9B3300C589D3 /* SDDSTextArea.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSTextArea.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -507,7 +507,7 @@
6969429A2D6F0D8C00F43C38 /* SDDSCell */ = {
isa = PBXGroup;
children = (
696942962D6F0D8C00F43C38 /* SDDSCell.swift */,
69ED5C0E2D7847E00019EE99 /* SDDSCell.swift */,
696942972D6F0D8C00F43C38 /* CellAppearance.swift */,
696942982D6F0D8C00F43C38 /* CellContentAlignment.swift */,
696942992D6F0D8C00F43C38 /* CellSizeConfigurations.swift */,
Expand All @@ -518,8 +518,8 @@
697970DB2D63A5EF008306A8 /* SDDSCell */ = {
isa = PBXGroup;
children = (
69ED5C102D7848020019EE99 /* SDDSCellPreview.swift */,
697970DE2D63A625008306A8 /* SDDSCellPreview+Extansion.swift */,
697970DC2D63A61A008306A8 /* SDDSCellPreview.swift */,
);
path = SDDSCell;
sourceTree = "<group>";
Expand Down Expand Up @@ -1493,8 +1493,8 @@
811D2E232D10A5B4001C0F48 /* SDDSAvatarGroupPreview.swift in Sources */,
697970DF2D63A633008306A8 /* SDDSCellPreview+Extansion.swift in Sources */,
81733A062D0362D00092608A /* SDDSCheckboxPreview.swift in Sources */,
697970DD2D63A622008306A8 /* SDDSCellPreview.swift in Sources */,
812DB76A2D57B4E900D3F4A3 /* TextFieldClearPreview.swift in Sources */,
69ED5C112D7848020019EE99 /* SDDSCellPreview.swift in Sources */,
81733A402D0738300092608A /* SDDSChipPreview.swift in Sources */,
81BBC5952C862764009616CE /* Spacing.swift in Sources */,
);
Expand All @@ -1509,6 +1509,7 @@
817339DE2D033D860092608A /* ChipAccessibility.swift in Sources */,
812DB7622D57B49F00D3F4A3 /* ChipGroupAlignment.swift in Sources */,
817339F12D033EF30092608A /* AvatarImageSource.swift in Sources */,
69ED5C0F2D7847E00019EE99 /* SDDSCell.swift in Sources */,
818C03BF2C43C371002C6D0A /* DebugModifier.swift in Sources */,
812DB7582D57B44100D3F4A3 /* TextFieldClear.swift in Sources */,
817339D72D033C0A0092608A /* ProgressBarAccessibility.swift in Sources */,
Expand Down Expand Up @@ -1576,7 +1577,6 @@
6969429F2D6F0D8C00F43C38 /* CellSizeConfigurations.swift in Sources */,
696942A02D6F0D8C00F43C38 /* CellContentAlignment.swift in Sources */,
696942A12D6F0D8C00F43C38 /* CellAppearance.swift in Sources */,
696942A22D6F0D8C00F43C38 /* SDDSCell.swift in Sources */,
811DE1582C5017C3000DD354 /* ProgressBarAppearance.swift in Sources */,
811DE1562C50179F000DD354 /* ChipAppearance.swift in Sources */,
81CF12202C6E74180074174F /* RoundedCornersMask.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ struct CellPreview: PreviewProvider {
.previewLayout(PreviewLayout.sizeThatFits)
.previewDisplayName("Cell")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ public struct SDDSAvatar: View {
fatalError("Undefined Avatar Typography")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ extension SDDSCell {
return .bottom
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,29 @@ public struct SDDSCheckboxGroup: View {
}

public enum SDDSCheckboxGroupSize: String, CheckboxGroupSizeConfiguration, CaseIterable {
case large
case medium
case small

public var horizontalIndent: CGFloat {
switch self {
case .large:
36
case .medium:
24
36
case .small:
12
24
}
}

public var verticalSpacing: CGFloat {
switch self {
case .large:
7
case .medium:
8
6
case .small:
4
5
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ public extension RadioboxImages {
}

public enum SDDSRadioboxGroupSize: String, RadioboxGroupSizeConfiguration, CaseIterable {
case large
case medium
case small

public var verticalSpacing: CGFloat {
switch self {
case .large:
8
case .medium:
8
case .small:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public struct SelectionControlAccessibility {
public var controlHint: String
public var controlEnabledValue: String
public var controlDisabledValue: String

public init(
titleLabel: String = "Title",
subtitleLabel: String = "Subtitle",
Expand Down Expand Up @@ -207,7 +207,7 @@ extension SelectionControlState {
false
}
}

func nextState() -> SelectionControlState {
if isSelected {
return .deselected
Expand Down
44 changes: 14 additions & 30 deletions SDDSDemoApp/SDDSDemoApp/Common/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ enum Theme: String, CaseIterable {
}

var avatarVariations: [Variation<AvatarAppearance>] {
let fallback = SDDSServTheme.Avatar.all

switch self {
case .sdddsServTheme:
return SDDSServTheme.Avatar.all
case .stylesSalute:
return fallback
return StylesSaluteTheme.Avatar.all
case .plasmaB2CTheme:
return PlasmaB2CTheme.Avatar.all
}
Expand Down Expand Up @@ -126,41 +124,35 @@ enum Theme: String, CaseIterable {
}

var checkboxVariations: [Variation<CheckboxAppearance>] {
let fallback = SDDSServTheme.Checkbox.all

switch self {
case .sdddsServTheme:
return SDDSServTheme.Checkbox.all
case .stylesSalute:
return fallback
return StylesSaluteTheme.Checkbox.all
case .plasmaB2CTheme:
return fallback
return PlasmaB2CTheme.Checkbox.all
}
}

var radioboxVariations: [Variation<RadioboxAppearance>] {
let fallback = SDDSServTheme.Radiobox.all

switch self {
case .sdddsServTheme:
return SDDSServTheme.Radiobox.all
case .stylesSalute:
return fallback
return StylesSaluteTheme.Radiobox.all
case .plasmaB2CTheme:
return fallback
return PlasmaB2CTheme.Radiobox.all
}
}

var chipVariations: [Variation<ChipAppearance>] {
let fallback = SDDSServTheme.Chip.all

switch self {
case .sdddsServTheme:
return SDDSServTheme.Chip.all
case .stylesSalute:
return fallback
return StylesSaluteTheme.Chip.all
case .plasmaB2CTheme:
return fallback
return PlasmaB2CTheme.Chip.all
}
}

Expand All @@ -176,54 +168,46 @@ enum Theme: String, CaseIterable {
}

var progressBarVariations: [Variation<ProgressBarAppearance>] {
let fallback: [Variation<ProgressBarAppearance>] = SDDSServTheme.ProgressBar.all

switch self {
case .sdddsServTheme:
return SDDSServTheme.ProgressBar.all
case .stylesSalute:
return fallback
return StylesSaluteTheme.ProgressBar.all
case .plasmaB2CTheme:
return fallback
return PlasmaB2CTheme.ProgressBar.all
}
}

var segmentItemVariations: [Variation<SegmentItemAppearance>] {
let fallback: [Variation<SegmentItemAppearance>] = SDDSServTheme.SegmentItem.all

switch self {
case .sdddsServTheme:
return SDDSServTheme.SegmentItem.all
case .stylesSalute:
return fallback
return StylesSaluteTheme.SegmentItem.all
case .plasmaB2CTheme:
return PlasmaB2CTheme.SegmentItem.all
}
}

var segmentVariations: [Variation<SegmentAppearance>] {
let fallback: [Variation<SegmentAppearance>] = SDDSServTheme.Segment.all

switch self {
case .sdddsServTheme:
return SDDSServTheme.Segment.all
case .stylesSalute:
return fallback
return StylesSaluteTheme.Segment.all
case .plasmaB2CTheme:
return fallback
return PlasmaB2CTheme.Segment.all
}
}

var switchVariations: [Variation<SwitchAppearance>] {
let fallback: [Variation<SwitchAppearance>] = SDDSServTheme.Switch.all

switch self {
case .sdddsServTheme:
return SDDSServTheme.Switch.all
case .stylesSalute:
return fallback
return StylesSaluteTheme.Switch.all
case .plasmaB2CTheme:
return fallback
return PlasmaB2CTheme.Switch.all
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import SwiftUI

import Combine
import SDDSComponents

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ struct CheckboxItemViewModel: Identifiable {
private extension SDDSCheckboxGroupSize {
var checkboxSize: SDDSCheckboxSize {
switch self {
case .large:
return .large
case .medium:
return .medium
case .small:
Expand Down
1 change: 0 additions & 1 deletion SDDSDemoApp/SDDSDemoApp/Views/ChipView/ChipView.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import SwiftUI

import Combine
import SDDSComponents
import SDDSServTheme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ final class RadioboxGroupViewModel: ObservableObject {
extension SDDSRadioboxGroupSize {
var radioboxSize: SDDSRadioboxSize {
switch self {
case .large:
return .large
case .medium:
return .medium
case .small:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public struct SegmentItemView: View {
Spacer()
}
}

public var title: some View {
HStack {
Text("Title")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum CodeGenerationComponent: String, CaseIterable, Decodable {
case iconBadgeTransparent = "IconBadgeTransparent"
case indicator = "Indicator"
case cell = "Cell"
case counter = "SDDSCounter"
case counter = "Counter"

static var supportedComponents: [CodeGenerationComponent] {
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ typealias ChipConfiguration = ComponentConfiguration<ChipProps>
typealias BadgeConfiguration = ComponentConfiguration<BadgeProps>
typealias IndicatorConfiguration = ComponentConfiguration<IndicatorProps>
typealias CellConfiguration = ComponentConfiguration<CellProps>
typealias CounterConfiguration = ComponentConfiguration<CounterProps>
typealias CounterConfiguration = ComponentConfiguration<CounterProps>
4 changes: 2 additions & 2 deletions Themes/PlasmaB2CTheme/Avatar/Avatar+BaseVariations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ extension AvatarAppearance {
textFillStyle: .gradient(Gradients.textDefaultAccentGradient),
backgroundFillStyle: .gradient(Gradients.surfaceDefaultAccentGradient),
backgroundOpacity: 0.2,
onlineStatusColor: Colors.textDefaultAccent,
offlineStatusColor: Colors.surfaceDefaultPositive,
onlineStatusColor: Colors.textDefaultPositive,
offlineStatusColor: Colors.surfaceDefaultSolidTertiary,
textTypography: AvatarTypography.title
)
}
Expand Down
6 changes: 3 additions & 3 deletions Themes/PlasmaB2CTheme/Chip/Chip+Variations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ private extension ChipAppearance {
var secondary: ChipAppearance {
var appearance = self
appearance.backgroundColor = ButtonColor(defaultColor: ColorToken.surfaceDefaultTransparentSecondary, highlightedColor: ColorToken.surfaceDefaultTransparentSecondaryActive, hoveredColor: ColorToken.surfaceDefaultTransparentSecondaryHover)
appearance.buttonTintColor = ButtonColor(defaultColor: ColorToken.textOnDarkPrimary, highlightedColor: ColorToken.textOnDarkPrimaryActive, hoveredColor: ColorToken.textOnDarkPrimaryHover)
appearance.imageTintColor = ButtonColor(defaultColor: ColorToken.textOnDarkPrimary, highlightedColor: ColorToken.textOnDarkPrimaryActive, hoveredColor: ColorToken.textOnDarkPrimaryHover)
appearance.titleColor = ButtonColor(defaultColor: ColorToken.textOnDarkPrimary, highlightedColor: ColorToken.textOnDarkPrimaryActive, hoveredColor: ColorToken.textOnDarkPrimaryHover)
appearance.buttonTintColor = ButtonColor(defaultColor: ColorToken.textOnLightSecondary, highlightedColor: ColorToken.textOnLightSecondaryActive, hoveredColor: ColorToken.textOnLightSecondaryHover)
appearance.imageTintColor = ButtonColor(defaultColor: ColorToken.textDefaultPrimary, highlightedColor: ColorToken.textDefaultPrimaryActive, hoveredColor: ColorToken.textDefaultPrimaryHover)
appearance.titleColor = ButtonColor(defaultColor: ColorToken.textDefaultPrimary, highlightedColor: ColorToken.textDefaultPrimaryActive, hoveredColor: ColorToken.textDefaultPrimaryHover)
return appearance
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import SDDSComponents
import SDDSThemeCore

public struct EmbeddedChip {
public static var xl: ComponentAppearanceVariation<EmbeddedChip, ChipAppearance> {
var appearance = ChipAppearance.base
appearance.size = EmbeddedChipSize.xl
appearance.titleTypography = EmbeddedChipTypography(oneSize: Typographies.bodyLNormal.typography).asContainer

return .init(
name: "xl",
appearance: appearance
)
}
public static var l: ComponentAppearanceVariation<EmbeddedChip, ChipAppearance> {
var appearance = ChipAppearance.base
appearance.size = EmbeddedChipSize.l
Expand Down
Loading
Loading