@nswds/ui 6.0.0 → 7.0.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.
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +9 -1
- package/dist/components/button.js.map +1 -1
- package/dist/components/header.d.ts +1 -1
- package/dist/components/input-group.d.ts +19 -1
- package/dist/components/input-group.js +356 -16
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/link.d.ts +1 -1
- package/dist/components/masthead.d.ts +1 -1
- package/dist/components/skip-link.d.ts +1 -1
- package/dist/components/textarea.d.ts +4 -2
- package/dist/components/textarea.js +48 -11
- package/dist/components/textarea.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/package.json +4 -4
|
@@ -13,7 +13,66 @@ function InputGroup({ className, ...props }) {
|
|
|
13
13
|
"data-slot": "input-group",
|
|
14
14
|
role: "group",
|
|
15
15
|
className: cn(
|
|
16
|
-
|
|
16
|
+
// No `outline-none` here: it sets `--tw-outline-style: none` on this
|
|
17
|
+
// element, which then suppresses the focus outline below (which reads
|
|
18
|
+
// `outline-style: var(--tw-outline-style)`).
|
|
19
|
+
"group/input-group relative flex h-12 w-full min-w-0 items-stretch rounded-sm motion-safe:transition-colors",
|
|
20
|
+
// Every colour routes through the --input-* semantic tokens (layer 3,
|
|
21
|
+
// theme.css / the registry theme item) — the same set Input uses, so a
|
|
22
|
+
// group and a bare input are the same control. The role tokens behind
|
|
23
|
+
// them are mode-aware, so there are no dark: variants here.
|
|
24
|
+
"border border-(--input-border) bg-(--input-surface)",
|
|
25
|
+
// Hover — owned by the wrapper so the whole control reacts, addons
|
|
26
|
+
// included, rather than just the inner control's box.
|
|
27
|
+
//
|
|
28
|
+
// Known nuance, deliberately NOT fixed here: hovering an embedded
|
|
29
|
+
// button also paints this surface, so the 464px field greys behind a
|
|
30
|
+
// control the pointer is only 85px inside. Suppressing it with
|
|
31
|
+
// `has-[button:hover]:bg-(--input-surface)` works for the button, but
|
|
32
|
+
// measurably breaks the ordinary field hover on any group holding a
|
|
33
|
+
// button — Chromium stops re-evaluating the plain `:hover` rule on a
|
|
34
|
+
// subject that also carries a `:has(…:hover)` rule, so the field hover
|
|
35
|
+
// silently stopped painting at all. Losing the common interaction to
|
|
36
|
+
// sharpen the rare one is the wrong trade. Revisit if the group ever
|
|
37
|
+
// gains a wrapper that can own hover without `:has()`.
|
|
38
|
+
"hover:bg-(--input-surface-hover)",
|
|
39
|
+
// Disabled — owned by the wrapper, because the control is only PART of
|
|
40
|
+
// this control. Input's `disabled:opacity-50` fades its own box and
|
|
41
|
+
// nothing else, so a disabled group rendered a full-strength border, a
|
|
42
|
+
// full-strength affix panel and a text cursor over dead chrome:
|
|
43
|
+
// measurably identical to an enabled group on every property except
|
|
44
|
+
// the input's text. Fading the wrapper reproduces a disabled bare
|
|
45
|
+
// Input, where one element carries border, surface and text together.
|
|
46
|
+
// The children neutralise their own `disabled:opacity-50` so the two
|
|
47
|
+
// layers cannot compound to 0.25.
|
|
48
|
+
"has-[[data-slot=input-group-control]:disabled]:opacity-50",
|
|
49
|
+
// Focus — the group draws one outline for whichever control is focused;
|
|
50
|
+
// InputGroupInput / InputGroupTextarea suppress their own. Offset and
|
|
51
|
+
// colour are unconditional because neither renders anything until
|
|
52
|
+
// `outline-2` supplies an outline-style, and keeping them off the
|
|
53
|
+
// has-[] variant leaves the invalid colour below a plain specificity
|
|
54
|
+
// win instead of a source-order tie between two has-[] rules.
|
|
55
|
+
"outline-offset-2 outline-(--input-ring)",
|
|
56
|
+
"has-[[data-slot=input-group-control]:focus-visible]:outline-2",
|
|
57
|
+
// Invalid — 2px danger border, danger hover surface and danger focus
|
|
58
|
+
// outline, mirroring Input's aria-invalid treatment. Each rule carries
|
|
59
|
+
// the has-[] selector, so it outranks its unqualified counterpart on
|
|
60
|
+
// specificity rather than on emission order.
|
|
61
|
+
"has-[[data-slot][aria-invalid=true]]:border-2 has-[[data-slot][aria-invalid=true]]:border-(--input-invalid-border)",
|
|
62
|
+
"has-[[data-slot][aria-invalid=true]]:outline-(--input-invalid-ring)",
|
|
63
|
+
"has-[[data-slot][aria-invalid=true]]:hover:bg-(--input-invalid-surface-hover)",
|
|
64
|
+
// An InputGroupAction sits flush to the trailing edge with square
|
|
65
|
+
// corners, so the group clips it to its own radius — cheaper and
|
|
66
|
+
// RTL-correct next to per-corner arithmetic on the action. Scoped to
|
|
67
|
+
// groups that actually hold one: a bare `overflow-hidden` would clip
|
|
68
|
+
// DESCENDANT outlines, and InputGroupButton's focus ring sits 2px
|
|
69
|
+
// outside itself, so every Combobox chevron would lose its ring.
|
|
70
|
+
"has-[[data-slot=input-group-action]]:overflow-hidden",
|
|
71
|
+
// Block-aligned addons stack the group and let it grow to fit
|
|
72
|
+
"has-data-[align=block-end]:rounded-sm has-data-[align=block-start]:rounded-sm has-[textarea]:rounded-sm",
|
|
73
|
+
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto",
|
|
74
|
+
// Addon-driven padding on the inner input
|
|
75
|
+
"has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3",
|
|
17
76
|
className
|
|
18
77
|
),
|
|
19
78
|
...props
|
|
@@ -21,14 +80,76 @@ function InputGroup({ className, ...props }) {
|
|
|
21
80
|
);
|
|
22
81
|
}
|
|
23
82
|
const inputGroupAddonVariants = cva(
|
|
24
|
-
|
|
83
|
+
// `--input-placeholder` is the input token set's de-emphasised-text role, and
|
|
84
|
+
// an icon or text affix is exactly that — so addons restyle with the input
|
|
85
|
+
// rather than drifting from it. Mode-aware, hence no dark: variants.
|
|
86
|
+
//
|
|
87
|
+
// Type and glyphs are sized off the control's own `text-base`, not off the
|
|
88
|
+
// box. An affix sits on the same line as the value, so 16px is the floor —
|
|
89
|
+
// the old `text-xs/relaxed` (12px) and 10px kbd were scaled for the 28px
|
|
90
|
+
// group this component used to be and read as fine print beside 16px input
|
|
91
|
+
// text. Glyphs are `size-5` (20px), 1.25x the label, the same reasoning
|
|
92
|
+
// button.tsx documents for a label glyph.
|
|
93
|
+
// An addon holding an InputGroupAction yields its own padding on that edge so
|
|
94
|
+
// the action reaches the group's inner border, and takes a 48px floor so the
|
|
95
|
+
// row still has height once the padding is gone (the affix text centres in
|
|
96
|
+
// it via `items-center`). Each override carries the has-[] selector, so it
|
|
97
|
+
// outranks the base padding on specificity rather than on emission order.
|
|
98
|
+
// The affix advertises a text caret because clicking it focuses the control.
|
|
99
|
+
// Over a DISABLED control that is a lie, so it takes the same
|
|
100
|
+
// `cursor-not-allowed` the control itself does — keyed on the control rather
|
|
101
|
+
// than on the group's `data-disabled`, which nothing in the component ever
|
|
102
|
+
// sets (the opacity hook below has the same gap and is left as the manual
|
|
103
|
+
// escape hatch it already was).
|
|
104
|
+
"flex cursor-text items-center justify-center gap-1 text-base text-(--input-placeholder) select-none group-has-[[data-slot=input-group-control]:disabled]/input-group:cursor-not-allowed group-data-[disabled=true]/input-group:opacity-50 has-[[data-slot=input-group-action]]:min-h-12 has-[[data-slot=input-group-action]]:py-0 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-(--input-placeholder)/10 **:data-[slot=kbd]:px-1 [&>svg:not([class*='size-'])]:size-5",
|
|
25
105
|
{
|
|
26
106
|
variants: {
|
|
27
107
|
align: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
108
|
+
// No negative nudge for buttons. `me-[-0.275rem]` was tuned to cancel a
|
|
109
|
+
// 20px `px-1` button in the 28px group this component used to be; at
|
|
110
|
+
// 32px and `px-3` it under-compensates and left the inline button 3.6px
|
|
111
|
+
// off the group's inner edge while the block-end row sat at 8px. Every
|
|
112
|
+
// inset is now that same 8px, so affixes, buttons and footer rows all
|
|
113
|
+
// land on one grid. The kbd nudge stays — a kbd chip is small enough
|
|
114
|
+
// that the optical correction still reads.
|
|
115
|
+
// ONE hairline colour for the whole control: `--input-border`, the same
|
|
116
|
+
// token the group's own edge uses. The mockup drew internal dividers in
|
|
117
|
+
// the lighter `--border-default`, but mixing the two put a #dcdfe0
|
|
118
|
+
// divider beside a #888f92 seam and outer edge, which reads as the
|
|
119
|
+
// junctions being heavier rather than as a hierarchy. It also fixes
|
|
120
|
+
// dark mode: `--border-default` measures 1.12:1 on the dark surface,
|
|
121
|
+
// under the 3:1 floor for a boundary that has to identify a control.
|
|
122
|
+
//
|
|
123
|
+
// The leading affix is a CELL, not floating text: a recessed fill, a
|
|
124
|
+
// hairline on its inner edge, and the group's full height. This is what
|
|
125
|
+
// makes the trailing action read as its mirror — the approved design's
|
|
126
|
+
// words were "the trailing cell mirrors the leading AUD cell exactly".
|
|
127
|
+
// 16px padding matches the value's own, so affix and value sit on one
|
|
128
|
+
// rhythm.
|
|
129
|
+
// Weight lives per align, not in the base: the design sets the inline
|
|
130
|
+
// affix at 600 (`.affix`) but the block row's hint at 300
|
|
131
|
+
// (`.foot .hint`). A base `font-semibold` made "Markdown supported"
|
|
132
|
+
// read as a label at the same weight as the AUD affix.
|
|
133
|
+
//
|
|
134
|
+
// No kbd nudge here any more. `ms-[-0.275rem]` was harmless while this
|
|
135
|
+
// addon was transparent text; now that it paints a fill, a border-inline
|
|
136
|
+
// -end and a rounded start corner, a negative start margin drags the
|
|
137
|
+
// whole cell out past the group's own border.
|
|
138
|
+
"inline-start": "order-first rounded-s-[calc(var(--radius-sm)-1px)] border-e border-(--input-border) bg-(--surface-sunken) px-4 font-semibold has-[[data-slot=input-group-action]]:ms-0 has-[[data-slot=input-group-action]]:items-stretch has-[[data-slot=input-group-action]]:p-0",
|
|
139
|
+
"inline-end": "order-last px-2 font-semibold has-[[data-slot=input-group-action]]:me-0 has-[[data-slot=input-group-action]]:items-stretch has-[[data-slot=input-group-action]]:p-0 has-[>kbd]:me-[-0.275rem]",
|
|
140
|
+
// Block addons are chrome, not content, so they carry the boundary the
|
|
141
|
+
// Hairline Rule asks for and sit on the recessed surface. Without both
|
|
142
|
+
// the row floats in the writing area with nothing dividing it.
|
|
143
|
+
//
|
|
144
|
+
// `--surface-sunken`, NOT `--background-subtle`: the latter resolves to
|
|
145
|
+
// the same value as `--surface-default` in dark, so the tint vanishes
|
|
146
|
+
// there. Sunken differs from the group's surface in BOTH modes.
|
|
147
|
+
//
|
|
148
|
+
// The corners are rounded rather than clipped by the group: a group-level
|
|
149
|
+
// `overflow-hidden` would cut off the focus ring of any button inside
|
|
150
|
+
// the row, since Button rings 2px outside itself.
|
|
151
|
+
"block-start": "order-first min-h-12 w-full justify-start rounded-t-[calc(var(--radius-sm)-1px)] border-b border-(--input-border) bg-(--surface-sunken) px-4 font-light has-[[data-slot=input-group-action]]:items-stretch has-[[data-slot=input-group-action]]:pe-0",
|
|
152
|
+
"block-end": "order-last min-h-12 w-full justify-start rounded-b-[calc(var(--radius-sm)-1px)] border-t border-(--input-border) bg-(--surface-sunken) px-4 font-light has-[[data-slot=input-group-action]]:items-stretch has-[[data-slot=input-group-action]]:pe-0"
|
|
32
153
|
}
|
|
33
154
|
},
|
|
34
155
|
defaultVariants: {
|
|
@@ -59,14 +180,54 @@ function InputGroupAddon({
|
|
|
59
180
|
);
|
|
60
181
|
}
|
|
61
182
|
const inputGroupButtonVariants = cva(
|
|
62
|
-
|
|
183
|
+
[
|
|
184
|
+
// No font-size here: Button already sets `text-base/7`, and the
|
|
185
|
+
// `text-xs/relaxed` this used to carry shrank its label to 12px.
|
|
186
|
+
// `before:shadow-none`, NOT `shadow-none`. Button paints its drop shadow on
|
|
187
|
+
// the `::before` fill layer (`before:shadow-sm` in the soft and solid
|
|
188
|
+
// variants), never on the button box — so `shadow-none` was doubly dead:
|
|
189
|
+
// wrong element, and a different tailwind-merge key, so both classes
|
|
190
|
+
// survived and the shadow rendered. Measured: `::before` box-shadow was
|
|
191
|
+
// `rgba(0,0,0,.1) 0 1px 3px`, a cast shadow inside flat hairline chrome.
|
|
192
|
+
"flex items-center gap-2 rounded-sm before:shadow-none",
|
|
193
|
+
// Every size below was inert until this line. Button pins
|
|
194
|
+
// `min-h-(--btn-h)` — 52px at the default step, 60px below `sm` — which
|
|
195
|
+
// outranks a plain `h-*` because they are different properties, so an
|
|
196
|
+
// `xs` button rendered at full size and inflated the row it sat in.
|
|
197
|
+
"min-h-0",
|
|
198
|
+
// Button's padding is a RESPONSIVE pair (`py-[…] sm:py-[…]`), and a media
|
|
199
|
+
// query adds no specificity, so an unprefixed override loses to the `sm:`
|
|
200
|
+
// rule on emission order. Restating both halves (`py-0 sm:py-0`) fixes the
|
|
201
|
+
// render but pairs a bare utility with a conditional one on the same
|
|
202
|
+
// property — check:cascade rejects that, and rightly: a consumer whose own
|
|
203
|
+
// build emits `.py-0` can have their copy land last on our element.
|
|
204
|
+
//
|
|
205
|
+
// `data-size` is always set by InputGroupButton, so an attribute selector
|
|
206
|
+
// is 0,2,0 against the media rule's 0,1,0 and wins at every width, with no
|
|
207
|
+
// second rule to order against.
|
|
208
|
+
"data-[size]:py-0",
|
|
209
|
+
// Same reason as InputGroupAction: zeroing Button's padding exposes its
|
|
210
|
+
// `items-baseline` base, which no longer centres the label.
|
|
211
|
+
"items-center",
|
|
212
|
+
// Same neutraliser InputGroupAction carries, and for the same reason: the
|
|
213
|
+
// group fades for a disabled control, and Button's own
|
|
214
|
+
// `data-disabled:opacity-50` would multiply into it. Measured at 0.25
|
|
215
|
+
// before this line — Combobox is the live case, since ComboboxInput passes
|
|
216
|
+
// `disabled` to the control AND to the trigger and clear buttons at once.
|
|
217
|
+
// Conditioned on the CONTROL, so a button disabled beside a live field
|
|
218
|
+
// still dims on its own.
|
|
219
|
+
"group-has-[[data-slot=input-group-control]:disabled]/input-group:disabled:opacity-100"
|
|
220
|
+
],
|
|
63
221
|
{
|
|
64
222
|
variants: {
|
|
223
|
+
// Heights are capped at 32px: the addon pads 8px top and bottom inside a
|
|
224
|
+
// 48px group, so anything taller re-inflates the row it is meant to sit
|
|
225
|
+
// inside. `sm` buys horizontal room rather than height for that reason.
|
|
65
226
|
size: {
|
|
66
|
-
xs: "h-
|
|
67
|
-
sm: "gap-1",
|
|
68
|
-
"icon-xs": "size-
|
|
69
|
-
"icon-sm": "size-
|
|
227
|
+
xs: "h-8 gap-1 rounded-[calc(var(--radius-sm)-1px)] data-[size=xs]:px-3 [&>svg:not([class*='size-'])]:size-5",
|
|
228
|
+
sm: "h-8 gap-1 rounded-[calc(var(--radius-sm)-1px)] data-[size=sm]:px-4 [&>svg:not([class*='size-'])]:size-5",
|
|
229
|
+
"icon-xs": "size-7 data-[size=icon-xs]:px-0",
|
|
230
|
+
"icon-sm": "size-8 data-[size=icon-sm]:px-0"
|
|
70
231
|
}
|
|
71
232
|
},
|
|
72
233
|
defaultVariants: {
|
|
@@ -77,7 +238,7 @@ const inputGroupButtonVariants = cva(
|
|
|
77
238
|
function InputGroupButton({
|
|
78
239
|
className,
|
|
79
240
|
type = "button",
|
|
80
|
-
variant = "
|
|
241
|
+
variant = "soft",
|
|
81
242
|
size = "xs",
|
|
82
243
|
...props
|
|
83
244
|
}) {
|
|
@@ -85,6 +246,7 @@ function InputGroupButton({
|
|
|
85
246
|
Button,
|
|
86
247
|
{
|
|
87
248
|
type,
|
|
249
|
+
"data-slot": "input-group-button",
|
|
88
250
|
"data-size": size,
|
|
89
251
|
variant,
|
|
90
252
|
className: cn(inputGroupButtonVariants({ size }), className),
|
|
@@ -92,12 +254,143 @@ function InputGroupButton({
|
|
|
92
254
|
}
|
|
93
255
|
);
|
|
94
256
|
}
|
|
257
|
+
const inputGroupActionVariants = cva(
|
|
258
|
+
[
|
|
259
|
+
// Fills the group's height and sits flush against its trailing edge — one
|
|
260
|
+
// block, not a button floating in addon padding. Button pins
|
|
261
|
+
// `min-h-(--btn-h)` (52px at the default step, 60px below `sm`), which a
|
|
262
|
+
// 48px group cannot hold, so `self-stretch` sizes the segment off the group
|
|
263
|
+
// and `min-h-0` clears the floor.
|
|
264
|
+
//
|
|
265
|
+
// `min-h-0`, NOT `[--btn-h:0px]`: the size step publishes its height through
|
|
266
|
+
// a RESPONSIVE pair (`[--btn-h:…] sm:[--btn-h:…]`), and a media query adds
|
|
267
|
+
// no specificity, so an unprefixed custom-property override loses to the
|
|
268
|
+
// `sm:` rule on emission order alone. Overriding the property itself lands
|
|
269
|
+
// in tailwind-merge's `min-h` group and drops Button's utility outright.
|
|
270
|
+
"h-auto min-h-0 self-stretch",
|
|
271
|
+
// Square: the group re-rounds the one outer corner by clipping (see
|
|
272
|
+
// `has-[[data-slot=input-group-action]]:overflow-hidden` on InputGroup), so
|
|
273
|
+
// there is no corner arithmetic here. The `before`/`after` fill layers are
|
|
274
|
+
// squared too — left at `calc(var(--radius-sm)-1px)` they notch the flush
|
|
275
|
+
// edges.
|
|
276
|
+
"rounded-none before:rounded-none after:rounded-none dark:after:rounded-none",
|
|
277
|
+
// Flush against the value: no optical border, and no shadow — a `shadow-sm`
|
|
278
|
+
// whisper belongs under a button sitting on the page, not one inset into a
|
|
279
|
+
// control. Padding is restated for both breakpoints because Button's is a
|
|
280
|
+
// responsive pair (see the min-h note above).
|
|
281
|
+
// Padding is keyed on `data-slot` rather than restated at both breakpoints:
|
|
282
|
+
// Button's own padding is a responsive pair, and a bare-plus-conditional
|
|
283
|
+
// override of the same property is what check:cascade forbids. The
|
|
284
|
+
// attribute selector is 0,2,0 and wins at every width on specificity.
|
|
285
|
+
"border-0 before:shadow-none data-[slot=input-group-action]:px-5 data-[slot=input-group-action]:py-0",
|
|
286
|
+
// The seam colour is owned here, for both modes, in the ALL-SIDES form.
|
|
287
|
+
// Button's ghost/soft/solid each set `dark:border-white/5`, which is a
|
|
288
|
+
// border-color shorthand — an inline-start longhand would only beat it by
|
|
289
|
+
// emission order, and white at 5% measures 1.12:1 on the dark surface, so
|
|
290
|
+
// the seam vanished there. Matching the shorthand puts both in one
|
|
291
|
+
// tailwind-merge group and drops Button's outright. Width stays 0 except
|
|
292
|
+
// where a variant below asks for it, so only that one edge paints.
|
|
293
|
+
"border-(--input-border) dark:border-(--input-border)",
|
|
294
|
+
// Focus draws INSIDE the segment: Button's default `outline-offset-2` puts
|
|
295
|
+
// the ring on the page, which the clipping group cuts off.
|
|
296
|
+
// `items-center`, because Button's base is `items-baseline`. Baseline
|
|
297
|
+
// alignment only looks centred while Button's own vertical padding
|
|
298
|
+
// balances the line box; with `py-0` and a stretched box it parked the
|
|
299
|
+
// label 9px above centre in a 46px segment. Measured, not eyeballed.
|
|
300
|
+
// The focus ring is stated in full here rather than inherited. Button
|
|
301
|
+
// publishes it as four classes (`focus:outline`, `focus:outline-2`,
|
|
302
|
+
// `focus:outline-offset-2`, `focus:outline-(--btn-bg)`); overriding only the
|
|
303
|
+
// offset left the rendered ring at the browser default — measured
|
|
304
|
+
// `solid 1.5px offset 0px`, not the designed 2px inset. Restating width and
|
|
305
|
+
// offset makes the treatment independent of what tailwind-merge does to
|
|
306
|
+
// Button's copies.
|
|
307
|
+
//
|
|
308
|
+
// Colour is `--input-ring`, the token the GROUP rings itself with, so a
|
|
309
|
+
// focused segment matches the control it sits in instead of borrowing the
|
|
310
|
+
// button system's brand ink. iterate-1.css:
|
|
311
|
+
// `.it .act:focus-visible { outline: 2px solid var(--input-ring); outline-offset: -2px }`.
|
|
312
|
+
"items-center font-semibold focus:outline-2 focus:-outline-offset-2 focus:outline-(--input-ring)",
|
|
313
|
+
// Keep Button's own `disabled:opacity-50` for the common case where only
|
|
314
|
+
// the action is disabled (an Apply that waits for a valid value) and the
|
|
315
|
+
// field beside it stays live. Drop it only when the GROUP is already
|
|
316
|
+
// fading for a disabled control, where the two layers would compound to
|
|
317
|
+
// 0.25. Conditioning on the control — not on this button's own state —
|
|
318
|
+
// is what separates the two cases.
|
|
319
|
+
"group-has-[[data-slot=input-group-control]:disabled]/input-group:disabled:opacity-100"
|
|
320
|
+
],
|
|
321
|
+
{
|
|
322
|
+
variants: {
|
|
323
|
+
// Three fills, mapped onto Button's own variants so hover, active and
|
|
324
|
+
// dark-mode handling come from the button system rather than being
|
|
325
|
+
// restated here. `open` and `subtle` have little or no fill contrast
|
|
326
|
+
// against the input surface, so both carry a leading hairline to read as
|
|
327
|
+
// a distinct cell; `solid` needs one only in dark (see below).
|
|
328
|
+
variant: {
|
|
329
|
+
// `open` and `subtle` have no usable fill contrast against the input
|
|
330
|
+
// surface (1:1 and 1.69:1 measured in dark), so both are bounded by a
|
|
331
|
+
// leading hairline in every mode. Colour comes from the base above.
|
|
332
|
+
// The seam is keyed on `data-variant-action` (stamped below) so it beats
|
|
333
|
+
// `border-0` on SPECIFICITY (0,2,0 vs 0,1,0). As a bare `border-s` it
|
|
334
|
+
// did not: tailwind-merge keeps BOTH `border-0` and `border-s` (verified
|
|
335
|
+
// — `border-w-s` invalidates nothing), `border-width:0` expands to the
|
|
336
|
+
// physical longhands and collides with `border-inline-start-width` at
|
|
337
|
+
// equal specificity, so only emission order separated them. Ours wins
|
|
338
|
+
// today by 199 bytes in dist/styles.css; a consuming app that emits its
|
|
339
|
+
// own `.border-0` after ours would reset the seam to 0 and `open` would
|
|
340
|
+
// lose the only thing delineating it. check:cascade cannot catch this —
|
|
341
|
+
// it only flags conditional at-rule pairs.
|
|
342
|
+
open: "bg-transparent data-[variant-action=open]:border-s",
|
|
343
|
+
subtle: "data-[variant-action=subtle]:border-s",
|
|
344
|
+
// Button rings in `--btn-bg`, which for a solid button IS the fill, so
|
|
345
|
+
// the inset ring above would be navy-on-navy. `--btn-text` is the label
|
|
346
|
+
// colour: 14.37:1 on the fill in both modes.
|
|
347
|
+
//
|
|
348
|
+
// The dark seam is not decoration. Button's `primary` reads the
|
|
349
|
+
// masterbrand ramp (--color-primary-800, Blue 01), which is
|
|
350
|
+
// theme-invariant, so on the dark group surface the fill measures
|
|
351
|
+
// 1.32:1 — under the 3:1 floor for identifying a UI component. The
|
|
352
|
+
// other three edges are bounded by the group's own border; this
|
|
353
|
+
// continues that hairline inward. Light needs none at 15.26:1, and a
|
|
354
|
+
// grey seam there would read as a gap.
|
|
355
|
+
solid: "focus:outline-(--btn-text) data-[variant-action=solid]:dark:border-s"
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
defaultVariants: {
|
|
359
|
+
variant: "solid"
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
const inputGroupActionButtonVariant = {
|
|
364
|
+
open: "ghost",
|
|
365
|
+
subtle: "soft",
|
|
366
|
+
solid: "solid"
|
|
367
|
+
};
|
|
368
|
+
function InputGroupAction({
|
|
369
|
+
className,
|
|
370
|
+
type = "button",
|
|
371
|
+
variant = "solid",
|
|
372
|
+
...props
|
|
373
|
+
}) {
|
|
374
|
+
return /* @__PURE__ */ jsx(
|
|
375
|
+
Button,
|
|
376
|
+
{
|
|
377
|
+
type,
|
|
378
|
+
"data-slot": "input-group-action",
|
|
379
|
+
"data-variant-action": variant,
|
|
380
|
+
variant: inputGroupActionButtonVariant[variant ?? "solid"],
|
|
381
|
+
className: cn(inputGroupActionVariants({ variant }), className),
|
|
382
|
+
...props
|
|
383
|
+
}
|
|
384
|
+
);
|
|
385
|
+
}
|
|
95
386
|
function InputGroupText({ className, ...props }) {
|
|
96
387
|
return /* @__PURE__ */ jsx(
|
|
97
388
|
"span",
|
|
98
389
|
{
|
|
99
390
|
className: cn(
|
|
100
|
-
|
|
391
|
+
// Matches the addon it sits in: 16px type, `--input-placeholder` ink,
|
|
392
|
+
// and a nested glyph the same size as one beside it.
|
|
393
|
+
"flex items-center gap-2 text-base text-(--input-placeholder) [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-5",
|
|
101
394
|
className
|
|
102
395
|
),
|
|
103
396
|
...props
|
|
@@ -110,7 +403,30 @@ function InputGroupInput({ className, ...props }) {
|
|
|
110
403
|
{
|
|
111
404
|
"data-slot": "input-group-control",
|
|
112
405
|
className: cn(
|
|
113
|
-
|
|
406
|
+
// The group owns the box, so fill its height (Input is `h-12` on its
|
|
407
|
+
// own) and drop the border, surface and radius to let the group's
|
|
408
|
+
// chrome show through.
|
|
409
|
+
//
|
|
410
|
+
// The hover surfaces must be neutralised too, even though the group
|
|
411
|
+
// paints the identical token: this control is `rounded-none` and
|
|
412
|
+
// `flex-1`, so with no inline-end addon its right edge lands 1px
|
|
413
|
+
// inside the group's border and its SQUARE corner fills the group's
|
|
414
|
+
// `rounded-sm` corner notch. Same colour, wrong shape — the group's
|
|
415
|
+
// own paint is clipped to its radius, the control's is not. Letting
|
|
416
|
+
// only the group paint keeps the corners round in both the default
|
|
417
|
+
// and the aria-invalid state (where the notch is 2px, not 1px).
|
|
418
|
+
//
|
|
419
|
+
// `outline-0` / `border-0` rather than `outline-none` / `border-none`:
|
|
420
|
+
// tailwind-merge treats those as the same group as Input's
|
|
421
|
+
// `focus-visible:outline-2` / `aria-invalid:border-2` and drops them
|
|
422
|
+
// from the class string outright, so there is never a pair of
|
|
423
|
+
// same-specificity rules whose winner depends on stylesheet order.
|
|
424
|
+
// `disabled:opacity-100` because the GROUP now fades for a disabled
|
|
425
|
+
// control (see InputGroup). Whenever this rule can fire, the group's
|
|
426
|
+
// has-[] rule has fired too, so leaving Input's own 50% in place would
|
|
427
|
+
// multiply to 0.25 and render the value fainter than a bare disabled
|
|
428
|
+
// Input's.
|
|
429
|
+
"h-full flex-1 rounded-none border-0 bg-transparent hover:bg-transparent focus-visible:outline-0 disabled:opacity-100 aria-invalid:border-0 aria-invalid:hover:bg-transparent",
|
|
114
430
|
className
|
|
115
431
|
),
|
|
116
432
|
...props
|
|
@@ -123,7 +439,31 @@ function InputGroupTextarea({ className, ...props }) {
|
|
|
123
439
|
{
|
|
124
440
|
"data-slot": "input-group-control",
|
|
125
441
|
className: cn(
|
|
126
|
-
|
|
442
|
+
// Identical contract to InputGroupInput, because Textarea is now
|
|
443
|
+
// Input's twin: same `--input-*` tokens, same outline focus treatment,
|
|
444
|
+
// same `aria-invalid:border-2`. The group owns all three, so the same
|
|
445
|
+
// three neutralisers apply, for the same tailwind-merge reason
|
|
446
|
+
// (`outline-0` / `border-0` land in Button's own conflict groups and
|
|
447
|
+
// drop its utilities from the class string rather than racing them).
|
|
448
|
+
// `disabled:opacity-100` for the same reason as InputGroupInput: the
|
|
449
|
+
// group owns the disabled fade now, and two 50% layers would compound.
|
|
450
|
+
//
|
|
451
|
+
// The two `hover:bg-transparent` neutralisers are here for the reason
|
|
452
|
+
// InputGroupInput documents above, and were missing: `bg-transparent`
|
|
453
|
+
// and `hover:bg-*` are different tailwind-merge keys, so Textarea's own
|
|
454
|
+
// `hover:bg-(--input-surface-hover)` survived on the element and
|
|
455
|
+
// outranks the flat `bg-transparent` on specificity. This box is
|
|
456
|
+
// `rounded-none` inside the group's `rounded-sm`, and the group only
|
|
457
|
+
// clips when it holds an action — so a hover surface painted by the
|
|
458
|
+
// control itself can square off the group's corner notch, which is the
|
|
459
|
+
// artefact the input's copies exist to prevent. Restores the "identical
|
|
460
|
+
// contract to InputGroupInput" this comment claims.
|
|
461
|
+
"flex-1 rounded-none border-0 bg-transparent hover:bg-transparent focus-visible:outline-0 disabled:opacity-100 aria-invalid:border-0 aria-invalid:hover:bg-transparent",
|
|
462
|
+
// Only the vertical padding differs from Textarea's own: the design's
|
|
463
|
+
// writing surface is `12px 16px`, and Textarea ships `py-2`. Its
|
|
464
|
+
// `min-h-24` (96px) and `px-4` already match the design, so restating
|
|
465
|
+
// them here would be dead weight.
|
|
466
|
+
"py-3",
|
|
127
467
|
className
|
|
128
468
|
),
|
|
129
469
|
...props
|
|
@@ -131,6 +471,6 @@ function InputGroupTextarea({ className, ...props }) {
|
|
|
131
471
|
);
|
|
132
472
|
}
|
|
133
473
|
|
|
134
|
-
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
474
|
+
export { InputGroup, InputGroupAction, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, inputGroupActionVariants };
|
|
135
475
|
//# sourceMappingURL=input-group.js.map
|
|
136
476
|
//# sourceMappingURL=input-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/input-group.tsx"],"names":[],"mappings":";;;;;;;AAUA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACxE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,IAAA,EAAK,OAAA;AAAA,MACL,SAAA,EAAW,EAAA;AAAA,QACT,4nCAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,MAAM,uBAAA,GAA0B,GAAA;AAAA,EAC9B,oXAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,KAAA,EAAO;AAAA,QACL,cAAA,EAAgB,yEAAA;AAAA,QAChB,YAAA,EAAc,wEAAA;AAAA,QACd,aAAA,EACE,iGAAA;AAAA,QACF,WAAA,EACE;AAAA;AACJ,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,KAAA,EAAO;AAAA;AACT;AAEJ,CAAA;AAEA,SAAS,eAAA,CAAgB;AAAA,EACvB,SAAA;AAAA,EACA,KAAA,GAAQ,cAAA;AAAA,EACR,GAAG;AACL,CAAA,EAA+E;AAC7E,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,OAAA;AAAA,MACL,WAAA,EAAU,mBAAA;AAAA,MACV,YAAA,EAAY,KAAA;AAAA,MACZ,WAAW,EAAA,CAAG,uBAAA,CAAwB,EAAE,KAAA,EAAO,GAAG,SAAS,CAAA;AAAA,MAC3D,OAAA,EAAS,CAAC,CAAA,KAAM;AACd,QAAA,IAAK,CAAA,CAAE,MAAA,CAAuB,OAAA,CAAQ,QAAQ,CAAA,EAAG;AAC/C,UAAA;AAAA,QACF;AACA,QAAA,CAAA,CAAE,aAAA,CAAc,a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,QACT,6HAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,kBAAA,CAAmB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAqC;AACrF,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,8IAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"input-group.js","sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\nimport { Button } from './button.js'\nimport { Input } from './input.js'\nimport { Textarea } from './textarea.js'\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='input-group'\n role='group'\n className={cn(\n 'group/input-group relative flex h-7 w-full min-w-0 items-center rounded-sm border border-input bg-input/20 transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-sm has-data-[align=block-start]:rounded-sm has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-sm has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pe-1.5 has-[>[data-align=inline-start]]:[&>input]:ps-1.5',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst inputGroupAddonVariants = cva(\n \"flex h-auto cursor-text items-center justify-center gap-1 py-2 text-xs/relaxed font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5\",\n {\n variants: {\n align: {\n 'inline-start': 'order-first ps-2 has-[>button]:ms-[-0.275rem] has-[>kbd]:ms-[-0.275rem]',\n 'inline-end': 'order-last pe-2 has-[>button]:me-[-0.275rem] has-[>kbd]:me-[-0.275rem]',\n 'block-start':\n 'order-first w-full justify-start px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2',\n 'block-end':\n 'order-last w-full justify-start px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2',\n },\n },\n defaultVariants: {\n align: 'inline-start',\n },\n },\n)\n\nfunction InputGroupAddon({\n className,\n align = 'inline-start',\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n role='group'\n data-slot='input-group-addon'\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest('button')) {\n return\n }\n e.currentTarget.parentElement?.querySelector<HTMLElement>('input, textarea')?.focus()\n }}\n {...props}\n />\n )\n}\n\nconst inputGroupButtonVariants = cva(\n 'flex items-center gap-2 rounded-sm text-xs/relaxed shadow-none',\n {\n variants: {\n size: {\n xs: \"h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3\",\n sm: 'gap-1',\n 'icon-xs': 'size-6 p-0 has-[>svg]:p-0',\n 'icon-sm': 'size-7 p-0 has-[>svg]:p-0',\n },\n },\n defaultVariants: {\n size: 'xs',\n },\n },\n)\n\nfunction InputGroupButton({\n className,\n type = 'button',\n variant = 'ghost',\n size = 'xs',\n ...props\n}: Omit<React.ComponentProps<typeof Button>, 'size' | 'type'> &\n VariantProps<typeof inputGroupButtonVariants> & {\n type?: 'button' | 'submit' | 'reset'\n }) {\n return (\n <Button\n type={type}\n data-size={size}\n variant={variant}\n className={cn(inputGroupButtonVariants({ size }), className)}\n {...props}\n />\n )\n}\n\nfunction InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n className={cn(\n \"flex items-center gap-2 text-xs/relaxed text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupInput({ className, ...props }: React.ComponentProps<'input'>) {\n return (\n <Input\n data-slot='input-group-control'\n className={cn(\n 'flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupTextarea({ className, ...props }: React.ComponentProps<'textarea'>) {\n return (\n <Textarea\n data-slot='input-group-control'\n className={cn(\n 'flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n InputGroupText,\n InputGroupTextarea,\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/input-group.tsx"],"names":[],"mappings":";;;;;;;AAUA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACxE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,IAAA,EAAK,OAAA;AAAA,MACL,SAAA,EAAW,EAAA;AAAA;AAAA;AAAA;AAAA,QAIT,4GAAA;AAAA;AAAA;AAAA;AAA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A;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,kBAAA,CAAmB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAqC;AACrF,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAoBT,uKAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAKA,MAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ","file":"input-group.js","sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\nimport { Button } from './button.js'\nimport { Input } from './input.js'\nimport { Textarea } from './textarea.js'\n\nfunction InputGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='input-group'\n role='group'\n className={cn(\n // No `outline-none` here: it sets `--tw-outline-style: none` on this\n // element, which then suppresses the focus outline below (which reads\n // `outline-style: var(--tw-outline-style)`).\n 'group/input-group relative flex h-12 w-full min-w-0 items-stretch rounded-sm motion-safe:transition-colors',\n // Every colour routes through the --input-* semantic tokens (layer 3,\n // theme.css / the registry theme item) — the same set Input uses, so a\n // group and a bare input are the same control. The role tokens behind\n // them are mode-aware, so there are no dark: variants here.\n 'border border-(--input-border) bg-(--input-surface)',\n // Hover — owned by the wrapper so the whole control reacts, addons\n // included, rather than just the inner control's box.\n //\n // Known nuance, deliberately NOT fixed here: hovering an embedded\n // button also paints this surface, so the 464px field greys behind a\n // control the pointer is only 85px inside. Suppressing it with\n // `has-[button:hover]:bg-(--input-surface)` works for the button, but\n // measurably breaks the ordinary field hover on any group holding a\n // button — Chromium stops re-evaluating the plain `:hover` rule on a\n // subject that also carries a `:has(…:hover)` rule, so the field hover\n // silently stopped painting at all. Losing the common interaction to\n // sharpen the rare one is the wrong trade. Revisit if the group ever\n // gains a wrapper that can own hover without `:has()`.\n 'hover:bg-(--input-surface-hover)',\n // Disabled — owned by the wrapper, because the control is only PART of\n // this control. Input's `disabled:opacity-50` fades its own box and\n // nothing else, so a disabled group rendered a full-strength border, a\n // full-strength affix panel and a text cursor over dead chrome:\n // measurably identical to an enabled group on every property except\n // the input's text. Fading the wrapper reproduces a disabled bare\n // Input, where one element carries border, surface and text together.\n // The children neutralise their own `disabled:opacity-50` so the two\n // layers cannot compound to 0.25.\n 'has-[[data-slot=input-group-control]:disabled]:opacity-50',\n // Focus — the group draws one outline for whichever control is focused;\n // InputGroupInput / InputGroupTextarea suppress their own. Offset and\n // colour are unconditional because neither renders anything until\n // `outline-2` supplies an outline-style, and keeping them off the\n // has-[] variant leaves the invalid colour below a plain specificity\n // win instead of a source-order tie between two has-[] rules.\n 'outline-offset-2 outline-(--input-ring)',\n 'has-[[data-slot=input-group-control]:focus-visible]:outline-2',\n // Invalid — 2px danger border, danger hover surface and danger focus\n // outline, mirroring Input's aria-invalid treatment. Each rule carries\n // the has-[] selector, so it outranks its unqualified counterpart on\n // specificity rather than on emission order.\n 'has-[[data-slot][aria-invalid=true]]:border-2 has-[[data-slot][aria-invalid=true]]:border-(--input-invalid-border)',\n 'has-[[data-slot][aria-invalid=true]]:outline-(--input-invalid-ring)',\n 'has-[[data-slot][aria-invalid=true]]:hover:bg-(--input-invalid-surface-hover)',\n // An InputGroupAction sits flush to the trailing edge with square\n // corners, so the group clips it to its own radius — cheaper and\n // RTL-correct next to per-corner arithmetic on the action. Scoped to\n // groups that actually hold one: a bare `overflow-hidden` would clip\n // DESCENDANT outlines, and InputGroupButton's focus ring sits 2px\n // outside itself, so every Combobox chevron would lose its ring.\n 'has-[[data-slot=input-group-action]]:overflow-hidden',\n // Block-aligned addons stack the group and let it grow to fit\n 'has-data-[align=block-end]:rounded-sm has-data-[align=block-start]:rounded-sm has-[textarea]:rounded-sm',\n 'has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto',\n // Addon-driven padding on the inner input\n 'has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst inputGroupAddonVariants = cva(\n // `--input-placeholder` is the input token set's de-emphasised-text role, and\n // an icon or text affix is exactly that — so addons restyle with the input\n // rather than drifting from it. Mode-aware, hence no dark: variants.\n //\n // Type and glyphs are sized off the control's own `text-base`, not off the\n // box. An affix sits on the same line as the value, so 16px is the floor —\n // the old `text-xs/relaxed` (12px) and 10px kbd were scaled for the 28px\n // group this component used to be and read as fine print beside 16px input\n // text. Glyphs are `size-5` (20px), 1.25x the label, the same reasoning\n // button.tsx documents for a label glyph.\n // An addon holding an InputGroupAction yields its own padding on that edge so\n // the action reaches the group's inner border, and takes a 48px floor so the\n // row still has height once the padding is gone (the affix text centres in\n // it via `items-center`). Each override carries the has-[] selector, so it\n // outranks the base padding on specificity rather than on emission order.\n // The affix advertises a text caret because clicking it focuses the control.\n // Over a DISABLED control that is a lie, so it takes the same\n // `cursor-not-allowed` the control itself does — keyed on the control rather\n // than on the group's `data-disabled`, which nothing in the component ever\n // sets (the opacity hook below has the same gap and is left as the manual\n // escape hatch it already was).\n \"flex cursor-text items-center justify-center gap-1 text-base text-(--input-placeholder) select-none group-has-[[data-slot=input-group-control]:disabled]/input-group:cursor-not-allowed group-data-[disabled=true]/input-group:opacity-50 has-[[data-slot=input-group-action]]:min-h-12 has-[[data-slot=input-group-action]]:py-0 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-(--input-placeholder)/10 **:data-[slot=kbd]:px-1 [&>svg:not([class*='size-'])]:size-5\",\n {\n variants: {\n align: {\n // No negative nudge for buttons. `me-[-0.275rem]` was tuned to cancel a\n // 20px `px-1` button in the 28px group this component used to be; at\n // 32px and `px-3` it under-compensates and left the inline button 3.6px\n // off the group's inner edge while the block-end row sat at 8px. Every\n // inset is now that same 8px, so affixes, buttons and footer rows all\n // land on one grid. The kbd nudge stays — a kbd chip is small enough\n // that the optical correction still reads.\n // ONE hairline colour for the whole control: `--input-border`, the same\n // token the group's own edge uses. The mockup drew internal dividers in\n // the lighter `--border-default`, but mixing the two put a #dcdfe0\n // divider beside a #888f92 seam and outer edge, which reads as the\n // junctions being heavier rather than as a hierarchy. It also fixes\n // dark mode: `--border-default` measures 1.12:1 on the dark surface,\n // under the 3:1 floor for a boundary that has to identify a control.\n //\n // The leading affix is a CELL, not floating text: a recessed fill, a\n // hairline on its inner edge, and the group's full height. This is what\n // makes the trailing action read as its mirror — the approved design's\n // words were \"the trailing cell mirrors the leading AUD cell exactly\".\n // 16px padding matches the value's own, so affix and value sit on one\n // rhythm.\n // Weight lives per align, not in the base: the design sets the inline\n // affix at 600 (`.affix`) but the block row's hint at 300\n // (`.foot .hint`). A base `font-semibold` made \"Markdown supported\"\n // read as a label at the same weight as the AUD affix.\n //\n // No kbd nudge here any more. `ms-[-0.275rem]` was harmless while this\n // addon was transparent text; now that it paints a fill, a border-inline\n // -end and a rounded start corner, a negative start margin drags the\n // whole cell out past the group's own border.\n 'inline-start':\n 'order-first rounded-s-[calc(var(--radius-sm)-1px)] border-e border-(--input-border) bg-(--surface-sunken) px-4 font-semibold has-[[data-slot=input-group-action]]:ms-0 has-[[data-slot=input-group-action]]:items-stretch has-[[data-slot=input-group-action]]:p-0',\n 'inline-end':\n 'order-last px-2 font-semibold has-[[data-slot=input-group-action]]:me-0 has-[[data-slot=input-group-action]]:items-stretch has-[[data-slot=input-group-action]]:p-0 has-[>kbd]:me-[-0.275rem]',\n // Block addons are chrome, not content, so they carry the boundary the\n // Hairline Rule asks for and sit on the recessed surface. Without both\n // the row floats in the writing area with nothing dividing it.\n //\n // `--surface-sunken`, NOT `--background-subtle`: the latter resolves to\n // the same value as `--surface-default` in dark, so the tint vanishes\n // there. Sunken differs from the group's surface in BOTH modes.\n //\n // The corners are rounded rather than clipped by the group: a group-level\n // `overflow-hidden` would cut off the focus ring of any button inside\n // the row, since Button rings 2px outside itself.\n 'block-start':\n 'order-first min-h-12 w-full justify-start rounded-t-[calc(var(--radius-sm)-1px)] border-b border-(--input-border) bg-(--surface-sunken) px-4 font-light has-[[data-slot=input-group-action]]:items-stretch has-[[data-slot=input-group-action]]:pe-0',\n 'block-end':\n 'order-last min-h-12 w-full justify-start rounded-b-[calc(var(--radius-sm)-1px)] border-t border-(--input-border) bg-(--surface-sunken) px-4 font-light has-[[data-slot=input-group-action]]:items-stretch has-[[data-slot=input-group-action]]:pe-0',\n },\n },\n defaultVariants: {\n align: 'inline-start',\n },\n },\n)\n\nfunction InputGroupAddon({\n className,\n align = 'inline-start',\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>) {\n return (\n <div\n role='group'\n data-slot='input-group-addon'\n data-align={align}\n className={cn(inputGroupAddonVariants({ align }), className)}\n onClick={(e) => {\n if ((e.target as HTMLElement).closest('button')) {\n return\n }\n e.currentTarget.parentElement?.querySelector<HTMLElement>('input, textarea')?.focus()\n }}\n {...props}\n />\n )\n}\n\nconst inputGroupButtonVariants = cva(\n [\n // No font-size here: Button already sets `text-base/7`, and the\n // `text-xs/relaxed` this used to carry shrank its label to 12px.\n // `before:shadow-none`, NOT `shadow-none`. Button paints its drop shadow on\n // the `::before` fill layer (`before:shadow-sm` in the soft and solid\n // variants), never on the button box — so `shadow-none` was doubly dead:\n // wrong element, and a different tailwind-merge key, so both classes\n // survived and the shadow rendered. Measured: `::before` box-shadow was\n // `rgba(0,0,0,.1) 0 1px 3px`, a cast shadow inside flat hairline chrome.\n 'flex items-center gap-2 rounded-sm before:shadow-none',\n // Every size below was inert until this line. Button pins\n // `min-h-(--btn-h)` — 52px at the default step, 60px below `sm` — which\n // outranks a plain `h-*` because they are different properties, so an\n // `xs` button rendered at full size and inflated the row it sat in.\n 'min-h-0',\n // Button's padding is a RESPONSIVE pair (`py-[…] sm:py-[…]`), and a media\n // query adds no specificity, so an unprefixed override loses to the `sm:`\n // rule on emission order. Restating both halves (`py-0 sm:py-0`) fixes the\n // render but pairs a bare utility with a conditional one on the same\n // property — check:cascade rejects that, and rightly: a consumer whose own\n // build emits `.py-0` can have their copy land last on our element.\n //\n // `data-size` is always set by InputGroupButton, so an attribute selector\n // is 0,2,0 against the media rule's 0,1,0 and wins at every width, with no\n // second rule to order against.\n 'data-[size]:py-0',\n // Same reason as InputGroupAction: zeroing Button's padding exposes its\n // `items-baseline` base, which no longer centres the label.\n 'items-center',\n // Same neutraliser InputGroupAction carries, and for the same reason: the\n // group fades for a disabled control, and Button's own\n // `data-disabled:opacity-50` would multiply into it. Measured at 0.25\n // before this line — Combobox is the live case, since ComboboxInput passes\n // `disabled` to the control AND to the trigger and clear buttons at once.\n // Conditioned on the CONTROL, so a button disabled beside a live field\n // still dims on its own.\n 'group-has-[[data-slot=input-group-control]:disabled]/input-group:disabled:opacity-100',\n ],\n {\n variants: {\n // Heights are capped at 32px: the addon pads 8px top and bottom inside a\n // 48px group, so anything taller re-inflates the row it is meant to sit\n // inside. `sm` buys horizontal room rather than height for that reason.\n size: {\n xs: \"h-8 gap-1 rounded-[calc(var(--radius-sm)-1px)] data-[size=xs]:px-3 [&>svg:not([class*='size-'])]:size-5\",\n sm: \"h-8 gap-1 rounded-[calc(var(--radius-sm)-1px)] data-[size=sm]:px-4 [&>svg:not([class*='size-'])]:size-5\",\n 'icon-xs': 'size-7 data-[size=icon-xs]:px-0',\n 'icon-sm': 'size-8 data-[size=icon-sm]:px-0',\n },\n },\n defaultVariants: {\n size: 'xs',\n },\n },\n)\n\n/**\n * The inline button inside an addon — a secondary action or an icon\n * affordance, as opposed to `InputGroupAction`, which attaches to the group's\n * trailing edge.\n *\n * Defaults to `soft` rather than `ghost`: a ghost button inside a control is\n * bare text with no shape, location or formatting to signal it is pressable,\n * which is the one thing an affordance has to do without being hovered. `soft`\n * gives it a 10% ink chip and stays quieter than the attached action beside\n * it. Icon affordances that should stay bare — Combobox's chevron and clear —\n * pass `variant='ghost'` explicitly and are unaffected.\n */\nfunction InputGroupButton({\n className,\n type = 'button',\n variant = 'soft',\n size = 'xs',\n ...props\n}: Omit<React.ComponentProps<typeof Button>, 'size' | 'type'> &\n VariantProps<typeof inputGroupButtonVariants> & {\n type?: 'button' | 'submit' | 'reset'\n }) {\n return (\n <Button\n type={type}\n data-slot='input-group-button'\n data-size={size}\n variant={variant}\n className={cn(inputGroupButtonVariants({ size }), className)}\n {...props}\n />\n )\n}\n\nconst inputGroupActionVariants = cva(\n [\n // Fills the group's height and sits flush against its trailing edge — one\n // block, not a button floating in addon padding. Button pins\n // `min-h-(--btn-h)` (52px at the default step, 60px below `sm`), which a\n // 48px group cannot hold, so `self-stretch` sizes the segment off the group\n // and `min-h-0` clears the floor.\n //\n // `min-h-0`, NOT `[--btn-h:0px]`: the size step publishes its height through\n // a RESPONSIVE pair (`[--btn-h:…] sm:[--btn-h:…]`), and a media query adds\n // no specificity, so an unprefixed custom-property override loses to the\n // `sm:` rule on emission order alone. Overriding the property itself lands\n // in tailwind-merge's `min-h` group and drops Button's utility outright.\n 'h-auto min-h-0 self-stretch',\n // Square: the group re-rounds the one outer corner by clipping (see\n // `has-[[data-slot=input-group-action]]:overflow-hidden` on InputGroup), so\n // there is no corner arithmetic here. The `before`/`after` fill layers are\n // squared too — left at `calc(var(--radius-sm)-1px)` they notch the flush\n // edges.\n 'rounded-none before:rounded-none after:rounded-none dark:after:rounded-none',\n // Flush against the value: no optical border, and no shadow — a `shadow-sm`\n // whisper belongs under a button sitting on the page, not one inset into a\n // control. Padding is restated for both breakpoints because Button's is a\n // responsive pair (see the min-h note above).\n // Padding is keyed on `data-slot` rather than restated at both breakpoints:\n // Button's own padding is a responsive pair, and a bare-plus-conditional\n // override of the same property is what check:cascade forbids. The\n // attribute selector is 0,2,0 and wins at every width on specificity.\n 'border-0 before:shadow-none data-[slot=input-group-action]:px-5 data-[slot=input-group-action]:py-0',\n // The seam colour is owned here, for both modes, in the ALL-SIDES form.\n // Button's ghost/soft/solid each set `dark:border-white/5`, which is a\n // border-color shorthand — an inline-start longhand would only beat it by\n // emission order, and white at 5% measures 1.12:1 on the dark surface, so\n // the seam vanished there. Matching the shorthand puts both in one\n // tailwind-merge group and drops Button's outright. Width stays 0 except\n // where a variant below asks for it, so only that one edge paints.\n 'border-(--input-border) dark:border-(--input-border)',\n // Focus draws INSIDE the segment: Button's default `outline-offset-2` puts\n // the ring on the page, which the clipping group cuts off.\n // `items-center`, because Button's base is `items-baseline`. Baseline\n // alignment only looks centred while Button's own vertical padding\n // balances the line box; with `py-0` and a stretched box it parked the\n // label 9px above centre in a 46px segment. Measured, not eyeballed.\n // The focus ring is stated in full here rather than inherited. Button\n // publishes it as four classes (`focus:outline`, `focus:outline-2`,\n // `focus:outline-offset-2`, `focus:outline-(--btn-bg)`); overriding only the\n // offset left the rendered ring at the browser default — measured\n // `solid 1.5px offset 0px`, not the designed 2px inset. Restating width and\n // offset makes the treatment independent of what tailwind-merge does to\n // Button's copies.\n //\n // Colour is `--input-ring`, the token the GROUP rings itself with, so a\n // focused segment matches the control it sits in instead of borrowing the\n // button system's brand ink. iterate-1.css:\n // `.it .act:focus-visible { outline: 2px solid var(--input-ring); outline-offset: -2px }`.\n 'items-center font-semibold focus:outline-2 focus:-outline-offset-2 focus:outline-(--input-ring)',\n // Keep Button's own `disabled:opacity-50` for the common case where only\n // the action is disabled (an Apply that waits for a valid value) and the\n // field beside it stays live. Drop it only when the GROUP is already\n // fading for a disabled control, where the two layers would compound to\n // 0.25. Conditioning on the control — not on this button's own state —\n // is what separates the two cases.\n 'group-has-[[data-slot=input-group-control]:disabled]/input-group:disabled:opacity-100',\n ],\n {\n variants: {\n // Three fills, mapped onto Button's own variants so hover, active and\n // dark-mode handling come from the button system rather than being\n // restated here. `open` and `subtle` have little or no fill contrast\n // against the input surface, so both carry a leading hairline to read as\n // a distinct cell; `solid` needs one only in dark (see below).\n variant: {\n // `open` and `subtle` have no usable fill contrast against the input\n // surface (1:1 and 1.69:1 measured in dark), so both are bounded by a\n // leading hairline in every mode. Colour comes from the base above.\n // The seam is keyed on `data-variant-action` (stamped below) so it beats\n // `border-0` on SPECIFICITY (0,2,0 vs 0,1,0). As a bare `border-s` it\n // did not: tailwind-merge keeps BOTH `border-0` and `border-s` (verified\n // — `border-w-s` invalidates nothing), `border-width:0` expands to the\n // physical longhands and collides with `border-inline-start-width` at\n // equal specificity, so only emission order separated them. Ours wins\n // today by 199 bytes in dist/styles.css; a consuming app that emits its\n // own `.border-0` after ours would reset the seam to 0 and `open` would\n // lose the only thing delineating it. check:cascade cannot catch this —\n // it only flags conditional at-rule pairs.\n open: 'bg-transparent data-[variant-action=open]:border-s',\n subtle: 'data-[variant-action=subtle]:border-s',\n // Button rings in `--btn-bg`, which for a solid button IS the fill, so\n // the inset ring above would be navy-on-navy. `--btn-text` is the label\n // colour: 14.37:1 on the fill in both modes.\n //\n // The dark seam is not decoration. Button's `primary` reads the\n // masterbrand ramp (--color-primary-800, Blue 01), which is\n // theme-invariant, so on the dark group surface the fill measures\n // 1.32:1 — under the 3:1 floor for identifying a UI component. The\n // other three edges are bounded by the group's own border; this\n // continues that hairline inward. Light needs none at 15.26:1, and a\n // grey seam there would read as a gap.\n solid: 'focus:outline-(--btn-text) data-[variant-action=solid]:dark:border-s',\n },\n },\n defaultVariants: {\n variant: 'solid',\n },\n },\n)\n\n/** Maps this component's fill names onto Button's variant names. */\nconst inputGroupActionButtonVariant = {\n open: 'ghost',\n subtle: 'soft',\n solid: 'solid',\n} as const\n\nfunction InputGroupAction({\n className,\n type = 'button',\n variant = 'solid',\n ...props\n}: Omit<React.ComponentProps<typeof Button>, 'size' | 'type' | 'variant'> &\n VariantProps<typeof inputGroupActionVariants> & {\n type?: 'button' | 'submit' | 'reset'\n }) {\n return (\n <Button\n type={type}\n data-slot='input-group-action'\n data-variant-action={variant}\n variant={inputGroupActionButtonVariant[variant ?? 'solid']}\n className={cn(inputGroupActionVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n className={cn(\n // Matches the addon it sits in: 16px type, `--input-placeholder` ink,\n // and a nested glyph the same size as one beside it.\n \"flex items-center gap-2 text-base text-(--input-placeholder) [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-5\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupInput({ className, ...props }: React.ComponentProps<'input'>) {\n return (\n <Input\n data-slot='input-group-control'\n className={cn(\n // The group owns the box, so fill its height (Input is `h-12` on its\n // own) and drop the border, surface and radius to let the group's\n // chrome show through.\n //\n // The hover surfaces must be neutralised too, even though the group\n // paints the identical token: this control is `rounded-none` and\n // `flex-1`, so with no inline-end addon its right edge lands 1px\n // inside the group's border and its SQUARE corner fills the group's\n // `rounded-sm` corner notch. Same colour, wrong shape — the group's\n // own paint is clipped to its radius, the control's is not. Letting\n // only the group paint keeps the corners round in both the default\n // and the aria-invalid state (where the notch is 2px, not 1px).\n //\n // `outline-0` / `border-0` rather than `outline-none` / `border-none`:\n // tailwind-merge treats those as the same group as Input's\n // `focus-visible:outline-2` / `aria-invalid:border-2` and drops them\n // from the class string outright, so there is never a pair of\n // same-specificity rules whose winner depends on stylesheet order.\n // `disabled:opacity-100` because the GROUP now fades for a disabled\n // control (see InputGroup). Whenever this rule can fire, the group's\n // has-[] rule has fired too, so leaving Input's own 50% in place would\n // multiply to 0.25 and render the value fainter than a bare disabled\n // Input's.\n 'h-full flex-1 rounded-none border-0 bg-transparent hover:bg-transparent focus-visible:outline-0 disabled:opacity-100 aria-invalid:border-0 aria-invalid:hover:bg-transparent',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction InputGroupTextarea({ className, ...props }: React.ComponentProps<'textarea'>) {\n return (\n <Textarea\n data-slot='input-group-control'\n className={cn(\n // Identical contract to InputGroupInput, because Textarea is now\n // Input's twin: same `--input-*` tokens, same outline focus treatment,\n // same `aria-invalid:border-2`. The group owns all three, so the same\n // three neutralisers apply, for the same tailwind-merge reason\n // (`outline-0` / `border-0` land in Button's own conflict groups and\n // drop its utilities from the class string rather than racing them).\n // `disabled:opacity-100` for the same reason as InputGroupInput: the\n // group owns the disabled fade now, and two 50% layers would compound.\n //\n // The two `hover:bg-transparent` neutralisers are here for the reason\n // InputGroupInput documents above, and were missing: `bg-transparent`\n // and `hover:bg-*` are different tailwind-merge keys, so Textarea's own\n // `hover:bg-(--input-surface-hover)` survived on the element and\n // outranks the flat `bg-transparent` on specificity. This box is\n // `rounded-none` inside the group's `rounded-sm`, and the group only\n // clips when it holds an action — so a hover surface painted by the\n // control itself can square off the group's corner notch, which is the\n // artefact the input's copies exist to prevent. Restores the \"identical\n // contract to InputGroupInput\" this comment claims.\n 'flex-1 rounded-none border-0 bg-transparent hover:bg-transparent focus-visible:outline-0 disabled:opacity-100 aria-invalid:border-0 aria-invalid:hover:bg-transparent',\n // Only the vertical padding differs from Textarea's own: the design's\n // writing surface is `12px 16px`, and Textarea ships `py-2`. Its\n // `min-h-24` (96px) and `px-4` already match the design, so restating\n // them here would be dead weight.\n 'py-3',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport {\n InputGroup,\n InputGroupAction,\n inputGroupActionVariants,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n InputGroupText,\n InputGroupTextarea,\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
5
5
|
declare const linkVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "white" | "primary" | "secondary" | "unstyled" | null | undefined;
|
|
7
7
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
8
8
|
type LinkComponent = React__default.ElementType;
|
|
9
9
|
/**
|
|
@@ -10,7 +10,7 @@ declare const mastheadColors: {
|
|
|
10
10
|
};
|
|
11
11
|
type MastheadColor = keyof typeof mastheadColors;
|
|
12
12
|
declare const mastheadVariants: (props?: ({
|
|
13
|
-
color?: "
|
|
13
|
+
color?: "light" | "white" | "grey" | "dark" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
declare const mastheadContainerVariants: (props?: ({
|
|
16
16
|
container?: "fluid" | "contained" | null | undefined;
|
|
@@ -3,7 +3,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
5
5
|
declare const skipLinkVariants: (props?: ({
|
|
6
|
-
color?: "
|
|
6
|
+
color?: "light" | "white" | "grey" | "dark" | null | undefined;
|
|
7
7
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
8
8
|
type SkipLinkProps = React__default.ComponentPropsWithoutRef<'a'> & VariantProps<typeof skipLinkVariants> & {
|
|
9
9
|
/** Same-page fragment target, e.g. `"#content"`. */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
declare function Textarea({ className, ...props }: React.ComponentProps<'textarea'>): React.JSX.Element;
|
|
3
|
+
declare function Textarea({ className, ref, ...props }: React.ComponentProps<'textarea'>): React.JSX.Element;
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type TextareaProps = React.ComponentProps<typeof Textarea>;
|
|
6
|
+
|
|
7
|
+
export { Textarea, type TextareaProps };
|