@tempoxyz/ds 0.3.14 → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/docs/AGENTS.md +75 -10
  2. package/dist/docs/arsenal.md +44 -0
  3. package/dist/docs/{marketing/introduction/getting-started.md → marketing.md} +32 -24
  4. package/dist/docs/product/components/actions.md +2110 -0
  5. package/dist/docs/product/components/blockchain.md +3969 -0
  6. package/dist/docs/product/components/data-display.md +5901 -0
  7. package/dist/docs/product/components/feedback-and-status.md +4138 -0
  8. package/dist/docs/product/components/forms-and-inputs.md +10543 -0
  9. package/dist/docs/product/components/layout.md +3339 -0
  10. package/dist/docs/product/components/navigation.md +2914 -0
  11. package/dist/docs/product/components/overlays.md +4917 -0
  12. package/dist/docs/product/components.md +125 -125
  13. package/dist/docs/product/foundations.md +4597 -0
  14. package/dist/docs/product/patterns.md +10110 -0
  15. package/dist/marketing/index.js.zyzz.json +1 -1
  16. package/dist/marketing/vars.d.ts +618 -758
  17. package/dist/marketing/vars.d.ts.map +1 -1
  18. package/dist/marketing/vars.js +8 -5
  19. package/dist/marketing/vars.js.map +1 -1
  20. package/dist/marketing/vars.js.zyzz.json +1 -1
  21. package/dist/marketing/zyzz.config.d.ts +3042 -3757
  22. package/dist/marketing/zyzz.config.d.ts.map +1 -1
  23. package/dist/marketing/zyzz.config.js +1 -1
  24. package/dist/marketing/zyzz.config.js.map +1 -1
  25. package/dist/marketing/zyzz.config.js.zyzz.json +1 -1
  26. package/dist/mobile/components/Button.d.ts +115 -15
  27. package/dist/mobile/components/Button.d.ts.map +1 -1
  28. package/dist/mobile/components/Button.js +85 -14
  29. package/dist/mobile/components/Button.js.map +1 -1
  30. package/dist/mobile/components/IconButton.d.ts +129 -40
  31. package/dist/mobile/components/IconButton.d.ts.map +1 -1
  32. package/dist/mobile/components/IconButton.js +97 -28
  33. package/dist/mobile/components/IconButton.js.map +1 -1
  34. package/dist/mobile/components/TextInput.d.ts +132 -11
  35. package/dist/mobile/components/TextInput.d.ts.map +1 -1
  36. package/dist/mobile/components/TextInput.js +115 -14
  37. package/dist/mobile/components/TextInput.js.map +1 -1
  38. package/dist/mobile/index.d.ts +1 -0
  39. package/dist/mobile/index.d.ts.map +1 -1
  40. package/dist/mobile/index.js +1 -0
  41. package/dist/mobile/index.js.map +1 -1
  42. package/dist/mobile/vars.d.ts +103 -0
  43. package/dist/mobile/vars.d.ts.map +1 -1
  44. package/dist/mobile/vars.js +74 -0
  45. package/dist/mobile/vars.js.map +1 -1
  46. package/dist/mobile/zyzz.config.d.ts +408 -0
  47. package/dist/mobile/zyzz.config.d.ts.map +1 -1
  48. package/dist/web/components/AddressCard.js.zyzz.json +1 -1
  49. package/dist/web/components/Amount.css +1 -1
  50. package/dist/web/components/Amount.d.ts +9 -0
  51. package/dist/web/components/Amount.d.ts.map +1 -1
  52. package/dist/web/components/Amount.js +8 -5
  53. package/dist/web/components/Amount.js.map +1 -1
  54. package/dist/web/components/Amount.js.zyzz.json +1 -1
  55. package/dist/web/components/CopyButton.d.ts +6 -0
  56. package/dist/web/components/CopyButton.d.ts.map +1 -1
  57. package/dist/web/components/CopyButton.js +4 -1
  58. package/dist/web/components/CopyButton.js.map +1 -1
  59. package/dist/web/components/CopyButton.js.zyzz.json +1 -1
  60. package/dist/web/components/Hex.css +1 -1
  61. package/dist/web/components/Hex.d.ts +84 -3
  62. package/dist/web/components/Hex.d.ts.map +1 -1
  63. package/dist/web/components/Hex.js +20 -13
  64. package/dist/web/components/Hex.js.map +1 -1
  65. package/dist/web/components/Hex.js.zyzz.json +1 -1
  66. package/dist/web/components/Progress.css +1 -1
  67. package/dist/web/components/Progress.d.ts +12 -2
  68. package/dist/web/components/Progress.d.ts.map +1 -1
  69. package/dist/web/components/Progress.js +9 -5
  70. package/dist/web/components/Progress.js.map +1 -1
  71. package/dist/web/components/Progress.js.zyzz.json +1 -1
  72. package/dist/web/components/SecretValue.js.zyzz.json +1 -1
  73. package/dist/web/components/SidebarMenu.d.ts +4 -4
  74. package/dist/web/components/SidebarMenu.js +6 -6
  75. package/dist/web/components/SidebarMenu.js.map +1 -1
  76. package/dist/web/components/Snippet.js.zyzz.json +1 -1
  77. package/dist/web/index.js.zyzz.json +1 -1
  78. package/package.json +1 -1
  79. package/src/marketing/README.md +1 -1
  80. package/src/marketing/vars.ts +526 -604
  81. package/src/marketing/zyzz.config.ts +5 -4
  82. package/src/mobile/README.md +19 -6
  83. package/src/mobile/components/Button.tsx +94 -17
  84. package/src/mobile/components/IconButton.tsx +122 -30
  85. package/src/mobile/components/TextInput.tsx +139 -24
  86. package/src/mobile/index.ts +1 -0
  87. package/src/mobile/vars.ts +74 -0
  88. package/src/web/components/Amount.tsx +37 -3
  89. package/src/web/components/CopyButton.tsx +8 -0
  90. package/src/web/components/Hex.tsx +79 -13
  91. package/src/web/components/Progress.tsx +8 -2
  92. package/src/web/components/SidebarMenu.tsx +6 -6
  93. package/dist/docs/index.md +0 -145
  94. package/dist/docs/product/components/accordion.md +0 -489
  95. package/dist/docs/product/components/address-card.md +0 -147
  96. package/dist/docs/product/components/agent-logo.md +0 -194
  97. package/dist/docs/product/components/alert-dialog.md +0 -631
  98. package/dist/docs/product/components/alert.md +0 -448
  99. package/dist/docs/product/components/amount-input.md +0 -305
  100. package/dist/docs/product/components/amount.md +0 -794
  101. package/dist/docs/product/components/app-shell.md +0 -559
  102. package/dist/docs/product/components/asset-chip.md +0 -294
  103. package/dist/docs/product/components/autocomplete.md +0 -620
  104. package/dist/docs/product/components/avatar.md +0 -321
  105. package/dist/docs/product/components/badge.md +0 -339
  106. package/dist/docs/product/components/badged-logo.md +0 -116
  107. package/dist/docs/product/components/banner.md +0 -379
  108. package/dist/docs/product/components/bar-chart.md +0 -208
  109. package/dist/docs/product/components/breadcrumbs.md +0 -380
  110. package/dist/docs/product/components/button-group.md +0 -286
  111. package/dist/docs/product/components/button.md +0 -650
  112. package/dist/docs/product/components/calendar.md +0 -375
  113. package/dist/docs/product/components/callout.md +0 -96
  114. package/dist/docs/product/components/checkbox-group.md +0 -521
  115. package/dist/docs/product/components/checkbox.md +0 -467
  116. package/dist/docs/product/components/choice-group.md +0 -516
  117. package/dist/docs/product/components/choicebox.md +0 -641
  118. package/dist/docs/product/components/code.md +0 -100
  119. package/dist/docs/product/components/combobox.md +0 -939
  120. package/dist/docs/product/components/container.md +0 -257
  121. package/dist/docs/product/components/copy-button.md +0 -642
  122. package/dist/docs/product/components/date-picker.md +0 -514
  123. package/dist/docs/product/components/dialog.md +0 -1332
  124. package/dist/docs/product/components/drawer.md +0 -966
  125. package/dist/docs/product/components/empty.md +0 -340
  126. package/dist/docs/product/components/field.md +0 -570
  127. package/dist/docs/product/components/fieldset.md +0 -398
  128. package/dist/docs/product/components/frame.md +0 -434
  129. package/dist/docs/product/components/gauge.md +0 -299
  130. package/dist/docs/product/components/get-started-visual.md +0 -117
  131. package/dist/docs/product/components/grid.md +0 -288
  132. package/dist/docs/product/components/hero-visual.md +0 -155
  133. package/dist/docs/product/components/hex.md +0 -487
  134. package/dist/docs/product/components/icon-tile.md +0 -292
  135. package/dist/docs/product/components/identicon.md +0 -371
  136. package/dist/docs/product/components/inline.md +0 -233
  137. package/dist/docs/product/components/inset.md +0 -225
  138. package/dist/docs/product/components/kbd.md +0 -423
  139. package/dist/docs/product/components/list-group.md +0 -981
  140. package/dist/docs/product/components/loading-dots.md +0 -237
  141. package/dist/docs/product/components/menu.md +0 -934
  142. package/dist/docs/product/components/native-select.md +0 -204
  143. package/dist/docs/product/components/network-logo.md +0 -248
  144. package/dist/docs/product/components/number-field.md +0 -543
  145. package/dist/docs/product/components/otp-field.md +0 -616
  146. package/dist/docs/product/components/pagination.md +0 -516
  147. package/dist/docs/product/components/popover.md +0 -544
  148. package/dist/docs/product/components/progress.md +0 -388
  149. package/dist/docs/product/components/qr.md +0 -314
  150. package/dist/docs/product/components/radio-group.md +0 -528
  151. package/dist/docs/product/components/secret-value.md +0 -406
  152. package/dist/docs/product/components/select.md +0 -751
  153. package/dist/docs/product/components/separator.md +0 -379
  154. package/dist/docs/product/components/sidebar-menu.md +0 -922
  155. package/dist/docs/product/components/skeleton.md +0 -517
  156. package/dist/docs/product/components/slider.md +0 -539
  157. package/dist/docs/product/components/snippet.md +0 -424
  158. package/dist/docs/product/components/spinner.md +0 -216
  159. package/dist/docs/product/components/split-bar.md +0 -139
  160. package/dist/docs/product/components/split-button.md +0 -464
  161. package/dist/docs/product/components/stack.md +0 -299
  162. package/dist/docs/product/components/status-chip.md +0 -226
  163. package/dist/docs/product/components/status-indicator.md +0 -119
  164. package/dist/docs/product/components/status-row.md +0 -174
  165. package/dist/docs/product/components/stepper.md +0 -451
  166. package/dist/docs/product/components/success-hero.md +0 -157
  167. package/dist/docs/product/components/surface.md +0 -639
  168. package/dist/docs/product/components/switch.md +0 -472
  169. package/dist/docs/product/components/table.md +0 -968
  170. package/dist/docs/product/components/tabs.md +0 -627
  171. package/dist/docs/product/components/tempo-logo.md +0 -185
  172. package/dist/docs/product/components/text-input.md +0 -624
  173. package/dist/docs/product/components/textarea.md +0 -352
  174. package/dist/docs/product/components/toast.md +0 -535
  175. package/dist/docs/product/components/token-logo.md +0 -371
  176. package/dist/docs/product/components/token.md +0 -247
  177. package/dist/docs/product/components/tooltip.md +0 -490
  178. package/dist/docs/product/components/verification-code.md +0 -116
  179. package/dist/docs/product/components/visual.md +0 -249
  180. package/dist/docs/product/foundations/accessibility.md +0 -377
  181. package/dist/docs/product/foundations/agents.md +0 -159
  182. package/dist/docs/product/foundations/color.md +0 -522
  183. package/dist/docs/product/foundations/content/tone.md +0 -194
  184. package/dist/docs/product/foundations/content/voice.md +0 -194
  185. package/dist/docs/product/foundations/content/writing-style.md +0 -406
  186. package/dist/docs/product/foundations/iconography.md +0 -282
  187. package/dist/docs/product/foundations/intent.md +0 -360
  188. package/dist/docs/product/foundations/layout.md +0 -508
  189. package/dist/docs/product/foundations/linter.md +0 -523
  190. package/dist/docs/product/foundations/motion.md +0 -151
  191. package/dist/docs/product/foundations/radius-and-padding.md +0 -86
  192. package/dist/docs/product/foundations/typography.md +0 -331
  193. package/dist/docs/product/introduction/faq.md +0 -133
  194. package/dist/docs/product/introduction/getting-started.md +0 -377
  195. package/dist/docs/product/patterns/blockchain-values.md +0 -709
  196. package/dist/docs/product/patterns/dashboards.md +0 -638
  197. package/dist/docs/product/patterns/destructive-actions.md +0 -626
  198. package/dist/docs/product/patterns/empty-states.md +0 -612
  199. package/dist/docs/product/patterns/errors-and-validation.md +0 -808
  200. package/dist/docs/product/patterns/feedback-and-status.md +0 -518
  201. package/dist/docs/product/patterns/forms.md +0 -679
  202. package/dist/docs/product/patterns/loading.md +0 -630
  203. package/dist/docs/product/patterns/navigation.md +0 -397
  204. package/dist/docs/product/patterns/payments.md +0 -765
  205. package/dist/docs/product/patterns/responsive-layout.md +0 -997
  206. package/dist/docs/product/patterns/tables-and-lists.md +0 -1170
  207. package/dist/docs/product/products/tempo-console.md +0 -671
  208. package/dist/docs/product/products/tempo-performance.md +0 -435
  209. package/dist/docs/product/products/tempo-wallet.md +0 -438
