@astryxdesign/native 0.7.5-canary.fd0aba8 → 0.7.6-canary.5cd7a15
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/apple/Package.swift +1 -1
- package/apple/README.md +8 -15
- package/apple/Sources/Astryx/Banner/Banner.swift +18 -18
- package/apple/Sources/Astryx/Base/BaseProps.swift +5 -0
- package/apple/Sources/Astryx/Base/HitArea.swift +16 -0
- package/apple/Sources/Astryx/Button/Button.spec.md +174 -0
- package/apple/Sources/Astryx/Button/Button.swift +222 -107
- package/apple/Sources/Astryx/Localization/AstryxStrings.swift +25 -0
- package/apple/Sources/Astryx/Resources/af.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/ar.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/ca.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/cs.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/da.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/de.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/el.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/en.lproj/Localizable.strings +24 -0
- package/apple/Sources/Astryx/Resources/es.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/fi.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/fr.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/he.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/hu.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/it.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/ja.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/ko.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/nb.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/nl.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/pl.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/pt-BR.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/pt-PT.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/ro.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/ru.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/sr.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/sv.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/tr.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/uk.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/vi.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/zh-Hans.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/Resources/zh-Hant.lproj/Localizable.strings +21 -0
- package/apple/Sources/Astryx/TextInput/TextInput.spec.md +179 -0
- package/apple/Sources/Astryx/TextInput/TextInput.swift +539 -50
- package/apple/Sources/Astryx/Theme/Theme.swift +5 -5
- package/apple/Sources/Astryx/Wire/AstryxNodeView.swift +2 -0
- package/apple/Tests/AstryxTests/BannerTests.swift +5 -2
- package/apple/Tests/AstryxTests/ButtonTests.swift +100 -4
- package/apple/Tests/AstryxTests/TextInputTests.swift +282 -5
- package/apple/Tests/AstryxTests/TwoThemeTests.swift +69 -0
- package/package.json +3 -3
- package/src/theme/swiftIOSStrings.test.ts +18 -0
package/apple/Package.swift
CHANGED
|
@@ -28,7 +28,7 @@ let package = Package(
|
|
|
28
28
|
dependencies: ["AstryxNative"],
|
|
29
29
|
path: "Sources/Astryx",
|
|
30
30
|
// Each component's spec lives beside its view (AST-093 FR1).
|
|
31
|
-
exclude: ["Avatar/Avatar.spec.md", "Avatar/AvatarStatusDot.spec.md", "Icon/Icon.spec.md", "Thumbnail/Thumbnail.spec.md"],
|
|
31
|
+
exclude: ["Avatar/Avatar.spec.md", "Avatar/AvatarStatusDot.spec.md", "Button/Button.spec.md", "Icon/Icon.spec.md", "TextInput/TextInput.spec.md", "Thumbnail/Thumbnail.spec.md"],
|
|
32
32
|
resources: [.process("Resources")]
|
|
33
33
|
),
|
|
34
34
|
.testTarget(name: "AstryxNativeTests", dependencies: ["AstryxNative"], path: "Tests/AstryxNativeTests"),
|
package/apple/README.md
CHANGED
|
@@ -53,15 +53,10 @@ apple/
|
|
|
53
53
|
that also imports SwiftUI, write `Astryx.Button` and `SwiftUI.Button`. A
|
|
54
54
|
component's parameters use core's prop names
|
|
55
55
|
and values (`variant: .primary`, `size: .lg`, `isLoading`), so code reads
|
|
56
|
-
the same across web and native.
|
|
57
|
-
generated `
|
|
58
|
-
|
|
59
|
-
contracts
|
|
60
|
-
- `Button` takes `action` where core has `onClick`.
|
|
61
|
-
- `Button` takes `fillsWidth` where core has `width="100%"`.
|
|
62
|
-
- `Button` takes `icon` as a shared icon name (`"search"`), which the
|
|
63
|
-
generated `ButtonProps` does not carry yet.
|
|
64
|
-
- `TextInput` takes a `Binding` where core has `value` and `onChange`.
|
|
56
|
+
the same across web and native. Every view with a core contract takes its
|
|
57
|
+
generated `<Name>Props` (AST-093 FR5) and has a labeled initializer that
|
|
58
|
+
builds the same props; `Banner` has no native contract yet (the generated
|
|
59
|
+
contracts do not include it), so its parameters are hand-written.
|
|
65
60
|
- **`Templates/`** holds one folder per page template, named after the
|
|
66
61
|
`astryx template` id. Templates are clone-only, as on the web: you copy a
|
|
67
62
|
template's folder into your app and own it from then on. They are a
|
|
@@ -103,9 +98,9 @@ tokens in the current mode as typed members (`tokens.color.textPrimary`,
|
|
|
103
98
|
`tokens.space.s4`, `tokens.font.body.size`), so a misspelled token fails to
|
|
104
99
|
compile. Font tokens come grouped: each type style (`tokens.font.body`,
|
|
105
100
|
`tokens.font.heading1`) holds its `size`, `weight`, and `leading`, and
|
|
106
|
-
`tokens.font.family`, `.size`, and `.weight` hold the scales. Text sizes grow
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
`tokens.font.family`, `.size`, and `.weight` hold the scales. Text sizes grow
|
|
102
|
+
with Dynamic Type. An app reads the same members for its own SwiftUI layout,
|
|
103
|
+
such as stack spacing (`astryx.tokens.space.s4`).
|
|
109
104
|
|
|
110
105
|
`Icon(.search)` draws a shared icon name as the platform's SF Symbol, at
|
|
111
106
|
core's icon size and color, hidden from VoiceOver unless it has a `label`.
|
|
@@ -198,8 +193,6 @@ system type, read its tokens from `astryx`, and add tests under
|
|
|
198
193
|
|
|
199
194
|
## Not here yet
|
|
200
195
|
|
|
201
|
-
- The views do not use the generated contract types in `AstryxNative` yet.
|
|
202
|
-
Moving them onto those types is how a core prop change reaches Swift.
|
|
203
196
|
- Pixel and behavior parity with the web components has not been measured.
|
|
204
|
-
-
|
|
197
|
+
- Theme-local tokens and platform theme entries
|
|
205
198
|
(`defineNativeTheme`, reserved as `Theme.native`) are not wired in.
|
|
@@ -13,21 +13,21 @@ public enum AstryxBannerStatus: String, CaseIterable, Sendable {
|
|
|
13
13
|
/// theme's or the platform's symbol for it.
|
|
14
14
|
var iconName: String { rawValue }
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
func groundColor(_ color: ColorTokens) -> Color {
|
|
17
17
|
switch self {
|
|
18
|
-
case .info:
|
|
19
|
-
case .warning:
|
|
20
|
-
case .error:
|
|
21
|
-
case .success:
|
|
18
|
+
case .info: color.accentMuted
|
|
19
|
+
case .warning: color.warningMuted
|
|
20
|
+
case .error: color.errorMuted
|
|
21
|
+
case .success: color.successMuted
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
func iconColor(_ color: ColorTokens) -> Color {
|
|
26
26
|
switch self {
|
|
27
|
-
case .info:
|
|
28
|
-
case .warning:
|
|
29
|
-
case .error:
|
|
30
|
-
case .success:
|
|
27
|
+
case .info: color.accent
|
|
28
|
+
case .warning: color.warning
|
|
29
|
+
case .error: color.error
|
|
30
|
+
case .success: color.success
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -48,15 +48,15 @@ public struct Banner: View {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
public var body: some View {
|
|
51
|
-
HStack(alignment: .firstTextBaseline, spacing: astryx.space
|
|
51
|
+
HStack(alignment: .firstTextBaseline, spacing: astryx.tokens.space.s2) {
|
|
52
52
|
if let icon = astryx.icon(status.iconName) {
|
|
53
53
|
// Sized with the title so it grows with Dynamic Type.
|
|
54
|
-
icon.sized(astryx.
|
|
55
|
-
.font(astryx.font(
|
|
56
|
-
.foregroundStyle(astryx.color
|
|
54
|
+
icon.sized(astryx.tokens.font.body.size * astryx.textScale)
|
|
55
|
+
.font(astryx.font(TypeStyle(astryx.tokens.font.body, families: astryx.tokens.font.family.body)))
|
|
56
|
+
.foregroundStyle(status.iconColor(astryx.tokens.color))
|
|
57
57
|
.accessibilityHidden(true)
|
|
58
58
|
}
|
|
59
|
-
VStack(alignment: .leading, spacing: astryx.space
|
|
59
|
+
VStack(alignment: .leading, spacing: astryx.tokens.space.s1) {
|
|
60
60
|
Text(title, weight: .semibold)
|
|
61
61
|
if let description {
|
|
62
62
|
Text(description, color: .secondary)
|
|
@@ -64,10 +64,10 @@ public struct Banner: View {
|
|
|
64
64
|
}
|
|
65
65
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
66
66
|
}
|
|
67
|
-
.padding(astryx.space
|
|
67
|
+
.padding(astryx.tokens.space.s3)
|
|
68
68
|
.background(
|
|
69
|
-
RoundedRectangle(cornerRadius: astryx.
|
|
70
|
-
.fill(astryx.color
|
|
69
|
+
RoundedRectangle(cornerRadius: astryx.tokens.radius.container, style: .continuous)
|
|
70
|
+
.fill(status.groundColor(astryx.tokens.color))
|
|
71
71
|
)
|
|
72
72
|
.accessibilityElement(children: .ignore)
|
|
73
73
|
.accessibilityLabel(SwiftUI.Text(accessibilityText))
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
extension View {
|
|
4
|
+
/// Answers taps across at least 44 by 44 points around a control drawn
|
|
5
|
+
/// `side` points wide, without growing its layout (accessibility X7).
|
|
6
|
+
func astryxMinimumHitArea(_ side: CGFloat) -> some View {
|
|
7
|
+
let inset = astryxHitInset(side)
|
|
8
|
+
return padding(inset).contentShape(Rectangle()).padding(-inset)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/// How far a control `side` points wide reaches past its edges to answer taps
|
|
13
|
+
/// across 44 points.
|
|
14
|
+
func astryxHitInset(_ side: CGFloat) -> CGFloat {
|
|
15
|
+
max(0, (44 - side) / 2)
|
|
16
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
schema_version: 3
|
|
3
|
+
template_version: 7
|
|
4
|
+
kind: component
|
|
5
|
+
id: component:swift/Button
|
|
6
|
+
platform_of: component:Button
|
|
7
|
+
authority: draft
|
|
8
|
+
archive_reason: null
|
|
9
|
+
superseded_by: null
|
|
10
|
+
approved_by: null
|
|
11
|
+
approved_at: null
|
|
12
|
+
owners: [cixzhang]
|
|
13
|
+
review_triggers: [public-api, behavior, theming, accessibility]
|
|
14
|
+
verified_by: [packages/native/apple/Tests/AstryxTests/ButtonTests.swift]
|
|
15
|
+
modules: []
|
|
16
|
+
families: [family:buttons, family:navigation-destinations]
|
|
17
|
+
design_specs: []
|
|
18
|
+
architecture: [architecture:public-component-api]
|
|
19
|
+
contributing: []
|
|
20
|
+
system_specs: [spec:AST-082, spec:AST-093]
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Button (Swift) component contract
|
|
24
|
+
|
|
25
|
+
## Contract at a glance
|
|
26
|
+
|
|
27
|
+
| Area | Contract |
|
|
28
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| Public contract | `Button(label:variant:size:elevation:isLoading:isInterruptible:isDisabled:width:tooltip:href:base:onClick:)` and `Button(_ props: ButtonProps)`, a SwiftUI `View` in module `Astryx`. |
|
|
30
|
+
| Behavior | A SwiftUI `Button` drawn with the Astryx button style, or a SwiftUI `Link` when an enabled Button has `href`. While loading, a spinner covers the label, which keeps its place, and presses wait unless it is interruptible. |
|
|
31
|
+
| End-user impact | A person gets one action control whose width holds while it loads and which never runs twice by accident; a link Button stays a link while busy, so VoiceOver and keyboard focus stay on it. |
|
|
32
|
+
| Builder impact | An app passes core's Button props; `href` makes the same view open a destination through the system. |
|
|
33
|
+
| Compatibility/readiness | Breaking for canary callers: `action:`, `fillsWidth:`, `icon:`, and the hand-written `AstryxButtonVariant` and `AstryxButtonSize` give way to the generated `ButtonProps` (`onClick:`, `width:`, `ButtonVariant`, `ButtonSize`). Draft; built and tested on macOS and the iOS Simulator. |
|
|
34
|
+
| Review checks | Reject a loading link that swaps to a button, a loading Button that runs `onClick` or opens its link while not interruptible, a size change while loading, or a disabled Button with `href` that opens. |
|
|
35
|
+
| Governing rules | `component:Button` FR7–FR11; `spec:AST-082` FR3; `spec:AST-093` FR1–FR5; the Swift component API record (A2–A5) under `packages/native/specs/swift/library/`. |
|
|
36
|
+
|
|
37
|
+
This table is a review projection; the body below is authoritative.
|
|
38
|
+
|
|
39
|
+
## Intent
|
|
40
|
+
|
|
41
|
+
Button on Apple platforms is core's action control drawn with SwiftUI's own
|
|
42
|
+
button and link, so presses, focus, and VoiceOver work the platform's way while
|
|
43
|
+
its look, loading, and link behavior follow the core `Button` contract.
|
|
44
|
+
|
|
45
|
+
## Compatibility and migration
|
|
46
|
+
|
|
47
|
+
- Released default preserved: `not yet released`
|
|
48
|
+
- Compatibility class: breaking for canary callers (hand-written parameters → generated `ButtonProps`)
|
|
49
|
+
- Controlled/uncontrolled behavior: not applicable
|
|
50
|
+
- Migration decision: none
|
|
51
|
+
|
|
52
|
+
Consumer migration instructions belong in consumer docs and release notes.
|
|
53
|
+
|
|
54
|
+
## Ownership boundary
|
|
55
|
+
|
|
56
|
+
**Owns**
|
|
57
|
+
|
|
58
|
+
- How Swift draws core's Button: the SwiftUI control it uses, the loading
|
|
59
|
+
presentation, when presses land, and when `href` makes it a link.
|
|
60
|
+
|
|
61
|
+
**Does not own / non-goals**
|
|
62
|
+
|
|
63
|
+
- The meaning of Button's props, its variants and sizes, and its pending and
|
|
64
|
+
disabled states — owned by `component:Button`.
|
|
65
|
+
- Which destinations a link may open — owned by
|
|
66
|
+
`family:navigation-destinations`.
|
|
67
|
+
- How a prop switches to a different SwiftUI control in general — owned by the
|
|
68
|
+
Swift component API record (A2).
|
|
69
|
+
|
|
70
|
+
## Public concepts
|
|
71
|
+
|
|
72
|
+
| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
|
|
73
|
+
| ------------- | ----------------------------- | ------------------------------------------------------------- | ----------------------------------------- | -------- | ------------------------ | ------------ | ------------------------------------------- |
|
|
74
|
+
| control | button; link | a SwiftUI `Button`, or a SwiftUI `Link` for an enabled `href` | always | button | `component:swift/Button` | experimental | an `href` that is not a URL leaves a button |
|
|
75
|
+
| loading | idle; loading | `isLoading`: spinner over the label, presses wait | always | idle | `component:Button` | experimental | none |
|
|
76
|
+
| interruptible | off; on | `isInterruptible`: presses and link opens land while loading | while loading | off | `component:Button` | experimental | none |
|
|
77
|
+
| availability | operable; busy-only; disabled | disabled wins over loading | always | operable | `component:Button` | experimental | none |
|
|
78
|
+
|
|
79
|
+
## Behavioral and layout contract
|
|
80
|
+
|
|
81
|
+
| ID | Candidate invariant | Basis | Draft review state |
|
|
82
|
+
| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ------------------ |
|
|
83
|
+
| FR1 | Both initializers MUST build the same `ButtonProps`; base props (`id`, `isHidden`) come through `ButtonProps`. | Swift component API A2, A3 | verify |
|
|
84
|
+
| FR2 | While loading, the view MUST draw a spinner over the label, keep the label's place so its size does not change, stay at full opacity, and read as busy ("Loading", core's catalog message) to VoiceOver. It MUST NOT run `onClick` while loading unless it is interruptible; an interruptible loading Button runs `onClick` on each press. | `component:Button` FR7–FR9 | verify |
|
|
85
|
+
| FR3 | An enabled Button with `href` MUST draw a SwiftUI `Link` to that destination, in the Astryx button style, which VoiceOver reads as a link. A disabled Button with `href` MUST draw its disabled button, which never opens. | `component:Button` FR11; `spec:AST-082` FR3 | verify |
|
|
86
|
+
| FR4 | A loading Button with `href` MUST stay a `Link`: it keeps focus, shows its spinner, reads as busy, and does not open its destination until loading ends, unless the Button is interruptible, in which case each activation opens it. It never swaps to a button while busy. | `component:Button` FR9 ("a link-mode Button stays a link while busy-only"), FR11 | verify |
|
|
87
|
+
| FR5 | A Button whose `href` is a script URL (`javascript:`, `vbscript:`) or an HTML document in a `data:` URL MUST NOT open it, after core's normalization (control characters removed, whitespace trimmed, the scheme compared in lowercase without spaces after its colon): it draws its enabled button, which runs `onClick` and does not look disabled. | `component:Button` FR11; `family:navigation-destinations` | verify |
|
|
88
|
+
| FR6 | A disabled Button MUST keep its keyboard focus stop and show its tooltip on focus, draw its disabled look, read as a dimmed button to VoiceOver, and never run `onClick`; a focused Button that becomes disabled keeps one view structure and its focus. A Button with `href` keeps its `Link` and its disabled button in one structure, and focus moves from the link to the button when it becomes disabled, and back when it is enabled, so focus stays inside the component. | `component:Button` FR10; `family:buttons` FR3 | verify |
|
|
89
|
+
|
|
90
|
+
### Allowed variation
|
|
91
|
+
|
|
92
|
+
- **AV1 — Platform controls.** The control is SwiftUI's `Button` or `Link`, so
|
|
93
|
+
focus rings, press feedback, and how the system opens a destination are the
|
|
94
|
+
platform's own.
|
|
95
|
+
|
|
96
|
+
### Representative states
|
|
97
|
+
|
|
98
|
+
| State | Required invariant | Allowed variation |
|
|
99
|
+
| ------------------------- | ---------------------------------------------- | ----------------------- |
|
|
100
|
+
| loading | same size as idle; spinner; busy; presses wait | spinner is the system's |
|
|
101
|
+
| loading and interruptible | presses land | none |
|
|
102
|
+
| enabled with `href` | a `Link` | none |
|
|
103
|
+
| disabled with `href` | a dimmed button that never opens | none |
|
|
104
|
+
| loading with `href` | a `Link` that does not open until loading ends | none |
|
|
105
|
+
|
|
106
|
+
### Transformation and precedence order
|
|
107
|
+
|
|
108
|
+
- **ORD1 — Availability.** Disabled, then loading (busy-only unless
|
|
109
|
+
interruptible), then operable, as in core.
|
|
110
|
+
|
|
111
|
+
### Performance and resources
|
|
112
|
+
|
|
113
|
+
- **PR1 — No work while idle.** The view holds no timers or tasks; loading is a
|
|
114
|
+
prop the caller sets.
|
|
115
|
+
|
|
116
|
+
## Accessibility contract
|
|
117
|
+
|
|
118
|
+
- **AR1 — Name and state.** The label names the control in every state; a
|
|
119
|
+
loading Button adds core's "Loading" message as its value and announces it
|
|
120
|
+
when loading starts. A link Button reads as a link, a disabled one as dimmed.
|
|
121
|
+
- **AR2 — Rendered tree not measured.** Tests assert what the view sets; the
|
|
122
|
+
rendered accessibility tree is not measured until an app-hosted target exists.
|
|
123
|
+
|
|
124
|
+
## Design relationships
|
|
125
|
+
|
|
126
|
+
| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
|
|
127
|
+
| ---------------- | ------------------------------- | -------------------------- | -------------- | ------------------ |
|
|
128
|
+
| Spinner | the system's activity indicator | prescribed by the platform | supporting | FR2, FR4 |
|
|
129
|
+
|
|
130
|
+
The component implements design requirements without copying their rationale.
|
|
131
|
+
|
|
132
|
+
Platform control: SwiftUI `Button` and `Link` with `ProgressView`; they are the
|
|
133
|
+
platform's own controls and satisfy the contract (`spec:AST-093` FR2). A
|
|
134
|
+
`tooltip` shows through the shared Astryx tooltip (`library/tooltip.spec.md`).
|
|
135
|
+
Guideline pages: Buttons, Progress indicators, and Accessibility in the Apple
|
|
136
|
+
Human Interface Guidelines (`spec:AST-093` FR3).
|
|
137
|
+
|
|
138
|
+
Theme values read (`spec:AST-093` FR4): `color.accent`, `color.onAccent`,
|
|
139
|
+
`color.error`, `color.onError`, `color.neutral`, `color.textPrimary`,
|
|
140
|
+
`size.elementSm`, `size.elementMd`, `size.elementLg`, `radius.element`,
|
|
141
|
+
`space` steps for padding, `font.label` and `font.family.body`, the
|
|
142
|
+
`shadow.low`, `shadow.med`, and `shadow.high` layers, and the Dynamic Type
|
|
143
|
+
scale.
|
|
144
|
+
|
|
145
|
+
## Family and system relationships
|
|
146
|
+
|
|
147
|
+
- `component:Button` owns the props, the pending and disabled states, and link
|
|
148
|
+
mode; this record states only how Swift draws them.
|
|
149
|
+
- `family:navigation-destinations` owns destination handling for links.
|
|
150
|
+
|
|
151
|
+
## Verification map
|
|
152
|
+
|
|
153
|
+
| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
|
|
154
|
+
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
|
|
155
|
+
| FR1 | `ButtonTests.swift` initializer test | both initializers | differing props fail | `audit:swift/Button/api` |
|
|
156
|
+
| FR2 | `ButtonTests.swift` loading, width, and interruptible tests | loading; loading and interruptible | a press that lands while loading, a size change, or dimming fails | `audit:swift/Button/loading` |
|
|
157
|
+
| FR3 | `ButtonTests.swift` `href` test | enabled and disabled with `href` | a disabled Button that opens, or an enabled one that is not a link, fails | `audit:swift/Button/link` |
|
|
158
|
+
| FR4 | `ButtonTests.swift` `href` test with loading, and with loading and interruptible | loading with `href`; interruptible | a busy link that swaps to a button or opens before loading ends fails | `audit:swift/Button/link` |
|
|
159
|
+
| FR5 | `ButtonTests.swift` refused-destination and normalization tests | `javascript:`, `vbscript:`, `data:text/html`, padded, mixed case, with controls, and `data: text/html`; a `data:image` and a `mailto:` that still open | a refused destination that opens, an unnormalized one that slips through, or a refused one that looks disabled, fails | `audit:swift/Button/link` |
|
|
160
|
+
| FR6 | `ButtonTests.swift` disabled tests, including a disabled Button with `href` keeping its destination for one structure; the focus stop and the focus move are not measured until an app-hosted test can observe them | disabled with and without a tooltip; disabled with `href` | a disabled Button that runs `onClick` or opens its link, or one marked without its focus stop, fails | `audit:swift/Button/disabled` |
|
|
161
|
+
| AR1 | `ButtonTests.swift` accessibility assertions | idle; loading; link | a missing name, value, or announcement fails | `audit:swift/Button/a11y` |
|
|
162
|
+
|
|
163
|
+
## Decision log
|
|
164
|
+
|
|
165
|
+
No component-local decision is recorded.
|
|
166
|
+
|
|
167
|
+
## Open questions
|
|
168
|
+
|
|
169
|
+
None.
|
|
170
|
+
|
|
171
|
+
## Content boundary
|
|
172
|
+
|
|
173
|
+
This file does not duplicate consumer prop tables/examples, current audit
|
|
174
|
+
results, implementation steps, or family/system rules. It links to their owners.
|