@fluid-app/ui-primitives 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4,7 +4,7 @@ var clsx = require('clsx');
4
4
  var tailwindMerge = require('tailwind-merge');
5
5
  var zod = require('@hookform/resolvers/zod');
6
6
  var reactHookForm = require('react-hook-form');
7
- var React8 = require('react');
7
+ var React15 = require('react');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var AccordionPrimitive = require('@radix-ui/react-accordion');
10
10
  var lucideReact = require('lucide-react');
@@ -14,14 +14,15 @@ var reactSlot = require('@radix-ui/react-slot');
14
14
  var reactDayPicker = require('react-day-picker');
15
15
  var RechartsPrimitive = require('recharts');
16
16
  var CollapsiblePrimitive = require('@radix-ui/react-collapsible');
17
+ var PopoverPrimitive = require('@radix-ui/react-popover');
17
18
  var SheetPrimitive = require('@radix-ui/react-dialog');
18
19
  var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
19
- var TogglePrimitive = require('@radix-ui/react-toggle');
20
20
  var LabelPrimitive = require('@radix-ui/react-label');
21
- var PopoverPrimitive = require('@radix-ui/react-popover');
21
+ var TogglePrimitive = require('@radix-ui/react-toggle');
22
22
  var SelectPrimitive = require('@radix-ui/react-select');
23
23
  var SeparatorPrimitive = require('@radix-ui/react-separator');
24
24
  var SliderPrimitive = require('@radix-ui/react-slider');
25
+ var sonner = require('sonner');
25
26
  var SwitchPrimitive = require('@radix-ui/react-switch');
26
27
  var TabsPrimitive = require('@radix-ui/react-tabs');
27
28
  var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
@@ -45,15 +46,15 @@ function _interopNamespace(e) {
45
46
  return Object.freeze(n);
46
47
  }
47
48
 
48
- var React8__namespace = /*#__PURE__*/_interopNamespace(React8);
49
+ var React15__namespace = /*#__PURE__*/_interopNamespace(React15);
49
50
  var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
50
51
  var RechartsPrimitive__namespace = /*#__PURE__*/_interopNamespace(RechartsPrimitive);
51
52
  var CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespace(CollapsiblePrimitive);
53
+ var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
52
54
  var SheetPrimitive__namespace = /*#__PURE__*/_interopNamespace(SheetPrimitive);
53
55
  var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
54
- var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
55
56
  var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
56
- var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
57
+ var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
57
58
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
58
59
  var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
59
60
  var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
@@ -72,7 +73,7 @@ function useZodForm(schema, options) {
72
73
  const resolver = zodResolverFn(schema);
73
74
  return reactHookForm.useForm({ ...options, resolver });
74
75
  }
