@tempoxyz/ds 0.3.13 → 0.3.14

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 (131) hide show
  1. package/dist/docs/AGENTS.md +7 -1
  2. package/dist/docs/product/components/button.md +1 -1
  3. package/dist/docs/product/components/table.md +1 -0
  4. package/dist/docs/product/foundations/agents.md +10 -1
  5. package/dist/docs/product/foundations/linter.md +27 -0
  6. package/dist/docs/product/foundations/typography.md +89 -24
  7. package/dist/docs/product/patterns/forms.md +1 -1
  8. package/dist/docs/product/patterns/tables-and-lists.md +206 -0
  9. package/dist/docs/product/products/tempo-performance.md +3 -5
  10. package/dist/oxlint/index.d.ts.map +1 -1
  11. package/dist/oxlint/index.js +3 -0
  12. package/dist/oxlint/index.js.map +1 -1
  13. package/dist/oxlint/rules/PreferTypography.d.ts +11 -0
  14. package/dist/oxlint/rules/PreferTypography.d.ts.map +1 -0
  15. package/dist/oxlint/rules/PreferTypography.js +68 -0
  16. package/dist/oxlint/rules/PreferTypography.js.map +1 -0
  17. package/dist/web/components/Accordion.js.zyzz.json +1 -1
  18. package/dist/web/components/AddressCard.js.zyzz.json +1 -1
  19. package/dist/web/components/AgentLogo.js.zyzz.json +1 -1
  20. package/dist/web/components/Alert.js.zyzz.json +1 -1
  21. package/dist/web/components/AlertDialog.js.zyzz.json +1 -1
  22. package/dist/web/components/Amount.js.zyzz.json +1 -1
  23. package/dist/web/components/AmountInput.js.zyzz.json +1 -1
  24. package/dist/web/components/AppShell.js.zyzz.json +1 -1
  25. package/dist/web/components/AssetChip.js.zyzz.json +1 -1
  26. package/dist/web/components/Autocomplete.js.zyzz.json +1 -1
  27. package/dist/web/components/Avatar.js.zyzz.json +1 -1
  28. package/dist/web/components/Badge.js.zyzz.json +1 -1
  29. package/dist/web/components/BadgedLogo.js.zyzz.json +1 -1
  30. package/dist/web/components/Banner.js.zyzz.json +1 -1
  31. package/dist/web/components/BarChart.js.zyzz.json +1 -1
  32. package/dist/web/components/Breadcrumbs.js.zyzz.json +1 -1
  33. package/dist/web/components/Button.css +1 -1
  34. package/dist/web/components/Button.d.ts +21 -1
  35. package/dist/web/components/Button.d.ts.map +1 -1
  36. package/dist/web/components/Button.js +3 -2
  37. package/dist/web/components/Button.js.map +1 -1
  38. package/dist/web/components/Button.js.zyzz.json +1 -1
  39. package/dist/web/components/ButtonGroup.js.zyzz.json +1 -1
  40. package/dist/web/components/Calendar.js.zyzz.json +1 -1
  41. package/dist/web/components/Callout.js.zyzz.json +1 -1
  42. package/dist/web/components/Checkbox.js.zyzz.json +1 -1
  43. package/dist/web/components/CheckboxGroup.js.zyzz.json +1 -1
  44. package/dist/web/components/ChoiceGroup.js.zyzz.json +1 -1
  45. package/dist/web/components/Choicebox.js.zyzz.json +1 -1
  46. package/dist/web/components/Code.js.zyzz.json +1 -1
  47. package/dist/web/components/Combobox.js.zyzz.json +1 -1
  48. package/dist/web/components/Container.js.zyzz.json +1 -1
  49. package/dist/web/components/CopyButton.js.zyzz.json +1 -1
  50. package/dist/web/components/DatePicker.js.zyzz.json +1 -1
  51. package/dist/web/components/Dialog.js.zyzz.json +1 -1
  52. package/dist/web/components/Drawer.js.zyzz.json +1 -1
  53. package/dist/web/components/Empty.js.zyzz.json +1 -1
  54. package/dist/web/components/Field.js.zyzz.json +1 -1
  55. package/dist/web/components/Fieldset.js.zyzz.json +1 -1
  56. package/dist/web/components/Frame.js.zyzz.json +1 -1
  57. package/dist/web/components/Gauge.js.zyzz.json +1 -1
  58. package/dist/web/components/GetStartedVisual.js.zyzz.json +1 -1
  59. package/dist/web/components/Grid.js.zyzz.json +1 -1
  60. package/dist/web/components/HeroVisual.js.zyzz.json +1 -1
  61. package/dist/web/components/Hex.js.zyzz.json +1 -1
  62. package/dist/web/components/IconTile.js.zyzz.json +1 -1
  63. package/dist/web/components/Identicon.js.zyzz.json +1 -1
  64. package/dist/web/components/Inline.js.zyzz.json +1 -1
  65. package/dist/web/components/Inset.js.zyzz.json +1 -1
  66. package/dist/web/components/Kbd.js.zyzz.json +1 -1
  67. package/dist/web/components/ListGroup.js.zyzz.json +1 -1
  68. package/dist/web/components/LoadingDots.js.zyzz.json +1 -1
  69. package/dist/web/components/Menu.js.zyzz.json +1 -1
  70. package/dist/web/components/NativeSelect.js.zyzz.json +1 -1
  71. package/dist/web/components/NetworkLogo.js.zyzz.json +1 -1
  72. package/dist/web/components/NumberField.js.zyzz.json +1 -1
  73. package/dist/web/components/OtpField.js.zyzz.json +1 -1
  74. package/dist/web/components/Pagination.js.zyzz.json +1 -1
  75. package/dist/web/components/Popover.js.zyzz.json +1 -1
  76. package/dist/web/components/Progress.js.zyzz.json +1 -1
  77. package/dist/web/components/Qr.js.zyzz.json +1 -1
  78. package/dist/web/components/RadioGroup.js.zyzz.json +1 -1
  79. package/dist/web/components/SecretValue.js.zyzz.json +1 -1
  80. package/dist/web/components/Select.js.zyzz.json +1 -1
  81. package/dist/web/components/Separator.js.zyzz.json +1 -1
  82. package/dist/web/components/SidebarMenu.js.zyzz.json +1 -1
  83. package/dist/web/components/Skeleton.js.zyzz.json +1 -1
  84. package/dist/web/components/Slider.js.zyzz.json +1 -1
  85. package/dist/web/components/Snippet.js.zyzz.json +1 -1
  86. package/dist/web/components/Spinner.js.zyzz.json +1 -1
  87. package/dist/web/components/SplitBar.js.zyzz.json +1 -1
  88. package/dist/web/components/SplitButton.js.zyzz.json +1 -1
  89. package/dist/web/components/Stack.js.zyzz.json +1 -1
  90. package/dist/web/components/StatusChip.js.zyzz.json +1 -1
  91. package/dist/web/components/StatusIndicator.js.zyzz.json +1 -1
  92. package/dist/web/components/StatusRow.js.zyzz.json +1 -1
  93. package/dist/web/components/Stepper.js.zyzz.json +1 -1
  94. package/dist/web/components/SuccessHero.js.zyzz.json +1 -1
  95. package/dist/web/components/Surface.js.zyzz.json +1 -1
  96. package/dist/web/components/Switch.js.zyzz.json +1 -1
  97. package/dist/web/components/Table.js.zyzz.json +1 -1
  98. package/dist/web/components/Tabs.css +1 -1
  99. package/dist/web/components/Tabs.d.ts +9 -9
  100. package/dist/web/components/Tabs.js.map +1 -1
  101. package/dist/web/components/Tabs.js.zyzz.json +1 -1
  102. package/dist/web/components/TempoLogo.js.zyzz.json +1 -1
  103. package/dist/web/components/TextInput.js.zyzz.json +1 -1
  104. package/dist/web/components/Textarea.js.zyzz.json +1 -1
  105. package/dist/web/components/Toast.css +1 -1
  106. package/dist/web/components/Toast.js +5 -5
  107. package/dist/web/components/Toast.js.map +1 -1
  108. package/dist/web/components/Toast.js.zyzz.json +1 -1
  109. package/dist/web/components/Token.js.zyzz.json +1 -1
  110. package/dist/web/components/TokenLogo.js.zyzz.json +1 -1
  111. package/dist/web/components/Tooltip.js.zyzz.json +1 -1
  112. package/dist/web/components/VerificationCode.js.zyzz.json +1 -1
  113. package/dist/web/components/Visual.js.zyzz.json +1 -1
  114. package/dist/web/components/internal/Field.js.zyzz.json +1 -1
  115. package/dist/web/components/internal/InputGroup.js.zyzz.json +1 -1
  116. package/dist/web/components/internal/Listbox.js.zyzz.json +1 -1
  117. package/dist/web/components/internal/Streaks.js.zyzz.json +1 -1
  118. package/dist/web/index.js.zyzz.json +1 -1
  119. package/dist/web/vars.d.ts +5 -5
  120. package/dist/web/vars.d.ts.map +1 -1
  121. package/dist/web/vars.js.map +1 -1
  122. package/dist/web/vars.js.zyzz.json +1 -1
  123. package/dist/web/zyzz.config.d.ts +25 -25
  124. package/dist/web/zyzz.config.js.zyzz.json +1 -1
  125. package/package.json +1 -1
  126. package/src/oxlint/index.ts +3 -0
  127. package/src/oxlint/rules/PreferTypography.ts +72 -0
  128. package/src/web/components/Button.tsx +24 -6
  129. package/src/web/components/Tabs.tsx +9 -9
  130. package/src/web/components/Toast.tsx +2 -2
  131. package/src/web/vars.ts +9 -7
