@bettercms-ai/kit 3.1.12 → 3.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/controls/code.js +2 -2
  2. package/dist/controls/code.js.map +1 -1
  3. package/dist/controls/color.js +1 -1
  4. package/dist/controls/color.js.map +1 -1
  5. package/dist/controls/link.js +2 -1
  6. package/dist/controls/link.js.map +1 -1
  7. package/dist/controls/location.d.ts +1 -1
  8. package/dist/controls/location.js +24 -7
  9. package/dist/controls/location.js.map +1 -1
  10. package/dist/controls/media.js +1 -1
  11. package/dist/controls/media.js.map +1 -1
  12. package/dist/controls/number.js +18 -5
  13. package/dist/controls/number.js.map +1 -1
  14. package/dist/controls/reference.js +1 -1
  15. package/dist/controls/reference.js.map +1 -1
  16. package/dist/controls/rich-text/blocks.js +2 -1
  17. package/dist/controls/rich-text/blocks.js.map +1 -1
  18. package/dist/controls/rich-text/control.js +1 -1
  19. package/dist/controls/rich-text/control.js.map +1 -1
  20. package/dist/controls/rich-text/editor.js +63 -4
  21. package/dist/controls/rich-text/editor.js.map +1 -1
  22. package/dist/controls/rich-text/ops.d.ts +3 -0
  23. package/dist/controls/rich-text/ops.js +47 -2
  24. package/dist/controls/rich-text/ops.js.map +1 -1
  25. package/dist/engine/array.js +2 -2
  26. package/dist/engine/array.js.map +1 -1
  27. package/dist/engine/field-shell.js +2 -2
  28. package/dist/engine/field-shell.js.map +1 -1
  29. package/dist/engine/kit-field.js +1 -1
  30. package/dist/engine/kit-field.js.map +1 -1
  31. package/dist/lib/validate.js +30 -0
  32. package/dist/lib/validate.js.map +1 -1
  33. package/dist/library/entries/advanced.entries.js +1 -1
  34. package/dist/library/entries/advanced.entries.js.map +1 -1
  35. package/dist/library/entries/media.entries.js +1 -1
  36. package/dist/library/entries/media.entries.js.map +1 -1
  37. package/dist/library/kit-catalog.json +2 -2
  38. package/dist/styles.css +1 -1
  39. package/dist/theme.css +2 -2
  40. package/dist/tokens.css +7 -7
  41. package/dist/ui/button.js +2 -2
  42. package/dist/ui/button.js.map +1 -1
  43. package/dist/ui/controls.js +6 -6
  44. package/dist/ui/controls.js.map +1 -1
  45. package/dist/ui/input.js +12 -0
  46. package/dist/ui/input.js.map +1 -1
  47. package/dist/ui/select.js +1 -1
  48. package/dist/ui/select.js.map +1 -1
  49. package/dist/ui/toast.js +1 -1
  50. package/dist/ui/toast.js.map +1 -1
  51. package/package.json +1 -1
package/dist/theme.css CHANGED
@@ -282,7 +282,7 @@
282
282
  box-shadow: 0 1px 2px rgb(16 16 16 / 0.04), 0 8px 24px -6px rgb(16 16 16 / 0.12);
283
283
  &:is(.dark *) {
284
284
  background-color: var(--kit-surface-raised);
285
- border-color: var(--kit-line-strong);
285
+ border-color: var(--kit-floating-line); /* 4B: keeps the V2 dark edge (#454548) now that line-strong is a 3:1 control boundary */
286
286
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.04), 0 12px 32px -8px oklch(0.12 0.01 286 / 0.5);
287
287
  }
288
288
  }
@@ -298,7 +298,7 @@
298
298
  box-shadow: 0 1px 2px rgb(16 16 16 / 0.05), 0 16px 40px -8px rgb(16 16 16 / 0.18);
299
299
  &:is(.dark *) {
300
300
  background-color: var(--kit-surface-raised);
301
- border-color: var(--kit-line-strong);
301
+ border-color: var(--kit-floating-line); /* 4B: keeps the V2 dark edge (#454548) now that line-strong is a 3:1 control boundary */
302
302
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.05), 0 16px 40px -8px oklch(0.12 0.01 286 / 0.58);
303
303
  }
304
304
  }
package/dist/tokens.css CHANGED
@@ -95,9 +95,9 @@
95
95
  --kit-fg-4: #707074;
96
96
  --kit-fg-inverse: #ffffff;
97
97
  --kit-line: #e5e5e5;
98
- --kit-line-strong: #dcdcdf;
98
+ --kit-line-strong: #8b8b8e; /* 4B: was V2 #dcdcdf (1.28:1); WCAG 1.4.11 control boundary */
99
99
  --kit-line-subtle: #f0f0f1;
100
- --kit-field-border: #cfcfd4;
100
+ --kit-field-border: #909095; /* 4B: was V2 #cfcfd4 (1.55:1) */
101
101
  --kit-focus-ring: #838383; /* V2 demo is #a3a3a3 — 2.1–2.5:1 on V2 surfaces fails WCAG 1.4.11; same neutral, darker */
102
102
  --kit-accent: #a354e9;
103
103
  --kit-accent-hover: #9140dc;
@@ -107,7 +107,7 @@
107
107
  --kit-accent-line: #e3ccf8;
108
108
  --kit-accent-fg: #6c3b97;
109
109
  --kit-accent-on: #ffffff;
110
- --kit-success: #3cba71;
110
+ --kit-success: #12a059; /* 4B: was V2 #3cba71 (2.32:1, white thumb 2.48:1) */
111
111
  --kit-success-soft: #dcfce7;
112
112
  --kit-success-softer: #eefef3;
113
113
  --kit-success-line: #c5ead4;
@@ -138,7 +138,7 @@
138
138
  --kit-field-bg: #ffffff;
139
139
  --kit-field-border-hover: #85858b;
140
140
  --kit-field-border-focus: #6a6a6f;
141
- --kit-switch-off: #dcdcdf;
141
+ --kit-switch-off: #8b8b8e; /* 4B: was V2 #dcdcdf (1.28:1) */
142
142
  --kit-control-thumb: #ffffff;
143
143
  --kit-swatch-ring: rgb(0 0 0 / 0.1);
144
144
  --kit-on-inverse-2: rgb(255 255 255 / 0.7);
@@ -200,7 +200,7 @@
200
200
  --kit-avatar-on: #ffffff;
201
201
  --kit-kbd: #f7f7f7;
202
202
  --kit-kbd-line: #e5e5e5;
203
- --kit-field-invalid: #dd868b;
203
+ --kit-field-invalid: #c87379; /* 4B: was V2 #dd868b (2.49:1) */
204
204
  --kit-emphasis-line: #6a6a6f;
205
205
  --kit-track: #ededed;
206
206
  --kit-track-line: #e2e2e2;
@@ -315,7 +315,7 @@
315
315
  --kit-fg-4: #9e9ea1;
316
316
  --kit-fg-inverse: #1b1b1e;
317
317
  --kit-line: #3a3a3d;
318
- --kit-line-strong: #454548;
318
+ --kit-line-strong: #79797d; /* 4B: was V2 #454548 (1.43:1) */
319
319
  --kit-line-subtle: #353538;
320
320
  --kit-field-border: #747477;
321
321
  --kit-focus-ring: #929295;
@@ -327,7 +327,7 @@
327
327
  --kit-accent-line: #5d4676;
328
328
  --kit-accent-fg: #d1b6f3;
329
329
  --kit-accent-on: #1e1628;
330
- --kit-success: #58b575;
330
+ --kit-success: #3a995b; /* 4B: was V2 #58b575 (light thumb 2.25:1) */
331
331
  --kit-success-soft: rgb(12 192 35 / 0.1);
332
332
  --kit-success-softer: #1e2820;
333
333
  --kit-success-line: #2c5f3c;
package/dist/ui/button.js CHANGED
@@ -26,7 +26,7 @@ var buttonVariants = variants("relative inline-flex items-center justify-center
26
26
  danger: "bg-kit-danger text-kit-danger-on shadow-kit-xs hover:brightness-95",
27
27
  "danger-ghost": "text-kit-danger-fg hover:bg-kit-danger-soft",
28
28
  link: "text-kit-accent-fg underline-offset-4 hover:underline px-0 h-auto active:scale-100",
29
- ai: "border border-kit-line bg-kit-control-bg text-kit-fg shadow-kit-xs hover:border-kit-accent-line hover:bg-kit-accent-softer"
29
+ ai: "border border-kit-line-strong bg-kit-control-bg text-kit-fg shadow-kit-xs hover:border-kit-accent-line hover:bg-kit-accent-softer"
30
30
  },