75
- var PortalContainerContext = React8.createContext(
76
+ var PortalContainerContext = React15.createContext(
76
77
  void 0
77
78
  );
78
79
  function PortalContainerProvider({
@@ -82,7 +83,7 @@ function PortalContainerProvider({
82
83
  return /* @__PURE__ */ jsxRuntime.jsx(PortalContainerContext.Provider, { value: container ?? void 0, children });
83
84
  }
84
85
  function usePortalContainer() {
85
- return React8.useContext(PortalContainerContext);
86
+ return React15.useContext(PortalContainerContext);
86
87
  }
87
88
  function Accordion({
88
89
  className,
@@ -213,6 +214,219 @@ function AlertDescription({
213
214
  }
214
215
  );
215
216
  }
217
+ var buttonVariants = classVarianceAuthority.cva(
218
+ "inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
219
+ {
220
+ variants: {
221
+ variant: {
222
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
223
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
224
+ outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
225
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
226
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
227
+ link: "text-primary underline-offset-4 hover:underline"
228
+ },
229
+ size: {
230
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
231
+ sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
232
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
233
+ xl: "h-11 rounded-md px-8 has-[>svg]:px-5",
234
+ icon: "size-9",
235
+ "icon-xs": "size-6",
236
+ "icon-sm": "size-8",
237
+ "icon-lg": "size-10"
238
+ }
239
+ },
240
+ defaultVariants: {
241
+ variant: "default",
242
+ size: "default"
243
+ }
244
+ }
245
+ );
246
+ function Button({
247
+ className,
248
+ variant,
249
+ size,
250
+ asChild = false,
251
+ ...props
252
+ }) {
253
+ const Comp = asChild ? reactSlot.Slot : "button";
254
+ return /* @__PURE__ */ jsxRuntime.jsx(
255
+ Comp,
256
+ {
257
+ "data-slot": "button",
258
+ className: cn(buttonVariants({ variant, size, className })),
259
+ ...props
260
+ }
261
+ );
262
+ }
263
+ function AlertDialog({
264
+ ...props
265
+ }) {
266
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.AlertDialog.Root, { "data-slot": "alert-dialog", ...props });
267
+ }
268
+ function AlertDialogTrigger({
269
+ ...props
270
+ }) {
271
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.AlertDialog.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
272
+ }
273
+ function AlertDialogPortal({
274
+ ...props
275
+ }) {
276
+ const portalContainer = usePortalContainer();
277
+ return /* @__PURE__ */ jsxRuntime.jsx(
278
+ radixUi.AlertDialog.Portal,
279
+ {
280
+ "data-slot": "alert-dialog-portal",
281
+ container: portalContainer,
282
+ ...props
283
+ }
284
+ );
285
+ }
286
+ function AlertDialogOverlay({
287
+ className,
288
+ ...props
289
+ }) {
290
+ return /* @__PURE__ */ jsxRuntime.jsx(
291
+ radixUi.AlertDialog.Overlay,
292
+ {
293
+ "data-slot": "alert-dialog-overlay",
294
+ className: cn(
295
+ "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
296
+ className
297
+ ),
298
+ ...props
299
+ }
300
+ );
301
+ }
302
+ function AlertDialogContent({
303
+ className,
304
+ size = "default",
305
+ ...props
306
+ }) {
307
+ return /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal, { children: [
308
+ /* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay, {}),
309
+ /* @__PURE__ */ jsxRuntime.jsx(
310
+ radixUi.AlertDialog.Content,
311
+ {
312
+ "data-slot": "alert-dialog-content",
313
+ "data-size": size,
314
+ className: cn(
315
+ "group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",
316
+ className
317
+ ),
318
+ ...props
319
+ }
320
+ )
321
+ ] });
322
+ }
323
+ function AlertDialogHeader({
324
+ className,
325
+ ...props
326
+ }) {
327
+ return /* @__PURE__ */ jsxRuntime.jsx(
328
+ "div",
329
+ {
330
+ "data-slot": "alert-dialog-header",
331
+ className: cn(
332
+ "grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
333
+ className
334
+ ),
335
+ ...props
336
+ }
337
+ );
338
+ }
339
+ function AlertDialogFooter({
340
+ className,
341
+ ...props
342
+ }) {
343
+ return /* @__PURE__ */ jsxRuntime.jsx(
344
+ "div",
345
+ {
346
+ "data-slot": "alert-dialog-footer",
347
+ className: cn(
348
+ "flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
349
+ className
350
+ ),
351
+ ...props
352
+ }
353
+ );
354
+ }
355
+ function AlertDialogTitle({
356
+ className,
357
+ ...props
358
+ }) {
359
+ return /* @__PURE__ */ jsxRuntime.jsx(
360
+ radixUi.AlertDialog.Title,
361
+ {
362
+ "data-slot": "alert-dialog-title",
363
+ className: cn(
364
+ "text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
365
+ className
366
+ ),
367
+ ...props
368
+ }
369
+ );
370
+ }
371
+ function AlertDialogDescription({
372
+ className,
373
+ ...props
374
+ }) {
375
+ return /* @__PURE__ */ jsxRuntime.jsx(
376
+ radixUi.AlertDialog.Description,
377
+ {
378
+ "data-slot": "alert-dialog-description",
379
+ className: cn("text-sm text-muted-foreground", className),
380
+ ...props
381
+ }
382
+ );
383
+ }
384
+ function AlertDialogMedia({
385
+ className,
386
+ ...props
387
+ }) {
388
+ return /* @__PURE__ */ jsxRuntime.jsx(
389
+ "div",
390
+ {
391
+ "data-slot": "alert-dialog-media",
392
+ className: cn(
393
+ "mb-2 inline-flex size-16 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",
394
+ className
395
+ ),
396
+ ...props
397
+ }
398
+ );
399
+ }
400
+ function AlertDialogAction({
401
+ className,
402
+ variant = "default",
403
+ size = "default",
404
+ ...props
405
+ }) {
406
+ return /* @__PURE__ */ jsxRuntime.jsx(Button, { variant, size, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
407
+ radixUi.AlertDialog.Action,
408
+ {
409
+ "data-slot": "alert-dialog-action",
410
+ className: cn(className),
411
+ ...props
412
+ }
413
+ ) });
414
+ }
415
+ function AlertDialogCancel({
416
+ className,
417
+ variant = "outline",
418
+ size = "default",
419
+ ...props
420
+ }) {
421
+ return /* @__PURE__ */ jsxRuntime.jsx(Button, { variant, size, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
422
+ radixUi.AlertDialog.Cancel,
423
+ {
424
+ "data-slot": "alert-dialog-cancel",
425
+ className: cn(className),
426
+ ...props
427
+ }
428
+ ) });
429
+ }
216
430
  function Avatar({
217
431
  className,
218
432
  size = "default",
@@ -340,52 +554,6 @@ function Badge({
340
554
  }
341
555
  );
342
556
  }
343
- var buttonVariants = classVarianceAuthority.cva(
344
- "inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
345
- {
346
- variants: {
347
- variant: {
348
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
349
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
350
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
351
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
352
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
353
- link: "text-primary underline-offset-4 hover:underline"
354
- },
355
- size: {
356
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
357
- sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
358
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
359
- xl: "h-11 rounded-md px-8 has-[>svg]:px-5",
360
- icon: "size-9",
361
- "icon-xs": "size-6",
362
- "icon-sm": "size-8",
363
- "icon-lg": "size-10"
364
- }
365
- },
366
- defaultVariants: {
367
- variant: "default",
368
- size: "default"
369
- }
370
- }
371
- );
372
- function Button({
373
- className,
374
- variant,
375
- size,
376
- asChild = false,
377
- ...props
378
- }) {
379
- const Comp = asChild ? reactSlot.Slot : "button";
380
- return /* @__PURE__ */ jsxRuntime.jsx(
381
- Comp,
382
- {
383
- "data-slot": "button",
384
- className: cn(buttonVariants({ variant, size, className })),
385
- ...props
386
- }
387
- );
388
- }
389
557
  function Calendar({
390
558
  className,
391
559
  classNames,
@@ -528,9 +696,9 @@ function CardFooter({ className, ...props }) {
528
696
  );
529
697
  }
530
698
  var THEMES = { light: "", dark: ".dark" };
531
- var ChartContext = React8__namespace.createContext(null);
699
+ var ChartContext = React15__namespace.createContext(null);
532
700
  function useChart() {
533
- const context = React8__namespace.useContext(ChartContext);
701
+ const context = React15__namespace.useContext(ChartContext);
534
702
  if (!context) {
535
703
  throw new Error("useChart must be used within a <ChartContainer />");
536
704
  }
@@ -543,7 +711,7 @@ function ChartContainer({
543
711
  config,
544
712
  ...props
545
713
  }) {
546
- const uniqueId = React8__namespace.useId();
714
+ const uniqueId = React15__namespace.useId();
547
715
  const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
548
716
  return /* @__PURE__ */ jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
549
717
  "div",
@@ -604,7 +772,7 @@ function ChartTooltipContent({
604
772
  labelKey
605
773
  }) {
606
774
  const { config } = useChart();
607
- const tooltipLabel = React8__namespace.useMemo(() => {
775
+ const tooltipLabel = React15__namespace.useMemo(() => {
608
776
  if (hideLabel || !payload?.length) {
609
777
  return null;
610
778
  }
@@ -782,6 +950,123 @@ function CollapsibleContent2({
782
950
  }
783
951
  );
784
952
  }
953
+ function Popover({
954
+ ...props
955
+ }) {
956
+ return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Root, { "data-slot": "popover", ...props });
957
+ }
958
+ function PopoverTrigger({
959
+ ...props
960
+ }) {
961
+ return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { "data-slot": "popover-trigger", ...props });
962
+ }
963
+ function PopoverContent({
964
+ className,
965
+ align = "center",
966
+ sideOffset = 4,
967
+ ...props
968
+ }) {
969
+ const portalContainer = usePortalContainer();
970
+ return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { container: portalContainer, children: /* @__PURE__ */ jsxRuntime.jsx(
971
+ PopoverPrimitive__namespace.Content,
972
+ {
973
+ "data-slot": "popover-content",
974
+ align,
975
+ sideOffset,
976
+ className: cn(
977
+ "cn-popover-content z-50 w-72 origin-(--radix-popover-content-transform-origin) outline-hidden",
978
+ className
979
+ ),
980
+ ...props
981
+ }
982
+ ) });
983
+ }
984
+ function PopoverAnchor({
985
+ ...props
986
+ }) {
987
+ return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Anchor, { "data-slot": "popover-anchor", ...props });
988
+ }
989
+ function PopoverHeader({ className, ...props }) {
990
+ return /* @__PURE__ */ jsxRuntime.jsx(
991
+ "div",
992
+ {
993
+ "data-slot": "popover-header",
994
+ className: cn("cn-popover-header", className),
995
+ ...props
996
+ }
997
+ );
998
+ }
999
+ function PopoverTitle({ className, ...props }) {
1000
+ return /* @__PURE__ */ jsxRuntime.jsx(
1001
+ "div",
1002
+ {
1003
+ "data-slot": "popover-title",
1004
+ className: cn("cn-popover-title", className),
1005
+ ...props
1006
+ }
1007
+ );
1008
+ }
1009
+ function PopoverDescription({
1010
+ className,
1011
+ ...props
1012
+ }) {
1013
+ return /* @__PURE__ */ jsxRuntime.jsx(
1014
+ "p",
1015
+ {
1016
+ "data-slot": "popover-description",
1017
+ className: cn("cn-popover-description", className),
1018
+ ...props
1019
+ }
1020
+ );
1021
+ }
1022
+ var defaultFormatDate = (date) => new Intl.DateTimeFormat(void 0, {
1023
+ month: "long",
1024
+ day: "numeric",
1025
+ year: "numeric"
1026
+ }).format(date);
1027
+ function DatePicker({
1028
+ value,
1029
+ onChange,
1030
+ placeholder = "Pick a date",
1031
+ formatDate = defaultFormatDate,
1032
+ disabled,
1033
+ className,
1034
+ calendarProps
1035
+ }) {
1036
+ const [open, setOpen] = React15__namespace.useState(false);
1037
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
1038
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
1039
+ Button,
1040
+ {
1041
+ "data-slot": "date-picker",
1042
+ variant: "outline",
1043
+ disabled,
1044
+ className: cn(
1045
+ "w-full justify-start text-left font-normal",
1046
+ !value && "text-muted-foreground",
1047
+ className
1048
+ ),
1049
+ children: [
1050
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "mr-2 size-4" }),
1051
+ value ? formatDate(value) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: placeholder })
1052
+ ]
1053
+ }
1054
+ ) }),
1055
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
1056
+ Calendar,
1057
+ {
1058
+ mode: "single",
1059
+ selected: value,
1060
+ onSelect: (date) => {
1061
+ onChange?.(date);
1062
+ setOpen(false);
1063
+ },
1064
+ initialFocus: true,
1065
+ ...calendarProps
1066
+ }
1067
+ ) })
1068
+ ] });
1069
+ }
785
1070
  function Dialog({
786
1071
  ...props
787
1072
  }) {
@@ -1120,6 +1405,125 @@ function DropdownMenuSubContent({
1120
1405
  }
1121
1406
  );
1122
1407
  }