@@ -9,4 +9,10 @@ Tempo has two design systems, and this package ships both. Choose one by what yo
9
9
 
10
10
  An app uses one system. A marketing site does not import `@tempoxyz/ds`, and a product interface does not import `@tempoxyz/ds/marketing`.
11
11
 
12
- Each system's folder follows its sidebar on the site, with Introduction, Foundations, and Components sections. [index.md](index.md) lists every page with its description. Before you use a component, read its page in full. For Product, also read [Agents](product/foundations/agents.md), which states the rules that generated UI follows.
12
+ Each system's folder follows its sidebar on the site, with Introduction, Foundations, and Components sections. [index.md](index.md) lists every page with its description. Before you use a component, read its page in full.
13
+
14
+ For Product, also read these pages before you build a screen:
15
+
16
+ - **Rules:** [Agents](product/foundations/agents.md) states the rules that generated UI follows.
17
+ - **Type:** [Typography](product/foundations/typography.md) states which sets to use and how many on one screen.
18
+ - **Patterns:** The `product/patterns/` folder holds layouts that combine components, such as [Forms](product/patterns/forms.md) and [Tables and Lists](product/patterns/tables-and-lists.md). The sidebar does not list them, so read the ones a screen uses from [index.md](index.md).
@@ -200,7 +200,7 @@ namespace styles {
200
200
 
201
201
  ### Loading
202
202
 
203
- Set `loading` to disable the button and show a spinner before its label.
203
+ Set `loading` to disable the button and mark it busy. The label stays visible, with a spinner centered in the leading space before it. An icon-only button shows only the centered spinner.
204
204
 
205
205
  ```tsx
206
206
  import { Button, style } from '@tempoxyz/ds'
@@ -535,6 +535,7 @@ import { Table } from '@tempoxyz/ds'
535
535
  * Compare many records with the same fields, such as wallet activity (date, recipient, amount, status) or benchmark runs (commit, TPS, latency).
536
536
  * Let people scan a column or find one row among many.
537
537
  * List API keys, webhooks, or team members.
538
+ * Edit several records with the same fields in place, as [Edit Rows in Place](../patterns/tables-and-lists.md#edit-rows-in-place) describes.
538
539
 
539
540
  ### When Not to Use
540
541
 
@@ -74,6 +74,13 @@ These rules are requirements, and so are the Guidelines, Content, and Accessibil
74
74
  * **One Styling System:** Don't add utility classes or a separate stylesheet to UI built with the library.
75
75
  * **Variable Scopes:** Components inherit variables, so apply `vars()` only to override values or fix a color scheme.
76
76
 
77
+ ### Set Type With Few Sets
78
+
79
+ * **Component Type:** Let each component set the type of its parts. Pass text as children and don't restyle it.
80
+ * **One Set per Style (typography):** Set your own text with one `typography` set, never a separate family, size, or weight.
81
+ * **Few Sets per Screen:** Use at most five styles on a screen, and Pilat only for titles.
82
+ * **Expressive Sets:** Follow [Typography](typography.md#reserve-the-expressive-sets) before you use display, value, utility, or mono.
83
+
77
84
  ### Use Only Documented APIs
78
85
 
79
86
  * **Documented Props:** Use only the props, parts, and values that a component page or its TSDoc documents.
@@ -83,7 +90,7 @@ These rules are requirements, and so are the Guidelines, Content, and Accessibil
83
90
  ### Follow the Guidelines
84
91
 
85
92
  * **Whole Pages:** Read a component's whole page before you use it, not only its Examples section.
86
- * **Patterns:** Apply the foundations and patterns that fit, such as [Payments](../patterns/payments.md) and [Blockchain Values](../patterns/blockchain-values.md).
93
+ * **Patterns:** Before you build a screen, read the patterns it uses, such as [Forms](../patterns/forms.md) and [Tables and Lists](../patterns/tables-and-lists.md).
87
94
  * **Native Semantics:** Keep native semantics, and meet every item on the [Accessibility](accessibility.md#checklist) checklist.
88
95
 
89
96
  ### Write Copy to the Content Guidelines
@@ -111,6 +118,8 @@ Add instructions like these to your project's AGENTS.md or CLAUDE.md file, so ev
111
118
  - Treat each page's Guidelines, Content, and Accessibility sections as requirements.
112
119
  - Choose each component by what its content means, not by the markup it replaces. Read https://ds.tehq.dev/docs/foundations/intent.md before you port a screen.
113
120
  - Style with `style` and TDS tokens. Don't hardcode colors or spacing.
121
+ - Set text with one `typography` set, and let components set the type of their own parts. Use Pilat only for titles, and at most five styles on a screen. Read https://ds.tehq.dev/docs/foundations/typography.md before you style text.
122
+ - Read the pattern pages that a screen uses, such as https://ds.tehq.dev/docs/patterns/forms.md and https://ds.tehq.dev/docs/patterns/tables-and-lists.md.
114
123
  - Write interface copy with the Content foundations, such as Writing Style.
115
124
  ```
116
125
 
@@ -50,6 +50,7 @@ Without Vite Plus, register both plugins and enable the rules in an Oxlint confi
50
50
  "tds/prefer-layout": "warn",
51
51
  "tds/prefer-progress": "warn",
52
52
  "tds/prefer-surface": "warn",
53
+ "tds/prefer-typography": "warn",
53
54
  "tds/require-accessible-name": "error",
54
55
  "tds/require-scroll-region": "warn"
55
56
  }
