Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

feat(native): Swift Button takes core's props; every view reads typed tokens (#8310)

Cindy Zhang06ff669dd7fe
diff --git a/packages/native/apple/Package.swift b/packages/native/apple/Package.swift
index e5c1c044f2..8d921fb83a 100644
--- a/packages/native/apple/Package.swift
+++ b/packages/native/apple/Package.swift
@@ -28,7 +28,7 @@ let package = Package(
dependencies: ["AstryxNative"],
path: "Sources/Astryx",
// Each component's spec lives beside its view (AST-093 FR1).
- exclude: ["Avatar/Avatar.spec.md", "Avatar/AvatarStatusDot.spec.md", "Icon/Icon.spec.md", "Thumbnail/Thumbnail.spec.md"],
+ 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"],
resources: [.process("Resources")]
),
.testTarget(name: "AstryxNativeTests", dependencies: ["AstryxNative"], path: "Tests/AstryxNativeTests"),
diff --git a/packages/native/apple/README.md b/packages/native/apple/README.md
index 4a36fa92dc..1e8ac40f82 100644
--- a/packages/native/apple/README.md
+++ b/packages/native/apple/README.md
@@ -53,15 +53,10 @@ apple/
that also imports SwiftUI, write `Astryx.Button` and `SwiftUI.Button`. A
component's parameters use core's prop names
and values (`variant: .primary`, `size: .lg`, `isLoading`), so code reads
- the same across web and native. `Text`, `Heading`, and `Card` take the
- generated `TextProps`, `HeadingProps`, and `CardProps`, as AST-093 FR5 asks;
- the others keep four exceptions, the interim shape FR5 exempts until they move onto the generated
- contracts:
- - `Button` takes `action` where core has `onClick`.
- - `Button` takes `fillsWidth` where core has `width="100%"`.
- - `Button` takes `icon` as a shared icon name (`"search"`), which the
- generated `ButtonProps` does not carry yet.
- - `TextInput` takes a `Binding` where core has `value` and `onChange`.
+ the same across web and native. Every view with a core contract takes its
+ generated `<Name>Props` (AST-093 FR5) and has a labeled initializer that
+ builds the same props; `Banner` has no native contract yet (the generated
+ contracts do not include it), so its parameters are hand-written.
- **`Templates/`** holds one folder per page template, named after the
`astryx template` id. Templates are clone-only, as on the web: you copy a
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`,
`tokens.space.s4`, `tokens.font.body.size`), so a misspelled token fails to
compile. Font tokens come grouped: each type style (`tokens.font.body`,
`tokens.font.heading1`) holds its `size`, `weight`, and `leading`, and
-`tokens.font.family`, `.size`, and `.weight` hold the scales. Text sizes grow with Dynamic Type. The components still read some
-tokens by core's name (`astryx.color("color-accent")`); moving them onto the
-typed members comes next.
+`tokens.font.family`, `.size`, and `.weight` hold the scales. Text sizes grow
+with Dynamic Type. An app reads the same members for its own SwiftUI layout,
+such as stack spacing (`astryx.tokens.space.s4`).
`Icon(.search)` draws a shared icon name as the platform's SF Symbol, at
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
## Not here yet
-- The views do not use the generated contract types in `AstryxNative` yet.
- Moving them onto those types is how a core prop change reaches Swift.
- Pixel and behavior parity with the web components has not been measured.
-- Increase Contrast, theme-local tokens, and platform theme entries
+- Theme-local tokens and platform theme entries
(`defineNativeTheme`, reserved as `Theme.native`) are not wired in.
diff --git a/packages/native/apple/Sources/Astryx/Banner/Banner.swift b/packages/native/apple/Sources/Astryx/Banner/Banner.swift
index c780b797d6..58984228b7 100644
--- a/packages/native/apple/Sources/Astryx/Banner/Banner.swift
+++ b/packages/native/apple/Sources/Astryx/Banner/Banner.swift
@@ -13,21 +13,21 @@ public enum AstryxBannerStatus: String, CaseIterable, Sendable {
/// theme's or the platform's symbol for it.
var iconName: String { rawValue }
- var groundToken: String {
+ func groundColor(_ color: ColorTokens) -> Color {
switch self {
- case .info: "color-accent-muted"
- case .warning: "color-warning-muted"
- case .error: "color-error-muted"
- case .success: "color-success-muted"
+ case .info: color.accentMuted
+ case .warning: color.warningMuted
+ case .error: color.errorMuted
+ case .success: color.successMuted
}
}
- var iconToken: String {
+ func iconColor(_ color: ColorTokens) -> Color {
switch self {
- case .info: "color-accent"
- case .warning: "color-warning"
- case .error: "color-error"
- case .success: "color-success"
+ case .info: color.accent
+ case .warning: color.warning
+ case .error: color.error
+ case .success: color.success
}
}
}
@@ -48,15 +48,15 @@ public struct Banner: View {
}
public var body: some View {
- HStack(alignment: .firstTextBaseline, spacing: astryx.space(2)) {
+ HStack(alignment: .firstTextBaseline, spacing: astryx.tokens.space.s2) {
if let icon = astryx.icon(status.iconName) {
// Sized with the title so it grows with Dynamic Type.
- icon.sized(astryx.fontSize("text-body-size", 14))
- .font(astryx.font(size: "text-body-size", 14, weight: "text-body-weight"))
- .foregroundStyle(astryx.color(status.iconToken))
+ icon.sized(astryx.tokens.font.body.size * astryx.textScale)
+ .font(astryx.font(TypeStyle(astryx.tokens.font.body, families: astryx.tokens.font.family.body)))
+ .foregroundStyle(status.iconColor(astryx.tokens.color))
.accessibilityHidden(true)
}
- VStack(alignment: .leading, spacing: astryx.space(1)) {
+ VStack(alignment: .leading, spacing: astryx.tokens.space.s1) {
Text(title, weight: .semibold)
if let description {
Text(description, color: .secondary)
@@ -64,10 +64,10 @@ public struct Banner: View {
}
.frame(maxWidth: .infinity, alignment: .leading)
}
- .padding(astryx.space(3))
+ .padding(astryx.tokens.space.s3)
.background(
- RoundedRectangle(cornerRadius: astryx.size("radius-container", 12), style: .continuous)
- .fill(astryx.color(status.groundToken))
+ RoundedRectangle(cornerRadius: astryx.tokens.radius.container, style: .continuous)
+ .fill(status.groundColor(astryx.tokens.color))
)
.accessibilityElement(children: .ignore)
.accessibilityLabel(SwiftUI.Text(accessibilityText))
diff --git a/packages/native/apple/Sources/Astryx/Base/BaseProps.swift b/packages/native/apple/Sources/Astryx/Base/BaseProps.swift
index 7718913f74..9e7fa93725 100644
--- a/packages/native/apple/Sources/Astryx/Base/BaseProps.swift
+++ b/packages/native/apple/Sources/Astryx/Base/BaseProps.swift
@@ -13,4 +13,9 @@ extension View {
self
}
}
+
+ /// Core's base `id` on the part it targets, such as a field's control.
+ @ViewBuilder func astryxIdentifier(_ id: String?) -> some View {
+ if let id { accessibilityIdentifier(id) } else { self }
+ }
}
diff --git a/packages/native/apple/Sources/Astryx/Base/HitArea.swift b/packages/native/apple/Sources/Astryx/Base/HitArea.swift
new file mode 100644
index 0000000000..c1d6d12c6b
--- /dev/null
+++ b/packages/native/apple/Sources/Astryx/Base/HitArea.swift
@@ -0,0 +1,16 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+extension View {
+ /// Answers taps across at least 44 by 44 points around a control drawn
+ /// `side` points wide, without growing its layout (accessibility X7).
+ func astryxMinimumHitArea(_ side: CGFloat) -> some View {
+ let inset = astryxHitInset(side)
+ return padding(inset).contentShape(Rectangle()).padding(-inset)
+ }
+}
+
+/// How far a control `side` points wide reaches past its edges to answer taps
+/// across 44 points.
+func astryxHitInset(_ side: CGFloat) -> CGFloat {
+ max(0, (44 - side) / 2)
+}
diff --git a/packages/native/apple/Sources/Astryx/Button/Button.spec.md b/packages/native/apple/Sources/Astryx/Button/Button.spec.md
new file mode 100644
index 0000000000..cf8b2f05c4
--- /dev/null
+++ b/packages/native/apple/Sources/Astryx/Button/Button.spec.md
@@ -0,0 +1,174 @@
+---
+schema_version: 3
+template_version: 7
+kind: component
+id: component:swift/Button
+platform_of: component:Button
+authority: draft
+archive_reason: null
+superseded_by: null
+approved_by: null
+approved_at: null
+owners: [cixzhang]
+review_triggers: [public-api, behavior, theming, accessibility]
+verified_by: [packages/native/apple/Tests/AstryxTests/ButtonTests.swift]
+modules: []
+families: [family:buttons, family:navigation-destinations]
+design_specs: []
+architecture: [architecture:public-component-api]
+contributing: []
+system_specs: [spec:AST-082, spec:AST-093]
+---
+
+# Button (Swift) component contract
+
+## Contract at a glance
+
+| Area | Contract |
+| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 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`. |
+| 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. |
+| 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. |
+| Builder impact | An app passes core's Button props; `href` makes the same view open a destination through the system. |
+| 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. |
+| 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. |
+| 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/`. |
+
+This table is a review projection; the body below is authoritative.
+
+## Intent
+
+Button on Apple platforms is core's action control drawn with SwiftUI's own
+button and link, so presses, focus, and VoiceOver work the platform's way while
+its look, loading, and link behavior follow the core `Button` contract.
+
+## Compatibility and migration
+
+- Released default preserved: `not yet released`
+- Compatibility class: breaking for canary callers (hand-written parameters → generated `ButtonProps`)
+- Controlled/uncontrolled behavior: not applicable
+- Migration decision: none
+
+Consumer migration instructions belong in consumer docs and release notes.
+
+## Ownership boundary
+
+**Owns**
+
+- How Swift draws core's Button: the SwiftUI control it uses, the loading
+ presentation, when presses land, and when `href` makes it a link.
+
+**Does not own / non-goals**
+
+- The meaning of Button's props, its variants and sizes, and its pending and
+ disabled states — owned by `component:Button`.
+- Which destinations a link may open — owned by
+ `family:navigation-destinations`.
+- How a prop switches to a different SwiftUI control in general — owned by the
+ Swift component API record (A2).
+
+## Public concepts
+
+| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
+| ------------- | ----------------------------- | ------------------------------------------------------------- | ----------------------------------------- | -------- | ------------------------ | ------------ | ------------------------------------------- |
+| 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 |
+| loading | idle; loading | `isLoading`: spinner over the label, presses wait | always | idle | `component:Button` | experimental | none |
+| interruptible | off; on | `isInterruptible`: presses and link opens land while loading | while loading | off | `component:Button` | experimental | none |
+| availability | operable; busy-only; disabled | disabled wins over loading | always | operable | `component:Button` | experimental | none |
+
+## Behavioral and layout contract
+
+| ID | Candidate invariant | Basis | Draft review state |
+| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ------------------ |
+| FR1 | Both initializers MUST build the same `ButtonProps`; base props (`id`, `isHidden`) come through `ButtonProps`. | Swift component API A2, A3 | verify |
+| 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 |
+| 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 |
+| 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 |
+| 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 |
+| 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 |
+
+### Allowed variation
+
+- **AV1 — Platform controls.** The control is SwiftUI's `Button` or `Link`, so
+ focus rings, press feedback, and how the system opens a destination are the
+ platform's own.
+
+### Representative states
+
+| State | Required invariant | Allowed variation |
+| ------------------------- | ---------------------------------------------- | ----------------------- |
+| loading | same size as idle; spinner; busy; presses wait | spinner is the system's |
+| loading and interruptible | presses land | none |
+| enabled with `href` | a `Link` | none |
+| disabled with `href` | a dimmed button that never opens | none |
+| loading with `href` | a `Link` that does not open until loading ends | none |
+
+### Transformation and precedence order
+
+- **ORD1 — Availability.** Disabled, then loading (busy-only unless
+ interruptible), then operable, as in core.
+
+### Performance and resources
+
+- **PR1 — No work while idle.** The view holds no timers or tasks; loading is a
+ prop the caller sets.
+
+## Accessibility contract
+
+- **AR1 — Name and state.** The label names the control in every state; a
+ loading Button adds core's "Loading" message as its value and announces it
+ when loading starts. A link Button reads as a link, a disabled one as dimmed.
+- **AR2 — Rendered tree not measured.** Tests assert what the view sets; the
+ rendered accessibility tree is not measured until an app-hosted target exists.
+
+## Design relationships
+
+| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
+| ---------------- | ------------------------------- | -------------------------- | -------------- | ------------------ |
+| Spinner | the system's activity indicator | prescribed by the platform | supporting | FR2, FR4 |
+
+The component implements design requirements without copying their rationale.
+
+Platform control: SwiftUI `Button` and `Link` with `ProgressView`; they are the
+platform's own controls and satisfy the contract (`spec:AST-093` FR2). A
+`tooltip` shows through the shared Astryx tooltip (`library/tooltip.spec.md`).
+Guideline pages: Buttons, Progress indicators, and Accessibility in the Apple
+Human Interface Guidelines (`spec:AST-093` FR3).
+
+Theme values read (`spec:AST-093` FR4): `color.accent`, `color.onAccent`,
+`color.error`, `color.onError`, `color.neutral`, `color.textPrimary`,
+`size.elementSm`, `size.elementMd`, `size.elementLg`, `radius.element`,
+`space` steps for padding, `font.label` and `font.family.body`, the
+`shadow.low`, `shadow.med`, and `shadow.high` layers, and the Dynamic Type
+scale.
+
+## Family and system relationships
+
+- `component:Button` owns the props, the pending and disabled states, and link
+ mode; this record states only how Swift draws them.
+- `family:navigation-destinations` owns destination handling for links.
+
+## Verification map
+
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
+| FR1 | `ButtonTests.swift` initializer test | both initializers | differing props fail | `audit:swift/Button/api` |
+| 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` |
+| 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` |
+| 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` |
+| 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` |
+| 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` |
+| AR1 | `ButtonTests.swift` accessibility assertions | idle; loading; link | a missing name, value, or announcement fails | `audit:swift/Button/a11y` |
+
+## Decision log
+
+No component-local decision is recorded.
+
+## Open questions
+
+None.
+
+## Content boundary
+
+This file does not duplicate consumer prop tables/examples, current audit
+results, implementation steps, or family/system rules. It links to their owners.
diff --git a/packages/native/apple/Sources/Astryx/Button/Button.swift b/packages/native/apple/Sources/Astryx/Button/Button.swift
index 4b0429893c..ad73329a66 100644
--- a/packages/native/apple/Sources/Astryx/Button/Button.swift
+++ b/packages/native/apple/Sources/Astryx/Button/Button.swift
@@ -1,110 +1,195 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
// Adapted from github.com/ejc3/astryx-swift (MIT).
-import SwiftUI
-
-/// Core's `Button` variants.
-public enum AstryxButtonVariant: String, CaseIterable, Sendable {
- case primary
- case secondary
- case ghost
- case destructive
-}
-
-/// Core's `Button` sizes: `size-element-sm`, `-md`, and `-lg` high.
-public enum AstryxButtonSize: String, CaseIterable, Sendable {
- case sm
- case md
- case lg
-
- var heightToken: String { "size-element-\(rawValue)" }
- var fallbackHeight: CGFloat {
- switch self {
- case .sm: 28
- case .md: 32
- case .lg: 36
- }
- }
-}
-
-/// A labeled action, painted with the theme's tokens. The tap area reaches
-/// the platform's 44-by-44-point minimum even when the drawn button is smaller.
+/// A labeled action, painted with the theme's tokens. It takes core's Button
+/// props (`ButtonProps`). With `href` it is a link the system opens. The tap
+/// area reaches the platform's 44-by-44-point minimum even when the drawn
+/// button is smaller.
public struct Button: View {
- let label: String
- let variant: AstryxButtonVariant
- let size: AstryxButtonSize
- let icon: String?
- let isLoading: Bool
- let isDisabled: Bool
- let fillsWidth: Bool
- let action: () -> Void
+ public let props: ButtonProps
@Environment(\.astryx) private var astryx
+ /// Which part of a Button with `href` holds focus: its link, or the button
+ /// it draws while disabled.
+ enum Part: Hashable { case link, button }
+ @FocusState private var focus: Part?
+
+ public init(_ props: ButtonProps) {
+ self.props = props
+ }
/// - Parameters:
- /// - icon: a shared icon name, such as `"search"`, shown before the
- /// label; the theme's symbol for it, else the platform default.
- /// - fillsWidth: the button takes the whole width it is offered, as
- /// core's `width="100%"` does.
+ /// - label: core's `label`, the button's words and accessible name.
+ /// - variant: core's `variant`; `secondary` when nil.
+ /// - size: core's `size`; `md` when nil.
+ /// - elevation: core's `elevation`, the theme's shadow at that depth.
+ /// - isLoading: core's `isLoading`: a spinner over the label, undimmed and
+ /// focusable, "Loading" spoken, presses ignored until it finishes.
+ /// - isInterruptible: core's `isInterruptible`: presses still land while
+ /// loading, so they can interrupt it.
+ /// - isDisabled: core's `isDisabled`.
+ /// - width: core's `width`: `content` (default) or `fill`, the whole width
+ /// offered.
+ /// - tooltip: core's `tooltip`: a tip on hover with a pointer, and a hint
+ /// VoiceOver reads; a tap belongs to the button, as on core's touch
+ /// screens.
+ /// - href: core's `href`: an enabled button becomes a SwiftUI `Link` the
+ /// system opens.
+ /// - base: core's base props.
+ /// - onClick: core's `onClick`, the press.
public init(
label: String,
- variant: AstryxButtonVariant = .secondary,
- size: AstryxButtonSize = .md,
- icon: String? = nil,
- isLoading: Bool = false,
- isDisabled: Bool = false,
- fillsWidth: Bool = false,
- action: @escaping () -> Void
+ variant: ButtonVariant? = nil,
+ size: ButtonSize? = nil,
+ elevation: ButtonElevation? = nil,
+ isLoading: Bool? = nil,
+ isInterruptible: Bool? = nil,
+ isDisabled: Bool? = nil,
+ width: ButtonWidth? = nil,
+ tooltip: String? = nil,
+ href: String? = nil,
+ base: AstryxBaseProps = AstryxBaseProps(),
+ onClick: (() -> Void)? = nil
) {
- self.label = label
- self.variant = variant
- self.size = size
- self.icon = icon
- self.isLoading = isLoading
- self.isDisabled = isDisabled
- self.fillsWidth = fillsWidth
- self.action = action
+ self.init(
+ ButtonProps(
+ label: label,
+ variant: variant,
+ size: size,
+ elevation: elevation,
+ isLoading: isLoading,
+ isInterruptible: isInterruptible,
+ isDisabled: isDisabled,
+ width: width,
+ tooltip: tooltip,
+ onClick: onClick,
+ href: href,
+ base: base
+ )
+ )
+ }
+
+ var isLoading: Bool { props.isLoading == true }
+ var isDisabled: Bool { props.isDisabled == true }
+
+ /// The destination a Button with `href` opens while enabled, or nil when
+ /// it has none or its destination is refused.
+ var destination: URL? {
+ guard let href = props.href, let safe = Self.safeDestination(href) else { return nil }
+ return URL(string: safe)
+ }
+
+ /// The link an enabled button with `href` becomes. A disabled one draws a
+ /// disabled button, as core draws a disabled `<button>`.
+ var link: URL? { isDisabled ? nil : destination }
+
+ /// A destination a link may open, normalized as core's shared rule does, or
+ /// nil for a script URL or an HTML document in a `data:` URL, which core's
+ /// navigation destinations refuse (`family:navigation-destinations` FR4).
+ /// Control characters are removed and whitespace trimmed; the scheme is
+ /// compared in lowercase without the spaces after its colon, which a data
+ /// URL's media type ignores (`data: text/html` is HTML).
+ nonisolated static func safeDestination(_ href: String) -> String? {
+ let normalized = String(String.UnicodeScalarView(
+ href.unicodeScalars.filter { $0.value > 0x1F && $0.value != 0x7F }
+ )).trimmingCharacters(in: .whitespacesAndNewlines)
+ var comparable = normalized.lowercased()
+ if let colon = comparable.firstIndex(of: ":"),
+ comparable[..<colon].range(of: "^[a-z][a-z0-9+.-]*$", options: .regularExpression) != nil {
+ let rest = comparable[comparable.index(after: colon)...].drop { $0 == " " }
+ comparable = String(comparable[...colon]) + rest
+ }
+ for blocked in ["javascript:", "vbscript:", "data:text/html"] where comparable.hasPrefix(blocked) {
+ return nil
+ }
+ return normalized
}
public var body: some View {
- SwiftUI.Button(action: activate) {
- // The label keeps its place while loading so the width holds; the
- // spinner draws over it.
- HStack(spacing: astryx.space(2)) {
- if let icon, let image = astryx.icon(icon) {
- // An asset matches the label's text size, as a symbol does.
- image.sized(astryx.fontSize("text-label-size", 14))
- }
- SwiftUI.Text(label).lineLimit(1)
+ control
+ .buttonStyle(style)
+ // The shared Astryx tooltip on hover and keyboard focus, as core's
+ // Button tooltip; its words are the VoiceOver hint.
+ .astryxTooltip(props.tooltip, hint: props.tooltip, focus: .control)
+ .accessibilityLabel(SwiftUI.Text(accessibilityText))
+ .accessibilityValue(SwiftUI.Text(loadingValue ?? ""))
+ .onChange(of: isLoading) { _, loading in
+ if loading { AccessibilityNotification.Announcement(AstryxStrings.buttonLoading).post() }
+ }
+ .astryxBase(props.base)
+ }
+
+ @ViewBuilder private var control: some View {
+ if let destination {
+ // A Button with `href` keeps its link and its disabled button in one
+ // structure; only one is shown and reachable at a time, and focus moves
+ // from the link to the button when it becomes disabled and back, so it
+ // stays inside the component (AST-085 FR4, core Button FR10).
+ ZStack {
+ // A link the system opens, read as a link; while loading it stays a
+ // link and opens nothing until loading ends, unless interruptible.
+ SwiftUI.Link(destination: destination) { content }
+ .environment(\.openURL, OpenURLAction { _ in
+ let lands = acceptsPress
+ if lands { props.onClick?() }
+ return lands ? .systemAction : .handled
+ })
+ .focused($focus, equals: .link)
+ .disabled(isDisabled)
+ .opacity(isDisabled ? 0 : 1)
+ .accessibilityHidden(isDisabled)
+ plainButton
+ .focused($focus, equals: .button)
+ .disabled(!isDisabled)
+ .opacity(isDisabled ? 1 : 0)
+ .accessibilityHidden(!isDisabled)
}
+ .onChange(of: isDisabled) { _, disabled in
+ if focus != nil { focus = disabled ? .button : .link }
+ }
+ } else {
+ plainButton
+ }
+ }
+
+ /// A disabled Button keeps its focus stop, as core keeps it focusable, so
+ /// keyboard users reach it and its tooltip; presses never land. VoiceOver
+ /// reads the platform's button, dimmed when disabled, in both states, so a
+ /// focused Button that becomes disabled keeps one view structure and focus.
+ private var plainButton: some View {
+ SwiftUI.Button(action: activate) { content }
+ .accessibilityAddTraits(Self.accessibilityTraits)
+ .accessibilityRepresentation {
+ SwiftUI.Button(accessibilityText, action: activate).disabled(isDisabled)
+ }
+ }
+
+ private var content: some View {
+ // The label keeps its place while loading so the width holds; the
+ // spinner draws over it.
+ SwiftUI.Text(props.label)
+ .lineLimit(1)
.opacity(isLoading ? 0 : 1)
.overlay {
if isLoading {
ProgressView().controlSize(.small).tint(foreground)
}
}
- }
- .buttonStyle(
- AstryxButtonStyle(
- astryx: astryx,
- size: size,
- fillsWidth: fillsWidth,
- foreground: foreground,
- background: background
- )
+ }
+
+ private var style: AstryxButtonStyle {
+ AstryxButtonStyle(
+ astryx: astryx,
+ height: height,
+ fillsWidth: props.width == .fill,
+ foreground: foreground,
+ background: background,
+ shadow: shadow,
+ isDimmed: isDisabled
)
- // As core's Button: a loading button stays undimmed and focusable, keeps
- // its label, and says Loading; taps do nothing until it finishes.
- .disabled(isDisabled)
- .accessibilityLabel(SwiftUI.Text(accessibilityText))
- .accessibilityAddTraits(Self.accessibilityTraits)
- .accessibilityValue(SwiftUI.Text(loadingValue ?? ""))
- .onChange(of: isLoading) { _, loading in
- if loading { AccessibilityNotification.Announcement(AstryxStrings.buttonLoading).post() }
- }
}
/// The button's accessible name: its label, also while loading.
- var accessibilityText: String { label }
+ var accessibilityText: String { props.label }
/// The traits assistive technology gets: a button.
static var accessibilityTraits: AccessibilityTraits { .isButton }
@@ -113,52 +198,81 @@ public struct Button: View {
/// catalog message, in the person's language.
var loadingValue: String? { isLoading ? AstryxStrings.buttonLoading : nil }
- /// Runs the action unless the button is loading.
+ /// Whether a press lands now: not while loading, unless interruptible.
+ var acceptsPress: Bool { !isDisabled && (!isLoading || props.isInterruptible == true) }
+
+ /// A disabled Button keeps its focus stop (core Button FR10).
+ var keepsFocusWhileDisabled: Bool { isDisabled }
+
+ /// Runs `onClick` when a press lands.
func activate() {
- guard !isLoading else { return }
- action()
+ guard acceptsPress else { return }
+ props.onClick?()
+ }
+
+ var height: CGFloat {
+ let size = astryx.tokens.size
+ switch props.size ?? .md {
+ case .sm: return size.elementSm
+ case .md: return size.elementMd
+ case .lg: return size.elementLg
+ }
}
private var foreground: Color {
- switch variant {
- case .primary: astryx.color("color-on-accent")
- case .destructive: astryx.color("color-on-error")
- case .secondary, .ghost: astryx.color("color-text-primary")
+ let color = astryx.tokens.color
+ switch props.variant ?? .secondary {
+ case .primary: return color.onAccent
+ case .destructive: return color.onError
+ case .secondary, .ghost: return color.textPrimary
}
}
private var background: Color {
- switch variant {
- case .primary: astryx.color("color-accent")
- case .destructive: astryx.color("color-error")
- case .secondary: astryx.color("color-neutral")
- case .ghost: .clear
+ let color = astryx.tokens.color
+ switch props.variant ?? .secondary {
+ case .primary: return color.accent
+ case .destructive: return color.error
+ case .secondary: return color.neutral
+ case .ghost: return .clear
+ }
+ }
+
+ var shadow: [ShadowLayer] {
+ let shadow = astryx.tokens.shadow
+ switch props.elevation ?? .none {
+ case .none: return []
+ case .low: return shadow.low
+ case .med: return shadow.med
+ case .high: return shadow.high
}
}
}
struct AstryxButtonStyle: ButtonStyle {
let astryx: AstryxStyle
- let size: AstryxButtonSize
+ let height: CGFloat
let fillsWidth: Bool
let foreground: Color
let background: Color
- @Environment(\.isEnabled) private var isEnabled
+ let shadow: [ShadowLayer]
+ /// Draws the disabled look for a disabled Button that keeps its focus stop.
+ var isDimmed = false
+ @Environment(\.isEnabled) private var environmentEnabled
+ private var isEnabled: Bool { environmentEnabled && !isDimmed }
func makeBody(configuration: Configuration) -> some View {
- let shape = RoundedRectangle(
- cornerRadius: astryx.size("radius-element", 8),
- style: .continuous
- )
- // Grows with text size, but not so far that one line of a large label
- // becomes a tall slab.
- let height = astryx.size(size.heightToken, size.fallbackHeight) * min(astryx.textScale, 1.4)
+ let shape = RoundedRectangle(cornerRadius: astryx.tokens.radius.element, style: .continuous)
+ let font = astryx.tokens.font
configuration.label
- .font(astryx.font(size: "text-label-size", 14, weight: "text-label-weight"))
+ .font(astryx.font(TypeStyle(font.label, families: font.family.body)))
.foregroundStyle(foreground)
- .padding(.horizontal, astryx.space(3))
- .frame(maxWidth: fillsWidth ? .infinity : nil, minHeight: height)
+ .padding(.horizontal, astryx.tokens.space.s3)
+ // Grows with text size, but not so far that one line of a large label
+ // becomes a tall slab.
+ .frame(maxWidth: fillsWidth ? .infinity : nil, minHeight: height * min(astryx.textScale, 1.4))
.background(shape.fill(background))
+ .astryxShadow(shadow, in: shape)
.opacity(isEnabled ? (configuration.isPressed ? 0.75 : 1) : 0.5)
// Drawn at the token size; laid out at least 44 by 44 so the whole
// platform-minimum tap area counts.
@@ -166,3 +280,4 @@ struct AstryxButtonStyle: ButtonStyle {
.contentShape(Rectangle())
}
}
+
diff --git a/packages/native/apple/Sources/Astryx/Localization/AstryxStrings.swift b/packages/native/apple/Sources/Astryx/Localization/AstryxStrings.swift
index d47b1c90c2..228262e3d1 100644
--- a/packages/native/apple/Sources/Astryx/Localization/AstryxStrings.swift
+++ b/packages/native/apple/Sources/Astryx/Localization/AstryxStrings.swift
@@ -1,5 +1,6 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
+import AstryxNative
import Foundation
/// Core's catalog messages, read from `Resources/<locale>.lproj`, which
@@ -44,6 +45,30 @@ enum AstryxStrings {
fill(localized("@astryx.thumbnail.remove", "Remove {accessibleName}"), ["accessibleName": accessibleName])
}
+ /// The indicator after an optional field's label.
+ static var fieldOptional: String { localized("@astryx.field.optional", "Optional") }
+ /// What VoiceOver reads for a read-only field, which SwiftUI cannot mark.
+ static var inputReadOnly: String { localized("@astryx.input.readOnly", "Read only") }
+ /// The indicator after a required field's label.
+ static var fieldRequired: String { localized("@astryx.field.required", "Required") }
+ /// The hover and pointer tip on an input's clear button.
+ static var clearTooltip: String { localized("@astryx.inputClearButton.tooltip", "Clear") }
+
+ /// The clear button's accessible name, naming the field.
+ static func clearLabel(_ label: String) -> String {
+ localized("@astryx.textInput.clearLabel", "Clear {label}").replacingOccurrences(of: "{label}", with: label)
+ }
+
+ /// The accessible name of an input's status button when its message shows
+ /// in a tip.
+ static func statusButton(_ type: TextInputStatusType) -> String {
+ switch type {
+ case .error: localized("@astryx.input.statusButton.error", "Error details")
+ case .warning: localized("@astryx.input.statusButton.warning", "Warning details")
+ case .success: localized("@astryx.input.statusButton.success", "Success details")
+ }
+ }
+
static func localized(_ key: String, _ english: String) -> String {
resourceBundle.localizedString(forKey: key, value: english, table: nil)
}
diff --git a/packages/native/apple/Sources/Astryx/Resources/af.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/af.lproj/Localizable.strings
index 5c48cd3544..0a09305887 100644
--- a/packages/native/apple/Sources/Astryx/Resources/af.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/af.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Laai tans";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Opsioneel";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Verpligtend";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Slegs lees";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Foutbesonderhede";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Suksesbesonderhede";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Waarskuwingbesonderhede";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Laai tans";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Vee {label} uit";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Duimnael";
diff --git a/packages/native/apple/Sources/Astryx/Resources/ar.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/ar.lproj/Localizable.strings
index 28b13b1206..d226f5a3cb 100644
--- a/packages/native/apple/Sources/Astryx/Resources/ar.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/ar.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "جارٍ التحميل";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "اختياري";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "مطلوب";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "للقراءة فقط";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "تفاصيل الخطأ";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "تفاصيل النجاح";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "تفاصيل التحذير";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "جارٍ التحميل";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "مسح {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "صورة مصغّرة";
diff --git a/packages/native/apple/Sources/Astryx/Resources/ca.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/ca.lproj/Localizable.strings
index 1dacd534bf..1522780dc7 100644
--- a/packages/native/apple/Sources/Astryx/Resources/ca.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/ca.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "S’està carregant";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Opcional";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Obligatori";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Només de lectura";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Detalls de l’error";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Detalls de l’èxit";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Detalls de l’advertiment";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "S’està carregant";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Esborra {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniatura";
diff --git a/packages/native/apple/Sources/Astryx/Resources/cs.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/cs.lproj/Localizable.strings
index abb4edff02..893e2024fe 100644
--- a/packages/native/apple/Sources/Astryx/Resources/cs.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/cs.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Načítání";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Volitelné";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Povinné";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Jen pro čtení";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Podrobnosti chyby";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Podrobnosti úspěchu";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Podrobnosti varování";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Načítání";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Vymazat {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Náhled";
diff --git a/packages/native/apple/Sources/Astryx/Resources/da.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/da.lproj/Localizable.strings
index e62276d392..9efcd4f566 100644
--- a/packages/native/apple/Sources/Astryx/Resources/da.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/da.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Indlæser";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Valgfri";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Påkrævet";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Skrivebeskyttet";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Fejldetaljer";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Detaljer om succes";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Advarselsdetaljer";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Indlæser";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Ryd {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniature";
diff --git a/packages/native/apple/Sources/Astryx/Resources/de.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/de.lproj/Localizable.strings
index 2f2bfdfc1e..7ad1e12695 100644
--- a/packages/native/apple/Sources/Astryx/Resources/de.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/de.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Wird geladen";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Optional";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Erforderlich";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Schreibgeschützt";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Fehlerdetails";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Erfolgsdetails";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Warndetails";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Wird geladen";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "{label} löschen";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniaturansicht";
diff --git a/packages/native/apple/Sources/Astryx/Resources/el.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/el.lproj/Localizable.strings
index c7eb587c21..7c48986edf 100644
--- a/packages/native/apple/Sources/Astryx/Resources/el.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/el.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Φόρτωση";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Προαιρετικό";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Υποχρεωτικό";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Μόνο για ανάγνωση";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Λεπτομέρειες σφάλματος";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Λεπτομέρειες επιτυχίας";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Λεπτομέρειες προειδοποίησης";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Φόρτωση";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Απαλοιφή {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Μικρογραφία";
diff --git a/packages/native/apple/Sources/Astryx/Resources/en.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/en.lproj/Localizable.strings
index 266decb03c..a7be4b50bf 100644
--- a/packages/native/apple/Sources/Astryx/Resources/en.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/en.lproj/Localizable.strings
@@ -6,9 +6,33 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Loading";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Optional";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Required";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Read only";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Error details";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Success details";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Warning details";
+
+/* Tooltip shown on hover or keyboard focus over the X button inside an input that clears its value. Verb, imperative. Shown alone beside the field, so it names only the action; the screen-reader label names the field separately. */
+"@astryx.inputClearButton.tooltip" = "Clear";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label; also announced once when a busy input or selector starts loading, in place of its decorative Spinner. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Loading";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Clear {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Thumbnail";
diff --git a/packages/native/apple/Sources/Astryx/Resources/es.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/es.lproj/Localizable.strings
index b082e667f5..c99b2f8c0c 100644
--- a/packages/native/apple/Sources/Astryx/Resources/es.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/es.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Cargando";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Opcional";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Obligatorio";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Solo lectura";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Detalles del error";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Detalles del éxito";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Detalles de la advertencia";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Cargando";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Borrar {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniatura";
diff --git a/packages/native/apple/Sources/Astryx/Resources/fi.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/fi.lproj/Localizable.strings
index f4fd53b253..a7e90a5082 100644
--- a/packages/native/apple/Sources/Astryx/Resources/fi.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/fi.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Ladataan";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Valinnainen";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Pakollinen";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Vain luku";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Virheen tiedot";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Onnistumisen tiedot";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Varoituksen tiedot";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Ladataan";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Tyhjennä {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Pikkukuva";
diff --git a/packages/native/apple/Sources/Astryx/Resources/fr.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/fr.lproj/Localizable.strings
index 004e6988a9..2283d15cf9 100644
--- a/packages/native/apple/Sources/Astryx/Resources/fr.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/fr.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Chargement";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Facultatif";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Obligatoire";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Lecture seule";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Détails de l’erreur";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Détails de la réussite";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Détails de l’avertissement";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Chargement";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Effacer {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniature";
diff --git a/packages/native/apple/Sources/Astryx/Resources/he.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/he.lproj/Localizable.strings
index f3fa2d3a5c..2ceafffd1a 100644
--- a/packages/native/apple/Sources/Astryx/Resources/he.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/he.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "טוען";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "רשות";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "חובה";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "לקריאה בלבד";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "פרטי השגיאה";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "פרטי ההצלחה";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "פרטי האזהרה";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "טוען";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "ניקוי {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "תמונה ממוזערת";
diff --git a/packages/native/apple/Sources/Astryx/Resources/hu.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/hu.lproj/Localizable.strings
index a502bf40a4..31ca1a41ca 100644
--- a/packages/native/apple/Sources/Astryx/Resources/hu.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/hu.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Betöltés";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Nem kötelező";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Kötelező";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Csak olvasható";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Hiba részletei";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Sikeres művelet részletei";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Figyelmeztetés részletei";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Betöltés";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "{label} törlése";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Bélyegkép";
diff --git a/packages/native/apple/Sources/Astryx/Resources/it.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/it.lproj/Localizable.strings
index fb9fd5369a..2c3a1ce7e2 100644
--- a/packages/native/apple/Sources/Astryx/Resources/it.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/it.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Caricamento";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Facoltativo";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Obbligatorio";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Sola lettura";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Dettagli dell’errore";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Dettagli del successo";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Dettagli dell’avviso";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Caricamento";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Cancella {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniatura";
diff --git a/packages/native/apple/Sources/Astryx/Resources/ja.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/ja.lproj/Localizable.strings
index aa2ca32b09..1c3fc84d9e 100644
--- a/packages/native/apple/Sources/Astryx/Resources/ja.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/ja.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "読み込み中";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "任意";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "必須";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "読み取り専用";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "エラーの詳細";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "成功の詳細";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "警告の詳細";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "読み込み中";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "{label} をクリア";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "サムネイル";
diff --git a/packages/native/apple/Sources/Astryx/Resources/ko.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/ko.lproj/Localizable.strings
index 9864380f3d..29a0282767 100644
--- a/packages/native/apple/Sources/Astryx/Resources/ko.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/ko.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "로드 중";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "선택 사항";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "필수";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "읽기 전용";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "오류 세부 정보";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "성공 세부 정보";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "경고 세부 정보";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "로드 중";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "{label} 지우기";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "썸네일";
diff --git a/packages/native/apple/Sources/Astryx/Resources/nb.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/nb.lproj/Localizable.strings
index bcc569b6cc..3fb2d86531 100644
--- a/packages/native/apple/Sources/Astryx/Resources/nb.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/nb.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Laster";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Valgfritt";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Påkrevd";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Skrivebeskyttet";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Feildetaljer";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Detaljer om suksess";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Advarseldetaljer";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Laster";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Fjern {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniatyrbilde";
diff --git a/packages/native/apple/Sources/Astryx/Resources/nl.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/nl.lproj/Localizable.strings
index 72acfc8907..e24f08b6c9 100644
--- a/packages/native/apple/Sources/Astryx/Resources/nl.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/nl.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Laden";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Optioneel";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Verplicht";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Alleen-lezen";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Foutdetails";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Succesdetails";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Waarschuwingsdetails";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Laden";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "{label} wissen";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniatuur";
diff --git a/packages/native/apple/Sources/Astryx/Resources/pl.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/pl.lproj/Localizable.strings
index 0120d16902..f36dc41a7f 100644
--- a/packages/native/apple/Sources/Astryx/Resources/pl.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/pl.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Ładowanie";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Opcjonalne";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Wymagane";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Tylko do odczytu";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Szczegóły błędu";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Szczegóły powodzenia";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Szczegóły ostrzeżenia";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Ładowanie";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Wyczyść {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniatura";
diff --git a/packages/native/apple/Sources/Astryx/Resources/pt-BR.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/pt-BR.lproj/Localizable.strings
index d7e1d41915..78721a8e9f 100644
--- a/packages/native/apple/Sources/Astryx/Resources/pt-BR.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/pt-BR.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Carregando";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Opcional";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Obrigatório";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Somente leitura";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Detalhes do erro";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Detalhes do sucesso";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Detalhes do aviso";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Carregando";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Limpar {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniatura";
diff --git a/packages/native/apple/Sources/Astryx/Resources/pt-PT.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/pt-PT.lproj/Localizable.strings
index 0840f436ba..dd65d1e602 100644
--- a/packages/native/apple/Sources/Astryx/Resources/pt-PT.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/pt-PT.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "A carregar";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Opcional";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Obrigatório";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Só de leitura";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Detalhes do erro";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Detalhes do sucesso";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Detalhes do aviso";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "A carregar";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Limpar {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniatura";
diff --git a/packages/native/apple/Sources/Astryx/Resources/ro.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/ro.lproj/Localizable.strings
index 46e66ab474..82002de53a 100644
--- a/packages/native/apple/Sources/Astryx/Resources/ro.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/ro.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Se încarcă";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Opțional";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Obligatoriu";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Doar în citire";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Detalii eroare";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Detalii succes";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Detalii avertisment";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Se încarcă";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Șterge {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniatură";
diff --git a/packages/native/apple/Sources/Astryx/Resources/ru.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/ru.lproj/Localizable.strings
index 7b3330669a..e0d610211c 100644
--- a/packages/native/apple/Sources/Astryx/Resources/ru.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/ru.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Загрузка";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Необязательно";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Обязательно";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Только для чтения";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Сведения об ошибке";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Сведения об успешном выполнении";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Сведения о предупреждении";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Загрузка";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Очистить {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Миниатюра";
diff --git a/packages/native/apple/Sources/Astryx/Resources/sr.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/sr.lproj/Localizable.strings
index dd3913d4dc..5be19473d1 100644
--- a/packages/native/apple/Sources/Astryx/Resources/sr.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/sr.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Учитавање";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Опционо";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Обавезно";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Само за читање";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Детаљи грешке";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Детаљи успеха";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Детаљи упозорења";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Учитавање";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Обриши {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Сличица";
diff --git a/packages/native/apple/Sources/Astryx/Resources/sv.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/sv.lproj/Localizable.strings
index ac0f9996b2..8d48c67166 100644
--- a/packages/native/apple/Sources/Astryx/Resources/sv.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/sv.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Läser in";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Valfritt";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Obligatoriskt";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Skrivskyddad";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Feldetaljer";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Detaljer om lyckat resultat";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Varningsdetaljer";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Läser in";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Rensa {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Miniatyr";
diff --git a/packages/native/apple/Sources/Astryx/Resources/tr.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/tr.lproj/Localizable.strings
index 6b40e57f2d..5285545cfc 100644
--- a/packages/native/apple/Sources/Astryx/Resources/tr.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/tr.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Yükleniyor";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "İsteğe bağlı";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Zorunlu";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Salt okunur";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Hata ayrıntıları";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Başarı ayrıntıları";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Uyarı ayrıntıları";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Yükleniyor";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "{label} temizle";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Küçük resim";
diff --git a/packages/native/apple/Sources/Astryx/Resources/uk.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/uk.lproj/Localizable.strings
index ccf2ac2f95..5a74e6c7f4 100644
--- a/packages/native/apple/Sources/Astryx/Resources/uk.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/uk.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Завантаження";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Необов’язково";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Обов’язково";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Лише для читання";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Деталі помилки";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Деталі успіху";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Деталі попередження";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Завантаження";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Очистити {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Мініатюра";
diff --git a/packages/native/apple/Sources/Astryx/Resources/vi.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/vi.lproj/Localizable.strings
index d740a9480f..585ccd3444 100644
--- a/packages/native/apple/Sources/Astryx/Resources/vi.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/vi.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "Đang tải";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "Tùy chọn";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "Bắt buộc";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "Chỉ đọc";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "Chi tiết lỗi";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "Chi tiết thành công";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "Chi tiết cảnh báo";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "Đang tải";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "Xóa {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "Hình thu nhỏ";
diff --git a/packages/native/apple/Sources/Astryx/Resources/zh-Hans.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/zh-Hans.lproj/Localizable.strings
index f5eb737a7a..e759e50b52 100644
--- a/packages/native/apple/Sources/Astryx/Resources/zh-Hans.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/zh-Hans.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "加载中";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "可选";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "必填";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "只读";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "错误详情";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "成功详情";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "警告详情";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "加载中";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "清除 {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "缩略图";
diff --git a/packages/native/apple/Sources/Astryx/Resources/zh-Hant.lproj/Localizable.strings b/packages/native/apple/Sources/Astryx/Resources/zh-Hant.lproj/Localizable.strings
index 9d4123ee6c..ecc34a8504 100644
--- a/packages/native/apple/Sources/Astryx/Resources/zh-Hant.lproj/Localizable.strings
+++ b/packages/native/apple/Sources/Astryx/Resources/zh-Hant.lproj/Localizable.strings
@@ -6,9 +6,30 @@
/* Screen-reader-only live-region announcement while a Button is in its loading state (spinner shown, action in flight). Progressive sense ("work in progress"), not a noun. Kept separate from `typeahead.loading` — translations may diverge. */
"@astryx.button.loading" = "載入中";
+/* Visible indicator shown next to a form field's label when the field is optional (isOptional). Mutually exclusive with the required indicator. Very short — appears inline after the label text. */
+"@astryx.field.optional" = "選填";
+
+/* Visible indicator shown next to a form field's label when the field must be filled in (isRequired). Mutually exclusive with the optional indicator. Very short — appears inline after the label text. */
+"@astryx.field.required" = "必填";
+
+/* Screen-reader-only description appended to a read-only form control when the platform does not expose aria-readonly for that control's host element. Short state label, not an instruction. */
+"@astryx.input.readOnly" = "唯讀";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is error. Activating or focusing the button reveals the error message in a tooltip. Keep it short — it labels an icon-only button. */
+"@astryx.input.statusButton.error" = "錯誤詳細資料";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is success. Activating or focusing the button reveals the success message in a tooltip. */
+"@astryx.input.statusButton.success" = "成功詳細資料";
+
+/* Accessible name for the focusable status icon button inside an input when statusVariant is 'tooltip' and the status type is warning. Activating or focusing the button reveals the warning message in a tooltip. */
+"@astryx.input.statusButton.warning" = "警告詳細資料";
+
/* Screen-reader-only default name for a standalone Spinner's role="status" element, used when the consumer supplies neither `aria-label` nor a visible string label. Present-progressive form. Kept separate from `button.loading` and `typeahead.loading` — translations may diverge. */
"@astryx.spinner.loading" = "載入中";
+/* Screen-reader-only label on the X that clears the value from a TextInput. Example: `Clear Email`, `Clear Name`. */
+"@astryx.textInput.clearLabel" = "清除 {label}";
+
/* Generic screen-reader name for a Thumbnail (image preview) that has no `alt` or `label`. Last-resort fallback so the control is never nameless; prefer a real name via `alt` or `label`. */
"@astryx.thumbnail.fallbackName" = "縮圖";
diff --git a/packages/native/apple/Sources/Astryx/TextInput/TextInput.spec.md b/packages/native/apple/Sources/Astryx/TextInput/TextInput.spec.md
new file mode 100644
index 0000000000..49c3e4cb94
--- /dev/null
+++ b/packages/native/apple/Sources/Astryx/TextInput/TextInput.spec.md
@@ -0,0 +1,179 @@
+---
+schema_version: 3
+template_version: 7
+kind: component
+id: component:swift/TextInput
+platform_of: component:TextInput
+authority: draft
+archive_reason: null
+superseded_by: null
+approved_by: null
+approved_at: null
+owners: [cixzhang]
+review_triggers: [public-api, behavior, theming, accessibility]
+verified_by: [packages/native/apple/Tests/AstryxTests/TextInputTests.swift]
+modules: []
+families: [family:input-fields]
+design_specs: []
+architecture: [architecture:public-component-api]
+contributing: []
+system_specs: [spec:AST-082, spec:AST-093, spec:AST-085]
+---
+
+# TextInput (Swift) component contract
+
+## Contract at a glance
+
+| Area | Contract |
+| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| Public contract | `TextInput(label:value:type:onChange:size:isLabelHidden:description:isOptional:isRequired:onEnter:isDisabled:isReadOnly:disabledMessage:isLoading:placeholder:labelTooltip:status:statusVariant:hasClear:hasAutoFocus:base:)` and `TextInput(_ props: TextInputProps)`, a SwiftUI `View` in module `Astryx`. |
+| Behavior | An editable field is SwiftUI's `TextField`, or `SecureField` for a password. A read-only or disabled field draws its value, keeps a focus stop without raising a keyboard, and reads to VoiceOver as SwiftUI's text field. |
+| End-user impact | A person types in the platform's own field; keyboard users still reach a read-only or disabled field and its reason; VoiceOver users hear the name, any error, the description, and the state. |
+| Builder impact | An app passes `value` and `onChange` as the contract types them, not a `Binding`. |
+| Compatibility/readiness | Breaking for canary callers: a `Binding` gives way to `value` and `onChange`, as the contract types them. Draft; built and tested on macOS and the iOS Simulator. |
+| Review checks | Reject a read-only field that raises a keyboard or accepts edits, a disabled field that leaves focus, a read-only password that shows its characters, an error only in the hint, or `.help` for a tip. |
+| Governing rules | `component:TextInput` FR3–FR10, FR13, FR15; `family:input-fields` FR4; `spec:AST-085`; `spec:AST-082` FR3, FR7, FR11; `spec:AST-093` FR1–FR5; the Swift component API, tooltip, and accessibility records under `packages/native/specs/swift/library/`. |
+
+This table is a review projection; the body below is authoritative.
+
+## Intent
+
+TextInput on Apple platforms is core's text field drawn with SwiftUI's own
+field for typing, so input methods, autofill, and the keyboard work the
+platform's way, while its read-only and disabled states keep core's focus and
+reading behavior where SwiftUI's field cannot.
+
+## Compatibility and migration
+
+- Released default preserved: `not yet released`
+- Compatibility class: breaking for canary callers (`Binding` → `value` and `onChange`)
+- Controlled/uncontrolled behavior: controlled; `value` and `onChange` only
+- Migration decision: none
+
+Consumer migration instructions belong in consumer docs and release notes.
+
+## Ownership boundary
+
+**Owns**
+
+- Which platform field Swift uses in each state, how a read-only or disabled
+ field keeps focus and reads to VoiceOver, and its status announcements.
+
+**Does not own / non-goals**
+
+- The meaning of TextInput's props and states — owned by `component:TextInput`
+ and `family:input-fields`.
+- Tooltip behavior — owned by the Swift tooltip record.
+
+## Public concepts
+
+| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
+| ------------ | ----------------------------- | ------------------------------------------------------------------------ | ----------------------------------------- | -------- | --------------------------- | ------------ | ---------------------- |
+| field | editable; drawn | SwiftUI `TextField`/`SecureField`, or the drawn read-only/disabled field | always | editable | `component:swift/TextInput` | experimental | none |
+| availability | editable; read-only; disabled | disabled wins over read-only | always | editable | `component:TextInput` | experimental | none |
+
+## Behavioral and layout contract
+
+| ID | Candidate invariant | Basis | Draft review state |
+| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------- | ------------------ |
+| FR1 | Both initializers MUST build the same `TextInputProps`. Edits reach `onChange` only while the field is editable; Return runs `onEnter` while editable or read-only. | Swift component API A2, A3, A5; `component:TextInput` FR3, FR10 | verify |
+| FR2 | A read-only or disabled field MUST draw its value (masked for a password, the placeholder when empty), keep its focus stop without raising a keyboard (a field that becomes read-only or disabled while focused keeps focus: the editable and drawn parts stay in one view structure and focus moves between them), accept no edits, and read to VoiceOver as SwiftUI's text field (`accessibilityRepresentation`): dimmed when disabled, a secure field for a password, with "Read only" or the disabled reason in its description. | `component:TextInput` FR6, FR8; `spec:AST-085`; `family:input-fields` FR4; AV1 | verify |
+| FR3 | An error MUST be in the field's VoiceOver label after its name; the description and status message MUST stay readable as text and in the description. A status message, and "Loading", are announced on the field's first appearance and when they change, an error at high priority. | `component:TextInput` FR4, FR9; `component:FieldStatus` AR1 | verify |
+| FR4 | The label tip, the tooltip-variant status, the clear button, and a disabled reason MUST show through the shared Astryx tooltip; no view uses `.help`. The tooltip-variant status tip is a button, as core's status icon is, named by its status and speaking its message when VoiceOver activates it. Trailing controls each lay out across their own 44-point target. | `component:TextInput` FR5, FR7, FR15; `spec:AST-082` FR11; Swift tooltip record | verify |
+| FR5 | Base `id` and `isHidden` MUST apply to the field control, TextInput's base target: `id` is its accessibility identifier, and `isHidden` takes the control and its buttons out of layout and focus (autofocus included) while the label, description, and status stay, with the label and its note read by VoiceOver as text. | `component:TextInput` FR13; `spec:AST-082` FR7 | verify |
+
+### Allowed variation
+
+- **AV1 — The drawn read-only and disabled field.** No platform field fits
+ both states on both platforms, so Swift draws the value and gives VoiceOver
+ SwiftUI's text field in its place. Fields considered:
+ - SwiftUI `TextField` and `SecureField`: no read-only mode, and `.disabled`
+ removes the focus stop core keeps (`spec:AST-085`).
+ - UIKit `UITextField` refusing edits through its delegate: focus raises the
+ keyboard unless its input view is replaced, its text and colors must be
+ bridged from the theme by hand, and SwiftUI's image renderer and previews
+ do not draw it.
+ - AppKit `NSTextField` with editing off and selection on: a true read-only
+ field on macOS, with no iOS counterpart, so the two platforms would differ.
+
+### Representative states
+
+| State | Required invariant | Allowed variation |
+| ------------------ | ----------------------------------------------------------- | ----------------- |
+| editable | the platform field; edits reach `onChange` | none |
+| read-only | value shown; focus stop; no keyboard; Return runs `onEnter` | none |
+| read-only password | masked; not selectable | none |
+| disabled | dimmed; focus stop; reads as a dimmed text field | none |
+| error | error in the label; message readable | none |
+
+### Transformation and precedence order
+
+- **ORD1 — Availability.** Disabled, then read-only, then editable, as in core.
+
+### Performance and resources
+
+- **PR1 — No work while idle.** The view holds no timers; announcements fire
+ only on first appearance or a change.
+
+## Accessibility contract
+
+- **AR1 — Name, error, description.** The name is the label and its note; an
+ error follows it in the label; the description, other status messages,
+ "Read only", and the disabled reason are the description.
+- **AR2 — Rendered tree not measured.** Tests assert what the view sets; the
+ rendered accessibility tree and keyboard focus are not measured until an
+ app-hosted target exists.
+
+## Design relationships
+
+| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
+| ---------------- | ------------------------- | -------------------------- | -------------- | ------------------ |
+| Field | the platform's text field | prescribed by the platform | primary | FR1, FR2 |
+
+The component implements design requirements without copying their rationale.
+
+Platform control: SwiftUI `TextField` and `SecureField` for editing; the drawn
+field in AV1 for read-only and disabled (`spec:AST-093` FR2). Guideline pages:
+Text fields and Accessibility in the Apple Human Interface Guidelines
+(`spec:AST-093` FR3).
+
+Theme values read (`spec:AST-093` FR4): `color.textPrimary`,
+`color.textSecondary`, `color.textDisabled`, `color.borderEmphasized`, the
+status roles `architecture:theme-tokens` INV11 assigns (`color.borderError`,
+`color.borderWarning`, `color.borderSuccess` for the border;
+`color.iconError`, `color.iconWarning`, `color.iconSuccess` for the icon;
+`color.errorMuted`, `color.warningMuted`, `color.successMuted` for the
+message ground and `color.onErrorMuted`, `color.onWarningMuted`,
+`color.onSuccessMuted` for its text),
+`size.elementSm`, `size.elementMd`, `size.elementLg`, `size.borderWidth`,
+`radius.element`, `space` steps, `font.body`, `font.label`, `font.supporting`,
+`font.weight.medium`, `font.weight.normal`,
+`font.family.body`, the theme's icons, and the Dynamic Type scale.
+
+## Family and system relationships
+
+- `component:TextInput` and `family:input-fields` own the props and states;
+ this record states only how Swift draws them.
+
+## Verification map
+
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------ |
+| FR1 | `TextInputTests.swift` initializer and edit tests | both initializers; editable, read-only, disabled | differing props, or an edit that reaches `onChange` while not editable, fails | `audit:swift/TextInput/api` |
+| FR2 | `TextInputTests.swift` read-only, password, placeholder, and focus-stop tests, and the VoiceOver field each state gives `accessibilityRepresentation` (text or secure, dimmed when disabled, label, value, and description); the rendered tree and focus are not measured | read-only; read-only password; empty; disabled; disabled password; error | a shown password, a missing placeholder, a secure field read as text, an undimmed disabled field, or a disabled field without a stop fails | `audit:swift/TextInput/states` |
+| FR3 | `TextInputTests.swift` label, description, and announcement tests | error with and without a message; warning; type change | an error missing from the label, or a missed announcement change, fails | `audit:swift/TextInput/a11y` |
+| FR4 | `TooltipPresenterTests.swift` `.help` guard; `TextInputTests.swift` checks the row ends in buttons and that the status tip is a button named by its status with its message; overlap of the 44-point targets is not measured until an app-hosted test can hit-test them | clear and tooltip status together; tooltip, attached, and detached statuses | `.help` in a view, or a status tip without the button trait, fails | `audit:swift/TextInput/tips` |
+| FR5 | `TextInputTests.swift` base tests: `isHidden` leaves the control out of layout; `id` and the control base target; the identifier on the drawn control is not measured until an app-hosted test exists | `id`; `isHidden` | `isHidden` keeping the control in layout or hiding the label fails | `audit:swift/TextInput/base` |
+
+## Decision log
+
+No component-local decision is recorded.
+
+## Open questions
+
+None.
+
+## Content boundary
+
+This file does not duplicate consumer prop tables/examples, current audit
+results, implementation steps, or family/system rules. It links to their owners.
diff --git a/packages/native/apple/Sources/Astryx/TextInput/TextInput.swift b/packages/native/apple/Sources/Astryx/TextInput/TextInput.swift
index bccb5ab0f7..682a165310 100644
--- a/packages/native/apple/Sources/Astryx/TextInput/TextInput.swift
+++ b/packages/native/apple/Sources/Astryx/TextInput/TextInput.swift
@@ -1,73 +1,359 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
// Adapted from github.com/ejc3/astryx-swift (MIT).
-import SwiftUI
-
-/// Core's `TextInput` types.
-public enum AstryxTextInputType: String, CaseIterable, Sendable {
- case text
- case email
- case password
-}
-
-/// A labeled one-line text field, painted with the theme's tokens. The label
-/// stays visible above the field and is the field's accessibility label.
+/// A labeled one-line text field, painted with the theme's tokens. It takes
+/// core's TextInput props (`TextInputProps`): the label stays visible above
+/// the field unless hidden, and is the field's accessible name either way.
public struct TextInput: View {
- let label: String
- @Binding var value: String
- let type: AstryxTextInputType
- let size: AstryxButtonSize
- let placeholder: String?
- let isDisabled: Bool
+ public let props: TextInputProps
@Environment(\.astryx) private var astryx
+ /// Which of the field's two parts holds focus: the editable field, or the
+ /// drawn read-only or disabled field.
+ enum FieldFocus: Hashable { case editable, drawn }
+ @FocusState private var focus: FieldFocus?
+ /// Set on the first appearance, so a field that scrolls back into view in a
+ /// List or Form does not announce or take focus again.
+ @State private var hasAppeared = false
+ public init(_ props: TextInputProps) {
+ self.props = props
+ }
+
+ /// - Parameters:
+ /// - label: core's `label`, the field's visible and accessible name.
+ /// - value: core's `value`, the text the field shows.
+ /// - type: core's `type`: `text`, `email`, or `password`.
+ /// - onChange: core's `onChange`, called with each edit.
+ /// - size: core's `size`; `md` when nil.
+ /// - isLabelHidden: core's `isLabelHidden`: no visible label, the same
+ /// accessible name.
+ /// - description: core's `description`, shown between the label and the
+ /// field and read after the label.
+ /// - isOptional: core's `isOptional`, an "Optional" note after the label.
+ /// - isRequired: core's `isRequired`, a "Required" note after the label.
+ /// - onEnter: core's `onEnter`, called when the person submits the field
+ /// (Return), never while an input method is still composing.
+ /// - isDisabled: core's `isDisabled`: dimmed and not editable.
+ /// - isReadOnly: core's `isReadOnly`: shown at full strength, selectable,
+ /// not editable.
+ /// - disabledMessage: core's `disabledMessage`, why a disabled field is
+ /// disabled: a tip on hover or tap, and read after the label.
+ /// - isLoading: core's `isLoading`: a spinner, and "Loading" spoken once
+ /// when it starts.
+ /// - placeholder: core's `placeholder`.
+ /// - labelTooltip: core's `labelTooltip`, a tip on an info icon after the
+ /// label: on hover or tap.
+ /// - status: core's `status`: a colored border and status icon, and its
+ /// message below the field.
+ /// - statusVariant: core's `statusVariant`: the message `attached` to the
+ /// field (default), `detached` below it, or in a `tooltip` on the icon.
+ /// - hasClear: core's `hasClear`, a clear button while there is text.
+ /// - hasAutoFocus: core's `hasAutoFocus`, focus when the field appears.
+ /// - base: core's base props; `id` names the field itself.
public init(
label: String,
- value: Binding<String>,
- type: AstryxTextInputType = .text,
- size: AstryxButtonSize = .md,
+ value: String,
+ type: TextInputType? = nil,
+ 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,
- isDisabled: Bool = false
+ labelTooltip: String? = nil,
+ status: TextInputStatus? = nil,
+ statusVariant: TextInputStatusVariant? = nil,
+ hasClear: Bool? = nil,
+ hasAutoFocus: Bool? = nil,
+ base: AstryxBaseProps = AstryxBaseProps()
) {
- self.label = label
- self._value = value
- self.type = type
- self.size = size
- self.placeholder = placeholder
- self.isDisabled = isDisabled
+ self.init(
+ TextInputProps(
+ type: type,
+ label: label,
+ value: value,
+ onChange: onChange,
+ size: size,
+ isLabelHidden: isLabelHidden,
+ description: description,
+ isOptional: isOptional,
+ isRequired: isRequired,
+ onEnter: onEnter,
+ isDisabled: isDisabled,
+ isReadOnly: isReadOnly,
+ disabledMessage: disabledMessage,
+ isLoading: isLoading,
+ placeholder: placeholder,
+ labelTooltip: labelTooltip,
+ status: status,
+ statusVariant: statusVariant,
+ hasClear: hasClear,
+ hasAutoFocus: hasAutoFocus,
+ base: base
+ )
+ )
}
+ var isDisabled: Bool { props.isDisabled == true }
+ /// Disabled wins when both are set, as in core.
+ var isReadOnly: Bool { props.isReadOnly == true && !isDisabled }
+ var statusVariant: TextInputStatusVariant { props.statusVariant ?? .attached }
+
public var body: some View {
- VStack(alignment: .leading, spacing: astryx.space(1)) {
- Text(label, type: .label, color: .secondary)
- .accessibilityHidden(true)
+ SwiftUI.VStack(alignment: .leading, spacing: astryx.tokens.space.s1) {
+ if props.isLabelHidden != true {
+ labelRow
+ }
+ // A hidden label hides the description with it, as core's field does;
+ // VoiceOver still reads it on the field. A shown description is also
+ // its own text in the reading order, as core's is.
+ if props.isLabelHidden != true, let description = props.description {
+ Text(description, type: .supporting, color: .secondary)
+ }
+ SwiftUI.VStack(alignment: .leading, spacing: 0) {
+ // Base `isHidden` targets the control, as `id` does: the control and
+ // its buttons leave layout and focus, while the label, description,
+ // and status stay (AST-082 FR7).
+ if !hidesControl {
+ fieldRow
+ }
+ statusMessage
+ }
+ }
+ .onAppear {
+ guard !hasAppeared else { return }
+ hasAppeared = true
+ if props.hasAutoFocus == true, !hidesControl { focus = isDrawn ? .drawn : .editable }
+ // A field that appears busy says so, as core announces a busy start.
+ if props.isLoading == true { AccessibilityNotification.Announcement(AstryxStrings.spinnerLoading).post() }
+ // A status message already present when the field appears is
+ // announced too, as core's field status does.
+ if let announcement = statusAnnouncement { announce(announcement) }
+ }
+ .onChange(of: props.isLoading == true) { _, loading in
+ if loading { AccessibilityNotification.Announcement(AstryxStrings.spinnerLoading).post() }
+ }
+ .onChange(of: statusAnnouncement) { _, announcement in
+ // A status message that appears or changes is announced: an error at
+ // once, others when VoiceOver is free, as core's field status does.
+ if let announcement { announce(announcement) }
+ }
+ }
+
+ // MARK: Label
+
+ /// The note after the label: "Optional" or "Required".
+ /// `isOptional` wins when both are set, as in core.
+ var labelNote: String? {
+ if props.isOptional == true { return AstryxStrings.fieldOptional }
+ if props.isRequired == true { return AstryxStrings.fieldRequired }
+ return nil
+ }
+
+ /// The status message to announce when the field appears with it, and when
+ /// its words or its type change.
+ struct StatusAnnouncement: Equatable {
+ var message: String
+ var type: TextInputStatusType
+ var isError: Bool { type == .error }
+ }
+
+ var statusAnnouncement: StatusAnnouncement? {
+ guard let status = props.status, let message = status.message else { return nil }
+ return StatusAnnouncement(message: message, type: status.type)
+ }
+
+ /// Posts a status message: an error at once, others when VoiceOver is free.
+ func announce(_ announcement: StatusAnnouncement) {
+ var words = AttributedString(announcement.message)
+ words.accessibilitySpeechAnnouncementPriority = announcement.isError ? .high : .default
+ AccessibilityNotification.Announcement(words).post()
+ }
+
+ private var labelRow: some View {
+ SwiftUI.HStack(alignment: .firstTextBaseline, spacing: astryx.tokens.space.s1) {
+ // The field reads the label and its note, so VoiceOver skips them here
+ // while the field shows; with the field hidden they are read as text.
+ Text(props.label, type: .label, color: isDisabled ? .disabled : .secondary, weight: .medium)
+ .accessibilityHidden(!hidesControl)
+ if let note = labelNote {
+ Text("∙ \(note)", type: .supporting, color: .secondary, weight: .normal)
+ .accessibilityHidden(!hidesControl)
+ }
+ if let tip = props.labelTooltip {
+ tipIcon(tip, icon: "info", label: tip)
+ .foregroundStyle(astryx.tokens.color.textSecondary)
+ }
+ }
+ }
+
+ // MARK: Field
+
+ /// The field's accessible name: the label and its note, as core's label
+ /// element names the input.
+ var accessibilityName: String {
+ labelNote.map { "\(props.label), \($0)" } ?? props.label
+ }
+
+ /// The label VoiceOver reads on the field: the name, then an error, since
+ /// SwiftUI has no invalid state and a hint is skipped with Speak Hints off.
+ var accessibilityLabelText: String {
+ guard let status = props.status, status.type == .error else { return accessibilityName }
+ return "\(accessibilityName), \(status.message ?? AstryxStrings.statusButton(.error))"
+ }
+
+ /// What VoiceOver reads after the name: the description, the status message,
+ /// and the disabled reason, in core's `aria-describedby` order.
+ /// An error leads, since SwiftUI has no invalid state to expose: its
+ /// message, or the error status name when it has none. A read-only field
+ /// says so, as core does where a control cannot expose read-only.
+ var accessibilityDescription: String {
+ var parts: [String] = []
+ if let description = props.description { parts.append(description) }
+ if let status = props.status, status.type != .error, let message = status.message { parts.append(message) }
+ if isReadOnly { parts.append(AstryxStrings.inputReadOnly) }
+ if isDisabled, let reason = props.disabledMessage { parts.append(reason) }
+ return parts.joined(separator: ", ")
+ }
+
+ /// Edits reach `onChange` only while the field can be edited.
+ var text: Binding<String> {
+ Binding(
+ get: { props.value },
+ set: { newValue in
+ guard !isDisabled, !isReadOnly else { return }
+ props.onChange?(newValue)
+ }
+ )
+ }
+
+ private var fieldRow: some View {
+ let shape = RoundedRectangle(cornerRadius: astryx.tokens.radius.element, style: .continuous)
+ return SwiftUI.HStack(spacing: astryx.tokens.space.s2) {
field
- .font(astryx.font(size: "text-body-size", 14, weight: "text-body-weight"))
- .foregroundStyle(astryx.color("color-text-primary"))
- .padding(.horizontal, astryx.space(3))
- .frame(minHeight: max(44, astryx.size(size.heightToken, size.fallbackHeight) * astryx.textScale))
- .background(
- RoundedRectangle(cornerRadius: astryx.size("radius-element", 8), style: .continuous)
- .strokeBorder(astryx.color("color-border-emphasized"), lineWidth: astryx.size("border-width", 1))
- )
- .disabled(isDisabled)
- .opacity(isDisabled ? 0.5 : 1)
- .accessibilityLabel(SwiftUI.Text(accessibilityText))
+ .font(astryx.font(TypeStyle(astryx.tokens.font.body, families: astryx.tokens.font.family.body)))
+ .foregroundStyle(astryx.tokens.color.textPrimary)
+ .onSubmit { props.onEnter?() }
+ .accessibilityLabel(SwiftUI.Text(accessibilityLabelText))
+ .accessibilityHint(SwiftUI.Text(accessibilityDescription))
+ .astryxIdentifier(props.base.id)
+ if props.isLoading == true {
+ ProgressView().controlSize(.small).accessibilityHidden(true)
+ }
+ // Trailing controls sit side by side, each across its own 44-point
+ // target, so no two tap regions overlap.
+ SwiftUI.HStack(spacing: 0) {
+ if showsClear {
+ SwiftUI.Button {
+ props.onChange?("")
+ focus = .editable
+ } label: {
+ icon("close").frame(minWidth: 44, minHeight: 44).contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .foregroundStyle(astryx.tokens.color.textSecondary)
+ .astryxTooltip(AstryxStrings.clearTooltip, focus: .control)
+ .accessibilityLabel(SwiftUI.Text(AstryxStrings.clearLabel(props.label)))
+ }
+ statusIcon
+ .frame(minWidth: hasTrailingButtons ? 44 : nil)
+ }
}
+ .padding(.leading, astryx.tokens.space.s3)
+ .padding(.trailing, hasTrailingButtons ? 0 : astryx.tokens.space.s3)
+ .frame(minHeight: max(44, height * astryx.textScale))
+ .background(
+ shape.strokeBorder(borderColor, lineWidth: astryx.tokens.size.borderWidth)
+ )
+ .opacity(isDisabled ? 0.5 : 1)
+ // A disabled field shows its reason in the shared tooltip on hover, on
+ // keyboard focus of its drawn field, and on a tap; VoiceOver reads the
+ // reason on the field.
+ .astryxTooltip(isDisabled ? props.disabledMessage : nil, focus: reasonTooltipFocus, touch: .tap)
}
- /// The field's accessible name: its visible label, which VoiceOver reads
- /// on the field itself rather than as separate text.
- var accessibilityText: String { label }
+ /// How keyboard focus opens the disabled reason: the row holds the drawn
+ /// field, which takes the focus, so focus inside the row opens it, as
+ /// Thumbnail's tooltip does for its parts.
+ var reasonTooltipFocus: TooltipFocus { .inside(focus == .drawn) }
- @ViewBuilder private var field: some View {
- let prompt = placeholder.map { SwiftUI.Text($0).foregroundStyle(astryx.color("color-text-secondary")) }
- switch type {
+ /// Whether the field row ends in buttons, whose 44-point targets reach its
+ /// edge in place of the trailing padding.
+ var hasTrailingButtons: Bool {
+ showsClear || (statusVariant == .tooltip && props.status?.message != nil)
+ }
+
+ /// A disabled field keeps its focus stop, as core's disabled input does
+ /// (`aria-disabled`), so keyboard users reach it and its reason.
+ var keepsFocusWhileDisabled: Bool { isDisabled }
+
+ /// Base `isHidden` hides the field control, TextInput's base target.
+ var hidesControl: Bool { props.base.isHidden == true }
+
+ var showsClear: Bool {
+ props.hasClear == true && !props.value.isEmpty && !isDisabled && !isReadOnly
+ }
+
+ var height: CGFloat {
+ switch props.size ?? .md {
+ case .sm: astryx.tokens.size.elementSm
+ case .md: astryx.tokens.size.elementMd
+ case .lg: astryx.tokens.size.elementLg
+ }
+ }
+
+ var borderColor: Color {
+ let color = astryx.tokens.color
+ guard !isDisabled, let status = props.status else { return color.borderEmphasized }
+ // The status border role, at 3:1 or more on the page (theme tokens INV11).
+ switch status.type {
+ case .error: return color.borderError
+ case .warning: return color.borderWarning
+ case .success: return color.borderSuccess
+ }
+ }
+
+ /// Whether the field draws its value instead of the editable field.
+ var isDrawn: Bool { isReadOnly || keepsFocusWhileDisabled }
+
+ /// Both parts stay in one view structure, so a field that becomes read-only
+ /// or disabled keeps its identity and its focus moves to the drawn part, as
+ /// core keeps focus on an input that becomes disabled (`spec:AST-085`).
+ private var field: some View {
+ ZStack(alignment: .leading) {
+ editableField
+ .focused($focus, equals: .editable)
+ .disabled(isDrawn)
+ .opacity(isDrawn ? 0 : 1)
+ .accessibilityHidden(isDrawn)
+ readOnlyField
+ .focusable(isDrawn)
+ .focused($focus, equals: .drawn)
+ .opacity(isDrawn ? 1 : 0)
+ .allowsHitTesting(isDrawn)
+ .accessibilityHidden(!isDrawn)
+ }
+ .onChange(of: isDrawn) { _, drawn in
+ if focus != nil { focus = drawn ? .drawn : .editable }
+ }
+ }
+
+ @ViewBuilder private var editableField: some View {
+ let prompt = props.placeholder.map {
+ SwiftUI.Text($0).foregroundStyle(astryx.tokens.color.textSecondary)
+ }
+ switch props.type ?? .text {
case .password:
- SecureField("", text: $value, prompt: prompt)
+ SecureField("", text: text, prompt: prompt)
.textContentType(.password)
case .email:
- TextField("", text: $value, prompt: prompt)
+ TextField("", text: text, prompt: prompt)
.textContentType(.emailAddress)
.autocorrectionDisabled()
#if os(iOS)
@@ -75,7 +361,210 @@ public struct TextInput: View {
.textInputAutocapitalization(.never)
#endif
case .text:
- TextField("", text: $value, prompt: prompt)
+ TextField("", text: text, prompt: prompt)
+ }
+ }
+
+ /// What a read-only field shows: the value, masked for a password.
+ var readOnlyText: String {
+ props.type == .password ? String(repeating: "\u{2022}", count: props.value.count) : props.value
+ }
+
+ /// Whether a read-only field shows its placeholder: when it has no value.
+ var showsReadOnlyPlaceholder: Bool { props.value.isEmpty && props.placeholder != nil }
+
+ /// Read-only or disabled: the value, never editable, with the placeholder
+ /// when empty. It keeps a focus stop, as core's read-only and disabled
+ /// inputs do, without raising a keyboard; Return runs `onEnter` only while
+ /// read-only. VoiceOver reads a SwiftUI text field in its place, dimmed when
+ /// disabled, with "Read only" or the disabled reason in its description,
+ /// since a SwiftUI text field cannot be read-only and a disabled one takes
+ /// no focus. A password stays masked and cannot be selected or copied.
+ @ViewBuilder private var readOnlyField: some View {
+ let shown = showsReadOnlyPlaceholder
+ ? SwiftUI.Text(props.placeholder ?? "").foregroundStyle(astryx.tokens.color.textSecondary)
+ : SwiftUI.Text(readOnlyText)
+ // One line, as the field it stands in for: it stays laid out under the
+ // editable field, so a long value must not make that field grow taller.
+ let text = shown
+ .lineLimit(1)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .onKeyPress(.return) {
+ guard isReadOnly else { return .ignored }
+ props.onEnter?()
+ return .handled
+ }
+ // VoiceOver reads it as the platform's text field: dimmed when
+ // disabled, a secure field for a password, with the name and the
+ // description the field reads in every state.
+ .accessibilityRepresentation { accessibleField }
+ if props.type == .password {
+ text.textSelection(.disabled)
+ } else {
+ text.textSelection(.enabled)
+ }
+ }
+
+ /// What VoiceOver reads for a read-only or disabled field: which platform
+ /// field, whether it is dimmed, and its label, value, and description.
+ struct AccessibleField: Equatable {
+ enum Kind: Equatable { case text, secure }
+ var kind: Kind
+ var isDimmed: Bool
+ var label: String
+ var value: String
+ var hint: String
+ }
+
+ var accessibleFieldDescription: AccessibleField {
+ AccessibleField(
+ kind: props.type == .password ? .secure : .text,
+ isDimmed: isDisabled,
+ label: accessibilityLabelText,
+ value: props.value,
+ hint: accessibilityDescription
+ )
+ }
+
+ /// The platform text field VoiceOver reads for a read-only or disabled field.
+ @ViewBuilder private var accessibleField: some View {
+ let field = accessibleFieldDescription
+ let value = Binding.constant(field.value)
+ Group {
+ switch field.kind {
+ case .secure: SecureField(field.label, text: value)
+ case .text: TextField(field.label, text: value)
+ }
+ }
+ .disabled(field.isDimmed)
+ .accessibilityHint(SwiftUI.Text(field.hint))
+ }
+
+ // MARK: Status
+
+ /// The status icon in the field: plain when attached, a tip button when the
+ /// message shows in a tip, and none when detached (its message has one).
+ @ViewBuilder private var statusIcon: some View {
+ if let status = props.status, statusVariant != .detached {
+ if statusVariant == .tooltip, let message = status.message {
+ tipIcon(message, icon: status.type.rawValue, label: AstryxStrings.statusButton(status.type), inField: true, isButton: true)
+ .foregroundStyle(statusColor(status.type))
+ } else {
+ icon(status.type.rawValue)
+ .foregroundStyle(statusColor(status.type))
+ .accessibilityHidden(true)
+ }
+ }
+ }
+
+ /// The message box below the field, attached to it or detached from it.
+ @ViewBuilder private var statusMessage: some View {
+ if let status = props.status, let message = status.message, statusVariant != .tooltip {
+ let detached = statusVariant == .detached
+ let radius = astryx.tokens.radius.element
+ SwiftUI.HStack(alignment: .firstTextBaseline, spacing: astryx.tokens.space.s1) {
+ if detached {
+ icon(status.type.rawValue).accessibilityHidden(true)
+ }
+ SwiftUI.Text(message)
+ .font(astryx.font(TypeStyle(astryx.tokens.font.supporting, families: astryx.tokens.font.family.body)))
+ }
+ .foregroundStyle(messageColor(status.type))
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.horizontal, astryx.tokens.space.s2)
+ .padding(.vertical, astryx.tokens.space.s2)
+ .background(
+ UnevenRoundedRectangle(
+ topLeadingRadius: detached ? radius : 0,
+ bottomLeadingRadius: radius,
+ bottomTrailingRadius: radius,
+ topTrailingRadius: detached ? radius : 0,
+ style: .continuous
+ )
+ .fill(messageGround(status.type))
+ )
+ .padding(.top, detached ? astryx.tokens.space.s1 : 0)
+ // The message is also its own text in the reading order, as core's is.
+ .accessibilityElement(children: .combine)
+ }
+ }
+
+ /// The status icon role on the page (theme tokens INV11).
+ func statusColor(_ type: TextInputStatusType) -> Color {
+ let color = astryx.tokens.color
+ switch type {
+ case .error: return color.iconError
+ case .warning: return color.iconWarning
+ case .success: return color.iconSuccess
+ }
+ }
+
+ /// Content on the muted status ground, at 4.5:1 or more (theme tokens INV11).
+ func messageColor(_ type: TextInputStatusType) -> Color {
+ let color = astryx.tokens.color
+ switch type {
+ case .error: return color.onErrorMuted
+ case .warning: return color.onWarningMuted
+ case .success: return color.onSuccessMuted
+ }
+ }
+
+ func messageGround(_ type: TextInputStatusType) -> Color {
+ let color = astryx.tokens.color
+ switch type {
+ case .error: return color.errorMuted
+ case .warning: return color.warningMuted
+ case .success: return color.successMuted
+ }
+ }
+
+ // MARK: Tips
+
+ /// An icon that shows `text` in the shared Astryx tooltip: on hover with a
+ /// pointer, on keyboard focus (it is a tab stop), and on a direct tap, as
+ /// core's tooltip icon does. VoiceOver reads it as `label` with `text` as
+ /// the hint. In the field row it lays out across its whole 44-point target;
+ /// beside the label it reaches 44 points without growing the row.
+ /// A status tip is a button, as core's status icon is a `<button>`:
+ /// activating it with VoiceOver speaks its message.
+ private func tipIcon(_ text: String, icon name: String, label: String, inField: Bool = false, isButton: Bool = false) -> some View {
+ let tip = TipAccessibility(text: text, label: label, isButton: isButton)
+ return icon(name)
+ .frame(minWidth: inField ? 44 : nil, minHeight: inField ? 44 : nil)
+ .contentShape(Rectangle())
+ .astryxMinimumHitArea(inField ? 44 : iconSide)
+ .accessibilityElement()
+ .accessibilityLabel(SwiftUI.Text(tip.label))
+ .accessibilityAddTraits(tip.isButton ? .isButton : [])
+ .accessibilityAction {
+ if tip.isButton { AccessibilityNotification.Announcement(tip.text).post() }
+ }
+ .astryxTooltip(text, hint: tip.hint, focus: .tabStop, touch: .tap)
+ }
+
+ /// What VoiceOver gets for a tip icon: its name, whether it is a button, and
+ /// its words as the hint unless they are the name.
+ struct TipAccessibility: Equatable {
+ var text: String
+ var label: String
+ var isButton: Bool
+ var hint: String? { label == text ? nil : text }
+ }
+
+ /// The tooltip-variant status tip's accessibility, for the current status.
+ var statusTipAccessibility: TipAccessibility? {
+ guard statusVariant == .tooltip, let status = props.status, let message = status.message else { return nil }
+ return TipAccessibility(text: message, label: AstryxStrings.statusButton(status.type), isButton: true)
+ }
+
+ /// A shared icon at the supporting text size: the theme's SF Symbol or app
+ /// asset, else the default symbol; a name nothing maps draws nothing.
+ var iconSide: CGFloat { astryx.tokens.font.supporting.size * astryx.textScale }
+
+ @ViewBuilder private func icon(_ name: String) -> some View {
+ let side = iconSide
+ if let image = astryx.icon(name) {
+ image.sized(side).font(.system(size: side))
}
}
}
diff --git a/packages/native/apple/Sources/Astryx/Theme/Theme.swift b/packages/native/apple/Sources/Astryx/Theme/Theme.swift
index 94978e7c25..05cc0d9e9e 100644
--- a/packages/native/apple/Sources/Astryx/Theme/Theme.swift
+++ b/packages/native/apple/Sources/Astryx/Theme/Theme.swift
@@ -65,31 +65,31 @@ public struct AstryxStyle: Sendable {
/// A token color by its CSS name, for code that only has the name. A name
/// the theme does not define draws clear. New code reads the typed members.
- public func color(_ token: String) -> Color {
+ func color(_ token: String) -> Color {
tokens.color.value(named: token) ?? .clear
}
/// A token size in points by its CSS name, or `fallback` when the theme does
/// not define it. New code reads the typed members.
- public func size(_ token: String, _ fallback: CGFloat) -> CGFloat {
+ func size(_ token: String, _ fallback: CGFloat) -> CGFloat {
tokens.space.value(named: token) ?? tokens.radius.value(named: token)
?? tokens.size.value(named: token) ?? tokens.font.number(named: token) ?? fallback
}
/// A step on the spacing ladder: `space(4)` reads `spacing-4`.
- public func space(_ step: Int) -> CGFloat {
+ func space(_ step: Int) -> CGFloat {
size("spacing-\(step)", CGFloat(step) * 4)
}
/// A token font size grown by Dynamic Type.
- public func fontSize(_ token: String, _ fallback: CGFloat) -> CGFloat {
+ func fontSize(_ token: String, _ fallback: CGFloat) -> CGFloat {
size(token, fallback) * textScale
}
/// The theme's font family at a token size and a token weight. The first
/// family in the stack that the device has wins; a system family, such as
/// `-apple-system` or `sans-serif`, is the system font.
- public func font(
+ func font(
size token: String,
_ fallback: CGFloat,
weight: String,
diff --git a/packages/native/apple/Sources/Astryx/Wire/AstryxNodeView.swift b/packages/native/apple/Sources/Astryx/Wire/AstryxNodeView.swift
index 69f7e241e3..7b65ddc7dd 100644
--- a/packages/native/apple/Sources/Astryx/Wire/AstryxNodeView.swift
+++ b/packages/native/apple/Sources/Astryx/Wire/AstryxNodeView.swift
@@ -15,8 +15,10 @@ public struct AstryxNodeView: View {
public var body: some View {
switch node {
+ case .button(let button): Button(button.viewProps(send: send))
case .text(let text): Text(text.viewProps(send: send))
case .heading(let heading): Heading(heading.viewProps(send: send))
+ case .textInput(let input): TextInput(input.viewProps(send: send))
case .card(let card): Card(card.viewProps(send: send), children: card.props.children ?? [], send: send)
case .icon(let icon): Icon(icon.viewProps(send: send))
case .avatar(let avatar):
diff --git a/packages/native/apple/Templates/Login/LoginTemplate.swift b/packages/native/apple/Templates/Login/LoginTemplate.swift
index da2c936d23..ea3ae4605f 100644
--- a/packages/native/apple/Templates/Login/LoginTemplate.swift
+++ b/packages/native/apple/Templates/Login/LoginTemplate.swift
@@ -38,7 +38,7 @@ public struct LoginTemplate: View {
ScrollView {
LoginTemplateContent(form: $form, signIn: signIn)
}
- .background(astryx.color("color-background-body").ignoresSafeArea())
+ .background(astryx.tokens.color.backgroundBody.ignoresSafeArea())
}
private func signIn() {
@@ -59,18 +59,18 @@ struct LoginTemplateContent: View {
@Environment(\.astryx) private var astryx
var body: some View {
- VStack(spacing: astryx.space(4)) {
- VStack(spacing: astryx.space(2)) {
+ VStack(spacing: astryx.tokens.space.s4) {
+ VStack(spacing: astryx.tokens.space.s2) {
Image(systemName: "cube")
- .font(.system(size: astryx.fontSize("font-size-2xl", 24)))
- .foregroundStyle(astryx.color("color-icon-primary"))
+ .font(.system(size: astryx.tokens.font.size.s2xl * astryx.textScale))
+ .foregroundStyle(astryx.tokens.color.iconPrimary)
.accessibilityHidden(true)
Text("Product Inc.", size: .lg, weight: .bold)
}
Card(padding: .v8) {
- VStack(alignment: .leading, spacing: astryx.space(4)) {
- VStack(spacing: astryx.space(1)) {
+ VStack(alignment: .leading, spacing: astryx.tokens.space.s4) {
+ VStack(spacing: astryx.tokens.space.s1) {
Heading("Sign in", level: .v2)
Text("Enter your credentials to continue", size: .sm, color: .secondary)
}
@@ -82,15 +82,17 @@ struct LoginTemplateContent: View {
TextInput(
label: "Email",
- value: $form.email,
+ value: form.email,
type: .email,
+ onChange: { form.email = $0 },
size: .lg,
placeholder: "[email protected]"
)
TextInput(
label: "Password",
- value: $form.password,
+ value: form.password,
type: .password,
+ onChange: { form.password = $0 },
size: .lg,
placeholder: "Enter your password"
)
@@ -99,14 +101,14 @@ struct LoginTemplateContent: View {
variant: .primary,
size: .lg,
isLoading: form.isLoading,
- fillsWidth: true,
- action: signIn
+ width: .fill,
+ onClick: signIn
)
}
}
}
.frame(maxWidth: 400)
- .padding(astryx.space(6))
+ .padding(astryx.tokens.space.s6)
.frame(maxWidth: .infinity)
}
}
diff --git a/packages/native/apple/Tests/AstryxTests/BannerTests.swift b/packages/native/apple/Tests/AstryxTests/BannerTests.swift
index 976e485e84..b6b6159028 100644
--- a/packages/native/apple/Tests/AstryxTests/BannerTests.swift
+++ b/packages/native/apple/Tests/AstryxTests/BannerTests.swift
@@ -9,9 +9,12 @@ import Testing
#expect(AstryxBannerStatus.allCases.map(\.iconName) == ["info", "warning", "error", "success"])
for status in AstryxBannerStatus.allCases {
#expect(style.icon(status.iconName) != nil)
- #expect(style.tokens.color.value(named: status.groundToken) != nil)
- #expect(style.tokens.color.value(named: status.iconToken) != nil)
}
+ let color = Theme.default.light.color
+ #expect(AstryxBannerStatus.info.groundColor(color) == color.accentMuted)
+ #expect(AstryxBannerStatus.error.groundColor(color) == color.errorMuted)
+ #expect(AstryxBannerStatus.warning.iconColor(color) == color.warning)
+ #expect(AstryxBannerStatus.success.iconColor(color) == color.success)
}
@Test func aThemeReplacesASharedIcon() {
diff --git a/packages/native/apple/Tests/AstryxTests/ButtonTests.swift b/packages/native/apple/Tests/AstryxTests/ButtonTests.swift
index 8e1b5633ff..d687183e19 100644
--- a/packages/native/apple/Tests/AstryxTests/ButtonTests.swift
+++ b/packages/native/apple/Tests/AstryxTests/ButtonTests.swift
@@ -59,14 +59,110 @@ import Testing
#expect(Astryx.Button.accessibilityTraits.contains(.isButton))
}
+@MainActor
@Test func buttonIconsUseSharedNamesAndTheTheme() {
#expect(AstryxStyle(tokens: Theme.default.light).icon("search") == "magnifyingglass")
#expect(AstryxStyle(tokens: Theme.default.light, icons: ["search": "sparkle.magnifyingglass"]).icon("search") == "sparkle.magnifyingglass")
}
+// Swift component API spec, A2, A3, A4: Button takes core's Button props.
+
+@MainActor
+@Test func buttonInitializersBuildTheSameProps() {
+ let labeled = Astryx.Button(label: "Save", variant: .primary, size: .lg, elevation: .low, width: .fill, tooltip: "Saves", href: "https://example.com")
+ let fromProps = Astryx.Button(
+ ButtonProps(label: "Save", variant: .primary, size: .lg, elevation: .low, width: .fill, tooltip: "Saves", href: "https://example.com"))
+ #expect(labeled.props.label == fromProps.props.label)
+ #expect(labeled.props.variant == fromProps.props.variant)
+ #expect(labeled.props.size == fromProps.props.size)
+ #expect(labeled.props.elevation == fromProps.props.elevation)
+ #expect(labeled.props.width == fromProps.props.width)
+ #expect(labeled.props.tooltip == fromProps.props.tooltip)
+ #expect(labeled.props.href == fromProps.props.href)
+}
+
+@MainActor
+@Test func anInterruptibleLoadingButtonStillTakesPresses() {
+ var presses = 0
+ Astryx.Button(label: "Stop", isLoading: true, isInterruptible: true) { presses += 1 }.activate()
+ #expect(presses == 1)
+}
+
+@MainActor
+@Test func hrefMakesAnEnabledButtonALinkAndADisabledOneAButton() {
+ #expect(Astryx.Button(label: "Docs", href: "https://example.com").link == URL(string: "https://example.com"))
+ #expect(Astryx.Button(label: "Docs", isDisabled: true, href: "https://example.com").link == nil)
+ #expect(Astryx.Button(label: "Docs").link == nil)
+ // A loading link stays a link; it opens nothing until loading ends.
+ let loading = Astryx.Button(label: "Docs", isLoading: true, href: "https://example.com")
+ #expect(loading.link != nil)
+ #expect(loading.acceptsPress == false)
+ // An interruptible loading link opens on each activation.
+ let interruptible = Astryx.Button(label: "Docs", isLoading: true, isInterruptible: true, href: "https://example.com")
+ #expect(interruptible.link != nil)
+ #expect(interruptible.acceptsPress)
+}
+
+@MainActor
+@Test func aFillWidthButtonTakesTheWholeWidth() {
+ let content = Pixels(Astryx.Button(label: "OK", variant: .primary).frame(width: 240))
+ let fill = Pixels(Astryx.Button(label: "OK", variant: .primary, width: .fill).frame(width: 240))
+ let accent = rgba(Theme.default.light.color.accent)
+ #expect(close(fill.at(4, fill.height / 2), accent))
+ #expect(!close(content.at(4, content.height / 2), accent))
+}
+
+@MainActor
+@Test func buttonElevationReadsTheThemesShadows() {
+ #expect(Astryx.Button(label: "OK").shadow.isEmpty)
+ #expect(Astryx.Button(label: "OK", elevation: .med).shadow == Theme.default.light.shadow.med)
+}
+
+@MainActor
+@Test func aButtonNeverOpensAScriptOrHTMLDocumentDestination() {
+ for href in [
+ "javascript:alert(1)", "JavaScript:void(0)", "vbscript:msgbox", "data:text/html,<p>hi</p>",
+ " javascript:alert(1)", "java\u{09}script:alert(1)", "\u{01}javascript:alert(1)",
+ "data: text/html,<p>hi</p>", "DATA: TEXT/HTML,<p>hi</p>", "javascript:\n alert(1)",
+ ] {
+ let button = Astryx.Button(label: "Go", href: href)
+ #expect(button.link == nil, "\(href)")
+ // It stays an enabled button, not a disabled one.
+ #expect(button.acceptsPress)
+ #expect(!button.isDisabled)
+ }
+ #expect(Astryx.Button(label: "Go", href: "data:image/png;base64,AAAA").link != nil)
+ #expect(Astryx.Button(label: "Go", href: "mailto:[email protected]").link != nil)
+}
+
+@MainActor
+@Test func aDisabledButtonKeepsItsFocusStopAndTakesNoPress() {
+ var presses = 0
+ let withTip = Astryx.Button(label: "Save", isDisabled: true, tooltip: "Fill in a name first") { presses += 1 }
+ #expect(withTip.keepsFocusWhileDisabled)
+ withTip.activate()
+ #expect(presses == 0)
+ #expect(Astryx.Button(label: "Save", isDisabled: true) {}.keepsFocusWhileDisabled)
+ #expect(!Astryx.Button(label: "Save") {}.keepsFocusWhileDisabled)
+}
+
+@Test func aSafeDestinationIsNormalizedAsCoresRule() {
+ // Accepted destinations come back trimmed and without control characters.
+ #expect(Astryx.Button.safeDestination(" https://example.com/a \n") == "https://example.com/a")
+ #expect(Astryx.Button.safeDestination("https://exa\u{0}mple.com") == "https://example.com")
+ #expect(Astryx.Button.safeDestination("/settings") == "/settings")
+ #expect(Astryx.Button.safeDestination("data:image/png;base64,AAAA") != nil)
+ #expect(Astryx.Button.safeDestination(" data: text/html,x") == nil)
+}
+
@MainActor
-@Test func aButtonDrawsItsSharedIcon() {
- let plain = Pixels(Astryx.Button(label: "Find") {}.fixedSize())
- let withIcon = Pixels(Astryx.Button(label: "Find", icon: "search") {}.fixedSize())
- #expect(withIcon.width > plain.width)
+@Test func aDisabledButtonWithHrefKeepsItsDestinationForOneStructure() {
+ // The link and the disabled button stay in one structure, so the
+ // destination is known while disabled even though nothing opens.
+ let disabled = Astryx.Button(label: "Docs", isDisabled: true, href: "https://example.com")
+ #expect(disabled.destination == URL(string: "https://example.com"))
+ #expect(disabled.link == nil)
+ #expect(!disabled.acceptsPress)
+ let enabled = Astryx.Button(label: "Docs", href: "https://example.com")
+ #expect(enabled.link == enabled.destination)
}
diff --git a/packages/native/apple/Tests/AstryxTests/TextInputTests.swift b/packages/native/apple/Tests/AstryxTests/TextInputTests.swift
index 5010ccfcb9..3ae3998fc2 100644
--- a/packages/native/apple/Tests/AstryxTests/TextInputTests.swift
+++ b/packages/native/apple/Tests/AstryxTests/TextInputTests.swift
@@ -4,9 +4,11 @@ import SwiftUI
import Testing
@testable import Astryx
+// Swift component API spec, A2 and A3: TextInput takes core's TextInput props.
+
@MainActor
@Test func aTextFieldIsAtLeast44PointsTallAtEveryTextSize() {
- let field = Astryx.TextInput(label: "Email", value: .constant(""), size: .sm).frame(width: 240)
+ let field = Astryx.TextInput(label: "Email", value: "", size: .sm).frame(width: 240)
for typeSize in [DynamicTypeSize.xSmall, .large, .accessibility5] {
let pixels = Pixels(field, typeSize: typeSize)
// The label sits above a field at least 44 tall.
@@ -18,12 +20,287 @@ import Testing
@Test func aFieldLabelUsesTheSecondaryTextColor() {
var theme = Theme.default
theme.light.color.textSecondary = Color(.sRGB, red: 1, green: 0, blue: 0, opacity: 1)
- let pixels = Pixels(Astryx.TextInput(label: "Email", value: .constant("")).frame(width: 240), theme: theme)
+ let pixels = Pixels(Astryx.TextInput(label: "Email", value: "").frame(width: 240), theme: theme)
#expect(pixels.contains { $0[0] > 200 && $0[1] < 60 && $0[2] < 60 && $0[3] > 200 })
}
@MainActor
-@Test func aTextFieldIsNamedByItsLabel() {
- let field = Astryx.TextInput(label: "Email", value: .constant(""))
- #expect(field.accessibilityText == "Email")
+@Test func textInputInitializersBuildTheSameProps() {
+ let labeled = Astryx.TextInput(label: "Email", value: "[email protected]", type: .email, size: .lg, isRequired: true, hasClear: true)
+ let fromProps = Astryx.TextInput(
+ TextInputProps(type: .email, label: "Email", value: "[email protected]", size: .lg, isRequired: true, hasClear: true))
+ #expect(labeled.props.label == fromProps.props.label)
+ #expect(labeled.props.value == fromProps.props.value)
+ #expect(labeled.props.type == fromProps.props.type)
+ #expect(labeled.props.size == fromProps.props.size)
+ #expect(labeled.props.isRequired == fromProps.props.isRequired)
+ #expect(labeled.props.hasClear == fromProps.props.hasClear)
+}
+
+@MainActor
+@Test func theFieldIsNamedByItsLabelAndItsNote() {
+ #expect(Astryx.TextInput(label: "Email", value: "").accessibilityName == "Email")
+ #expect(Astryx.TextInput(label: "Email", value: "", isRequired: true).accessibilityName == "Email, Required")
+ #expect(Astryx.TextInput(label: "Email", value: "", isOptional: true).accessibilityName == "Email, Optional")
+ // A hidden label still names the field.
+ #expect(Astryx.TextInput(label: "Search", value: "", isLabelHidden: true).accessibilityName == "Search")
+}
+
+@MainActor
+@Test func theFieldReadsItsDescriptionStatusAndDisabledReason() {
+ let field = Astryx.TextInput(
+ label: "Email",
+ value: "",
+ description: "Work address",
+ isDisabled: true,
+ disabledMessage: "Managed by your admin",
+ status: TextInputStatus(type: .error, message: "Not valid")
+ )
+ // The error is in the label; the description and the disabled reason
+ // follow as the description.
+ #expect(field.accessibilityLabelText == "Email, Not valid")
+ #expect(field.accessibilityDescription == "Work address, Managed by your admin")
+ // The reason is read only while the field is disabled.
+ let enabled = Astryx.TextInput(label: "Email", value: "", disabledMessage: "Managed by your admin")
+ #expect(enabled.accessibilityDescription == "")
+}
+
+@MainActor
+@Test func editsReachOnChangeOnlyWhileTheFieldCanBeEdited() {
+ final class Edits: @unchecked Sendable { var values: [String] = [] }
+ let edits = Edits()
+ Astryx.TextInput(label: "Name", value: "", onChange: { edits.values.append($0) }).text.wrappedValue = "A"
+ Astryx.TextInput(label: "Name", value: "", onChange: { edits.values.append($0) }, isDisabled: true).text.wrappedValue = "B"
+ Astryx.TextInput(label: "Name", value: "", onChange: { edits.values.append($0) }, isReadOnly: true).text.wrappedValue = "C"
+ #expect(edits.values == ["A"])
+}
+
+@MainActor
+@Test func disabledWinsOverReadOnlyAndBothHideTheClearButton() {
+ let both = Astryx.TextInput(label: "Name", value: "x", isDisabled: true, isReadOnly: true, hasClear: true)
+ #expect(both.isDisabled)
+ #expect(both.isReadOnly == false)
+ #expect(both.showsClear == false)
+ #expect(Astryx.TextInput(label: "Name", value: "x", hasClear: true).showsClear)
+ #expect(Astryx.TextInput(label: "Name", value: "", hasClear: true).showsClear == false)
+ #expect(Astryx.TextInput(label: "Name", value: "x", isReadOnly: true, hasClear: true).showsClear == false)
+}
+
+@MainActor
+@Test func theClearButtonNamesItsField() {
+ #expect(AstryxStrings.clearLabel("Email") == "Clear Email")
+ #expect(AstryxStrings.statusButton(.error) == "Error details")
+}
+
+@MainActor
+@Test func aStatusColorsTheBorderUnlessTheFieldIsDisabled() {
+ let error = Astryx.TextInput(label: "Email", value: "", status: TextInputStatus(type: .error))
+ let pixels = Pixels(error.frame(width: 240), scheme: .light)
+ let red = rgba(Theme.default.light.color.borderError)
+ #expect(pixels.contains { close($0, red) })
+}
+
+@MainActor
+@Test func anAttachedMessageDrawsOnTheStatusGround() {
+ let field = Astryx.TextInput(
+ label: "Email", value: "", status: TextInputStatus(type: .warning, message: "Check the domain"))
+ let pixels = Pixels(field.frame(width: 240))
+ // The muted ground is translucent, and Pixels reads premultiplied RGBA, so
+ // compare against the premultiplied color.
+ let ground = rgba(Theme.default.light.color.warningMuted)
+ let alpha = ground[3]
+ let premultiplied = ground.prefix(3).map { $0 * alpha / 255 } + [alpha]
+ #expect(alpha < 255)
+ #expect(pixels.contains { close($0, premultiplied, within: 3) })
+}
+
+// Read-only, status, and label rules from core's field.
+
+@MainActor
+@Test func aReadOnlyPasswordStaysMasked() {
+ let field = Astryx.TextInput(label: "Password", value: "hunter2", type: .password, isReadOnly: true)
+ #expect(field.readOnlyText == String(repeating: "\u{2022}", count: 7))
+ #expect(!field.readOnlyText.contains("hunter2"))
+ let plain = Astryx.TextInput(label: "Email", value: "[email protected]", isReadOnly: true)
+ #expect(plain.readOnlyText == "[email protected]")
+ #expect(plain.accessibilityDescription.contains(AstryxStrings.inputReadOnly))
+}
+
+@MainActor
+@Test func optionalWinsOverRequired() {
+ let field = Astryx.TextInput(label: "Name", value: "", isOptional: true, isRequired: true)
+ #expect(field.labelNote == AstryxStrings.fieldOptional)
+}
+
+@MainActor
+@Test func anErrorIsInTheLabelVoiceOverReads() {
+ let withMessage = Astryx.TextInput(
+ label: "Email", value: "", description: "Work address",
+ status: TextInputStatus(type: .error, message: "Enter a valid email"))
+ // The error is in the label, which VoiceOver reads with Speak Hints off.
+ #expect(withMessage.accessibilityLabelText == "Email, Enter a valid email")
+ #expect(withMessage.accessibilityDescription == "Work address")
+ let bare = Astryx.TextInput(label: "Email", value: "", status: TextInputStatus(type: .error))
+ #expect(bare.accessibilityLabelText == "Email, \(AstryxStrings.statusButton(.error))")
+ let warning = Astryx.TextInput(
+ label: "Email", value: "", description: "Work address",
+ status: TextInputStatus(type: .warning, message: "Check the domain"))
+ #expect(warning.accessibilityDescription == "Work address, Check the domain")
+ #expect(warning.accessibilityLabelText == "Email")
+}
+
+@MainActor
+@Test func aStatusMessageIsAnnouncedWithItsUrgency() {
+ let error = Astryx.TextInput(label: "Email", value: "", status: TextInputStatus(type: .error, message: "Required"))
+ #expect(error.statusAnnouncement == .init(message: "Required", type: .error))
+ #expect(error.statusAnnouncement?.isError == true)
+ let success = Astryx.TextInput(label: "Email", value: "", status: TextInputStatus(type: .success, message: "Looks good"))
+ #expect(success.statusAnnouncement == .init(message: "Looks good", type: .success))
+ // The same words with another type are a change to announce.
+ #expect(success.statusAnnouncement != .init(message: "Looks good", type: .warning))
+ #expect(Astryx.TextInput(label: "Email", value: "").statusAnnouncement == nil)
+}
+
+@MainActor
+@Test func aHiddenLabelHidesTheDescription() {
+ let hidden = Astryx.TextInput(label: "Search", value: "", isLabelHidden: true, description: "By name or email")
+ let bare = Astryx.TextInput(label: "Search", value: "", isLabelHidden: true)
+ #expect(Pixels(hidden.frame(width: 240)).height == Pixels(bare.frame(width: 240)).height)
+}
+
+@MainActor
+@Test func smallControlsAnswerTapsAcross44PointsWithoutGrowing() {
+ #expect(astryxHitInset(20) == 12)
+ #expect(astryxHitInset(50) == 0)
+ let dot = Color.black.frame(width: 20, height: 20)
+ #expect(Pixels(dot.astryxMinimumHitArea(20)).width == Pixels(dot).width)
+}
+
+@MainActor
+@Test func everyDisabledFieldKeepsItsFocusStop() {
+ let withReason = Astryx.TextInput(label: "Plan", value: "Team", isDisabled: true, disabledMessage: "Managed by your admin")
+ #expect(withReason.keepsFocusWhileDisabled)
+ let bare = Astryx.TextInput(label: "Plan", value: "Team", isDisabled: true)
+ #expect(bare.keepsFocusWhileDisabled)
+ #expect(!Astryx.TextInput(label: "Plan", value: "Team").keepsFocusWhileDisabled)
+}
+
+@MainActor
+@Test func anEmptyReadOnlyFieldShowsItsPlaceholder() {
+ #expect(Astryx.TextInput(label: "Notes", value: "", isReadOnly: true, placeholder: "None").showsReadOnlyPlaceholder)
+ #expect(!Astryx.TextInput(label: "Notes", value: "Hi", isReadOnly: true, placeholder: "None").showsReadOnlyPlaceholder)
+}
+
+@MainActor
+@Test func trailingButtonsTakeTheirTargetsInPlaceOfThePadding() {
+ let clearAndTip = Astryx.TextInput(
+ label: "Email", value: "you@", status: TextInputStatus(type: .error, message: "Enter a full address"),
+ statusVariant: .tooltip, hasClear: true)
+ #expect(clearAndTip.hasTrailingButtons)
+ #expect(!Astryx.TextInput(label: "Email", value: "").hasTrailingButtons)
+}
+
+@MainActor
+@Test func isHiddenHidesTheControlAndKeepsTheLabel() {
+ let hidden = Astryx.TextInput(label: "Email", value: "", base: AstryxBaseProps(isHidden: true))
+ #expect(hidden.hidesControl)
+ // The control leaves layout: the view is shorter than with the control, and
+ // the label still draws.
+ let shown = Astryx.TextInput(label: "Email", value: "")
+ let hiddenHeight = Pixels(hidden.frame(width: 240)).height
+ #expect(hiddenHeight > 0)
+ #expect(hiddenHeight < Pixels(shown.frame(width: 240)).height)
+ #expect(!shown.hidesControl)
+}
+
+@MainActor
+@Test func baseIdBelongsToTheControl() {
+ let field = Astryx.TextInput(label: "Email", value: "", base: AstryxBaseProps(id: "email"))
+ #expect(field.props.base.id == "email")
+ #expect(TextInputProps.baseTarget == .control)
+}
+
+// What VoiceOver reads for the drawn read-only and disabled field (record FR2).
+// The rendered accessibility tree is not measured until an app-hosted test
+// target exists; these assert what the view gives `accessibilityRepresentation`.
+
+@MainActor
+@Test func aReadOnlyFieldReadsAsAnUndimmedTextFieldWithItsValue() {
+ let field = Astryx.TextInput(label: "Account", value: "ID 12345", isReadOnly: true).accessibleFieldDescription
+ #expect(field.kind == .text)
+ #expect(!field.isDimmed)
+ #expect(field.label == "Account")
+ #expect(field.value == "ID 12345")
+ #expect(field.hint == AstryxStrings.inputReadOnly)
+}
+
+@MainActor
+@Test func aReadOnlyPasswordReadsAsASecureField() {
+ let field = Astryx.TextInput(label: "Password", value: "hunter2", type: .password, isReadOnly: true).accessibleFieldDescription
+ #expect(field.kind == .secure)
+ #expect(!field.isDimmed)
+}
+
+@MainActor
+@Test func aDisabledFieldReadsAsADimmedTextFieldWithItsReason() {
+ let field = Astryx.TextInput(
+ label: "Plan", value: "Team", isDisabled: true, disabledMessage: "Managed by your admin"
+ ).accessibleFieldDescription
+ #expect(field.kind == .text)
+ #expect(field.isDimmed)
+ #expect(field.hint == "Managed by your admin")
+ let password = Astryx.TextInput(label: "Password", value: "x", type: .password, isDisabled: true).accessibleFieldDescription
+ #expect(password.kind == .secure)
+ #expect(password.isDimmed)
+}
+
+@MainActor
+@Test func aDrawnFieldWithAnErrorCarriesItInItsLabel() {
+ let field = Astryx.TextInput(
+ label: "Email", value: "you@", isReadOnly: true, status: TextInputStatus(type: .error, message: "Enter a full address")
+ ).accessibleFieldDescription
+ #expect(field.label == "Email, Enter a full address")
+}
+
+@MainActor
+@Test func theTooltipStatusTipIsAButtonThatSpeaksItsMessage() {
+ let field = Astryx.TextInput(
+ label: "Email", value: "you@", status: TextInputStatus(type: .error, message: "Enter a full address"),
+ statusVariant: .tooltip)
+ let tip = field.statusTipAccessibility
+ #expect(tip?.isButton == true)
+ #expect(tip?.label == AstryxStrings.statusButton(.error))
+ #expect(tip?.text == "Enter a full address")
+ #expect(tip?.hint == "Enter a full address")
+ // Attached and detached statuses have no tip.
+ let attached = Astryx.TextInput(label: "Email", value: "", status: TextInputStatus(type: .error, message: "Required"))
+ #expect(attached.statusTipAccessibility == nil)
+}
+
+@MainActor
+@Test func theFieldDrawsItsValueOnlyWhileReadOnlyOrDisabled() {
+ #expect(!Astryx.TextInput(label: "Email", value: "").isDrawn)
+ #expect(Astryx.TextInput(label: "Email", value: "", isReadOnly: true).isDrawn)
+ #expect(Astryx.TextInput(label: "Email", value: "", isDisabled: true).isDrawn)
+}
+
+@MainActor
+@Test func aLongValueDoesNotGrowTheField() {
+ let long = String(repeating: "A long value that would wrap ", count: 8)
+ let short = Pixels(Astryx.TextInput(label: "Notes", value: "Hi", isReadOnly: true).frame(width: 240))
+ let wrapped = Pixels(Astryx.TextInput(label: "Notes", value: long, isReadOnly: true).frame(width: 240))
+ #expect(wrapped.height == short.height)
+}
+
+@MainActor
+@Test func aDisabledReasonOpensOnFocusInsideTheRow() {
+ // The row is not itself focusable; its drawn field is, so the reason's
+ // tooltip follows focus inside the row (the drawn field's focus), not the
+ // row's own focus.
+ let field = Astryx.TextInput(label: "Plan", value: "Team", isDisabled: true, disabledMessage: "Managed by your admin")
+ guard case .inside = field.reasonTooltipFocus else {
+ Issue.record("expected focus inside the row to open the reason")
+ return
+ }
+ #expect(field.keepsFocusWhileDisabled)
}
diff --git a/packages/native/apple/Tests/AstryxTests/TwoThemeTests.swift b/packages/native/apple/Tests/AstryxTests/TwoThemeTests.swift
index 6bbdf9ec2c..6faf5756f3 100644
--- a/packages/native/apple/Tests/AstryxTests/TwoThemeTests.swift
+++ b/packages/native/apple/Tests/AstryxTests/TwoThemeTests.swift
@@ -63,3 +63,72 @@ private let secondTheme: Theme = {
#expect(second.contains { $0[0] > 200 && $0[1] < 60 && $0[2] < 60 && $0[3] > 200 })
#expect(!standard.contains { $0[0] > 200 && $0[1] < 60 && $0[2] < 60 && $0[3] > 200 })
}
+
+@MainActor
+@Test func textInputFollowsTheThemesTextColorAndTypeSize() {
+ // Read-only draws its value as text, which an image renderer can read; an
+ // editable field is a platform text field it does not draw.
+ let field = Astryx.TextInput(label: "Name", value: "Ada", isLabelHidden: true, isReadOnly: true).frame(width: 240)
+ let standard = Pixels(field, theme: .default)
+ let second = Pixels(field, theme: secondTheme)
+ #expect(second.contains { close($0, rgba("#FF0000FF"), within: 24) })
+ #expect(!standard.contains { close($0, rgba("#FF0000FF"), within: 24) })
+ // A body size past the 44-point minimum makes the field taller.
+ var large = secondTheme
+ large.light.font.body.size = 60
+ #expect(Pixels(field, theme: large).height > standard.height)
+}
+
+// Theme tokens INV11: a status uses its border, icon, and on-muted roles, so a
+// theme that sets them draws them, and Core's defaults stay legible.
+
+@MainActor
+@Test func textInputStatusDrawsTheThemesStatusRoles() {
+ var theme = Theme.default
+ theme.light.color.borderWarning = Color(.sRGB, red: 1, green: 0, blue: 1, opacity: 1)
+ theme.light.color.onWarningMuted = Color(.sRGB, red: 0, green: 1, blue: 1, opacity: 1)
+ let field = Astryx.TextInput(
+ label: "Domain", value: "example.org", isReadOnly: true,
+ status: TextInputStatus(type: .warning, message: "Not your company domain")
+ ).frame(width: 260)
+ let pixels = Pixels(field, theme: theme)
+ #expect(pixels.contains { close($0, [255, 0, 255, 255], within: 6) })
+ #expect(pixels.contains { close($0, [0, 255, 255, 255], within: 40) })
+}
+
+@MainActor
+@Test func statusMessagesMeetTheirContrastFloorInEveryTheme() {
+ for theme in [Theme.default, .butter, .chocolate, .matcha, .neutral, .stone, .y2k, .gothic] {
+ for tokens in [theme.light, theme.dark] {
+ let c = tokens.color
+ for (content, ground) in [(c.onErrorMuted, c.errorMuted), (c.onWarningMuted, c.warningMuted), (c.onSuccessMuted, c.successMuted)] {
+ // Muted grounds are translucent; compose them over the card ground.
+ let composed = astryxComposite(ground, over: c.backgroundCard)
+ #expect(astryxContrast(content, composed) >= 4.5)
+ }
+ for border in [c.borderError, c.borderWarning, c.borderSuccess] {
+ #expect(astryxContrast(border, c.backgroundCard) >= 3)
+ }
+ }
+ }
+}
+
+/// A translucent color drawn over an opaque one, in sRGB.
+private func astryxComposite(_ top: Color, over under: Color) -> Color {
+ let t = top.resolve(in: EnvironmentValues())
+ let u = under.resolve(in: EnvironmentValues())
+ let a = Double(t.opacity)
+ func mix(_ x: Float, _ y: Float) -> Double { Double(x) * a + Double(y) * (1 - a) }
+ return Color(.sRGB, red: mix(t.red, u.red), green: mix(t.green, u.green), blue: mix(t.blue, u.blue), opacity: 1)
+}
+
+@MainActor
+@Test func bannerFollowsTheThemesTextColorAndTypeSize() {
+ let banner = Astryx.Banner(status: .info, title: "Saved").frame(width: 240)
+ let standard = Pixels(banner, theme: .default)
+ let second = Pixels(banner, theme: secondTheme)
+ #expect(second.contains { close($0, rgba("#FF0000FF"), within: 24) })
+ #expect(!standard.contains { close($0, rgba("#FF0000FF"), within: 24) })
+ // A larger body size makes the banner taller.
+ #expect(second.height > standard.height)
+}
diff --git a/packages/native/scripts/swift-ios-strings.mjs b/packages/native/scripts/swift-ios-strings.mjs
index d2b507f896..98a0ea929d 100644
--- a/packages/native/scripts/swift-ios-strings.mjs
+++ b/packages/native/scripts/swift-ios-strings.mjs
@@ -29,7 +29,15 @@ export const SWIFT_IOS_STRINGS_DIR = path.join(
export const SWIFT_IOS_STRING_KEYS = [
'@astryx.avatar.nameWithStatus',
'@astryx.button.loading',
+ '@astryx.field.optional',
+ '@astryx.field.required',
+ '@astryx.input.readOnly',
+ '@astryx.input.statusButton.error',
+ '@astryx.input.statusButton.success',
+ '@astryx.input.statusButton.warning',
+ '@astryx.inputClearButton.tooltip',
'@astryx.spinner.loading',
+ '@astryx.textInput.clearLabel',
'@astryx.thumbnail.fallbackName',
'@astryx.thumbnail.open',
'@astryx.thumbnail.remove',
@@ -80,7 +88,12 @@ export function renderSwiftIOSStrings() {
];
for (const key of SWIFT_IOS_STRING_KEYS) {
const entry = catalog[key];
- if (!entry) throw new Error(`${file} has no ${key}`);
+ // A catalog without a message falls back to English, as core does at
+ // run time; English itself must have every message.
+ if (!entry && locale.startsWith('en')) {
+ throw new Error(`${file} has no ${key}`);
+ }
+ if (!entry) continue;
lines.push('', `/* ${entry.description.replace(/\*\//g, '* /')} */`);
lines.push(`${quote(key)} = ${quote(entry.defaultMessage)};`);
}
diff --git a/packages/native/specs/swift/library/component-api.md b/packages/native/specs/swift/library/component-api.md
index 6b98283f76..2b45a4a19e 100644
--- a/packages/native/specs/swift/library/component-api.md
+++ b/packages/native/specs/swift/library/component-api.md
@@ -103,6 +103,8 @@ same generated contract.
draws a disabled `<button>`; a disabled Item with `href` stays a link that
VoiceOver reads as dimmed and that does not open, as core keeps a disabled
link; Avatar has no disabled state.
+ How a loading Button with `href` behaves is Button's own rule
+ (`component:swift/Button` FR4).
- **A5 — Words and values take the contract's types.** A word prop is the
contract's `String`, and a value prop and its change callback are the
contract's two parameters, as AST-093 FR5 requires. A localizable spelling
@@ -152,12 +154,11 @@ same generated contract.
(SwiftUI views with core's names, `Button`, `Text`, and so on, re-exporting
SwiftUI and the contracts) and the `AstryxNative` product (generated contract
types, unprefixed: `ButtonProps`, `ButtonVariant`).
-- Avatar, AvatarStatusDot, Card, Heading, Icon, Text, and Thumbnail take their
- generated `<Name>Props`; Button and
- TextInput still take hand-written parameters until each moves onto its
- generated props; Banner has no generated contract.
-- `AstryxNodeView` draws Avatar (with its status dot), AvatarStatusDot, Card,
- Heading, Icon, Text, and Thumbnail wire nodes. Any other
+- Avatar, AvatarStatusDot, Button, Card, Heading, Icon, Text, TextInput, and
+ Thumbnail take their generated `<Name>Props`; Banner has no generated
+ contract.
+- `AstryxNodeView` draws Avatar (with its status dot), AvatarStatusDot, Button,
+ Card, Heading, Icon, Text, TextInput, and Thumbnail wire nodes. Any other
node, HStack and VStack included, renders in its place as unsupported, and
its siblings still render, until the logic host draws stacks (A9).
- The generated iOS `SwitchProps` still declares `size`, and `HStackProps` and
diff --git a/packages/native/specs/swift/library/theme-environment.md b/packages/native/specs/swift/library/theme-environment.md
index 8129394bce..ace8eb79b6 100644
--- a/packages/native/specs/swift/library/theme-environment.md
+++ b/packages/native/specs/swift/library/theme-environment.md
@@ -85,7 +85,10 @@ settings system for an app to keep in step.
- `packages/native/apple` has the `Astryx` product: the `Theme` and `Tokens`
types, the `.astryxTheme(_:)` modifier, which sets the tint and a
single-mode theme's color scheme, and SwiftUI components that read the theme
- from the `astryx` environment value.
+ from the `astryx` environment value. Components choose light or dark tokens from
+ `colorScheme`, with or without the modifier, scale text with
+ `dynamicTypeSize`, and draw a custom face one weight step heavier under Bold
+ Text.
## Open questions
diff --git a/packages/native/src/theme/swiftIOSStrings.test.ts b/packages/native/src/theme/swiftIOSStrings.test.ts
index 05b1752539..7df7b211b4 100644
--- a/packages/native/src/theme/swiftIOSStrings.test.ts
+++ b/packages/native/src/theme/swiftIOSStrings.test.ts
@@ -30,6 +30,24 @@ describe('swift-ios localized strings', () => {
);
});
+ it('carries the field messages TextInput speaks, falling back to English where a catalog lacks one', () => {
+ const files = renderSwiftIOSStrings();
+ const english = files['en.lproj/Localizable.strings'] ?? '';
+ for (const line of [
+ '"@astryx.field.optional" = "Optional";',
+ '"@astryx.field.required" = "Required";',
+ '"@astryx.textInput.clearLabel" = "Clear {label}";',
+ '"@astryx.spinner.loading" = "Loading";',
+ '"@astryx.input.statusButton.error" = "Error details";',
+ ]) {
+ expect(english).toContain(line);
+ }
+ // af-ZA has no clear tip yet; the app reads the English value in code.
+ expect(files['af.lproj/Localizable.strings']).not.toContain(
+ '@astryx.inputClearButton.tooltip',
+ );
+ });
+
it("keeps the committed files in sync with core's catalogs", () => {
const files = renderSwiftIOSStrings();
const committed = fs