@wirecore/wirelayer-recipes 0.4.1 → 0.6.0

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 (166) hide show
  1. package/dist/app.js +2 -2
  2. package/dist/app.js.map +1 -1
  3. package/dist/button.js +8 -8
  4. package/dist/button.js.map +1 -1
  5. package/dist/card.d.ts +1 -1
  6. package/dist/card.js +1 -1
  7. package/dist/card.js.map +1 -1
  8. package/dist/control-ids.d.ts +10 -0
  9. package/dist/control-ids.d.ts.map +1 -0
  10. package/dist/control-ids.js +15 -0
  11. package/dist/control-ids.js.map +1 -0
  12. package/dist/data-table.d.ts +10 -0
  13. package/dist/data-table.d.ts.map +1 -1
  14. package/dist/data-table.js +16 -0
  15. package/dist/data-table.js.map +1 -1
  16. package/dist/data.d.ts +70 -0
  17. package/dist/data.d.ts.map +1 -1
  18. package/dist/data.js +20 -0
  19. package/dist/data.js.map +1 -1
  20. package/dist/dev.d.ts +5 -0
  21. package/dist/dev.d.ts.map +1 -1
  22. package/dist/dev.js +13 -0
  23. package/dist/dev.js.map +1 -1
  24. package/dist/extras.d.ts.map +1 -1
  25. package/dist/extras.js +7 -3
  26. package/dist/extras.js.map +1 -1
  27. package/dist/field.d.ts +9 -9
  28. package/dist/field.js +10 -10
  29. package/dist/field.js.map +1 -1
  30. package/dist/i18n.d.ts +1 -0
  31. package/dist/i18n.d.ts.map +1 -1
  32. package/dist/i18n.js +1 -0
  33. package/dist/i18n.js.map +1 -1
  34. package/dist/index.d.ts +6 -5
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +5 -4
  37. package/dist/index.js.map +1 -1
  38. package/dist/inputs.d.ts +51 -0
  39. package/dist/inputs.d.ts.map +1 -1
  40. package/dist/inputs.js +77 -40
  41. package/dist/inputs.js.map +1 -1
  42. package/dist/list-items.d.ts +21 -3
  43. package/dist/list-items.d.ts.map +1 -1
  44. package/dist/list-items.js +32 -6
  45. package/dist/list-items.js.map +1 -1
  46. package/dist/locales/ar.d.ts.map +1 -1
  47. package/dist/locales/ar.js +1 -0
  48. package/dist/locales/ar.js.map +1 -1
  49. package/dist/locales/cs.d.ts.map +1 -1
  50. package/dist/locales/cs.js +1 -0
  51. package/dist/locales/cs.js.map +1 -1
  52. package/dist/locales/de.d.ts +1 -0
  53. package/dist/locales/de.d.ts.map +1 -1
  54. package/dist/locales/de.js +1 -0
  55. package/dist/locales/de.js.map +1 -1
  56. package/dist/locales/es.d.ts.map +1 -1
  57. package/dist/locales/es.js +1 -0
  58. package/dist/locales/es.js.map +1 -1
  59. package/dist/locales/fr.d.ts.map +1 -1
  60. package/dist/locales/fr.js +1 -0
  61. package/dist/locales/fr.js.map +1 -1
  62. package/dist/locales/hu.d.ts.map +1 -1
  63. package/dist/locales/hu.js +1 -0
  64. package/dist/locales/hu.js.map +1 -1
  65. package/dist/locales/it.d.ts.map +1 -1
  66. package/dist/locales/it.js +1 -0
  67. package/dist/locales/it.js.map +1 -1
  68. package/dist/locales/lv.d.ts.map +1 -1
  69. package/dist/locales/lv.js +1 -0
  70. package/dist/locales/lv.js.map +1 -1
  71. package/dist/locales/nl.d.ts.map +1 -1
  72. package/dist/locales/nl.js +1 -0
  73. package/dist/locales/nl.js.map +1 -1
  74. package/dist/locales/pl.d.ts.map +1 -1
  75. package/dist/locales/pl.js +1 -0
  76. package/dist/locales/pl.js.map +1 -1
  77. package/dist/locales/pt-BR.d.ts.map +1 -1
  78. package/dist/locales/pt-BR.js +1 -0
  79. package/dist/locales/pt-BR.js.map +1 -1
  80. package/dist/locales/pt.d.ts.map +1 -1
  81. package/dist/locales/pt.js +1 -0
  82. package/dist/locales/pt.js.map +1 -1
  83. package/dist/locales/tr.d.ts.map +1 -1
  84. package/dist/locales/tr.js +1 -0
  85. package/dist/locales/tr.js.map +1 -1
  86. package/dist/media.d.ts +24 -0
  87. package/dist/media.d.ts.map +1 -1
  88. package/dist/media.js +15 -0
  89. package/dist/media.js.map +1 -1
  90. package/dist/native/charts.d.ts +3 -3
  91. package/dist/native/controls.d.ts +18 -0
  92. package/dist/native/controls.d.ts.map +1 -1
  93. package/dist/native/controls.js +4 -0
  94. package/dist/native/controls.js.map +1 -1
  95. package/dist/navigation.d.ts.map +1 -1
  96. package/dist/navigation.js +7 -3
  97. package/dist/navigation.js.map +1 -1
  98. package/dist/overlay.d.ts +39 -3
  99. package/dist/overlay.d.ts.map +1 -1
  100. package/dist/overlay.js +17 -8
  101. package/dist/overlay.js.map +1 -1
  102. package/dist/overrides.d.ts +27 -2
  103. package/dist/overrides.d.ts.map +1 -1
  104. package/dist/overrides.js +100 -11
  105. package/dist/overrides.js.map +1 -1
  106. package/dist/selection.d.ts.map +1 -1
  107. package/dist/selection.js +2 -1
  108. package/dist/selection.js.map +1 -1
  109. package/dist/sources/button.css +1 -1
  110. package/dist/sources/card.css +1 -1
  111. package/dist/sources/colorPicker.css +1 -1
  112. package/dist/sources/combobox.css +1 -1
  113. package/dist/sources/dataTable.css +1 -1
  114. package/dist/sources/datePicker.css +1 -1
  115. package/dist/sources/dialog.css +1 -1
  116. package/dist/sources/drawer.css +1 -1
  117. package/dist/sources/iconButton.css +1 -1
  118. package/dist/sources/input.css +1 -1
  119. package/dist/sources/multiSelect.css +1 -1
  120. package/dist/sources/nativeSelect.css +1 -1
  121. package/dist/sources/numberInput.css +1 -1
  122. package/dist/sources/passwordInput.css +1 -1
  123. package/dist/sources/segmentedControl.css +1 -1
  124. package/dist/sources/select.css +1 -1
  125. package/dist/sources/slider.css +1 -1
  126. package/dist/sources/tagsInput.css +1 -1
  127. package/dist/sources/textarea.css +1 -1
  128. package/dist/vite.d.ts +19 -0
  129. package/dist/vite.d.ts.map +1 -0
  130. package/dist/vite.js +161 -0
  131. package/dist/vite.js.map +1 -0
  132. package/dist/widgets.d.ts +3 -3
  133. package/package.json +15 -2
  134. package/src/app.ts +2 -2
  135. package/src/button.ts +8 -8
  136. package/src/card.ts +1 -1
  137. package/src/control-ids.ts +21 -0
  138. package/src/data-table.ts +27 -0
  139. package/src/data.ts +24 -0
  140. package/src/dev.ts +14 -0
  141. package/src/extras.ts +7 -3
  142. package/src/field.ts +10 -10
  143. package/src/i18n.ts +1 -0
  144. package/src/index.ts +11 -2
  145. package/src/inputs.ts +82 -40
  146. package/src/list-items.ts +45 -4
  147. package/src/locales/ar.ts +1 -0
  148. package/src/locales/cs.ts +1 -0
  149. package/src/locales/de.ts +1 -0
  150. package/src/locales/es.ts +1 -0
  151. package/src/locales/fr.ts +1 -0
  152. package/src/locales/hu.ts +1 -0
  153. package/src/locales/it.ts +1 -0
  154. package/src/locales/lv.ts +1 -0
  155. package/src/locales/nl.ts +1 -0
  156. package/src/locales/pl.ts +1 -0
  157. package/src/locales/pt-BR.ts +1 -0
  158. package/src/locales/pt.ts +1 -0
  159. package/src/locales/tr.ts +1 -0
  160. package/src/media.ts +15 -0
  161. package/src/native/controls.ts +4 -0
  162. package/src/navigation.ts +9 -3
  163. package/src/overlay.ts +17 -8
  164. package/src/overrides.ts +130 -15
  165. package/src/selection.ts +2 -1
  166. package/src/vite.ts +162 -0
