@behavioral-agentic-design-system/core 0.23.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/package.json +8 -4
  2. package/scripts/build-tokens.cjs +79 -5
  3. package/src/app/preview/components/page.tsx +4760 -213
  4. package/src/app/shell.tsx +18 -6
  5. package/src/components/customize/brand-mark-section.tsx +1 -1
  6. package/src/components/customize-tab.tsx +2 -2
  7. package/src/components/home-tab.tsx +2 -2
  8. package/src/components/ui/action-bar.tsx +142 -0
  9. package/src/components/ui/affix.tsx +109 -0
  10. package/src/components/ui/alert.tsx +37 -3
  11. package/src/components/ui/anchor.tsx +136 -0
  12. package/src/components/ui/angle-slider.tsx +265 -0
  13. package/src/components/ui/autocomplete.tsx +223 -0
  14. package/src/components/ui/avatar.tsx +8 -2
  15. package/src/components/ui/blockquote.tsx +112 -0
  16. package/src/components/ui/bottom-navigation.tsx +144 -0
  17. package/src/components/ui/burger.tsx +117 -0
  18. package/src/components/ui/button.tsx +101 -3
  19. package/src/components/ui/calendar.tsx +1 -1
  20. package/src/components/ui/card.tsx +43 -5
  21. package/src/components/ui/carousel.tsx +10 -5
  22. package/src/components/ui/cascader.tsx +253 -0
  23. package/src/components/ui/checkbox-card.tsx +176 -0
  24. package/src/components/ui/checkbox-group.tsx +231 -0
  25. package/src/components/ui/checkbox.tsx +14 -3
  26. package/src/components/ui/chip.tsx +143 -0
  27. package/src/components/ui/circular-progress.tsx +2 -2
  28. package/src/components/ui/color-swatch.tsx +73 -0
  29. package/src/components/ui/copy-button.tsx +21 -4
  30. package/src/components/ui/data-list.tsx +169 -0
  31. package/src/components/ui/date-picker.tsx +6 -3
  32. package/src/components/ui/date-range-picker.tsx +6 -3
  33. package/src/components/ui/fieldset.tsx +8 -2
  34. package/src/components/ui/float-label.tsx +114 -0
  35. package/src/components/ui/floating-panel.tsx +129 -0
  36. package/src/components/ui/format-number.tsx +122 -0
  37. package/src/components/ui/highlight.tsx +85 -0
  38. package/src/components/ui/image.tsx +195 -0
  39. package/src/components/ui/index.ts +52 -0
  40. package/src/components/ui/indicator.tsx +2 -2
  41. package/src/components/ui/input-group.tsx +11 -1
  42. package/src/components/ui/input.tsx +48 -4
  43. package/src/components/ui/kbd.tsx +1 -1
  44. package/src/components/ui/link.tsx +158 -0
  45. package/src/components/ui/listbox.tsx +426 -0
  46. package/src/components/ui/loading-overlay.tsx +80 -0
  47. package/src/components/ui/marquee.tsx +193 -0
  48. package/src/components/ui/masonry.tsx +164 -0
  49. package/src/components/ui/meter.tsx +186 -0
  50. package/src/components/ui/motion-toggle.tsx +170 -0
  51. package/src/components/ui/notification.tsx +175 -0
  52. package/src/components/ui/overlay.tsx +63 -0
  53. package/src/components/ui/progress.tsx +95 -4
  54. package/src/components/ui/qr-code.tsx +107 -0
  55. package/src/components/ui/rating-group.tsx +1 -0
  56. package/src/components/ui/separator.tsx +57 -1
  57. package/src/components/ui/sidebar.tsx +1 -1
  58. package/src/components/ui/signature-pad.tsx +381 -0
  59. package/src/components/ui/skeleton.tsx +59 -2
  60. package/src/components/ui/skip-link.tsx +117 -0
  61. package/src/components/ui/slider.tsx +86 -1
  62. package/src/components/ui/spoiler.tsx +131 -0
  63. package/src/components/ui/tabs.tsx +1 -1
  64. package/src/components/ui/text.tsx +135 -0
  65. package/src/components/ui/textarea.tsx +66 -2
  66. package/src/components/ui/timeline.tsx +71 -14
  67. package/src/components/ui/timer.tsx +183 -0
  68. package/src/components/ui/tour.tsx +332 -0
  69. package/src/components/ui/transfer-list.tsx +308 -0
  70. package/src/components/ui/visually-hidden.tsx +42 -0
  71. package/src/components/ui/watermark.tsx +0 -0
  72. package/src/data/docs-index.ts +10 -2
  73. package/src/stories/ActionBar.stories.tsx +201 -0
  74. package/src/stories/Affix.stories.tsx +165 -0
  75. package/src/stories/Alert.stories.tsx +58 -0
  76. package/src/stories/Anchor.stories.tsx +236 -0
  77. package/src/stories/AngleSlider.stories.tsx +128 -0
  78. package/src/stories/Autocomplete.stories.tsx +216 -0
  79. package/src/stories/Avatar.stories.tsx +73 -1
  80. package/src/stories/Blockquote.stories.tsx +148 -0
  81. package/src/stories/BottomNavigation.stories.tsx +195 -0
  82. package/src/stories/Burger.stories.tsx +79 -0
  83. package/src/stories/Button.stories.tsx +103 -2
  84. package/src/stories/Calendar.stories.tsx +4 -0
  85. package/src/stories/Card.stories.tsx +30 -0
  86. package/src/stories/Carousel.stories.tsx +2 -1
  87. package/src/stories/Cascader.stories.tsx +285 -0
  88. package/src/stories/Checkbox.stories.tsx +13 -0
  89. package/src/stories/CheckboxCard.stories.tsx +210 -0
  90. package/src/stories/CheckboxGroup.stories.tsx +186 -0
  91. package/src/stories/Chip.stories.tsx +173 -0
  92. package/src/stories/CircularProgress.stories.tsx +3 -0
  93. package/src/stories/ColorSwatch.stories.tsx +81 -0
  94. package/src/stories/CopyButton.stories.tsx +3 -3
  95. package/src/stories/DataList.stories.tsx +160 -0
  96. package/src/stories/DatePicker.stories.tsx +3 -0
  97. package/src/stories/DateRangePicker.stories.tsx +3 -0
  98. package/src/stories/Editable.stories.tsx +14 -0
  99. package/src/stories/Fieldset.stories.tsx +4 -0
  100. package/src/stories/FloatLabel.stories.tsx +148 -0
  101. package/src/stories/FloatingPanel.stories.tsx +176 -0
  102. package/src/stories/FormatNumber.stories.tsx +308 -0
  103. package/src/stories/Highlight.stories.tsx +140 -0
  104. package/src/stories/Image.stories.tsx +141 -0
  105. package/src/stories/Indicator.stories.tsx +3 -0
  106. package/src/stories/Input.stories.tsx +33 -0
  107. package/src/stories/InputGroup.stories.tsx +39 -41
  108. package/src/stories/Kbd.stories.tsx +3 -0
  109. package/src/stories/Link.stories.tsx +198 -0
  110. package/src/stories/Listbox.stories.tsx +240 -0
  111. package/src/stories/LoadingOverlay.stories.tsx +148 -0
  112. package/src/stories/Marquee.stories.tsx +170 -0
  113. package/src/stories/Masonry.stories.tsx +227 -0
  114. package/src/stories/Meter.stories.tsx +143 -0
  115. package/src/stories/MotionToggle.stories.tsx +85 -0
  116. package/src/stories/Notification.stories.tsx +264 -0
  117. package/src/stories/Overlay.stories.tsx +169 -0
  118. package/src/stories/PasswordInput.stories.tsx +4 -0
  119. package/src/stories/Progress.stories.tsx +70 -27
  120. package/src/stories/QrCode.stories.tsx +146 -0
  121. package/src/stories/RatingGroup.stories.tsx +5 -0
  122. package/src/stories/Separator.stories.tsx +41 -5
  123. package/src/stories/Sidebar.stories.tsx +2 -1
  124. package/src/stories/SignaturePad.stories.tsx +112 -0
  125. package/src/stories/Skeleton.stories.tsx +23 -4
  126. package/src/stories/SkipLink.stories.tsx +137 -0
  127. package/src/stories/Slider.stories.tsx +28 -0
  128. package/src/stories/Spoiler.stories.tsx +122 -0
  129. package/src/stories/Tabs.stories.tsx +2 -1
  130. package/src/stories/Text.stories.tsx +191 -0
  131. package/src/stories/Textarea.stories.tsx +58 -6
  132. package/src/stories/Timeline.stories.tsx +82 -0
  133. package/src/stories/Timer.stories.tsx +160 -0
  134. package/src/stories/Tour.stories.tsx +191 -0
  135. package/src/stories/TransferList.stories.tsx +169 -0
  136. package/src/stories/VisuallyHidden.stories.tsx +105 -0
  137. package/src/stories/Watermark.stories.tsx +212 -0
  138. package/src/styles.css +80 -6
  139. package/src/tokens.json +2 -2