1408
+ function Label2({
1409
+ className,
1410
+ ...props
1411
+ }) {
1412
+ return /* @__PURE__ */ jsxRuntime.jsx(
1413
+ LabelPrimitive__namespace.Root,
1414
+ {
1415
+ "data-slot": "label",
1416
+ className: cn(
1417
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
1418
+ className
1419
+ ),
1420
+ ...props
1421
+ }
1422
+ );
1423
+ }
1424
+ var Form = reactHookForm.FormProvider;
1425
+ var FormFieldContext = React15__namespace.createContext(
1426
+ {}
1427
+ );
1428
+ var FormField = ({
1429
+ ...props
1430
+ }) => {
1431
+ return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
1432
+ };
1433
+ var useFormField = () => {
1434
+ const fieldContext = React15__namespace.useContext(FormFieldContext);
1435
+ const itemContext = React15__namespace.useContext(FormItemContext);
1436
+ const { getFieldState } = reactHookForm.useFormContext();
1437
+ const formState = reactHookForm.useFormState({ name: fieldContext.name });
1438
+ const fieldState = getFieldState(fieldContext.name, formState);
1439
+ if (!fieldContext.name) {
1440
+ throw new Error("useFormField should be used within <FormField>");
1441
+ }
1442
+ const { id } = itemContext;
1443
+ if (!id) {
1444
+ throw new Error("useFormField should be used within <FormItem>");
1445
+ }
1446
+ return {
1447
+ id,
1448
+ name: fieldContext.name,
1449
+ formItemId: `${id}-form-item`,
1450
+ formDescriptionId: `${id}-form-item-description`,
1451
+ formMessageId: `${id}-form-item-message`,
1452
+ ...fieldState
1453
+ };
1454
+ };
1455
+ var FormItemContext = React15__namespace.createContext(
1456
+ {}
1457
+ );
1458
+ function FormItem({ className, ...props }) {
1459
+ const id = React15__namespace.useId();
1460
+ return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx(
1461
+ "div",
1462
+ {
1463
+ "data-slot": "form-item",
1464
+ className: cn("grid gap-2", className),
1465
+ ...props
1466
+ }
1467
+ ) });
1468
+ }
1469
+ function FormLabel({
1470
+ className,
1471
+ ...props
1472
+ }) {
1473
+ const { error, formItemId } = useFormField();
1474
+ return /* @__PURE__ */ jsxRuntime.jsx(
1475
+ Label2,
1476
+ {
1477
+ "data-slot": "form-label",
1478
+ "data-error": !!error,
1479
+ className: cn("data-[error=true]:text-destructive", className),
1480
+ htmlFor: formItemId,
1481
+ ...props
1482
+ }
1483
+ );
1484
+ }
1485
+ function FormControl({ ...props }) {
1486
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
1487
+ return /* @__PURE__ */ jsxRuntime.jsx(
1488
+ radixUi.Slot.Root,
1489
+ {
1490
+ "data-slot": "form-control",
1491
+ id: formItemId,
1492
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
1493
+ "aria-invalid": !!error,
1494
+ ...props
1495
+ }
1496
+ );
1497
+ }
1498
+ function FormDescription({ className, ...props }) {
1499
+ const { formDescriptionId } = useFormField();
1500
+ return /* @__PURE__ */ jsxRuntime.jsx(
1501
+ "p",
1502
+ {
1503
+ "data-slot": "form-description",
1504
+ id: formDescriptionId,
1505
+ className: cn("text-sm text-muted-foreground", className),
1506
+ ...props
1507
+ }
1508
+ );
1509
+ }
1510
+ function FormMessage({ className, ...props }) {
1511
+ const { error, formMessageId } = useFormField();
1512
+ const body = error ? String(error?.message ?? "") : props.children;
1513
+ if (!body) {
1514
+ return null;
1515
+ }
1516
+ return /* @__PURE__ */ jsxRuntime.jsx(
1517
+ "p",
1518
+ {
1519
+ "data-slot": "form-message",
1520
+ id: formMessageId,
1521
+ className: cn("text-sm text-destructive", className),
1522
+ ...props,
1523
+ children: body
1524
+ }
1525
+ );
1526
+ }
1123
1527
  function IconButton({
1124
1528
  icon: Icon2,
1125
1529
  className,
@@ -1207,88 +1611,107 @@ function Input({ className, type, ...props }) {
1207
1611
  }
1208
1612
  );
1209
1613
  }