@@ -334,6 +335,32 @@ Warns on an empty div or span whose inline width is a computed percentage, which
334
335
  ```
335
336
  ````
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
+
337
364
  ### Style With Tokens
338
365
 
339
366
  Warns on a raw color, length, or font family in an inline style. A value that reads a custom property passes.
@@ -4,7 +4,7 @@ Type sets for titles, body text, values, and code.
4
4
 
5
5
  ## Overview
6
6
 
7
- Type in Tempo is quiet and direct. Inter carries the interface, Pilat gives titles and large numbers their character, and JetBrains Mono keeps addresses and code legible.
7
+ Type in Tempo is quiet and direct. Inter carries the interface and its numbers, Pilat gives titles their character, and JetBrains Mono keeps addresses and code legible.
8
8
 
9
9
  Each set bundles a family, size, weight, line height, and tracking into one token, so you choose a role instead of tuning properties. A set keeps one size at every screen width.
10
10
 
@@ -22,8 +22,8 @@ namespace styles {
22
22
 
23
23
  Three bundled families cover every set.
24
24
 
25
- * **Inter (100 to 900):** Body text, labels, buttons, and table cells.
26
- * **Pilat (100 to 900):** Titles, display text, and large values.
25
+ * **Inter (100 to 900):** Body text, labels, buttons, table cells, and numbers.
26
+ * **Pilat (100 to 900):** Page, dialog, section, card, and hero titles only.
27
27
  * **JetBrains Mono (400 to 700):** Addresses, hashes, keys, and code.
28
28
 
29
29
  ## Type Sets
@@ -32,38 +32,38 @@ Six sets cover the interface, from hero titles down to small labels.
32
32
 
33
33
  ### Display
34
34
 
35
- Hero titles and large amounts, in light and regular weights that let size carry the emphasis. [Amount](../components/amount.md) uses display type at its largest size.
35
+ Hero titles in Pilat, in light and regular weights that let size carry the emphasis.
36
36
 
37
- * `display.d1`: 44px, weight 300, line height 41.8px
38
- * `display.d2`: 36px, weight 400, line height 34.2px
37
+ * `display.d1`: Pilat, 44px, weight 300, line height 41.8px
38
+ * `display.d2`: Pilat, 36px, weight 400, line height 34.2px
39
39
 
40
40
  ### Value
41
41
 
42
- Large readings, such as balances and dashboard numbers, with tight tracking so the digits read as one figure.
42
+ Large readings in Inter, such as a balance, with tight tracking so the digits read as one figure.
43
43
 
44
- * `value.v1`: 80px, weight 400, line height normal
45
- * `value.v2`: 52px, weight 400, line height normal
46
- * `value.v3`: 40px, weight 400, line height normal
44
+ * `value.v1`: Inter, 80px, weight 400, line height normal
45
+ * `value.v2`: Inter, 52px, weight 400, line height normal
46
+ * `value.v3`: Inter, 40px, weight 400, line height normal
47
47
 
48
48
  ### Heading
49
49
 
50
- Page, dialog, section, and card titles, in a medium weight. Tracking tightens as the size grows, so large titles stay compact.
50
+ Page, dialog, section, and card titles, in Pilat at a medium weight. Only the heading and display sets use Pilat. Tracking tightens as the size grows, so large titles stay compact.
51
51
 
52
- * `heading.h1`: 32px, weight 500, line height 36.8px
53
- * `heading.h2`: 24px, weight 500, line height 27.6px
54
- * `heading.h3`: 20px, weight 500, line height 23px
55
- * `heading.h4`: 18px, weight 500, line height 20.7px
52
+ * `heading.h1`: Pilat, 32px, weight 500, line height 36.8px
53
+ * `heading.h2`: Pilat, 24px, weight 500, line height 27.6px
54
+ * `heading.h3`: Pilat, 20px, weight 500, line height 23px
55
+ * `heading.h4`: Pilat, 18px, weight 500, line height 20.7px
56
56
 
57
57
  ### Body
58
58
 
59
59
  Paragraphs, descriptions, labels, buttons, and table cells, in a regular and a strong weight at each size.
60
60
 
61
- * `body.b1`: 16px, weight 400, line height 22px
62
- * `body.b1Strong`: 16px, weight 500, line height 22px
63
- * `body.b2`: 14px, weight 400, line height 20px
64
- * `body.b2Strong`: 14px, weight 500, line height 20px
65
- * `body.b3`: 12px, weight 400, line height 16px
66
- * `body.b3Strong`: 12px, weight 500, line height 16px
61
+ * `body.b1`: Inter, 16px, weight 400, line height 22px
62
+ * `body.b1Strong`: Inter, 16px, weight 500, line height 22px
63
+ * `body.b2`: Inter, 14px, weight 400, line height 20px
64
+ * `body.b2Strong`: Inter, 14px, weight 500, line height 20px
65
+ * `body.b3`: Inter, 12px, weight 400, line height 16px
66
+ * `body.b3Strong`: Inter, 12px, weight 500, line height 16px
67
67
 
68
68
  * **Weight (400 and 500):** Strong sets add emphasis without a larger size.
69
69
  * **Default (body.b1):** The page default, a size down on dense screens.
@@ -81,8 +81,8 @@ Addresses, hashes, keys, and code, in one size.
81
81
 
82
82
  Short metadata labels in the mono family, with wide tracking. The design sets them in uppercase, which a component applies itself, since the sets keep the text's case.
83
83
 
84
- * `utility.m1`: 12px, weight 400, line height 16px
85
- * `utility.m2`: 10px, weight 400, line height 12px
84
+ * `utility.m1`: JetBrains Mono, 12px, weight 400, line height 16px
85
+ * `utility.m2`: JetBrains Mono, 10px, weight 400, line height 12px
86
86
 
87
87
  * **Label (utility.m1):** Metadata labels above or beside a value.
88
88
  * **Small Label (utility.m2):** The smaller size, for labels in tight spaces.
@@ -128,7 +128,72 @@ Keep headings in order. Choose the element by its place in the outline and the s
128
128
  * **Wrapping Text (body):** Anything that can wrap.
129
129
  * **Labels (body.b2Strong):** Field labels and short lines beside controls.
130
130
  * **Titles (heading):** Page, dialog, section, and card titles.
131
- * **Hero Numbers (display and value):** Balances and dashboard readings.
131
+ * **Hero Numbers (value):** One balance or reading per screen, in Inter.
132
+
133
+ ### Reserve Pilat for Titles
134
+
135
+ Pilat sets titles only: page, dialog, section, and card titles in the heading sets, and hero titles in the display sets, from 18px up. Inter sets everything else, including labels, tabs, toasts, buttons, and numbers.
136
+
137
+ **Do:** Set the title in Pilat and the text below it in Inter.
138
+
139
+ ```tsx
140
+ <Surface.Title>Recent payments</Surface.Title>
141
+ <TypeDemo kind="body" />
142
+ ```
143
+
144
+ **Don't:** Set Pilat on labels, tabs, toasts, or numbers, or below 18px.
145
+
146
+ ```tsx
147
+ <Snippet size="small">{"fontFamily: 'heading'"}</Snippet>
148
+ ```
149
+
150
+ ### Use Five Styles per Screen
151
+
152
+ Dense screens, such as consoles and internal tools, use at most five styles. Add `mono.m1` as a sixth only where the screen shows hex values or code.
153
+
154
+ * **Page Title (heading.h2):** One per screen, in Pilat.
155
+ * **Section Title (heading.h3):** Sections, cards, and dialogs, in Pilat.
156
+ * **Body (body.b2):** Text, table cells, and descriptions.
157
+ * **Strong (body.b2Strong):** Labels, buttons, and emphasis.
158
+ * **Meta (body.b3):** Timestamps, hints, and secondary details.
159
+ * **Hex and Code (mono.m1):** The sixth style, only for hex values and code.
160
+
161
+ * **Families (2 per screen):** Inter and Pilat, plus mono only for hex and code.
162
+ * **Content Sizes (3 per screen):** Below the titles, use weight and color before size.
163
+
164
+ ### Let Components Set Their Type
165
+
166
+ Components set the type of their own parts, such as a field label, a table cell, or a button. Pass text as children, and don't restyle it.
167
+
168
+ * **Component Text (children):** Pass plain text. The component applies its set and color.
169
+ * **Your Own Text (typography):** Choose a set by role, from the five styles above.
170
+
171
+ ### Set Type With One Set
172
+
173
+ Set your own text with one `typography` set. Don't combine a family, size, or weight from different sets, which renders a style that the designs don't define. The [Linter](linter.md#set-type-with-a-typography-set) reports these.
174
+
175
+ **Do:** Set the role as one set.
176
+
177
+ ```tsx
178
+ <Snippet size="small" style={{ width: 240 }}>
179
+ {"typography: 'body.b2'"}
180
+ </Snippet>
181
+ ```
182
+
183
+ **Don't:** Build or adjust a style with separate type properties.
184
+
185
+ ```tsx
186
+ <Snippet size="small" style={{ width: 240 }}>
187
+ {"fontWeight: '600 !custom'"}
188
+ </Snippet>
189
+ ```
190
+
191
+ ### Reserve the Expressive Sets
192
+
193
+ * **Display (display):** One hero title per screen, in Pilat. Never in cards, tables, or dialogs.
194
+ * **Value (value):** One headline reading per screen, in Inter. Not for a row of metrics.
195
+ * **Utility (utility):** A metadata label above a value. No other text uses all caps.
196
+ * **Mono (mono):** Hex values and code only. Not for numbers, amounts, dates, or labels.
132
197
 
133
198
  ### Use Tabular Figures for Numbers
134
199
 
@@ -229,7 +229,7 @@ This reference layout uses [Surface](../components/surface.md), [Frame](../compo
229
229
 
230
230
  ### Use One Column
231
231
 
232
- Stack fields in a single column, in the order a person expects, such as recipient, then amount, then memo. Put two fields on one row only if they form one short value, such as a month and a year.
232
+ Stack fields in a single column, in the order a person expects, such as recipient, then amount, then memo. Put two fields on one row only if they form one short value, such as a month and a year. If people enter several records with the same fields, such as batch payout recipients, use an [editable table](tables-and-lists.md#edit-rows-in-place).
233
233
 
234
234
  **Do:** Stack fields in one column, in the order you answer them.
235
235
 
@@ -524,6 +524,208 @@ namespace styles {
524
524
 
525
525
  Confirm a destructive bulk action in an [AlertDialog](../components/alert-dialog.md) that names the count, such as Cancel 2 payouts, as [Destructive Actions](destructive-actions.md) describes.
526
526
 
527
+ ## Edit Rows in Place
528
+
529
+ If people enter or change several records with the same fields, such as the recipients of a batch payout, put the controls in the cells of a table. Change an amount in the example to show the error, or add and remove rows.
530
+
531
+ ```tsx
532
+ /** Reference layout of a table whose rows people edit in place, such as the recipients of a batch payout. @module */
533
+ import { Amount, Button, Field, Inset, style, Surface, Table, TextInput } from '@tempoxyz/ds'
534
+ import { Delete, Plus } from '@tempoxyz/ds/icons'
535
+ import { useState } from 'react'
536
+
537
+ export const fill = true
538
+ type Row = { amount: string; id: number; recipient: string }
539
+
540
+ const initial: readonly Row[] = [
541
+ { amount: '1200.00', id: 1, recipient: 'ada.tempo' },
542
+ { amount: '48.5x', id: 2, recipient: 'grace.tempo' },
543
+ { amount: '310.00', id: 3, recipient: 'alan.tempo' },
544
+ ]
545
+
546
+ function valid(amount: string) {
547
+ return /^\d+(?:\.\d{1,2})?$/.test(amount) && Number(amount) > 0
548
+ }
549
+
550
+ export function Demo() {
551
+ const [next, setNext] = useState(initial.length + 1)
552
+ const [rows, setRows] = useState<readonly Row[]>(initial)
553
+
554
+ const total = rows
555
+ .filter((row) => valid(row.amount))
556
+ .reduce((sum, row) => sum + Number(row.amount), 0)
557
+
558
+ function update(id: number, field: 'amount' | 'recipient', value: string) {
559
+ setRows((current) => current.map((row) => (row.id === id ? { ...row, [field]: value } : row)))
560
+ }
561
+
562
+ return (
563
+ <Inset aria-label="Batch payout" role="region" space="16" tabIndex={0} {...styles.region()}>
564
+ <Surface {...styles.surface()}>
565
+ <Surface.Header>
566
+ <Surface.Title id="batch-title">Batch payout</Surface.Title>
567
+ <Button
568
+ onClick={() => {
569
+ setRows((current) => [...current, { amount: '', id: next, recipient: '' }])
570
+ setNext(next + 1)
571
+ }}
572
+ size="small"
573
+ variant="secondary"
574
+ >
575
+ <Plus />
576
+ Add recipient
577
+ </Button>
578
+ </Surface.Header>
579
+ <Table.Root aria-labelledby="batch-title" size="large">
580
+ <Table.Head>
581
+ <Table.Row>
582
+ <Table.HeaderCell id="batch-recipient">Recipient</Table.HeaderCell>
583
+ <Table.HeaderCell id="batch-amount">Amount</Table.HeaderCell>
584
+ <Table.HeaderCell {...styles.action()}>
585
+ <span {...styles.hidden()}>Actions</span>
586
+ </Table.HeaderCell>
587
+ </Table.Row>
588
+ </Table.Head>
589
+ <Table.Body>
590
+ {rows.map((row, index) => {
591
+ const invalid = row.amount !== '' && !valid(row.amount)
592
+
593
+ return (
594
+ <Table.Row key={row.id}>
595
+ <Table.Cell {...styles.top()}>
596
+ <Field.Root>
597
+ <TextInput.Group>
598
+ <TextInput.Control
599
+ aria-label={`Recipient, row ${index + 1}`}
600
+ autoComplete="off"
601
+ onValueChange={(value) => update(row.id, 'recipient', value)}
602
+ placeholder="name.tempo or 0x…"
603
+ value={row.recipient}
604
+ />
605
+ </TextInput.Group>
606
+ </Field.Root>
607
+ </Table.Cell>
608
+ <Table.Cell {...styles.top()}>
609
+ <Field.Root invalid={invalid}>
610
+ <TextInput.Group>
611
+ <TextInput.Control
612
+ aria-label={`Amount, row ${index + 1}`}
613
+ inputMode="decimal"
614
+ onValueChange={(value) => update(row.id, 'amount', value)}
615
+ placeholder="0.00"
616
+ value={row.amount}
617
+ />
618
+ <TextInput.Suffix>USDC</TextInput.Suffix>
619
+ </TextInput.Group>
620
+ <Field.Error match={invalid}>Enter an amount, such as 25.00.</Field.Error>
621
+ </Field.Root>
622
+ </Table.Cell>
623
+ <Table.Cell {...styles.remove()}>
624
+ <Button
625
+ aria-label={`Remove row ${index + 1}`}
626
+ disabled={rows.length === 1}
627
+ onClick={() =>
628
+ setRows((current) => current.filter((item) => item.id !== row.id))
629
+ }
630
+ shape="icon"
631
+ size="small"
632
+ variant="tertiary"
633
+ >
634
+ <Delete />
635
+ </Button>
636
+ </Table.Cell>
637
+ </Table.Row>
638
+ )
639
+ })}
640
+ </Table.Body>
641
+ </Table.Root>
642
+ <div {...styles.total()}>
643
+ <span>Total</span>
644
+ <Amount align="right" symbol="USDC" value={total.toFixed(2)} />
645
+ </div>
646
+ </Surface>
647
+ </Inset>
648
+ )
649
+ }
650
+
651
+ namespace styles {
652
+ export const action = style({ width: '1px !custom' })
653
+
654
+ export const hidden = style({
655
+ clipPath: 'inset(50%) !custom',
656
+ height: '1px !custom',
657
+ overflow: 'hidden',
658
+ position: 'absolute',
659
+ whiteSpace: 'nowrap',
660
+ width: '1px !custom',
661
+ })
662
+
663
+ export const region = style({ backgroundColor: 'background.primary', overflowX: 'auto' })
664
+
665
+ export const remove = style({ verticalAlign: 'top', width: '1px !custom' })
666
+
667
+ export const surface = style({ minWidth: '36rem !custom' })
668
+
669
+ export const top = style({ verticalAlign: 'top' })
670
+
671
+ export const total = style({
672
+ alignItems: 'center',
673
+ color: 'content.primary',
674
+ display: 'flex',
675
+ justifyContent: 'space-between',
676
+ paddingBlockStart: '12',
677
+ typography: 'body.b2Strong',
678
+ })
679
+ }
680
+ ```
681
+
682
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Patterns/TablesEditable.tsx)
683
+
684
+ * **Row Height (large):** Use the large table, whose rows hold a medium field without a change in height.
685
+ * **Header as Label (aria-label):** The column header is the visible label. Name each control by its column and row.
686
+ * **Errors in the Cell (Field.Error):** Wrap each control in a Field, and show its error below the control in the same cell.
687
+ * **Rows and Totals:** Add rows from the header. Remove each row with a named icon button. Show totals below.
688
+
689
+ **Do:** Keep the controls and type of the library, and let the header label the column.
690
+
691
+ ```tsx
692
+ <Table.Root size="large" style={{ width: 280 }}>
693
+ <Table.Head>
694
+ <Table.Row>
695
+ <Table.HeaderCell>Recipient</Table.HeaderCell>
696
+ <Table.HeaderCell>Amount</Table.HeaderCell>
697
+ </Table.Row>
698
+ </Table.Head>
699
+ <Table.Body>
700
+ <Table.Row>
701
+ <Table.Cell>
702
+ <TextInput.Group>
703
+ <TextInput.Control aria-label="Recipient, row 1" defaultValue="ada.tempo" />
704
+ </TextInput.Group>
705
+ </Table.Cell>
706
+ <Table.Cell>
707
+ <TextInput.Group>
708
+ <TextInput.Control aria-label="Amount, row 1" defaultValue="25.00" />
709
+ </TextInput.Group>
710
+ </Table.Cell>
711
+ </Table.Row>
712
+ </Table.Body>
713
+ </Table.Root>
714
+ ```
715
+
716
+ **Don't:** Build a grid of native inputs with hand-styled headers in a new type set.
717
+
718
+ ```tsx
719
+ <div style={{ display: 'grid', gap: 8, gridTemplateColumns: '1fr 1fr', width: 280 }}>
720
+ <strong>RECIPIENT</strong>
721
+ <strong>AMOUNT</strong>
722
+ <input aria-label="Recipient, row 1" defaultValue="ada.tempo" />
723
+ <input aria-label="Amount, row 1" defaultValue="25.00" />
724
+ </div>
725
+ ```
726
+
727
+ Use an editable table only for repeated records. For the fields of one record, use one column of fields, as [Forms](forms.md) describes. If a row needs more than three or four controls, edit it in a [Dialog](../components/dialog.md) or a [Drawer](../components/drawer.md) instead.
728
+
527
729
  ## Sort Columns
528
730
 
529
731
  [Table](../components/table.md) has no built-in sorting. Put a `button` inside each sortable `Table.HeaderCell`. Set `aria-sort` to `ascending` or `descending` on the sorted column.
@@ -959,6 +1161,10 @@ Covers skeletons and spinners.
959
1161
 
960
1162
  Covers first use and no results.
961
1163
 
1164
+ [Forms](forms.md)
1165
+
1166
+ Covers fields, labels, and errors in a form.
1167
+
962
1168
  [Destructive Actions](destructive-actions.md)
963
1169
 
964
1170
  Covers confirming bulk actions.
@@ -286,11 +286,10 @@ namespace styles {
286
286
  alignItems: 'baseline',
287
287
  columnGap: '8',
288
288
  display: 'flex',
289
- fontFamily: 'mono',
290
- fontSize: '36',
291
289
  fontVariantNumeric: 'tabular-nums !custom',
292
290
  margin: '0',
293
291
  marginBlock: '8',
292
+ typography: 'value.v3',
294
293
  })
295
294
 
296
295
  export const label = style({
@@ -329,14 +328,13 @@ namespace styles {
329
328
 
330
329
  export const title = style({ margin: '0', typography: 'heading.h3' })
331
330
 
332
- export const unit = style({ color: 'content.secondary', fontSize: '14' })
331
+ export const unit = style({ color: 'content.secondary', typography: 'body.b2' })
333
332
 
334
333
  export const value = style({
335
- fontFamily: 'mono',
336
- fontSize: '24',
337
334
  fontVariantNumeric: 'tabular-nums !custom',
338
335
  margin: '0',
339
336
  marginBlockStart: '4',
337
+ typography: 'body.b1Strong',
340
338
  })
341
339
  }
342
340
  ```
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/oxlint/index.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAa7C,+BAA+B;AAC/B,MAAM,MAAM,QAAQ,GAA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ED;;;;;;;;;GASG;AACH,eAAO,MAAM,GAAG,EAAE,MAiBjB,CAAA;AAED,kHAAkH;AAClH,QAAA,MAAM,MAAM,EAAE,MAgBb,CAAA;eAEc,MAAM"}
@@ -7,6 +7,7 @@ import * as PreferComponent from './rules/PreferComponent.js';
7
7
  import * as PreferLayout from './rules/PreferLayout.js';
