@stll/ui 0.0.1-placeholder.0 → 0.2.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 (133) hide show
  1. package/README.md +84 -0
  2. package/dist/components/accordion.d.ts +8 -0
  3. package/dist/components/accordion.js +38 -0
  4. package/dist/components/alert-dialog.d.ts +32 -0
  5. package/dist/components/alert-dialog.js +75 -0
  6. package/dist/components/avatar.d.ts +7 -0
  7. package/dist/components/avatar.js +22 -0
  8. package/dist/components/bidi-text.d.ts +24 -0
  9. package/dist/components/bidi-text.js +38 -0
  10. package/dist/components/brand-icons.d.ts +7 -0
  11. package/dist/components/brand-icons.js +18 -0
  12. package/dist/components/breadcrumb.d.ts +12 -0
  13. package/dist/components/breadcrumb.js +61 -0
  14. package/dist/components/button-variants.d.ts +17 -0
  15. package/dist/components/button-variants.js +43 -0
  16. package/dist/components/button.d.ts +20 -0
  17. package/dist/components/button.js +53 -0
  18. package/dist/components/checkbox.d.ts +5 -0
  19. package/dist/components/checkbox.js +44 -0
  20. package/dist/components/color-picker.d.ts +47 -0
  21. package/dist/components/color-picker.js +249 -0
  22. package/dist/components/combobox.d.ts +40 -0
  23. package/dist/components/combobox.js +208 -0
  24. package/dist/components/command.d.ts +34 -0
  25. package/dist/components/command.js +100 -0
  26. package/dist/components/date-picker-popover.d.ts +29 -0
  27. package/dist/components/date-picker-popover.js +548 -0
  28. package/dist/components/date-picker-popover.logic.d.ts +14 -0
  29. package/dist/components/date-picker-popover.logic.js +26 -0
  30. package/dist/components/destructive-action-confirmation.d.ts +21 -0
  31. package/dist/components/destructive-action-confirmation.js +60 -0
  32. package/dist/components/destructive-confirm-dialog.d.ts +17 -0
  33. package/dist/components/destructive-confirm-dialog.js +49 -0
  34. package/dist/components/dialog.d.ts +37 -0
  35. package/dist/components/dialog.js +92 -0
  36. package/dist/components/directional-icon.d.ts +30 -0
  37. package/dist/components/directional-icon.js +12 -0
  38. package/dist/components/field.d.ts +11 -0
  39. package/dist/components/field.js +34 -0
  40. package/dist/components/form.d.ts +5 -0
  41. package/dist/components/form.js +12 -0
  42. package/dist/components/frame.d.ts +10 -0
  43. package/dist/components/frame.js +35 -0
  44. package/dist/components/hex-color-picker.d.ts +11 -0
  45. package/dist/components/hex-color-picker.js +366 -0
  46. package/dist/components/input-group.d.ts +15 -0
  47. package/dist/components/input-group.js +53 -0
  48. package/dist/components/input-otp.d.ts +13 -0
  49. package/dist/components/input-otp.js +39 -0
  50. package/dist/components/input.d.ts +12 -0
  51. package/dist/components/input.js +46 -0
  52. package/dist/components/label.d.ts +5 -0
  53. package/dist/components/label.js +18 -0
  54. package/dist/components/menu.d.ts +44 -0
  55. package/dist/components/menu.js +152 -0
  56. package/dist/components/outline-rail.d.ts +39 -0
  57. package/dist/components/outline-rail.js +405 -0
  58. package/dist/components/pagination.d.ts +17 -0
  59. package/dist/components/pagination.js +78 -0
  60. package/dist/components/popover.d.ts +34 -0
  61. package/dist/components/popover.js +67 -0
  62. package/dist/components/preview-card.d.ts +12 -0
  63. package/dist/components/preview-card.js +25 -0
  64. package/dist/components/preview-pane.d.ts +23 -0
  65. package/dist/components/preview-pane.js +33 -0
  66. package/dist/components/scroll-area.d.ts +19 -0
  67. package/dist/components/scroll-area.js +38 -0
  68. package/dist/components/scroll-to-top.d.ts +12 -0
  69. package/dist/components/scroll-to-top.js +43 -0
  70. package/dist/components/secret-input.d.ts +9 -0
  71. package/dist/components/secret-input.js +38 -0
  72. package/dist/components/segmented-icon-toggle.d.ts +22 -0
  73. package/dist/components/segmented-icon-toggle.js +30 -0
  74. package/dist/components/select.d.ts +25 -0
  75. package/dist/components/select.js +196 -0
  76. package/dist/components/separator.d.ts +16 -0
  77. package/dist/components/separator.js +26 -0
  78. package/dist/components/sheet.d.ts +29 -0
  79. package/dist/components/sheet.js +87 -0
  80. package/dist/components/skeleton.d.ts +4 -0
  81. package/dist/components/skeleton.js +10 -0
  82. package/dist/components/stella-mark.d.ts +5 -0
  83. package/dist/components/stella-mark.js +12 -0
  84. package/dist/components/stella-wordmark.d.ts +5 -0
  85. package/dist/components/stella-wordmark.js +21 -0
  86. package/dist/components/table.d.ts +20 -0
  87. package/dist/components/table.js +80 -0
  88. package/dist/components/tabs.d.ts +11 -0
  89. package/dist/components/tabs.js +46 -0
  90. package/dist/components/textarea.d.ts +9 -0
  91. package/dist/components/textarea.js +31 -0
  92. package/dist/components/toast.d.ts +60 -0
  93. package/dist/components/toast.js +261 -0
  94. package/dist/components/tooltip-trigger-helper.d.ts +11 -0
  95. package/dist/components/tooltip-trigger-helper.js +14 -0
  96. package/dist/components/tooltip.d.ts +15 -0
  97. package/dist/components/tooltip.js +32 -0
  98. package/dist/hooks/use-contained-handler.d.ts +55 -0
  99. package/dist/hooks/use-contained-handler.js +54 -0
  100. package/dist/hooks/use-content-dir.d.ts +48 -0
  101. package/dist/hooks/use-content-dir.js +45 -0
  102. package/dist/hooks/use-mobile.d.ts +4 -0
  103. package/dist/hooks/use-mobile.js +16 -0
  104. package/dist/hooks/use-viewport-width.d.ts +5 -0
  105. package/dist/hooks/use-viewport-width.js +14 -0
  106. package/dist/index.d.ts +60 -0
  107. package/dist/index.js +59 -0
  108. package/dist/inspector/chrome.d.ts +72 -0
  109. package/dist/inspector/chrome.js +153 -0
  110. package/dist/inspector/dock.d.ts +48 -0
  111. package/dist/inspector/dock.js +36 -0
  112. package/dist/inspector/index.d.ts +6 -0
  113. package/dist/inspector/index.js +6 -0
  114. package/dist/inspector/layout-tokens.d.ts +28 -0
  115. package/dist/inspector/layout-tokens.js +28 -0
  116. package/dist/inspector/pane-width.d.ts +64 -0
  117. package/dist/inspector/pane-width.js +53 -0
  118. package/dist/inspector/use-pane-width.d.ts +99 -0
  119. package/dist/inspector/use-pane-width.js +149 -0
  120. package/dist/lib/button-disposition.d.ts +63 -0
  121. package/dist/lib/button-disposition.js +52 -0
  122. package/dist/lib/overlay-layer.d.ts +22 -0
  123. package/dist/lib/overlay-layer.js +21 -0
  124. package/dist/lib/tab-order.d.ts +15 -0
  125. package/dist/lib/tab-order.js +15 -0
  126. package/dist/lib/tooltip-content.d.ts +13 -0
  127. package/dist/lib/tooltip-content.js +12 -0
  128. package/dist/lib/utils.d.ts +20 -0
  129. package/dist/lib/utils.js +41 -0
  130. package/dist/lib/week.d.ts +25 -0
  131. package/dist/lib/week.js +40 -0
  132. package/dist/styles/theme.css +1209 -0
  133. package/package.json +506 -2