1210
- function Label2({
1211
- className,
1212
- ...props
1213
- }) {
1614
+ function Pagination({ className, ...props }) {
1214
1615
  return /* @__PURE__ */ jsxRuntime.jsx(
1215
- LabelPrimitive__namespace.Root,
1616
+ "nav",
1216
1617
  {
1217
- "data-slot": "label",
1218
- className: cn(
1219
- "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
1220
- className
1221
- ),
1618
+ "aria-label": "pagination",
1619
+ "data-slot": "pagination",
1620
+ className: cn("mx-auto flex w-full justify-center", className),
1222
1621
  ...props
1223
1622
  }
1224
1623
  );
1225
1624
  }
1226
- function Popover({
1625
+ function PaginationContent({
1626
+ className,
1227
1627
  ...props
1228
1628
  }) {
1229
- return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Root, { "data-slot": "popover", ...props });
1629
+ return /* @__PURE__ */ jsxRuntime.jsx(
1630
+ "ul",
1631
+ {
1632
+ "data-slot": "pagination-content",
1633
+ className: cn("flex flex-row items-center gap-1", className),
1634
+ ...props
1635
+ }
1636
+ );
1230
1637
  }
1231
- function PopoverTrigger({
1232
- ...props
1233
- }) {
1234
- return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Trigger, { "data-slot": "popover-trigger", ...props });
1638
+ function PaginationItem({ ...props }) {
1639
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { "data-slot": "pagination-item", ...props });
1235
1640
  }
1236
- function PopoverContent({
1641
+ function PaginationLink({
1237
1642
  className,
1238
- align = "center",
1239
- sideOffset = 4,
1643
+ isActive,
1644
+ size = "icon",
1240
1645
  ...props
1241
1646
  }) {
1242
- const portalContainer = usePortalContainer();
1243
- return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { container: portalContainer, children: /* @__PURE__ */ jsxRuntime.jsx(
1244
- PopoverPrimitive__namespace.Content,
1647
+ return /* @__PURE__ */ jsxRuntime.jsx(
1648
+ "a",
1245
1649
  {
1246
- "data-slot": "popover-content",
1247
- align,
1248
- sideOffset,
1650
+ "aria-current": isActive ? "page" : void 0,
1651
+ "data-slot": "pagination-link",
1652
+ "data-active": isActive,
1249
1653
  className: cn(
1250
- "cn-popover-content z-50 w-72 origin-(--radix-popover-content-transform-origin) outline-hidden",
1654
+ buttonVariants({
1655
+ variant: isActive ? "outline" : "ghost",
1656
+ size
1657
+ }),
1251
1658
  className
1252
1659
  ),
1253
1660
  ...props
1254
1661
  }
1255
- ) });
1662
+ );
1256
1663
  }
1257
- function PopoverAnchor({
1664
+ function PaginationPrevious({
1665
+ className,
1258
1666
  ...props
1259
1667
  }) {
1260
- return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Anchor, { "data-slot": "popover-anchor", ...props });
1261
- }
1262
- function PopoverHeader({ className, ...props }) {
1263
- return /* @__PURE__ */ jsxRuntime.jsx(
1264
- "div",
1668
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1669
+ PaginationLink,
1265
1670
  {
1266
- "data-slot": "popover-header",
1267
- className: cn("cn-popover-header", className),
1268
- ...props
1671
+ "aria-label": "Go to previous page",
1672
+ size: "default",
1673
+ className: cn("gap-1 px-2.5 sm:pl-2.5", className),
1674
+ ...props,
1675
+ children: [
1676
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, {}),
1677
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:block", children: "Previous" })
1678
+ ]
1269
1679
  }
1270
1680
  );
1271
1681
  }
1272
- function PopoverTitle({ className, ...props }) {
1273
- return /* @__PURE__ */ jsxRuntime.jsx(
1274
- "div",
1682
+ function PaginationNext({
1683
+ className,
1684
+ ...props
1685
+ }) {
1686
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1687
+ PaginationLink,
1275
1688
  {
1276
- "data-slot": "popover-title",
1277
- className: cn("cn-popover-title", className),
1278
- ...props
1689
+ "aria-label": "Go to next page",
1690
+ size: "default",
1691
+ className: cn("gap-1 px-2.5 sm:pr-2.5", className),
1692
+ ...props,
1693
+ children: [
1694
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:block", children: "Next" }),
1695
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, {})
1696
+ ]
1279
1697
  }
1280
1698
  );
1281
1699
  }
1282
- function PopoverDescription({
1700
+ function PaginationEllipsis({
1283
1701
  className,
1284
1702
  ...props
1285
1703
  }) {
1286
- return /* @__PURE__ */ jsxRuntime.jsx(
1287
- "p",
1704
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1705
+ "span",
1288
1706
  {
1289
- "data-slot": "popover-description",
1290
- className: cn("cn-popover-description", className),
1291
- ...props
1707
+ "aria-hidden": true,
1708
+ "data-slot": "pagination-ellipsis",
1709
+ className: cn("flex size-9 items-center justify-center", className),
1710
+ ...props,
1711
+ children: [
1712
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontalIcon, { className: "size-4" }),
1713
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "More pages" })
1714
+ ]
1292
1715
  }
1293
1716
  );
1294
1717
  }
@@ -1485,7 +1908,7 @@ function SelectScrollDownButton({
1485
1908
  }
1486
1909
  );
1487
1910
  }
