@constructive-io/ui 0.1.1 → 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 (57) hide show
  1. package/dist/components/alert-dialog.js.map +1 -1
  2. package/dist/components/autocomplete.js +11 -3
  3. package/dist/components/autocomplete.js.map +1 -1
  4. package/dist/components/avatar.js.map +1 -1
  5. package/dist/components/breadcrumb.js.map +1 -1
  6. package/dist/components/combobox.d.ts +1 -1
  7. package/dist/components/combobox.js +49 -13
  8. package/dist/components/combobox.js.map +1 -1
  9. package/dist/components/command.d.ts +16 -35
  10. package/dist/components/command.js +72 -508
  11. package/dist/components/command.js.map +1 -1
  12. package/dist/components/dialog.js.map +1 -1
  13. package/dist/components/drawer.js +1 -1
  14. package/dist/components/drawer.js.map +1 -1
  15. package/dist/components/dropdown-menu.js.map +1 -1
  16. package/dist/components/form-control.js.map +1 -1
  17. package/dist/components/form.js.map +1 -1
  18. package/dist/components/input-group.js +2 -2
  19. package/dist/components/input-group.js.map +1 -1
  20. package/dist/components/input.js +1 -1
  21. package/dist/components/input.js.map +1 -1
  22. package/dist/components/json-input.js.map +1 -1
  23. package/dist/components/multi-select.js.map +1 -1
  24. package/dist/components/pagination.js.map +1 -1
  25. package/dist/components/popover.js.map +1 -1
  26. package/dist/components/portal.js.map +1 -1
  27. package/dist/components/record-picker.js +1 -1
  28. package/dist/components/record-picker.js.map +1 -1
  29. package/dist/components/resizable.js.map +1 -1
  30. package/dist/components/responsive-diagram.js +6 -4
  31. package/dist/components/responsive-diagram.js.map +1 -1
  32. package/dist/components/select.d.ts +2 -2
  33. package/dist/components/select.js +3 -3
  34. package/dist/components/select.js.map +1 -1
  35. package/dist/components/sheet.js.map +1 -1
  36. package/dist/components/sidebar.js +1 -1
  37. package/dist/components/sidebar.js.map +1 -1
  38. package/dist/components/stack/index.d.ts +11 -0
  39. package/dist/components/stack/index.js +33 -6
  40. package/dist/components/stack/index.js.map +1 -1
  41. package/dist/components/stepper.js.map +1 -1
  42. package/dist/components/table.js.map +1 -1
  43. package/dist/components/tabs.js.map +1 -1
  44. package/dist/components/tags.d.ts +1 -3
  45. package/dist/components/tags.js +107 -388
  46. package/dist/components/tags.js.map +1 -1
  47. package/dist/components/textarea.js +1 -1
  48. package/dist/components/textarea.js.map +1 -1
  49. package/dist/components/tooltip.js.map +1 -1
  50. package/dist/index.cjs +348 -363
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.cts +22 -24
  53. package/dist/index.d.ts +22 -24
  54. package/dist/index.js +235 -250
  55. package/dist/index.js.map +1 -1
  56. package/package.json +2 -6
  57. package/src/styles/globals.css +1 -1
@@ -1,16 +1,13 @@
1
1
  "use client";
2
- import { Dialog } from '@base-ui/react/dialog';
3
- import { SearchIcon, ChevronsUpDownIcon, XIcon } from 'lucide-react';
4
- import * as React2 from 'react';
5
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { Command as Command$1 } from 'cmdk';
3
+ import { SearchIcon } from 'lucide-react';
4
+ import * as React from 'react';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
  import { clsx } from 'clsx';
7
7
  import { twMerge } from 'tailwind-merge';
8
- import { Autocomplete as Autocomplete$1 } from '@base-ui/react/autocomplete';
9
- import { Input as Input$1 } from '@base-ui/react/input';
10
- import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
11
8
 
12
9
  var PORTAL_ROOT_ID = "portal-root";