@@ -0,0 +1,143 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cva, type VariantProps } from "class-variance-authority";
5
+ import { Check } from "lucide-react";
6
+
7
+ import { cn } from "../../lib/utils";
8
+
9
+ // Chip — interactive filter/facet toggle pill (role="checkbox").
10
+ //
11
+ // Semantic sibling of Tag: Tag is a passive display label (a div, optionally
12
+ // dismissible); Chip is a stateful selector the user toggles on/off ("Filter
13
+ // by: design tokens | a11y contract"). Each chip is an independent toggle and
14
+ // its own tab stop — deliberately NOT a radiogroup, so arrow-key roving is
15
+ // not wired. Space (and Enter, via the native button) toggles.
16
+ //
17
+ // Motion is pattern (c): explicit transition property list + inline
18
+ // var(--duration-fast) / var(--ease-out). box-shadow is excluded from the
19
+ // list so the focus ring appears instantly (a11y floor).
20
+
21
+ const chipVariants = cva(
22
+ [
23
+ // Layout + long-label overflow contract: the button is the flex parent
24
+ // (max-w-full min-w-0 overflow-hidden); the label span truncates.
25
+ "inline-flex max-w-full min-w-0 cursor-pointer select-none items-center gap-1.5 overflow-hidden rounded-full border font-medium whitespace-nowrap",
26
+ "transition-[background-color,color,border-color]",
27
+ "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
28
+ "disabled:pointer-events-none disabled:opacity-50",
29
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
30
+ ],
31
+ {
32
+ variants: {
33
+ variant: {
34
+ default: [
35
+ "border-transparent bg-secondary text-secondary-foreground",
36
+ "hover:bg-secondary/80",
37
+ "aria-checked:bg-primary aria-checked:text-primary-foreground aria-checked:hover:bg-primary/90",
38
+ ],
39
+ outline: [
40
+ "border-input bg-transparent text-muted-foreground",
41
+ "hover:bg-muted hover:text-foreground",
42
+ "aria-checked:border-primary aria-checked:bg-primary/10 aria-checked:text-foreground",
43
+ ],
44
+ },
45
+ size: {
46
+ // sm is the documented dense-filter-chrome exception to the CTA size
47
+ // contract (min-h-9, mirroring Button's h-9 default — CLAUDE.md →
48
+ // Accessibility Floor, 2026-07 audit H5). When a chip is a
49
+ // flow-changing CTA, use size="default" or "lg" (min-h-11+).
50
+ sm: "min-h-9 px-3 text-sm",
51
+ default: "min-h-11 px-4 text-sm",
52
+ lg: "min-h-12 px-5 text-sm",
53
+ },
54
+ },
55
+ defaultVariants: {
56
+ variant: "default",
57
+ size: "default",
58
+ },
59
+ }
60
+ );
61
+
62
+ type ChipProps = Omit<React.ComponentProps<"button">, "children"> &
63
+ VariantProps<typeof chipVariants> & {
64
+ /** Controlled selected state. */
65
+ selected?: boolean;
66
+ /** Uncontrolled initial selected state. */
67
+ defaultSelected?: boolean;
68
+ /** Called with the next selected state on every toggle. */
69
+ onSelectedChange?: (selected: boolean) => void;
70
+ /**
71
+ * Optional leading icon (16px, strokeWidth 1.5 enforced via CSS).
72
+ * Replaced by the check indicator while the chip is selected.
73
+ */
74
+ icon?: React.ReactNode;
75
+ /** Visible label — the chip's accessible name. */
76
+ children: React.ReactNode;
77
+ };
78
+
79
+ function Chip({
80
+ className,
81
+ variant,
82
+ size,
83
+ selected,
84
+ defaultSelected = false,
85
+ onSelectedChange,
86
+ icon,
87
+ disabled,
88
+ onClick,
89
+ style,
90
+ children,
91
+ ...props
92
+ }: ChipProps) {
93
+ const [uncontrolledSelected, setUncontrolledSelected] =
94
+ React.useState(defaultSelected);
95
+ const isControlled = selected !== undefined;
96
+ const isSelected = isControlled ? selected : uncontrolledSelected;
97
+
98
+ const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
99
+ onClick?.(event);
100
+ if (event.defaultPrevented || disabled) return;
101
+ const next = !isSelected;
102
+ if (!isControlled) setUncontrolledSelected(next);
103
+ onSelectedChange?.(next);
104
+ };
105
+
106
+ return (
107
+ <button
108
+ type="button"
109
+ role="checkbox"
110
+ aria-checked={isSelected}
111
+ data-slot="chip"
112
+ data-selected={isSelected || undefined}
113
+ data-state={isSelected ? "checked" : "unchecked"}
114
+ disabled={disabled}
115
+ onClick={handleClick}
116
+ className={cn(chipVariants({ variant, size }), className)}
117
+ style={{
118
+ transitionDuration: "var(--duration-fast)",
119
+ transitionTimingFunction: "var(--ease-out)",
120
+ ...style,
121
+ }}
122
+ {...props}
123
+ >
124
+ {isSelected ? (
125
+ // Non-color selected indicator — state never reads by fill alone.
126
+ <Check strokeWidth={1.5} aria-hidden="true" className="size-4 shrink-0" />
127
+ ) : (
128
+ icon != null && (
129
+ <span
130
+ aria-hidden="true"
131
+ className="shrink-0 [&>svg]:size-4 [&>svg]:stroke-[1.5]"
132
+ >
133
+ {icon}
134
+ </span>
135
+ )
136
+ )}
137
+ <span className="min-w-0 truncate">{children}</span>
138
+ </button>
139
+ );
140
+ }
141
+
142
+ export { Chip, chipVariants };
143
+ export type { ChipProps };
@@ -19,8 +19,8 @@ const circularProgressVariants = cva(
19
19
  variant: {
20
20
  default: "text-primary",
21
21
  muted: "text-muted-foreground",
22
- success: "text-[hsl(var(--success))]",
23
- warning: "text-[hsl(var(--warning))]",
22
+ success: "text-[var(--success)]",
23
+ warning: "text-[var(--warning)]",
24
24
  destructive: "text-destructive",
25
25
  },
26
26
  },