1488
- var Separator3 = React8__namespace.forwardRef(
1911
+ var Separator3 = React15__namespace.forwardRef(
1489
1912
  ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1490
1913
  SeparatorPrimitive__namespace.Root,
1491
1914
  {
@@ -1502,34 +1925,6 @@ var Separator3 = React8__namespace.forwardRef(
1502
1925
  )
1503
1926
  );
1504
1927
  Separator3.displayName = SeparatorPrimitive__namespace.Root.displayName;
1505
- function Skeleton({
1506
- className,
1507
- ...props
1508
- }) {
1509
- return /* @__PURE__ */ jsxRuntime.jsx(
1510
- "div",
1511
- {
1512
- className: cn("animate-pulse rounded-md bg-muted", className),
1513
- ...props
1514
- }
1515
- );
1516
- }
1517
- var Slider = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
1518
- SliderPrimitive__namespace.Root,
1519
- {
1520
- ref,
1521
- className: cn(
1522
- "relative flex w-full touch-none items-center select-none",
1523
- className
1524
- ),
1525
- ...props,
1526
- children: [
1527
- /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-gray-200", children: /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Range, { className: "absolute h-full bg-primary" }) }),
1528
- /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Thumb, { className: "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50" })
1529
- ]
1530
- }
1531
- ));
1532
- Slider.displayName = SliderPrimitive__namespace.Root.displayName;
1533
1928
  var Sheet = SheetPrimitive__namespace.Root;
