@astryxdesign/native 0.7.5-canary.f2dafed → 0.7.5-canary.fccd771
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -2
- package/apple/Sources/AstryxNative/Generated/Button.swift +78 -0
- package/apple/Sources/AstryxNative/Generated/Divider.swift +45 -0
- package/apple/Sources/AstryxNative/Generated/Heading.swift +97 -0
- package/apple/Sources/AstryxNative/Generated/ProgressBar.swift +72 -0
- package/apple/Sources/AstryxNative/Generated/Switch.swift +106 -0
- package/apple/Sources/AstryxNative/Generated/Text.swift +100 -0
- package/apple/Sources/AstryxNative/Generated/TextInput.swift +129 -0
- package/apple/Tests/AstryxNativeTests/ControlPropsTests.swift +27 -0
- package/dist/components/Button.d.ts +10 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +15 -0
- package/dist/components/Divider.d.ts +10 -0
- package/dist/components/Divider.d.ts.map +1 -0
- package/dist/components/Divider.js +6 -0
- package/dist/components/Heading.d.ts +10 -0
- package/dist/components/Heading.d.ts.map +1 -0
- package/dist/components/Heading.js +14 -0
- package/dist/components/ProgressBar.d.ts +10 -0
- package/dist/components/ProgressBar.d.ts.map +1 -0
- package/dist/components/ProgressBar.js +5 -0
- package/dist/components/Switch.d.ts +10 -0
- package/dist/components/Switch.d.ts.map +1 -0
- package/dist/components/Switch.js +6 -0
- package/dist/components/Text.d.ts +10 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/Text.js +13 -0
- package/dist/components/TextInput.d.ts +10 -0
- package/dist/components/TextInput.d.ts.map +1 -0
- package/dist/components/TextInput.js +9 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +17 -1
- package/dist/contract/fromComponentDoc.d.ts +43 -5
- package/dist/contract/fromComponentDoc.d.ts.map +1 -1
- package/dist/contract/fromComponentDoc.js +46 -4
- package/dist/contract/generateSwift.d.ts.map +1 -1
- package/dist/contract/generateSwift.js +11 -0
- package/dist/contract/generateTypeScript.d.ts.map +1 -1
- package/dist/contract/generateTypeScript.js +2 -0
- package/dist/contract/index.d.ts +7 -3
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +2 -1
- package/dist/contract/parseDocType.d.ts +5 -2
- package/dist/contract/parseDocType.d.ts.map +1 -1
- package/dist/contract/parseDocType.js +34 -5
- package/dist/contract/rules.d.ts +5 -2
- package/dist/contract/rules.d.ts.map +1 -1
- package/dist/contract/rules.js +8 -4
- package/dist/contract/types.d.ts +7 -0
- package/dist/contract/types.d.ts.map +1 -1
- package/dist/types/android.d.ts +23 -2
- package/dist/types/core.d.ts +97 -0
- package/dist/types/ios.d.ts +23 -2
- package/dist/types/macos.d.ts +23 -2
- package/dist/types/shared.d.ts +23 -2
- package/dist/types/windows.d.ts +23 -2
- package/package.json +3 -3
- package/src/components/Button.ts +26 -0
- package/src/components/Divider.ts +17 -0
- package/src/components/Heading.ts +25 -0
- package/src/components/ProgressBar.ts +16 -0
- package/src/components/Switch.ts +17 -0
- package/src/components/Text.ts +24 -0
- package/src/components/TextInput.ts +20 -0
- package/src/components/index.ts +17 -1
- package/src/contract/contracts.test.ts +27 -0
- package/src/contract/fromComponentDoc.test.ts +97 -0
- package/src/contract/fromComponentDoc.ts +104 -9
- package/src/contract/generateSwift.ts +16 -0
- package/src/contract/generateTypeScript.ts +2 -0
- package/src/contract/index.ts +13 -4
- package/src/contract/parseDocType.test.ts +45 -0
- package/src/contract/parseDocType.ts +41 -6
- package/src/contract/rules.ts +11 -4
- package/src/contract/types.ts +4 -0
package/README.md
CHANGED
|
@@ -20,8 +20,9 @@ rests on evidence.
|
|
|
20
20
|
| Native theme | `defineNativeTheme` | Durable theme intent (`material: 'opaque' \| 'translucent'`) plus platform entries scoped by OS version, such as Liquid Glass from iOS 26. Never sets tokens. |
|
|
21
21
|
| Icons | `NATIVE_ICON_DEFAULTS` | Astryx's built-in icon names mapped to SF Symbols on Apple platforms and Material Symbols on Android. |
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
are not built yet; see
|
|
23
|
+
Contracts cover Button, Divider, Heading, ProgressBar, Selector, Switch, Text,
|
|
24
|
+
and TextInput. React Native and Android bindings are not built yet; see
|
|
25
|
+
[the experiment matrix](#experiment-matrix).
|
|
25
26
|
|
|
26
27
|
```ts
|
|
27
28
|
// tsconfig.json for an iOS app: "customConditions": ["ios"]
|
|
@@ -34,6 +35,22 @@ const props: SelectorProps = {
|
|
|
34
35
|
};
|
|
35
36
|
```
|
|
36
37
|
|
|
38
|
+
How core documentation becomes a contract:
|
|
39
|
+
|
|
40
|
+
- A callback whose arguments are values followed by the DOM event that caused
|
|
41
|
+
them, such as `(checked: boolean, e: ChangeEvent) => void`, keeps the values
|
|
42
|
+
in the core; the event stays on the web.
|
|
43
|
+
- A callback that carries only an event stays on the web, unless the component
|
|
44
|
+
names it in `callbacks`, as Button does for `onClick`. Its core form takes no
|
|
45
|
+
arguments. A callback with an event before a value stays on the web either
|
|
46
|
+
way.
|
|
47
|
+
- Free-form content becomes a typed slot only where a component declares one
|
|
48
|
+
in `slots`; `text` is a string, as for a badge's label or a heading's words.
|
|
49
|
+
- A closed set of numbers, such as a heading level, is a Swift enum with raw
|
|
50
|
+
values.
|
|
51
|
+
- A core prop may share a platform toolkit's name only when the component
|
|
52
|
+
declares in `sameMeaning` that it means the same thing there.
|
|
53
|
+
|
|
37
54
|
## Working on it
|
|
38
55
|
|
|
39
56
|
```sh
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
public enum ButtonVariant: String, CaseIterable, Sendable {
|
|
3
|
+
case primary = "primary"
|
|
4
|
+
case secondary = "secondary"
|
|
5
|
+
case ghost = "ghost"
|
|
6
|
+
case destructive = "destructive"
|
|
7
|
+
}
|
|
8
|
+
public enum ButtonSize: String, CaseIterable, Sendable {
|
|
9
|
+
case sm = "sm"
|
|
10
|
+
case md = "md"
|
|
11
|
+
case lg = "lg"
|
|
12
|
+
}
|
|
13
|
+
public enum ButtonElevation: String, CaseIterable, Sendable {
|
|
14
|
+
case none = "none"
|
|
15
|
+
case low = "low"
|
|
16
|
+
case med = "med"
|
|
17
|
+
case high = "high"
|
|
18
|
+
}
|
|
19
|
+
#if os(iOS)
|
|
20
|
+
public struct ButtonProps {
|
|
21
|
+
/// Base props attach to this part on every platform.
|
|
22
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
23
|
+
public var base: AstryxBaseProps
|
|
24
|
+
public var label: String
|
|
25
|
+
public var variant: ButtonVariant?
|
|
26
|
+
public var size: ButtonSize?
|
|
27
|
+
public var elevation: ButtonElevation?
|
|
28
|
+
public var isLoading: Bool?
|
|
29
|
+
public var isInterruptible: Bool?
|
|
30
|
+
public var isDisabled: Bool?
|
|
31
|
+
public var tooltip: String?
|
|
32
|
+
public var onClick: (() -> Void)?
|
|
33
|
+
public var href: String?
|
|
34
|
+
public init(label: String, variant: ButtonVariant? = nil, size: ButtonSize? = nil, elevation: ButtonElevation? = nil, isLoading: Bool? = nil, isInterruptible: Bool? = nil, isDisabled: Bool? = nil, tooltip: String? = nil, onClick: (() -> Void)? = nil, href: String? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
35
|
+
self.label = label
|
|
36
|
+
self.variant = variant
|
|
37
|
+
self.size = size
|
|
38
|
+
self.elevation = elevation
|
|
39
|
+
self.isLoading = isLoading
|
|
40
|
+
self.isInterruptible = isInterruptible
|
|
41
|
+
self.isDisabled = isDisabled
|
|
42
|
+
self.tooltip = tooltip
|
|
43
|
+
self.onClick = onClick
|
|
44
|
+
self.href = href
|
|
45
|
+
self.base = base
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
#endif
|
|
49
|
+
#if os(macOS)
|
|
50
|
+
public struct ButtonProps {
|
|
51
|
+
/// Base props attach to this part on every platform.
|
|
52
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
53
|
+
public var base: AstryxBaseProps
|
|
54
|
+
public var label: String
|
|
55
|
+
public var variant: ButtonVariant?
|
|
56
|
+
public var size: ButtonSize?
|
|
57
|
+
public var elevation: ButtonElevation?
|
|
58
|
+
public var isLoading: Bool?
|
|
59
|
+
public var isInterruptible: Bool?
|
|
60
|
+
public var isDisabled: Bool?
|
|
61
|
+
public var tooltip: String?
|
|
62
|
+
public var onClick: (() -> Void)?
|
|
63
|
+
public var href: String?
|
|
64
|
+
public init(label: String, variant: ButtonVariant? = nil, size: ButtonSize? = nil, elevation: ButtonElevation? = nil, isLoading: Bool? = nil, isInterruptible: Bool? = nil, isDisabled: Bool? = nil, tooltip: String? = nil, onClick: (() -> Void)? = nil, href: String? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
65
|
+
self.label = label
|
|
66
|
+
self.variant = variant
|
|
67
|
+
self.size = size
|
|
68
|
+
self.elevation = elevation
|
|
69
|
+
self.isLoading = isLoading
|
|
70
|
+
self.isInterruptible = isInterruptible
|
|
71
|
+
self.isDisabled = isDisabled
|
|
72
|
+
self.tooltip = tooltip
|
|
73
|
+
self.onClick = onClick
|
|
74
|
+
self.href = href
|
|
75
|
+
self.base = base
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
#endif
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
public enum DividerOrientation: String, CaseIterable, Sendable {
|
|
3
|
+
case horizontal = "horizontal"
|
|
4
|
+
case vertical = "vertical"
|
|
5
|
+
}
|
|
6
|
+
public enum DividerVariant: String, CaseIterable, Sendable {
|
|
7
|
+
case subtle = "subtle"
|
|
8
|
+
case strong = "strong"
|
|
9
|
+
}
|
|
10
|
+
#if os(iOS)
|
|
11
|
+
public struct DividerProps {
|
|
12
|
+
/// Base props attach to this part on every platform.
|
|
13
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
14
|
+
public var base: AstryxBaseProps
|
|
15
|
+
public var orientation: DividerOrientation?
|
|
16
|
+
public var label: String?
|
|
17
|
+
public var variant: DividerVariant?
|
|
18
|
+
public var isFullBleed: Bool?
|
|
19
|
+
public init(orientation: DividerOrientation? = nil, label: String? = nil, variant: DividerVariant? = nil, isFullBleed: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
20
|
+
self.orientation = orientation
|
|
21
|
+
self.label = label
|
|
22
|
+
self.variant = variant
|
|
23
|
+
self.isFullBleed = isFullBleed
|
|
24
|
+
self.base = base
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
#endif
|
|
28
|
+
#if os(macOS)
|
|
29
|
+
public struct DividerProps {
|
|
30
|
+
/// Base props attach to this part on every platform.
|
|
31
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
32
|
+
public var base: AstryxBaseProps
|
|
33
|
+
public var orientation: DividerOrientation?
|
|
34
|
+
public var label: String?
|
|
35
|
+
public var variant: DividerVariant?
|
|
36
|
+
public var isFullBleed: Bool?
|
|
37
|
+
public init(orientation: DividerOrientation? = nil, label: String? = nil, variant: DividerVariant? = nil, isFullBleed: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
38
|
+
self.orientation = orientation
|
|
39
|
+
self.label = label
|
|
40
|
+
self.variant = variant
|
|
41
|
+
self.isFullBleed = isFullBleed
|
|
42
|
+
self.base = base
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
#endif
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
public enum HeadingLevel: Int, CaseIterable, Sendable {
|
|
3
|
+
case v1 = 1
|
|
4
|
+
case v2 = 2
|
|
5
|
+
case v3 = 3
|
|
6
|
+
case v4 = 4
|
|
7
|
+
case v5 = 5
|
|
8
|
+
case v6 = 6
|
|
9
|
+
}
|
|
10
|
+
public enum HeadingType: String, CaseIterable, Sendable {
|
|
11
|
+
case display1 = "display-1"
|
|
12
|
+
case display2 = "display-2"
|
|
13
|
+
case display3 = "display-3"
|
|
14
|
+
}
|
|
15
|
+
public enum HeadingWeight: String, CaseIterable, Sendable {
|
|
16
|
+
case normal = "normal"
|
|
17
|
+
case medium = "medium"
|
|
18
|
+
case semibold = "semibold"
|
|
19
|
+
case bold = "bold"
|
|
20
|
+
}
|
|
21
|
+
public enum HeadingAccessibilityLevel: Int, CaseIterable, Sendable {
|
|
22
|
+
case v1 = 1
|
|
23
|
+
case v2 = 2
|
|
24
|
+
case v3 = 3
|
|
25
|
+
case v4 = 4
|
|
26
|
+
case v5 = 5
|
|
27
|
+
case v6 = 6
|
|
28
|
+
}
|
|
29
|
+
public enum HeadingColor: String, CaseIterable, Sendable {
|
|
30
|
+
case primary = "primary"
|
|
31
|
+
case secondary = "secondary"
|
|
32
|
+
case disabled = "disabled"
|
|
33
|
+
case placeholder = "placeholder"
|
|
34
|
+
case accent = "accent"
|
|
35
|
+
case inherit = "inherit"
|
|
36
|
+
}
|
|
37
|
+
public enum HeadingJustify: String, CaseIterable, Sendable {
|
|
38
|
+
case start = "start"
|
|
39
|
+
case center = "center"
|
|
40
|
+
case end = "end"
|
|
41
|
+
}
|
|
42
|
+
#if os(iOS)
|
|
43
|
+
public struct HeadingProps {
|
|
44
|
+
/// Base props attach to this part on every platform.
|
|
45
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
46
|
+
public var base: AstryxBaseProps
|
|
47
|
+
public var level: HeadingLevel
|
|
48
|
+
public var type: HeadingType?
|
|
49
|
+
public var weight: HeadingWeight?
|
|
50
|
+
public var children: String
|
|
51
|
+
public var accessibilityLevel: HeadingAccessibilityLevel?
|
|
52
|
+
public var color: HeadingColor?
|
|
53
|
+
public var maxLines: Double?
|
|
54
|
+
public var justify: HeadingJustify?
|
|
55
|
+
public var hasStrikethrough: Bool?
|
|
56
|
+
public init(level: HeadingLevel, type: HeadingType? = nil, weight: HeadingWeight? = nil, children: String, accessibilityLevel: HeadingAccessibilityLevel? = nil, color: HeadingColor? = nil, maxLines: Double? = nil, justify: HeadingJustify? = nil, hasStrikethrough: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
57
|
+
self.level = level
|
|
58
|
+
self.type = type
|
|
59
|
+
self.weight = weight
|
|
60
|
+
self.children = children
|
|
61
|
+
self.accessibilityLevel = accessibilityLevel
|
|
62
|
+
self.color = color
|
|
63
|
+
self.maxLines = maxLines
|
|
64
|
+
self.justify = justify
|
|
65
|
+
self.hasStrikethrough = hasStrikethrough
|
|
66
|
+
self.base = base
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
#endif
|
|
70
|
+
#if os(macOS)
|
|
71
|
+
public struct HeadingProps {
|
|
72
|
+
/// Base props attach to this part on every platform.
|
|
73
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
74
|
+
public var base: AstryxBaseProps
|
|
75
|
+
public var level: HeadingLevel
|
|
76
|
+
public var type: HeadingType?
|
|
77
|
+
public var weight: HeadingWeight?
|
|
78
|
+
public var children: String
|
|
79
|
+
public var accessibilityLevel: HeadingAccessibilityLevel?
|
|
80
|
+
public var color: HeadingColor?
|
|
81
|
+
public var maxLines: Double?
|
|
82
|
+
public var justify: HeadingJustify?
|
|
83
|
+
public var hasStrikethrough: Bool?
|
|
84
|
+
public init(level: HeadingLevel, type: HeadingType? = nil, weight: HeadingWeight? = nil, children: String, accessibilityLevel: HeadingAccessibilityLevel? = nil, color: HeadingColor? = nil, maxLines: Double? = nil, justify: HeadingJustify? = nil, hasStrikethrough: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
85
|
+
self.level = level
|
|
86
|
+
self.type = type
|
|
87
|
+
self.weight = weight
|
|
88
|
+
self.children = children
|
|
89
|
+
self.accessibilityLevel = accessibilityLevel
|
|
90
|
+
self.color = color
|
|
91
|
+
self.maxLines = maxLines
|
|
92
|
+
self.justify = justify
|
|
93
|
+
self.hasStrikethrough = hasStrikethrough
|
|
94
|
+
self.base = base
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
#endif
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
public enum ProgressBarVariant: String, CaseIterable, Sendable {
|
|
3
|
+
case accent = "accent"
|
|
4
|
+
case success = "success"
|
|
5
|
+
case warning = "warning"
|
|
6
|
+
case error = "error"
|
|
7
|
+
case neutral = "neutral"
|
|
8
|
+
}
|
|
9
|
+
public struct ProgressBarMarks: Equatable, Sendable {
|
|
10
|
+
public var value: Double
|
|
11
|
+
public var label: String
|
|
12
|
+
public init(value: Double, label: String) {
|
|
13
|
+
self.value = value
|
|
14
|
+
self.label = label
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
#if os(iOS)
|
|
18
|
+
public struct ProgressBarProps {
|
|
19
|
+
/// Base props attach to this part on every platform.
|
|
20
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
21
|
+
public var base: AstryxBaseProps
|
|
22
|
+
public var label: String
|
|
23
|
+
public var value: Double?
|
|
24
|
+
public var max: Double?
|
|
25
|
+
public var isLabelHidden: Bool?
|
|
26
|
+
public var hasValueLabel: Bool?
|
|
27
|
+
public var variant: ProgressBarVariant?
|
|
28
|
+
public var isIndeterminate: Bool?
|
|
29
|
+
public var marks: [ProgressBarMarks]?
|
|
30
|
+
public var isDisabled: Bool?
|
|
31
|
+
public init(label: String, value: Double? = nil, max: Double? = nil, isLabelHidden: Bool? = nil, hasValueLabel: Bool? = nil, variant: ProgressBarVariant? = nil, isIndeterminate: Bool? = nil, marks: [ProgressBarMarks]? = nil, isDisabled: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
32
|
+
self.label = label
|
|
33
|
+
self.value = value
|
|
34
|
+
self.max = max
|
|
35
|
+
self.isLabelHidden = isLabelHidden
|
|
36
|
+
self.hasValueLabel = hasValueLabel
|
|
37
|
+
self.variant = variant
|
|
38
|
+
self.isIndeterminate = isIndeterminate
|
|
39
|
+
self.marks = marks
|
|
40
|
+
self.isDisabled = isDisabled
|
|
41
|
+
self.base = base
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
#endif
|
|
45
|
+
#if os(macOS)
|
|
46
|
+
public struct ProgressBarProps {
|
|
47
|
+
/// Base props attach to this part on every platform.
|
|
48
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
49
|
+
public var base: AstryxBaseProps
|
|
50
|
+
public var label: String
|
|
51
|
+
public var value: Double?
|
|
52
|
+
public var max: Double?
|
|
53
|
+
public var isLabelHidden: Bool?
|
|
54
|
+
public var hasValueLabel: Bool?
|
|
55
|
+
public var variant: ProgressBarVariant?
|
|
56
|
+
public var isIndeterminate: Bool?
|
|
57
|
+
public var marks: [ProgressBarMarks]?
|
|
58
|
+
public var isDisabled: Bool?
|
|
59
|
+
public init(label: String, value: Double? = nil, max: Double? = nil, isLabelHidden: Bool? = nil, hasValueLabel: Bool? = nil, variant: ProgressBarVariant? = nil, isIndeterminate: Bool? = nil, marks: [ProgressBarMarks]? = nil, isDisabled: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
60
|
+
self.label = label
|
|
61
|
+
self.value = value
|
|
62
|
+
self.max = max
|
|
63
|
+
self.isLabelHidden = isLabelHidden
|
|
64
|
+
self.hasValueLabel = hasValueLabel
|
|
65
|
+
self.variant = variant
|
|
66
|
+
self.isIndeterminate = isIndeterminate
|
|
67
|
+
self.marks = marks
|
|
68
|
+
self.isDisabled = isDisabled
|
|
69
|
+
self.base = base
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
#endif
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
public enum SwitchSize: String, CaseIterable, Sendable {
|
|
3
|
+
case sm = "sm"
|
|
4
|
+
case md = "md"
|
|
5
|
+
}
|
|
6
|
+
public enum SwitchStatusType: String, CaseIterable, Sendable {
|
|
7
|
+
case warning = "warning"
|
|
8
|
+
case error = "error"
|
|
9
|
+
case success = "success"
|
|
10
|
+
}
|
|
11
|
+
public struct SwitchStatus: Equatable, Sendable {
|
|
12
|
+
public var type: SwitchStatusType
|
|
13
|
+
public var message: String?
|
|
14
|
+
public init(type: SwitchStatusType, message: String? = nil) {
|
|
15
|
+
self.type = type
|
|
16
|
+
self.message = message
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
public enum SwitchLabelPosition: String, CaseIterable, Sendable {
|
|
20
|
+
case start = "start"
|
|
21
|
+
case end = "end"
|
|
22
|
+
}
|
|
23
|
+
public enum SwitchLabelSpacing: String, CaseIterable, Sendable {
|
|
24
|
+
case hug = "hug"
|
|
25
|
+
case spread = "spread"
|
|
26
|
+
}
|
|
27
|
+
#if os(iOS)
|
|
28
|
+
public struct SwitchProps {
|
|
29
|
+
/// Base props attach to this part on every platform.
|
|
30
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
31
|
+
public var base: AstryxBaseProps
|
|
32
|
+
public var label: String
|
|
33
|
+
public var value: Bool
|
|
34
|
+
public var onChange: ((Bool) -> Void)?
|
|
35
|
+
public var isLoading: Bool?
|
|
36
|
+
public var isLabelHidden: Bool?
|
|
37
|
+
public var description: String?
|
|
38
|
+
public var isDisabled: Bool?
|
|
39
|
+
public var size: SwitchSize?
|
|
40
|
+
public var disabledMessage: String?
|
|
41
|
+
public var isOptional: Bool?
|
|
42
|
+
public var isRequired: Bool?
|
|
43
|
+
public var status: SwitchStatus?
|
|
44
|
+
public var labelTooltip: String?
|
|
45
|
+
public var labelPosition: SwitchLabelPosition?
|
|
46
|
+
public var labelSpacing: SwitchLabelSpacing?
|
|
47
|
+
public init(label: String, value: Bool, onChange: ((Bool) -> Void)? = nil, isLoading: Bool? = nil, isLabelHidden: Bool? = nil, description: String? = nil, isDisabled: Bool? = nil, size: SwitchSize? = nil, disabledMessage: String? = nil, isOptional: Bool? = nil, isRequired: Bool? = nil, status: SwitchStatus? = nil, labelTooltip: String? = nil, labelPosition: SwitchLabelPosition? = nil, labelSpacing: SwitchLabelSpacing? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
48
|
+
self.label = label
|
|
49
|
+
self.value = value
|
|
50
|
+
self.onChange = onChange
|
|
51
|
+
self.isLoading = isLoading
|
|
52
|
+
self.isLabelHidden = isLabelHidden
|
|
53
|
+
self.description = description
|
|
54
|
+
self.isDisabled = isDisabled
|
|
55
|
+
self.size = size
|
|
56
|
+
self.disabledMessage = disabledMessage
|
|
57
|
+
self.isOptional = isOptional
|
|
58
|
+
self.isRequired = isRequired
|
|
59
|
+
self.status = status
|
|
60
|
+
self.labelTooltip = labelTooltip
|
|
61
|
+
self.labelPosition = labelPosition
|
|
62
|
+
self.labelSpacing = labelSpacing
|
|
63
|
+
self.base = base
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
#endif
|
|
67
|
+
#if os(macOS)
|
|
68
|
+
public struct SwitchProps {
|
|
69
|
+
/// Base props attach to this part on every platform.
|
|
70
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
71
|
+
public var base: AstryxBaseProps
|
|
72
|
+
public var label: String
|
|
73
|
+
public var value: Bool
|
|
74
|
+
public var onChange: ((Bool) -> Void)?
|
|
75
|
+
public var isLoading: Bool?
|
|
76
|
+
public var isLabelHidden: Bool?
|
|
77
|
+
public var description: String?
|
|
78
|
+
public var isDisabled: Bool?
|
|
79
|
+
public var size: SwitchSize?
|
|
80
|
+
public var disabledMessage: String?
|
|
81
|
+
public var isOptional: Bool?
|
|
82
|
+
public var isRequired: Bool?
|
|
83
|
+
public var status: SwitchStatus?
|
|
84
|
+
public var labelTooltip: String?
|
|
85
|
+
public var labelPosition: SwitchLabelPosition?
|
|
86
|
+
public var labelSpacing: SwitchLabelSpacing?
|
|
87
|
+
public init(label: String, value: Bool, onChange: ((Bool) -> Void)? = nil, isLoading: Bool? = nil, isLabelHidden: Bool? = nil, description: String? = nil, isDisabled: Bool? = nil, size: SwitchSize? = nil, disabledMessage: String? = nil, isOptional: Bool? = nil, isRequired: Bool? = nil, status: SwitchStatus? = nil, labelTooltip: String? = nil, labelPosition: SwitchLabelPosition? = nil, labelSpacing: SwitchLabelSpacing? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
88
|
+
self.label = label
|
|
89
|
+
self.value = value
|
|
90
|
+
self.onChange = onChange
|
|
91
|
+
self.isLoading = isLoading
|
|
92
|
+
self.isLabelHidden = isLabelHidden
|
|
93
|
+
self.description = description
|
|
94
|
+
self.isDisabled = isDisabled
|
|
95
|
+
self.size = size
|
|
96
|
+
self.disabledMessage = disabledMessage
|
|
97
|
+
self.isOptional = isOptional
|
|
98
|
+
self.isRequired = isRequired
|
|
99
|
+
self.status = status
|
|
100
|
+
self.labelTooltip = labelTooltip
|
|
101
|
+
self.labelPosition = labelPosition
|
|
102
|
+
self.labelSpacing = labelSpacing
|
|
103
|
+
self.base = base
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
#endif
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
public enum TextType: String, CaseIterable, Sendable {
|
|
3
|
+
case body = "body"
|
|
4
|
+
case large = "large"
|
|
5
|
+
case label = "label"
|
|
6
|
+
case supporting = "supporting"
|
|
7
|
+
case code = "code"
|
|
8
|
+
case display1 = "display-1"
|
|
9
|
+
case display2 = "display-2"
|
|
10
|
+
case display3 = "display-3"
|
|
11
|
+
case inherit = "inherit"
|
|
12
|
+
}
|
|
13
|
+
public enum TextSize: String, CaseIterable, Sendable {
|
|
14
|
+
case v4xs = "4xs"
|
|
15
|
+
case v3xs = "3xs"
|
|
16
|
+
case v2xs = "2xs"
|
|
17
|
+
case xsm = "xsm"
|
|
18
|
+
case sm = "sm"
|
|
19
|
+
case base = "base"
|
|
20
|
+
case lg = "lg"
|
|
21
|
+
case xl = "xl"
|
|
22
|
+
case v2xl = "2xl"
|
|
23
|
+
case v3xl = "3xl"
|
|
24
|
+
case v4xl = "4xl"
|
|
25
|
+
}
|
|
26
|
+
public enum TextColor: String, CaseIterable, Sendable {
|
|
27
|
+
case primary = "primary"
|
|
28
|
+
case secondary = "secondary"
|
|
29
|
+
case disabled = "disabled"
|
|
30
|
+
case placeholder = "placeholder"
|
|
31
|
+
case accent = "accent"
|
|
32
|
+
case inherit = "inherit"
|
|
33
|
+
}
|
|
34
|
+
public enum TextWeight: String, CaseIterable, Sendable {
|
|
35
|
+
case normal = "normal"
|
|
36
|
+
case medium = "medium"
|
|
37
|
+
case semibold = "semibold"
|
|
38
|
+
case bold = "bold"
|
|
39
|
+
}
|
|
40
|
+
public enum TextJustify: String, CaseIterable, Sendable {
|
|
41
|
+
case start = "start"
|
|
42
|
+
case center = "center"
|
|
43
|
+
case end = "end"
|
|
44
|
+
}
|
|
45
|
+
#if os(iOS)
|
|
46
|
+
public struct TextProps {
|
|
47
|
+
/// Base props attach to this part on every platform.
|
|
48
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
49
|
+
public var base: AstryxBaseProps
|
|
50
|
+
public var type: TextType?
|
|
51
|
+
public var children: String
|
|
52
|
+
public var size: TextSize?
|
|
53
|
+
public var color: TextColor?
|
|
54
|
+
public var weight: TextWeight?
|
|
55
|
+
public var maxLines: Double?
|
|
56
|
+
public var justify: TextJustify?
|
|
57
|
+
public var hasStrikethrough: Bool?
|
|
58
|
+
public var hasTabularNumbers: Bool?
|
|
59
|
+
public init(type: TextType? = nil, children: String, size: TextSize? = nil, color: TextColor? = nil, weight: TextWeight? = nil, maxLines: Double? = nil, justify: TextJustify? = nil, hasStrikethrough: Bool? = nil, hasTabularNumbers: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
60
|
+
self.type = type
|
|
61
|
+
self.children = children
|
|
62
|
+
self.size = size
|
|
63
|
+
self.color = color
|
|
64
|
+
self.weight = weight
|
|
65
|
+
self.maxLines = maxLines
|
|
66
|
+
self.justify = justify
|
|
67
|
+
self.hasStrikethrough = hasStrikethrough
|
|
68
|
+
self.hasTabularNumbers = hasTabularNumbers
|
|
69
|
+
self.base = base
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
#endif
|
|
73
|
+
#if os(macOS)
|
|
74
|
+
public struct TextProps {
|
|
75
|
+
/// Base props attach to this part on every platform.
|
|
76
|
+
public static let baseTarget: AstryxBaseTarget = .root
|
|
77
|
+
public var base: AstryxBaseProps
|
|
78
|
+
public var type: TextType?
|
|
79
|
+
public var children: String
|
|
80
|
+
public var size: TextSize?
|
|
81
|
+
public var color: TextColor?
|
|
82
|
+
public var weight: TextWeight?
|
|
83
|
+
public var maxLines: Double?
|
|
84
|
+
public var justify: TextJustify?
|
|
85
|
+
public var hasStrikethrough: Bool?
|
|
86
|
+
public var hasTabularNumbers: Bool?
|
|
87
|
+
public init(type: TextType? = nil, children: String, size: TextSize? = nil, color: TextColor? = nil, weight: TextWeight? = nil, maxLines: Double? = nil, justify: TextJustify? = nil, hasStrikethrough: Bool? = nil, hasTabularNumbers: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
88
|
+
self.type = type
|
|
89
|
+
self.children = children
|
|
90
|
+
self.size = size
|
|
91
|
+
self.color = color
|
|
92
|
+
self.weight = weight
|
|
93
|
+
self.maxLines = maxLines
|
|
94
|
+
self.justify = justify
|
|
95
|
+
self.hasStrikethrough = hasStrikethrough
|
|
96
|
+
self.hasTabularNumbers = hasTabularNumbers
|
|
97
|
+
self.base = base
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
#endif
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// Generated by @astryxdesign/native. Do not edit.
|
|
2
|
+
public enum TextInputType: String, CaseIterable, Sendable {
|
|
3
|
+
case text = "text"
|
|
4
|
+
case password = "password"
|
|
5
|
+
case email = "email"
|
|
6
|
+
}
|
|
7
|
+
public enum TextInputSize: String, CaseIterable, Sendable {
|
|
8
|
+
case sm = "sm"
|
|
9
|
+
case md = "md"
|
|
10
|
+
case lg = "lg"
|
|
11
|
+
}
|
|
12
|
+
public enum TextInputStatusType: String, CaseIterable, Sendable {
|
|
13
|
+
case error = "error"
|
|
14
|
+
case warning = "warning"
|
|
15
|
+
case success = "success"
|
|
16
|
+
}
|
|
17
|
+
public struct TextInputStatus: Equatable, Sendable {
|
|
18
|
+
public var type: TextInputStatusType
|
|
19
|
+
public var message: String?
|
|
20
|
+
public init(type: TextInputStatusType, message: String? = nil) {
|
|
21
|
+
self.type = type
|
|
22
|
+
self.message = message
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
public enum TextInputStatusVariant: String, CaseIterable, Sendable {
|
|
26
|
+
case attached = "attached"
|
|
27
|
+
case detached = "detached"
|
|
28
|
+
case tooltip = "tooltip"
|
|
29
|
+
}
|
|
30
|
+
#if os(iOS)
|
|
31
|
+
public struct TextInputProps {
|
|
32
|
+
/// Base props attach to this part on every platform.
|
|
33
|
+
public static let baseTarget: AstryxBaseTarget = .control
|
|
34
|
+
public var base: AstryxBaseProps
|
|
35
|
+
public var type: TextInputType?
|
|
36
|
+
public var label: String
|
|
37
|
+
public var value: String
|
|
38
|
+
public var onChange: ((String) -> Void)?
|
|
39
|
+
public var size: TextInputSize?
|
|
40
|
+
public var isLabelHidden: Bool?
|
|
41
|
+
public var description: String?
|
|
42
|
+
public var isOptional: Bool?
|
|
43
|
+
public var isRequired: Bool?
|
|
44
|
+
public var onEnter: (() -> Void)?
|
|
45
|
+
public var isDisabled: Bool?
|
|
46
|
+
public var isReadOnly: Bool?
|
|
47
|
+
public var disabledMessage: String?
|
|
48
|
+
public var isLoading: Bool?
|
|
49
|
+
public var placeholder: String?
|
|
50
|
+
public var labelTooltip: String?
|
|
51
|
+
public var status: TextInputStatus?
|
|
52
|
+
public var statusVariant: TextInputStatusVariant?
|
|
53
|
+
public var hasClear: Bool?
|
|
54
|
+
public var hasAutoFocus: Bool?
|
|
55
|
+
public init(type: TextInputType? = nil, label: String, value: String, onChange: ((String) -> Void)? = nil, size: TextInputSize? = nil, isLabelHidden: Bool? = nil, description: String? = nil, isOptional: Bool? = nil, isRequired: Bool? = nil, onEnter: (() -> Void)? = nil, isDisabled: Bool? = nil, isReadOnly: Bool? = nil, disabledMessage: String? = nil, isLoading: Bool? = nil, placeholder: String? = nil, labelTooltip: String? = nil, status: TextInputStatus? = nil, statusVariant: TextInputStatusVariant? = nil, hasClear: Bool? = nil, hasAutoFocus: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
56
|
+
self.type = type
|
|
57
|
+
self.label = label
|
|
58
|
+
self.value = value
|
|
59
|
+
self.onChange = onChange
|
|
60
|
+
self.size = size
|
|
61
|
+
self.isLabelHidden = isLabelHidden
|
|
62
|
+
self.description = description
|
|
63
|
+
self.isOptional = isOptional
|
|
64
|
+
self.isRequired = isRequired
|
|
65
|
+
self.onEnter = onEnter
|
|
66
|
+
self.isDisabled = isDisabled
|
|
67
|
+
self.isReadOnly = isReadOnly
|
|
68
|
+
self.disabledMessage = disabledMessage
|
|
69
|
+
self.isLoading = isLoading
|
|
70
|
+
self.placeholder = placeholder
|
|
71
|
+
self.labelTooltip = labelTooltip
|
|
72
|
+
self.status = status
|
|
73
|
+
self.statusVariant = statusVariant
|
|
74
|
+
self.hasClear = hasClear
|
|
75
|
+
self.hasAutoFocus = hasAutoFocus
|
|
76
|
+
self.base = base
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
#endif
|
|
80
|
+
#if os(macOS)
|
|
81
|
+
public struct TextInputProps {
|
|
82
|
+
/// Base props attach to this part on every platform.
|
|
83
|
+
public static let baseTarget: AstryxBaseTarget = .control
|
|
84
|
+
public var base: AstryxBaseProps
|
|
85
|
+
public var type: TextInputType?
|
|
86
|
+
public var label: String
|
|
87
|
+
public var value: String
|
|
88
|
+
public var onChange: ((String) -> Void)?
|
|
89
|
+
public var size: TextInputSize?
|
|
90
|
+
public var isLabelHidden: Bool?
|
|
91
|
+
public var description: String?
|
|
92
|
+
public var isOptional: Bool?
|
|
93
|
+
public var isRequired: Bool?
|
|
94
|
+
public var onEnter: (() -> Void)?
|
|
95
|
+
public var isDisabled: Bool?
|
|
96
|
+
public var isReadOnly: Bool?
|
|
97
|
+
public var disabledMessage: String?
|
|
98
|
+
public var isLoading: Bool?
|
|
99
|
+
public var placeholder: String?
|
|
100
|
+
public var labelTooltip: String?
|
|
101
|
+
public var status: TextInputStatus?
|
|
102
|
+
public var statusVariant: TextInputStatusVariant?
|
|
103
|
+
public var hasClear: Bool?
|
|
104
|
+
public var hasAutoFocus: Bool?
|
|
105
|
+
public init(type: TextInputType? = nil, label: String, value: String, onChange: ((String) -> Void)? = nil, size: TextInputSize? = nil, isLabelHidden: Bool? = nil, description: String? = nil, isOptional: Bool? = nil, isRequired: Bool? = nil, onEnter: (() -> Void)? = nil, isDisabled: Bool? = nil, isReadOnly: Bool? = nil, disabledMessage: String? = nil, isLoading: Bool? = nil, placeholder: String? = nil, labelTooltip: String? = nil, status: TextInputStatus? = nil, statusVariant: TextInputStatusVariant? = nil, hasClear: Bool? = nil, hasAutoFocus: Bool? = nil, base: AstryxBaseProps = AstryxBaseProps()) {
|
|
106
|
+
self.type = type
|
|
107
|
+
self.label = label
|
|
108
|
+
self.value = value
|
|
109
|
+
self.onChange = onChange
|
|
110
|
+
self.size = size
|
|
111
|
+
self.isLabelHidden = isLabelHidden
|
|
112
|
+
self.description = description
|
|
113
|
+
self.isOptional = isOptional
|
|
114
|
+
self.isRequired = isRequired
|
|
115
|
+
self.onEnter = onEnter
|
|
116
|
+
self.isDisabled = isDisabled
|
|
117
|
+
self.isReadOnly = isReadOnly
|
|
118
|
+
self.disabledMessage = disabledMessage
|
|
119
|
+
self.isLoading = isLoading
|
|
120
|
+
self.placeholder = placeholder
|
|
121
|
+
self.labelTooltip = labelTooltip
|
|
122
|
+
self.status = status
|
|
123
|
+
self.statusVariant = statusVariant
|
|
124
|
+
self.hasClear = hasClear
|
|
125
|
+
self.hasAutoFocus = hasAutoFocus
|
|
126
|
+
self.base = base
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
#endif
|