@@ -0,0 +1,47 @@
1
+ import * as React$1 from "react";
2
+ //#region src/components/color-picker.d.ts
3
+ type ColorPreset = {
4
+ label: string;
5
+ /** Value emitted on select (e.g. "red" or "FF0000") */
6
+ value: string;
7
+ /** CSS color for the swatch (e.g. "var(--option-red)" or "#FF0000").
8
+ * Falls back to `#${value}` when omitted. */
9
+ color?: string;
10
+ };
11
+ type ColorPickerProps = {
12
+ /** Currently selected value (matches a preset value, or a hex without #) */
13
+ value?: string | undefined;
14
+ /** Called with the preset value on selection, or a hex string from the input */
15
+ onSelect?: (value: string) => void;
16
+ /** Show "No Color" button; fires on click */
17
+ onClear?: () => void;
18
+ /** Color presets. Falls back to DEFAULT_PRESETS when omitted. */
19
+ presets?: ColorPreset[];
20
+ /** Grid columns (default 9) */
21
+ columns?: number;
22
+ /** Start with hex input visible (default false) */
23
+ defaultExpanded?: boolean;
24
+ /** Localized label for expanding the custom color controls. */
25
+ moreLabel: string;
26
+ /** Popover trigger element */
27
+ children: React$1.ReactNode;
28
+ /** Popover placement side */
29
+ side?: "top" | "bottom" | "left" | "right";
30
+ /** Popover placement alignment */
31
+ align?: "start" | "center" | "end";
32
+ className?: string;
33
+ };
34
+ type ColorPickerContentProps = {
35
+ value?: string | undefined;
36
+ onSelect?: ((value: string) => void) | undefined;
37
+ onClear?: (() => void) | undefined;
38
+ presets: ColorPreset[];
39
+ columns: number;
40
+ defaultExpanded: boolean;
41
+ moreLabel: string;
42
+ };
43
+ declare const DEFAULT_PRESETS: ColorPreset[];
44
+ declare const ColorPickerContent: ({ value, onSelect, onClear, presets, columns, defaultExpanded, moreLabel }: ColorPickerContentProps) => React$1.JSX.Element;
45
+ declare const ColorPicker: ({ value, onSelect, onClear, presets, columns, defaultExpanded, moreLabel, children, side, align, className }: ColorPickerProps) => React$1.JSX.Element;
46
+ //#endregion
47
+ export { ColorPicker, ColorPickerContent, type ColorPickerContentProps, type ColorPickerProps, type ColorPreset, DEFAULT_PRESETS };
@@ -0,0 +1,249 @@
1
+ "use client";
2
+ import { cn } from "../lib/utils.js";
3
+ import { CheckIcon, ChevronDownIcon } from "lucide-react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Suspense, lazy, useState } from "react";
6
+ import { Popover } from "@base-ui/react/popover";
7
+ //#region src/components/color-picker.tsx
8
+ const HexColorPicker = lazy(async () => {
9
+ return { default: (await import("./hex-color-picker.js")).HexColorPicker };
10
+ });
11
+ const DEFAULT_PRESETS = [
12
+ {
13
+ label: "Black",
14
+ value: "000000",
15
+ color: "#000000"
16
+ },
17
+ {
18
+ label: "White",
19
+ value: "FFFFFF",
20
+ color: "#FFFFFF"
21
+ },
22
+ {
23
+ label: "Red",
24
+ value: "red",
25
+ color: "var(--option-red)"
26
+ },
27
+ {
28
+ label: "Orange",
29
+ value: "orange",
30
+ color: "var(--option-orange)"
31
+ },
32
+ {
33
+ label: "Amber",
34
+ value: "amber",
35
+ color: "var(--option-amber)"
36
+ },
37
+ {
38
+ label: "Yellow",
39
+ value: "yellow",
40
+ color: "var(--option-yellow)"
41
+ },
42
+ {
43
+ label: "Lime",
44
+ value: "lime",
45
+ color: "var(--option-lime)"
46
+ },
47
+ {
48
+ label: "Green",
49
+ value: "green",
50
+ color: "var(--option-green)"
51
+ },
52
+ {
53
+ label: "Emerald",
54
+ value: "emerald",
55
+ color: "var(--option-emerald)"
56
+ },
57
+ {
58
+ label: "Teal",
59
+ value: "teal",
60
+ color: "var(--option-teal)"
61
+ },
62
+ {
63
+ label: "Cyan",
64
+ value: "cyan",
65
+ color: "var(--option-cyan)"
66
+ },
67
+ {
68
+ label: "Sky",
69
+ value: "sky",
70
+ color: "var(--option-sky)"
71
+ },
72
+ {
73
+ label: "Blue",
74
+ value: "blue",
75
+ color: "var(--option-blue)"
76
+ },
77
+ {
78
+ label: "Indigo",
79
+ value: "indigo",
80
+ color: "var(--option-indigo)"
81
+ },
82
+ {
83
+ label: "Violet",
84
+ value: "violet",
85
+ color: "var(--option-violet)"
86
+ },
87
+ {
88
+ label: "Purple",
89
+ value: "purple",
90
+ color: "var(--option-purple)"
91
+ },
92
+ {
93
+ label: "Fuchsia",
94
+ value: "fuchsia",
95
+ color: "var(--option-fuchsia)"
96
+ },
97
+ {
98
+ label: "Gray",
99
+ value: "gray",
100
+ color: "var(--option-gray)"
101
+ }
102
+ ];
103
+ const isValidHex = (hex) => /^[0-9A-Fa-f]{6}$/u.test(hex);
104
+ const normalizeHex = (hex) => hex.replace(/^#/u, "").toUpperCase();
105
+ /** CSS color to render for a preset swatch. */
106
+ const swatchColor = (preset) => preset.color ?? `#${preset.value}`;
107
+ /** Returns true when a 6-char hex is light enough to need a visible border. */
108
+ const isLightHex = (hex) => {
109
+ if (hex.length !== 6) return false;
110
+ const r = Number.parseInt(hex.slice(0, 2), 16);
111
+ const g = Number.parseInt(hex.slice(2, 4), 16);
112
+ const b = Number.parseInt(hex.slice(4, 6), 16);
113
+ return (r * 299 + g * 587 + b * 114) / 1e3 > 220;
114
+ };
115
+ /** Check if a value looks like a 6-char hex (no CSS vars, no named colors). */
116
+ const looksLikeHex = (v) => /^[0-9A-Fa-f]{6}$/u.test(v);
117
+ const ColorSwatch = ({ cssColor, selected, label, isLight, onClick }) => /* @__PURE__ */ jsx(Popover.Close, {
118
+ render: /* @__PURE__ */ jsx("button", {
119
+ "aria-label": label,
120
+ className: cn("hover:border-foreground relative flex size-6 items-center justify-center rounded-md border transition-[transform,border-color] hover:scale-115 sm:size-5", selected ? "border-foreground ring-ring/24 ring-1" : "border-border/40", isLight && !selected && "border-border"),
121
+ onClick,
122
+ style: { backgroundColor: cssColor },
123
+ type: "button"
124
+ }),
125
+ children: selected && /* @__PURE__ */ jsx(CheckIcon, {
126
+ className: "pointer-events-none size-3 sm:size-2.5",
127
+ style: { color: isLight ? "#000" : "#fff" }
128
+ })
129
+ });
130
+ const ColorPickerContent = ({ value, onSelect, onClear, presets, columns, defaultExpanded, moreLabel }) => {
131
+ const [expanded, setExpanded] = useState(defaultExpanded);
132
+ const [pickerHex, setPickerHex] = useState(() => (looksLikeHex(value ?? "") ? value : "000000") ?? "000000");
133
+ const [inputHex, setInputHex] = useState("");
134
+ /** Called when the visual picker (SB square / hue strip) emits a color. */
135
+ const handlePickerChange = (hex) => {
136
+ const normalized = normalizeHex(hex);
137
+ setPickerHex(normalized);
138
+ setInputHex(normalized);
139
+ if (isValidHex(normalized)) onSelect?.(normalized);
140
+ };
141
+ /** Called when the hex text input changes. */
142
+ const handleInputChange = (raw) => {
143
+ const cleaned = raw.replace(/[^0-9A-Fa-f]/gu, "").slice(0, 6).toUpperCase();
144
+ setInputHex(cleaned);
145
+ if (isValidHex(cleaned)) {
146
+ setPickerHex(cleaned);
147
+ onSelect?.(cleaned);
148
+ }
149
+ };
150
+ return /* @__PURE__ */ jsxs("div", {
151
+ className: "flex flex-col gap-1.5",
152
+ "data-slot": "color-picker",
153
+ children: [
154
+ onClear && /* @__PURE__ */ jsxs(Popover.Close, {
155
+ render: /* @__PURE__ */ jsx("button", {
156
+ "aria-label": "No color",
157
+ className: "text-muted-foreground hover:bg-accent hover:text-accent-foreground flex h-6 w-full items-center gap-1.5 rounded px-1 text-[11px] transition-colors",
158
+ onClick: onClear,
159
+ type: "button"
160
+ }),
161
+ children: [/* @__PURE__ */ jsx("span", {
162
+ className: "bg-popover border-border relative flex size-4 items-center justify-center rounded-sm border",
163
+ children: /* @__PURE__ */ jsx("span", { className: "bg-destructive absolute h-px w-[140%] rotate-[-45deg]" })
164
+ }), "No Color"]
165
+ }),
166
+ /* @__PURE__ */ jsx("div", {
167
+ className: "grid gap-0.5",
168
+ role: "grid",
169
+ style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` },
170
+ children: presets.map((preset) => /* @__PURE__ */ jsx(ColorSwatch, {
171
+ cssColor: swatchColor(preset),
172
+ isLight: looksLikeHex(preset.value) && isLightHex(preset.value),
173
+ label: preset.label,
174
+ onClick: () => onSelect?.(preset.value),
175
+ selected: value === preset.value
176
+ }, preset.value))
177
+ }),
178
+ !expanded ? /* @__PURE__ */ jsxs("button", {
179
+ className: "text-muted-foreground hover:text-foreground flex items-center justify-center gap-1 py-0.5 text-[11px] transition-colors",
180
+ onClick: () => setExpanded(true),
181
+ type: "button",
182
+ children: [moreLabel, /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3" })]
183
+ }) : /* @__PURE__ */ jsxs("div", {
184
+ className: "border-border flex flex-col gap-2 border-t pt-2",
185
+ children: [/* @__PURE__ */ jsx(Suspense, {
186
+ fallback: /* @__PURE__ */ jsx("div", {
187
+ "aria-hidden": true,
188
+ className: "ring-border/30 h-[140px] w-full rounded-lg ring-1"
189
+ }),
190
+ children: /* @__PURE__ */ jsx(HexColorPicker, {
191
+ className: "ring-border/30 !h-[140px] !w-full overflow-hidden rounded-lg ring-1",
192
+ color: pickerHex,
193
+ onChange: (hex) => handlePickerChange(hex.replace("#", ""))
194
+ })
195
+ }), /* @__PURE__ */ jsxs("div", {
196
+ className: "flex items-center gap-1.5",
197
+ children: [
198
+ /* @__PURE__ */ jsx("span", {
199
+ className: "text-muted-foreground text-[11px]",
200
+ children: "#"
201
+ }),
202
+ /* @__PURE__ */ jsx("input", {
203
+ "aria-label": "Custom hex color",
204
+ className: "border-input bg-background text-foreground h-6 flex-1 rounded border px-1.5 font-mono text-[11px] outline-none",
205
+ dir: "ltr",
206
+ maxLength: 6,
207
+ onChange: (e) => handleInputChange(e.target.value),
208
+ onKeyDown: (e) => e.stopPropagation(),
209
+ onMouseDown: (e) => e.stopPropagation(),
210
+ onPointerDown: (e) => e.stopPropagation(),
211
+ placeholder: "FF0000",
212
+ value: inputHex
213
+ }),
214
+ isValidHex(inputHex) && /* @__PURE__ */ jsx("span", {
215
+ className: "border-border size-6 shrink-0 rounded border",
216
+ style: { backgroundColor: `#${inputHex}` }
217
+ })
218
+ ]
219
+ })]
220
+ })
221
+ ]
222
+ });
223
+ };
224
+ const ColorPicker = ({ value, onSelect, onClear, presets = DEFAULT_PRESETS, columns = 9, defaultExpanded = false, moreLabel, children, side = "bottom", align = "start", className }) => /* @__PURE__ */ jsxs(Popover.Root, { children: [/* @__PURE__ */ jsx(Popover.Trigger, {
225
+ "data-slot": "color-picker-trigger",
226
+ nativeButton: false,
227
+ render: /* @__PURE__ */ jsx("div", { className: "inline-flex" }),
228
+ children
229
+ }), /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
230
+ align,
231
+ className: "z-50",
232
+ side,
233
+ sideOffset: 4,
234
+ children: /* @__PURE__ */ jsx(Popover.Popup, {
235
+ className: cn("bg-popover text-popover-foreground origin-(--transform-origin) rounded-lg border p-2 shadow-lg/5 transition-[scale,opacity] not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", className),
236
+ "data-slot": "color-picker-popup",
237
+ children: /* @__PURE__ */ jsx(ColorPickerContent, {
238
+ columns,
239
+ defaultExpanded,
240
+ moreLabel,
241
+ onClear,
242
+ onSelect,
243
+ presets,
244
+ value
245
+ })
246
+ })
247
+ }) })] });
248
+ //#endregion
249
+ export { ColorPicker, ColorPickerContent, DEFAULT_PRESETS };
@@ -0,0 +1,40 @@
1
+ import * as React$1 from "react";
2
+ import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
3
+ //#region src/components/combobox.d.ts
4
+ declare const Combobox: <Value, Multiple extends boolean | undefined = false>(props: Combobox$1.Root.Props<Value, Multiple>) => React$1.JSX.Element;
5
+ declare const ComboboxChipsInput: ({ className, size, ...props }: Omit<Combobox$1.Input.Props, "size"> & {
6
+ size?: "sm" | "default" | "lg" | number;
7
+ ref?: React$1.Ref<HTMLInputElement>;
8
+ }) => React$1.JSX.Element;
9
+ declare const ComboboxInput: ({ className, showTrigger, showClear, startAddon, size, ...props }: Omit<Combobox$1.Input.Props, "size"> & {
10
+ showTrigger?: boolean;
11
+ showClear?: boolean;
12
+ startAddon?: React$1.ReactNode;
13
+ size?: "sm" | "default" | "lg" | number;
14
+ ref?: React$1.Ref<HTMLInputElement>;
15
+ }) => React$1.JSX.Element;
16
+ declare const ComboboxTrigger: ({ className, ...props }: Combobox$1.Trigger.Props) => React$1.JSX.Element;
17
+ declare const ComboboxPopup: ({ className, children, side, sideOffset, alignOffset, align, ...props }: Combobox$1.Popup.Props & {
18
+ align?: Combobox$1.Positioner.Props["align"];
19
+ sideOffset?: Combobox$1.Positioner.Props["sideOffset"];
20
+ alignOffset?: Combobox$1.Positioner.Props["alignOffset"];
21
+ side?: Combobox$1.Positioner.Props["side"];
22
+ }) => React$1.JSX.Element;
23
+ declare const ComboboxItem: ({ className, children, ...props }: Combobox$1.Item.Props) => React$1.JSX.Element;
24
+ declare const ComboboxSeparator: ({ className, ...props }: Combobox$1.Separator.Props) => React$1.JSX.Element;
25
+ declare const ComboboxGroup: ({ className, ...props }: Combobox$1.Group.Props) => React$1.JSX.Element;
26
+ declare const ComboboxGroupLabel: ({ className, ...props }: Combobox$1.GroupLabel.Props) => React$1.JSX.Element;
27
+ declare const ComboboxEmpty: ({ className, ...props }: Combobox$1.Empty.Props) => React$1.JSX.Element;
28
+ declare const ComboboxRow: ({ className, ...props }: Combobox$1.Row.Props) => React$1.JSX.Element;
29
+ declare const ComboboxValue: ({ ...props }: Combobox$1.Value.Props) => React$1.JSX.Element;
30
+ declare const ComboboxList: ({ className, ...props }: Combobox$1.List.Props) => React$1.JSX.Element;
31
+ declare const ComboboxClear: ({ className, ...props }: Combobox$1.Clear.Props) => React$1.JSX.Element;
32
+ declare const ComboboxStatus: ({ className, ...props }: Combobox$1.Status.Props) => React$1.JSX.Element;
33
+ declare const ComboboxCollection: (props: Combobox$1.Collection.Props) => React$1.JSX.Element;
34
+ declare const ComboboxChips: ({ className, children, startAddon, ...props }: Combobox$1.Chips.Props & {
35
+ startAddon?: React$1.ReactNode;
36
+ }) => React$1.JSX.Element;
37
+ declare const ComboboxChip: ({ children, ...props }: Combobox$1.Chip.Props) => React$1.JSX.Element;
38
+ declare const useComboboxFilter: typeof Combobox$1.useFilter;
39
+ //#endregion
40
+ export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, useComboboxFilter };
@@ -0,0 +1,208 @@
1
+ "use client";
2
+ import { cn } from "../lib/utils.js";
3
+ import { OVERLAY_LAYER_CLASS_NAMES } from "../lib/overlay-layer.js";
4
+ import { containedHandler } from "../hooks/use-contained-handler.js";
5
+ import { Input } from "./input.js";
6
+ import { ScrollArea } from "./scroll-area.js";
7
+ import { ChevronsUpDownIcon, XIcon } from "lucide-react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import * as React$1 from "react";
10
+ import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
11
+ //#region src/components/combobox.tsx
12
+ const ComboboxContext = React$1.createContext({
13
+ chipsRef: null,
14
+ multiple: false
15
+ });
16
+ const Combobox = (props) => {
17
+ const chipsRef = React$1.useRef(null);
18
+ const contextValue = React$1.useMemo(() => ({
19
+ chipsRef,
20
+ multiple: !!props.multiple
21
+ }), [chipsRef, props.multiple]);
22
+ return /* @__PURE__ */ jsx(ComboboxContext, {
23
+ value: contextValue,
24
+ children: /* @__PURE__ */ jsx(Combobox$1.Root, { ...props })
25
+ });
26
+ };
27
+ const ComboboxChipsInput = ({ className, size, ...props }) => {
28
+ const sizeValue = size ?? "default";
29
+ return /* @__PURE__ */ jsx(Combobox$1.Input, {
30
+ className: cn("min-w-12 flex-1 text-base outline-none sm:text-sm [[data-slot=combobox-chip]+&]:ps-0.5", sizeValue === "sm" ? "ps-1.5" : "ps-2", className),
31
+ "data-size": typeof sizeValue === "string" ? sizeValue : void 0,
32
+ "data-slot": "combobox-chips-input",
33
+ size: typeof sizeValue === "number" ? sizeValue : void 0,
34
+ ...props
35
+ });
36
+ };
37
+ const ComboboxInput = ({ className, showTrigger = true, showClear = false, startAddon, size, ...props }) => {
38
+ const sizeValue = size ?? "default";
39
+ return /* @__PURE__ */ jsxs(Combobox$1.InputGroup, {
40
+ className: "text-foreground relative w-full not-has-[>*.w-full]:w-fit has-disabled:opacity-64",
41
+ children: [
42
+ Boolean(startAddon) && /* @__PURE__ */ jsx("div", {
43
+ "aria-hidden": "true",
44
+ className: "pointer-events-none absolute inset-y-0 start-px z-10 flex items-center ps-[calc(--spacing(3)-1px)] opacity-80 has-[+[data-size=sm]]:ps-[calc(--spacing(2.5)-1px)] [&_svg]:-mx-0.5 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
45
+ "data-slot": "combobox-start-addon",
46
+ children: startAddon
47
+ }),
48
+ /* @__PURE__ */ jsx(Combobox$1.Input, {
49
+ className: cn(Boolean(startAddon) && "*:data-[slot=combobox-input]:ps-[calc(--spacing(8.5)-1px)] data-[size=sm]:*:data-[slot=combobox-input]:ps-[calc(--spacing(7.5)-1px)] sm:*:data-[slot=combobox-input]:ps-[calc(--spacing(8)-1px)] sm:data-[size=sm]:*:data-[slot=combobox-input]:ps-[calc(--spacing(7)-1px)]", sizeValue === "sm" ? "has-[+[data-slot=combobox-trigger],+[data-slot=combobox-clear]]:*:data-[slot=combobox-input]:pe-6.5" : "has-[+[data-slot=combobox-trigger],+[data-slot=combobox-clear]]:*:data-[slot=combobox-input]:pe-7", className),
50
+ "data-slot": "combobox-input",
51
+ render: /* @__PURE__ */ jsx(Input, {
52
+ className: "has-disabled:opacity-100",
53
+ nativeInput: true,
54
+ size: sizeValue
55
+ }),
56
+ ...props
57
+ }),
58
+ showTrigger && /* @__PURE__ */ jsx(ComboboxTrigger, {
59
+ className: cn("absolute top-1/2 inline-flex size-8 shrink-0 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 transition-opacity outline-none hover:opacity-100 has-[+[data-slot=combobox-clear]]:hidden sm:size-7 pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4", sizeValue === "sm" ? "end-0" : "end-0.5"),
60
+ children: /* @__PURE__ */ jsx(ChevronsUpDownIcon, {})
61
+ }),
62
+ showClear && /* @__PURE__ */ jsx(ComboboxClear, {
63
+ className: cn("absolute top-1/2 inline-flex size-8 shrink-0 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 transition-opacity outline-none hover:opacity-100 has-[+[data-slot=combobox-clear]]:hidden sm:size-7 pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4", sizeValue === "sm" ? "end-0" : "end-0.5"),
64
+ children: /* @__PURE__ */ jsx(XIcon, {})
65
+ })
66
+ ]
67
+ });
68
+ };
69
+ const ComboboxTrigger = ({ className, ...props }) => /* @__PURE__ */ jsx(Combobox$1.Trigger, {
70
+ className,
71
+ "data-slot": "combobox-trigger",
72
+ ...props
73
+ });
74
+ const ComboboxPopup = ({ className, children, side = "bottom", sideOffset = 4, alignOffset, align = "start", ...props }) => {
75
+ const { chipsRef } = React$1.use(ComboboxContext);
76
+ return /* @__PURE__ */ jsx(Combobox$1.Portal, { children: /* @__PURE__ */ jsx(Combobox$1.Positioner, {
77
+ align,
78
+ alignOffset,
79
+ anchor: chipsRef,
80
+ className: cn(OVERLAY_LAYER_CLASS_NAMES.popup, "select-none"),
81
+ "data-slot": "combobox-positioner",
82
+ side,
83
+ sideOffset,
84
+ children: /* @__PURE__ */ jsx("span", {
85
+ className: cn("bg-popover relative flex max-h-full max-w-(--available-width) min-w-(--anchor-width) origin-(--transform-origin) rounded-lg border shadow-lg/5 transition-[scale,opacity] not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", className),
86
+ children: /* @__PURE__ */ jsx(Combobox$1.Popup, {
87
+ className: "text-foreground flex max-h-[min(var(--available-height),23rem)] flex-1 flex-col",
88
+ "data-slot": "combobox-popup",
89
+ ...props,
90
+ children
91
+ })
92
+ })
93
+ }) });
94
+ };
95
+ const ComboboxItem = ({ className, children, ...props }) => /* @__PURE__ */ jsxs(Combobox$1.Item, {
96
+ className: cn("data-highlighted:bg-accent data-highlighted:text-accent-foreground grid min-h-8 cursor-default grid-cols-[1rem_1fr] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] data-disabled:pointer-events-none data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4", className),
97
+ "data-slot": "combobox-item",
98
+ ...props,
99
+ children: [/* @__PURE__ */ jsx(Combobox$1.ItemIndicator, {
100
+ className: "col-start-1",
101
+ children: /* @__PURE__ */ jsxs("svg", {
102
+ fill: "none",
103
+ height: "24",
104
+ stroke: "currentColor",
105
+ strokeLinecap: "round",
106
+ strokeLinejoin: "round",
107
+ strokeWidth: "2",
108
+ viewBox: "0 0 24 24",
109
+ width: "24",
110
+ xmlns: "http://www.w3.org/2000/svg",
111
+ children: [/* @__PURE__ */ jsx("title", { children: "Selected" }), /* @__PURE__ */ jsx("path", { d: "M5.252 12.7 10.2 18.63 18.748 5.37" })]
112
+ })
113
+ }), /* @__PURE__ */ jsx("div", {
114
+ className: "col-start-2",
115
+ children
116
+ })]
117
+ });
118
+ const ComboboxSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx(Combobox$1.Separator, {
119
+ className: cn("bg-border mx-2 my-1 h-px last:hidden", className),
120
+ "data-slot": "combobox-separator",
121
+ ...props
122
+ });
123
+ const ComboboxGroup = ({ className, ...props }) => /* @__PURE__ */ jsx(Combobox$1.Group, {
124
+ className: cn("[[role=group]+&]:mt-1.5", className),
125
+ "data-slot": "combobox-group",
126
+ ...props
127
+ });
128
+ const ComboboxGroupLabel = ({ className, ...props }) => /* @__PURE__ */ jsx(Combobox$1.GroupLabel, {
129
+ className: cn("text-muted-foreground px-2 py-1.5 text-xs font-medium", className),
130
+ "data-slot": "combobox-group-label",
131
+ ...props
132
+ });
133
+ const ComboboxEmpty = ({ className, ...props }) => /* @__PURE__ */ jsx(Combobox$1.Empty, {
134
+ className: cn("text-muted-foreground text-center text-base not-empty:p-2 sm:text-sm", className),
135
+ "data-slot": "combobox-empty",
136
+ ...props
137
+ });
138
+ const ComboboxRow = ({ className, ...props }) => /* @__PURE__ */ jsx(Combobox$1.Row, {
139
+ className,
140
+ "data-slot": "combobox-row",
141
+ ...props
142
+ });
143
+ const ComboboxValue = ({ ...props }) => /* @__PURE__ */ jsx(Combobox$1.Value, {
144
+ "data-slot": "combobox-value",
145
+ ...props
146
+ });
147
+ const ComboboxList = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollArea, {
148
+ scrollbarGutter: true,
149
+ scrollFade: true,
150
+ children: /* @__PURE__ */ jsx(Combobox$1.List, {
151
+ className: cn("not-empty:scroll-py-1 not-empty:px-1 not-empty:py-1 in-data-has-overflow-y:pe-3", className),
152
+ "data-slot": "combobox-list",
153
+ ...props
154
+ })
155
+ });
156
+ const ComboboxClear = ({ className, ...props }) => /* @__PURE__ */ jsx(Combobox$1.Clear, {
157
+ className,
158
+ "data-slot": "combobox-clear",
159
+ ...props
160
+ });
161
+ const ComboboxStatus = ({ className, ...props }) => /* @__PURE__ */ jsx(Combobox$1.Status, {
162
+ className: cn("text-muted-foreground px-3 py-2 text-xs font-medium empty:m-0 empty:p-0", className),
163
+ "data-slot": "combobox-status",
164
+ ...props
165
+ });
166
+ const ComboboxCollection = (props) => /* @__PURE__ */ jsx(Combobox$1.Collection, {
167
+ "data-slot": "combobox-collection",
168
+ ...props
169
+ });
170
+ const ComboboxChips = ({ className, children, startAddon, ...props }) => {
171
+ const { chipsRef } = React$1.use(ComboboxContext);
172
+ return /* @__PURE__ */ jsxs(Combobox$1.Chips, {
173
+ className: cn("border-input bg-background ring-ring/24 focus-within:border-ring has-autofill:bg-foreground/4 has-aria-invalid:border-destructive/36 focus-within:has-aria-invalid:border-destructive/64 focus-within:has-aria-invalid:ring-destructive/16 dark:not-has-disabled:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 relative inline-flex min-h-9 w-full flex-wrap gap-1 rounded-lg border p-[calc(--spacing(1)-1px)] text-base shadow-xs/5 transition-shadow outline-none *:min-h-7 not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-focus-within:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-within:ring-[3px] has-disabled:pointer-events-none has-disabled:opacity-64 has-data-[size=lg]:min-h-10 has-data-[size=lg]:*:min-h-8 has-data-[size=sm]:min-h-8 has-data-[size=sm]:*:min-h-6 has-[:disabled,:focus-within,[aria-invalid]]:shadow-none sm:min-h-8 sm:text-sm sm:*:min-h-6 sm:has-data-[size=lg]:min-h-9 sm:has-data-[size=lg]:*:min-h-7 sm:has-data-[size=sm]:min-h-7 sm:has-data-[size=sm]:*:min-h-5 dark:not-has-disabled:not-focus-within:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]", className),
174
+ "data-slot": "combobox-chips",
175
+ onMouseDown: containedHandler(chipsRef, (e) => {
176
+ const { target } = e;
177
+ if (!(target instanceof Element)) return;
178
+ if (target.closest("[data-slot=\"combobox-chip\"]") || !chipsRef?.current) return;
179
+ e.preventDefault();
180
+ const input = chipsRef.current.querySelector("input");
181
+ if (input && !chipsRef.current.querySelector("input:focus")) input.focus();
182
+ }),
183
+ ref: chipsRef,
184
+ ...props,
185
+ children: [Boolean(startAddon) && /* @__PURE__ */ jsx("div", {
186
+ "aria-hidden": "true",
187
+ className: "flex shrink-0 items-center ps-2 opacity-80 has-[+[data-slot=combobox-chip]]:pe-2 has-[~[data-size=sm]]:ps-1.5 has-[~[data-size=sm]]:has-[+[data-slot=combobox-chip]]:pe-1.5 [&_svg]:pointer-events-none [&_svg]:-ms-0.5 [&_svg]:-me-1.5 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
188
+ "data-slot": "combobox-start-addon",
189
+ children: startAddon
190
+ }), children]
191
+ });
192
+ };
193
+ const ComboboxChip = ({ children, ...props }) => /* @__PURE__ */ jsxs(Combobox$1.Chip, {
194
+ className: "bg-accent text-accent-foreground flex items-center rounded-[calc(var(--radius-md)-1px)] ps-2 text-sm font-medium outline-none sm:text-xs/(--text-xs--line-height) [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5",
195
+ "data-slot": "combobox-chip",
196
+ ...props,
197
+ children: [children, /* @__PURE__ */ jsx(ComboboxChipRemove, {})]
198
+ });
199
+ const ComboboxChipRemove = (props) => /* @__PURE__ */ jsx(Combobox$1.ChipRemove, {
200
+ "aria-label": "Remove",
201
+ className: "h-full shrink-0 cursor-pointer px-1.5 opacity-80 hover:opacity-100 [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5",
202
+ "data-slot": "combobox-chip-remove",
203
+ ...props,
204
+ children: /* @__PURE__ */ jsx(XIcon, {})
205
+ });
206
+ const useComboboxFilter = Combobox$1.useFilter;
207
+ //#endregion
208
+ export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, useComboboxFilter };
@@ -0,0 +1,34 @@
1
+ import { DialogContent as DialogPopup } from "./dialog.js";
2
+ import * as React$1 from "react";
3
+ import { Autocomplete } from "@base-ui/react/autocomplete";
4
+ import { Dialog } from "@base-ui/react/dialog";
5
+ //#region src/components/command.d.ts
6
+ type CommandProps<ItemValue> = Omit<Autocomplete.Root.Props<ItemValue>, "items"> & {
7
+ items?: readonly ItemValue[] | undefined;
8
+ };
9
+ declare const Command: <ItemValue>({ autoHighlight, keepHighlight, open, ...props }: CommandProps<ItemValue>) => React$1.JSX.Element;
10
+ declare const CommandDialog: typeof Dialog.Root;
11
+ declare const CommandDialogTrigger: (props: Dialog.Trigger.Props) => React$1.JSX.Element;
12
+ declare const CommandDialogPopup: ({ className, showCloseButton, ...props }: React$1.ComponentProps<typeof DialogPopup>) => React$1.JSX.Element;
13
+ type CommandInputProps = Omit<Autocomplete.Input.Props, "size"> & {
14
+ size?: "sm" | "default" | "lg" | number;
15
+ wrapperClassName?: string;
16
+ ref?: React$1.Ref<HTMLInputElement>;
17
+ };
18
+ declare const CommandInput: ({ className, size, wrapperClassName, dir, onChange, ...props }: CommandInputProps) => React$1.JSX.Element;
19
+ declare const CommandPanel: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
20
+ declare const CommandEmpty: ({ className, ...props }: Autocomplete.Empty.Props) => React$1.JSX.Element;
21
+ declare const CommandList: ({ className, ...props }: Autocomplete.List.Props & {
22
+ ref?: React$1.Ref<HTMLDivElement>;
23
+ }) => React$1.JSX.Element;
24
+ declare const CommandGroup: ({ className, ...props }: Autocomplete.Group.Props) => React$1.JSX.Element;
25
+ declare const CommandGroupLabel: ({ className, ...props }: Autocomplete.GroupLabel.Props) => React$1.JSX.Element;
26
+ declare const CommandCollection: (props: Autocomplete.Collection.Props) => React$1.JSX.Element;
27
+ declare const CommandItem: ({ className, ...props }: Autocomplete.Item.Props & {
28
+ ref?: React$1.Ref<HTMLDivElement>;
29
+ }) => React$1.JSX.Element;
30
+ declare const CommandSeparator: ({ className, ...props }: Autocomplete.Separator.Props) => React$1.JSX.Element;
31
+ declare const CommandShortcut: ({ className, ...props }: React$1.ComponentProps<"span">) => React$1.JSX.Element;
32
+ declare const CommandFooter: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
33
+ //#endregion
34
+ export { Command, CommandCollection, CommandDialog, CommandDialogPopup, CommandDialogTrigger, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut };