@wirecore/wirelayer-recipes 0.5.0 → 0.7.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 (134) hide show
  1. package/dist/alert.d.ts +30 -0
  2. package/dist/alert.d.ts.map +1 -1
  3. package/dist/alert.js +8 -0
  4. package/dist/alert.js.map +1 -1
  5. package/dist/app.js +2 -2
  6. package/dist/app.js.map +1 -1
  7. package/dist/button.js +8 -8
  8. package/dist/button.js.map +1 -1
  9. package/dist/card.d.ts +1 -1
  10. package/dist/card.js +1 -1
  11. package/dist/card.js.map +1 -1
  12. package/dist/control-ids.d.ts +10 -0
  13. package/dist/control-ids.d.ts.map +1 -0
  14. package/dist/control-ids.js +15 -0
  15. package/dist/control-ids.js.map +1 -0
  16. package/dist/controls.d.ts +3 -3
  17. package/dist/data.d.ts +70 -0
  18. package/dist/data.d.ts.map +1 -1
  19. package/dist/data.js +20 -0
  20. package/dist/data.js.map +1 -1
  21. package/dist/dev.d.ts +5 -0
  22. package/dist/dev.d.ts.map +1 -1
  23. package/dist/dev.js +13 -0
  24. package/dist/dev.js.map +1 -1
  25. package/dist/editor.d.ts +3 -3
  26. package/dist/extras.d.ts.map +1 -1
  27. package/dist/extras.js +7 -3
  28. package/dist/extras.js.map +1 -1
  29. package/dist/field.d.ts +39 -9
  30. package/dist/field.d.ts.map +1 -1
  31. package/dist/field.js +18 -10
  32. package/dist/field.js.map +1 -1
  33. package/dist/filters.d.ts +3 -3
  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 +57 -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 +8 -0
  43. package/dist/list-items.d.ts.map +1 -1
  44. package/dist/list-items.js +16 -2
  45. package/dist/list-items.js.map +1 -1
  46. package/dist/media.d.ts +24 -0
  47. package/dist/media.d.ts.map +1 -1
  48. package/dist/media.js +15 -0
  49. package/dist/media.js.map +1 -1
  50. package/dist/native/controls.d.ts +18 -0
  51. package/dist/native/controls.d.ts.map +1 -1
  52. package/dist/native/controls.js +4 -0
  53. package/dist/native/controls.js.map +1 -1
  54. package/dist/native/data.d.ts +90 -0
  55. package/dist/native/data.d.ts.map +1 -1
  56. package/dist/native/data.js +23 -0
  57. package/dist/native/data.js.map +1 -1
  58. package/dist/native/display.d.ts +128 -32
  59. package/dist/native/display.d.ts.map +1 -1
  60. package/dist/native/display.js +27 -0
  61. package/dist/native/display.js.map +1 -1
  62. package/dist/native/form.d.ts +30 -0
  63. package/dist/native/form.d.ts.map +1 -1
  64. package/dist/native/form.js +8 -0
  65. package/dist/native/form.js.map +1 -1
  66. package/dist/native/overlay.d.ts +30 -0
  67. package/dist/native/overlay.d.ts.map +1 -1
  68. package/dist/native/overlay.js +10 -0
  69. package/dist/native/overlay.js.map +1 -1
  70. package/dist/native/widgets.d.ts +3 -3
  71. package/dist/navigation.d.ts +117 -3
  72. package/dist/navigation.d.ts.map +1 -1
  73. package/dist/navigation.js +64 -8
  74. package/dist/navigation.js.map +1 -1
  75. package/dist/overlay.d.ts +66 -0
  76. package/dist/overlay.d.ts.map +1 -1
  77. package/dist/overlay.js +20 -2
  78. package/dist/overlay.js.map +1 -1
  79. package/dist/overrides.d.ts +27 -2
  80. package/dist/overrides.d.ts.map +1 -1
  81. package/dist/overrides.js +100 -11
  82. package/dist/overrides.js.map +1 -1
  83. package/dist/sources/alert.css +1 -1
  84. package/dist/sources/button.css +1 -1
  85. package/dist/sources/card.css +1 -1
  86. package/dist/sources/colorPicker.css +1 -1
  87. package/dist/sources/combobox.css +1 -1
  88. package/dist/sources/dataTable.css +1 -1
  89. package/dist/sources/datePicker.css +1 -1
  90. package/dist/sources/dialog.css +1 -1
  91. package/dist/sources/drawer.css +1 -1
  92. package/dist/sources/iconButton.css +1 -1
  93. package/dist/sources/input.css +1 -1
  94. package/dist/sources/multiSelect.css +1 -1
  95. package/dist/sources/nativeSelect.css +1 -1
  96. package/dist/sources/numberInput.css +1 -1
  97. package/dist/sources/passwordInput.css +1 -1
  98. package/dist/sources/progress.css +1 -1
  99. package/dist/sources/select.css +1 -1
  100. package/dist/sources/slider.css +1 -1
  101. package/dist/sources/tagsInput.css +1 -1
  102. package/dist/sources/textarea.css +1 -1
  103. package/dist/utils.d.ts +9 -0
  104. package/dist/utils.d.ts.map +1 -1
  105. package/dist/utils.js +24 -0
  106. package/dist/utils.js.map +1 -1
  107. package/dist/vite.d.ts +19 -0
  108. package/dist/vite.d.ts.map +1 -0
  109. package/dist/vite.js +161 -0
  110. package/dist/vite.js.map +1 -0
  111. package/package.json +15 -2
  112. package/src/alert.ts +8 -0
  113. package/src/app.ts +2 -2
  114. package/src/button.ts +8 -8
  115. package/src/card.ts +1 -1
  116. package/src/control-ids.ts +21 -0
  117. package/src/data.ts +24 -0
  118. package/src/dev.ts +14 -0
  119. package/src/extras.ts +7 -3
  120. package/src/field.ts +18 -10
  121. package/src/index.ts +8 -2
  122. package/src/inputs.ts +81 -40
  123. package/src/list-items.ts +21 -0
  124. package/src/media.ts +15 -0
  125. package/src/native/controls.ts +4 -0
  126. package/src/native/data.ts +23 -0
  127. package/src/native/display.ts +27 -0
  128. package/src/native/form.ts +8 -0
  129. package/src/native/overlay.ts +10 -0
  130. package/src/navigation.ts +66 -8
  131. package/src/overlay.ts +20 -2
  132. package/src/overrides.ts +130 -15
  133. package/src/utils.ts +22 -0
  134. package/src/vite.ts +162 -0
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]',
@@ -84,6 +84,10 @@ export const input = tv({
84
84
  hasStatusIcon: {
85
85
  true: { control: 'pe-2' },
86
86
  },
87
+ /** Monospace font of the theme – for paths, tokens, codes and keys */
88
+ mono: {
89
+ true: { control: 'font-mono' },
90
+ },
87
91
  },
88
92
  defaultVariants: {
89
93
  size: 'md',
@@ -92,14 +96,14 @@ export const input = tv({
92
96
 
93
97
  export const textarea = tv({
94
98
  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',
99
+ '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
100
  'outline-none transition-colors placeholder:text-muted focus:border-primary motion-reduce:transition-none',
97
101
  ],
98
102
  variants: {
99
103
  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',
104
+ sm: 'rounded-[var(--wc-control-radius-sm,0.375rem)] px-2.5 py-1.5 text-[length:var(--wc-control-text-sm,13px)]',
105
+ md: 'rounded-[var(--wc-control-radius-md,0.5rem)] px-3 py-[9px] text-[length:var(--wc-control-text-md,15px)]',
106
+ lg: 'rounded-[var(--wc-control-radius-lg,10px)] px-4 py-3 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
103
107
  },
104
108
  invalid: {
105
109
  true: 'border-danger focus:border-danger',
@@ -119,6 +123,10 @@ export const textarea = tv({
119
123
  hasTrailing: {
120
124
  true: 'pe-10',
121
125
  },
126
+ /** Monospace font of the theme – for keys, codes and logs */
127
+ mono: {
128
+ true: 'font-mono',
129
+ },
122
130
  },
123
131
  });
124
132
 
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,
@@ -353,6 +354,7 @@ export {
353
354
  anchorBox,
354
355
  checkPasswordRequirements,
355
356
  clampDialogOffset,
357
+ closeMenuOnPageEvents,
356
358
  closeTab,
357
359
  createLongPress,
358
360
  dialogMoveForKey,
@@ -667,11 +669,14 @@ export {
667
669
  withRecipeOverrides,
668
670
  type AnyRecipe,
669
671
  type RecipeClasses,
672
+ type RecipeCompoundClasses,
670
673
  type RecipeConfig,
671
674
  type RecipeName,
672
675
  type RecipeOverride,
673
676
  type RecipeOverrides,
674
677
  type RecipeSlot,
678
+ type RecipeVariantClasses,
679
+ type RecipeVariantName,
675
680
  } from './overrides.js';
676
681
  export {
677
682
  GAUGE_ARC,
@@ -834,7 +839,8 @@ export {
834
839
  type TrendDirection,
835
840
  type TrendTone,
836
841
  } from './format.js';
837
- export { checkRecipeSources, warnInDevelopment } from './dev.js';
842
+ export { checkRecipeSources, warnInDevelopment, warnLabelFor } from './dev.js';
843
+ export { controlIds, type ControlIds } from './control-ids.js';
838
844
  export {
839
845
  formatHotkey,
840
846
  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,11 +98,23 @@ 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,
114
+ /** Monospace font of the theme – for tokens, passphrases and keys */
115
+ mono: {
116
+ true: { input: 'font-mono' },
117
+ },
98
118
  },
99
119
  defaultVariants: {
100
120
  size: 'md',
@@ -143,6 +163,14 @@ export const slider = tv({
143
163
  control: 'mb-6 data-[orientation=vertical]:mb-0 data-[orientation=vertical]:me-14',
144
164
  },
145
165
  },
166
+ /** The label for screen readers only (`hideLabel`) – it still names the thumbs; the value stays at the end */
167
+ hideLabel: {
168
+ true: { header: 'justify-end', label: 'sr-only' },
169
+ },
170
+ /** Neither label nor value visible: the header takes no room */
171
+ hideHeader: {
172
+ true: { header: 'sr-only' },
173
+ },
146
174
  },
147
175
  });
148
176
 
@@ -150,7 +178,7 @@ export const multiSelect = tv({
150
178
  slots: {
151
179
  base: 'flex w-full flex-col',
152
180
  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',
181
+ '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
182
  'outline-none transition-colors motion-reduce:transition-none focus-visible:border-primary data-[state=open]:border-primary',
155
183
  'data-invalid:border-danger data-disabled:cursor-not-allowed data-disabled:border-line data-disabled:bg-bg-2 data-disabled:text-muted',
156
184
  ],
@@ -175,13 +203,13 @@ export const multiSelect = tv({
175
203
  /** Wraps trigger and clear button (clearable); with chips the bordered box around chips and trigger */
176
204
  control: 'relative flex',
177
205
  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',
206
+ '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
207
  'transition-colors motion-reduce:transition-none focus-within:border-primary data-[state=open]:border-primary',
180
208
  'data-invalid:border-danger data-disabled:cursor-not-allowed data-disabled:border-line data-disabled:bg-bg-2 data-disabled:text-muted',
181
209
  ],
182
210
  /** The trigger next to the chips: fills the rest of the row, no border of its own */
183
211
  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',
212
+ '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
213
  'data-disabled:cursor-not-allowed data-disabled:text-muted',
186
214
  ],
187
215
  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 +241,18 @@ export const multiSelect = tv({
213
241
  variants: {
214
242
  size: {
215
243
  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]',
244
+ trigger:
245
+ '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)]',
246
+ chipsControl:
247
+ 'min-h-[var(--wc-control-h-sm,2rem)] rounded-[var(--wc-control-radius-sm,0.375rem)] py-0.5',
248
+ chipsTrigger: 'text-[length:var(--wc-control-text-sm,13px)]',
219
249
  },
220
250
  md: {},
221
251
  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',
252
+ trigger:
253
+ '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',
254
+ chipsControl: 'min-h-[var(--wc-control-h-lg,3rem)] rounded-[var(--wc-control-radius-lg,10px)] py-[9px]',
255
+ chipsTrigger: 'text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
225
256
  },
226
257
  },
227
258
  // Room for the clear button between value and arrow
@@ -237,7 +268,7 @@ export const multiSelect = tv({
237
268
  export const combobox = tv({
238
269
  slots: {
239
270
  base: 'flex w-full flex-col',
240
- control: [...box, 'h-10'],
271
+ control: [...box, 'h-[var(--wc-control-h-md,2.5rem)]'],
241
272
  input: boxInput,
242
273
  clear: [...boxButton, 'w-8'],
243
274
  clearIcon: 'size-3.5',
@@ -257,9 +288,18 @@ export const combobox = tv({
257
288
  },
258
289
  variants: {
259
290
  size: {
260
- sm: { control: 'h-8 rounded-md', input: 'px-2.5 text-[13px]', trigger: 'w-8', clear: 'w-7' },
291
+ sm: {
292
+ control: 'h-[var(--wc-control-h-sm,2rem)] rounded-[var(--wc-control-radius-sm,0.375rem)]',
293
+ input: 'px-2.5 text-[length:var(--wc-control-text-sm,13px)]',
294
+ trigger: 'w-8',
295
+ clear: 'w-7',
296
+ },
261
297
  md: {},
262
- lg: { control: 'h-12 rounded-[10px]', input: 'px-4 text-base', trigger: 'w-11' },
298
+ lg: {
299
+ control: 'h-[var(--wc-control-h-lg,3rem)] rounded-[var(--wc-control-radius-lg,10px)]',
300
+ input: 'px-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
301
+ trigger: 'w-11',
302
+ },
263
303
  },
264
304
  },
265
305
  defaultVariants: {
@@ -270,15 +310,15 @@ export const combobox = tv({
270
310
  export const datePicker = tv({
271
311
  slots: {
272
312
  base: 'flex w-full flex-col',
273
- control: [...box, 'h-10'],
313
+ control: [...box, 'h-[var(--wc-control-h-md,2.5rem)]'],
274
314
  // Segmented date field (DateInput): one spin button per part, separators come from the locale
275
315
  dateInput: 'relative flex min-w-0 flex-1 items-center px-3',
276
316
  // Holds one date, or start – end of a range, in a row; invisible (still usable) while the placeholder shows
277
317
  dateControl: 'flex min-w-0 items-center data-placeholder-shown:opacity-0',
278
318
  /** Own placeholder of the empty field (`placeholder`) – gives way to the parts on focus */
279
319
  placeholder:
280
- 'absolute inset-0 flex cursor-text items-center overflow-hidden px-3 text-[15px] whitespace-nowrap text-muted data-hidden:pointer-events-none data-hidden:opacity-0',
281
- segments: 'flex items-center text-[15px]',
320
+ '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',
321
+ segments: 'flex items-center text-[length:var(--wc-control-text-md,15px)]',
282
322
  segment: [
283
323
  'rounded-sm px-px text-fg tabular-nums outline-none data-placeholder-shown:text-muted',
284
324
  // Tabular figures would make the separators as wide as a digit
@@ -364,7 +404,8 @@ export const datePicker = tv({
364
404
  'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-fg',
365
405
  ],
366
406
  /** Chosen dates as text in the field (selectionMode multiple), muted while empty */
367
- multiValue: 'min-w-0 flex-1 truncate px-3 text-[15px] data-placeholder:text-muted',
407
+ multiValue:
408
+ 'min-w-0 flex-1 truncate px-3 text-[length:var(--wc-control-text-md,15px)] data-placeholder:text-muted',
368
409
  /** Short zone name after the time (showTimeZone) */
369
410
  timeZone: 'shrink-0 self-center pe-1 text-xs text-muted',
370
411
  /** Narrow screens (responsive): the calendar as a sheet at the bottom over a backdrop */
@@ -372,34 +413,34 @@ export const datePicker = tv({
372
413
  backdrop: 'fixed inset-0 z-40 bg-black/40 motion-safe:animate-fade-in',
373
414
  /** QuarterPicker: typed quarter ("Q4 2026"), the year above the quarters, the quarters */
374
415
  textInput:
375
- 'h-full min-w-0 flex-1 bg-transparent px-3 text-[15px] text-inherit outline-none placeholder:text-muted disabled:cursor-not-allowed',
416
+ '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',
376
417
  yearLabel: 'text-sm font-semibold tabular-nums',
377
418
  quarterGrid: 'grid grid-cols-2 gap-1',
378
419
  /** DurationInput: unit after a part ("hr") */
379
- unit: 'px-1 text-[15px] text-muted',
420
+ unit: 'px-1 text-[length:var(--wc-control-text-md,15px)] text-muted',
380
421
  },
381
422
  variants: {
382
423
  size: {
383
424
  sm: {
384
- control: 'h-8 rounded-md',
425
+ control: 'h-[var(--wc-control-h-sm,2rem)] rounded-[var(--wc-control-radius-sm,0.375rem)]',
385
426
  dateInput: 'px-2.5',
386
- placeholder: 'px-2.5 text-[13px]',
387
- segments: 'text-[13px]',
388
- multiValue: 'px-2.5 text-[13px]',
389
- textInput: 'px-2.5 text-[13px]',
390
- unit: 'text-[13px]',
427
+ placeholder: 'px-2.5 text-[length:var(--wc-control-text-sm,13px)]',
428
+ segments: 'text-[length:var(--wc-control-text-sm,13px)]',
429
+ multiValue: 'px-2.5 text-[length:var(--wc-control-text-sm,13px)]',
430
+ textInput: 'px-2.5 text-[length:var(--wc-control-text-sm,13px)]',
431
+ unit: 'text-[length:var(--wc-control-text-sm,13px)]',
391
432
  trigger: 'w-8',
392
433
  clear: 'w-7',
393
434
  },
394
435
  md: {},
395
436
  lg: {
396
- control: 'h-12 rounded-[10px]',
437
+ control: 'h-[var(--wc-control-h-lg,3rem)] rounded-[var(--wc-control-radius-lg,10px)]',
397
438
  dateInput: 'px-4',
398
- placeholder: 'px-4 text-base',
399
- segments: 'text-base',
400
- multiValue: 'px-4 text-base',
401
- textInput: 'px-4 text-base',
402
- unit: 'text-base',
439
+ placeholder: 'px-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
440
+ segments: 'text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
441
+ multiValue: 'px-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
442
+ textInput: 'px-4 text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
443
+ unit: 'text-[length:var(--wc-control-text-lg,1rem)] leading-normal',
403
444
  trigger: 'w-11',
404
445
  },
405
446
  },
@@ -630,9 +671,9 @@ export const knob = tv({
630
671
  export const colorPicker = tv({
631
672
  slots: {
632
673
  base: 'flex w-full flex-col',
633
- control: [...box, 'h-10'],
674
+ control: [...box, 'h-[var(--wc-control-h-md,2.5rem)]'],
634
675
  trigger: [
635
- 'flex min-w-0 flex-1 cursor-pointer items-center gap-2.5 px-3 text-start text-[15px] text-fg outline-none',
676
+ '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',
636
677
  'focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-fg',
637
678
  ],
638
679
  swatch: 'size-5 shrink-0 rounded-md shadow-[inset_0_0_0_1px_rgba(0,0,0,.15)]',
package/src/list-items.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { warnInDevelopment } from './dev.js';
2
+
1
3
  // Shared logic of the option lists (Select, MultiSelect, Combobox, Autocomplete, Listbox, TagsInput, VirtualSelect):
2
4
  // items of any shape, values of any type, stable string keys for Ark, groups and filtering.
3
5
 
@@ -33,6 +35,8 @@ export interface ListOption<T = unknown> {
33
35
  keywords?: string[];
34
36
  /** The original item (for slots and render functions) */
35
37
  item: T;
38
+ /** A chosen value that is not among the items – shown as its text (see checkListValues) */
39
+ unknown?: boolean;
36
40
  }
37
41
 
38
42
  /** Options under one heading; `label` is undefined for items without a group */
@@ -173,10 +177,27 @@ export function listOptionsForValues<T>(
173
177
  label: String(value),
174
178
  disabled: false,
175
179
  item: value as T,
180
+ unknown: true,
176
181
  };
177
182
  });
178
183
  }
179
184
 
185
+ /**
186
+ * Development only: warns about chosen values that are not among the loaded items – they show as raw text, e.g. a
187
+ * country code while the items carry country names. Call it once the items are there (not while loading, not while a
188
+ * data source can still resolve the value, not for free text).
189
+ */
190
+ export function checkListValues(component: string, selected: readonly ListOption[]) {
191
+ for (const option of selected) {
192
+ if (!option.unknown) continue;
193
+ warnInDevelopment(
194
+ `${component}: the value ${JSON.stringify(option.value)} is not among its items and shows as text. ` +
195
+ 'Check `itemValue`/`valueKey` against the values of the items – a value the items load later can be ' +
196
+ 'resolved by a data source (`getItemsByKeys`).'
197
+ );
198
+ }
199
+ }
200
+
180
201
  /**
181
202
  * The value of a single choice as a list: undefined → [], null → [] – unless one of the options has the value null
182
203
  * (e.g. "All"): then null chooses it.
package/src/media.ts CHANGED
@@ -14,6 +14,8 @@ export const carousel = tv({
14
14
  control:
15
15
  'flex items-center gap-2 rtl:[&_[data-part=prev-trigger]_svg]:-scale-x-100 rtl:[&_[data-part=next-trigger]_svg]:-scale-x-100',
16
16
  indicatorGroup: 'flex flex-1 flex-wrap items-center justify-center',
17
+ /** `controlsPosition: 'sides'`: previous button, slides and next button in a row */
18
+ stage: 'flex min-w-0 items-center gap-2 rtl:[&_[data-part=prev-trigger]_svg]:-scale-x-100 rtl:[&_[data-part=next-trigger]_svg]:-scale-x-100',
17
19
  // 24 × 24 px target (WCAG 2.5.8) around a small dot; the current one is wider, not only coloured
18
20
  indicator: [
19
21
  'flex size-6 cursor-pointer items-center justify-center rounded-full',
@@ -34,7 +36,20 @@ export const carousel = tv({
34
36
  '[&_[data-part=prev-trigger]_svg]:rotate-90 [&_[data-part=next-trigger]_svg]:rotate-90 rtl:[&_[data-part=prev-trigger]_svg]:scale-x-100 rtl:[&_[data-part=next-trigger]_svg]:scale-x-100',
35
37
  },
36
38
  },
39
+ /** Previous and next beside the slides (`controlsPosition: 'sides'`) – without it in the row below them */
40
+ controlsPosition: {
41
+ sides: { itemGroup: 'min-w-0 flex-1' },
42
+ },
37
43
  },
44
+ compoundVariants: [
45
+ {
46
+ vertical: true,
47
+ controlsPosition: 'sides',
48
+ class: {
49
+ stage: 'flex-col [&_[data-part=prev-trigger]_svg]:rotate-90 [&_[data-part=next-trigger]_svg]:rotate-90 rtl:[&_[data-part=prev-trigger]_svg]:scale-x-100 rtl:[&_[data-part=next-trigger]_svg]:scale-x-100',
50
+ },
51
+ },
52
+ ],
38
53
  });
39
54
 
40
55
  export const gallery = tv({
@@ -163,6 +163,10 @@ export const slider = tv({
163
163
  markLabel: 'mt-0',
164
164
  },
165
165
  },
166
+ /** Without the visible label (`hideLabel`): the value stays at the end */
167
+ hideLabel: {
168
+ true: { header: 'justify-end' },
169
+ },
166
170
  },
167
171
  defaultVariants: {
168
172
  orientation: 'horizontal',
@@ -293,7 +293,30 @@ export const progressParts = tv({
293
293
  filled: {
294
294
  true: { step: 'bg-primary' },
295
295
  },
296
+ /** `xs`: a thin bar, e.g. in a list */
297
+ size: {
298
+ xs: { track: 'h-1', steps: 'h-1', verticalTrack: 'w-1' },
299
+ md: {},
300
+ },
301
+ /** Colour of the filled part by its state */
302
+ status: {
303
+ info: { verticalRange: 'bg-info' },
304
+ success: { verticalRange: 'bg-success' },
305
+ warn: { verticalRange: 'bg-warn' },
306
+ danger: { verticalRange: 'bg-danger' },
307
+ },
308
+ /** Text in the bar: a taller track */
309
+ hasText: {
310
+ true: { track: 'relative h-4' },
311
+ },
296
312
  },
313
+ compoundVariants: [
314
+ { filled: true, status: 'info', class: { step: 'bg-info' } },
315
+ { filled: true, status: 'success', class: { step: 'bg-success' } },
316
+ { filled: true, status: 'warn', class: { step: 'bg-warn' } },
317
+ { filled: true, status: 'danger', class: { step: 'bg-danger' } },
318
+ { size: 'xs', hasText: true, class: { track: 'h-3.5' } },
319
+ ],
297
320
  });
298
321
 
299
322
  /** Colours of meters and segments (`MeterColor`) */
@@ -85,6 +85,8 @@ export const alert = tv({
85
85
  content: 'min-w-0 flex-1 gap-0.5 pt-[3px]',
86
86
  title: 'font-sans-semibold text-sm text-fg',
87
87
  description: 'font-sans text-[13px] leading-5 text-muted',
88
+ /** Buttons in the message (`actions`), below the text */
89
+ actions: 'mt-2 flex-row flex-wrap items-center gap-2',
88
90
  dismiss: ['size-7 items-center justify-center rounded-full', pressable, 'active:bg-line active:opacity-100'],
89
91
  dismissIcon: 'size-3.5 text-muted',
90
92
  },
@@ -226,5 +228,30 @@ export const progress = tv({
226
228
  value: 'shrink-0 font-mono text-[11px] text-muted',
227
229
  track: 'h-1.5 overflow-hidden rounded-[3px] bg-line-2',
228
230
  range: 'h-full overflow-hidden rounded-[3px] bg-primary',
231
+ /** Text in the bar (`barText`) over the empty part */
232
+ barText: 'absolute inset-0 items-center justify-center px-1.5',
233
+ barTextLabel: 'font-mono text-[10.5px] text-fg',
234
+ /** The same text inside the filled part (as wide as the track), in the colour for the fill */
235
+ barTextFill: 'absolute top-0 bottom-0 left-0 items-center justify-center px-1.5',
236
+ barTextFillLabel: 'font-mono text-[10.5px] text-on-primary',
229
237
  },
238
+ variants: {
239
+ /** `xs`: small text, e.g. in a list */
240
+ size: {
241
+ xs: { base: 'gap-1', label: 'text-[10px]', value: 'text-[10px]' },
242
+ md: {},
243
+ },
244
+ /** Colour of the filled part by its state */
245
+ status: {
246
+ info: { range: 'bg-info', barTextFillLabel: 'text-on-info' },
247
+ success: { range: 'bg-success', barTextFillLabel: 'text-on-success' },
248
+ warn: { range: 'bg-warn', barTextFillLabel: 'text-on-warn' },
249
+ danger: { range: 'bg-danger', barTextFillLabel: 'text-on-danger' },
250
+ },
251
+ /** The label only names the bar; the value stays at the end */
252
+ hideLabel: {
253
+ true: { header: 'justify-end' },
254
+ },
255
+ },
256
+ compoundVariants: [{ size: 'xs', class: { barTextLabel: 'text-[10px]', barTextFillLabel: 'text-[10px]' } }],
230
257
  });
@@ -67,6 +67,10 @@ export const input = tv({
67
67
  hasIcon: {
68
68
  true: { control: 'pl-2' },
69
69
  },
70
+ /** Monospace font of the theme – for paths, tokens, codes and keys */
71
+ mono: {
72
+ true: { control: 'font-mono' },
73
+ },
70
74
  },
71
75
  defaultVariants: {
72
76
  size: 'md',
@@ -93,6 +97,10 @@ export const textarea = tv({
93
97
  md: {},
94
98
  lg: 'rounded-[10px] px-4 py-3 text-base',
95
99
  },
100
+ /** Monospace font of the theme – for keys, codes and logs */
101
+ mono: {
102
+ true: 'font-mono',
103
+ },
96
104
  },
97
105
  });
98
106
 
@@ -72,6 +72,16 @@ export const dialog = tv({
72
72
  bare: {
73
73
  true: { body: 'pt-[18px]' },
74
74
  },
75
+ /** `titlePosition: 'header'`: the title in the row of the close button (a smaller icon before it), as on the Drawer */
76
+ titleInHeader: {
77
+ true: {
78
+ header: 'border-b border-line pb-3',
79
+ iconBox: 'size-7 rounded-lg',
80
+ icon: 'size-4',
81
+ title: 'min-w-0 flex-1 text-base',
82
+ body: 'pt-4',
83
+ },
84
+ },
75
85
  /** The body scrolls, title and buttons stay */
76
86
  scrollInside: {
77
87
  true: { content: 'max-h-full' },