1534
1929
  var SheetTrigger = SheetPrimitive__namespace.Trigger;
1535
1930
  var SheetClose = SheetPrimitive__namespace.Close;
@@ -1537,7 +1932,7 @@ function SheetPortal(props) {
1537
1932
  const portalContainer = usePortalContainer();
1538
1933
  return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Portal, { container: portalContainer, ...props });
1539
1934
  }
1540
- var SheetOverlay = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1935
+ var SheetOverlay = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1541
1936
  SheetPrimitive__namespace.Overlay,
1542
1937
  {
1543
1938
  className: cn(
@@ -1565,7 +1960,7 @@ var sheetVariants = classVarianceAuthority.cva(
1565
1960
  }
1566
1961
  }
1567
1962
  );
1568
- var SheetContent = React8__namespace.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(SheetPortal, { children: [
1963
+ var SheetContent = React15__namespace.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(SheetPortal, { children: [
1569
1964
  /* @__PURE__ */ jsxRuntime.jsx(SheetOverlay, {}),
1570
1965
  /* @__PURE__ */ jsxRuntime.jsxs(
1571
1966
  SheetPrimitive__namespace.Content,
@@ -1608,7 +2003,7 @@ function SheetFooter({ className, ...props }) {
1608
2003
  }
1609
2004
  );
1610
2005
  }
1611
- var SheetTitle = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2006
+ var SheetTitle = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1612
2007
  SheetPrimitive__namespace.Title,
1613
2008
  {
1614
2009
  ref,
@@ -1617,7 +2012,7 @@ var SheetTitle = React8__namespace.forwardRef(({ className, ...props }, ref) =>
1617
2012
  }
1618
2013
  ));
1619
2014
  SheetTitle.displayName = SheetPrimitive__namespace.Title.displayName;
1620
- var SheetDescription = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2015
+ var SheetDescription = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1621
2016
  SheetPrimitive__namespace.Description,
1622
2017
  {
1623
2018
  ref,
@@ -1626,6 +2021,69 @@ var SheetDescription = React8__namespace.forwardRef(({ className, ...props }, re
1626
2021
  }
1627
2022
  ));
1628
2023
  SheetDescription.displayName = SheetPrimitive__namespace.Description.displayName;
2024
+ function Skeleton({
2025
+ className,
2026
+ ...props
2027
+ }) {
2028
+ return /* @__PURE__ */ jsxRuntime.jsx(
2029
+ "div",
2030
+ {
2031
+ className: cn("animate-pulse rounded-md bg-muted", className),
2032
+ ...props
2033
+ }
2034
+ );
2035
+ }
2036
+ var Slider = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
2037
+ SliderPrimitive__namespace.Root,
2038
+ {
2039
+ ref,
2040
+ className: cn(
2041
+ "relative flex w-full touch-none items-center select-none",
2042
+ className
2043
+ ),
2044
+ ...props,
2045
+ children: [
2046
+ /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-gray-200", children: /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Range, { className: "absolute h-full bg-primary" }) }),
2047
+ /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Thumb, { className: "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50" })
2048
+ ]
2049
+ }
2050
+ ));
2051
+ Slider.displayName = SliderPrimitive__namespace.Root.displayName;
2052
+ function Toaster({ theme = "system", ...props }) {
2053
+ return /* @__PURE__ */ jsxRuntime.jsx(
2054
+ sonner.Toaster,
2055
+ {
2056
+ theme,
2057
+ className: "toaster group",
2058
+ icons: {
2059
+ success: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleCheckIcon, { className: "size-4" }),
2060
+ info: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "size-4" }),
2061
+ warning: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TriangleAlertIcon, { className: "size-4" }),
2062
+ error: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.OctagonXIcon, { className: "size-4" }),
2063
+ loading: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2Icon, { className: "size-4 animate-spin" })
2064
+ },
2065
+ style: {
2066
+ "--normal-bg": "var(--popover)",
2067
+ "--normal-text": "var(--popover-foreground)",
2068
+ "--normal-border": "var(--border)",
2069
+ "--success-bg": "var(--popover)",
2070
+ "--success-text": "var(--popover-foreground)",
2071
+ "--success-border": "var(--border)",
2072
+ "--error-bg": "var(--popover)",
2073
+ "--error-text": "var(--popover-foreground)",
2074
+ "--error-border": "var(--border)",
2075
+ "--warning-bg": "var(--popover)",
2076
+ "--warning-text": "var(--popover-foreground)",
2077
+ "--warning-border": "var(--border)",
2078
+ "--info-bg": "var(--popover)",
2079
+ "--info-text": "var(--popover-foreground)",
2080
+ "--info-border": "var(--border)",
2081
+ "--border-radius": "var(--radius)"
2082
+ },
2083
+ ...props
2084
+ }
2085
+ );
2086
+ }
1629
2087
  function SpinnerWithText({
1630
2088
  text = "Loading...",
1631
2089
  variant = "inline",
@@ -1678,7 +2136,7 @@ function SpinnerWithText({
1678
2136
  }
1679
2137
  );
1680
2138
  }
1681
- var Switch = React8__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2139
+ var Switch = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1682
2140
  SwitchPrimitive__namespace.Root,
1683
2141
  {
1684
2142
  className: cn(
@@ -1871,7 +2329,7 @@ function Textarea({ className, ...props }) {
1871
2329
  }
1872
2330
  );
1873
2331
  }
1874
- var ToggleGroupContext = React8__namespace.createContext({
2332
+ var ToggleGroupContext = React15__namespace.createContext({
1875
2333
  size: "default",
1876
2334
  variant: "default",
1877
2335
  spacing: 0,
@@ -1917,7 +2375,7 @@ function ToggleGroupItem({
1917
2375
  size = "default",
1918
2376
  ...props
1919
2377
  }) {
1920
- const context = React8__namespace.useContext(ToggleGroupContext);
2378
+ const context = React15__namespace.useContext(ToggleGroupContext);
1921
2379
  return /* @__PURE__ */ jsxRuntime.jsx(
1922
2380
  ToggleGroupPrimitive__namespace.Item,
1923
2381
  {
@@ -1968,6 +2426,18 @@ exports.AccordionItem = AccordionItem;
1968
2426
  exports.AccordionTrigger = AccordionTrigger;
1969
2427
  exports.Alert = Alert;
1970
2428
  exports.AlertDescription = AlertDescription;
2429
+ exports.AlertDialog = AlertDialog;
2430
+ exports.AlertDialogAction = AlertDialogAction;
2431
+ exports.AlertDialogCancel = AlertDialogCancel;
2432
+ exports.AlertDialogContent = AlertDialogContent;
2433
+ exports.AlertDialogDescription = AlertDialogDescription;
2434
+ exports.AlertDialogFooter = AlertDialogFooter;
2435
+ exports.AlertDialogHeader = AlertDialogHeader;
2436
+ exports.AlertDialogMedia = AlertDialogMedia;
2437
+ exports.AlertDialogOverlay = AlertDialogOverlay;
2438
+ exports.AlertDialogPortal = AlertDialogPortal;
2439
+ exports.AlertDialogTitle = AlertDialogTitle;
2440
+ exports.AlertDialogTrigger = AlertDialogTrigger;
1971
2441
  exports.AlertTitle = AlertTitle;
1972
2442
  exports.Avatar = Avatar;
1973
2443
  exports.AvatarBadge = AvatarBadge;
@@ -1994,6 +2464,7 @@ exports.ChartTooltipContent = ChartTooltipContent;
1994
2464
  exports.Collapsible = Collapsible;
1995
2465
  exports.CollapsibleContent = CollapsibleContent2;
1996
2466
  exports.CollapsibleTrigger = CollapsibleTrigger2;
2467
+ exports.DatePicker = DatePicker;
1997
2468
  exports.Dialog = Dialog;
1998
2469
  exports.DialogClose = DialogClose;
1999
2470
  exports.DialogContent = DialogContent;
@@ -2019,10 +2490,24 @@ exports.DropdownMenuSub = DropdownMenuSub;
2019
2490
  exports.DropdownMenuSubContent = DropdownMenuSubContent;
2020
2491
  exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
2021
2492
  exports.DropdownMenuTrigger = DropdownMenuTrigger;
2493
+ exports.Form = Form;
2494
+ exports.FormControl = FormControl;
2495
+ exports.FormDescription = FormDescription;
2496
+ exports.FormField = FormField;
2497
+ exports.FormItem = FormItem;
2498
+ exports.FormLabel = FormLabel;
2499
+ exports.FormMessage = FormMessage;
2022
2500
  exports.IconButton = IconButton;
2023
2501
  exports.IconToggle = IconToggle;
2024
2502
  exports.Input = Input;
2025
2503
  exports.Label = Label2;
2504
+ exports.Pagination = Pagination;
2505
+ exports.PaginationContent = PaginationContent;
2506
+ exports.PaginationEllipsis = PaginationEllipsis;
2507
+ exports.PaginationItem = PaginationItem;
2508
+ exports.PaginationLink = PaginationLink;
2509
+ exports.PaginationNext = PaginationNext;
2510
+ exports.PaginationPrevious = PaginationPrevious;
2026
2511
  exports.Popover = Popover;
2027
2512
  exports.PopoverAnchor = PopoverAnchor;
2028
2513
  exports.PopoverContent = PopoverContent;
@@ -2071,6 +2556,7 @@ exports.TabsContent = TabsContent;
2071
2556
  exports.TabsList = TabsList;
2072
2557
  exports.TabsTrigger = TabsTrigger;
2073
2558
  exports.Textarea = Textarea;
2559
+ exports.Toaster = Toaster;
2074
2560
  exports.Toggle = Toggle;
2075
2561
  exports.ToggleGroup = ToggleGroup;
2076
2562
  exports.ToggleGroupItem = ToggleGroupItem;
@@ -2082,6 +2568,7 @@ exports.badgeVariants = badgeVariants;
2082
2568
  exports.buttonVariants = buttonVariants;
2083
2569
  exports.cn = cn;
2084
2570
  exports.toggleVariants = toggleVariants;
2571
+ exports.useFormField = useFormField;
2085
2572
  exports.useZodForm = useZodForm;
2086
2573
  //# sourceMappingURL=index.cjs.map
2087
2574
  //# sourceMappingURL=index.cjs.map