@nswds/ui 7.0.0 → 7.0.1
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/header.d.ts +1 -1
- package/dist/components/input-group.d.ts +6 -0
- package/dist/components/input-group.js +140 -47
- 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/styles.css +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import { Link } from './link.js';
|
|
|
6
6
|
|
|
7
7
|
declare const badgeVariants: (props?: ({
|
|
8
8
|
variant?: "solid" | "soft" | "surface" | "outline" | null | undefined;
|
|
9
|
-
color?: "primary
|
|
9
|
+
color?: "primary" | "secondary" | "white" | "accent" | "grey" | "tertiary" | "primary/grey" | "light" | "primary/white" | null | undefined;
|
|
10
10
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
11
11
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
12
|
type BadgeProps = VariantProps<typeof badgeVariants> & React__default.ComponentPropsWithoutRef<'span'> & {
|
|
@@ -5,8 +5,8 @@ import React__default from 'react';
|
|
|
5
5
|
import { Link } from './link.js';
|
|
6
6
|
|
|
7
7
|
declare const buttonVariants: (props?: ({
|
|
8
|
-
variant?: "
|
|
9
|
-
color?: "
|
|
8
|
+
variant?: "link" | "solid" | "soft" | "surface" | "outline" | "ghost" | null | undefined;
|
|
9
|
+
color?: "primary" | "secondary" | "white" | "accent" | "grey" | "tertiary" | "danger" | "success" | "warning" | null | undefined;
|
|
10
10
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
11
11
|
iconOnly?: boolean | null | undefined;
|
|
12
12
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -30,7 +30,7 @@ declare const headerColors: {
|
|
|
30
30
|
};
|
|
31
31
|
type HeaderColor = keyof typeof headerColors;
|
|
32
32
|
declare const headerVariants: (props?: ({
|
|
33
|
-
color?: "
|
|
33
|
+
color?: "white" | "grey" | "light" | "dark" | null | undefined;
|
|
34
34
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
35
35
|
declare const headerContainerVariants: (props?: ({
|
|
36
36
|
container?: "fluid" | "contained" | null | undefined;
|
|
@@ -5,6 +5,12 @@ import { Button } from './button.js';
|
|
|
5
5
|
import '@base-ui/react/button';
|
|
6
6
|
import './link.js';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* `data-disabled="true"` styles group chrome only. Set `disabled` on each
|
|
10
|
+
* InputGroupInput / InputGroupTextarea that should be inactive; the hook does
|
|
11
|
+
* not disable, fade, or prevent focus on descendants. Buttons own their state
|
|
12
|
+
* independently, so an action can remain enabled beside a disabled control.
|
|
13
|
+
*/
|
|
8
14
|
declare function InputGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
9
15
|
declare const inputGroupAddonVariants: (props?: ({
|
|
10
16
|
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
@@ -36,16 +36,53 @@ function InputGroup({ className, ...props }) {
|
|
|
36
36
|
// sharpen the rare one is the wrong trade. Revisit if the group ever
|
|
37
37
|
// gains a wrapper that can own hover without `:has()`.
|
|
38
38
|
"hover:bg-(--input-surface-hover)",
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
|
|
39
|
+
// ...but a disabled group must not react at all. A standalone Input
|
|
40
|
+
// cannot: `disabled:pointer-events-none` means `:hover` never matches
|
|
41
|
+
// it. This wrapper is a plain div, and `pointer-events` on the CONTROL
|
|
42
|
+
// does not stop its ancestor being hovered, so without this line a dead
|
|
43
|
+
// field painted the full enabled hover surface — measured with a real
|
|
44
|
+
// pointer at `--input-surface-hover`, identical to an enabled group.
|
|
45
|
+
// `pointer-events-none` on the wrapper is not the fix: it would also
|
|
46
|
+
// kill an enabled action sitting inside a disabled-field group.
|
|
47
|
+
//
|
|
48
|
+
// Mirrored for `data-disabled`, the manual escape hatch the addon also
|
|
49
|
+
// honours. Every wrapper rule keyed on a disabled control needs its
|
|
50
|
+
// twin so the hook consistently styles the chrome — previously the
|
|
51
|
+
// addon's hairline faded and its cursor changed while this border and
|
|
52
|
+
// hover surface stayed fully live.
|
|
53
|
+
"has-[[data-slot=input-group-control]:disabled]:hover:bg-(--input-surface)",
|
|
54
|
+
"data-[disabled=true]:hover:bg-(--input-surface)",
|
|
55
|
+
// Disabled — the group fades its own CHROME: this border, plus the
|
|
56
|
+
// addon's hairline and cursor. Every child owns its own state, and
|
|
57
|
+
// nothing in this component puts `opacity` on an ancestor.
|
|
58
|
+
//
|
|
59
|
+
// The wrapper-opacity version of this shipped briefly and was wrong:
|
|
60
|
+
// ancestor opacity composites the whole subtree and a child cannot opt
|
|
61
|
+
// out of it, so an ENABLED action beside a disabled field rendered at
|
|
62
|
+
// 50% — measured white-on-navy at 3.12:1, under the 4.5:1 floor, on a
|
|
63
|
+
// button that was still clickable. A control that looks disabled and
|
|
64
|
+
// isn't is worse than the chrome bug it replaced. It also forced
|
|
65
|
+
// `opacity-100` neutralisers onto four children to stop 0.5 x 0.5
|
|
66
|
+
// compounding, and those only worked for natively `:disabled` targets.
|
|
67
|
+
// Fading the chrome directly needs no neutralisers and cannot compound.
|
|
68
|
+
//
|
|
69
|
+
// `not-has-[…aria-invalid…]` is load-bearing, not belt-and-braces. This
|
|
70
|
+
// rule and the aria-invalid border rule below both set `border-color`
|
|
71
|
+
// at identical specificity — `:has()` takes its most specific argument,
|
|
72
|
+
// so `:has([data-slot=input-group-control]:disabled)` (attribute +
|
|
73
|
+
// pseudo-class) and `:has([data-slot][aria-invalid=true])` (two
|
|
74
|
+
// attributes) are both (0,2,0), plus one class each. Without the
|
|
75
|
+
// exclusion only emission order separates them, and this package's
|
|
76
|
+
// classes can be re-emitted after ours by a consuming app's own
|
|
77
|
+
// Tailwind build — the two-build hazard check:cascade exists for, which
|
|
78
|
+
// it cannot catch here because it only flags conditional at-rule pairs.
|
|
79
|
+
// A field that fails validation and is then disabled during submit hits
|
|
80
|
+
// exactly this: the faded grey would erase the error border. Making the
|
|
81
|
+
// two mutually exclusive decides it by MATCHING instead of by order.
|
|
82
|
+
// The `data-disabled` twin below carries the same exclusion, for the
|
|
83
|
+
// same reason: an error border must outlive either disabled path.
|
|
84
|
+
"has-[[data-slot=input-group-control]:disabled]:not-has-[[data-slot][aria-invalid=true]]:border-(--input-border)/50",
|
|
85
|
+
"data-[disabled=true]:not-has-[[data-slot][aria-invalid=true]]:border-(--input-border)/50",
|
|
49
86
|
// Focus — the group draws one outline for whichever control is focused;
|
|
50
87
|
// InputGroupInput / InputGroupTextarea suppress their own. Offset and
|
|
51
88
|
// colour are unconditional because neither renders anything until
|
|
@@ -60,7 +97,18 @@ function InputGroup({ className, ...props }) {
|
|
|
60
97
|
// specificity rather than on emission order.
|
|
61
98
|
"has-[[data-slot][aria-invalid=true]]:border-2 has-[[data-slot][aria-invalid=true]]:border-(--input-invalid-border)",
|
|
62
99
|
"has-[[data-slot][aria-invalid=true]]:outline-(--input-invalid-ring)",
|
|
63
|
-
|
|
100
|
+
// Excluded when the control is disabled, for the same reason the border
|
|
101
|
+
// rule above is: this and the disabled hover rule both compute to
|
|
102
|
+
// (0,4,0) — class + `:has()` + `:hover` on each — so a tie decided by
|
|
103
|
+
// emission order would let an invalid AND disabled field paint the
|
|
104
|
+
// danger hover surface. Mutually exclusive selectors decide it by
|
|
105
|
+
// MATCHING, and disabled is the one that should win: a dead control
|
|
106
|
+
// gives no hover feedback whatever its validation state. BOTH disabled
|
|
107
|
+
// paths are excluded — the hover rules are (0,3,0) for `data-disabled`
|
|
108
|
+
// against this rule's (0,6,0), so excluding only the control-disabled
|
|
109
|
+
// one would have let an invalid group flagged via the hatch keep
|
|
110
|
+
// painting the danger hover surface.
|
|
111
|
+
"has-[[data-slot][aria-invalid=true]]:not-has-[[data-slot=input-group-control]:disabled]:not-data-[disabled=true]:hover:bg-(--input-invalid-surface-hover)",
|
|
64
112
|
// An InputGroupAction sits flush to the trailing edge with square
|
|
65
113
|
// corners, so the group clips it to its own radius — cheaper and
|
|
66
114
|
// RTL-correct next to per-corner arithmetic on the action. Scoped to
|
|
@@ -95,13 +143,48 @@ const inputGroupAddonVariants = cva(
|
|
|
95
143
|
// row still has height once the padding is gone (the affix text centres in
|
|
96
144
|
// it via `items-center`). Each override carries the has-[] selector, so it
|
|
97
145
|
// outranks the base padding on specificity rather than on emission order.
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
|
|
146
|
+
// Disabled: the addon fades its own HAIRLINE and swaps its cursor, and never
|
|
147
|
+
// touches `opacity`. This is the whole point, so it is worth stating plainly:
|
|
148
|
+
// the addon is an ANCESTOR of every inline button (InputGroupButton always sits
|
|
149
|
+
// in one, and a block-end InputGroupAction does too). `opacity` on this
|
|
150
|
+
// element therefore composites those buttons, and a child cannot opt out of
|
|
151
|
+
// an ancestor's opacity. Measured with `opacity-50` here: an ENABLED button
|
|
152
|
+
// beside a disabled field rendered at effective 0.5 while still clickable,
|
|
153
|
+
// and a disabled one multiplied with Button's own `data-disabled:opacity-50`
|
|
154
|
+
// to 0.25 — which is exactly the Combobox shape, since ComboboxInput passes
|
|
155
|
+
// `disabled` to the control and to the trigger and clear buttons at once.
|
|
156
|
+
// Fading only what this element itself paints leaves every descendant
|
|
157
|
+
// untouched and cannot compound.
|
|
158
|
+
//
|
|
159
|
+
// The affix CONTENT is deliberately not faded — only the hairline is. Two
|
|
160
|
+
// attempts to fade it were both wrong and are worth recording so neither is
|
|
161
|
+
// retried. A faded `color` on the addon never reaches InputGroupText, which
|
|
162
|
+
// sets its own `color` and so stayed lit beside a faded glyph. Expressing the
|
|
163
|
+
// same fade as `opacity` on the children fixed that, but the a11y gate
|
|
164
|
+
// rejects both: axe measures the affix label at 2.43:1 and cannot tell it
|
|
165
|
+
// belongs to a disabled control, because the span carries no disabled state
|
|
166
|
+
// of its own and the addon is a sibling of the control, not its ancestor.
|
|
167
|
+
//
|
|
168
|
+
// Leaving it legible is also the better answer. An affix is an adornment —
|
|
169
|
+
// "AUD", "Markdown supported" — closer to a label than to the control, and a
|
|
170
|
+
// label beside a disabled input does not fade either. The disabled signal is
|
|
171
|
+
// carried by the wrapper's border, this hairline, `cursor-not-allowed`, and
|
|
172
|
+
// the control's own fade, which is four cues without making information
|
|
173
|
+
// harder to read. Fading it would need `aria-disabled` plumbed onto a
|
|
174
|
+
// presentational div to keep axe honest, for a worse result.
|
|
175
|
+
//
|
|
176
|
+
// Background is likewise NOT faded: `--surface-sunken` measures 1.1:1 against
|
|
177
|
+
// the field, so 50% of it is imperceptible, and an `inline-end` addon has no
|
|
178
|
+
// background at all — a base-level `bg` fade would ADD a grey panel.
|
|
179
|
+
//
|
|
180
|
+
// Both conditions get the same paint. `data-disabled` on the group is a
|
|
181
|
+
// manual escape hatch nothing in this component sets, but it had the same
|
|
182
|
+
// ancestor-opacity defect, so it is converted rather than left as a landmine.
|
|
183
|
+
//
|
|
184
|
+
// The affix also advertises a text caret, because clicking it focuses the
|
|
185
|
+
// control. Over a disabled control that is a lie, so it takes the same
|
|
186
|
+
// `cursor-not-allowed` the control itself does.
|
|
187
|
+
"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-has-[[data-slot=input-group-control]:disabled]/input-group:border-(--input-border)/50 group-data-[disabled=true]/input-group:cursor-not-allowed group-data-[disabled=true]/input-group:border-(--input-border)/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",
|
|
105
188
|
{
|
|
106
189
|
variants: {
|
|
107
190
|
align: {
|
|
@@ -208,15 +291,12 @@ const inputGroupButtonVariants = cva(
|
|
|
208
291
|
"data-[size]:py-0",
|
|
209
292
|
// Same reason as InputGroupAction: zeroing Button's padding exposes its
|
|
210
293
|
// `items-baseline` base, which no longer centres the label.
|
|
211
|
-
"items-center"
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
//
|
|
216
|
-
//
|
|
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"
|
|
294
|
+
"items-center"
|
|
295
|
+
// No disabled-opacity handling here on purpose. Button's own
|
|
296
|
+
// `data-disabled:opacity-50` is the whole treatment: this button always
|
|
297
|
+
// renders inside an addon, and the addon fades its own paint rather than
|
|
298
|
+
// its opacity, so there is no ancestor fade to compound with and nothing
|
|
299
|
+
// to neutralise.
|
|
220
300
|
],
|
|
221
301
|
{
|
|
222
302
|
variants: {
|
|
@@ -224,8 +304,8 @@ const inputGroupButtonVariants = cva(
|
|
|
224
304
|
// 48px group, so anything taller re-inflates the row it is meant to sit
|
|
225
305
|
// inside. `sm` buys horizontal room rather than height for that reason.
|
|
226
306
|
size: {
|
|
227
|
-
xs: "h-8 gap-1
|
|
228
|
-
sm: "h-8 gap-1
|
|
307
|
+
xs: "h-8 gap-1 data-[size=xs]:px-3 [&>svg:not([class*='size-'])]:size-5",
|
|
308
|
+
sm: "h-8 gap-1 data-[size=sm]:px-4 [&>svg:not([class*='size-'])]:size-5",
|
|
229
309
|
"icon-xs": "size-7 data-[size=icon-xs]:px-0",
|
|
230
310
|
"icon-sm": "size-8 data-[size=icon-sm]:px-0"
|
|
231
311
|
}
|
|
@@ -309,14 +389,12 @@ const inputGroupActionVariants = cva(
|
|
|
309
389
|
// focused segment matches the control it sits in instead of borrowing the
|
|
310
390
|
// button system's brand ink. iterate-1.css:
|
|
311
391
|
// `.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
|
-
//
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
//
|
|
317
|
-
//
|
|
318
|
-
// is what separates the two cases.
|
|
319
|
-
"group-has-[[data-slot=input-group-control]:disabled]/input-group:disabled:opacity-100"
|
|
392
|
+
"items-center font-semibold focus:outline-2 focus:-outline-offset-2 focus:outline-(--input-ring)"
|
|
393
|
+
// Button's own `data-disabled:opacity-50` is left as the entire disabled
|
|
394
|
+
// treatment, for both placements: flush against the group's edge, and
|
|
395
|
+
// nested in a block-end addon. Neither ancestor fades its opacity, so an
|
|
396
|
+
// Apply that waits for a valid value dims on its own while the live field
|
|
397
|
+
// beside it stays at full strength.
|
|
320
398
|
],
|
|
321
399
|
{
|
|
322
400
|
variants: {
|
|
@@ -340,7 +418,15 @@ const inputGroupActionVariants = cva(
|
|
|
340
418
|
// lose the only thing delineating it. check:cascade cannot catch this —
|
|
341
419
|
// it only flags conditional at-rule pairs.
|
|
342
420
|
open: "bg-transparent data-[variant-action=open]:border-s",
|
|
343
|
-
|
|
421
|
+
// `--btn-bg` (the button's own ink) for the ring, NOT the group's
|
|
422
|
+
// `--input-ring`. The base picks `--input-ring` so a focused segment
|
|
423
|
+
// matches the control it sits in, which holds for `open` — measured
|
|
424
|
+
// 3.29:1 against the field surface showing through. On `subtle` the
|
|
425
|
+
// ring lands on the tinted fill instead and measures 2.70:1, under the
|
|
426
|
+
// 3:1 non-text floor of WCAG 1.4.11. The ink reads 14.37:1 there and
|
|
427
|
+
// satisfies the Derived State Rule, which wants focus derived from the
|
|
428
|
+
// one ink variable rather than independently chosen.
|
|
429
|
+
subtle: "focus:outline-(--btn-bg) data-[variant-action=subtle]:border-s",
|
|
344
430
|
// Button rings in `--btn-bg`, which for a solid button IS the fill, so
|
|
345
431
|
// the inset ring above would be navy-on-navy. `--btn-text` is the label
|
|
346
432
|
// colour: 14.37:1 on the fill in both modes.
|
|
@@ -390,6 +476,15 @@ function InputGroupText({ className, ...props }) {
|
|
|
390
476
|
className: cn(
|
|
391
477
|
// Matches the addon it sits in: 16px type, `--input-placeholder` ink,
|
|
392
478
|
// and a nested glyph the same size as one beside it.
|
|
479
|
+
//
|
|
480
|
+
// No disabled rule here, and none on the addon either: affix content
|
|
481
|
+
// stays at full contrast in a disabled group. Do not add one. Two
|
|
482
|
+
// attempts are recorded on inputGroupAddonVariants — a faded `color` on
|
|
483
|
+
// the addon never reaches this span, because setting `color` here
|
|
484
|
+
// overrides the inherited one for its own subtree; and expressing the
|
|
485
|
+
// same fade as `opacity` on the addon's children fixed that but failed
|
|
486
|
+
// the a11y gate, which measures this label at 2.43:1 and cannot tell it
|
|
487
|
+
// belongs to a disabled control. The disabled signal lives on chrome.
|
|
393
488
|
"flex items-center gap-2 text-base text-(--input-placeholder) [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-5",
|
|
394
489
|
className
|
|
395
490
|
),
|
|
@@ -421,12 +516,10 @@ function InputGroupInput({ className, ...props }) {
|
|
|
421
516
|
// `focus-visible:outline-2` / `aria-invalid:border-2` and drops them
|
|
422
517
|
// from the class string outright, so there is never a pair of
|
|
423
518
|
// same-specificity rules whose winner depends on stylesheet order.
|
|
424
|
-
// `disabled:opacity-
|
|
425
|
-
//
|
|
426
|
-
//
|
|
427
|
-
|
|
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",
|
|
519
|
+
// Input's own `disabled:opacity-50` is deliberately left intact: the
|
|
520
|
+
// group fades only its own chrome, so this control owns its disabled
|
|
521
|
+
// appearance exactly as a bare Input does, and nothing compounds.
|
|
522
|
+
"h-full flex-1 rounded-none border-0 bg-transparent hover:bg-transparent focus-visible:outline-0 aria-invalid:border-0 aria-invalid:hover:bg-transparent",
|
|
430
523
|
className
|
|
431
524
|
),
|
|
432
525
|
...props
|
|
@@ -445,8 +538,8 @@ function InputGroupTextarea({ className, ...props }) {
|
|
|
445
538
|
// three neutralisers apply, for the same tailwind-merge reason
|
|
446
539
|
// (`outline-0` / `border-0` land in Button's own conflict groups and
|
|
447
540
|
// drop its utilities from the class string rather than racing them).
|
|
448
|
-
// `disabled:opacity-
|
|
449
|
-
//
|
|
541
|
+
// Textarea's own `disabled:opacity-50` is left intact, as in
|
|
542
|
+
// InputGroupInput — the group fades only its chrome.
|
|
450
543
|
//
|
|
451
544
|
// The two `hover:bg-transparent` neutralisers are here for the reason
|
|
452
545
|
// InputGroupInput documents above, and were missing: `bg-transparent`
|
|
@@ -458,7 +551,7 @@ function InputGroupTextarea({ className, ...props }) {
|
|
|
458
551
|
// control itself can square off the group's corner notch, which is the
|
|
459
552
|
// artefact the input's copies exist to prevent. Restores the "identical
|
|
460
553
|
// contract to InputGroupInput" this comment claims.
|
|
461
|
-
"flex-1 rounded-none border-0 bg-transparent hover:bg-transparent focus-visible:outline-0
|
|
554
|
+
"flex-1 rounded-none border-0 bg-transparent hover:bg-transparent focus-visible:outline-0 aria-invalid:border-0 aria-invalid:hover:bg-transparent",
|
|
462
555
|
// Only the vertical padding differs from Textarea's own: the design's
|
|
463
556
|
// writing surface is `12px 16px`, and Textarea ships `py-2`. Its
|
|
464
557
|
// `min-h-24` (96px) and `px-4` already match the design, so restating
|
|
@@ -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,E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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAwBT,8KAAA;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;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"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/input-group.tsx"],"names":[],"mappings":";;;;;;;AAgBA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACxE,EAAA,uB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","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\n/**\n * `data-disabled=\"true\"` styles group chrome only. Set `disabled` on each\n * InputGroupInput / InputGroupTextarea that should be inactive; the hook does\n * not disable, fade, or prevent focus on descendants. Buttons own their state\n * independently, so an action can remain enabled beside a disabled control.\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 // ...but a disabled group must not react at all. A standalone Input\n // cannot: `disabled:pointer-events-none` means `:hover` never matches\n // it. This wrapper is a plain div, and `pointer-events` on the CONTROL\n // does not stop its ancestor being hovered, so without this line a dead\n // field painted the full enabled hover surface — measured with a real\n // pointer at `--input-surface-hover`, identical to an enabled group.\n // `pointer-events-none` on the wrapper is not the fix: it would also\n // kill an enabled action sitting inside a disabled-field group.\n //\n // Mirrored for `data-disabled`, the manual escape hatch the addon also\n // honours. Every wrapper rule keyed on a disabled control needs its\n // twin so the hook consistently styles the chrome — previously the\n // addon's hairline faded and its cursor changed while this border and\n // hover surface stayed fully live.\n 'has-[[data-slot=input-group-control]:disabled]:hover:bg-(--input-surface)',\n 'data-[disabled=true]:hover:bg-(--input-surface)',\n // Disabled — the group fades its own CHROME: this border, plus the\n // addon's hairline and cursor. Every child owns its own state, and\n // nothing in this component puts `opacity` on an ancestor.\n //\n // The wrapper-opacity version of this shipped briefly and was wrong:\n // ancestor opacity composites the whole subtree and a child cannot opt\n // out of it, so an ENABLED action beside a disabled field rendered at\n // 50% — measured white-on-navy at 3.12:1, under the 4.5:1 floor, on a\n // button that was still clickable. A control that looks disabled and\n // isn't is worse than the chrome bug it replaced. It also forced\n // `opacity-100` neutralisers onto four children to stop 0.5 x 0.5\n // compounding, and those only worked for natively `:disabled` targets.\n // Fading the chrome directly needs no neutralisers and cannot compound.\n //\n // `not-has-[…aria-invalid…]` is load-bearing, not belt-and-braces. This\n // rule and the aria-invalid border rule below both set `border-color`\n // at identical specificity — `:has()` takes its most specific argument,\n // so `:has([data-slot=input-group-control]:disabled)` (attribute +\n // pseudo-class) and `:has([data-slot][aria-invalid=true])` (two\n // attributes) are both (0,2,0), plus one class each. Without the\n // exclusion only emission order separates them, and this package's\n // classes can be re-emitted after ours by a consuming app's own\n // Tailwind build — the two-build hazard check:cascade exists for, which\n // it cannot catch here because it only flags conditional at-rule pairs.\n // A field that fails validation and is then disabled during submit hits\n // exactly this: the faded grey would erase the error border. Making the\n // two mutually exclusive decides it by MATCHING instead of by order.\n // The `data-disabled` twin below carries the same exclusion, for the\n // same reason: an error border must outlive either disabled path.\n 'has-[[data-slot=input-group-control]:disabled]:not-has-[[data-slot][aria-invalid=true]]:border-(--input-border)/50',\n 'data-[disabled=true]:not-has-[[data-slot][aria-invalid=true]]:border-(--input-border)/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 // Excluded when the control is disabled, for the same reason the border\n // rule above is: this and the disabled hover rule both compute to\n // (0,4,0) — class + `:has()` + `:hover` on each — so a tie decided by\n // emission order would let an invalid AND disabled field paint the\n // danger hover surface. Mutually exclusive selectors decide it by\n // MATCHING, and disabled is the one that should win: a dead control\n // gives no hover feedback whatever its validation state. BOTH disabled\n // paths are excluded — the hover rules are (0,3,0) for `data-disabled`\n // against this rule's (0,6,0), so excluding only the control-disabled\n // one would have let an invalid group flagged via the hatch keep\n // painting the danger hover surface.\n 'has-[[data-slot][aria-invalid=true]]:not-has-[[data-slot=input-group-control]:disabled]:not-data-[disabled=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 // Disabled: the addon fades its own HAIRLINE and swaps its cursor, and never\n // touches `opacity`. This is the whole point, so it is worth stating plainly:\n // the addon is an ANCESTOR of every inline button (InputGroupButton always sits\n // in one, and a block-end InputGroupAction does too). `opacity` on this\n // element therefore composites those buttons, and a child cannot opt out of\n // an ancestor's opacity. Measured with `opacity-50` here: an ENABLED button\n // beside a disabled field rendered at effective 0.5 while still clickable,\n // and a disabled one multiplied with Button's own `data-disabled:opacity-50`\n // to 0.25 — which is exactly the Combobox shape, since ComboboxInput passes\n // `disabled` to the control and to the trigger and clear buttons at once.\n // Fading only what this element itself paints leaves every descendant\n // untouched and cannot compound.\n //\n // The affix CONTENT is deliberately not faded — only the hairline is. Two\n // attempts to fade it were both wrong and are worth recording so neither is\n // retried. A faded `color` on the addon never reaches InputGroupText, which\n // sets its own `color` and so stayed lit beside a faded glyph. Expressing the\n // same fade as `opacity` on the children fixed that, but the a11y gate\n // rejects both: axe measures the affix label at 2.43:1 and cannot tell it\n // belongs to a disabled control, because the span carries no disabled state\n // of its own and the addon is a sibling of the control, not its ancestor.\n //\n // Leaving it legible is also the better answer. An affix is an adornment —\n // \"AUD\", \"Markdown supported\" — closer to a label than to the control, and a\n // label beside a disabled input does not fade either. The disabled signal is\n // carried by the wrapper's border, this hairline, `cursor-not-allowed`, and\n // the control's own fade, which is four cues without making information\n // harder to read. Fading it would need `aria-disabled` plumbed onto a\n // presentational div to keep axe honest, for a worse result.\n //\n // Background is likewise NOT faded: `--surface-sunken` measures 1.1:1 against\n // the field, so 50% of it is imperceptible, and an `inline-end` addon has no\n // background at all — a base-level `bg` fade would ADD a grey panel.\n //\n // Both conditions get the same paint. `data-disabled` on the group is a\n // manual escape hatch nothing in this component sets, but it had the same\n // ancestor-opacity defect, so it is converted rather than left as a landmine.\n //\n // The affix also advertises a text caret, because clicking it focuses the\n // control. Over a disabled control that is a lie, so it takes the same\n // `cursor-not-allowed` the control itself does.\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-has-[[data-slot=input-group-control]:disabled]/input-group:border-(--input-border)/50 group-data-[disabled=true]/input-group:cursor-not-allowed group-data-[disabled=true]/input-group:border-(--input-border)/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 // No disabled-opacity handling here on purpose. Button's own\n // `data-disabled:opacity-50` is the whole treatment: this button always\n // renders inside an addon, and the addon fades its own paint rather than\n // its opacity, so there is no ancestor fade to compound with and nothing\n // to neutralise.\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 data-[size=xs]:px-3 [&>svg:not([class*='size-'])]:size-5\",\n sm: \"h-8 gap-1 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 // Button's own `data-disabled:opacity-50` is left as the entire disabled\n // treatment, for both placements: flush against the group's edge, and\n // nested in a block-end addon. Neither ancestor fades its opacity, so an\n // Apply that waits for a valid value dims on its own while the live field\n // beside it stays at full strength.\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 // `--btn-bg` (the button's own ink) for the ring, NOT the group's\n // `--input-ring`. The base picks `--input-ring` so a focused segment\n // matches the control it sits in, which holds for `open` — measured\n // 3.29:1 against the field surface showing through. On `subtle` the\n // ring lands on the tinted fill instead and measures 2.70:1, under the\n // 3:1 non-text floor of WCAG 1.4.11. The ink reads 14.37:1 there and\n // satisfies the Derived State Rule, which wants focus derived from the\n // one ink variable rather than independently chosen.\n subtle: 'focus:outline-(--btn-bg) 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 //\n // No disabled rule here, and none on the addon either: affix content\n // stays at full contrast in a disabled group. Do not add one. Two\n // attempts are recorded on inputGroupAddonVariants — a faded `color` on\n // the addon never reaches this span, because setting `color` here\n // overrides the inherited one for its own subtree; and expressing the\n // same fade as `opacity` on the addon's children fixed that but failed\n // the a11y gate, which measures this label at 2.43:1 and cannot tell it\n // belongs to a disabled control. The disabled signal lives on chrome.\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 // Input's own `disabled:opacity-50` is deliberately left intact: the\n // group fades only its own chrome, so this control owns its disabled\n // appearance exactly as a bare Input does, and nothing compounds.\n 'h-full flex-1 rounded-none border-0 bg-transparent hover:bg-transparent focus-visible:outline-0 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 // Textarea's own `disabled:opacity-50` is left intact, as in\n // InputGroupInput — the group fades only its chrome.\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 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?: "primary" | "secondary" | "white" | "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?: "white" | "grey" | "light" | "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?: "white" | "grey" | "light" | "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"`. */
|