@tempoxyz/ds 0.3.15 → 0.3.17

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 (130) hide show
  1. package/dist/docs/AGENTS.md +10 -6
  2. package/dist/docs/arsenal.md +44 -0
  3. package/dist/docs/marketing.md +703 -4
  4. package/dist/docs/product/components/actions.md +53 -1
  5. package/dist/docs/product/components/blockchain.md +147 -3
  6. package/dist/docs/product/components/feedback-and-status.md +137 -7
  7. package/dist/docs/product/components/navigation.md +1 -1
  8. package/dist/docs/product/documents.md +225 -0
  9. package/dist/docs/product/foundations.md +2 -1
  10. package/dist/docs/product/patterns.md +3 -22
  11. package/dist/document/Document.d.ts +46 -0
  12. package/dist/document/Document.d.ts.map +1 -0
  13. package/dist/document/Document.js +190 -0
  14. package/dist/document/Document.js.map +1 -0
  15. package/dist/document/Enhance.d.ts +13 -0
  16. package/dist/document/Enhance.d.ts.map +1 -0
  17. package/dist/document/Enhance.js +421 -0
  18. package/dist/document/Enhance.js.map +1 -0
  19. package/dist/document/bin.d.ts +3 -0
  20. package/dist/document/bin.d.ts.map +1 -0
  21. package/dist/document/bin.js +38 -0
  22. package/dist/document/bin.js.map +1 -0
  23. package/dist/document/document.css +373 -0
  24. package/dist/document/index.d.ts +3 -0
  25. package/dist/document/index.d.ts.map +1 -0
  26. package/dist/document/index.js +3 -0
  27. package/dist/document/index.js.map +1 -0
  28. package/dist/document/internal/Cli.d.ts +43 -0
  29. package/dist/document/internal/Cli.d.ts.map +1 -0
  30. package/dist/document/internal/Cli.js +87 -0
  31. package/dist/document/internal/Cli.js.map +1 -0
  32. package/dist/document/internal/Template.d.ts +21 -0
  33. package/dist/document/internal/Template.d.ts.map +1 -0
  34. package/dist/document/internal/Template.js +15 -0
  35. package/dist/document/internal/Template.js.map +1 -0
  36. package/dist/document/script.d.ts +2 -0
  37. package/dist/document/script.d.ts.map +1 -0
  38. package/dist/document/script.js +379 -0
  39. package/dist/document/templates/brief.html +96 -0
  40. package/dist/document/templates/essay.html +70 -0
  41. package/dist/document/templates/post.html +69 -0
  42. package/dist/marketing/index.js.zyzz.json +1 -1
  43. package/dist/marketing/vars.d.ts +618 -758
  44. package/dist/marketing/vars.d.ts.map +1 -1
  45. package/dist/marketing/vars.js +8 -5
  46. package/dist/marketing/vars.js.map +1 -1
  47. package/dist/marketing/vars.js.zyzz.json +1 -1
  48. package/dist/marketing/zyzz.config.d.ts +3042 -3757
  49. package/dist/marketing/zyzz.config.d.ts.map +1 -1
  50. package/dist/marketing/zyzz.config.js +1 -1
  51. package/dist/marketing/zyzz.config.js.map +1 -1
  52. package/dist/marketing/zyzz.config.js.zyzz.json +1 -1
  53. package/dist/mobile/components/Button.d.ts +115 -15
  54. package/dist/mobile/components/Button.d.ts.map +1 -1
  55. package/dist/mobile/components/Button.js +85 -14
  56. package/dist/mobile/components/Button.js.map +1 -1
  57. package/dist/mobile/components/IconButton.d.ts +129 -40
  58. package/dist/mobile/components/IconButton.d.ts.map +1 -1
  59. package/dist/mobile/components/IconButton.js +97 -28
  60. package/dist/mobile/components/IconButton.js.map +1 -1
  61. package/dist/mobile/components/TextInput.d.ts +132 -11
  62. package/dist/mobile/components/TextInput.d.ts.map +1 -1
  63. package/dist/mobile/components/TextInput.js +115 -14
  64. package/dist/mobile/components/TextInput.js.map +1 -1
  65. package/dist/mobile/index.d.ts +1 -0
  66. package/dist/mobile/index.d.ts.map +1 -1
  67. package/dist/mobile/index.js +1 -0
  68. package/dist/mobile/index.js.map +1 -1
  69. package/dist/mobile/vars.d.ts +103 -0
  70. package/dist/mobile/vars.d.ts.map +1 -1
  71. package/dist/mobile/vars.js +74 -0
  72. package/dist/mobile/vars.js.map +1 -1
  73. package/dist/mobile/zyzz.config.d.ts +408 -0
  74. package/dist/mobile/zyzz.config.d.ts.map +1 -1
  75. package/dist/web/components/AddressCard.js.zyzz.json +1 -1
  76. package/dist/web/components/Amount.css +1 -1
  77. package/dist/web/components/Amount.d.ts +9 -0
  78. package/dist/web/components/Amount.d.ts.map +1 -1
  79. package/dist/web/components/Amount.js +8 -5
  80. package/dist/web/components/Amount.js.map +1 -1
  81. package/dist/web/components/Amount.js.zyzz.json +1 -1
  82. package/dist/web/components/CopyButton.d.ts +6 -0
  83. package/dist/web/components/CopyButton.d.ts.map +1 -1
  84. package/dist/web/components/CopyButton.js +4 -1
  85. package/dist/web/components/CopyButton.js.map +1 -1
  86. package/dist/web/components/CopyButton.js.zyzz.json +1 -1
  87. package/dist/web/components/Hex.css +1 -1
  88. package/dist/web/components/Hex.d.ts +84 -3
  89. package/dist/web/components/Hex.d.ts.map +1 -1
  90. package/dist/web/components/Hex.js +20 -13
  91. package/dist/web/components/Hex.js.map +1 -1
  92. package/dist/web/components/Hex.js.zyzz.json +1 -1
  93. package/dist/web/components/Progress.css +1 -1
  94. package/dist/web/components/Progress.d.ts +12 -2
  95. package/dist/web/components/Progress.d.ts.map +1 -1
  96. package/dist/web/components/Progress.js +9 -5
  97. package/dist/web/components/Progress.js.map +1 -1
  98. package/dist/web/components/Progress.js.zyzz.json +1 -1
  99. package/dist/web/components/SecretValue.js.zyzz.json +1 -1
  100. package/dist/web/components/SidebarMenu.d.ts +4 -4
  101. package/dist/web/components/SidebarMenu.js +6 -6
  102. package/dist/web/components/SidebarMenu.js.map +1 -1
  103. package/dist/web/components/Snippet.js.zyzz.json +1 -1
  104. package/dist/web/index.js.zyzz.json +1 -1
  105. package/package.json +19 -1
  106. package/src/document/Document.ts +277 -0
  107. package/src/document/Enhance.ts +434 -0
  108. package/src/document/bin.ts +38 -0
  109. package/src/document/document.css +373 -0
  110. package/src/document/index.ts +2 -0
  111. package/src/document/internal/Cli.ts +132 -0
  112. package/src/document/internal/Template.ts +25 -0
  113. package/src/document/script.ts +8 -0
  114. package/src/document/templates/brief.html +96 -0
  115. package/src/document/templates/essay.html +70 -0
  116. package/src/document/templates/post.html +69 -0
  117. package/src/marketing/README.md +1 -1
  118. package/src/marketing/vars.ts +526 -604
  119. package/src/marketing/zyzz.config.ts +5 -4
  120. package/src/mobile/README.md +19 -6
  121. package/src/mobile/components/Button.tsx +94 -17
  122. package/src/mobile/components/IconButton.tsx +122 -30
  123. package/src/mobile/components/TextInput.tsx +139 -24
  124. package/src/mobile/index.ts +1 -0
  125. package/src/mobile/vars.ts +74 -0
  126. package/src/web/components/Amount.tsx +37 -3
  127. package/src/web/components/CopyButton.tsx +8 -0
  128. package/src/web/components/Hex.tsx +79 -13
  129. package/src/web/components/Progress.tsx +8 -2
  130. package/src/web/components/SidebarMenu.tsx +6 -6
@@ -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
  }