@@ -9,7 +9,7 @@ import { variables } from './vars.js'
9
9
  * - `style(definition)` returns a callable that produces `className` and `style` props.
10
10
  * - `variants({ base, variants, defaultVariants })` returns a callable that takes the variant
11
11
  * selection.
12
- * - `vars` holds references such as `vars.ease.snappy`. Call `vars({ colorScheme })` for props
12
+ * - `vars` holds references such as `vars.ease.standard`. Call `vars({ colorScheme })` for props
13
13
  * that apply the variables, and optionally a color scheme, to a scope.
14
14
  *
15
15
  * @example
@@ -355,11 +355,12 @@ fontFace({
355
355
  })
356
356
 
357
357
  global({
358
- // Squircles at 1.84 times the radius meet the 45 degree point of a round corner, which is where
359
- // the designs' fully smoothed corners pass. Browsers without `corner-shape` skip the block.
358
+ // Squircles at DS Marketing's `dimension/corner-scale` times the radius meet the 45 degree point
359
+ // of a round corner, which is where the designs' fully smoothed corners pass. Browsers without
360
+ // `corner-shape` skip the block.
360
361
  // Pseudo-elements usually paint a state layer over their element, so they take its shape.
361
362
  '@supports (corner-shape: squircle)': {
362
- ':root': { '--tds-corner-scale': '1.84' },
363
+ ':root': { '--tds-corner-scale': vars.corner.scale },
363
364
  ':where(*)': { cornerShape: 'squircle' },
364
365
  ':where(*)::after, :where(*)::before': { cornerShape: 'inherit' },
365
366
  },
@@ -1,6 +1,6 @@
1
1
  # Mobile
2
2
 
3
- Use `@tempoxyz/ds/mobile` for React Native apps that bundle with Metro, such as Expo apps. Implemented exports map to [TDS App](https://www.figma.com/design/8iu5856rBEI3pnZ6YaIBgw) families, captured style contracts, and native parity suites.
3
+ Use `@tempoxyz/ds/mobile` for React Native apps that bundle with Metro, such as Expo apps. Button, IconButton, and TextInput follow the current [Mobile App component designs](https://www.figma.com/design/0LMGd4FJ0xf67pGoo9Bkfy?node-id=1-174). The other eight components retain their [TDS App](https://www.figma.com/design/8iu5856rBEI3pnZ6YaIBgw) sizes, colors, and behavior.
4
4
 
5
5
  ## Setup
6
6
 
@@ -125,7 +125,9 @@ Props that take a color instead of a style read it through `useColor`, as above.
125
125
 
126
126
  ## Custom Tokens
127
127
 
128
- An app config names its sets `base` and `inverse`, since every Zyzz config reads the Provider's set selection. Zyzz extensions only replace existing tokens. Define app tokens in your own sets, and reference TDS tokens through `variables` and `inverse`.
128
+ A variable set is a named collection of design values. The Provider selects the set with `vars="base"` (the default) or `vars="inverse"` (inverted surface colors). Name your app’s sets `base` and `inverse` too, so the same Provider selection resolves both library and app styles.
129
+
130
+ `Vars.define` creates a set. `Vars.extend` overrides existing values but cannot add new tokens. Define app tokens with `Vars.define`, then reference library values through `variables` (base) or `inverse`. The app’s `defineConfig` exports a `style` helper that accepts its own tokens, such as `color: 'caption'` below.
129
131
 
130
132
  ```ts
131
133
  import { inverse as tdsInverse, variables } from '@tempoxyz/ds/mobile'
@@ -162,7 +164,7 @@ export const { style } = defineConfig({ defaultVars: 'base', id: 'app', vars: {
162
164
  | Skeleton | `layout` | Loading placeholders |
163
165
  | Spinner | `color`, `elevated` | Indeterminate progress |
164
166
  | TextButton | `children` | Inline actions |
165
- | TextInput | `appearance`, `extended`, `helper`, `label`, `secondaryLabel` | Text entry |
167
+ | TextInput | `appearance`, `extended`, `helper`, `invalid`, `label`, `secondaryLabel` | Text entry |
166
168
  | Toast | `variant` | Status messages |
167
169
  | Toggle | `disabled`, `onValueChange`, `value` | Binary settings |
168
170
 
@@ -170,15 +172,26 @@ Components also accept the props and `ref` of the React Native element they rend
170
172
 
171
173
  ## Behavior
172
174
 
173
- - Figma defines no pressed or disabled Button, IconButton, or TextButton. Pressed controls render at 65% opacity, and disabled controls render at 50%.
175
+ - **Action states:** The current Button and IconButton variants use distinct pressed and disabled colors. Compatibility-only Button appearances retain opacity feedback. TextButton uses 65% pressed and 50% disabled opacity.
176
+ - **Button variants:** Primary, Secondary, and Destructive map to `variant="primary"`, `"secondary"`, and `"destructive"`. `scale="large"` is Base (48 points), `"medium"` is Compact (40 points), and `"small"` is Small (32 points).
177
+ - **Icon variants:** Use `variant="plain"`, `"surface"`, or `"glass"`. The legacy Primary and Secondary variants map to Surface, and Tertiary maps to Plain. `appearance="overlay" variant="secondary"` maps to Glass.
178
+ - **Input states:** TextInput applies focused styling from native focus events. `invalid` applies the error treatment and an error accessibility hint. `editable={false}` or `readOnly` applies the disabled treatment and prevents editing. Disabled styling takes precedence over errors and focus.
174
179
  - Button follows its parent's alignment, so it fills a column and centers in a centered container. Set `alignSelf: 'flex-start'` to fit the label instead.
175
- - Button's `leadingIcon` and `trailingIcon` match Figma's icon toggles and take the label color. `loading` shows a spinner over the hidden content, keeps the button's size, and blocks presses.
180
+ - Button's `leadingIcon` and `trailingIcon` follow the label color. The current designs hide every leading icon, so those hidden paints do not replace the existing icon behavior. `loading` shows a spinner over the hidden content, keeps the button's size, and blocks presses.
176
181
  - Button, IconButton, and TextButton play a light impact haptic when pressed. Toggle plays a selection haptic when its value changes.
177
182
  - Toggle draws Figma's 44 by 28 point track with `Pressable` and the `switch` role, since the native switch has a fixed size.
178
183
  - CodeInput routes typing and one-time-code autofill through one hidden native input. The focused cell is the one that receives the next digit, and dismissing the keyboard ends entry.
179
184
  - Toast renders a single message. Your app positions, queues, and dismisses notifications.
180
185
  - Skeleton placeholders pulse and Spinner rotates, and both stay still when Reduce Motion is on.
181
- - React Native has no backdrop blur, so overlay secondary controls keep only their translucent fill.
186
+ - **Glass limitation:** Core React Native provides no backdrop blur. Glass icon buttons retain the translucent fill, hairline, and shadow, but omit the design’s 20-point background blur.
187
+
188
+ ### Alignment Scope
189
+
190
+ Button, IconButton, and TextInput use typography and color tokens dedicated to these controls. Existing tokens for the other components are unchanged. Native compiler tests cover the variants captured from the linked designs on November 13, 2026, in both color schemes, but do not establish screenshot parity or automate live Figma drift detection.
191
+
192
+ The linked designs render disabled Secondary buttons, Surface icon buttons, and input values/messages in black, even though their bound variables specify different colors. The controls preserve the visible black colors. These overrides make disabled Secondary and Surface content unreadable in the light scheme, and disabled input values and messages unreadable in the dark scheme. Do not release these disabled styles until design review resolves the conflict between the rendered colors and their bound tokens.
193
+
194
+ The designs reduce loading buttons to a compact spinner-only width. Button instead keeps its label width while loading to avoid a layout shift, and its shared Spinner retains its existing track opacity. Legacy appearance and icon options remain compatible. Optional TextInput leading/trailing, paste, and error-icon slots are not exposed. Other designs in the Mobile App file (Screen Header, List Row, Number Pad, Amount, and Sheet) are not implemented by this package.
182
195
 
183
196
  ## Haptics
184
197
 
@@ -1,17 +1,22 @@
1
+ /** Native labeled actions with Mobile App sizes and interaction states. @module */
1
2
  import { cloneElement, type ComponentPropsWithRef, type ReactElement } from 'react'
2
3
  import { type ColorValue, Pressable, Text, View } from 'react-native'
3
4
  import type * as zyzz from 'zyzz'
4
5
  import * as Haptics from '../Haptics.js'
5
6
  import { useColor } from '../useColor.js'
6
- import { inverse } from '../vars.js'
7
+ import { inverse, variables } from '../vars.js'
7
8
  import { style, variants } from '../zyzz.config.js'
8
9
  import { Spinner } from './Spinner.js'
9
10
 
10
11
  /**
11
12
  * A `Pressable` with the `button` role and a text label. Pressing plays a light impact haptic
12
- * before `onPress`. Pressed buttons render at 65% opacity and disabled ones at 50%. Variants
13
+ * before `onPress`. Pressed and disabled states use their own fill and content colors. Variants
13
14
  * default to `appearance="base"`, `scale="medium"`, `variant="primary"`.
14
15
  *
16
+ * `large`, `medium`, and `small` map to Base, Compact, and Small. `destructive` marks a
17
+ * destructive action. `appearance`, `tertiary`, and `trailingIcon` remain compatibility options;
18
+ * the current design family specifies base Primary, Secondary, and Destructive only.
19
+ *
15
20
  * - Start the label with a specific verb, such as `Add funds`.
16
21
  * - The button follows its parent's alignment and fills a column. Set `alignSelf: 'flex-start'`
17
22
  * to fit the label instead.
@@ -42,13 +47,20 @@ export function Button(props: Button.Props) {
42
47
  variant,
43
48
  ...pressableProps
44
49
  } = props
45
- const color = useColor(styles.label({ appearance, scale, variant }).style)
50
+ const state = disabled ? 'disabled' : undefined
51
+ const color = useColor(styles.label({ appearance, scale, state, variant }).style)
46
52
 
47
53
  return (
54
+ // Base UI Button renders a DOM button; native actions require Pressable.
48
55
  <Pressable
49
56
  accessibilityRole="button"
50
57
  aria-busy={loading}
51
58
  {...pressableProps}
59
+ accessibilityState={{
60
+ ...props.accessibilityState,
61
+ busy: Boolean(loading) || props.accessibilityState?.busy,
62
+ disabled: Boolean(disabled || loading) || props.accessibilityState?.disabled,
63
+ }}
52
64
  disabled={disabled || loading}
53
65
  onPress={(event) => {
54
66
  Haptics.press()
@@ -60,6 +72,7 @@ export function Button(props: Button.Props) {
60
72
  scale,
61
73
  state: (() => {
62
74
  if (disabled) return 'disabled'
75
+ if (loading) return 'loading'
63
76
  return state.pressed ? 'pressed' : undefined
64
77
  })(),
65
78
  variant,
@@ -69,9 +82,9 @@ export function Button(props: Button.Props) {
69
82
  >
70
83
  {/* The hidden content keeps the button's width while the spinner shows. */}
71
84
  <View style={styles.content({ loading: Boolean(loading) }).style}>
72
- {leadingIcon && cloneElement(leadingIcon, { color })}
73
- <Text style={styles.label({ appearance, scale, variant }).style}>{children}</Text>
74
- {trailingIcon && cloneElement(trailingIcon, { color })}
85
+ {leadingIcon && cloneElement(leadingIcon, { color, height: 16, width: 16 })}
86
+ <Text style={styles.label({ appearance, scale, state, variant }).style}>{children}</Text>
87
+ {trailingIcon && cloneElement(trailingIcon, { color, height: 16, width: 16 })}
75
88
  </View>
76
89
  {loading && (
77
90
  <View style={styles.spinner().style}>
@@ -83,12 +96,17 @@ export function Button(props: Button.Props) {
83
96
  }
84
97
 
85
98
  export namespace Button {
86
- type Icon = ReactElement<{ color?: ColorValue | undefined }>
99
+ type Icon = ReactElement<{
100
+ color?: ColorValue | undefined
101
+ height?: number | undefined
102
+ width?: number | undefined
103
+ }>
87
104
 
88
105
  export type Props = Omit<ComponentPropsWithRef<typeof Pressable>, 'children'> &
89
106
  Omit<zyzz.Props.Variants<typeof styles.button>, 'state'> & {
107
+ /** Visible action label, retained as the accessible name while loading. */
90
108
  children: string
91
- /** Icon before the label, matching Figma's Leading Icon. The button sets its color. */
109
+ /** A 16-point leading icon in the label color. */
92
110
  leadingIcon?: Icon | undefined
93
111
  /**
94
112
  * Replaces the content with a spinner and blocks presses without changing the button's size.
@@ -108,7 +126,6 @@ export namespace styles {
108
126
  borderRadius: 'full',
109
127
  flexDirection: 'row',
110
128
  justifyContent: 'center',
111
- minWidth: '80px !custom',
112
129
  paddingVertical: '4',
113
130
  },
114
131
  defaultVariants: { appearance: 'base', scale: 'medium', variant: 'primary' },
@@ -117,11 +134,15 @@ export namespace styles {
117
134
  scale: {
118
135
  large: { height: '48', paddingHorizontal: '32' },
119
136
  medium: { height: '40', paddingHorizontal: '24' },
120
- small: { height: '32', paddingHorizontal: '16' },
137
+ small: { height: '32', minWidth: '80px !custom', paddingHorizontal: '16' },
138
+ },
139
+ state: { disabled: {}, loading: {}, pressed: {} },
140
+ variant: {
141
+ destructive: { backgroundColor: 'container.negative' },
142
+ primary: {},
143
+ secondary: { backgroundColor: 'container.regular' },
144
+ tertiary: {},
121
145
  },
122
- // Figma defines no pressed or disabled Button, so both states dim the resting variant.
123
- state: { disabled: { opacity: 0.5 }, pressed: { opacity: 0.65 } },
124
- variant: { primary: {}, secondary: { backgroundColor: 'container.regular' }, tertiary: {} },
125
146
  },
126
147
  compoundVariants: [
127
148
  {
@@ -141,6 +162,48 @@ export namespace styles {
141
162
  when: { appearance: 'overlay', variant: 'secondary' },
142
163
  style: { backgroundColor: 'component.button.overlay.fill' },
143
164
  },
165
+ {
166
+ when: { appearance: 'base', state: 'pressed', variant: 'primary' },
167
+ style: { backgroundColor: variables.color.component.button.primaryPressed },
168
+ },
169
+ {
170
+ when: { appearance: 'base', state: 'pressed', variant: 'secondary' },
171
+ style: { backgroundColor: 'container.strong' },
172
+ },
173
+ {
174
+ when: { state: 'pressed', variant: 'destructive' },
175
+ style: { backgroundColor: 'border.negative' },
176
+ },
177
+ {
178
+ when: { state: 'disabled', variant: ['destructive', 'primary'] },
179
+ style: { backgroundColor: 'container.regular' },
180
+ },
181
+ {
182
+ when: {
183
+ appearance: ['inverse', 'overlay'],
184
+ state: 'disabled',
185
+ variant: ['destructive', 'primary'],
186
+ },
187
+ style: { backgroundColor: inverse.color.container.regular },
188
+ },
189
+ {
190
+ // Figma renders a literal black disabled fill despite its regular-fill binding.
191
+ when: { appearance: 'base', state: 'disabled', variant: 'secondary' },
192
+ style: { backgroundColor: '#000000 !custom' },
193
+ },
194
+ {
195
+ // Compatibility-only combinations have no current state frames; retain their press feedback.
196
+ when: {
197
+ appearance: ['inverse', 'overlay'],
198
+ state: 'pressed',
199
+ variant: ['primary', 'secondary'],
200
+ },
201
+ style: { opacity: 0.65 },
202
+ },
203
+ {
204
+ when: { state: 'pressed', variant: 'tertiary' },
205
+ style: { opacity: 0.65 },
206
+ },
144
207
  ],
145
208
  },
146
209
  { id: 'tds/mobile/button' },
@@ -165,11 +228,17 @@ export namespace styles {
165
228
  overlay: { color: inverse.color.content.primary },
166
229
  },
167
230
  scale: {
168
- large: { typography: 'body.b2Strong' },
169
- medium: { typography: 'body.b2Strong' },
170
- small: { typography: 'body.b3Strong' },
231
+ large: { typography: 'control.labelStrong' },
232
+ medium: { typography: 'control.labelStrong' },
233
+ small: { typography: 'control.compact' },
234
+ },
235
+ state: { disabled: {}, loading: {}, pressed: {} },
236
+ variant: {
237
+ destructive: { color: 'content.negative' },
238
+ primary: {},
239
+ secondary: {},
240
+ tertiary: {},
171
241
  },
172
- variant: { primary: {}, secondary: {}, tertiary: {} },
173
242
  },
174
243
  compoundVariants: [
175
244
  {
@@ -180,6 +249,14 @@ export namespace styles {
180
249
  when: { appearance: ['inverse', 'overlay'], variant: 'primary' },
181
250
  style: { color: 'content.primary' },
182
251
  },
252
+ {
253
+ when: { state: 'disabled' },
254
+ style: { color: 'component.control.content.tertiary' },
255
+ },
256
+ {
257
+ when: { appearance: ['inverse', 'overlay'], state: 'disabled' },
258
+ style: { color: inverse.color.component.control.content.tertiary },
259
+ },
183
260
  ],
184
261
  },
185
262
  { id: 'tds/mobile/button/label' },
@@ -1,5 +1,6 @@
1
+ /** Native icon actions with Plain, Surface, and Glass treatments. @module */
1
2
  import { cloneElement, type ComponentPropsWithRef, type ReactElement } from 'react'
2
- import { type ColorValue, Pressable } from 'react-native'
3
+ import { type ColorValue, Pressable, type ViewStyle } from 'react-native'
3
4
  import type * as zyzz from 'zyzz'
4
5
  import * as Haptics from '../Haptics.js'
5
6
  import { useColor } from '../useColor.js'
@@ -8,9 +9,13 @@ import { variants } from '../zyzz.config.js'
8
9
 
9
10
  /**
10
11
  * An icon-only `Pressable` with the `button` role. It sets its icon's color from `appearance` and
11
- * `variant`, and plays a light impact haptic before `onPress`. Pressed buttons render at 65%
12
- * opacity and disabled ones at 50%. Variants default to `appearance="base"`, `scale="medium"`,
13
- * `variant="primary"`.
12
+ * `variant`, and plays a light impact haptic before `onPress`. Defaults are `appearance="base"`,
13
+ * `scale="medium"`, and `variant="surface"`. Pressed and disabled states use dedicated colors.
14
+ *
15
+ * `large`, `medium`, and `small` map to Large, Default, and Small. `plain`, `surface`, and
16
+ * `glass` match the approved styles. Legacy `primary` and `secondary` map to Surface, and
17
+ * `tertiary` to Plain; `appearance="overlay"` with `secondary` maps to Glass. Glass preserves
18
+ * its fill, hairline, and shadow, but core React Native cannot provide the 20-point backdrop blur.
14
19
  *
15
20
  * - Name the action in `accessibilityLabel`, such as `Copy address`, since the icon has no text.
16
21
  * - `small` and `medium` are 32 and 40 points square. Add `hitSlop` to reach a 44-point touch
@@ -31,12 +36,21 @@ import { variants } from '../zyzz.config.js'
31
36
  */
32
37
  export function IconButton(props: IconButton.Props) {
33
38
  const { appearance, children, disabled, scale, variant, ...pressableProps } = props
34
- const color = useColor(styles.icon({ appearance, variant }).style)
39
+ const color = useColor(
40
+ styles.icon({ appearance, state: disabled ? 'disabled' : undefined }).style,
41
+ )
42
+ const shadowColor = useColor(styles.shadowColor({ appearance }).style)
43
+ const size = scale === 'small' ? 16 : 20
35
44
 
36
45
  return (
46
+ // Base UI Button targets DOM elements; Pressable preserves the native control and ref.
37
47
  <Pressable
38
48
  accessibilityRole="button"
39
49
  {...pressableProps}
50
+ accessibilityState={{
51
+ ...props.accessibilityState,
52
+ disabled: Boolean(disabled) || props.accessibilityState?.disabled,
53
+ }}
40
54
  disabled={disabled}
41
55
  onPress={(event) => {
42
56
  Haptics.press()
@@ -52,10 +66,11 @@ export function IconButton(props: IconButton.Props) {
52
66
  })(),
53
67
  variant,
54
68
  }).style,
69
+ styles.shadow({ appearance, color: shadowColor, variant }),
55
70
  typeof props.style === 'function' ? props.style(state) : props.style,
56
71
  ]}
57
72
  >
58
- {cloneElement(children, { color })}
73
+ {cloneElement(children, { color, height: size, width: size })}
59
74
  </Pressable>
60
75
  )
61
76
  }
@@ -65,8 +80,12 @@ export namespace IconButton {
65
80
  Omit<zyzz.Props.Variants<typeof styles.button>, 'state'> & {
66
81
  /** Required, since the icon provides no text alternative. */
67
82
  accessibilityLabel: string
68
- /** A single icon element. The button replaces its `color` with the variant's icon color. */
69
- children: ReactElement<{ color?: ColorValue | undefined }>
83
+ /** A single icon; its color and 20-point (Small: 16-point) dimensions follow the design. */
84
+ children: ReactElement<{
85
+ color?: ColorValue | undefined
86
+ height?: number | undefined
87
+ width?: number | undefined
88
+ }>
70
89
  }
71
90
  }
72
91
 
@@ -77,10 +96,8 @@ export namespace styles {
77
96
  alignItems: 'center',
78
97
  borderRadius: 'full',
79
98
  justifyContent: 'center',
80
- paddingHorizontal: 'none',
81
- paddingVertical: '4',
82
99
  },
83
- defaultVariants: { appearance: 'base', scale: 'medium', variant: 'primary' },
100
+ defaultVariants: { appearance: 'base', scale: 'medium', variant: 'surface' },
84
101
  variants: {
85
102
  appearance: { base: {}, inverse: {}, overlay: {} },
86
103
  scale: {
@@ -88,27 +105,67 @@ export namespace styles {
88
105
  medium: { height: '40', width: '40' },
89
106
  small: { height: '32', width: '32' },
90
107
  },
91
- // Figma defines no pressed or disabled IconButton, so both states dim the resting variant.
92
- state: { disabled: { opacity: 0.5 }, pressed: { opacity: 0.65 } },
93
- variant: { primary: {}, secondary: { backgroundColor: 'container.regular' }, tertiary: {} },
108
+ state: { disabled: {}, pressed: {} },
109
+ variant: {
110
+ glass: {
111
+ backgroundColor: 'material.ultrathin',
112
+ borderColor: 'component.iconButton.glass.border',
113
+ borderWidth: 'thin',
114
+ },
115
+ plain: {},
116
+ primary: { backgroundColor: 'container.regular' },
117
+ secondary: { backgroundColor: 'container.regular' },
118
+ surface: { backgroundColor: 'container.regular' },
119
+ tertiary: {},
120
+ },
94
121
  },
95
122
  compoundVariants: [
96
123
  {
97
- when: { appearance: 'base', variant: 'primary' },
98
- style: { backgroundColor: inverse.color.background.secondary },
124
+ when: {
125
+ appearance: ['inverse', 'overlay'],
126
+ variant: ['primary', 'secondary', 'surface'],
127
+ },
128
+ style: { backgroundColor: inverse.color.container.regular },
129
+ },
130
+ {
131
+ when: { appearance: 'overlay', variant: 'secondary' },
132
+ style: {
133
+ backgroundColor: inverse.color.material.ultrathin,
134
+ borderColor: inverse.color.component.iconButton.glass.border,
135
+ borderWidth: 'thin',
136
+ },
137
+ },
138
+ {
139
+ when: { appearance: ['inverse', 'overlay'], variant: 'glass' },
140
+ style: {
141
+ backgroundColor: inverse.color.material.ultrathin,
142
+ borderColor: inverse.color.component.iconButton.glass.border,
143
+ },
144
+ },
145
+ {
146
+ when: { state: 'pressed' },
147
+ style: { backgroundColor: 'container.strong' },
148
+ },
149
+ {
150
+ when: { appearance: ['inverse', 'overlay'], state: 'pressed' },
151
+ style: { backgroundColor: inverse.color.container.strong },
99
152
  },
100
153
  {
101
- when: { appearance: ['inverse', 'overlay'], variant: 'primary' },
102
- style: { backgroundColor: 'background.secondary' },
154
+ // Figma renders a literal black disabled fill despite its regular-fill binding.
155
+ when: { state: 'disabled', variant: ['primary', 'secondary', 'surface'] },
156
+ style: { backgroundColor: '#000000 !custom' },
103
157
  },
104
158
  {
105
- when: { appearance: 'inverse', variant: 'secondary' },
159
+ when: { state: 'disabled', variant: 'glass' },
160
+ style: { backgroundColor: 'container.regular' },
161
+ },
162
+ {
163
+ when: { appearance: 'overlay', state: 'disabled', variant: 'secondary' },
106
164
  style: { backgroundColor: inverse.color.container.regular },
107
165
  },
108
166
  {
109
- // React Native has no backdrop blur, so the overlay keeps only its translucent fill.
110
- when: { appearance: 'overlay', variant: 'secondary' },
111
- style: { backgroundColor: 'component.button.overlay.fill' },
167
+ when: { appearance: ['inverse', 'overlay'], state: 'disabled', variant: 'glass' },
168
+ style: { backgroundColor: inverse.color.container.regular },
112
169
  },
113
170
  ],
114
171
  },
@@ -118,26 +175,61 @@ export namespace styles {
118
175
  export const icon = variants(
119
176
  {
120
177
  base: { color: 'content.primary' },
121
- defaultVariants: { appearance: 'base', variant: 'primary' },
178
+ defaultVariants: { appearance: 'base', scale: 'medium' },
122
179
  variants: {
123
180
  appearance: {
124
181
  base: {},
125
182
  inverse: { color: inverse.color.content.primary },
126
183
  overlay: { color: inverse.color.content.primary },
127
184
  },
128
- variant: { primary: {}, secondary: {}, tertiary: {} },
185
+ scale: {
186
+ large: { height: '20', width: '20' },
187
+ medium: { height: '20', width: '20' },
188
+ small: { height: '16', width: '16' },
189
+ },
190
+ state: { disabled: { color: 'component.control.content.tertiary' }, pressed: {} },
129
191
  },
130
192
  compoundVariants: [
131
193
  {
132
- when: { appearance: 'base', variant: 'primary' },
133
- style: { color: inverse.color.content.primary },
134
- },
135
- {
136
- when: { appearance: ['inverse', 'overlay'], variant: 'primary' },
137
- style: { color: 'content.primary' },
194
+ when: { appearance: ['inverse', 'overlay'], state: 'disabled' },
195
+ style: { color: inverse.color.component.control.content.tertiary },
138
196
  },
139
197
  ],
140
198
  },
141
199
  { id: 'tds/mobile/icon-button/icon' },
142
200
  )
201
+
202
+ /** Builds the native shadow without converting CSS blur into iOS shadowRadius. */
203
+ export function shadow(options: shadow.Options): ViewStyle | undefined {
204
+ if (
205
+ options.variant !== 'glass' &&
206
+ !(options.appearance === 'overlay' && options.variant === 'secondary')
207
+ )
208
+ return undefined
209
+
210
+ return { boxShadow: [{ blurRadius: 20, color: options.color, offsetX: 0, offsetY: 8 }] }
211
+ }
212
+
213
+ export declare namespace shadow {
214
+ /** The variant and Provider-resolved shadow color used by the native control. */
215
+ type Options = Pick<zyzz.Props.Variants<typeof button>, 'appearance' | 'variant'> & {
216
+ /** A native color, including dynamic iOS colors, from the compiled shadowColor recipe. */
217
+ color: ColorValue
218
+ }
219
+ }
220
+
221
+ /** Resolves shadow color through the same Provider and appearance as the native icon. */
222
+ export const shadowColor = variants(
223
+ {
224
+ base: { color: 'component.iconButton.glass.shadow' },
225
+ variants: {
226
+ appearance: {
227
+ base: {},
228
+ inverse: { color: inverse.color.component.iconButton.glass.shadow },
229
+ overlay: { color: inverse.color.component.iconButton.glass.shadow },
230
+ },
231
+ },
232
+ },
233
+ { id: 'tds/mobile/icon-button/shadow-color' },
234
+ )
143
235
  }