8
8
  import * as PreferProgress from './rules/PreferProgress.js';
9
9
  import * as PreferSurface from './rules/PreferSurface.js';
10
+ import * as PreferTypography from './rules/PreferTypography.js';
10
11
  import * as RequireAccessibleName from './rules/RequireAccessibleName.js';
11
12
  import * as RequireScrollRegion from './rules/RequireScrollRegion.js';
12
13
  const plugins = [
@@ -80,6 +81,7 @@ export const web = {
80
81
  'tds/prefer-layout': 'warn',
81
82
  'tds/prefer-progress': 'warn',
82
83
  'tds/prefer-surface': 'warn',
84
+ 'tds/prefer-typography': 'warn',
83
85
  'tds/require-accessible-name': 'error',
84
86
  'tds/require-scroll-region': 'warn',
85
87
  ...zyzz,
@@ -98,6 +100,7 @@ const plugin = {
98
100
  'prefer-layout': PreferLayout.rule,
99
101
  'prefer-progress': PreferProgress.rule,
100
102
  'prefer-surface': PreferSurface.rule,
103
+ 'prefer-typography': PreferTypography.rule,
101
104
  'require-accessible-name': RequireAccessibleName.rule,
102
105
  'require-scroll-region': RequireScrollRegion.rule,
103
106
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/oxlint/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAA;AAC3D,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAA;AAC3D,OAAO,KAAK,iBAAiB,MAAM,8BAA8B,CAAA;AACjE,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,oBAAoB,MAAM,iCAAiC,CAAA;AACvE,OAAO,KAAK,eAAe,MAAM,4BAA4B,CAAA;AAC7D,OAAO,KAAK,YAAY,MAAM,yBAAyB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,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACrD,sBAAsB,EAAE,MAAM;QAC9B,yBAAyB,EAAE,OAAO;QAClC,mBAAmB,EAAE,MAAM;QAC3B,6BAA6B,EAAE,MAAM;QACrC,sBAAsB,EAAE,MAAM;QAC9B,mBAAmB,EAAE,MAAM;QAC3B,qBAAqB,EAAE,MAAM;QAC7B,oBAAoB,EAAE,MAAM;QAC5B,uBAAuB,EAAE,MAAM;QAC/B,6BAA6B,EAAE,OAAO;QACtC,2BAA2B,EAAE,MAAM;QACnC,GAAG,IAAI;KACR;CACF,CAAA;AAED,kHAAkH;AAClH,MAAM,MAAM,GAAW;IACrB,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;IACrB,KAAK,EAAE;QACL,kBAAkB,EAAE,cAAc,CAAC,IAAI;QACvC,kBAAkB,EAAE,cAAc,CAAC,IAAI;QACvC,qBAAqB,EAAE,iBAAiB,CAAC,IAAI;QAC7C,eAAe,EAAE,WAAW,CAAC,IAAI;QACjC,yBAAyB,EAAE,oBAAoB,CAAC,IAAI;QACpD,kBAAkB,EAAE,eAAe,CAAC,IAAI;QACxC,eAAe,EAAE,YAAY,CAAC,IAAI;QAClC,iBAAiB,EAAE,cAAc,CAAC,IAAI;QACtC,gBAAgB,EAAE,aAAa,CAAC,IAAI;QACpC,mBAAmB,EAAE,gBAAgB,CAAC,IAAI;QAC1C,yBAAyB,EAAE,qBAAqB,CAAC,IAAI;QACrD,uBAAuB,EAAE,mBAAmB,CAAC,IAAI;KAClD;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -0,0 +1,11 @@
1
+ /** Finds type styles that Zyzz definitions compose outside a `typography` set. @module */
2
+ import type { Rule } from '@oxlint/plugins';
3
+ /**
4
+ * Reports the type properties of one `style()` or `variants()` object when it sets two or more of
5
+ * `fontFamily`, `fontSize`, `fontWeight`, `letterSpacing`, and `lineHeight`, or one of them beside
6
+ * `typography`. Each composes a type style that no set defines. One property alone, such as a
7
+ * `fontSize` that sizes an icon or a mono `fontFamily` on inline code, passes, and so do `inherit`
8
+ * values, which reset native controls.
9
+ */
10
+ export declare const rule: Rule;
11
+ //# sourceMappingURL=PreferTypography.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreferTypography.d.ts","sourceRoot":"","sources":["../../../src/oxlint/rules/PreferTypography.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,KAAK,EAAU,IAAI,EAAE,MAAM,iBAAiB,CAAA;AASnD;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,IAsDlB,CAAA"}
@@ -0,0 +1,68 @@
1
+ import * as Docs from '../internal/Docs.js';
2
+ import * as Styles from '../internal/Styles.js';
3
+ // Properties that a typography set bundles.
4
+ const type = /^(?:fontFamily|fontSize|fontWeight|letterSpacing|lineHeight)$/;
5
+ const url = Docs.page('foundations/linter#set-type-with-a-typography-set');
6
+ /**
7
+ * Reports the type properties of one `style()` or `variants()` object when it sets two or more of
8
+ * `fontFamily`, `fontSize`, `fontWeight`, `letterSpacing`, and `lineHeight`, or one of them beside
9
+ * `typography`. Each composes a type style that no set defines. One property alone, such as a
10
+ * `fontSize` that sizes an icon or a mono `fontFamily` on inline code, passes, and so do `inherit`
11
+ * values, which reset native controls.
12
+ */
13
+ export const rule = {
14
+ meta: {
15
+ docs: { description: 'Set type with one `typography` set, not composed type properties.' },
16
+ messages: {
17
+ typography: "'{{property}}' composes a type style outside a typography set. Use one `typography` set, such as 'body.b2'. See {{url}}",
18
+ },
19
+ schema: [],
20
+ type: 'suggestion',
21
+ },
22
+ create(context) {
23
+ function check(object) {
24
+ const found = [];
25
+ let typography = false;
26
+ for (const property of object.properties) {
27
+ if (property.type !== 'Property')
28
+ continue;
29
+ if (property.value.type === 'ObjectExpression') {
30
+ check(property.value);
31
+ continue;
32
+ }
33
+ // Compound variants hold an array of `{ when, style }` objects.
34
+ if (property.value.type === 'ArrayExpression') {
35
+ for (const element of property.value.elements)
36
+ if (element?.type === 'ObjectExpression')
37
+ check(element);
38
+ continue;
39
+ }
40
+ const name = Styles.key(property);
41
+ if (name === 'typography')
42
+ typography = true;
43
+ if (name === undefined || Styles.text(property.value) === 'inherit')
44
+ continue;
45
+ if (type.test(name))
46
+ found.push(property);
47
+ }
48
+ if (found.length === 0 || (found.length === 1 && !typography))
49
+ return;
50
+ for (const property of found)
51
+ context.report({
52
+ data: { property: Styles.key(property) ?? '', url },
53
+ messageId: 'typography',
54
+ node: property,
55
+ });
56
+ }
57
+ return {
58
+ CallExpression(node) {
59
+ if (!Styles.helper(node.callee))
60
+ return;
61
+ for (const argument of node.arguments.slice(0, 1))
62
+ if (argument.type === 'ObjectExpression')
63
+ check(argument);
64
+ },
65
+ };
66
+ },
67
+ };
68
+ //# sourceMappingURL=PreferTypography.js.map