Skip to content

Commit

Permalink
fix(sdds-counter, counterview): corrections to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirDimitraki committed Dec 25, 2024
1 parent 6785849 commit 4c90ff5
Show file tree
Hide file tree
Showing 27 changed files with 1,595 additions and 4 deletions.
60 changes: 60 additions & 0 deletions SDDSComponents/SDDSComponents.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
objects = {

/* Begin PBXBuildFile section */
6987445F2D1C367700559ABA /* SDDSCounter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6987445D2D1C367700559ABA /* SDDSCounter.swift */; };
698744602D1C367700559ABA /* CounterAppearance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6987445A2D1C367700559ABA /* CounterAppearance+Extensions.swift */; };
698744612D1C367700559ABA /* CounterSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 698744582D1C367700559ABA /* CounterSize.swift */; };
698744622D1C367700559ABA /* CounterColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 698744572D1C367700559ABA /* CounterColor.swift */; };
698744632D1C367700559ABA /* CounterData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6987445C2D1C367700559ABA /* CounterData.swift */; };
698744642D1C367700559ABA /* CounterAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 698744562D1C367700559ABA /* CounterAppearance.swift */; };
698744672D1C368E00559ABA /* SDDSSegmentElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 698744652D1C368E00559ABA /* SDDSSegmentElement.swift */; };
8102BA2F2CBE9B3300C589D3 /* SDDSTextArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8102BA2A2CBE9B3300C589D3 /* SDDSTextArea.swift */; };
8102BA302CBE9B3300C589D3 /* TextAreaAccessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8102BA2B2CBE9B3300C589D3 /* TextAreaAccessibility.swift */; };
8102BA312CBE9B3300C589D3 /* TextAreaAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8102BA2C2CBE9B3300C589D3 /* TextAreaAppearance.swift */; };
Expand Down Expand Up @@ -146,6 +153,13 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
698744562D1C367700559ABA /* CounterAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterAppearance.swift; sourceTree = "<group>"; };
698744572D1C367700559ABA /* CounterColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterColor.swift; sourceTree = "<group>"; };
698744582D1C367700559ABA /* CounterSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterSize.swift; sourceTree = "<group>"; };
6987445A2D1C367700559ABA /* CounterAppearance+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CounterAppearance+Extensions.swift"; sourceTree = "<group>"; };
6987445C2D1C367700559ABA /* CounterData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterData.swift; sourceTree = "<group>"; };
6987445D2D1C367700559ABA /* SDDSCounter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSCounter.swift; sourceTree = "<group>"; };
698744652D1C368E00559ABA /* SDDSSegmentElement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDDSSegmentElement.swift; sourceTree = "<group>"; };
8102BA2A2CBE9B3300C589D3 /* SDDSTextArea.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SDDSTextArea.swift; sourceTree = "<group>"; };
8102BA2B2CBE9B3300C589D3 /* TextAreaAccessibility.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextAreaAccessibility.swift; sourceTree = "<group>"; };
8102BA2C2CBE9B3300C589D3 /* TextAreaAppearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextAreaAppearance.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -324,6 +338,43 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
698744592D1C367700559ABA /* CounterAppearance */ = {
isa = PBXGroup;
children = (
698744562D1C367700559ABA /* CounterAppearance.swift */,
698744572D1C367700559ABA /* CounterColor.swift */,
698744582D1C367700559ABA /* CounterSize.swift */,
);
path = CounterAppearance;
sourceTree = "<group>";
};
6987445B2D1C367700559ABA /* CounterAppearance+Extensions */ = {
isa = PBXGroup;
children = (
6987445A2D1C367700559ABA /* CounterAppearance+Extensions.swift */,
);
path = "CounterAppearance+Extensions";
sourceTree = "<group>";
};
6987445E2D1C367700559ABA /* SDDSCounter */ = {
isa = PBXGroup;
children = (
698744592D1C367700559ABA /* CounterAppearance */,
6987445B2D1C367700559ABA /* CounterAppearance+Extensions */,
6987445C2D1C367700559ABA /* CounterData.swift */,
6987445D2D1C367700559ABA /* SDDSCounter.swift */,
);
path = SDDSCounter;
sourceTree = "<group>";
};
698744662D1C368E00559ABA /* SDDSSegmentElement */ = {
isa = PBXGroup;
children = (
698744652D1C368E00559ABA /* SDDSSegmentElement.swift */,
);
path = SDDSSegmentElement;
sourceTree = "<group>";
};
8102BA282CBE9B3300C589D3 /* SDDSTextArea */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -611,6 +662,8 @@
818C03AF2C418705002C6D0A /* Components */ = {
isa = PBXGroup;
children = (
698744662D1C368E00559ABA /* SDDSSegmentElement */,
6987445E2D1C367700559ABA /* SDDSCounter */,
8102BA282CBE9B3300C589D3 /* SDDSTextArea */,
81E9FA8D2C92B12C0041B5FF /* SDDSTextField */,
81CBC09B2C82326600FBDAC8 /* SDDSAvatarGroup */,
Expand Down Expand Up @@ -1145,6 +1198,12 @@
818C03BF2C43C371002C6D0A /* DebugModifier.swift in Sources */,
817339D72D033C0A0092608A /* ProgressBarAccessibility.swift in Sources */,
814E30392C99AFB3004601F7 /* SDDSAvatarGroup.swift in Sources */,
6987445F2D1C367700559ABA /* SDDSCounter.swift in Sources */,
698744602D1C367700559ABA /* CounterAppearance+Extensions.swift in Sources */,
698744612D1C367700559ABA /* CounterSize.swift in Sources */,
698744622D1C367700559ABA /* CounterColor.swift in Sources */,
698744632D1C367700559ABA /* CounterData.swift in Sources */,
698744642D1C367700559ABA /* CounterAppearance.swift in Sources */,
814E307E2C99CEE1004601F7 /* View+DebugModifiers.swift in Sources */,
817339D52D033BF50092608A /* ProgressBarSizeConfiguration.swift in Sources */,
818FE9312C3C1CDC00F64958 /* Components.swift in Sources */,
Expand Down Expand Up @@ -1192,6 +1251,7 @@
818C03CE2C4515ED002C6D0A /* SDDSRadiobox.swift in Sources */,
81998FF92C35503D009074B7 /* View+Modifiers.swift in Sources */,
816AA9A72C97280400C3347C /* PlaceholderTextField.swift in Sources */,
698744672D1C368E00559ABA /* SDDSSegmentElement.swift in Sources */,
811DE1542C50098D000DD354 /* SDDSChip.swift in Sources */,
8102BA3C2CBEB32700C589D3 /* ExpandingTextEditor.swift in Sources */,
81F7531E2CF46793000156D9 /* ButtonAlignment.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public struct BasicButton: View {
appearance: appearance,
layoutMode: layoutMode,
accessibility: accessibility,
counter: nil,
action: action
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public struct IconButton: View {
appearance: appearance,
layoutMode: layoutMode,
accessibility: accessibility,
counter: nil,
action: action
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public struct LinkButton: View {
appearance: appearance,
layoutMode: layoutMode,
accessibility: accessibility,
counter: nil,
action: action
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ public struct SDDSButton: View {
public let iconAttributes: ButtonIconAttributes?
public let isDisabled: Bool
public let isLoading: Bool
public let spinnerImage: Image
public let spinnerImage: Image?
public let buttonStyle: SDDSComponents.ButtonStyle
public let appearance: ButtonAppearance
public let layoutMode: ButtonLayoutMode
public let accessibility: ButtonAccessibility
public let counter: ViewProvider?

@Environment(\.colorScheme) var colorScheme
@State private var isAnimating: Bool = false
Expand All @@ -28,11 +29,12 @@ public struct SDDSButton: View {
iconAttributes: ButtonIconAttributes? = nil,
isDisabled: Bool = false,
isLoading: Bool = false,
spinnerImage: Image = Image("spinner", bundle: Bundle(for: Components.self)),
spinnerImage: Image? = Image("spinner", bundle: Bundle(for: Components.self)),
buttonStyle: SDDSComponents.ButtonStyle = .basic,
appearance: ButtonAppearance,
layoutMode: ButtonLayoutMode = .wrapContent,
accessibility: ButtonAccessibility = ButtonAccessibility(),
counter: ViewProvider?,
action: @escaping () -> Void
) {
self.title = title
Expand All @@ -45,6 +47,7 @@ public struct SDDSButton: View {
self.appearance = appearance
self.layoutMode = layoutMode
self.accessibility = accessibility
self.counter = counter
self.action = action
}

Expand Down Expand Up @@ -161,7 +164,7 @@ public struct SDDSButton: View {

@ViewBuilder
private var spinner: some View {
if isLoading {
if let spinnerImage = spinnerImage, isLoading {
SpinnerView(
image: spinnerImage,
foregroundColor: currentColor(for: appearance.spinnerColor)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import Foundation
import SDDSThemeCore

public extension CounterAppearance {
func size(_ size: CounterSizeConfiguration) -> CounterAppearance {
return CounterAppearance(
size: size,
dataTypography: self.dataTypography,
dataColor: self.dataColor,
backgroundColor: self.backgroundColor,
disabledAlpha: self.disabledAlpha,
loadingAlpha: self.loadingAlpha
)
}

func dataTypography(_ dataTypography: TypographyConfiguration) -> CounterAppearance {
return CounterAppearance(
size: self.size,
dataTypography: dataTypography,
dataColor: self.dataColor,
backgroundColor: self.backgroundColor,
disabledAlpha: self.disabledAlpha,
loadingAlpha: self.loadingAlpha
)
}

func dataColor(_ dataColor: CounterColor) -> CounterAppearance {
return CounterAppearance(
size: self.size,
dataTypography: self.dataTypography,
dataColor: dataColor,
backgroundColor: self.backgroundColor,
disabledAlpha: self.disabledAlpha,
loadingAlpha: self.loadingAlpha
)
}

func backgroundColor(_ backgroundColor: CounterColor) -> CounterAppearance {
return CounterAppearance(
size: self.size,
dataTypography: self.dataTypography,
dataColor: self.dataColor,
backgroundColor: backgroundColor,
disabledAlpha: self.disabledAlpha,
loadingAlpha: self.loadingAlpha
)
}

func disabledAlpha(_ disabledAlpha: CGFloat) -> CounterAppearance {
return CounterAppearance(
size: self.size,
dataTypography: self.dataTypography,
dataColor: dataColor,
backgroundColor: self.backgroundColor,
disabledAlpha: disabledAlpha,
loadingAlpha: self.loadingAlpha
)
}

func loadingAlpha(_ loadingAlpha: CGFloat) -> CounterAppearance {
return CounterAppearance(
size: self.size,
dataTypography: self.dataTypography,
dataColor: dataColor,
backgroundColor: self.backgroundColor,
disabledAlpha: self.disabledAlpha,
loadingAlpha: loadingAlpha
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Foundation
@_exported import SDDSThemeCore

public struct CounterAppearance {
public let size: CounterSizeConfiguration
public let dataTypography: TypographyConfiguration
public let dataColor: CounterColor
public let backgroundColor: CounterColor
public let disabledAlpha: CGFloat
public let loadingAlpha: CGFloat

public init(
size: CounterSizeConfiguration = DefaultCounterSize(),
dataTypography: TypographyConfiguration = .default,
dataColor: CounterColor = CounterColor(),
backgroundColor: CounterColor = CounterColor(),
disabledAlpha: CGFloat = 0,
loadingAlpha: CGFloat = 0
) {
self.size = size
self.dataTypography = dataTypography
self.dataColor = dataColor
self.backgroundColor = backgroundColor
self.disabledAlpha = disabledAlpha
self.loadingAlpha = loadingAlpha
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Foundation
@_exported import SDDSThemeCore

public struct CounterColor {
public let defaultColor: ColorToken
public let highlightedColor: ColorToken
public let hoveredColor: ColorToken

public init(
defaultColor: ColorToken = .clearColor,
highlightedColor: ColorToken = .clearColor,
hoveredColor: ColorToken = .clearColor
) {
self.defaultColor = defaultColor
self.highlightedColor = highlightedColor
self.hoveredColor = hoveredColor
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Foundation
import SwiftUI

public struct DefaultCounterSize: CounterSizeConfiguration {
public var height: CGFloat = 0
public var width: CGFloat = 0
public var paddings: EdgeInsets = .init()
public var debugDescription: String {
return "DefaultCounterSize"
}

public init() {}
}

public protocol CounterSizeConfiguration: SizeConfiguration, CustomDebugStringConvertible {
var height: CGFloat { get }
var width: CGFloat { get }
var paddings: EdgeInsets { get }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Foundation

public struct CounterData {
public var value: String

public init(value: String = "") {
self.value = value
}
}
Loading

0 comments on commit 4c90ff5

Please sign in to comment.