@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
@@ -1,523 +0,0 @@
1
- # Linter
2
-
3
- Oxlint rules that check how your app uses Tempo Design System.
4
-
5
- ## Overview
6
-
7
- The library ships an Oxlint plugin that reports the mistakes types cannot catch, such as an unnamed icon-only [Button](../components/button.md), an import from an internal path, or a native control or hand-built card that a component replaces.
8
-
9
- ## Set Up the Linter
10
-
11
- Spread the configuration for your surface, web, mobile, or marketing, into the lint options of Vite Plus, then run the linter.
12
-
13
- ```ts title="vite.config.ts"
14
- import { web } from '@tempoxyz/ds/oxlint'
15
- import { defineConfig } from 'vite-plus'
16
-
17
- export default defineConfig({ lint: web })
18
- ```
19
-
20
- ```sh
21
- vp lint
22
- ```
23
-
24
- To change a severity, spread the rules and override one.
25
-
26
- ```ts title="vite.config.ts"
27
- import { web } from '@tempoxyz/ds/oxlint'
28
- import { defineConfig } from 'vite-plus'
29
-
30
- export default defineConfig({
31
- lint: { ...web, rules: { ...web.rules, 'tds/no-raw-values': 'error' } },
32
- })
33
- ```
34
-
35
- Without Vite Plus, register both plugins and enable the rules in an Oxlint configuration file.
36
-
37
- ```json title=".oxlintrc.json"
38
- {
39
- "jsPlugins": [
40
- { "name": "tds", "specifier": "@tempoxyz/ds/oxlint" },
41
- { "name": "zyzz", "specifier": "zyzz/oxlint" }
42
- ],
43
- "rules": {
44
- "tds/no-cross-surface": ["error", { "surface": "web" }],
45
- "tds/no-custom-values": "warn",
46
- "tds/no-internal-imports": "error",
47
- "tds/no-raw-values": "warn",
48
- "tds/no-single-key-shortcuts": "warn",
49
- "tds/prefer-component": "warn",
50
- "tds/prefer-layout": "warn",
51
- "tds/prefer-progress": "warn",
52
- "tds/prefer-surface": "warn",
53
- "tds/prefer-typography": "warn",
54
- "tds/require-accessible-name": "error",
55
- "tds/require-scroll-region": "warn"
56
- }
57
- }
58
- ```
59
-
60
- ## Rules
61
-
62
- ### Import From Public Entrypoints
63
-
64
- Reports a library import from a path that the package does not publish. The root, icons, mobile, and oxlint entrypoints pass, and so do icon SVG and font files.
65
-
66
- ```json
67
- { "rules": { "tds/no-internal-imports": "error" } }
68
- ```
69
-
70
- **Do:** Import components from `@tempoxyz/ds` and icons from `@tempoxyz/ds/icons`.
71
-
72
- ````tsx
73
- ```tsx
74
- import { Spinner } from '@tempoxyz/ds'
75
- import { Copy } from '@tempoxyz/ds/icons'
76
- ```
77
- ````
78
-
79
- **Don't:** Import from `src` or `dist`. Internal paths change without a release note.
80
-
81
- ````tsx
82
- ```tsx
83
- import { Spinner } from '@tempoxyz/ds/src/web'
84
- // @lint: tds/no-internal-imports: '@tempoxyz/ds/src/web' is not a published entrypoint. Import from '@tempoxyz/ds', '@tempoxyz/ds/mobile', or their `icons` subpaths.
85
- import { Copy } from '@tempoxyz/ds/dist/icons'
86
- // @lint: tds/no-internal-imports: '@tempoxyz/ds/dist/icons' is not a published entrypoint. Import from '@tempoxyz/ds', '@tempoxyz/ds/mobile', or their `icons` subpaths.
87
- ```
88
- ````
89
-
90
- ### Stay on One Surface
91
-
92
- Reports an import from the surface that your app does not render. Without a surface option, it reports a file that imports from both surfaces.
93
-
94
- ```json
95
- { "rules": { "tds/no-cross-surface": ["error", { "surface": "web" }] } }
96
- ```
97
-
98
- **Do:** Import every component and icon of a React Native app from the Mobile entrypoints.
99
-
100
- ````tsx
101
- ```tsx
102
- import { Toggle } from '@tempoxyz/ds/mobile'
103
- import { Copy } from '@tempoxyz/ds/mobile/icons'
104
- ```
105
- ````
106
-
107
- **Don't:** Mix surfaces in one app. Each surface owns its variables, and a Web component does not render in React Native.
108
-
109
- ````tsx
110
- ```tsx
111
- import { Toggle } from '@tempoxyz/ds/mobile'
112
- import { Switch } from '@tempoxyz/ds'
113
- // @lint: tds/no-cross-surface: '@tempoxyz/ds' belongs to the web surface, but this app uses the mobile surface.
114
- ```
115
- ````
116
-
117
- ### Name Controls Without Text
118
-
119
- Reports a library component that renders no text and has no accessible name, such as an icon-only [Button](../components/button.md) or a [Gauge](../components/gauge.md).
120
-
121
- ```json
122
- { "rules": { "tds/require-accessible-name": "error" } }
123
- ```
124
-
125
- **Do:** Name the action in `aria-label`, on the button or on the trigger that renders it.
126
-
127
- ````tsx
128
- ```tsx
129
- <Button aria-label="Copy address" shape="icon">
130
- <Copy />
131
- </Button>
132
- ```
133
- ````
134
-
135
- **Don't:** Leave an icon-only button or a [Gauge](../components/gauge.md) unnamed. Screen readers announce only its role.
136
-
137
- ````tsx
138
- ```tsx
139
- <Button shape="icon">
140
- <Copy />
141
- </Button>
142
- // @lint: tds/require-accessible-name: 'Button' renders no text. Name it with `aria-label` or `aria-labelledby`.
143
- ```
144
- ````
145
-
146
- ### Name Scroll Regions
147
-
148
- Reports a native element that scrolls without a role, a tab stop, and a name. A container whose content holds a link, a button, or a field passes, since its content takes focus.
149
-
150
- ```json
151
- { "rules": { "tds/require-scroll-region": "warn" } }
152
- ```
153
-
154
- **Do:** Name the region and give it a tab stop, so keyboards can scroll it.
155
-
156
- ````tsx
157
- ```tsx
158
- <div aria-label="Fee schedule" role="region" {...styles.scroll()} tabIndex={0}>
159
- <Table.Root>{rows}</Table.Root>
160
- </div>
161
- ```
162
- ````
163
-
164
- **Don't:** Leave a scroll container without a tab stop. Keyboard users cannot reach the hidden content.
165
-
166
- ````tsx
167
- ```tsx
168
- <div style={{ overflowX: 'auto' }}>
169
- // @lint: tds/require-scroll-region: This scrolling <div> needs role="region", tabIndex={0}, and an aria-label, so keyboard and screen reader users can reach and identify it.
170
- <Table.Root>{rows}</Table.Root>
171
- </div>
172
- ```
173
- ````
174
-
175
- ### Require a Modifier on Shortcuts
176
-
177
- Warns on a key listener on the window or the document that matches one printable character, such as G or /, and reads no modifier. A character key on the whole page fires while people type or dictate ([SC 2.1.4](https://www.w3.org/WAI/WCAG22/Understanding/character-key-shortcuts.html)).
178
-
179
- ```json
180
- { "rules": { "tds/no-single-key-shortcuts": "warn" } }
181
- ```
182
-
183
- A single-key shortcut is valid when people can turn it off or remap it, or when it works only while a component has focus. The rule cannot detect either case. If a shortcut meets one of them, disable the rule on that line and state the reason.
184
-
185
- ```tsx
186
- window.addEventListener('keydown', (event) => {
187
- // oxlint-disable-next-line tds/no-single-key-shortcuts -- Settings turn this shortcut off.
188
- if (shortcuts.enabled && event.key === '/') open()
189
- })
190
- ```
191
-
192
- **Do:** Require Command or Control, and show the shortcut with [Kbd](../components/kbd.md).
193
-
194
- ````tsx
195
- ```tsx
196
- window.addEventListener('keydown', (event) => {
197
- if (event.key === 'k' && (event.metaKey || event.ctrlKey)) open()
198
- })
199
- ```
200
- ````
201
-
202
- **Don't:** Bind a lone character key on the whole page, unless people can turn it off or remap it.
203
-
204
- ````tsx
205
- ```tsx
206
- window.addEventListener('keydown', (event) => {
207
- if (event.key === '/') open()
208
- // @lint: tds/no-single-key-shortcuts: '/' is a single-key shortcut on the whole page. Require a modifier, such as metaKey or ctrlKey, or let people turn it off or remap it (WCAG 2.1.4).
209
- })
210
- ```
211
- ````
212
-
213
- ### Prefer Library Components
214
-
215
- Warns on a native element that a library component replaces, such as a button, a checkbox, a dialog, a table, or a description list. The message links the docs page of the component. Elements in a render prop pass, and an allow list skips the elements you name.
216
-
217
- ```json
218
- { "rules": { "tds/prefer-component": ["warn", { "allow": ["table"] }] } }
219
- ```
220
-
221
- **Do:** Use [Checkbox](../components/checkbox.md) and [Button](../components/button.md), which bring Tempo states, focus rings, and motion.
222
-
223
- ````tsx
224
- ```tsx
225
- <Checkbox defaultChecked />
226
- <Button variant="secondary">Cancel</Button>
227
- ```
228
- ````
229
-
230
- **Don't:** Restyle a native control that the library already ships.
231
-
232
- ````tsx
233
- ```tsx
234
- <input defaultChecked type="checkbox" />
235
- // @lint: tds/prefer-component: Use 'Checkbox' from '@tempoxyz/ds' instead of <input>. See https://ds.tehq.dev/docs/components/checkbox
236
- <button type="button">Cancel</button>
237
- // @lint: tds/prefer-component: Use 'Button' from '@tempoxyz/ds' instead of <button>. See https://ds.tehq.dev/docs/components/button
238
- ```
239
- ````
240
-
241
- ### Use Surface for Cards
242
-
243
- Warns on an article, aside, div, list item, or section whose styles draw a card: a corner radius and padding with a border or a background. Pills and positioned layers pass.
244
-
245
- ```json
246
- { "rules": { "tds/prefer-surface": "warn" } }
247
- ```
248
-
249
- **Do:** Use [Surface](../components/surface.md), which sets the radius and padding together.
250
-
251
- ````tsx
252
- ```tsx
253
- <Surface>
254
- <Surface.Title>Balance</Surface.Title>
255
- </Surface>
256
- ```
257
- ````
258
-
259
- **Don't:** Rebuild a card from tokens. The radius and padding drift apart.
260
-
261
- ````tsx
262
- ```tsx
263
- namespace styles {
264
- export const card = style({
265
- backgroundColor: 'background.elevated',
266
- borderRadius: 'sm',
267
- padding: '16',
268
- })
269
- }
270
-
271
- ;<div {...styles.card()} />
272
- // @lint: tds/prefer-surface: Use 'Surface' from '@tempoxyz/ds' instead of styling <div> as a card. It sets the radius and padding together.
273
- ```
274
- ````
275
-
276
- ### Use Layout Components
277
-
278
- Warns on a block element whose only styles lay out its children with flex or grid and a gap. A column maps to [Stack](../components/stack.md), a row to [Inline](../components/inline.md), and equal tracks to [Grid](../components/grid.md). An element with any other declaration or a class name passes.
279
-
280
- ```json
281
- { "rules": { "tds/prefer-layout": "warn" } }
282
- ```
283
-
284
- **Do:** Space siblings with a layout component and its gap token.
285
-
286
- ````tsx
287
- ```tsx
288
- <Stack gap="16">
289
- <Field.Root />
290
- <Field.Root />
291
- </Stack>
292
- ```
293
- ````
294
-
295
- **Don't:** Hand-build a flex or grid wrapper that a layout component replaces.
296
-
297
- ````tsx
298
- ```tsx
299
- <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
300
- // @lint: tds/prefer-layout: Use 'Stack' from '@tempoxyz/ds' instead of laying out <div> with flex and a gap.
301
- <Field.Root />
302
- <Field.Root />
303
- </div>
304
- ```
305
- ````
306
-
307
- ### Use Progress for Bars
308
-
309
- Warns on an empty div or span whose inline width is a computed percentage, which draws the fill of a hand-built bar. An element with children passes, since a resizable pane sets its width the same way.
310
-
311
- ```json
312
- { "rules": { "tds/prefer-progress": "warn" } }
313
- ```
314
-
315
- **Do:** Use [Progress](../components/progress.md), or `ListGroup.Meter` in a [ListGroup](../components/list-group.md) row, which announce the value.
316
-
317
- ````tsx
318
- ```tsx
319
- <Progress.Root value={66}>
320
- <Progress.Track>
321
- <Progress.Indicator />
322
- </Progress.Track>
323
- </Progress.Root>
324
- ```
325
- ````
326
-
327
- **Don't:** Draw a bar from a sized element. Screen readers announce nothing.
328
-
329
- ````tsx
330
- ```tsx
331
- <div {...styles.track()}>
332
- <div style={{ width: `${used}%` }} />
333
- // @lint: tds/prefer-progress: Use 'Progress' from '@tempoxyz/ds', or 'ListGroup.Meter' in a ListGroup row, instead of drawing a bar with <div> and a percentage width.
334
- </div>
335
- ```
336
- ````
337
-
338
- ### Set Type With a Typography Set
339
-
340
- Warns when one `style` or `variants` object sets two or more of `fontFamily`, `fontSize`, `fontWeight`, `letterSpacing`, and `lineHeight`, or one of them beside `typography`. These build a type style that no set defines. One property alone passes, such as a `fontSize` that sizes an icon.
341
-
342
- ```json
343
- { "rules": { "tds/prefer-typography": "warn" } }
344
- ```
345
-
346
- **Do:** Set type with one set, as [Typography](typography.md#set-type-with-one-set) describes.
347
-
348
- ````tsx
349
- ```tsx
350
- style({ color: 'content.secondary', typography: 'body.b2' })
351
- ```
352
- ````
353
-
354
- **Don't:** Combine a family and a size from different sets.
355
-
356
- ````tsx
357
- ```tsx
358
- style({ fontFamily: 'heading', fontSize: '14' })
359
- // @lint: tds/prefer-typography: 'fontFamily' composes a type style outside a typography set. Use one `typography` set, such as 'body.b2'.
360
- // @lint: tds/prefer-typography: 'fontSize' composes a type style outside a typography set. Use one `typography` set, such as 'body.b2'.
361
- ```
362
- ````
363
-
364
- ### Style With Tokens
365
-
366
- Warns on a raw color, length, or font family in an inline style. A value that reads a custom property passes.
367
-
368
- ```json
369
- { "rules": { "tds/no-raw-values": "warn" } }
370
- ```
371
-
372
- **Do:** Set colors and spacing with tokens in a `style` definition.
373
-
374
- ````tsx
375
- ```tsx
376
- namespace styles {
377
- export const card = style({ padding: '16' })
378
- }
379
-
380
- ;<div {...styles.card()} />
381
- ```
382
- ````
383
-
384
- **Don't:** Hardcode colors and lengths in inline styles. They do not follow the scheme or the token scale.
385
-
386
- ````tsx
387
- ```tsx
388
- <div style={{ color: '#000', padding: 16 }} />
389
- // @lint: tds/no-raw-values: 'color' sets the raw value '#000'. Use a token through a Zyzz style instead.
390
- // @lint: tds/no-raw-values: 'padding' sets the raw value 16. Use a token through a Zyzz style instead.
391
- ```
392
- ````
393
-
394
- ### Use Tokens for Custom Values
395
-
396
- Warns on a `!custom` value in a `style` or `variants` definition that equals a token: a px or rem length that equals a spacing, radius, size, or container step, or a `zIndex` number that equals a layer. The message names the token. A value that no token fits, such as `'13px !custom'`, passes.
397
-
398
- ```json
399
- { "rules": { "tds/no-custom-values": "warn" } }
400
- ```
401
-
402
- * **Spacing ('16'):** Padding, margins, and gaps, with keys in px.
403
- * **Radius ('xs'):** Corners, from `3xs` at 4px to `2xl` at 64px.
404
- * **Layers ('popover'):** `overlay` 40, `popover` 50, `modal` 60, and `toast` 1000.
405
-
406
- **Do:** Set lengths and layers with tokens.
407
-
408
- ````tsx
409
- ```tsx
410
- style({ borderRadius: 'xs', padding: '16', zIndex: 'popover' })
411
- ```
412
- ````
413
-
414
- **Don't:** Mark a value with `!custom` when a token equals it.
415
-
416
- ````tsx
417
- ```tsx
418
- style({ borderRadius: '12px !custom', zIndex: '50 !custom' })
419
- // @lint: tds/no-custom-values: 'borderRadius' sets the custom value '12px !custom', which equals a token. Use the radius token 'xs'.
420
- // @lint: tds/no-custom-values: 'zIndex' sets the custom value '50 !custom', which equals a token. Use the zIndex token 'popover'.
421
- ```
422
- ````
423
-
424
- ## Zyzz Rules
425
-
426
- Both configurations also turn on the rules of the Zyzz plugin, which check style definitions and their use.
427
-
428
- ### Merge Styling Props Into the Style
429
-
430
- Reports a className or style prop that would overwrite a style spread.
431
-
432
- ```json
433
- { "rules": { "zyzz/no-conflicting-props": "error" } }
434
- ```
435
-
436
- **Do:** Pass the caller's class into the style call, which merges it.
437
-
438
- ````tsx
439
- ```tsx
440
- <div {...styles.card({ className: props.className })} />
441
- ```
442
- ````
443
-
444
- **Don't:** Set a class beside a style spread. One overwrites the other.
445
-
446
- ````tsx
447
- ```tsx
448
- <div className="card" {...styles.card()} />
449
- // @lint: zyzz/no-conflicting-props: Pass 'className' into the Zyzz style call to merge styling props.
450
- ```
451
- ````
452
-
453
- ### Remove Unused Styles
454
-
455
- Warns on a style in a styles namespace that nothing applies.
456
-
457
- ```json
458
- { "rules": { "zyzz/no-unused": "warn" } }
459
- ```
460
-
461
- **Do:** Keep only the styles that the module applies.
462
-
463
- ````tsx
464
- ```tsx
465
- namespace styles {
466
- export const card = style({ padding: '16' })
467
- }
468
-
469
- ;<div {...styles.card()} />
470
- ```
471
- ````
472
-
473
- **Don't:** Leave a style that nothing applies. It still ships in the stylesheet.
474
-
475
- ````tsx
476
- ```tsx
477
- namespace styles {
478
- export const card = style({ padding: '16' })
479
-
480
- export const legacy = style({ padding: '8' })
481
- // @lint: zyzz/no-unused: Style 'styles.legacy' is never used.
482
- }
483
- ```
484
- ````
485
-
486
- ### Write Scalar Declarations
487
-
488
- Reports a declaration whose value is not a string, a number, or a fallback array.
489
-
490
- ```json
491
- { "rules": { "zyzz/valid-styles": "error" } }
492
- ```
493
-
494
- **Do:** Set each side with its own property.
495
-
496
- ````tsx
497
- ```tsx
498
- style({ paddingTop: '8' })
499
- ```
500
- ````
501
-
502
- **Don't:** Nest an object inside a declaration.
503
-
504
- ````tsx
505
- ```tsx
506
- style({ padding: { top: '8' } })
507
- // @lint: zyzz/valid-styles: CSS declarations require scalar values or fallback arrays.
508
- ```
509
- ````
510
-
511
- ## Related
512
-
513
- [Agents](agents.md)
514
-
515
- Covers the rules that coding agents follow and the checks they run.
516
-
517
- [Accessibility](accessibility.md)
518
-
519
- Covers the accessible names that the linter checks.
520
-
521
- [Getting Started](../introduction/getting-started.md)
522
-
523
- Covers the install and the Zyzz setup that the linter builds on.
@@ -1,151 +0,0 @@
1
- # Motion
2
-
3
- Easing curves, durations, and reduced-motion rules for state changes.
4
-
5
- ## Overview
6
-
7
- Motion in Tempo shows where something came from, confirms a press, and marks what is new. It is short, eases out, and never delays input, both in components and in anything you style yourself.
8
-
9
- ## Easing
10
-
11
- Three ease-out curves cover interface motion, so each response starts at full speed. Use them by name instead of the browser default or a custom curve.
12
-
13
- * `ease.snappy`: `cubic-bezier(0.23, 1, 0.32, 1)`
14
- * `ease.spring`: `cubic-bezier(0.32, 0.72, 0, 1)`
15
- * `ease.overshoot`: `cubic-bezier(0.34, 1.36, 0.64, 1)`
16
-
17
- * **Snappy (ease.snappy):** Short changes, such as hover, focus, presses, popovers, and menus.
18
- * **Overshoot (ease.overshoot):** Only physical feedback, such as switch thumbs and check marks. A dialog or menu would wobble.
19
- * **Spring (ease.spring):** Larger travel, such as dialogs, drawers, toasts, and tabs.
20
- * **Constant Rate (linear):** Continuous indicators only, such as [Spinner](../components/spinner.md), which would pulse with easing.
21
-
22
- ## Durations
23
-
24
- Small state changes finish fastest, overlays that travel farther run longer, and every overlay leaves faster than it enters.
25
-
26
- ### Micro Interactions
27
-
28
- * **Press (100ms in, 160ms out):** Buttons scale down slightly and return on release.
29
- * **Item Highlight (120ms):** Menu, select, and combobox items highlight.
30
- * **Hover, Focus, and Color (160ms):** Buttons, tabs, and checkboxes change color.
31
- * **Check Indicators (200ms):** Checkbox and radio indicators overshoot slightly.
32
- * **Switch Thumb (240ms):** The switch thumb slides with a slight overshoot.
33
- * **Selection Indicator (240ms):** The tabs indicator slides to the selected tab.
34
-
35
- ### Overlays and Content
36
-
37
- * **Tooltip (160ms in, 100ms out):** Tooltips fade in, and leave faster than they enter.
38
- * **Popover and Menu (200ms in, 140ms out):** Popovers and menus grow from their trigger.
39
- * **Select and Combobox List (240ms in, 150ms out):** Lists open on the spring curve and close on snappy.
40
- * **Expanding Content (240ms in, 180ms out):** Accordion panels expand and collapse.
41
- * **Dialog (280ms in, 180ms out):** Dialogs enter over a fading backdrop.
42
- * **Drawer and Toast (320ms in, 200 to 240ms out):** Drawers and toasts travel farthest and run longest.
43
-
44
- ## Guidelines
45
-
46
- ### Animate Every State Change
47
-
48
- Give every state change a transition, from hover and focus to checked, disabled, and invalid states. Animate overlays, toasts, expanding content, and changing values in and out.
49
-
50
- * **Press:** Scale the control to `scale.press` (0.98).
51
- * **Popover and Menu:** Fade and grow from `scale.enter` (0.96).
52
- * **Dialog and Drawer:** Fade the backdrop and slide or scale the panel.
53
- * **Value Change:** Fade or slide the new value in.
54
-
55
- ### Use Transitions for State, Keyframes for Feedback
56
-
57
- A transition reverses from its current point when the state flips back, so a quick hover in and out never jumps. Keep keyframes for feedback that plays once.
58
-
59
- * **State Changes (transition):** Hover, press, checked, and open states, such as the switch thumb.
60
- * **One-Shot Feedback (keyframes):** The 360ms nudge of an invalid [TextInput](../components/text-input.md) or [OtpField](../components/otp-field.md), and the 240ms pop of a [CopyButton](../components/copy-button.md) check.
61
-
62
- ### Animate Transform and Opacity
63
-
64
- Animate transforms, opacity, colors, shadows, and outlines, which change without a new layout. Animate size only when no transform produces the effect, as the components below do.
65
-
66
- **Do:** Scale a pressed control to `scale: 'press'` with `ease.snappy`.
67
-
68
- **Don't:** Animate `width`, `height`, or `margin` when a transform produces the same effect.
69
-
70
- * **Accordion (height):** Panels grow to a measured height, not a transform.
71
- * **SidebarMenu (height):** Nested items grow as a group expands.
72
- * **Progress (width):** The indicator grows and keeps its rounded ends.
73
- * **Tabs (size):** The indicator stretches to match each tab.
74
- * **Switch (width):** The pressed thumb stretches to keep its round ends.
75
- * **Toast (height):** Toasts shrink as their stack collapses.
76
-
77
- ### Never Delay Input
78
-
79
- Controls respond on the first frame of a press. Don't hold an action until an animation finishes, and don't block the next interaction during an exit animation.
80
-
81
- **Do:** Use short transitions that respond on the first frame, such as the library's press feedback.
82
-
83
- ```tsx
84
- <MotionDemo kind="press" />
85
- ```
86
-
87
- **Don't:** Make the reader wait for an animation to finish before they can act.
88
-
89
- ```tsx
90
- <MotionDemo kind="slow" />
91
- ```
92
-
93
- ## Authoring Motion
94
-
95
- Set each curve and duration by its token, and pair each transition with a reduced-motion override that removes movement and keeps color changes.
96
-
97
- ```tsx
98
- import { style } from '@tempoxyz/ds'
99
-
100
- namespace styles {
101
- export const row = style({
102
- transitionDuration: '160',
103
- transitionProperty: 'background-color, scale',
104
- transitionTimingFunction: 'snappy',
105
- selectors: {
106
- '&:active': { scale: 'press' },
107
- '&:hover': { backgroundColor: 'container.regular' },
108
- },
109
- '@media (prefers-reduced-motion: reduce)': {
110
- transitionProperty: 'background-color',
111
- selectors: { '&:active': { scale: 'none !custom' } },
112
- },
113
- })
114
- }
115
- ```
116
-
117
- * **Durations (transitionDuration):** Name a duration in ms, such as `'160'`.
118
- * **Curves (transitionTimingFunction):** Name a curve, such as `'snappy'`.
119
- * **Keyframes (vars.ease):** A keyframe shorthand reads its curve from `vars`.
120
-
121
- ## Reduced Motion
122
-
123
- When the system asks for reduced motion, components remove movement and scaling, and keep instant changes or brief opacity fades. Apply the same rule in your own styles, and honor Reduce Motion on iOS and Android.
124
-
125
- ### What Components Change
126
-
127
- * **Pressable Controls:** Buttons, surfaces, and other pressable controls stop scaling and keep their color transitions.
128
- * **Overlays:** Popovers, menus, dialogs, and toasts fade in place, including the narrow-screen dialog sheet.
129
- * **Moving Indicators:** The tabs indicator and the switch thumb jump straight to their final position.
130
- * **Loading Indicators:** Spinners stop rotating, skeletons stop their sweep, and loading dots stop pulsing.
131
- * **Feedback:** [CopyButton](../components/copy-button.md) skips its pop, and invalid fields skip their nudge.
132
-
133
- ## Accessibility
134
-
135
- [Accessibility](accessibility.md#motion) sets the limits for flashing and for content that moves on its own.
136
-
137
- * **Never Motion Alone (Field.Error):** Never convey information through motion alone. Pair a nudge on an invalid field with an error message.
138
-
139
- ## Related
140
-
141
- [Loading](../patterns/loading.md)
142
-
143
- Covers spinners, skeletons, and progress.
144
-
145
- [Feedback and Status](../patterns/feedback-and-status.md)
146
-
147
- Covers toasts and confirmations.
148
-
149
- [Accessibility](accessibility.md)
150
-
151
- Covers reduced motion and other preferences.