@@ -0,0 +1,73 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+
6
+ import { cn } from "../../lib/utils"
7
+
8
+ const colorSwatchVariants = cva(
9
+ // Inset ring gives the swatch a crisp edge on any canvas. `foreground/15`
10
+ // is token-driven: a dark hairline in light mode delineates pale swatches,
11
+ // a light hairline in dark mode delineates near-black swatches.
12
+ "inline-grid shrink-0 place-items-center ring-1 ring-inset ring-foreground/15",
13
+ {
14
+ variants: {
15
+ size: {
16
+ sm: "size-4 [&_svg]:size-2.5",
17
+ default: "size-6 [&_svg]:size-3.5",
18
+ lg: "size-8 [&_svg]:size-4",
19
+ },
20
+ shape: {
21
+ rounded: "rounded-md",
22
+ circle: "rounded-full",
23
+ square: "rounded-none",
24
+ },
25
+ },
26
+ defaultVariants: {
27
+ size: "default",
28
+ shape: "rounded",
29
+ },
30
+ }
31
+ )
32
+
33
+ interface ColorSwatchProps
34
+ extends Omit<React.ComponentProps<"span">, "color">,
35
+ VariantProps<typeof colorSwatchVariants> {
36
+ /** Any CSS color — hex, rgb(), hsl(), or a CSS variable like `var(--chart-1)`. */
37
+ color: string
38
+ }
39
+
40
+ /**
41
+ * Display-only color chip. Presentational by default (`aria-hidden`) since a
42
+ * swatch usually sits beside a text label that already names the color. Pass
43
+ * `aria-label` when the swatch stands alone and must announce its meaning —
44
+ * it then renders `role="img"`. Not interactive: wrap it in a Button (with a
45
+ * label) if a click should do something.
46
+ */
47
+ function ColorSwatch({
48
+ className,
49
+ color,
50
+ size,
51
+ shape,
52
+ style,
53
+ children,
54
+ "aria-label": ariaLabel,
55
+ ...props
56
+ }: ColorSwatchProps) {
57
+ return (
58
+ <span
59
+ data-slot="color-swatch"
60
+ role={ariaLabel ? "img" : undefined}
61
+ aria-label={ariaLabel}
62
+ aria-hidden={ariaLabel ? undefined : true}
63
+ className={cn(colorSwatchVariants({ size, shape }), className)}
64
+ style={{ backgroundColor: color, ...style }}
65
+ {...props}
66
+ >
67
+ {children}
68
+ </span>
69
+ )
70
+ }
71
+
72
+ export { ColorSwatch, colorSwatchVariants }
73
+ export type { ColorSwatchProps }
@@ -58,6 +58,11 @@ function CopyButton({
58
58
  }, [value, copied, copiedDuration, onCopy])