31
31
  size: {
32
32
  xs: "h-6 rounded-kit-md px-2 text-kit-xs [&_svg]:size-3.5",
@@ -89,7 +89,7 @@ var iconButtonVariants = variants("relative inline-flex items-center justify-cen
89
89
  },
90
90
  variant: {
91
91
  ghost: "",
92
- outline: "border border-kit-line bg-kit-control-bg shadow-kit-xs hover:border-kit-line-strong",
92
+ outline: "border border-kit-line-strong bg-kit-control-bg shadow-kit-xs hover:border-[var(--kit-emphasis-line)]",
93
93
  soft: "bg-kit-muted"
94
94
  }
95
95
  },
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","names":[],"sources":["../../src/ui/button.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Tooltip as TooltipPrimitive } from \"@base-ui/react/tooltip\";\nimport { IconPlus } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { SPARKLE_PATH } from \"../brand/logo\";\nimport { Spinner } from \"./spinner\";\nimport { TooltipLayer, TooltipRoot } from \"./tooltip-root\";\nimport { variants, type VariantProps } from \"./variants\";\n\n/**\n * Button: the only button in the kit.\n * Heights: xs 24 · sm 28 · md 32 (default) · lg 36 · xl 40. Radius 6.\n * Variants: primary (ink) · accent (violet, reserved for the ONE create action per screen)\n * secondary (bordered) · ghost · soft · danger · danger-ghost · link · ai (gradient sparkle)\n * The keyboard focus ring is the global :focus-visible outline, suppressed under pointer modality (DESIGN.md 3.7).\n */\nexport const buttonVariants = variants(\n \"relative inline-flex items-center justify-center gap-1.5 whitespace-nowrap font-medium tracking-[-0.01em] select-none transition-[background-color,border-color,color,box-shadow,opacity] duration-150 ease-out disabled:pointer-events-none disabled:opacity-45 [&_svg]:shrink-0 [&_svg]:opacity-90\",\n {\n variants: {\n variant: {\n // .btn-solid: in dark a disabled primary/accent takes the solid --kit-disabled-bg / --kit-disabled-fg pair; light keeps the opacity dim.\n primary: \"bg-kit-inverse text-kit-fg-inverse shadow-kit-button-primary hover:bg-kit-inverse-hover active:bg-kit-inverse btn-solid\",\n accent: \"bg-kit-accent text-kit-accent-on shadow-kit-xs hover:bg-kit-accent-hover btn-solid\",\n secondary: \"border border-kit-line-strong bg-kit-control-bg text-kit-fg shadow-kit-xs hover:bg-kit-subtle active:bg-kit-hover\",\n ghost: \"text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg active:bg-kit-selected\",\n soft: \"bg-kit-muted text-kit-fg hover:bg-kit-selected\",\n danger: \"bg-kit-danger text-kit-danger-on shadow-kit-xs hover:brightness-95\",\n \"danger-ghost\": \"text-kit-danger-fg hover:bg-kit-danger-soft\",\n link: \"text-kit-accent-fg underline-offset-4 hover:underline px-0 h-auto active:scale-100\",\n ai: \"border border-kit-line bg-kit-control-bg text-kit-fg shadow-kit-xs hover:border-kit-accent-line hover:bg-kit-accent-softer\",\n },\n size: {\n xs: \"h-6 rounded-kit-md px-2 text-kit-xs [&_svg]:size-3.5\",\n sm: \"h-7 rounded-kit-md px-2.5 text-kit-sm [&_svg]:size-3.5\",\n md: \"h-8 rounded-kit-md px-3 text-kit-sm [&_svg]:size-4\",\n lg: \"h-9 rounded-kit-md px-3.5 text-kit-base [&_svg]:size-4\",\n xl: \"h-10 rounded-kit-md px-4 text-kit-base [&_svg]:size-[18px]\",\n },\n },\n compoundVariants: [{ variant: \"link\", className: \"h-auto px-0\" }],\n defaultVariants: { variant: \"secondary\", size: \"md\" },\n },\n);\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {\n /** Render the single child element (a link, say) with the button's classes and props. */\n asChild?: boolean;\n loading?: boolean;\n leftIcon?: React.ReactNode;\n rightIcon?: React.ReactNode;\n}\n\ntype ChildProps = { className?: string; ref?: React.Ref<unknown> };\n\nfunction mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.RefObject<T | null>).current = node;\n }\n };\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild, loading, leftIcon, rightIcon, children, disabled, ...props }, ref) => {\n const classes = cn(buttonVariants({ variant, size }), className);\n if (asChild && React.isValidElement<ChildProps>(children)) {\n return React.cloneElement(children, {\n ...props,\n ...children.props,\n className: cn(classes, children.props.className),\n ref: mergeRefs(ref as React.Ref<unknown>, children.props.ref),\n });\n }\n return (\n <button ref={ref} type={props.type ?? \"button\"} disabled={disabled || loading} aria-busy={loading || undefined} className={classes} {...props}>\n {/* the kit Spinner (decorative: the button says it is busy); the size variant's [&_svg] rule sizes its glyph */}\n {loading ? <Spinner /> : leftIcon}\n {variant === \"ai\" && !leftIcon && !loading ? <Sparkle /> : null}\n {children}\n {rightIcon}\n </button>\n );\n },\n);\nButton.displayName = \"Button\";\n\n/** Square icon-only button. Always pass `label` (used for aria-label + tooltip). */\nexport const iconButtonVariants = variants(\n \"relative inline-flex items-center justify-center shrink-0 text-kit-fg-2 transition-colors duration-150 hover:bg-kit-hover hover:text-kit-fg active:scale-[0.96] disabled:opacity-40 disabled:pointer-events-none data-[active=true]:bg-kit-selected data-[active=true]:text-kit-fg\",\n {\n variants: {\n size: {\n xs: \"size-6 rounded-kit-md [&_svg]:size-3.5\",\n sm: \"size-7 rounded-kit-md [&_svg]:size-4\",\n md: \"size-8 rounded-kit-md [&_svg]:size-4\",\n lg: \"size-9 rounded-kit-md [&_svg]:size-[18px]\",\n },\n variant: {\n ghost: \"\",\n outline: \"border border-kit-line bg-kit-control-bg shadow-kit-xs hover:border-kit-line-strong\",\n soft: \"bg-kit-muted\",\n },\n },\n defaultVariants: { size: \"md\", variant: \"ghost\" },\n },\n);\n\n/**\n * a11y: true while rendering inside a tooltip (or a surface that manages its own hints), so an IconButton nested\n * there doesn't add a second tooltip. Provided by HintTooltip and overlay.tsx's <Tooltip>.\n */\nexport const TooltipScope = React.createContext(false);\n\n/**\n * The plain ink hint (DESIGN.md 8.23: top, 6px offset, 8px collision padding, portalled, z 90, 350ms). The child\n * element is the trigger and must take a ref and DOM props. input, display and action-tray use it so they never\n * import overlay.tsx; overlay's <Tooltip> adds the shortcut slot on top of the same layer.\n */\nexport function HintTooltip({\n content,\n side = \"top\",\n delay = 350,\n children,\n}: {\n content: React.ReactNode;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n delay?: number;\n children: React.ReactElement;\n}) {\n return (\n <TooltipScope.Provider value>\n <TooltipRoot>\n <TooltipPrimitive.Trigger delay={delay} render={children} />\n <TooltipLayer side={side}>\n <span className=\"line-clamp-[8] min-w-0 whitespace-normal [overflow-wrap:anywhere]\">{content}</span>\n </TooltipLayer>\n </TooltipRoot>\n </TooltipScope.Provider>\n );\n}\n\nexport interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof iconButtonVariants> {\n label: string;\n active?: boolean;\n /** Hover/focus hint. Defaults to `label`; pass `false` to opt out, or a node to customise. */\n tooltip?: React.ReactNode | false;\n tooltipSide?: \"top\" | \"bottom\" | \"left\" | \"right\";\n}\n\nexport const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ className, size, variant, label, active, children, tooltip, tooltipSide = \"top\", ...props }, ref) => {\n const inTooltip = React.useContext(TooltipScope);\n const btn = (\n <button\n ref={ref}\n type=\"button\"\n aria-label={label}\n data-active={active ? \"true\" : undefined}\n className={cn(iconButtonVariants({ size, variant }), className)}\n {...props}\n >\n {children}\n </button>\n );\n // Every icon-only button gets a visible hint on hover AND keyboard focus (brief §11), unless a\n // parent tooltip already provides one or the caller opted out.\n if (inTooltip || tooltip === false || !label) return btn;\n return (\n <HintTooltip content={tooltip ?? label} side={tooltipSide}>\n {btn}\n </HintTooltip>\n );\n },\n);\nIconButton.displayName = \"IconButton\";\n\n/** The AI sparkle in the official brand gradient. Used everywhere AI appears. */\nexport function Sparkle({ className, size = 16 }: { className?: string; size?: number }) {\n const id = React.useId().replace(/:/g, \"\");\n return (\n <svg width={size} height={size} viewBox=\"2 2 16 16\" className={cn(\"shrink-0\", className)} aria-hidden>\n <defs>\n <linearGradient id={`sp${id}`} x1=\"6.89\" y1=\"4.59\" x2=\"18\" y2=\"23.67\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0.0817\" style={{ stopColor: \"var(--kit-brand-violet)\" }} />\n <stop offset=\"0.4667\" style={{ stopColor: \"var(--kit-brand-coral)\" }} />\n <stop offset=\"1\" style={{ stopColor: \"var(--kit-brand-rose)\" }} />\n </linearGradient>\n </defs>\n <path d={SPARKLE_PATH} fill={`url(#sp${id})`} />\n </svg>\n );\n}\n\n/** D15 progressive disclosure: \"+ Add a message\" / \"+ Limit to specific sites\": reveals an optional input. */\nexport function RevealLink({ className, children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) {\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex h-7 items-center gap-1 rounded-kit-md text-kit-sm font-medium text-kit-fg-2 transition-colors hover:text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AM,KAAK,MAAM,MAAM,CAAC,CAAC,QAAQ,MAAM,EAAE;CACzC,OACE,qBAAC,OAAD;EAAK,OAAO;EAAM,QAAQ;EAAM,SAAQ;EAAY,WAAW,GAAG,YAAY,SAAS;EAAG,eAAA;EAA1F,UAAA,CACE,oBAAC,QAAD,EAAA,UACE,qBAAC,kBAAD;GAAgB,IAAI,KAAK;GAAM,IAAG;GAAO,IAAG;GAAO,IAAG;GAAK,IAAG;GAAQ,eAAc;GAApF,UAAA;IACE,oBAAC,QAAD;KAAM,QAAO;KAAS,OAAO,EAAE,WAAW,0BAA0B;IAAI,CAAA;IACxE,oBAAC,QAAD;KAAM,QAAO;KAAS,OAAO,EAAE,WAAW,yBAAyB;IAAI,CAAA;IACvE,oBAAC,QAAD;KAAM,QAAO;KAAI,OAAO,EAAE,WAAW,wBAAwB;IAAI,CAAA;GACnD;EACZ,CAAA,EAAA,CAAA,GACN,oBAAC,QAAD;GAAM,GAAG;GAAc,MAAM,UAAU,GAAG;EAAK,CAAA,CAC5C;;AAET;;AAGA,SAAgB,WAAW,EAAE,WAAW,UAAU,GAAG,SAAwD;CAC3G,OACE,qBAAC,UAAD;EACE,MAAK;EACL,WAAW,GACT,gJACA,SACF;EACA,GAAI;EANN,UAAA,CAQE,oBAAC,UAAD;GAAU,QAAQ;GAAG,eAAA;EAAa,CAAA,GACjC,QACK;;AAEZ"}
1
+ {"version":3,"file":"button.js","names":[],"sources":["../../src/ui/button.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Tooltip as TooltipPrimitive } from \"@base-ui/react/tooltip\";\nimport { IconPlus } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { SPARKLE_PATH } from \"../brand/logo\";\nimport { Spinner } from \"./spinner\";\nimport { TooltipLayer, TooltipRoot } from \"./tooltip-root\";\nimport { variants, type VariantProps } from \"./variants\";\n\n/**\n * Button: the only button in the kit.\n * Heights: xs 24 · sm 28 · md 32 (default) · lg 36 · xl 40. Radius 6.\n * Variants: primary (ink) · accent (violet, reserved for the ONE create action per screen)\n * secondary (bordered) · ghost · soft · danger · danger-ghost · link · ai (gradient sparkle)\n * The keyboard focus ring is the global :focus-visible outline, suppressed under pointer modality (DESIGN.md 3.7).\n */\nexport const buttonVariants = variants(\n \"relative inline-flex items-center justify-center gap-1.5 whitespace-nowrap font-medium tracking-[-0.01em] select-none transition-[background-color,border-color,color,box-shadow,opacity] duration-150 ease-out disabled:pointer-events-none disabled:opacity-45 [&_svg]:shrink-0 [&_svg]:opacity-90\",\n {\n variants: {\n variant: {\n // .btn-solid: in dark a disabled primary/accent takes the solid --kit-disabled-bg / --kit-disabled-fg pair; light keeps the opacity dim.\n primary: \"bg-kit-inverse text-kit-fg-inverse shadow-kit-button-primary hover:bg-kit-inverse-hover active:bg-kit-inverse btn-solid\",\n accent: \"bg-kit-accent text-kit-accent-on shadow-kit-xs hover:bg-kit-accent-hover btn-solid\",\n secondary: \"border border-kit-line-strong bg-kit-control-bg text-kit-fg shadow-kit-xs hover:bg-kit-subtle active:bg-kit-hover\",\n ghost: \"text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg active:bg-kit-selected\",\n soft: \"bg-kit-muted text-kit-fg hover:bg-kit-selected\",\n danger: \"bg-kit-danger text-kit-danger-on shadow-kit-xs hover:brightness-95\",\n \"danger-ghost\": \"text-kit-danger-fg hover:bg-kit-danger-soft\",\n link: \"text-kit-accent-fg underline-offset-4 hover:underline px-0 h-auto active:scale-100\",\n ai: \"border border-kit-line-strong bg-kit-control-bg text-kit-fg shadow-kit-xs hover:border-kit-accent-line hover:bg-kit-accent-softer\",\n },\n size: {\n xs: \"h-6 rounded-kit-md px-2 text-kit-xs [&_svg]:size-3.5\",\n sm: \"h-7 rounded-kit-md px-2.5 text-kit-sm [&_svg]:size-3.5\",\n md: \"h-8 rounded-kit-md px-3 text-kit-sm [&_svg]:size-4\",\n lg: \"h-9 rounded-kit-md px-3.5 text-kit-base [&_svg]:size-4\",\n xl: \"h-10 rounded-kit-md px-4 text-kit-base [&_svg]:size-[18px]\",\n },\n },\n compoundVariants: [{ variant: \"link\", className: \"h-auto px-0\" }],\n defaultVariants: { variant: \"secondary\", size: \"md\" },\n },\n);\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {\n /** Render the single child element (a link, say) with the button's classes and props. */\n asChild?: boolean;\n loading?: boolean;\n leftIcon?: React.ReactNode;\n rightIcon?: React.ReactNode;\n}\n\ntype ChildProps = { className?: string; ref?: React.Ref<unknown> };\n\nfunction mergeRefs<T>(...refs: (React.Ref<T> | undefined)[]) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.RefObject<T | null>).current = node;\n }\n };\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild, loading, leftIcon, rightIcon, children, disabled, ...props }, ref) => {\n const classes = cn(buttonVariants({ variant, size }), className);\n if (asChild && React.isValidElement<ChildProps>(children)) {\n return React.cloneElement(children, {\n ...props,\n ...children.props,\n className: cn(classes, children.props.className),\n ref: mergeRefs(ref as React.Ref<unknown>, children.props.ref),\n });\n }\n return (\n <button ref={ref} type={props.type ?? \"button\"} disabled={disabled || loading} aria-busy={loading || undefined} className={classes} {...props}>\n {/* the kit Spinner (decorative: the button says it is busy); the size variant's [&_svg] rule sizes its glyph */}\n {loading ? <Spinner /> : leftIcon}\n {variant === \"ai\" && !leftIcon && !loading ? <Sparkle /> : null}\n {children}\n {rightIcon}\n </button>\n );\n },\n);\nButton.displayName = \"Button\";\n\n/** Square icon-only button. Always pass `label` (used for aria-label + tooltip). */\nexport const iconButtonVariants = variants(\n \"relative inline-flex items-center justify-center shrink-0 text-kit-fg-2 transition-colors duration-150 hover:bg-kit-hover hover:text-kit-fg active:scale-[0.96] disabled:opacity-40 disabled:pointer-events-none data-[active=true]:bg-kit-selected data-[active=true]:text-kit-fg\",\n {\n variants: {\n size: {\n xs: \"size-6 rounded-kit-md [&_svg]:size-3.5\",\n sm: \"size-7 rounded-kit-md [&_svg]:size-4\",\n md: \"size-8 rounded-kit-md [&_svg]:size-4\",\n lg: \"size-9 rounded-kit-md [&_svg]:size-[18px]\",\n },\n variant: {\n ghost: \"\",\n outline: \"border border-kit-line-strong bg-kit-control-bg shadow-kit-xs hover:border-[var(--kit-emphasis-line)]\",\n soft: \"bg-kit-muted\",\n },\n },\n defaultVariants: { size: \"md\", variant: \"ghost\" },\n },\n);\n\n/**\n * a11y: true while rendering inside a tooltip (or a surface that manages its own hints), so an IconButton nested\n * there doesn't add a second tooltip. Provided by HintTooltip and overlay.tsx's <Tooltip>.\n */\nexport const TooltipScope = React.createContext(false);\n\n/**\n * The plain ink hint (DESIGN.md 8.23: top, 6px offset, 8px collision padding, portalled, z 90, 350ms). The child\n * element is the trigger and must take a ref and DOM props. input, display and action-tray use it so they never\n * import overlay.tsx; overlay's <Tooltip> adds the shortcut slot on top of the same layer.\n */\nexport function HintTooltip({\n content,\n side = \"top\",\n delay = 350,\n children,\n}: {\n content: React.ReactNode;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n delay?: number;\n children: React.ReactElement;\n}) {\n return (\n <TooltipScope.Provider value>\n <TooltipRoot>\n <TooltipPrimitive.Trigger delay={delay} render={children} />\n <TooltipLayer side={side}>\n <span className=\"line-clamp-[8] min-w-0 whitespace-normal [overflow-wrap:anywhere]\">{content}</span>\n </TooltipLayer>\n </TooltipRoot>\n </TooltipScope.Provider>\n );\n}\n\nexport interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof iconButtonVariants> {\n label: string;\n active?: boolean;\n /** Hover/focus hint. Defaults to `label`; pass `false` to opt out, or a node to customise. */\n tooltip?: React.ReactNode | false;\n tooltipSide?: \"top\" | \"bottom\" | \"left\" | \"right\";\n}\n\nexport const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ className, size, variant, label, active, children, tooltip, tooltipSide = \"top\", ...props }, ref) => {\n const inTooltip = React.useContext(TooltipScope);\n const btn = (\n <button\n ref={ref}\n type=\"button\"\n aria-label={label}\n data-active={active ? \"true\" : undefined}\n className={cn(iconButtonVariants({ size, variant }), className)}\n {...props}\n >\n {children}\n </button>\n );\n // Every icon-only button gets a visible hint on hover AND keyboard focus (brief §11), unless a\n // parent tooltip already provides one or the caller opted out.\n if (inTooltip || tooltip === false || !label) return btn;\n return (\n <HintTooltip content={tooltip ?? label} side={tooltipSide}>\n {btn}\n </HintTooltip>\n );\n },\n);\nIconButton.displayName = \"IconButton\";\n\n/** The AI sparkle in the official brand gradient. Used everywhere AI appears. */\nexport function Sparkle({ className, size = 16 }: { className?: string; size?: number }) {\n const id = React.useId().replace(/:/g, \"\");\n return (\n <svg width={size} height={size} viewBox=\"2 2 16 16\" className={cn(\"shrink-0\", className)} aria-hidden>\n <defs>\n <linearGradient id={`sp${id}`} x1=\"6.89\" y1=\"4.59\" x2=\"18\" y2=\"23.67\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0.0817\" style={{ stopColor: \"var(--kit-brand-violet)\" }} />\n <stop offset=\"0.4667\" style={{ stopColor: \"var(--kit-brand-coral)\" }} />\n <stop offset=\"1\" style={{ stopColor: \"var(--kit-brand-rose)\" }} />\n </linearGradient>\n </defs>\n <path d={SPARKLE_PATH} fill={`url(#sp${id})`} />\n </svg>\n );\n}\n\n/** D15 progressive disclosure: \"+ Add a message\" / \"+ Limit to specific sites\": reveals an optional input. */\nexport function RevealLink({ className, children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) {\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex h-7 items-center gap-1 rounded-kit-md text-kit-sm font-medium text-kit-fg-2 transition-colors hover:text-kit-fg [&_svg]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconPlus stroke={2} aria-hidden />\n {children}\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,IAAa,iBAAiB,SAC5B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AG,eAAA;EAA1F,UAAA,CACE,oBAAC,QAAD,EAAA,UACE,qBAAC,kBAAD;GAAgB,IAAI,KAAK;GAAM,IAAG;GAAO,IAAG;GAAO,IAAG;GAAK,IAAG;GAAQ,eAAc;GAApF,UAAA;IACE,oBAAC,QAAD;KAAM,QAAO;KAAS,OAAO,EAAE,WAAW,0BAA0B;IAAI,CAAA;IACxE,oBAAC,QAAD;KAAM,QAAO;KAAS,OAAO,EAAE,WAAW,yBAAyB;IAAI,CAAA;IACvE,oBAAC,QAAD;KAAM,QAAO;KAAI,OAAO,EAAE,WAAW,wBAAwB;IAAI,CAAA;GACnD;EACZ,CAAA,EAAA,CAAA,GACN,oBAAC,QAAD;GAAM,GAAG;GAAc,MAAM,UAAU,GAAG;EAAK,CAAA,CAC5C;;AAET;;AAGA,SAAgB,WAAW,EAAE,WAAW,UAAU,GAAG,SAAwD;CAC3G,OACE,qBAAC,UAAD;EACE,MAAK;EACL,WAAW,GACT,gJACA,SACF;EACA,GAAI;EANN,UAAA,CAQE,oBAAC,UAAD;GAAU,QAAQ;GAAG,eAAA;EAAa,CAAA,GACjC,QACK;;AAEZ"}
@@ -69,7 +69,7 @@ function ChoiceCard({ selected, onSelect, icon, title, description, badge, class
69
69
  type: "button",
70
70
  onClick: onSelect,
71
71
  "aria-pressed": selected,
72
- className: cn("focus-inset group relative flex w-full flex-col gap-1.5 rounded-kit-lg border bg-kit-control-bg px-3 py-2.5 text-left transition-[border-color,box-shadow,background-color] duration-150", selected ? "border-[var(--kit-emphasis-line)] shadow-kit-ring-field" : "border-kit-line hover:border-kit-line-strong hover:shadow-kit-sm", className),
72
+ className: cn("focus-inset group relative flex w-full flex-col gap-1.5 rounded-kit-lg border bg-kit-control-bg px-3 py-2.5 text-left transition-[border-color,box-shadow,background-color] duration-150", selected ? "border-[var(--kit-emphasis-line)] shadow-kit-ring-field" : "border-kit-line-strong hover:border-[var(--kit-emphasis-line)] hover:shadow-kit-sm", className),
73
73
  children: [/* @__PURE__ */ jsxs("div", {
74
74
  className: "flex items-start gap-3",
75
75
  children: [
@@ -102,7 +102,7 @@ function ChoiceCard({ selected, onSelect, icon, title, description, badge, class
102
102
  function ChoiceList({ className, children, ...props }) {
103
103
  return /* @__PURE__ */ jsx("div", {
104
104
  role: "group",
105
- className: cn("flex flex-col divide-y divide-kit-line-subtle overflow-hidden rounded-kit-lg border border-kit-line", "[&>*]:rounded-none [&>*]:border-0 [&>*]:shadow-none [&>*]:hover:shadow-none [&>*]:hover:bg-kit-hover [&>[aria-pressed=true]]:bg-kit-selected [&>[aria-pressed=true]]:shadow-none", className),
105
+ className: cn("flex flex-col divide-y divide-kit-line-subtle overflow-hidden rounded-kit-lg border border-kit-line-strong", "[&>*]:rounded-none [&>*]:border-0 [&>*]:shadow-none [&>*]:hover:shadow-none [&>*]:hover:bg-kit-hover [&>[aria-pressed=true]]:bg-kit-selected [&>[aria-pressed=true]]:shadow-none", className),
106
106
  ...props,
107
107
  children
108
108
  });
@@ -204,7 +204,7 @@ function Segmented({ value, onChange, items, size = "md", className, layoutId, i
204
204
  role: "radiogroup",
205
205
  "aria-label": ariaLabel,
206
206
  "data-segmented": true,
207
- className: cn("inline-flex items-center gap-[2px] rounded-kit-md border border-kit-line bg-kit-field-bg p-[2px]", className),
207
+ className: cn("inline-flex items-center gap-[2px] rounded-kit-md border border-kit-line-strong bg-kit-field-bg p-[2px]", className),
208
208
  children: items.map((it, i) => {
209
209
  const active = it.value === value;
210
210
  const sm = size === "sm";
@@ -225,7 +225,7 @@ function Segmented({ value, onChange, items, size = "md", className, layoutId, i
225
225
  layoutId: layoutId ?? `seg-${id}`,
226
226
  transition: pillTransition,
227
227
  "data-seg-indicator": "",
228
- className: "absolute inset-0 rounded-kit-sm bg-kit-selected"
228
+ className: "absolute inset-0 rounded-kit-sm bg-kit-selected ring-1 ring-inset ring-kit-line-strong"
229
229
  }) : null, /* @__PURE__ */ jsxs("span", {
230
230
  className: cn("relative z-[1] inline-flex items-center", !collapseInactive && "gap-1.5"),
231
231
  children: [
@@ -286,7 +286,7 @@ function ToggleGroup({ className, ...props }) {
286
286
  return /* @__PURE__ */ jsx(ToggleGroupSingle.Provider, {
287
287
  value: single,
288
288
  children: /* @__PURE__ */ jsx(ToggleGroup$1, {
289
- className: cn("inline-flex items-center gap-px rounded-kit-md border border-kit-line bg-kit-field-bg p-[2px]", className),
289
+ className: cn("inline-flex items-center gap-px rounded-kit-md border border-kit-line-strong bg-kit-field-bg p-[2px]", className),
290
290
  ...single ? { role: "radiogroup" } : {},
291
291
  ...props
292
292
  })
@@ -301,7 +301,7 @@ function ToggleItem({ className, ...props }) {
301
301
  "aria-checked": state.pressed,
302
302
  "aria-pressed": void 0
303
303
  }) } : {},
304
- className: cn("inline-flex h-6 min-w-6 items-center justify-center gap-1 rounded-kit-sm px-1.5 text-kit-xs font-medium text-kit-fg-3 transition-colors hover:bg-kit-hover hover:text-kit-fg data-[pressed]:bg-kit-selected data-[pressed]:text-kit-fg [&_svg]:size-3.5", className),
304
+ className: cn("inline-flex h-6 min-w-6 items-center justify-center gap-1 rounded-kit-sm px-1.5 text-kit-xs font-medium text-kit-fg-3 transition-colors hover:bg-kit-hover hover:text-kit-fg data-[pressed]:bg-kit-selected data-[pressed]:ring-1 data-[pressed]:ring-inset data-[pressed]:ring-kit-line-strong data-[pressed]:text-kit-fg [&_svg]:size-3.5", className),
305
305
  ...props
306
306
  });
307
307
  }
@@ -1 +1 @@
1
- {"version":3,"file":"controls.js","names":[],"sources":["../../src/ui/controls.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Switch as SwitchPrimitive } from \"@base-ui/react/switch\";\nimport { Checkbox as CheckboxPrimitive } from \"@base-ui/react/checkbox\";\nimport { RadioGroup as RadioGroupPrimitive } from \"@base-ui/react/radio-group\";\nimport { Radio as RadioPrimitive } from \"@base-ui/react/radio\";\nimport { Tooltip as TooltipPrimitive } from \"@base-ui/react/tooltip\";\nimport { Slider as SliderPrimitive } from \"@base-ui/react/slider\";\nimport { ToggleGroup as ToggleGroupPrimitive } from \"@base-ui/react/toggle-group\";\nimport { Toggle as TogglePrimitive } from \"@base-ui/react/toggle\";\nimport { Progress as ProgressPrimitive } from \"@base-ui/react/progress\";\nimport { IconCheck, IconMinus } from \"@tabler/icons-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"framer-motion\";\nimport { cn } from \"../lib/cn\";\nimport { useFieldLabelledBy, useLabelFor } from \"./field-context\";\nimport { TooltipScope } from \"./button\";\nimport { useShortcutHints } from \"./shortcut-hint\";\nimport { TooltipLayer, TooltipRoot } from \"./tooltip-root\";\n\n/* Underlines and selected pills share one spring (DESIGN.md 3.6). */\nconst PILL_SPRING = { type: \"spring\", stiffness: 520, damping: 42 } as const;\n\n/* ── Switch ─────────────────────────────────────────────────────────────── */\nexport function Switch({\n className,\n size = \"md\",\n ...props\n}: SwitchPrimitive.Root.Props & { size?: \"sm\" | \"md\" }) {\n const sm = size === \"sm\";\n const labelledBy = useFieldLabelledBy();\n const labelFor = useLabelFor(props.id);\n return (\n <SwitchPrimitive.Root\n className={cn(\n \"group relative inline-flex shrink-0 items-center rounded-full bg-kit-switch-off transition-colors duration-200 data-[checked]:bg-kit-success data-[disabled]:opacity-40\",\n sm ? \"h-4 w-7\" : \"h-5 w-9\",\n className,\n )}\n aria-labelledby={props[\"aria-labelledby\"] ?? (props[\"aria-label\"] ? undefined : (labelFor ?? (props.id ? undefined : labelledBy)))}\n {...props}\n >\n <SwitchPrimitive.Thumb\n className={cn(\n \"pointer-events-none block rounded-full bg-kit-control-thumb shadow-kit-sm transition-transform duration-200 ease-[var(--kit-ease-spring)]\",\n sm ? \"size-3 translate-x-0.5 data-[checked]:translate-x-[14px]\" : \"size-4 translate-x-0.5 data-[checked]:translate-x-[18px]\",\n )}\n />\n </SwitchPrimitive.Root>\n );\n}\n\n/* ── Checkbox ───────────────────────────────────────────────────────────── */\n/** `checked` keeps V2's tri-state value: true, false or \"indeterminate\". */\nexport function Checkbox({\n className,\n checked,\n ...props\n}: Omit<CheckboxPrimitive.Root.Props, \"checked\" | \"indeterminate\"> & { checked?: boolean | \"indeterminate\" }) {\n const indeterminate = checked === \"indeterminate\";\n const labelFor = useLabelFor(props.id);\n return (\n <CheckboxPrimitive.Root\n aria-labelledby={props[\"aria-labelledby\"] ?? (props[\"aria-label\"] ? undefined : labelFor)}\n className={cn(\n \"peer flex size-4 shrink-0 items-center justify-center rounded-kit-sm border border-kit-line-strong bg-kit-control-bg shadow-kit-xs transition-colors hover:border-[var(--kit-emphasis-line)] data-[checked]:border-kit-inverse data-[checked]:bg-kit-inverse data-[indeterminate]:border-kit-inverse data-[indeterminate]:bg-kit-inverse\",\n className,\n )}\n checked={checked === undefined ? undefined : checked === true}\n indeterminate={indeterminate}\n {...props}\n >\n <CheckboxPrimitive.Indicator className=\"text-kit-fg-inverse\">\n {indeterminate ? <IconMinus className=\"size-3\" stroke={3} /> : <IconCheck className=\"size-3\" stroke={3} />}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n\n/* ── Radio ──────────────────────────────────────────────────────────────── */\nexport const RadioGroup = RadioGroupPrimitive;\nexport function Radio({ className, ...props }: RadioPrimitive.Root.Props) {\n return (\n <RadioPrimitive.Root\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded-full border border-kit-line-strong bg-kit-control-bg shadow-kit-xs transition-colors hover:border-[var(--kit-emphasis-line)] data-[checked]:border-kit-accent\",\n className,\n )}\n {...props}\n >\n <RadioPrimitive.Indicator className=\"block size-2 rounded-full bg-kit-accent\" />\n </RadioPrimitive.Root>\n );\n}\n\n/** Large selectable card used for choices (plans, project kinds, roles). */\nexport function ChoiceCard({\n selected,\n onSelect,\n icon,\n title,\n description,\n badge,\n className,\n children,\n}: {\n selected: boolean;\n onSelect: () => void;\n icon?: React.ReactNode;\n title: React.ReactNode;\n description?: React.ReactNode;\n badge?: React.ReactNode;\n className?: string;\n children?: React.ReactNode;\n}) {\n return (\n <button\n type=\"button\"\n onClick={onSelect}\n aria-pressed={selected}\n className={cn(\n \"focus-inset group relative flex w-full flex-col gap-1.5 rounded-kit-lg border bg-kit-control-bg px-3 py-2.5 text-left transition-[border-color,box-shadow,background-color] duration-150\", // inset: option cards often sit in a clipped, gapless list\n selected\n ? \"border-[var(--kit-emphasis-line)] shadow-kit-ring-field\"\n : \"border-kit-line hover:border-kit-line-strong hover:shadow-kit-sm\",\n className,\n )}\n >\n <div className=\"flex items-start gap-3\">\n {icon ? (\n <span className={cn(\"mt-0.5 flex shrink-0 items-center justify-center text-kit-fg-2 [&_svg]:size-4\", selected && \"text-kit-fg\")}>\n {icon}\n </span>\n ) : null}\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2 text-kit-sm font-medium text-kit-fg\">\n {title}\n {badge}\n </div>\n {description ? <p className=\"mt-0.5 text-[13px] leading-[18px] text-kit-fg-2\">{description}</p> : null}\n </div>\n <span\n className={cn(\n \"mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border transition-colors\",\n selected ? \"border-kit-inverse bg-kit-inverse text-kit-fg-inverse\" : \"border-kit-line-strong\",\n )}\n >\n {selected ? <IconCheck className=\"size-2.5\" stroke={3.5} /> : null}\n </span>\n </div>\n {children}\n </button>\n );\n}\n\n/** D15: 2–4 choices → one hairline list of compact rows. Wrap <ChoiceCard>s in it; they lose their own card chrome. */\nexport function ChoiceList({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n role=\"group\"\n className={cn(\n \"flex flex-col divide-y divide-kit-line-subtle overflow-hidden rounded-kit-lg border border-kit-line\",\n \"[&>*]:rounded-none [&>*]:border-0 [&>*]:shadow-none [&>*]:hover:shadow-none [&>*]:hover:bg-kit-hover [&>[aria-pressed=true]]:bg-kit-selected [&>[aria-pressed=true]]:shadow-none\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\n/* ── Slider ─────────────────────────────────────────────────────────────── */\nexport function Slider({\n className,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n label,\n ...props\n}: Omit<SliderPrimitive.Root.Props<number | readonly number[]>, \"className\"> & {\n className?: string;\n /** accessible name for the thumb(s) */\n label?: string;\n}) {\n const name = ariaLabel ?? label;\n const v = props.value ?? props.defaultValue ?? [0];\n const thumbs = Array.isArray(v) ? v.length : 1;\n return (\n <SliderPrimitive.Root className={cn(\"w-full\", className)} {...props}>\n <SliderPrimitive.Control className=\"relative flex h-5 w-full touch-none select-none items-center\">\n {/* Figma §4.3 slider: 4px track, --fg-2 fill, 12px light thumb with a border (control-thumb lifts off the dark track) */}\n <SliderPrimitive.Track className=\"relative h-1 w-full grow overflow-hidden rounded-full bg-[var(--kit-track-line)]\">\n <SliderPrimitive.Indicator className=\"absolute h-full bg-kit-fg-2\" />\n </SliderPrimitive.Track>\n {Array.from({ length: thumbs }, (_, i) => (\n <SliderPrimitive.Thumb\n key={i}\n index={thumbs > 1 ? i : undefined}\n getAriaLabel={name ? () => name : undefined}\n aria-labelledby={name ? undefined : ariaLabelledby}\n className=\"block size-3 rounded-full border border-kit-line-strong bg-kit-control-thumb shadow-kit-md transition-transform hover:scale-110 has-[:focus-visible]:scale-110 has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-kit-focus-ring has-[:focus-visible]:[outline-style:solid]\"\n />\n ))}\n </SliderPrimitive.Control>\n </SliderPrimitive.Root>\n );\n}\n\n/* V2's overlay <Tooltip> (side bottom, 350ms) for collapsed and icon-only segments, built on the shared ink layer. */\nfunction SegmentTooltip({ content, shortcut, children }: { content: React.ReactNode; shortcut?: string; children: React.ReactElement }) {\n const hints = useShortcutHints();\n return (\n <TooltipScope.Provider value>\n <TooltipRoot>\n <TooltipPrimitive.Trigger delay={350} render={children} />\n <TooltipLayer side=\"bottom\">\n <span className=\"line-clamp-[8] min-w-0 whitespace-normal [overflow-wrap:anywhere]\">{content}</span>\n {shortcut && hints ? (\n <kbd data-hint=\"shortcuts\" className=\"mt-px shrink-0 rounded-kit-sm bg-kit-ink-active px-1 font-kit-sans text-kit-2xs\">\n {shortcut}\n </kbd>\n ) : null}\n </TooltipLayer>\n </TooltipRoot>\n </TooltipScope.Provider>\n );\n}\n\n/* ── Segmented ───────────────────────────────────────────────────────────\n Two deliberate looks (founder: no \"AI-sloppy\" grey pills with counts inside):\n • variant=\"tabs\" (opt-in) — quiet text tabs, muted tabular count, 1.5px animated underline.\n Use for filters, view sections, panel tabs.\n • variant=\"toggle\" (default) — slim hairline-bordered control, subtle selected fill, no shadow.\n Use for binary/ternary switches: list|grid, light|dark, desktop|tablet|mobile.\n Pass `count` on items instead of baking numbers into labels. */\nexport type SegmentedItem<T extends string> = {\n value: T;\n label: React.ReactNode;\n icon?: React.ReactNode;\n disabled?: boolean;\n count?: number;\n tooltip?: React.ReactNode;\n shortcut?: string;\n name?: string;\n};\n\nexport function Segmented<T extends string>({\n value,\n onChange,\n items,\n size = \"md\",\n className,\n layoutId,\n iconOnly,\n collapseInactive,\n variant,\n bordered,\n \"aria-label\": ariaLabel,\n}: {\n \"aria-label\"?: string;\n value: T;\n onChange: (v: T) => void;\n items: SegmentedItem<T>[];\n /** Toggle variant: only the selected item shows its label; the others collapse to icon + tooltip. */\n collapseInactive?: boolean;\n size?: \"sm\" | \"md\";\n className?: string;\n layoutId?: string;\n iconOnly?: boolean;\n variant?: \"tabs\" | \"toggle\";\n /** tabs only: draw a hairline under the whole tab row */\n bordered?: boolean;\n}) {\n const id = React.useId();\n const v = variant ?? \"toggle\";\n const reduceMotion = useReducedMotion();\n const pillTransition = reduceMotion ? { duration: 0 } : PILL_SPRING;\n const onKey = (e: React.KeyboardEvent, i: number) => {\n const enabled = items.filter((x) => !x.disabled);\n const idx = enabled.findIndex((x) => x.value === items[i].value);\n const fwd = e.key === \"ArrowRight\" || e.key === \"ArrowDown\";\n const back = e.key === \"ArrowLeft\" || e.key === \"ArrowUp\";\n const next = fwd\n ? enabled[(idx + 1) % enabled.length]\n : back\n ? enabled[(idx - 1 + enabled.length) % enabled.length]\n : e.key === \"Home\"\n ? enabled[0]\n : e.key === \"End\"\n ? enabled[enabled.length - 1]\n : null;\n if (next) {\n e.preventDefault();\n onChange(next.value);\n // roving tabindex: keep keyboard focus on the newly selected item\n const group = (e.currentTarget as HTMLElement).closest(\"[data-segmented]\");\n requestAnimationFrame(() => group?.querySelector<HTMLElement>(`[data-seg-value=\"${CSS.escape(next.value)}\"]`)?.focus());\n }\n };\n\n if (v === \"tabs\") {\n return (\n <div role=\"tablist\" aria-label={ariaLabel} data-segmented className={cn(\"inline-flex items-center gap-5\", bordered && \"border-b border-kit-line\", className)}>\n {items.map((it, i) => {\n const active = it.value === value;\n return (\n <button\n key={it.value}\n role=\"tab\"\n type=\"button\"\n data-seg-value={it.value}\n aria-selected={active}\n tabIndex={active ? 0 : -1}\n disabled={it.disabled}\n onKeyDown={(e) => onKey(e, i)}\n onClick={() => onChange(it.value)}\n className={cn(\n \"group relative inline-flex items-center justify-center gap-1.5 whitespace-nowrap font-medium tracking-[-0.01em] transition-colors duration-150 disabled:opacity-40 [&_svg]:size-4\",\n size === \"sm\" ? \"h-7 text-kit-xs [&_svg]:size-3.5\" : \"h-8 text-kit-sm\",\n active ? \"text-kit-fg\" : \"text-kit-fg-3 hover:text-kit-fg-2\",\n )}\n >\n {it.icon}\n {iconOnly ? null : it.label}\n {typeof it.count === \"number\" ? (\n <span className={cn(\"text-kit-xs font-normal tabular-nums\", active ? \"text-kit-fg-2\" : \"text-kit-fg-4\")}>{it.count}</span>\n ) : null}\n {active ? (\n <motion.span\n layoutId={layoutId ?? `tab-${id}`}\n transition={pillTransition}\n data-seg-indicator=\"\"\n className={cn(\"absolute inset-x-0 h-[1.5px] rounded-full bg-kit-fg\", bordered ? \"-bottom-px\" : \"bottom-0\")}\n />\n ) : null}\n </button>\n );\n })}\n </div>\n );\n }\n\n return (\n /* Toggle metrics (D29, founder): container 1px border + 2px padding, 2px between items, pill radius = container (6) − 2.\n md items are 28px tall and icon-only items exactly 28×28; sm items 24px. Collapsing items keep the icon at the same\n inset in both states (6px md / 5px sm) — only the label wrapper animates its width, with the icon→label gap inside it. */\n <div role=\"radiogroup\" aria-label={ariaLabel} data-segmented className={cn(\"inline-flex items-center gap-[2px] rounded-kit-md border border-kit-line bg-kit-field-bg p-[2px]\", className)}>\n {items.map((it, i) => {\n const active = it.value === value;\n const sm = size === \"sm\";\n const hasLabel = !iconOnly && it.label !== \"\" && it.label != null;\n const showLabel = hasLabel && (!collapseInactive || active);\n const btn = (\n <button\n key={it.value}\n role=\"radio\"\n type=\"button\"\n data-seg-value={it.value}\n aria-checked={active}\n aria-label={iconOnly && typeof it.label === \"string\" ? it.label : collapseInactive ? it.name : undefined}\n tabIndex={active ? 0 : -1}\n disabled={it.disabled}\n onKeyDown={(e) => onKey(e, i)}\n onClick={() => onChange(it.value)}\n className={cn(\n \"relative inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-kit-sm font-medium transition-[color,background-color,padding] duration-150 disabled:opacity-40 [&_svg]:size-4 [&_svg]:shrink-0\",\n sm ? \"h-6 text-kit-xs [&_svg]:size-3.5\" : \"h-7 text-kit-sm\",\n iconOnly || !hasLabel\n ? sm ? \"w-6 px-0\" : \"w-7 px-0\"\n : collapseInactive\n ? sm ? (active ? \"pl-[5px] pr-2\" : \"px-[5px]\") : active ? \"pl-1.5 pr-2.5\" : \"px-1.5\"\n : sm ? \"px-2\" : \"px-2.5\",\n active ? \"text-kit-fg\" : \"text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg\",\n )}\n >\n {active ? (\n <motion.span\n layoutId={layoutId ?? `seg-${id}`}\n transition={pillTransition}\n data-seg-indicator=\"\"\n className=\"absolute inset-0 rounded-kit-sm bg-kit-selected\"\n />\n ) : null}\n <span className={cn(\"relative z-[1] inline-flex items-center\", !collapseInactive && \"gap-1.5\")}>\n {it.icon}\n {!hasLabel ? null : collapseInactive ? (\n <AnimatePresence initial={false}>\n {showLabel ? (\n <motion.span\n key=\"label\"\n initial={{ width: 0, opacity: 0 }}\n animate={{ width: \"auto\", opacity: 1 }}\n exit={{ width: 0, opacity: 0 }}\n transition={reduceMotion ? { duration: 0 } : { duration: 0.18, ease: [0.2, 0, 0, 1] }}\n className=\"inline-flex overflow-hidden\"\n >\n <span className={sm ? \"pl-1\" : \"pl-1.5\"}>{it.label}</span>\n </motion.span>\n ) : null}\n </AnimatePresence>\n ) : (\n it.label\n )}\n {typeof it.count === \"number\" ? <span className=\"text-kit-xs font-normal tabular-nums text-kit-fg-3\">{it.count}</span> : null}\n </span>\n </button>\n );\n if (collapseInactive && it.tooltip)\n return (\n <SegmentTooltip key={it.value} content={it.tooltip} shortcut={it.shortcut}>\n {btn}\n </SegmentTooltip>\n );\n return iconOnly && typeof it.label === \"string\" ? (\n <SegmentTooltip key={it.value} content={it.label}>\n {btn}\n </SegmentTooltip>\n ) : (\n btn\n );\n })}\n </div>\n );\n}\n\n/* ── Toggle group (toolbar style) ───────────────────────────────────────\n One choice (the default) is a radio group in WAI-ARIA: role=\"radiogroup\" with role=\"radio\" + aria-checked items, as\n V2's Radix ToggleGroup type=\"single\" renders. `multiple` keeps group + aria-pressed (independent toggles). The arrow\n keys rove the items either way (Base UI's composite). */\nconst ToggleGroupSingle = React.createContext(false);\nexport function ToggleGroup({ className, ...props }: Omit<ToggleGroupPrimitive.Props, \"className\"> & { className?: string }) {\n const single = !props.multiple;\n return (\n <ToggleGroupSingle.Provider value={single}>\n <ToggleGroupPrimitive\n className={cn(\"inline-flex items-center gap-px rounded-kit-md border border-kit-line bg-kit-field-bg p-[2px]\", className)}\n {...(single ? { role: \"radiogroup\" } : {})}\n {...props}\n />\n </ToggleGroupSingle.Provider>\n );\n}\nexport function ToggleItem({ className, ...props }: Omit<TogglePrimitive.Props, \"className\"> & { className?: string }) {\n const single = React.useContext(ToggleGroupSingle);\n return (\n <TogglePrimitive\n {...(single\n ? { render: (p: React.ComponentProps<\"button\">, state: { pressed: boolean }) => <button {...p} role=\"radio\" aria-checked={state.pressed} aria-pressed={undefined} /> }\n : {})}\n className={cn(\n \"inline-flex h-6 min-w-6 items-center justify-center gap-1 rounded-kit-sm px-1.5 text-kit-xs font-medium text-kit-fg-3 transition-colors hover:bg-kit-hover hover:text-kit-fg data-[pressed]:bg-kit-selected data-[pressed]:text-kit-fg [&_svg]:size-3.5\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/* ── Progress ──────────────────────────────────────────────────────────── */\nconst progressTones = {\n success: \"bg-kit-success\",\n accent: \"bg-kit-accent\",\n warning: \"bg-kit-warning\",\n danger: \"bg-kit-danger\",\n // --bar-fill: ink in light, a quiet grey in dark (no near-white glare on a dark track)\n ink: \"bg-[var(--kit-bar-fill)]\",\n brand: \"bg-[var(--kit-bar-fill)]\",\n};\nexport function Progress({\n value,\n className,\n tone = \"success\",\n size = \"md\",\n label = \"Progress\",\n}: {\n value: number;\n className?: string;\n /** accessible name, e.g. \"AI credits used\" */\n label?: string;\n tone?: keyof typeof progressTones;\n size?: \"sm\" | \"md\";\n}) {\n const pct = Math.min(100, Math.max(0, value));\n return (\n <ProgressPrimitive.Root\n value={pct}\n aria-label={label}\n className={cn(\n \"relative w-full overflow-hidden rounded-full bg-[var(--kit-track)]\",\n size === \"sm\" ? \"h-1\" : \"h-1.5\",\n className,\n )}\n >\n <ProgressPrimitive.Indicator\n className={cn(\"h-full rounded-full transition-[width] duration-500 ease-[var(--kit-ease-out-soft)]\", progressTones[tone])}\n style={{ width: `${pct}%` }}\n />\n </ProgressPrimitive.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,IAAM,cAAc;CAAE,MAAM;CAAU,WAAW;CAAK,SAAS;AAAG;AAGlE,SAAgB,OAAO,EACrB,WACA,OAAO,MACP,GAAG,SACmD;CACtD,MAAM,KAAK,SAAS;CACpB,MAAM,aAAa,mBAAmB;CACtC,MAAM,WAAW,YAAY,MAAM,EAAE;CACrC,OACE,oBAAC,SAAgB,MAAjB;EACE,WAAW,GACT,2KACA,KAAK,YAAY,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O,QAAQ,SACxB,SACF;EAEA,UAAA,oBAAC,WAAkB,WAAnB;GACE,WAAW,GAAG,uFAAuF,cAAc,KAAK;GACxH,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG;EAC3B,CAAA;CACqB,CAAA;AAE5B"}
1
+ {"version":3,"file":"controls.js","names":[],"sources":["../../src/ui/controls.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Switch as SwitchPrimitive } from \"@base-ui/react/switch\";\nimport { Checkbox as CheckboxPrimitive } from \"@base-ui/react/checkbox\";\nimport { RadioGroup as RadioGroupPrimitive } from \"@base-ui/react/radio-group\";\nimport { Radio as RadioPrimitive } from \"@base-ui/react/radio\";\nimport { Tooltip as TooltipPrimitive } from \"@base-ui/react/tooltip\";\nimport { Slider as SliderPrimitive } from \"@base-ui/react/slider\";\nimport { ToggleGroup as ToggleGroupPrimitive } from \"@base-ui/react/toggle-group\";\nimport { Toggle as TogglePrimitive } from \"@base-ui/react/toggle\";\nimport { Progress as ProgressPrimitive } from \"@base-ui/react/progress\";\nimport { IconCheck, IconMinus } from \"@tabler/icons-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"framer-motion\";\nimport { cn } from \"../lib/cn\";\nimport { useFieldLabelledBy, useLabelFor } from \"./field-context\";\nimport { TooltipScope } from \"./button\";\nimport { useShortcutHints } from \"./shortcut-hint\";\nimport { TooltipLayer, TooltipRoot } from \"./tooltip-root\";\n\n/* Underlines and selected pills share one spring (DESIGN.md 3.6). */\nconst PILL_SPRING = { type: \"spring\", stiffness: 520, damping: 42 } as const;\n\n/* ── Switch ─────────────────────────────────────────────────────────────── */\nexport function Switch({\n className,\n size = \"md\",\n ...props\n}: SwitchPrimitive.Root.Props & { size?: \"sm\" | \"md\" }) {\n const sm = size === \"sm\";\n const labelledBy = useFieldLabelledBy();\n const labelFor = useLabelFor(props.id);\n return (\n <SwitchPrimitive.Root\n className={cn(\n \"group relative inline-flex shrink-0 items-center rounded-full bg-kit-switch-off transition-colors duration-200 data-[checked]:bg-kit-success data-[disabled]:opacity-40\",\n sm ? \"h-4 w-7\" : \"h-5 w-9\",\n className,\n )}\n aria-labelledby={props[\"aria-labelledby\"] ?? (props[\"aria-label\"] ? undefined : (labelFor ?? (props.id ? undefined : labelledBy)))}\n {...props}\n >\n <SwitchPrimitive.Thumb\n className={cn(\n \"pointer-events-none block rounded-full bg-kit-control-thumb shadow-kit-sm transition-transform duration-200 ease-[var(--kit-ease-spring)]\",\n sm ? \"size-3 translate-x-0.5 data-[checked]:translate-x-[14px]\" : \"size-4 translate-x-0.5 data-[checked]:translate-x-[18px]\",\n )}\n />\n </SwitchPrimitive.Root>\n );\n}\n\n/* ── Checkbox ───────────────────────────────────────────────────────────── */\n/** `checked` keeps V2's tri-state value: true, false or \"indeterminate\". */\nexport function Checkbox({\n className,\n checked,\n ...props\n}: Omit<CheckboxPrimitive.Root.Props, \"checked\" | \"indeterminate\"> & { checked?: boolean | \"indeterminate\" }) {\n const indeterminate = checked === \"indeterminate\";\n const labelFor = useLabelFor(props.id);\n return (\n <CheckboxPrimitive.Root\n aria-labelledby={props[\"aria-labelledby\"] ?? (props[\"aria-label\"] ? undefined : labelFor)}\n className={cn(\n \"peer flex size-4 shrink-0 items-center justify-center rounded-kit-sm border border-kit-line-strong bg-kit-control-bg shadow-kit-xs transition-colors hover:border-[var(--kit-emphasis-line)] data-[checked]:border-kit-inverse data-[checked]:bg-kit-inverse data-[indeterminate]:border-kit-inverse data-[indeterminate]:bg-kit-inverse\",\n className,\n )}\n checked={checked === undefined ? undefined : checked === true}\n indeterminate={indeterminate}\n {...props}\n >\n <CheckboxPrimitive.Indicator className=\"text-kit-fg-inverse\">\n {indeterminate ? <IconMinus className=\"size-3\" stroke={3} /> : <IconCheck className=\"size-3\" stroke={3} />}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n\n/* ── Radio ──────────────────────────────────────────────────────────────── */\nexport const RadioGroup = RadioGroupPrimitive;\nexport function Radio({ className, ...props }: RadioPrimitive.Root.Props) {\n return (\n <RadioPrimitive.Root\n className={cn(\n \"flex size-4 shrink-0 items-center justify-center rounded-full border border-kit-line-strong bg-kit-control-bg shadow-kit-xs transition-colors hover:border-[var(--kit-emphasis-line)] data-[checked]:border-kit-accent\",\n className,\n )}\n {...props}\n >\n <RadioPrimitive.Indicator className=\"block size-2 rounded-full bg-kit-accent\" />\n </RadioPrimitive.Root>\n );\n}\n\n/** Large selectable card used for choices (plans, project kinds, roles). */\nexport function ChoiceCard({\n selected,\n onSelect,\n icon,\n title,\n description,\n badge,\n className,\n children,\n}: {\n selected: boolean;\n onSelect: () => void;\n icon?: React.ReactNode;\n title: React.ReactNode;\n description?: React.ReactNode;\n badge?: React.ReactNode;\n className?: string;\n children?: React.ReactNode;\n}) {\n return (\n <button\n type=\"button\"\n onClick={onSelect}\n aria-pressed={selected}\n className={cn(\n \"focus-inset group relative flex w-full flex-col gap-1.5 rounded-kit-lg border bg-kit-control-bg px-3 py-2.5 text-left transition-[border-color,box-shadow,background-color] duration-150\", // inset: option cards often sit in a clipped, gapless list\n selected\n ? \"border-[var(--kit-emphasis-line)] shadow-kit-ring-field\"\n : \"border-kit-line-strong hover:border-[var(--kit-emphasis-line)] hover:shadow-kit-sm\",\n className,\n )}\n >\n <div className=\"flex items-start gap-3\">\n {icon ? (\n <span className={cn(\"mt-0.5 flex shrink-0 items-center justify-center text-kit-fg-2 [&_svg]:size-4\", selected && \"text-kit-fg\")}>\n {icon}\n </span>\n ) : null}\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2 text-kit-sm font-medium text-kit-fg\">\n {title}\n {badge}\n </div>\n {description ? <p className=\"mt-0.5 text-[13px] leading-[18px] text-kit-fg-2\">{description}</p> : null}\n </div>\n <span\n className={cn(\n \"mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border transition-colors\",\n selected ? \"border-kit-inverse bg-kit-inverse text-kit-fg-inverse\" : \"border-kit-line-strong\",\n )}\n >\n {selected ? <IconCheck className=\"size-2.5\" stroke={3.5} /> : null}\n </span>\n </div>\n {children}\n </button>\n );\n}\n\n/** D15: 2–4 choices → one hairline list of compact rows. Wrap <ChoiceCard>s in it; they lose their own card chrome. */\nexport function ChoiceList({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n role=\"group\"\n className={cn(\n \"flex flex-col divide-y divide-kit-line-subtle overflow-hidden rounded-kit-lg border border-kit-line-strong\",\n \"[&>*]:rounded-none [&>*]:border-0 [&>*]:shadow-none [&>*]:hover:shadow-none [&>*]:hover:bg-kit-hover [&>[aria-pressed=true]]:bg-kit-selected [&>[aria-pressed=true]]:shadow-none\",\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\n/* ── Slider ─────────────────────────────────────────────────────────────── */\nexport function Slider({\n className,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n label,\n ...props\n}: Omit<SliderPrimitive.Root.Props<number | readonly number[]>, \"className\"> & {\n className?: string;\n /** accessible name for the thumb(s) */\n label?: string;\n}) {\n const name = ariaLabel ?? label;\n const v = props.value ?? props.defaultValue ?? [0];\n const thumbs = Array.isArray(v) ? v.length : 1;\n return (\n <SliderPrimitive.Root className={cn(\"w-full\", className)} {...props}>\n <SliderPrimitive.Control className=\"relative flex h-5 w-full touch-none select-none items-center\">\n {/* Figma §4.3 slider: 4px track, --fg-2 fill, 12px light thumb with a border (control-thumb lifts off the dark track) */}\n <SliderPrimitive.Track className=\"relative h-1 w-full grow overflow-hidden rounded-full bg-[var(--kit-track-line)]\">\n <SliderPrimitive.Indicator className=\"absolute h-full bg-kit-fg-2\" />\n </SliderPrimitive.Track>\n {Array.from({ length: thumbs }, (_, i) => (\n <SliderPrimitive.Thumb\n key={i}\n index={thumbs > 1 ? i : undefined}\n getAriaLabel={name ? () => name : undefined}\n aria-labelledby={name ? undefined : ariaLabelledby}\n className=\"block size-3 rounded-full border border-kit-line-strong bg-kit-control-thumb shadow-kit-md transition-transform hover:scale-110 has-[:focus-visible]:scale-110 has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-kit-focus-ring has-[:focus-visible]:[outline-style:solid]\"\n />\n ))}\n </SliderPrimitive.Control>\n </SliderPrimitive.Root>\n );\n}\n\n/* V2's overlay <Tooltip> (side bottom, 350ms) for collapsed and icon-only segments, built on the shared ink layer. */\nfunction SegmentTooltip({ content, shortcut, children }: { content: React.ReactNode; shortcut?: string; children: React.ReactElement }) {\n const hints = useShortcutHints();\n return (\n <TooltipScope.Provider value>\n <TooltipRoot>\n <TooltipPrimitive.Trigger delay={350} render={children} />\n <TooltipLayer side=\"bottom\">\n <span className=\"line-clamp-[8] min-w-0 whitespace-normal [overflow-wrap:anywhere]\">{content}</span>\n {shortcut && hints ? (\n <kbd data-hint=\"shortcuts\" className=\"mt-px shrink-0 rounded-kit-sm bg-kit-ink-active px-1 font-kit-sans text-kit-2xs\">\n {shortcut}\n </kbd>\n ) : null}\n </TooltipLayer>\n </TooltipRoot>\n </TooltipScope.Provider>\n );\n}\n\n/* ── Segmented ───────────────────────────────────────────────────────────\n Two deliberate looks (founder: no \"AI-sloppy\" grey pills with counts inside):\n • variant=\"tabs\" (opt-in) — quiet text tabs, muted tabular count, 1.5px animated underline.\n Use for filters, view sections, panel tabs.\n • variant=\"toggle\" (default) — slim hairline-bordered control, subtle selected fill, no shadow.\n Use for binary/ternary switches: list|grid, light|dark, desktop|tablet|mobile.\n Pass `count` on items instead of baking numbers into labels. */\nexport type SegmentedItem<T extends string> = {\n value: T;\n label: React.ReactNode;\n icon?: React.ReactNode;\n disabled?: boolean;\n count?: number;\n tooltip?: React.ReactNode;\n shortcut?: string;\n name?: string;\n};\n\nexport function Segmented<T extends string>({\n value,\n onChange,\n items,\n size = \"md\",\n className,\n layoutId,\n iconOnly,\n collapseInactive,\n variant,\n bordered,\n \"aria-label\": ariaLabel,\n}: {\n \"aria-label\"?: string;\n value: T;\n onChange: (v: T) => void;\n items: SegmentedItem<T>[];\n /** Toggle variant: only the selected item shows its label; the others collapse to icon + tooltip. */\n collapseInactive?: boolean;\n size?: \"sm\" | \"md\";\n className?: string;\n layoutId?: string;\n iconOnly?: boolean;\n variant?: \"tabs\" | \"toggle\";\n /** tabs only: draw a hairline under the whole tab row */\n bordered?: boolean;\n}) {\n const id = React.useId();\n const v = variant ?? \"toggle\";\n const reduceMotion = useReducedMotion();\n const pillTransition = reduceMotion ? { duration: 0 } : PILL_SPRING;\n const onKey = (e: React.KeyboardEvent, i: number) => {\n const enabled = items.filter((x) => !x.disabled);\n const idx = enabled.findIndex((x) => x.value === items[i].value);\n const fwd = e.key === \"ArrowRight\" || e.key === \"ArrowDown\";\n const back = e.key === \"ArrowLeft\" || e.key === \"ArrowUp\";\n const next = fwd\n ? enabled[(idx + 1) % enabled.length]\n : back\n ? enabled[(idx - 1 + enabled.length) % enabled.length]\n : e.key === \"Home\"\n ? enabled[0]\n : e.key === \"End\"\n ? enabled[enabled.length - 1]\n : null;\n if (next) {\n e.preventDefault();\n onChange(next.value);\n // roving tabindex: keep keyboard focus on the newly selected item\n const group = (e.currentTarget as HTMLElement).closest(\"[data-segmented]\");\n requestAnimationFrame(() => group?.querySelector<HTMLElement>(`[data-seg-value=\"${CSS.escape(next.value)}\"]`)?.focus());\n }\n };\n\n if (v === \"tabs\") {\n return (\n <div role=\"tablist\" aria-label={ariaLabel} data-segmented className={cn(\"inline-flex items-center gap-5\", bordered && \"border-b border-kit-line\", className)}>\n {items.map((it, i) => {\n const active = it.value === value;\n return (\n <button\n key={it.value}\n role=\"tab\"\n type=\"button\"\n data-seg-value={it.value}\n aria-selected={active}\n tabIndex={active ? 0 : -1}\n disabled={it.disabled}\n onKeyDown={(e) => onKey(e, i)}\n onClick={() => onChange(it.value)}\n className={cn(\n \"group relative inline-flex items-center justify-center gap-1.5 whitespace-nowrap font-medium tracking-[-0.01em] transition-colors duration-150 disabled:opacity-40 [&_svg]:size-4\",\n size === \"sm\" ? \"h-7 text-kit-xs [&_svg]:size-3.5\" : \"h-8 text-kit-sm\",\n active ? \"text-kit-fg\" : \"text-kit-fg-3 hover:text-kit-fg-2\",\n )}\n >\n {it.icon}\n {iconOnly ? null : it.label}\n {typeof it.count === \"number\" ? (\n <span className={cn(\"text-kit-xs font-normal tabular-nums\", active ? \"text-kit-fg-2\" : \"text-kit-fg-4\")}>{it.count}</span>\n ) : null}\n {active ? (\n <motion.span\n layoutId={layoutId ?? `tab-${id}`}\n transition={pillTransition}\n data-seg-indicator=\"\"\n className={cn(\"absolute inset-x-0 h-[1.5px] rounded-full bg-kit-fg\", bordered ? \"-bottom-px\" : \"bottom-0\")}\n />\n ) : null}\n </button>\n );\n })}\n </div>\n );\n }\n\n return (\n /* Toggle metrics (D29, founder): container 1px border + 2px padding, 2px between items, pill radius = container (6) − 2.\n md items are 28px tall and icon-only items exactly 28×28; sm items 24px. Collapsing items keep the icon at the same\n inset in both states (6px md / 5px sm) — only the label wrapper animates its width, with the icon→label gap inside it. */\n <div role=\"radiogroup\" aria-label={ariaLabel} data-segmented className={cn(\"inline-flex items-center gap-[2px] rounded-kit-md border border-kit-line-strong bg-kit-field-bg p-[2px]\", className)}>\n {items.map((it, i) => {\n const active = it.value === value;\n const sm = size === \"sm\";\n const hasLabel = !iconOnly && it.label !== \"\" && it.label != null;\n const showLabel = hasLabel && (!collapseInactive || active);\n const btn = (\n <button\n key={it.value}\n role=\"radio\"\n type=\"button\"\n data-seg-value={it.value}\n aria-checked={active}\n aria-label={iconOnly && typeof it.label === \"string\" ? it.label : collapseInactive ? it.name : undefined}\n tabIndex={active ? 0 : -1}\n disabled={it.disabled}\n onKeyDown={(e) => onKey(e, i)}\n onClick={() => onChange(it.value)}\n className={cn(\n \"relative inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-kit-sm font-medium transition-[color,background-color,padding] duration-150 disabled:opacity-40 [&_svg]:size-4 [&_svg]:shrink-0\",\n sm ? \"h-6 text-kit-xs [&_svg]:size-3.5\" : \"h-7 text-kit-sm\",\n iconOnly || !hasLabel\n ? sm ? \"w-6 px-0\" : \"w-7 px-0\"\n : collapseInactive\n ? sm ? (active ? \"pl-[5px] pr-2\" : \"px-[5px]\") : active ? \"pl-1.5 pr-2.5\" : \"px-1.5\"\n : sm ? \"px-2\" : \"px-2.5\",\n active ? \"text-kit-fg\" : \"text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg\",\n )}\n >\n {active ? (\n <motion.span\n layoutId={layoutId ?? `seg-${id}`}\n transition={pillTransition}\n data-seg-indicator=\"\"\n className=\"absolute inset-0 rounded-kit-sm bg-kit-selected ring-1 ring-inset ring-kit-line-strong\"\n />\n ) : null}\n <span className={cn(\"relative z-[1] inline-flex items-center\", !collapseInactive && \"gap-1.5\")}>\n {it.icon}\n {!hasLabel ? null : collapseInactive ? (\n <AnimatePresence initial={false}>\n {showLabel ? (\n <motion.span\n key=\"label\"\n initial={{ width: 0, opacity: 0 }}\n animate={{ width: \"auto\", opacity: 1 }}\n exit={{ width: 0, opacity: 0 }}\n transition={reduceMotion ? { duration: 0 } : { duration: 0.18, ease: [0.2, 0, 0, 1] }}\n className=\"inline-flex overflow-hidden\"\n >\n <span className={sm ? \"pl-1\" : \"pl-1.5\"}>{it.label}</span>\n </motion.span>\n ) : null}\n </AnimatePresence>\n ) : (\n it.label\n )}\n {typeof it.count === \"number\" ? <span className=\"text-kit-xs font-normal tabular-nums text-kit-fg-3\">{it.count}</span> : null}\n </span>\n </button>\n );\n if (collapseInactive && it.tooltip)\n return (\n <SegmentTooltip key={it.value} content={it.tooltip} shortcut={it.shortcut}>\n {btn}\n </SegmentTooltip>\n );\n return iconOnly && typeof it.label === \"string\" ? (\n <SegmentTooltip key={it.value} content={it.label}>\n {btn}\n </SegmentTooltip>\n ) : (\n btn\n );\n })}\n </div>\n );\n}\n\n/* ── Toggle group (toolbar style) ───────────────────────────────────────\n One choice (the default) is a radio group in WAI-ARIA: role=\"radiogroup\" with role=\"radio\" + aria-checked items, as\n V2's Radix ToggleGroup type=\"single\" renders. `multiple` keeps group + aria-pressed (independent toggles). The arrow\n keys rove the items either way (Base UI's composite). */\nconst ToggleGroupSingle = React.createContext(false);\nexport function ToggleGroup({ className, ...props }: Omit<ToggleGroupPrimitive.Props, \"className\"> & { className?: string }) {\n const single = !props.multiple;\n return (\n <ToggleGroupSingle.Provider value={single}>\n <ToggleGroupPrimitive\n className={cn(\"inline-flex items-center gap-px rounded-kit-md border border-kit-line-strong bg-kit-field-bg p-[2px]\", className)}\n {...(single ? { role: \"radiogroup\" } : {})}\n {...props}\n />\n </ToggleGroupSingle.Provider>\n );\n}\nexport function ToggleItem({ className, ...props }: Omit<TogglePrimitive.Props, \"className\"> & { className?: string }) {\n const single = React.useContext(ToggleGroupSingle);\n return (\n <TogglePrimitive\n {...(single\n ? { render: (p: React.ComponentProps<\"button\">, state: { pressed: boolean }) => <button {...p} role=\"radio\" aria-checked={state.pressed} aria-pressed={undefined} /> }\n : {})}\n className={cn(\n \"inline-flex h-6 min-w-6 items-center justify-center gap-1 rounded-kit-sm px-1.5 text-kit-xs font-medium text-kit-fg-3 transition-colors hover:bg-kit-hover hover:text-kit-fg data-[pressed]:bg-kit-selected data-[pressed]:ring-1 data-[pressed]:ring-inset data-[pressed]:ring-kit-line-strong data-[pressed]:text-kit-fg [&_svg]:size-3.5\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/* ── Progress ──────────────────────────────────────────────────────────── */\nconst progressTones = {\n success: \"bg-kit-success\",\n accent: \"bg-kit-accent\",\n warning: \"bg-kit-warning\",\n danger: \"bg-kit-danger\",\n // --bar-fill: ink in light, a quiet grey in dark (no near-white glare on a dark track)\n ink: \"bg-[var(--kit-bar-fill)]\",\n brand: \"bg-[var(--kit-bar-fill)]\",\n};\nexport function Progress({\n value,\n className,\n tone = \"success\",\n size = \"md\",\n label = \"Progress\",\n}: {\n value: number;\n className?: string;\n /** accessible name, e.g. \"AI credits used\" */\n label?: string;\n tone?: keyof typeof progressTones;\n size?: \"sm\" | \"md\";\n}) {\n const pct = Math.min(100, Math.max(0, value));\n return (\n <ProgressPrimitive.Root\n value={pct}\n aria-label={label}\n className={cn(\n \"relative w-full overflow-hidden rounded-full bg-[var(--kit-track)]\",\n size === \"sm\" ? \"h-1\" : \"h-1.5\",\n className,\n )}\n >\n <ProgressPrimitive.Indicator\n className={cn(\"h-full rounded-full transition-[width] duration-500 ease-[var(--kit-ease-out-soft)]\", progressTones[tone])}\n style={{ width: `${pct}%` }}\n />\n </ProgressPrimitive.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,IAAM,cAAc;CAAE,MAAM;CAAU,WAAW;CAAK,SAAS;AAAG;AAGlE,SAAgB,OAAO,EACrB,WACA,OAAO,MACP,GAAG,SACmD;CACtD,MAAM,KAAK,SAAS;CACpB,MAAM,aAAa,mBAAmB;CACtC,MAAM,WAAW,YAAY,MAAM,EAAE;CACrC,OACE,oBAAC,SAAgB,MAAjB;EACE,WAAW,GACT,2KACA,KAAK,YAAY,WACjB,SACF;EACA,mBAAiB,MAAM,uBAAuB,MAAM,gBAAgB,KAAA,IAAa,aAAa,MAAM,KAAK,KAAA,IAAY;EACrH,GAAI;EAEJ,UAAA,oBAAC,SAAgB,OAAjB,EACE,WAAW,GACT,6IACA,KAAK,6DAA6D,0DACpE,EACD,CAAA;CACmB,CAAA;AAE1B;;AAIA,SAAgB,SAAS,EACvB,WACA,SACA,GAAG,SACyG;CAC5G,MAAM,gBAAgB,YAAY;CAClC,MAAM,WAAW,YAAY,MAAM,EAAE;CACrC,OACE,oBAAC,WAAkB,MAAnB;EACE,mBAAiB,MAAM,uBAAuB,MAAM,gBAAgB,KAAA,IAAY;EAChF,WAAW,GACT,4UACA,SACF;EACA,SAAS,YAAY,KAAA,IAAY,KAAA,IAAY,YAAY;EAC1C;EACf,GAAI;EAEJ,UAAA,oBAAC,WAAkB,WAAnB;GAA6B,WAAU;GACpC,UAAA,gBAAgB,oBAAC,WAAD;IAAW,WAAU;IAAS,QAAQ;GA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AgB,WAAW,EAAE,WAAW,GAAG,SAA4E;CACrH,MAAM,SAAS,MAAM,WAAW,iBAAiB;CACjD,OACE,oBAAC,QAAD;EACE,GAAK,SACD,EAAE,SAAS,GAAmC,UAAgC,oBAAC,UAAD;GAAQ,GAAI;GAAG,MAAK;GAAQ,gBAAc,MAAM;GAAS,gBAAc,KAAA;EAAY,CAAA,EAAE,IACnK,CAAC;EACL,WAAW,GACT,+UACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAGA,IAAM,gBAAgB;CACpB,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;CAER,KAAK;CACL,OAAO;AACT;AACA,SAAgB,SAAS,EACvB,OACA,WACA,OAAO,WACP,OAAO,MACP,QAAQ,cAQP;CACD,MAAM,MAAM,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC;CAC5C,OACE,oBAAC,WAAkB,MAAnB;EACE,OAAO;EACP,cAAY;EACZ,WAAW,GACT,sEACA,SAAS,OAAO,QAAQ,SACxB,SACF;EAEA,UAAA,oBAAC,WAAkB,WAAnB;GACE,WAAW,GAAG,uFAAuF,cAAc,KAAK;GACxH,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG;EAC3B,CAAA;CACqB,CAAA;AAE5B"}
package/dist/ui/input.js CHANGED
@@ -89,6 +89,18 @@ var Textarea = React.forwardRef(({ className, autoGrow = true, variant = "outlin
89
89
  ro.disconnect();
90
90
  };
91
91
  }, [autoGrow]);
92
+ React.useEffect(() => {
93
+ if (!autoGrow) return;
94
+ const again = () => grow();
95
+ const fonts = typeof document !== "undefined" ? document.fonts : void 0;
96
+ fonts?.ready?.then(again);
97
+ fonts?.addEventListener?.("loadingdone", again);
98
+ window.addEventListener("resize", again);
99
+ return () => {
100
+ fonts?.removeEventListener?.("loadingdone", again);
101
+ window.removeEventListener("resize", again);
102
+ };
103
+ }, [autoGrow]);
92
104
  return /* @__PURE__ */ jsx("textarea", {
93
105
  ref: inner,
94
106
  rows: props.rows ?? 2,
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","names":[],"sources":["../../src/ui/input.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { IconInfoCircle, IconSearch, IconX } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { HintTooltip } from \"./button\";\nimport { useShortcutHints } from \"./shortcut-hint\";\n\n/**\n * Inputs — CPO D19: white field + 1px --field-border at rest (default \"outline\"), border darkens on hover, halo on focus.\n * \"filled\" (grey, borderless) is kept only for search fields, which Figma draws grey.\n * Heights follow buttons: sm 28 · md 32 · lg 36.\n */\nimport {\n FieldDescribedByContext,\n FieldIdContext,\n FieldLabelledByContext,\n useFieldDescribedBy,\n useFieldId,\n useFieldLabelledBy,\n useLabelFor,\n} from \"./field-context\";\n/* The Field contexts live in field-context.ts so controls in other files (Switch, Select) read the same ones. */\nexport { FieldDescribedByContext, FieldLabelledByContext, useFieldDescribedBy, useFieldId, useFieldLabelledBy };\n\nconst joinIds = (...ids: (string | undefined)[]) => ids.filter(Boolean).join(\" \") || undefined;\n\nconst base =\n \"w-full min-w-0 rounded-kit-md border border-kit-field-border bg-kit-field-bg text-kit-fg shadow-kit-field placeholder:text-kit-fg-4 transition-[border-color,box-shadow] duration-150 hover:border-kit-field-border-hover focus:border-kit-field-border-focus focus:shadow-kit-ring-field disabled:cursor-not-allowed disabled:bg-kit-subtle disabled:opacity-60 aria-[invalid=true]:border-[var(--kit-field-invalid)]\";\n\nexport interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"prefix\"> {\n size?: \"sm\" | \"md\" | \"lg\";\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n variant?: \"filled\" | \"outline\";\n}\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, size = \"md\", leading, trailing, variant = \"outline\", ...rest }, ref) => {\n const fieldId = useFieldId();\n const labelledBy = useFieldLabelledBy();\n const named = rest.id ?? fieldId ?? rest[\"aria-label\"] ?? rest[\"aria-labelledby\"];\n const labelFor = useLabelFor(rest.id ?? fieldId);\n const describedBy = useFieldDescribedBy();\n const props = {\n ...rest,\n id: rest.id ?? fieldId,\n \"aria-labelledby\": rest[\"aria-labelledby\"] ?? (rest[\"aria-label\"] ? undefined : (labelFor ?? (named ? undefined : labelledBy))),\n \"aria-describedby\": joinIds(rest[\"aria-describedby\"], describedBy),\n };\n const h = size === \"sm\" ? \"h-7 text-kit-sm\" : size === \"lg\" ? \"h-9 text-kit-base\" : \"h-8 text-kit-sm\";\n const v = variant === \"filled\" ? \"bg-kit-muted border-transparent shadow-none hover:border-kit-line-strong\" : \"\";\n if (!leading && !trailing) return <input ref={ref} className={cn(base, h, v, \"px-2.5\", className)} {...props} />;\n return (\n <div className={cn(\"relative flex items-center\", className)}>\n {leading ? (\n <span className=\"pointer-events-none absolute left-2.5 flex text-kit-fg-3 [&_svg]:size-4\">{leading}</span>\n ) : null}\n <input ref={ref} className={cn(base, h, v, leading ? \"pl-8\" : \"pl-2.5\", trailing ? \"pr-8\" : \"pr-2.5\")} {...props} />\n {trailing ? <span className=\"absolute right-2 flex items-center text-kit-fg-3 [&_svg]:size-4\">{trailing}</span> : null}\n </div>\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & { autoGrow?: boolean; variant?: \"filled\" | \"outline\" };\n\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, autoGrow = true, variant = \"outline\", onInput, ...rest }, ref) => {\n const fieldId = useFieldId();\n const labelFor = useLabelFor(rest.id ?? fieldId);\n const describedBy = useFieldDescribedBy();\n const props = {\n ...rest,\n id: rest.id ?? fieldId,\n \"aria-labelledby\": rest[\"aria-labelledby\"] ?? (rest[\"aria-label\"] ? undefined : labelFor),\n \"aria-describedby\": joinIds(rest[\"aria-describedby\"], describedBy),\n };\n const inner = React.useRef<HTMLTextAreaElement | null>(null);\n React.useImperativeHandle(ref, () => inner.current as HTMLTextAreaElement);\n const grow = () => {\n const el = inner.current;\n if (!el || !autoGrow || !el.clientWidth) return; // hidden / zero-width: measuring now would be wrong\n el.style.height = \"auto\";\n el.style.height = `${el.scrollHeight + 2}px`;\n };\n React.useLayoutEffect(grow, [props.value, autoGrow]); // eslint-disable-line react-hooks/exhaustive-deps\n /* Re-measure when the WIDTH changes (a panel resize or a panel that mounts mid-animation): a height measured at a\n narrower width is stale and leaves single-line fields hundreds of px tall. Height-only changes are ignored, so\n the observer never feeds itself. */\n React.useEffect(() => {\n const el = inner.current;\n if (!el || !autoGrow || typeof ResizeObserver === \"undefined\") return;\n let w = el.clientWidth;\n let raf = 0;\n const ro = new ResizeObserver(() => {\n const nw = el.clientWidth;\n if (nw === w) return;\n w = nw;\n cancelAnimationFrame(raf);\n raf = requestAnimationFrame(grow);\n });\n ro.observe(el);\n return () => {\n cancelAnimationFrame(raf);\n ro.disconnect();\n };\n }, [autoGrow]); // eslint-disable-line react-hooks/exhaustive-deps\n return (\n <textarea\n ref={inner}\n rows={props.rows ?? 2}\n onInput={(e) => {\n grow();\n onInput?.(e);\n }}\n className={cn(\n base,\n \"min-h-16 resize-none px-2.5 py-2 text-kit-sm leading-[20px]\",\n variant === \"filled\" && \"bg-kit-muted border-transparent shadow-none\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTextarea.displayName = \"Textarea\";\n\nexport function SearchInput({\n value,\n onChange,\n placeholder = \"Search…\",\n className,\n size = \"md\",\n autoFocus,\n shortcut,\n variant = \"filled\",\n count,\n onKeyDown,\n inputRef,\n \"aria-label\": ariaLabel,\n}: {\n \"aria-label\"?: string;\n value: string;\n onChange: (v: string) => void;\n placeholder?: string;\n className?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n autoFocus?: boolean;\n /** Shown only while the D44 keyboard hints switch is on. */\n shortcut?: string;\n /**\n * \"filled\" (grey) for search on white surfaces (menus, sidebars, lists); \"outline\" is the standard field (field-bg,\n * field-border) for search that sits on a grey plane, where a grey fill reads as a pill, not a field (D70, the schema desk).\n */\n variant?: \"filled\" | \"outline\";\n /** a result count shown inside the field while there is a query (\"3 matches\", \"2 of 5\"); announced politely */\n count?: string;\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n inputRef?: React.Ref<HTMLInputElement>;\n}) {\n const hints = useShortcutHints();\n return (\n <Input\n ref={inputRef}\n variant={variant}\n size={size}\n autoFocus={autoFocus}\n value={value}\n placeholder={placeholder}\n aria-label={ariaLabel ?? placeholder.replace(/…$/, \"\")}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={onKeyDown}\n leading={<IconSearch aria-hidden />}\n className={cn(className, value && count ? \"[&_input]:pr-28\" : undefined)}\n trailing={\n value ? (\n <span className=\"flex items-center gap-1.5\">\n {count ? (\n <span aria-live=\"polite\" className=\"whitespace-nowrap text-kit-xs tabular-nums text-kit-fg-3\">\n {count}\n </span>\n ) : null}\n <button\n type=\"button\"\n aria-label=\"Clear search\"\n onClick={() => onChange(\"\")}\n className=\"flex size-5 items-center justify-center rounded-kit-sm text-kit-fg-3 hover:bg-kit-selected hover:text-kit-fg [&_svg]:size-3.5\"\n >\n <IconX aria-hidden />\n </button>\n </span>\n ) : shortcut && hints ? (\n <kbd data-hint=\"shortcuts\" className=\"font-kit-sans text-kit-2xs text-kit-fg-3\">\n {shortcut}\n </kbd>\n ) : undefined\n }\n />\n );\n}\n\nexport function Label({ className, ...props }: React.LabelHTMLAttributes<HTMLLabelElement>) {\n return <label className={cn(\"text-kit-sm font-medium text-kit-fg\", className)} {...props} />;\n}\n\n/**\n * Field = label row · help · control · error. CPO D39, the one help system (same spec as the Block Kit FieldShell):\n * [Label *] [hint] [i helpMore] …… [counter] [actions]\n * help: 12/16, --fg-3 (≥4.5:1 light + dark), 4px under the label, 1–2 lines\n * control\n * error: replaces the help, danger colour, under the control\n * The control gets `aria-describedby` → help + ⓘ text + error.\n * Required marker is V2 ui/input.tsx:249 (--danger-fg); the sr-only \"(required)\" names it for screen readers.\n */\nexport function Field({\n label,\n htmlFor,\n hint,\n help,\n helpMore,\n error,\n required,\n counter,\n actions,\n children,\n className,\n}: {\n label?: React.ReactNode;\n htmlFor?: string;\n /** short, quiet aside on the label row (\"Optional\", \"Shown publicly\") */\n hint?: React.ReactNode;\n /** the help line under the label */\n help?: React.ReactNode;\n /** longer explanation behind the ⓘ next to the label */\n helpMore?: React.ReactNode;\n error?: React.ReactNode;\n required?: boolean;\n counter?: { value: number; max: number };\n actions?: React.ReactNode;\n children: React.ReactNode;\n className?: string;\n}) {\n const autoId = React.useId();\n const id = htmlFor ?? autoId;\n const helpId = `${id}-help`;\n const moreId = `${id}-more`;\n const errId = `${id}-error`;\n const describedBy = [error ? errId : help ? helpId : null, helpMore ? moreId : null].filter(Boolean).join(\" \") || undefined;\n return (\n <div className={cn(\"flex flex-col gap-1.5\", className)}>\n {label || actions || counter ? (\n <div className=\"flex min-h-5 items-center justify-between gap-2\">\n <span className=\"flex min-w-0 items-center gap-1\">\n <Label htmlFor={label ? id : undefined} className=\"flex items-center gap-1.5 text-kit-sm text-kit-fg-2\">\n {label}\n {required ? (\n <>\n <span aria-hidden className=\"text-kit-danger-fg\">*</span>\n <span className=\"sr-only\">(required)</span>\n </>\n ) : null}\n {hint ? <span className=\"font-normal text-kit-fg-3\">{hint}</span> : null}\n </Label>\n {helpMore ? (\n <HelpMore id={moreId} label={typeof label === \"string\" ? label : undefined}>\n {helpMore}\n </HelpMore>\n ) : null}\n </span>\n <div className=\"flex items-center gap-1\">\n {counter ? (\n <span\n className={cn(\n \"tabular-nums text-kit-xs\",\n counter.value > counter.max\n ? \"text-kit-danger-fg\"\n : counter.value > counter.max * 0.9\n ? \"text-kit-warning-fg\"\n : \"text-kit-fg-3\",\n )}\n >\n {counter.value}/{counter.max}\n </span>\n ) : null}\n {actions}\n </div>\n </div>\n ) : null}\n {help && !error ? (\n <p id={helpId} data-slot=\"field-help\" className=\"-mt-0.5 text-kit-xs leading-4 text-kit-fg-3\">\n {help}\n </p>\n ) : null}\n <FieldIdContext.Provider value={label ? id : undefined}>\n <FieldDescribedByContext.Provider value={describedBy}>{children}</FieldDescribedByContext.Provider>\n </FieldIdContext.Provider>\n {error ? (\n <p id={errId} role=\"alert\" className=\"text-kit-xs leading-4 text-kit-danger-fg\">\n {error}\n </p>\n ) : null}\n </div>\n );\n}\n\n/** The ⓘ next to a label: longer help in a tooltip, also read by screen readers through aria-describedby (D39). */\nexport function HelpMore({ id, label, children }: { id?: string; label?: string; children: React.ReactNode }) {\n return (\n <HintTooltip content={<span className=\"block max-w-[260px] whitespace-normal font-normal leading-4\">{children}</span>}>\n <button\n type=\"button\"\n aria-label={label ? `About ${label}` : \"More about this field\"}\n className=\"hit-area inline-flex size-4 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 [--hit-size:16px] hover:text-kit-fg-2\"\n >\n <IconInfoCircle className=\"size-3.5\" stroke={1.5} aria-hidden />\n <span id={id} className=\"sr-only\">\n {children}\n </span>\n </button>\n </HintTooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAM,WAAW,GAAG,QAAgC,IAAI,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;AAErF,IAAM,OACJ;AASF,IAAa,QAAQ,MAAM,YACxB,EAAE,WAAW,OAAO,MAAM,SAAS,UAAU,UAAU,WAAW,GAAG,QAAQ,QAAQ;CACpF,MAAM,UAAU,WAAW;CAC3B,MAAM,aAAa,mBAAmB;CACtC,MAAM,QAAQ,KAAK,MAAM,WAAW,KAAK,iBAAiB,KAAK;CAC/D,MAAM,WAAW,YAAY,KAAK,MAAM,OAAO;CAC/C,MAAM,cAAc,oBAAoB;CACxC,MAAM,QAAQ;EACZ,GAAG;EACH,IAAI,KAAK,MAAM;EACf,mBAAmB,KAAK,uBAAuB,KAAK,gBAAgB,KAAA,IAAa,aAAa,QAAQ,KAAA,IAAY;EAClH,oBAAoB,QAAQ,KAAK,qBAAqB,WAAW;CACnE;CACA,MAAM,IAAI,SAAS,OAAO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AO,OAAO,UAAU,WAAW,QAAQ,KAAA;MAC9D,UAAA;KACO,CAAA,IACR,IACA;IACN,CAAA,GAAA,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACG,UACC,qBAAC,QAAD;MACE,WAAW,GACT,4BACA,QAAQ,QAAQ,QAAQ,MACpB,uBACA,QAAQ,QAAQ,QAAQ,MAAM,KAC5B,wBACA,eACR;MARF,UAAA;OAUG,QAAQ;OAAM;OAAE,QAAQ;MACrB;KACJ,CAAA,IAAA,MACH,OACE;IACF,CAAA,CAAA;GACH,CAAA,IAAA;GACH,QAAQ,CAAC,QACR,oBAAC,KAAD;IAAG,IAAI;IAAQ,aAAU;IAAa,WAAU;IAC7C,UAAA;GACA,CAAA,IACD;GACJ,oBAAC,eAAe,UAAhB;IAAyB,OAAO,QAAQ,KAAK,KAAA;IAC3C,UAAA,oBAAC,wBAAwB,UAAzB;KAAkC,OAAO;KAAc;IAA2C,CAAA;GAC3E,CAAA;GACxB,QACC,oBAAC,KAAD;IAAG,IAAI;IAAO,MAAK;IAAQ,WAAU;IAClC,UAAA;GACA,CAAA,IACD;EACD;;AAET;;AAGA,SAAgB,SAAS,EAAE,IAAI,OAAO,YAAwE;CAC5G,OACE,oBAAC,aAAD;EAAa,SAAS,oBAAC,QAAD;GAAM,WAAU;GAA+D;EAAe,CAAA;EAClH,UAAA,qBAAC,UAAD;GACE,MAAK;GACL,cAAY,QAAQ,SAAS,UAAU;GACvC,WAAU;GAHZ,UAAA,CAKE,oBAAC,gBAAD;IAAgB,WAAU;IAAW,QAAQ;IAAK,eAAA;GAAa,CAAA,GAC/D,oBAAC,QAAD;IAAU;IAAI,WAAU;IACrB;GACG,CAAA,CACA;;CACG,CAAA;AAEjB"}
1
+ {"version":3,"file":"input.js","names":[],"sources":["../../src/ui/input.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { IconInfoCircle, IconSearch, IconX } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { HintTooltip } from \"./button\";\nimport { useShortcutHints } from \"./shortcut-hint\";\n\n/**\n * Inputs — CPO D19: white field + 1px --field-border at rest (default \"outline\"), border darkens on hover, halo on focus.\n * \"filled\" (grey, borderless) is kept only for search fields, which Figma draws grey.\n * Heights follow buttons: sm 28 · md 32 · lg 36.\n */\nimport {\n FieldDescribedByContext,\n FieldIdContext,\n FieldLabelledByContext,\n useFieldDescribedBy,\n useFieldId,\n useFieldLabelledBy,\n useLabelFor,\n} from \"./field-context\";\n/* The Field contexts live in field-context.ts so controls in other files (Switch, Select) read the same ones. */\nexport { FieldDescribedByContext, FieldLabelledByContext, useFieldDescribedBy, useFieldId, useFieldLabelledBy };\n\nconst joinIds = (...ids: (string | undefined)[]) => ids.filter(Boolean).join(\" \") || undefined;\n\nconst base =\n \"w-full min-w-0 rounded-kit-md border border-kit-field-border bg-kit-field-bg text-kit-fg shadow-kit-field placeholder:text-kit-fg-4 transition-[border-color,box-shadow] duration-150 hover:border-kit-field-border-hover focus:border-kit-field-border-focus focus:shadow-kit-ring-field disabled:cursor-not-allowed disabled:bg-kit-subtle disabled:opacity-60 aria-[invalid=true]:border-[var(--kit-field-invalid)]\";\n\nexport interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\" | \"prefix\"> {\n size?: \"sm\" | \"md\" | \"lg\";\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n variant?: \"filled\" | \"outline\";\n}\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, size = \"md\", leading, trailing, variant = \"outline\", ...rest }, ref) => {\n const fieldId = useFieldId();\n const labelledBy = useFieldLabelledBy();\n const named = rest.id ?? fieldId ?? rest[\"aria-label\"] ?? rest[\"aria-labelledby\"];\n const labelFor = useLabelFor(rest.id ?? fieldId);\n const describedBy = useFieldDescribedBy();\n const props = {\n ...rest,\n id: rest.id ?? fieldId,\n \"aria-labelledby\": rest[\"aria-labelledby\"] ?? (rest[\"aria-label\"] ? undefined : (labelFor ?? (named ? undefined : labelledBy))),\n \"aria-describedby\": joinIds(rest[\"aria-describedby\"], describedBy),\n };\n const h = size === \"sm\" ? \"h-7 text-kit-sm\" : size === \"lg\" ? \"h-9 text-kit-base\" : \"h-8 text-kit-sm\";\n const v = variant === \"filled\" ? \"bg-kit-muted border-transparent shadow-none hover:border-kit-line-strong\" : \"\";\n if (!leading && !trailing) return <input ref={ref} className={cn(base, h, v, \"px-2.5\", className)} {...props} />;\n return (\n <div className={cn(\"relative flex items-center\", className)}>\n {leading ? (\n <span className=\"pointer-events-none absolute left-2.5 flex text-kit-fg-3 [&_svg]:size-4\">{leading}</span>\n ) : null}\n <input ref={ref} className={cn(base, h, v, leading ? \"pl-8\" : \"pl-2.5\", trailing ? \"pr-8\" : \"pr-2.5\")} {...props} />\n {trailing ? <span className=\"absolute right-2 flex items-center text-kit-fg-3 [&_svg]:size-4\">{trailing}</span> : null}\n </div>\n );\n },\n);\nInput.displayName = \"Input\";\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & { autoGrow?: boolean; variant?: \"filled\" | \"outline\" };\n\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, autoGrow = true, variant = \"outline\", onInput, ...rest }, ref) => {\n const fieldId = useFieldId();\n const labelFor = useLabelFor(rest.id ?? fieldId);\n const describedBy = useFieldDescribedBy();\n const props = {\n ...rest,\n id: rest.id ?? fieldId,\n \"aria-labelledby\": rest[\"aria-labelledby\"] ?? (rest[\"aria-label\"] ? undefined : labelFor),\n \"aria-describedby\": joinIds(rest[\"aria-describedby\"], describedBy),\n };\n const inner = React.useRef<HTMLTextAreaElement | null>(null);\n React.useImperativeHandle(ref, () => inner.current as HTMLTextAreaElement);\n const grow = () => {\n const el = inner.current;\n if (!el || !autoGrow || !el.clientWidth) return; // hidden / zero-width: measuring now would be wrong\n el.style.height = \"auto\";\n el.style.height = `${el.scrollHeight + 2}px`;\n };\n React.useLayoutEffect(grow, [props.value, autoGrow]); // eslint-disable-line react-hooks/exhaustive-deps\n /* Re-measure when the WIDTH changes (a panel resize or a panel that mounts mid-animation): a height measured at a\n narrower width is stale and leaves single-line fields hundreds of px tall. Height-only changes are ignored, so\n the observer never feeds itself. */\n React.useEffect(() => {\n const el = inner.current;\n if (!el || !autoGrow || typeof ResizeObserver === \"undefined\") return;\n let w = el.clientWidth;\n let raf = 0;\n const ro = new ResizeObserver(() => {\n const nw = el.clientWidth;\n if (nw === w) return;\n w = nw;\n cancelAnimationFrame(raf);\n raf = requestAnimationFrame(grow);\n });\n ro.observe(el);\n return () => {\n cancelAnimationFrame(raf);\n ro.disconnect();\n };\n }, [autoGrow]); // eslint-disable-line react-hooks/exhaustive-deps\n /* KP-226: the text can change height with no change to the value or the width: a web font arriving, or the\n browser's zoom / text size changing. Neither resizes the box (its height is set inline), so no observer fires;\n re-measure when fonts finish loading and when the window resizes (a zoom change is one). */\n React.useEffect(() => {\n if (!autoGrow) return;\n const again = () => grow();\n const fonts = typeof document !== \"undefined\" ? document.fonts : undefined;\n void fonts?.ready?.then(again);\n fonts?.addEventListener?.(\"loadingdone\", again);\n window.addEventListener(\"resize\", again);\n return () => {\n fonts?.removeEventListener?.(\"loadingdone\", again);\n window.removeEventListener(\"resize\", again);\n };\n }, [autoGrow]); // eslint-disable-line react-hooks/exhaustive-deps\n return (\n <textarea\n ref={inner}\n rows={props.rows ?? 2}\n onInput={(e) => {\n grow();\n onInput?.(e);\n }}\n className={cn(\n base,\n \"min-h-16 resize-none px-2.5 py-2 text-kit-sm leading-[20px]\",\n variant === \"filled\" && \"bg-kit-muted border-transparent shadow-none\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTextarea.displayName = \"Textarea\";\n\nexport function SearchInput({\n value,\n onChange,\n placeholder = \"Search…\",\n className,\n size = \"md\",\n autoFocus,\n shortcut,\n variant = \"filled\",\n count,\n onKeyDown,\n inputRef,\n \"aria-label\": ariaLabel,\n}: {\n \"aria-label\"?: string;\n value: string;\n onChange: (v: string) => void;\n placeholder?: string;\n className?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n autoFocus?: boolean;\n /** Shown only while the D44 keyboard hints switch is on. */\n shortcut?: string;\n /**\n * \"filled\" (grey) for search on white surfaces (menus, sidebars, lists); \"outline\" is the standard field (field-bg,\n * field-border) for search that sits on a grey plane, where a grey fill reads as a pill, not a field (D70, the schema desk).\n */\n variant?: \"filled\" | \"outline\";\n /** a result count shown inside the field while there is a query (\"3 matches\", \"2 of 5\"); announced politely */\n count?: string;\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n inputRef?: React.Ref<HTMLInputElement>;\n}) {\n const hints = useShortcutHints();\n return (\n <Input\n ref={inputRef}\n variant={variant}\n size={size}\n autoFocus={autoFocus}\n value={value}\n placeholder={placeholder}\n aria-label={ariaLabel ?? placeholder.replace(/…$/, \"\")}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={onKeyDown}\n leading={<IconSearch aria-hidden />}\n className={cn(className, value && count ? \"[&_input]:pr-28\" : undefined)}\n trailing={\n value ? (\n <span className=\"flex items-center gap-1.5\">\n {count ? (\n <span aria-live=\"polite\" className=\"whitespace-nowrap text-kit-xs tabular-nums text-kit-fg-3\">\n {count}\n </span>\n ) : null}\n <button\n type=\"button\"\n aria-label=\"Clear search\"\n onClick={() => onChange(\"\")}\n className=\"flex size-5 items-center justify-center rounded-kit-sm text-kit-fg-3 hover:bg-kit-selected hover:text-kit-fg [&_svg]:size-3.5\"\n >\n <IconX aria-hidden />\n </button>\n </span>\n ) : shortcut && hints ? (\n <kbd data-hint=\"shortcuts\" className=\"font-kit-sans text-kit-2xs text-kit-fg-3\">\n {shortcut}\n </kbd>\n ) : undefined\n }\n />\n );\n}\n\nexport function Label({ className, ...props }: React.LabelHTMLAttributes<HTMLLabelElement>) {\n return <label className={cn(\"text-kit-sm font-medium text-kit-fg\", className)} {...props} />;\n}\n\n/**\n * Field = label row · help · control · error. CPO D39, the one help system (same spec as the Block Kit FieldShell):\n * [Label *] [hint] [i helpMore] …… [counter] [actions]\n * help: 12/16, --fg-3 (≥4.5:1 light + dark), 4px under the label, 1–2 lines\n * control\n * error: replaces the help, danger colour, under the control\n * The control gets `aria-describedby` → help + ⓘ text + error.\n * Required marker is V2 ui/input.tsx:249 (--danger-fg); the sr-only \"(required)\" names it for screen readers.\n */\nexport function Field({\n label,\n htmlFor,\n hint,\n help,\n helpMore,\n error,\n required,\n counter,\n actions,\n children,\n className,\n}: {\n label?: React.ReactNode;\n htmlFor?: string;\n /** short, quiet aside on the label row (\"Optional\", \"Shown publicly\") */\n hint?: React.ReactNode;\n /** the help line under the label */\n help?: React.ReactNode;\n /** longer explanation behind the ⓘ next to the label */\n helpMore?: React.ReactNode;\n error?: React.ReactNode;\n required?: boolean;\n counter?: { value: number; max: number };\n actions?: React.ReactNode;\n children: React.ReactNode;\n className?: string;\n}) {\n const autoId = React.useId();\n const id = htmlFor ?? autoId;\n const helpId = `${id}-help`;\n const moreId = `${id}-more`;\n const errId = `${id}-error`;\n const describedBy = [error ? errId : help ? helpId : null, helpMore ? moreId : null].filter(Boolean).join(\" \") || undefined;\n return (\n <div className={cn(\"flex flex-col gap-1.5\", className)}>\n {label || actions || counter ? (\n <div className=\"flex min-h-5 items-center justify-between gap-2\">\n <span className=\"flex min-w-0 items-center gap-1\">\n <Label htmlFor={label ? id : undefined} className=\"flex items-center gap-1.5 text-kit-sm text-kit-fg-2\">\n {label}\n {required ? (\n <>\n <span aria-hidden className=\"text-kit-danger-fg\">*</span>\n <span className=\"sr-only\">(required)</span>\n </>\n ) : null}\n {hint ? <span className=\"font-normal text-kit-fg-3\">{hint}</span> : null}\n </Label>\n {helpMore ? (\n <HelpMore id={moreId} label={typeof label === \"string\" ? label : undefined}>\n {helpMore}\n </HelpMore>\n ) : null}\n </span>\n <div className=\"flex items-center gap-1\">\n {counter ? (\n <span\n className={cn(\n \"tabular-nums text-kit-xs\",\n counter.value > counter.max\n ? \"text-kit-danger-fg\"\n : counter.value > counter.max * 0.9\n ? \"text-kit-warning-fg\"\n : \"text-kit-fg-3\",\n )}\n >\n {counter.value}/{counter.max}\n </span>\n ) : null}\n {actions}\n </div>\n </div>\n ) : null}\n {help && !error ? (\n <p id={helpId} data-slot=\"field-help\" className=\"-mt-0.5 text-kit-xs leading-4 text-kit-fg-3\">\n {help}\n </p>\n ) : null}\n <FieldIdContext.Provider value={label ? id : undefined}>\n <FieldDescribedByContext.Provider value={describedBy}>{children}</FieldDescribedByContext.Provider>\n </FieldIdContext.Provider>\n {error ? (\n <p id={errId} role=\"alert\" className=\"text-kit-xs leading-4 text-kit-danger-fg\">\n {error}\n </p>\n ) : null}\n </div>\n );\n}\n\n/** The ⓘ next to a label: longer help in a tooltip, also read by screen readers through aria-describedby (D39). */\nexport function HelpMore({ id, label, children }: { id?: string; label?: string; children: React.ReactNode }) {\n return (\n <HintTooltip content={<span className=\"block max-w-[260px] whitespace-normal font-normal leading-4\">{children}</span>}>\n <button\n type=\"button\"\n aria-label={label ? `About ${label}` : \"More about this field\"}\n className=\"hit-area inline-flex size-4 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 [--hit-size:16px] hover:text-kit-fg-2\"\n >\n <IconInfoCircle className=\"size-3.5\" stroke={1.5} aria-hidden />\n <span id={id} className=\"sr-only\">\n {children}\n </span>\n </button>\n </HintTooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAM,WAAW,GAAG,QAAgC,IAAI,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;AAErF,IAAM,OACJ;AASF,IAAa,QAAQ,MAAM,YACxB,EAAE,WAAW,OAAO,MAAM,SAAS,UAAU,UAAU,WAAW,GAAG,QAAQ,QAAQ;CACpF,MAAM,UAAU,WAAW;CAC3B,MAAM,aAAa,mBAAmB;CACtC,MAAM,QAAQ,KAAK,MAAM,WAAW,KAAK,iBAAiB,KAAK;CAC/D,MAAM,WAAW,YAAY,KAAK,MAAM,OAAO;CAC/C,MAAM,cAAc,oBAAoB;CACxC,MA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AET;;AAGA,SAAgB,SAAS,EAAE,IAAI,OAAO,YAAwE;CAC5G,OACE,oBAAC,aAAD;EAAa,SAAS,oBAAC,QAAD;GAAM,WAAU;GAA+D;EAAe,CAAA;EAClH,UAAA,qBAAC,UAAD;GACE,MAAK;GACL,cAAY,QAAQ,SAAS,UAAU;GACvC,WAAU;GAHZ,UAAA,CAKE,oBAAC,gBAAD;IAAgB,WAAU;IAAW,QAAQ;IAAK,eAAA;GAAa,CAAA,GAC/D,oBAAC,QAAD;IAAU;IAAI,WAAU;IACrB;GACG,CAAA,CACA;;CACG,CAAA;AAEjB"}
package/dist/ui/select.js CHANGED
@@ -127,7 +127,7 @@ function grouped(options) {
127
127
  return out;
128
128
  }
129
129
  function triggerClass(variant, size) {
130
- return cn("group inline-flex w-full min-w-0 items-center justify-between gap-2 rounded-kit-md border px-2.5 text-left text-kit-fg transition-colors data-[placeholder]:text-kit-fg-3 disabled:cursor-not-allowed disabled:opacity-60 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-60", variant === "filled" && "border-kit-field-border bg-kit-field-bg shadow-kit-field hover:border-kit-field-border-hover", variant === "outline" && "border-kit-line bg-kit-field-bg shadow-kit-xs hover:border-kit-line-strong", variant === "ghost" && "w-auto border-transparent bg-transparent px-2 text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg", size === "sm" ? "h-7 text-kit-sm" : size === "lg" ? "h-9 text-kit-base" : "h-8 text-kit-sm");
130
+ return cn("group inline-flex w-full min-w-0 items-center justify-between gap-2 rounded-kit-md border px-2.5 text-left text-kit-fg transition-colors data-[placeholder]:text-kit-fg-3 disabled:cursor-not-allowed disabled:opacity-60 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-60", variant === "filled" && "border-kit-field-border bg-kit-field-bg shadow-kit-field hover:border-kit-field-border-hover", variant === "outline" && "border-kit-line-strong bg-kit-field-bg shadow-kit-xs hover:border-[var(--kit-emphasis-line)]", variant === "ghost" && "w-auto border-transparent bg-transparent px-2 text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg", size === "sm" ? "h-7 text-kit-sm" : size === "lg" ? "h-9 text-kit-base" : "h-8 text-kit-sm");
131
131
  }
132
132
  /** The Select trigger look, for controls that open their own picker but must read as a Select (D57: one look per job). */
133
133
  var selectTriggerClass = triggerClass;