13
- var PortalContext = React2.createContext({
10
+ var PortalContext = React.createContext({
14
11
  layer: "base",
15
12
  depth: 0,
16
13
  floatingPortalStrategy: "root",
@@ -21,9 +18,9 @@ function ModalPortalScope({
21
18
  floatingPortalStrategy = "nested",
22
19
  floatingZIndex = "default"
23
20
  }) {
24
- const parentContext = React2.useContext(PortalContext);
21
+ const parentContext = React.useContext(PortalContext);
25
22
  const depth = parentContext.layer === "modal" ? parentContext.depth + 1 : 0;
26
- const value = React2.useMemo(
23
+ const value = React.useMemo(
27
24
  () => ({
28
25
  layer: "modal",
29
26
  depth,
@@ -35,528 +32,86 @@ function ModalPortalScope({
35
32
  return /* @__PURE__ */ jsx(PortalContext.Provider, { value, children });
36
33
  }
37
34
  function useRootPortalContainer() {
38
- const [container, setContainer] = React2.useState(null);
39
- React2.useLayoutEffect(() => {
35
+ const [container, setContainer] = React.useState(null);
36
+ React.useLayoutEffect(() => {
40
37
  const el = document.getElementById(PORTAL_ROOT_ID);
41
38
  setContainer(el);
42
39
  }, []);
43
40
  return container;
44
41
  }
45
- function composeRefs(...refs) {
46
- return (node) => {
47
- refs.forEach((ref) => {
48
- if (typeof ref === "function") {
49
- ref(node);
50
- } else if (ref != null) {
51
- ref.current = node;
52
- }
53
- });
54
- };
55
- }
56
- function mergeProps(slotProps, childProps) {
57
- const overrideProps = { ...childProps };
58
- for (const propName in childProps) {
59
- if (propName === "ref") continue;
60
- const slotPropValue = slotProps[propName];
61
- const childPropValue = childProps[propName];
62
- if (/^on[A-Z]/.test(propName) && typeof slotPropValue === "function" && typeof childPropValue === "function") {
63
- overrideProps[propName] = (...args) => {
64
- childPropValue(...args);
65
- slotPropValue(...args);
66
- };
67
- } else if (propName === "className" && typeof slotPropValue === "string" && typeof childPropValue === "string") {
68
- overrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();
69
- } else if (propName === "style" && typeof slotPropValue === "object" && typeof childPropValue === "object") {
70
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
71
- }
72
- }
73
- return { ...slotProps, ...overrideProps };
74
- }
75
- function mergePropsWithRef(parentProps, childElement) {
76
- const childProps = childElement.props;
77
- const parentRef = parentProps.ref;
78
- const childRef = childProps.ref;
79
- const mergedProps = mergeProps(parentProps, childProps);
80
- if (parentRef || childRef) {
81
- mergedProps.ref = composeRefs(parentRef, childRef);
82
- }
83
- return mergedProps;
84
- }
85
- function isSlottable(child) {
86
- return React2.isValidElement(child);
87
- }
88
- var Slot = React2.forwardRef((props, forwardedRef) => {
89
- const { children, ...slotProps } = props;
90
- if (isSlottable(children)) {
91
- const childProps = children.props;
92
- const childRef = childProps.ref;
93
- return React2.cloneElement(children, {
94
- ...mergeProps(slotProps, childProps),
95
- ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
96
- });
97
- }
98
- if (React2.Children.count(children) > 1) {
99
- const childrenArray = React2.Children.toArray(children);
100
- const slottableChild = childrenArray.find(
101
- (child) => React2.isValidElement(child) && child.type === Slottable
102
- );
103
- if (slottableChild) {
104
- const newElement = slottableChild.props.children;
105
- if (isSlottable(newElement)) {
106
- const newElementProps = newElement.props;
107
- const newChildren = childrenArray.map((child) => {
108
- if (child === slottableChild) {
109
- return React2.Children.count(newElementProps.children) > 1 ? React2.Children.only(null) : newElementProps.children;
110
- }
111
- return child;
112
- });
113
- const childRef = newElementProps.ref;
114
- return React2.cloneElement(newElement, {
115
- ...mergeProps(slotProps, newElementProps),
116
- ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
117
- children: newChildren
118
- });
119
- }
120
- }
121
- }
122
- return /* @__PURE__ */ jsx(Fragment, { children });
123
- });
124
- Slot.displayName = "Slot";
125
- function Slottable({ children }) {
126
- return /* @__PURE__ */ jsx(Fragment, { children });
127
- }
128
42
  function cn(...inputs) {
129
43
  return twMerge(clsx(inputs));
130
44
  }
131
- function Input({ className, size = "default", unstyled = false, ...props }) {
132
- const isFloating = props.placeholder === " ";
133
- return /* @__PURE__ */ jsx(
134
- "span",
135
- {
136
- className: cn(
137
- !unstyled && [
138
- // Base layout
139
- "relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base shadow-xs transition-shadow",
140
- // Inner shadow highlight
141
- "before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)]",
142
- "not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)]",
143
- // Focus state - use primary brand color
144
- "has-focus-visible:border-primary/60 has-focus-visible:ring-[3px] has-focus-visible:ring-primary/35",
145
- // Invalid state
146
- "has-aria-invalid:border-destructive/36",
147
- "has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16",
148
- // Disabled state
149
- "has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none",
150
- // Dark mode
151
- "sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border",
152
- "dark:has-aria-invalid:ring-destructive/24",
153
- "dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)]"
154
- ],
155
- className
156
- ) || void 0,
157
- "data-size": size,
158
- "data-slot": "input-control",
159
- children: /* @__PURE__ */ jsx(
160
- Input$1,
161
- {
162
- className: cn(
163
- "w-full min-w-0 rounded-[inherit] bg-transparent px-[calc(--spacing(3)-1px)] outline-none",
164
- isFloating ? "h-11 pt-4.5 pb-1 leading-none placeholder:text-transparent sm:h-10" : "h-8.5 leading-8.5 placeholder:text-muted-foreground/72 sm:h-7.5 sm:leading-7.5",
165
- size === "sm" && (isFloating ? "h-10 px-[calc(--spacing(2.5)-1px)] pt-4 pb-1 sm:h-9" : "h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5"),
166
- size === "lg" && (isFloating ? "h-12 pt-5 pb-1.5 sm:h-11" : "h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5"),
167
- props.type === "search" && "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",
168
- props.type === "file" && "text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm"
169
- ),
170
- "data-slot": "input",
171
- size: typeof size === "number" ? size : void 0,
172
- ...props
173
- }
174
- )
175
- }
176
- );
177
- }
178
- var ScrollArea = React2.forwardRef(
179
- ({ className, children, scrollFade = false, scrollbarGutter = false, ...props }, ref) => {
180
- return /* @__PURE__ */ jsxs(
181
- ScrollArea$1.Root,
182
- {
183
- ref,
184
- className: cn("size-full min-h-0", className),
185
- ...props,
186
- children: [
187
- /* @__PURE__ */ jsx(
188
- ScrollArea$1.Viewport,
189
- {
190
- className: cn(
191
- "h-full overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
192
- scrollFade && "mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]",
193
- scrollbarGutter && "data-has-overflow-y:pe-2.5 data-has-overflow-x:pb-2.5"
194
- ),
195
- "data-slot": "scroll-area-viewport",
196
- children
197
- }
198
- ),
199
- /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" }),
200
- /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" }),
201
- /* @__PURE__ */ jsx(ScrollArea$1.Corner, { "data-slot": "scroll-area-corner" })
202
- ]
203
- }
204
- );
205
- }
206
- );
207
- ScrollArea.displayName = "ScrollArea";
208
- function ScrollBar({
209
- className,
210
- orientation = "vertical",
211
- ...props
212
- }) {
213
- return /* @__PURE__ */ jsx(
214
- ScrollArea$1.Scrollbar,
215
- {
216
- className: cn(
217
- "m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100",
218
- className
219
- ),
220
- "data-slot": "scroll-area-scrollbar",
221
- orientation,
222
- ...props,
223
- children: /* @__PURE__ */ jsx(
224
- ScrollArea$1.Thumb,
225
- {
226
- className: "relative flex-1 rounded-full bg-foreground/20",
227
- "data-slot": "scroll-area-thumb"
228
- }
229
- )
230
- }
231
- );
232
- }
233
- var Autocomplete = Autocomplete$1.Root;
234
- function AutocompleteInput({
235
- className,
236
- showTrigger = false,
237
- showClear = false,
238
- startAddon,
239
- size = "default",
240
- ...props
241
- }) {
242
- const sizeValue = size;
243
- return /* @__PURE__ */ jsxs("div", { className: "relative not-has-[>*.w-full]:w-fit w-full", children: [
244
- startAddon && /* @__PURE__ */ jsx(
245
- "div",
246
- {
247
- "aria-hidden": "true",
248
- className: "[&_svg]:-mx-0.5 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:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
249
- "data-slot": "autocomplete-start-addon",
250
- children: startAddon
251
- }
252
- ),
253
- /* @__PURE__ */ jsx(
254
- Autocomplete$1.Input,
255
- {
256
- className: cn(
257
- startAddon && "data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7.5)-1px)] *:data-[slot=autocomplete-input]:ps-[calc(--spacing(8.5)-1px)] sm:data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7)-1px)] sm:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(8)-1px)]",
258
- sizeValue === "sm" ? "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-6.5" : "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-7",
259
- className
260
- ),
261
- "data-slot": "autocomplete-input",
262
- render: /* @__PURE__ */ jsx(Input, { size: sizeValue }),
263
- ...props
264
- }
265
- ),
266
- showTrigger && /* @__PURE__ */ jsx(
267
- AutocompleteTrigger,
268
- {
269
- className: cn(
270
- "-translate-y-1/2 absolute top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=autocomplete-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
271
- sizeValue === "sm" ? "end-0" : "end-0.5"
272
- ),
273
- children: /* @__PURE__ */ jsx(ChevronsUpDownIcon, {})
274
- }
275
- ),
276
- showClear && /* @__PURE__ */ jsx(
277
- AutocompleteClear,
278
- {
279
- className: cn(
280
- "-translate-y-1/2 absolute top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=autocomplete-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
281
- sizeValue === "sm" ? "end-0" : "end-0.5"
282
- ),
283
- children: /* @__PURE__ */ jsx(XIcon, {})
284
- }
285
- )
286
- ] });
287
- }
288
- function AutocompleteItem({
45
+ function CommandDialog({
289
46
  className,
290
47
  children,
291
48
  ...props
292
49
  }) {
50
+ const container = useRootPortalContainer();
293
51
  return /* @__PURE__ */ jsx(
294
- Autocomplete$1.Item,
295
- {
296
- className: cn(
297
- "flex min-h-8 cursor-default select-none items-center rounded-sm px-2 py-1 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm",
298
- className
299
- ),
300
- "data-slot": "autocomplete-item",
301
- ...props,
302
- children
303
- }
304
- );
305
- }
306
- function AutocompleteSeparator({
307
- className,
308
- ...props
309
- }) {
310
- return /* @__PURE__ */ jsx(
311
- Autocomplete$1.Separator,
312
- {
313
- className: cn("mx-2 my-1 h-px bg-border last:hidden", className),
314
- "data-slot": "autocomplete-separator",
315
- ...props
316
- }
317
- );
318
- }
319
- function AutocompleteGroup({
320
- className,
321
- ...props
322
- }) {
323
- return /* @__PURE__ */ jsx(
324
- Autocomplete$1.Group,
325
- {
326
- className: cn("[[role=group]+&]:mt-1.5", className),
327
- "data-slot": "autocomplete-group",
328
- ...props
329
- }
330
- );
331
- }
332
- function AutocompleteGroupLabel({
333
- className,
334
- ...props
335
- }) {
336
- return /* @__PURE__ */ jsx(
337
- Autocomplete$1.GroupLabel,
338
- {
339
- className: cn(
340
- "px-2 py-1.5 font-medium text-muted-foreground text-xs",
341
- className
342
- ),
343
- "data-slot": "autocomplete-group-label",
344
- ...props
345
- }
346
- );
347
- }
348
- function AutocompleteEmpty({
349
- className,
350
- ...props
351
- }) {
352
- return /* @__PURE__ */ jsx(
353
- Autocomplete$1.Empty,
52
+ Command$1.Dialog,
354
53
  {
355
- className: cn(
356
- "not-empty:p-2 text-center text-base text-muted-foreground sm:text-sm",
357
- className
54
+ container: container ?? void 0,
55
+ overlayClassName: cn(
56
+ "fixed inset-0 z-[var(--z-layer-toast)] bg-black/32 backdrop-blur-sm transition-all duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
358
57
  ),
359
- "data-slot": "autocomplete-empty",
360
- ...props
361
- }
362
- );
363
- }
364
- function AutocompleteList({
365
- className,
366
- ...props
367
- }) {
368
- return /* @__PURE__ */ jsx(ScrollArea, { scrollbarGutter: true, scrollFade: true, children: /* @__PURE__ */ jsx(
369
- Autocomplete$1.List,
370
- {
371
- className: cn(
372
- "not-empty:scroll-py-1 not-empty:p-1 in-data-has-overflow-y:pe-3",
58
+ contentClassName: cn(
59
+ "fixed left-1/2 top-[max(--spacing(4),4vh)] sm:top-[10vh] z-[var(--z-layer-toast)] -translate-x-1/2 flex max-h-100 min-h-0 w-full min-w-0 max-w-xl flex-col rounded-2xl border bg-popover bg-clip-padding text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-98 data-[state=open]:zoom-in-98 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:bg-muted/50 before:shadow-[0_1px_--theme(--color-black/4%)] **:data-[slot=scroll-area-viewport]:data-has-overflow-y:pe-1 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]",
373
60
  className
374
61
  ),
375
- "data-slot": "autocomplete-list",
376
- ...props
377
- }
378
- ) });
379
- }
380
- function AutocompleteClear({
381
- className,
382
- ...props
383
- }) {
384
- return /* @__PURE__ */ jsx(
385
- Autocomplete$1.Clear,
386
- {
387
- className: cn(
388
- "-translate-y-1/2 absolute end-0.5 top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-[color,background-color,box-shadow,opacity] pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
389
- className
390
- ),
391
- "data-slot": "autocomplete-clear",
62
+ loop: true,
392
63
  ...props,
393
- children: /* @__PURE__ */ jsx(XIcon, {})
64
+ children: /* @__PURE__ */ jsx(ModalPortalScope, { children })
394
65
  }
395
66
  );
396
67
  }
397
- function AutocompleteCollection({
398
- ...props
399
- }) {
400
- return /* @__PURE__ */ jsx(
401
- Autocomplete$1.Collection,
402
- {
403
- "data-slot": "autocomplete-collection",
404
- ...props
405
- }
406
- );
407
- }
408
- function AutocompleteTrigger({
409
- className,
410
- ...props
411
- }) {
412
- return /* @__PURE__ */ jsx(
413
- Autocomplete$1.Trigger,
414
- {
415
- className,
416
- "data-slot": "autocomplete-trigger",
417
- ...props
418
- }
419
- );
420
- }
421
- var CommandInputContext = React2.createContext({
422
- inputRef: null
423
- });
424
- var CommandDialog = Dialog.Root;
425
- function CommandDialogPortal({ ...props }) {
426
- const container = useRootPortalContainer();
427
- const style = {
428
- ...props.style ?? {},
429
- ["--z-layer-floating"]: "var(--z-layer-floating-elevated)"
430
- };
431
- return /* @__PURE__ */ jsx(Dialog.Portal, { container, ...props, style });
432
- }
433
- function CommandDialogTrigger({
434
- asChild,
435
- nativeButton,
68
+ function CommandDialogPopup({
436
69
  children,
437
- ...props
438
- }) {
439
- if (asChild && React2.isValidElement(children)) {
440
- return /* @__PURE__ */ jsx(
441
- Dialog.Trigger,
442
- {
443
- "data-slot": "command-dialog-trigger",
444
- nativeButton: nativeButton ?? true,
445
- ...props,
446
- render: (triggerProps) => {
447
- const { nativeButton: _, ...rest } = triggerProps;
448
- return React2.cloneElement(
449
- children,
450
- mergePropsWithRef(rest, children)
451
- );
452
- }
453
- }
454
- );
455
- }
456
- return /* @__PURE__ */ jsx(
457
- Dialog.Trigger,
458
- {
459
- "data-slot": "command-dialog-trigger",
460
- nativeButton,
461
- ...props,
462
- children
463
- }
464
- );
465
- }
466
- function CommandDialogBackdrop({
467
70
  className,
468
71
  ...props
469
72
  }) {
470
- return /* @__PURE__ */ jsx(
471
- Dialog.Backdrop,
472
- {
473
- className: cn(
474
- "fixed inset-0 z-[var(--z-layer-toast)] bg-black/32 backdrop-blur-sm transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
475
- className
476
- ),
477
- "data-slot": "command-dialog-backdrop",
478
- ...props
479
- }
480
- );
73
+ return /* @__PURE__ */ jsx("div", { "data-slot": "command-dialog-popup", className, ...props, children });
481
74
  }
482
- function CommandDialogViewport({
75
+ function Command({
483
76
  className,
484
77
  ...props
485
78
  }) {
486
79
  return /* @__PURE__ */ jsx(
487
- Dialog.Viewport,
80
+ Command$1,
488
81
  {
489
82
  className: cn(
490
- "fixed inset-0 z-[var(--z-layer-toast)] flex flex-col items-center px-4 py-[max(--spacing(4),4vh)] sm:py-[10vh]",
83
+ "flex h-full w-full flex-col overflow-hidden rounded-2xl",
491
84
  className
492
85
  ),
493
- "data-slot": "command-dialog-viewport",
494
- ...props
495
- }
496
- );
497
- }
498
- function CommandDialogPopup({
499
- className,
500
- children,
501
- ...props
502
- }) {
503
- const inputRef = React2.useRef(null);
504
- return /* @__PURE__ */ jsxs(CommandDialogPortal, { children: [
505
- /* @__PURE__ */ jsx(CommandDialogBackdrop, {}),
506
- /* @__PURE__ */ jsx(CommandDialogViewport, { children: /* @__PURE__ */ jsx(
507
- Dialog.Popup,
508
- {
509
- className: cn(
510
- "-translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-100 min-h-0 w-full min-w-0 max-w-xl scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:bg-muted/50 before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 **:data-[slot=scroll-area-viewport]:data-has-overflow-y:pe-1 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]",
511
- className
512
- ),
513
- "data-slot": "command-dialog-popup",
514
- initialFocus: inputRef,
515
- ...props,
516
- children: /* @__PURE__ */ jsx(ModalPortalScope, { children: /* @__PURE__ */ jsx(CommandInputContext.Provider, { value: { inputRef }, children }) })
517
- }
518
- ) })
519
- ] });
520
- }
521
- function Command({
522
- autoHighlight = "always",
523
- keepHighlight = true,
524
- open = true,
525
- ...props
526
- }) {
527
- const AutocompleteAny = Autocomplete;
528
- return /* @__PURE__ */ jsx(
529
- AutocompleteAny,
530
- {
531
- autoHighlight,
532
- keepHighlight,
533
- open,
86
+ "data-slot": "command",
534
87
  ...props
535
88
  }
536
89
  );
537
90
  }
538
91
  function CommandInput({
539
92
  className,
540
- placeholder = void 0,
541
- value,
542
- onValueChange,
93
+ placeholder,
543
94
  ...props
544
95
  }) {
545
- const { inputRef } = React2.useContext(CommandInputContext);
546
- return /* @__PURE__ */ jsx("div", { className: "px-2.5 py-1.5", children: /* @__PURE__ */ jsx(
547
- AutocompleteInput,
96
+ return /* @__PURE__ */ jsx("div", { className: "px-2.5 py-1.5", "data-slot": "command-input-wrapper", children: /* @__PURE__ */ jsxs(
97
+ "div",
548
98
  {
549
99
  className: cn(
550
- "border-transparent! bg-transparent! shadow-none before:hidden has-focus-visible:ring-0",
100
+ "flex items-center gap-2 rounded-lg px-3 text-base",
551
101
  className
552
102
  ),
553
- placeholder,
554
- ref: inputRef,
555
- size: "lg",
556
- startAddon: /* @__PURE__ */ jsx(SearchIcon, {}),
557
- value,
558
- onChange: onValueChange ? (e) => onValueChange(e.target.value) : void 0,
559
- ...props
103
+ children: [
104
+ /* @__PURE__ */ jsx(SearchIcon, { className: "size-4 shrink-0 text-muted-foreground" }),
105
+ /* @__PURE__ */ jsx(
106
+ Command$1.Input,
107
+ {
108
+ className: "flex h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
109
+ placeholder,
110
+ "data-slot": "command-input",
111
+ ...props
112
+ }
113
+ )
114
+ ]
560
115
  }
561
116
  ) });
562
117
  }
@@ -565,9 +120,9 @@ function CommandList({
565
120
  ...props
566
121
  }) {
567
122
  return /* @__PURE__ */ jsx(
568
- AutocompleteList,
123
+ Command$1.List,
569
124
  {
570
- className: cn("not-empty:scroll-py-2 not-empty:p-2", className),
125
+ className: cn("not-empty:scroll-py-2 not-empty:p-2 max-h-[300px] overflow-y-auto overflow-x-hidden", className),
571
126
  "data-slot": "command-list",
572
127
  ...props
573
128
  }
@@ -578,7 +133,7 @@ function CommandEmpty({
578
133
  ...props
579
134
  }) {
580
135
  return /* @__PURE__ */ jsx(
581
- AutocompleteEmpty,
136
+ Command$1.Empty,
582
137
  {
583
138
  className: cn("not-empty:py-6", className),
584
139
  "data-slot": "command-empty",
@@ -590,7 +145,11 @@ function CommandPanel({ className, ...props }) {
590
145
  return /* @__PURE__ */ jsx(
591
146
  "div",
592
147
  {
593
- className: "-mx-px relative min-h-0 rounded-t-xl border bg-popover bg-clip-padding shadow-xs [clip-path:inset(0_1px)] before:pointer-events-none before:absolute before:inset-0 before:rounded-t-[calc(var(--radius-xl)-1px)] **:data-[slot=scroll-area-scrollbar]:mt-2 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]",
148
+ className: cn(
149
+ "-mx-px relative min-h-0 rounded-t-xl border bg-popover bg-clip-padding shadow-xs [clip-path:inset(0_1px)] before:pointer-events-none before:absolute before:inset-0 before:rounded-t-[calc(var(--radius-xl)-1px)] **:data-[slot=scroll-area-scrollbar]:mt-2 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]",
150
+ className
151
+ ),
152
+ "data-slot": "command-panel",
594
153
  ...props
595
154
  }
596
155
  );
@@ -601,16 +160,17 @@ function CommandGroup({
601
160
  children,
602
161
  ...props
603
162
  }) {
604
- return /* @__PURE__ */ jsxs(
605
- AutocompleteGroup,
163
+ return /* @__PURE__ */ jsx(
164
+ Command$1.Group,
606
165
  {
607
- className,
166
+ className: cn(
167
+ "overflow-hidden text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
168
+ className
169
+ ),
170
+ heading,
608
171
  "data-slot": "command-group",
609
172
  ...props,
610
- children: [
611
- heading && /* @__PURE__ */ jsx(CommandGroupLabel, { children: heading }),
612
- children
613
- ]
173
+ children
614
174
  }
615
175
  );
616
176
  }
@@ -619,27 +179,31 @@ function CommandGroupLabel({
619
179
  ...props
620
180
  }) {
621
181
  return /* @__PURE__ */ jsx(
622
- AutocompleteGroupLabel,
182
+ "div",
623
183
  {
624
- className,
184
+ className: cn(
185
+ "px-2 py-1.5 text-xs font-medium text-muted-foreground",
186
+ className
187
+ ),
625
188
  "data-slot": "command-group-label",
626
189
  ...props
627
190
  }
628
191
  );
629
192
  }
630
- function CommandCollection({
631
- ...props
632
- }) {
633
- return /* @__PURE__ */ jsx(AutocompleteCollection, { "data-slot": "command-collection", ...props });
193
+ function CommandCollection({ children }) {
194
+ return /* @__PURE__ */ jsx(Fragment, { children });
634
195
  }
635
196
  function CommandItem({
636
197
  className,
637
198
  ...props
638
199
  }) {
639
200
  return /* @__PURE__ */ jsx(
640
- AutocompleteItem,
201
+ Command$1.Item,
641
202
  {
642
- className: cn("py-1.5", className),
203
+ className: cn(
204
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",
205
+ className
206
+ ),
643
207
  "data-slot": "command-item",
644
208
  ...props
645
209
  }
@@ -650,9 +214,9 @@ function CommandSeparator({
650
214
  ...props
651
215
  }) {
652
216
  return /* @__PURE__ */ jsx(
653
- AutocompleteSeparator,
217
+ Command$1.Separator,
654
218
  {
655
- className: cn("my-2", className),
219
+ className: cn("-mx-1 my-2 h-px bg-border", className),
656
220
  "data-slot": "command-separator",
657
221
  ...props
658
222
  }
@@ -685,6 +249,6 @@ function CommandFooter({ className, ...props }) {
685
249
  );
686
250
  }
687
251
 
688
- export { Command, CommandCollection, CommandDialog, CommandDialogPopup, CommandDialogTrigger, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut };
252
+ export { Command, CommandCollection, CommandDialog, CommandDialogPopup, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut };
689
253
  //# sourceMappingURL=command.js.map
690
254
  //# sourceMappingURL=command.js.map