Skip to content

Commit

Permalink
feat(sdds-uikit): added SDDSTextArea
Browse files Browse the repository at this point in the history
  • Loading branch information
vkaltyrin committed Nov 1, 2024
1 parent 816631e commit c7dc1d8
Show file tree
Hide file tree
Showing 83 changed files with 3,333 additions and 236 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "icon-24×24.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
2 changes: 1 addition & 1 deletion SDDSComponents/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let package = Package(
),
.target(
name: "SDDSComponentsPreview",
dependencies: ["SDDSServTheme", "SDDSThemeCore"],
dependencies: ["SDDSServTheme", "SDDSThemeCore", "SDDSComponents"],
path: "SDDSComponentsPreview",
exclude: ["SDDSComponentsPreview.h"],
resources: [
Expand Down
101 changes: 67 additions & 34 deletions SDDSComponents/SDDSComponents.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@
{
"filename" : "CheckBoxOff.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "light"
}
],
"filename" : "CheckBoxOff 1.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "CheckBoxDark.svg",
"idiom" : "universal"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@
{
"filename" : "RadioBoxOff.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "light"
}
],
"filename" : "RadioBoxDark 1.svg",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "RadioBoxDark.svg",
"idiom" : "universal"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extension AvatarTypography {
extraExtraLarge: Typographies.headerH2Bold.typography,
large: Typographies.headerH4Bold.typography,
medium: Typographies.headerH5Bold.typography,
small: Typographies.headerH5Bold.typography
small: Typographies.textXsBold.typography
).asContainer
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ struct SDDSAvatarPreview: PreviewProvider {
.padding()
}

static var defaultAccessibility: AvatarAccessibility {
private static var defaultAccessibility: AvatarAccessibility {
AvatarAccessibility(label: "User Avatar", hint: "Displays user status and initials or image")
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Foundation
import SDDSComponents

public extension SDDSServeB2CStyle {
var defaultButtonAppearance: ButtonAppearance {
extension SDDSServeB2CStyle {
public var defaultButtonAppearance: ButtonAppearance {
switch self {
case .default:
return .default
Expand All @@ -25,7 +25,7 @@ public extension SDDSServeB2CStyle {
}
}

var defaultLinkButtonAppearance: ButtonAppearance {
public var defaultLinkButtonAppearance: ButtonAppearance {
switch self {
case .default:
return .linkDefault
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ public extension CheckboxAppearance {
subtitleTypography: RadioboxTypography.description,
titleColor: .backgroundInversePrimary,
subtitleColor: .surfaceInverseSolidPrimary.withOpacity(0.56),
disabledAlpha: 0.4,
imageTintColor: .surfaceDefaultAccent
disabledAlpha: 0.4
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import SDDSComponents
- maxColumns: Максимальное количество столбцов в ряду.
- alignment: Выравнивание группы чипов.
*/
public struct DefaultChipGroupSize: ChipGroupSizeConfiguration {
public struct DefaultChipGroupSize: ChipGroupSizeConfiguration, Hashable {
public var debugDescription: String {
String(reflecting: self)
alignment.rawValue
}

public var insets: EdgeInsets {
Expand All @@ -29,4 +29,12 @@ public struct DefaultChipGroupSize: ChipGroupSizeConfiguration {
public init(alignment: ChipGroupAlignment = .center) {
self.alignment = alignment
}

public static var allCases: [DefaultChipGroupSize] {
[.init(alignment: .center), .init(alignment: .left), .init(alignment: .right), .init(alignment: .decreasingLeft), .init(alignment: .decreasingRight)]
}

public func hash(into hasher: inout Hasher) {
hasher.combine(alignment)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct SDDSChipGroupPreview: PreviewProvider {
let chipSize = SDDSChipSize.medium(.pilled)
let chipAccessibility = ChipAccessibility()

let chipData = (1...12).map { index in
let chipData = (1...32).map { index in
ChipData(
title: "Label",
isEnabled: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public extension RadioboxAppearance {
subtitleTypography: RadioboxTypography.description,
titleColor: .backgroundInversePrimary,
subtitleColor: .surfaceInverseSolidPrimary.withOpacity(0.56),
disabledAlpha: 0.4,
imageTintColor: .surfaceDefaultAccent
disabledAlpha: 0.4,
imageTintColor: nil
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import Foundation
import SDDSComponents
import SwiftUI
import SDDSServTheme

// MARK: - Preview

struct SDDSTextAreaPreview: PreviewProvider {
static var previews: some View {
let chips = (1...12).map { index in
ChipData(
title: "Label",
isEnabled: true,
iconImage: nil,
buttonImage: Image.image("textFieldChipIcon"),
appearance: .textArea,
size: TextAreaChipSize.medium,
accessibility: ChipAccessibility(),
removeAction: {}
)
}

return Group {
SDDSTextArea(
value: .constant(.single("")),
title: "Title",
optionalTitle: "optional",
placeholder: "Placeholder",
caption: "caption",
counter: "counter",
disabled: false,
readOnly: false,
style: .default,
labelPlacement: .none,
required: true,
requiredPlacement: .left,
appearance: .defaultAppearance,
size: SDDSTextAreaSize.medium,
chipGroupSize: SDDSTextAreaSize.large.chipGroupSize,
layout: .default,
iconActionViewProvider: ViewProvider(iconActionView)
)
.previewDisplayName("Outer Label")
.previewLayout(.sizeThatFits)
.padding()

SDDSTextArea(
value: .constant(.multiple("", chips)),
title: "Title",
optionalTitle: "optional",
placeholder: "Placeholder",
caption: "caption",
counter: "counter",
disabled: false,
style: .default,
labelPlacement: .none,
required: true,
requiredPlacement: .left,
appearance: .defaultAppearance,
size: SDDSTextAreaSize.large,
chipGroupSize: SDDSTextAreaSize.large.chipGroupSize,
layout: .default,
iconActionViewProvider: ViewProvider(iconActionView)
)
.previewDisplayName("Multiple – Default Label")
.previewLayout(.sizeThatFits)
.padding()
}
}

@ViewBuilder
private static var iconView: some View {
Image.image("textFieldIcon")
.renderingMode(.template)
.resizable()
.aspectRatio(contentMode: .fit)
}

@ViewBuilder
private static var iconActionView: some View {
Image.image("textFieldIconAction")
.renderingMode(.template)
.resizable()
.aspectRatio(contentMode: .fit)

}
}
Loading

0 comments on commit c7dc1d8

Please sign in to comment.