59
59
 
60
60
  const iconOnly = children === undefined
61
+ // Compact labeled buttons drop the check icon in the copied state — at
62
+ // sm/xs padding the icon+text pair is wider than the resting label and
63
+ // clips against overflow-hidden. "Copied!" alone is confirmation enough
64
+ // there. Icon-only mode always keeps the check (it's the only feedback).
65
+ const showCheck = iconOnly || (size !== "sm" && size !== "xs")
61
66
 
62
67
  return (
63
68
  <>
@@ -66,7 +71,12 @@ function CopyButton({
66
71
  data-copied={copied ? "true" : undefined}
67
72
  variant={variant}
68
73
  size={size}
69
- disabled={disabled || copied}
74
+ // Not disabled during the copied window — the Button primitive's
75
+ // disabled:opacity-50 would dim the green confirmation to 50%. The
76
+ // re-copy guard lives in handleCopy (`if (copied) return`), so leaving
77
+ // the button enabled keeps "Copied!" at full opacity without allowing
78
+ // a double-copy.
79
+ disabled={disabled}
70
80
  onClick={handleCopy}
71
81
  aria-label={ariaLabel ?? (iconOnly ? (copied ? "Copied" : "Copy") : undefined)}
72
82
  className={cn("relative overflow-hidden", className)}
@@ -75,7 +85,7 @@ function CopyButton({
75
85
  {/* In labeled mode this span provides the button's accessible name — not aria-hidden */}
76
86
  <span
77
87
  className={cn(
78
- "inline-flex items-center gap-2 transition-all",
88
+ "inline-flex items-center gap-1.5 transition-[opacity,transform]",
79
89
  copied ? "opacity-0 scale-75" : "opacity-100 scale-100"
80
90
  )}
81
91
  style={{
@@ -90,7 +100,14 @@ function CopyButton({
90
100
  {/* Always hidden — state announced by the aria-live region */}
91
101
  <span
92
102
  className={cn(
93
- "absolute inset-0 inline-flex items-center justify-center gap-2 transition-all",
103
+ // Centered over the whole button face. An earlier right-aligned
104
+ // pr-4 treatment clipped the overlay's left edge on any size whose
105
+ // padding isn't px-4 (sm/xs) because the swap-in content is wider
106
+ // than the resting label and the button is overflow-hidden.
107
+ // No color override — inherits the button's own foreground so it
108
+ // reads on any variant. Green text on the dark default button fails
109
+ // AAA (~3.6:1); the check icon is sufficient confirmation.
110
+ "absolute inset-0 inline-flex items-center justify-center gap-1.5 transition-[opacity,transform]",
94
111
  copied ? "opacity-100 scale-100" : "opacity-0 scale-75"
95
112
  )}
96
113
  style={{
@@ -99,7 +116,7 @@ function CopyButton({
99
116
  }}
100
117
  aria-hidden="true"
101
118
  >
102
- <CheckIcon strokeWidth={1.5} />
119
+ {showCheck && <CheckIcon strokeWidth={1.5} />}
103
120
  {!iconOnly && "Copied!"}
104
121
  </span>
105
122
  </Button>
@@ -0,0 +1,169 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cva, type VariantProps } from "class-variance-authority";
5
+
6
+ import { cn } from "../../lib/utils";
7
+
8
+ /**
9
+ * Semantic key–value list primitive. Renders a native <dl> with <dt>/<dd>
10
+ * pairs, so screen readers announce a description list and associate each
11
+ * term with its description — semantics a div grid or the <ul>-based List
12
+ * primitive cannot produce.
13
+ *
14
+ * Use DataList for read-only detail surfaces: profile panels, invoice and
15
+ * order summaries, settings recaps, metadata blocks, confirmation review
16
+ * steps. It is display-only — no interaction, no focus, no motion. For
17
+ * editable values compose Editable or CopyButton inside DataListValue; for
18
+ * tabular column data use Table.
19
+ *
20
+ * <DataList orientation="horizontal">
21
+ * <DataListItem>
22
+ * <DataListLabel>Billing email</DataListLabel>
23
+ * <DataListValue>jordan@reeves.design</DataListValue>
24
+ * </DataListItem>
25
+ * </DataList>
26
+ *
27
+ * Orientation "vertical" (default) stacks label over value; "horizontal"
28
+ * lays each pair on a grid row with the label column aligned across ALL
29
+ * rows via CSS subgrid (root owns the two-column track, each item spans it
30
+ * with grid-cols-subgrid). Browsers without subgrid degrade to a stacked
31
+ * row — readable, non-breaking.
32
+ */
33
+
34
+ type DataListContextValue = {
35
+ orientation: "vertical" | "horizontal";
36
+ size: "sm" | "default" | "lg";
37
+ };
38
+
39
+ const DataListContext = React.createContext<DataListContextValue>({
40
+ orientation: "vertical",
41
+ size: "default",
42
+ });
43
+
44
+ function useDataListContext() {
45
+ return React.useContext(DataListContext);
46
+ }
47
+
48
+ const dataListVariants = cva("min-w-0", {
49
+ variants: {
50
+ orientation: {
51
+ // Stacked pairs; the root is a simple column.
52
+ vertical: "flex flex-col",
53
+ // Root owns the two-column track (label auto-sized, value fills);
54
+ // items span it with subgrid so the label column aligns across rows.
55
+ horizontal: "grid grid-cols-[auto_1fr] gap-x-6",
56
+ },
57
+ size: {
58
+ sm: "",
59
+ default: "",
60
+ lg: "",
61
+ },
62
+ },
63
+ compoundVariants: [
64
+ { orientation: "vertical", size: "sm", className: "gap-3" },
65
+ { orientation: "vertical", size: "default", className: "gap-4" },
66
+ { orientation: "vertical", size: "lg", className: "gap-5" },
67
+ { orientation: "horizontal", size: "sm", className: "gap-y-2" },
68
+ { orientation: "horizontal", size: "default", className: "gap-y-3" },
69
+ { orientation: "horizontal", size: "lg", className: "gap-y-4" },
70
+ ],
71
+ defaultVariants: { orientation: "vertical", size: "default" },
72
+ });
73
+
74
+ export interface DataListProps
75
+ extends React.ComponentProps<"dl">,
76
+ VariantProps<typeof dataListVariants> {}
77
+
78
+ function DataList({
79
+ className,
80
+ orientation = "vertical",
81
+ size = "default",
82
+ ...props
83
+ }: DataListProps) {
84
+ const ctx = React.useMemo<DataListContextValue>(
85
+ () => ({ orientation: orientation ?? "vertical", size: size ?? "default" }),
86
+ [orientation, size],
87
+ );
88
+
89
+ return (
90
+ <DataListContext.Provider value={ctx}>
91
+ <dl
92
+ data-slot="data-list"
93
+ data-orientation={ctx.orientation}
94
+ className={cn(dataListVariants({ orientation, size }), className)}
95
+ {...props}
96
+ />
97
+ </DataListContext.Provider>
98
+ );
99
+ }
100
+
101
+ /**
102
+ * One term–description pair. A <div> is spec-valid inside <dl> for grouping
103
+ * a <dt> with its <dd>, and is transparent to the accessibility tree.
104
+ */
105
+ function DataListItem({ className, ...props }: React.ComponentProps<"div">) {
106
+ const { orientation } = useDataListContext();
107
+ return (
108
+ <div
109
+ data-slot="data-list-item"
110
+ className={cn(
111
+ "min-w-0",
112
+ orientation === "horizontal"
113
+ ? // Span the root's two-column track; subgrid keeps every row's
114
+ // label column aligned. No-subgrid browsers fall back to a
115
+ // stacked block row.
116
+ "col-span-2 grid grid-cols-subgrid items-baseline"
117
+ : "flex flex-col gap-1",
118
+ className,
119
+ )}
120
+ {...props}
121
+ />
122
+ );
123
+ }
124
+
125
+ /** The term (<dt>) — muted, medium weight. */
126
+ function DataListLabel({ className, ...props }: React.ComponentProps<"dt">) {
127
+ const { size } = useDataListContext();
128
+ return (
129
+ <dt
130
+ data-slot="data-list-label"
131
+ className={cn(
132
+ "font-medium text-muted-foreground",
133
+ // BADS scale: text-xs = 14px (AAA floor), text-sm = 16px.
134
+ size === "lg" ? "text-sm" : "text-xs",
135
+ className,
136
+ )}
137
+ {...props}
138
+ />
139
+ );
140
+ }
141
+
142
+ /**
143
+ * The description (<dd>). Values are arbitrary runtime strings (emails,
144
+ * URLs, IDs), so the long-label overflow contract applies: min-w-0 +
145
+ * overflow-wrap anywhere. m-0 defensively clears the UA stylesheet's
146
+ * <dd> start margin outside preflight contexts.
147
+ */
148
+ function DataListValue({ className, ...props }: React.ComponentProps<"dd">) {
149
+ const { size } = useDataListContext();
150
+ return (
151
+ <dd
152
+ data-slot="data-list-value"
153
+ className={cn(
154
+ "m-0 min-w-0 text-foreground [overflow-wrap:anywhere]",
155
+ size === "lg" ? "text-base" : "text-sm",
156
+ className,
157
+ )}
158
+ {...props}
159
+ />
160
+ );
161
+ }
162
+
163
+ export {
164
+ DataList,
165
+ DataListItem,
166
+ DataListLabel,
167
+ DataListValue,
168
+ dataListVariants,
169
+ };
@@ -146,9 +146,12 @@ function DatePicker({
146
146
  mode="single"
147
147
  selected={selectedDate}
148
148
  onSelect={handleSelect}
149
- fromDate={fromDate}
150
- toDate={toDate}
151
- initialFocus
149
+ startMonth={fromDate}
150
+ endMonth={toDate}
151
+ disabled={[
152
+ ...(fromDate ? [{ before: fromDate }] : []),
153
+ ...(toDate ? [{ after: toDate }] : []),
154
+ ]}
152
155
  />
153
156
  </PopoverContent>
154
157
  </Popover>
@@ -161,10 +161,13 @@ function DateRangePicker({
161
161
  mode="range"
162
162
  selected={selectedRange as DateRange | undefined}
163
163
  onSelect={handleSelect}
164
- fromDate={fromDate}
165
- toDate={toDate}
164
+ startMonth={fromDate}
165
+ endMonth={toDate}
166
+ disabled={[
167
+ ...(fromDate ? [{ before: fromDate }] : []),
168
+ ...(toDate ? [{ after: toDate }] : []),
169
+ ]}
166
170
  numberOfMonths={2}
167
- initialFocus
168
171
  />
169
172
  </PopoverContent>
170
173
  </Popover>
@@ -165,8 +165,14 @@ function FieldsetLegend({
165
165
  <legend
166
166
  data-slot="fieldset-legend"
167
167
  className={cn(
168
- // float-none + w-full so it plays nicely as the first flex child
169
- "float-none w-full text-sm font-semibold text-foreground",
168
+ // float-left (not float-none!) is what opts a <legend> OUT of the
169
+ // browser's native "rendered legend" placement — with float:none the
170
+ // legend is drawn straddling the fieldset's top border (HTML rendering
171
+ // spec), which strikes the border line through the title and notches
172
+ // the top edge (shipped broken 2026-07-04, caught by Sir on prod).
173
+ // Inside the flex fieldset the float is then inert and the legend lays
174
+ // out as a normal first flex item; w-full keeps it on its own row.
175
+ "float-left w-full text-sm font-semibold text-foreground",
170
176
  "group-data-[disabled]:text-muted-foreground",
171
177
  invalid && "text-destructive",
172
178
  className,
@@ -0,0 +1,114 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { cva, type VariantProps } from "class-variance-authority";
5
+
6
+ import { cn } from "../../lib/utils";
7
+ import { Input } from "./input";
8
+
9
+ // ─── Variants ─────────────────────────────────────────────────────────────────
10
+ //
11
+ // The label always carries px-1 (so the floated "notch" has breathing room over
12
+ // the top border) and left-* compensates per size so the RESTING label text
13
+ // aligns exactly with the input's own text (Input pads: sm px-2.5, default px-3,
14
+ // lg px-4).
15
+ //
16
+ // Float trigger is pure CSS — the wrapped <Input> is the `peer`, and the label
17
+ // reacts to :focus, :not(:placeholder-shown) (requires placeholder=" "), and
18
+ // :autofill (Chrome autofill doesn't always fire focus). No JS state.
19
+
20
+ const floatLabelVariants = cva(
21
+ [
22
+ // geometry + resting position (vertically centered in the field)
23
+ "pointer-events-none absolute top-1/2 -translate-y-1/2 select-none px-1",
24
+ "origin-left text-muted-foreground",
25
+ // float on focus
26
+ "peer-focus:top-0 peer-focus:text-xs peer-focus:bg-background peer-focus:text-foreground",
27
+ // stay floated while filled (placeholder=" " makes :placeholder-shown reliable)
28
+ "peer-[:not(:placeholder-shown)]:top-0 peer-[:not(:placeholder-shown)]:text-xs peer-[:not(:placeholder-shown)]:bg-background",
29
+ // browser autofill paints a value without necessarily focusing
30
+ "peer-autofill:top-0 peer-autofill:text-xs peer-autofill:bg-background",
31
+ // state mirrors
32
+ "peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
33
+ "peer-aria-invalid:text-destructive",
34
+ // motion: property list here; duration/easing via inline style tokens below
35
+ "transition-[top,transform,font-size,color,background-color]",
36
+ ],
37
+ {
38
+ variants: {
39
+ size: {
40
+ sm: "left-1.5 text-sm",
41
+ default: "left-2 text-sm",
42
+ lg: "left-3 text-base",
43
+ },
44
+ },
45
+ defaultVariants: {
46
+ size: "default",
47
+ },
48
+ }
49
+ );
50
+
51
+ // ─── Types ────────────────────────────────────────────────────────────────────
52
+
53
+ type FloatLabelProps = Omit<
54
+ React.ComponentProps<typeof Input>,
55
+ "size" | "placeholder" | "clearable"
56
+ > &
57
+ VariantProps<typeof floatLabelVariants> & {
58
+ /** Visible label text. Required — this IS the field's accessible name. */
59
+ label: string;
60
+ /** Class applied to the outer relative wrapper (use for width control). */
61
+ containerClassName?: string;
62
+ };
63
+
64
+ // ─── FloatLabel ───────────────────────────────────────────────────────────────
65
+
66
+ function FloatLabel({
67
+ label,
68
+ size,
69
+ id,
70
+ required,
71
+ containerClassName,
72
+ className,
73
+ ...props
74
+ }: FloatLabelProps) {
75
+ const generatedId = React.useId();
76
+ const inputId = id ?? generatedId;
77
+ const labelId = `${inputId}-label`;
78
+
79
+ return (
80
+ <div
81
+ data-slot="float-label"
82
+ className={cn("relative", containerClassName)}
83
+ >
84
+ <Input
85
+ id={inputId}
86
+ size={size}
87
+ required={required}
88
+ aria-labelledby={labelId}
89
+ // A single space keeps :placeholder-shown reliable for empty-state
90
+ // detection without ever rendering visible placeholder text — the
91
+ // floating label is the field's one visible name.
92
+ placeholder=" "
93
+ className={cn("peer", className)}
94
+ {...props}
95
+ />
96
+ <label
97
+ id={labelId}
98
+ htmlFor={inputId}
99
+ data-slot="float-label-label"
100
+ className={cn(floatLabelVariants({ size }))}
101
+ style={{
102
+ transitionDuration: "var(--duration-fast)",
103
+ transitionTimingFunction: "var(--ease-out)",
104
+ }}
105
+ >
106
+ {label}
107
+ {required && <span aria-hidden="true"> *</span>}
108
+ </label>
109
+ </div>
110
+ );
111
+ }
112
+
113
+ export { FloatLabel, floatLabelVariants };
114
+ export type { FloatLabelProps };