package/src/button.ts CHANGED
@@ -158,13 +158,13 @@ export const button = tv({
158
158
  color: colorKeys,
159
159
  size: {
160
160
  xs: { base: 'h-6 gap-1 px-2.5 text-xs', icon: 'size-3' },
161
- sm: { base: 'h-8 gap-1 px-3 text-[13px]', icon: 'size-3.5' },
162
- md: { base: 'h-10 gap-1.5 px-4 text-sm', icon: 'size-4' },
163
- lg: { base: 'h-12 gap-2 px-5.5 text-[15px]', icon: 'size-[18px]' },
161
+ sm: { base: 'h-[var(--wc-control-h-sm,2rem)] gap-1 px-3 text-[13px]', icon: 'size-3.5' },
162
+ md: { base: 'h-[var(--wc-control-h-md,2.5rem)] gap-1.5 px-4 text-sm', icon: 'size-4' },
163
+ lg: { base: 'h-[var(--wc-control-h-lg,3rem)] gap-2 px-5.5 text-[15px]', icon: 'size-[18px]' },
164
164
  },
165
165
  shape: {
166
166
  pill: {},
167
- rounded: { base: 'rounded-lg' },
167
+ rounded: { base: 'rounded-[var(--wc-button-radius,0.5rem)]' },
168
168
  square: { base: 'rounded-none' },
169
169
  },
170
170
  /** Full width of its container */
@@ -225,13 +225,13 @@ export const iconButton = tv({
225
225
  color: colorKeys,
226
226
  size: {
227
227
  xs: { base: 'size-6', icon: 'size-3.5' },
228
- sm: { base: 'size-8', icon: 'size-3.5' },
229
- md: { base: 'size-10', icon: 'size-[18px]' },
230
- lg: { base: 'size-12', icon: 'size-5' },
228
+ sm: { base: 'size-[var(--wc-control-h-sm,2rem)]', icon: 'size-3.5' },
229
+ md: { base: 'size-[var(--wc-control-h-md,2.5rem)]', icon: 'size-[18px]' },
230
+ lg: { base: 'size-[var(--wc-control-h-lg,3rem)]', icon: 'size-5' },
231
231
  },
232
232
  shape: {
233
233
  pill: {},
234
- rounded: { base: 'rounded-lg' },
234
+ rounded: { base: 'rounded-[var(--wc-button-radius,0.5rem)]' },
235
235
  square: { base: 'rounded-none' },
236
236
  },
237
237
  },
package/src/card.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { tv } from './tv.js';
2
2
 
3
3
  export const card = tv({
4
- base: 'flex flex-col gap-2.5 rounded-card border border-line bg-card p-6',
4
+ base: 'flex flex-col gap-2.5 rounded-card border border-line bg-card p-[var(--wc-card-p,1.5rem)]',
5
5
  variants: {
6
6
  interactive: {
7
7
  true: [
@@ -0,0 +1,21 @@
1
+ // Own ids on Ark-based controls. Ark finds its parts by the ids it generates – an `id` attribute spread onto a part
2
+ // overwrites that id, and the machine loses the element (a Select list opened at the top left of the page). An own id
3
+ // therefore goes through Ark's `ids` option to the part a `<label for>` points to (trigger, input …).
4
+
5
+ export type ControlIds = Record<string, string | undefined>;
6
+
7
+ /**
8
+ * The props for an Ark root that put an own `id` on `part`. Ark replaces its `ids` as a whole, so `fieldIds` are the
9
+ * ones it would take from a surrounding Field (e.g. `{ label, hiddenSelect }` for a Select). Without an own id nothing
10
+ * is passed (Ark keeps its ids); `standalone` drops the Field's ids (a second control inside a Field).
11
+ */
12
+ export function controlIds(
13
+ id: string | undefined,
14
+ part: string,
15
+ fieldIds: ControlIds = {},
16
+ standalone = false
17
+ ): { ids?: ControlIds } {
18
+ const own = id ? { [part]: id } : {};
19
+ if (standalone) return { ids: own };
20
+ return id ? { ids: { ...fieldIds, ...own } } : {};
21
+ }
package/src/data-table.ts CHANGED
@@ -293,6 +293,20 @@ export function matchesColumnFilter(cell: DataTableCellFilterInput, filter: Data
293
293
  export const matchesSearch = (values: unknown[], search: string, locale?: string) =>
294
294
  !search || values.some((value) => fold(value, locale).includes(fold(search, locale)));
295
295
 
296
+ /** Whether the extra search text of a row (`rowKeywords`) contains the search – an empty search finds nothing here */
297
+ export const matchesRowKeywords = (
298
+ keywords: string | readonly string[] | null | undefined,
299
+ search: string,
300
+ locale?: string
301
+ ) =>
302
+ !!search &&
303
+ keywords !== null &&
304
+ keywords !== undefined &&
305
+ matchesSearch(typeof keywords === 'string' ? [keywords] : [...keywords], search, locale);
306
+
307
+ /** Whether two values of a controlled prop (sorting, filters, ids …) have the same content */
308
+ export const sameTableValue = (a: unknown, b: unknown) => a === b || listValueKey(a) === listValueKey(b);
309
+
296
310
  /**
297
311
  * The sorting after a click on a column header: ascending → descending → unsorted. With `add` (Shift+click in
298
312
  * the multiple mode) the column is added to the existing sorting instead of replacing it.
@@ -381,6 +395,19 @@ export interface DataTableState {
381
395
  expanded?: string[];
382
396
  selection?: string[];
383
397
  density?: 'sm' | 'md' | 'lg';
398
+ /** Whether the filter row is shown (`filterToggle`) */
399
+ showFilters?: boolean;
400
+ }
401
+
402
+ /** A part of the saved state, e.g. for `stateExclude` */
403
+ export type DataTableStateKey = keyof DataTableState;
404
+
405
+ /** The state without the excluded parts */
406
+ export function omitTableState(state: DataTableState, exclude: readonly DataTableStateKey[] = []): DataTableState {
407
+ if (!exclude.length) return state;
408
+ const kept = { ...state };
409
+ for (const key of exclude) delete kept[key];
410
+ return kept;
384
411
  }
385
412
 
386
413
  const storageOf = (kind: 'local' | 'session') => {
package/src/data.ts CHANGED
@@ -1,5 +1,16 @@
1
1
  import { popupMotion, tv } from './tv.js';
2
2
 
3
+ /** Where the DataTable puts its pagination row: rows per page at the start and pages at the end, or both together */
4
+ export type DataTablePaginatorAlign = 'between' | 'start' | 'center' | 'end';
5
+ /**
6
+ * The recipe value of `paginatorAlign` – prefixed, so the HTML classes do not clash with the column `align`
7
+ * (`.wc-data-table-paginator-start`)
8
+ */
9
+ export const paginatorAlignKey = (align: DataTablePaginatorAlign | undefined) =>
10
+ align && align !== 'between'
11
+ ? (`paginator${align[0]!.toUpperCase()}${align.slice(1)}` as `paginator${Capitalize<Exclude<DataTablePaginatorAlign, 'between'>>}`)
12
+ : undefined;
13
+
3
14
  // DataTable (@wirecore/wirelayer-vue/data-table, @wirecore/wirelayer-react/data-table) and virtualised lists.
4
15
 
5
16
  const focusRing = 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-fg';
@@ -211,6 +222,19 @@ export const dataTable = tv({
211
222
  footCell: 'border-e border-line last:border-e-0',
212
223
  },
213
224
  },
225
+ /** A border around the whole table (with or without `gridlines`) */
226
+ bordered: {
227
+ true: { table: 'border border-line' },
228
+ },
229
+ /**
230
+ * The pagination row, both parts together (without it: rows per page at the start, the pages at the end) –
231
+ * the values come from paginatorAlignKey()
232
+ */
233
+ paginatorAlign: {
234
+ paginatorStart: { footer: 'justify-start' },
235
+ paginatorCenter: { footer: 'justify-center' },
236
+ paginatorEnd: { footer: 'justify-end' },
237
+ },
214
238
  /** Every other row tinted */
215
239
  striped: {
216
240
  true: { row: 'even:bg-bg-2/60' },
package/src/dev.ts CHANGED
@@ -19,6 +19,20 @@ export function warnInDevelopment(message: string) {
19
19
  console.warn(`[WireLayer] ${message}`);
20
20
  }
21
21
 
22
+ /**
23
+ * Development only: warns when a `<label for>` points at a control that no label element can name – a date field of
24
+ * spin buttons, a slider, a group of stars … Such controls are named by a surrounding Field or an aria-label.
25
+ */
26
+ export function warnLabelFor(component: string, id: string | undefined) {
27
+ if (!id || typeof document === 'undefined' || !isDevelopment()) return;
28
+ const labels = document.querySelectorAll('label[for]');
29
+ if (![...labels].some((label) => (label as HTMLLabelElement).htmlFor === id)) return;
30
+ warnInDevelopment(
31
+ `<label for="${id}"> does not name the ${component}: a label element cannot point at it. Put a Field ` +
32
+ `around it (it links label, description and error) or give it an aria-label.`
33
+ );
34
+ }
35
+
22
36
  const checkedSources = new Set<string>();
23
37
 
24
38
  /**
package/src/extras.ts CHANGED
@@ -110,7 +110,7 @@ export const nativeSelect = tv({
110
110
  slots: {
111
111
  base: 'relative flex w-full',
112
112
  select: [
113
- 'h-10 w-full cursor-pointer appearance-none rounded-lg border border-line-strong bg-bg pe-9 ps-3 text-[15px] text-fg outline-none',
113
+ 'h-[var(--wc-control-h-md,2.5rem)] w-full cursor-pointer appearance-none rounded-[var(--wc-control-radius-md,0.5rem)] border border-line-strong bg-bg pe-9 ps-3 text-[length:var(--wc-control-text-md,15px)] text-fg outline-none',
114
114
  'transition-colors focus:border-primary motion-reduce:transition-none',
115
115
  'aria-[invalid=true]:border-danger disabled:cursor-not-allowed disabled:border-line disabled:bg-bg-2 disabled:text-muted',
116
116
  ],
@@ -118,9 +118,13 @@ export const nativeSelect = tv({
118
118
  },
119
119
  variants: {
120
120
  size: {
121
- sm: { select: 'h-8 rounded-md ps-2.5 text-[13px]' },
121
+ sm: {
122
+ select: 'h-[var(--wc-control-h-sm,2rem)] rounded-[var(--wc-control-radius-sm,0.375rem)] ps-2.5 text-[length:var(--wc-control-text-sm,13px)]',
123
+ },
122
124
  md: {},
123
- lg: { select: 'h-12 rounded-[10px] ps-4 text-base' },
125
+ lg: {
126
+ select: 'h-[var(--wc-control-h-lg,3rem)] rounded-[var(--wc-control-radius-lg,10px)] ps-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
127
+ },
124
128
  },
125
129
  },
126
130
  defaultVariants: {
package/src/field.ts CHANGED
@@ -44,24 +44,24 @@ export const input = tv({
44
44
  variants: {
45
45
  size: {
46
46
  sm: {
47
- base: 'h-8 rounded-md',
48
- control: 'px-2.5 text-[13px]',
47
+ base: 'h-[var(--wc-control-h-sm,2rem)] rounded-[var(--wc-control-radius-sm,0.375rem)]',
48
+ control: 'px-2.5 text-[length:var(--wc-control-text-sm,13px)]',
49
49
  icon: 'ms-2.5 size-3.5',
50
50
  statusIcon: 'me-2.5 size-3.5',
51
51
  spinner: 'me-2.5 size-3.5',
52
52
  clear: 'me-1 size-6',
53
53
  },
54
54
  md: {
55
- base: 'h-10 rounded-lg',
56
- control: 'px-3 text-[15px]',
55
+ base: 'h-[var(--wc-control-h-md,2.5rem)] rounded-[var(--wc-control-radius-md,0.5rem)]',
56
+ control: 'px-3 text-[length:var(--wc-control-text-md,15px)]',
57
57
  icon: 'ms-3 size-4',
58
58
  statusIcon: 'me-3 size-4',
59
59
  spinner: 'me-3 size-4',
60
60
  clear: 'me-1.5 size-6',
61
61
  },
62
62
  lg: {
63
- base: 'h-12 rounded-[10px]',
64
- control: 'px-4 text-base',
63
+ base: 'h-[var(--wc-control-h-lg,3rem)] rounded-[var(--wc-control-radius-lg,10px)]',
64
+ control: 'px-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
65
65
  icon: 'ms-4 size-[18px]',
66
66
  statusIcon: 'me-4 size-[18px]',
67
67
  spinner: 'me-4 size-[18px]',
@@ -92,14 +92,14 @@ export const input = tv({
92
92
 
93
93
  export const textarea = tv({
94
94
  base: [
95
- 'block w-full resize-y rounded-lg border border-line-strong bg-bg px-3 py-[9px] text-[15px] leading-normal text-fg',
95
+ 'block w-full resize-y rounded-[var(--wc-control-radius-md,0.5rem)] border border-line-strong bg-bg px-3 py-[9px] text-[length:var(--wc-control-text-md,15px)] leading-normal text-fg',
96
96
  'outline-none transition-colors placeholder:text-muted focus:border-primary motion-reduce:transition-none',
97
97
  ],
98
98
  variants: {
99
99
  size: {
100
- sm: 'rounded-md px-2.5 py-1.5 text-[13px]',
101
- md: 'rounded-lg px-3 py-[9px] text-[15px]',
102
- lg: 'rounded-[10px] px-4 py-3 text-base',
100
+ sm: 'rounded-[var(--wc-control-radius-sm,0.375rem)] px-2.5 py-1.5 text-[length:var(--wc-control-text-sm,13px)]',
101
+ md: 'rounded-[var(--wc-control-radius-md,0.5rem)] px-3 py-[9px] text-[length:var(--wc-control-text-md,15px)]',
102
+ lg: 'rounded-[var(--wc-control-radius-lg,10px)] px-4 py-3 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
103
103
  },
104
104
  invalid: {
105
105
  true: 'border-danger focus:border-danger',
package/src/i18n.ts CHANGED
@@ -563,6 +563,7 @@ const en: Translations = {
563
563
  exportAll: 'All rows',
564
564
  exportSelection: 'Selected rows',
565
565
  filterToggle: 'Show filters',
566
+ resetFilters: 'Reset filters',
566
567
  rowCount: (count) => (count === 1 ? '1 row' : `${count} rows`),
567
568
  filteredCount: (count) => `${count} filtered`,
568
569
  copy: (header, value) => `Copy ${value}, ${header}`,
package/src/index.ts CHANGED
@@ -23,7 +23,7 @@ export {
23
23
  type AuthValidationOptions,
24
24
  type AuthValues,
25
25
  } from './blocks.js';
26
- export { dataTable, virtualList } from './data.js';
26
+ export { dataTable, paginatorAlignKey, virtualList, type DataTablePaginatorAlign } from './data.js';
27
27
  export { breadcrumb } from './breadcrumb.js';
28
28
  export {
29
29
  button,
@@ -55,6 +55,7 @@ export { statusDot, type StatusDotStatus } from './status-dot.js';
55
55
  export { pagination, progress, select, sidebarNav, stepper, steps, tabs, type StepStatus } from './navigation.js';
56
56
  export {
57
57
  allListOptionsState,
58
+ checkListValues,
58
59
  filterListOptions,
59
60
  groupListOptions,
60
61
  indexListOptions,
@@ -537,6 +538,7 @@ export {
537
538
  matchesColumnFilter,
538
539
  matchesConstraint,
539
540
  matchesFilter,
541
+ matchesRowKeywords,
540
542
  matchesSearch,
541
543
  matchModeDefinition,
542
544
  matchModeLabel,
@@ -546,9 +548,11 @@ export {
546
548
  moveTreeRow,
547
549
  nextSorting,
548
550
  numberSummary,
551
+ omitTableState,
549
552
  printHtml,
550
553
  printTableHtml,
551
554
  saveTableState,
555
+ sameTableValue,
552
556
  toFilterRule,
553
557
  type ColumnBlock,
554
558
  type PrintCell,
@@ -563,6 +567,7 @@ export {
563
567
  type DataTableMatchModeDefinition,
564
568
  type DataTableSort,
565
569
  type DataTableState,
570
+ type DataTableStateKey,
566
571
  } from './data-table.js';
567
572
  export {
568
573
  fitColumnWidth,
@@ -663,11 +668,14 @@ export {
663
668
  withRecipeOverrides,
664
669
  type AnyRecipe,
665
670
  type RecipeClasses,
671
+ type RecipeCompoundClasses,
666
672
  type RecipeConfig,
667
673
  type RecipeName,
668
674
  type RecipeOverride,
669
675
  type RecipeOverrides,
670
676
  type RecipeSlot,
677
+ type RecipeVariantClasses,
678
+ type RecipeVariantName,
671
679
  } from './overrides.js';
672
680
  export {
673
681
  GAUGE_ARC,
@@ -830,7 +838,8 @@ export {
830
838
  type TrendDirection,
831
839
  type TrendTone,
832
840
  } from './format.js';
833
- export { checkRecipeSources, warnInDevelopment } from './dev.js';
841
+ export { checkRecipeSources, warnInDevelopment, warnLabelFor } from './dev.js';
842
+ export { controlIds, type ControlIds } from './control-ids.js';
834
843
  export {
835
844
  formatHotkey,
836
845
  formatHotkeyText,
package/src/inputs.ts CHANGED
@@ -7,12 +7,12 @@ import { tv } from './tv.js';
7
7
 
8
8
  /** The bordered box around a text control – like Input */
9
9
  const box = [
10
- 'flex w-full items-stretch overflow-hidden rounded-lg border border-line-strong bg-bg text-fg',
10
+ 'flex w-full items-stretch overflow-hidden rounded-[var(--wc-control-radius-md,0.5rem)] border border-line-strong bg-bg text-fg',
11
11
  'transition-colors motion-reduce:transition-none focus-within:border-primary',
12
12
  'data-invalid:border-danger data-disabled:cursor-not-allowed data-disabled:border-line data-disabled:bg-bg-2 data-disabled:text-muted',
13
13
  ];
14
14
  const boxInput =
15
- 'h-full min-w-0 flex-1 bg-transparent px-3 text-[15px] text-inherit outline-none placeholder:text-muted disabled:cursor-not-allowed';
15
+ 'h-full min-w-0 flex-1 bg-transparent px-3 text-[length:var(--wc-control-text-md,15px)] text-inherit outline-none placeholder:text-muted disabled:cursor-not-allowed';
16
16
  /** Square button inside the box (password toggle, calendar, clear) */
17
17
  const boxButton = [
18
18
  'flex w-10 shrink-0 cursor-pointer items-center justify-center text-muted transition-colors hover:text-fg motion-reduce:transition-none',
@@ -32,7 +32,7 @@ const boxSuccess = { true: { control: 'border-success focus-within:border-succes
32
32
  export const numberInput = tv({
33
33
  slots: {
34
34
  base: 'flex w-full flex-col',
35
- control: [...box, 'h-10'],
35
+ control: [...box, 'h-[var(--wc-control-h-md,2.5rem)]'],
36
36
  input: [boxInput, 'tabular-nums'],
37
37
  // Side by side, the full height: 24 × 24 px touch targets at least (WCAG 2.5.8)
38
38
  button: [
@@ -49,9 +49,17 @@ export const numberInput = tv({
49
49
  },
50
50
  variants: {
51
51
  size: {
52
- sm: { control: 'h-8 rounded-md', input: 'px-2.5 text-[13px]', button: 'w-8' },
52
+ sm: {
53
+ control: 'h-[var(--wc-control-h-sm,2rem)] rounded-[var(--wc-control-radius-sm,0.375rem)]',
54
+ input: 'px-2.5 text-[length:var(--wc-control-text-sm,13px)]',
55
+ button: 'w-8',
56
+ },
53
57
  md: {},
54
- lg: { control: 'h-12 rounded-[10px]', input: 'px-4 text-base', button: 'w-11' },
58
+ lg: {
59
+ control: 'h-[var(--wc-control-h-lg,3rem)] rounded-[var(--wc-control-radius-lg,10px)]',
60
+ input: 'px-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
61
+ button: 'w-11',
62
+ },
55
63
  },
56
64
  // Up above down at the end; the field is 48px high so both keep a 24px target (WCAG 2.5.8)
57
65
  stacked: {
@@ -67,7 +75,7 @@ export const numberInput = tv({
67
75
  export const passwordInput = tv({
68
76
  slots: {
69
77
  base: 'flex w-full flex-col',
70
- control: [...box, 'h-10'],
78
+ control: [...box, 'h-[var(--wc-control-h-md,2.5rem)]'],
71
79
  input: boxInput,
72
80
  toggle: boxButton,
73
81
  toggleIcon: 'size-4',
@@ -90,9 +98,17 @@ export const passwordInput = tv({
90
98
  },
91
99
  variants: {
92
100
  size: {
93
- sm: { control: 'h-8 rounded-md', input: 'px-2.5 text-[13px]', toggle: 'w-8' },
101
+ sm: {
102
+ control: 'h-[var(--wc-control-h-sm,2rem)] rounded-[var(--wc-control-radius-sm,0.375rem)]',
103
+ input: 'px-2.5 text-[length:var(--wc-control-text-sm,13px)]',
104
+ toggle: 'w-8',
105
+ },
94
106
  md: {},
95
- lg: { control: 'h-12 rounded-[10px]', input: 'px-4 text-base', toggle: 'w-12' },
107
+ lg: {
108
+ control: 'h-[var(--wc-control-h-lg,3rem)] rounded-[var(--wc-control-radius-lg,10px)]',
109
+ input: 'px-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
110
+ toggle: 'w-12',
111
+ },
96
112
  },
97
113
  success: boxSuccess,
98
114
  },
@@ -143,6 +159,14 @@ export const slider = tv({
143
159
  control: 'mb-6 data-[orientation=vertical]:mb-0 data-[orientation=vertical]:me-14',
144
160
  },
145
161
  },
162
+ /** The label for screen readers only (`hideLabel`) – it still names the thumbs; the value stays at the end */
163
+ hideLabel: {
164
+ true: { header: 'justify-end', label: 'sr-only' },
165
+ },
166
+ /** Neither label nor value visible: the header takes no room */
167
+ hideHeader: {
168
+ true: { header: 'sr-only' },
169
+ },
146
170
  },
147
171
  });
148
172
 
@@ -150,7 +174,7 @@ export const multiSelect = tv({
150
174
  slots: {
151
175
  base: 'flex w-full flex-col',
152
176
  trigger: [
153
- 'flex h-10 w-full cursor-pointer items-center justify-between gap-2.5 rounded-lg border border-line-strong bg-bg pe-2.5 ps-3 text-start text-[15px] text-fg',
177
+ 'flex h-[var(--wc-control-h-md,2.5rem)] w-full cursor-pointer items-center justify-between gap-2.5 rounded-[var(--wc-control-radius-md,0.5rem)] border border-line-strong bg-bg pe-2.5 ps-3 text-start text-[length:var(--wc-control-text-md,15px)] text-fg',
154
178
  'outline-none transition-colors motion-reduce:transition-none focus-visible:border-primary data-[state=open]:border-primary',
155
179
  'data-invalid:border-danger data-disabled:cursor-not-allowed data-disabled:border-line data-disabled:bg-bg-2 data-disabled:text-muted',
156
180
  ],
@@ -175,13 +199,13 @@ export const multiSelect = tv({
175
199
  /** Wraps trigger and clear button (clearable); with chips the bordered box around chips and trigger */
176
200
  control: 'relative flex',
177
201
  chipsControl: [
178
- 'relative flex min-h-10 w-full flex-wrap items-center gap-1 rounded-lg border border-line-strong bg-bg py-[5px] pe-2.5 ps-1.5 text-fg',
202
+ 'relative flex min-h-[var(--wc-control-h-md,2.5rem)] w-full flex-wrap items-center gap-1 rounded-[var(--wc-control-radius-md,0.5rem)] border border-line-strong bg-bg py-[5px] pe-2.5 ps-1.5 text-fg',
179
203
  'transition-colors motion-reduce:transition-none focus-within:border-primary data-[state=open]:border-primary',
180
204
  'data-invalid:border-danger data-disabled:cursor-not-allowed data-disabled:border-line data-disabled:bg-bg-2 data-disabled:text-muted',
181
205
  ],
182
206
  /** The trigger next to the chips: fills the rest of the row, no border of its own */
183
207
  chipsTrigger: [
184
- 'flex h-7 min-w-16 flex-1 cursor-pointer items-center justify-between gap-2.5 ps-1.5 text-start text-[15px] text-fg outline-none',
208
+ 'flex h-7 min-w-16 flex-1 cursor-pointer items-center justify-between gap-2.5 ps-1.5 text-start text-[length:var(--wc-control-text-md,15px)] text-fg outline-none',
185
209
  'data-disabled:cursor-not-allowed data-disabled:text-muted',
186
210
  ],
187
211
  chip: 'inline-flex h-7 max-w-full min-w-0 items-center gap-1 rounded-md bg-line pe-0.5 ps-2 text-sm text-fg',
@@ -213,15 +237,18 @@ export const multiSelect = tv({
213
237
  variants: {
214
238
  size: {
215
239
  sm: {
216
- trigger: 'h-8 rounded-md ps-2.5 pe-2 text-[13px]',
217
- chipsControl: 'min-h-8 rounded-md py-0.5',
218
- chipsTrigger: 'text-[13px]',
240
+ trigger:
241
+ 'h-[var(--wc-control-h-sm,2rem)] rounded-[var(--wc-control-radius-sm,0.375rem)] ps-2.5 pe-2 text-[length:var(--wc-control-text-sm,13px)]',
242
+ chipsControl:
243
+ 'min-h-[var(--wc-control-h-sm,2rem)] rounded-[var(--wc-control-radius-sm,0.375rem)] py-0.5',
244
+ chipsTrigger: 'text-[length:var(--wc-control-text-sm,13px)]',
219
245
  },
220
246
  md: {},
221
247
  lg: {
222
- trigger: 'h-12 rounded-[10px] ps-4 pe-3 text-base',
223
- chipsControl: 'min-h-12 rounded-[10px] py-[9px]',
224
- chipsTrigger: 'text-base',
248
+ trigger:
249
+ 'h-[var(--wc-control-h-lg,3rem)] rounded-[var(--wc-control-radius-lg,10px)] ps-4 pe-3 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
250
+ chipsControl: 'min-h-[var(--wc-control-h-lg,3rem)] rounded-[var(--wc-control-radius-lg,10px)] py-[9px]',
251
+ chipsTrigger: 'text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
225
252
  },
226
253
  },
227
254
  // Room for the clear button between value and arrow
@@ -237,7 +264,7 @@ export const multiSelect = tv({
237
264
  export const combobox = tv({
238
265
  slots: {
239
266
  base: 'flex w-full flex-col',
240
- control: [...box, 'h-10'],
267
+ control: [...box, 'h-[var(--wc-control-h-md,2.5rem)]'],
241
268
  input: boxInput,
242
269
  clear: [...boxButton, 'w-8'],
243
270
  clearIcon: 'size-3.5',
@@ -257,9 +284,18 @@ export const combobox = tv({
257
284
  },
258
285
  variants: {
259
286
  size: {
260
- sm: { control: 'h-8 rounded-md', input: 'px-2.5 text-[13px]', trigger: 'w-8', clear: 'w-7' },
287
+ sm: {
288
+ control: 'h-[var(--wc-control-h-sm,2rem)] rounded-[var(--wc-control-radius-sm,0.375rem)]',
289
+ input: 'px-2.5 text-[length:var(--wc-control-text-sm,13px)]',
290
+ trigger: 'w-8',
291
+ clear: 'w-7',
292
+ },
261
293
  md: {},
262
- lg: { control: 'h-12 rounded-[10px]', input: 'px-4 text-base', trigger: 'w-11' },
294
+ lg: {
295
+ control: 'h-[var(--wc-control-h-lg,3rem)] rounded-[var(--wc-control-radius-lg,10px)]',
296
+ input: 'px-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
297
+ trigger: 'w-11',
298
+ },
263
299
  },
264
300
  },
265
301
  defaultVariants: {
@@ -270,12 +306,15 @@ export const combobox = tv({
270
306
  export const datePicker = tv({
271
307
  slots: {
272
308
  base: 'flex w-full flex-col',
273
- control: [...box, 'h-10'],
309
+ control: [...box, 'h-[var(--wc-control-h-md,2.5rem)]'],
274
310
  // Segmented date field (DateInput): one spin button per part, separators come from the locale
275
- dateInput: 'flex min-w-0 flex-1 items-center px-3',
276
- // Holds one date, or start – end of a range, in a row
277
- dateControl: 'flex min-w-0 items-center',
278
- segments: 'flex items-center text-[15px]',
311
+ dateInput: 'relative flex min-w-0 flex-1 items-center px-3',
312
+ // Holds one date, or start – end of a range, in a row; invisible (still usable) while the placeholder shows
313
+ dateControl: 'flex min-w-0 items-center data-placeholder-shown:opacity-0',
314
+ /** Own placeholder of the empty field (`placeholder`) – gives way to the parts on focus */
315
+ placeholder:
316
+ 'absolute inset-0 flex cursor-text items-center overflow-hidden px-3 text-[length:var(--wc-control-text-md,15px)] whitespace-nowrap text-muted data-hidden:pointer-events-none data-hidden:opacity-0',
317
+ segments: 'flex items-center text-[length:var(--wc-control-text-md,15px)]',
279
318
  segment: [
280
319
  'rounded-sm px-px text-fg tabular-nums outline-none data-placeholder-shown:text-muted',
281
320
  // Tabular figures would make the separators as wide as a digit
@@ -361,7 +400,8 @@ export const datePicker = tv({
361
400
  'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-fg',
362
401
  ],
363
402
  /** Chosen dates as text in the field (selectionMode multiple), muted while empty */
364
- multiValue: 'min-w-0 flex-1 truncate px-3 text-[15px] data-placeholder:text-muted',
403
+ multiValue:
404
+ 'min-w-0 flex-1 truncate px-3 text-[length:var(--wc-control-text-md,15px)] data-placeholder:text-muted',
365
405
  /** Short zone name after the time (showTimeZone) */
366
406
  timeZone: 'shrink-0 self-center pe-1 text-xs text-muted',
367
407
  /** Narrow screens (responsive): the calendar as a sheet at the bottom over a backdrop */
@@ -369,32 +409,34 @@ export const datePicker = tv({
369
409
  backdrop: 'fixed inset-0 z-40 bg-black/40 motion-safe:animate-fade-in',
370
410
  /** QuarterPicker: typed quarter ("Q4 2026"), the year above the quarters, the quarters */
371
411
  textInput:
372
- 'h-full min-w-0 flex-1 bg-transparent px-3 text-[15px] text-inherit outline-none placeholder:text-muted disabled:cursor-not-allowed',
412
+ 'h-full min-w-0 flex-1 bg-transparent px-3 text-[length:var(--wc-control-text-md,15px)] text-inherit outline-none placeholder:text-muted disabled:cursor-not-allowed',
373
413
  yearLabel: 'text-sm font-semibold tabular-nums',
374
414
  quarterGrid: 'grid grid-cols-2 gap-1',
375
415
  /** DurationInput: unit after a part ("hr") */
376
- unit: 'px-1 text-[15px] text-muted',
416
+ unit: 'px-1 text-[length:var(--wc-control-text-md,15px)] text-muted',
377
417
  },
378
418
  variants: {
379
419
  size: {
380
420
  sm: {
381
- control: 'h-8 rounded-md',
421
+ control: 'h-[var(--wc-control-h-sm,2rem)] rounded-[var(--wc-control-radius-sm,0.375rem)]',
382
422
  dateInput: 'px-2.5',
383
- segments: 'text-[13px]',
384
- multiValue: 'px-2.5 text-[13px]',
385
- textInput: 'px-2.5 text-[13px]',
386
- unit: 'text-[13px]',
423
+ placeholder: 'px-2.5 text-[length:var(--wc-control-text-sm,13px)]',
424
+ segments: 'text-[length:var(--wc-control-text-sm,13px)]',
425
+ multiValue: 'px-2.5 text-[length:var(--wc-control-text-sm,13px)]',
426
+ textInput: 'px-2.5 text-[length:var(--wc-control-text-sm,13px)]',
427
+ unit: 'text-[length:var(--wc-control-text-sm,13px)]',
387
428
  trigger: 'w-8',
388
429
  clear: 'w-7',
389
430
  },
390
431
  md: {},
391
432
  lg: {
392
- control: 'h-12 rounded-[10px]',
433
+ control: 'h-[var(--wc-control-h-lg,3rem)] rounded-[var(--wc-control-radius-lg,10px)]',
393
434
  dateInput: 'px-4',
394
- segments: 'text-base',
395
- multiValue: 'px-4 text-base',
396
- textInput: 'px-4 text-base',
397
- unit: 'text-base',
435
+ placeholder: 'px-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
436
+ segments: 'text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
437
+ multiValue: 'px-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
438
+ textInput: 'px-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
439
+ unit: 'text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
398
440
  trigger: 'w-11',
399
441
  },
400
442
  },
@@ -625,9 +667,9 @@ export const knob = tv({
625
667
  export const colorPicker = tv({
626
668
  slots: {
627
669
  base: 'flex w-full flex-col',
628
- control: [...box, 'h-10'],
670
+ control: [...box, 'h-[var(--wc-control-h-md,2.5rem)]'],
629
671
  trigger: [
630
- 'flex min-w-0 flex-1 cursor-pointer items-center gap-2.5 px-3 text-start text-[15px] text-fg outline-none',
672
+ 'flex min-w-0 flex-1 cursor-pointer items-center gap-2.5 px-3 text-start text-[length:var(--wc-control-text-md,15px)] text-fg outline-none',
631
673
  'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-fg',
632
674
  ],
633
675
  swatch: 'size-5 shrink-0 rounded-md shadow-[inset_0_0_0_1px_rgba(0,0,0,.15)]',