@locusgraph/components 0.2.0 → 0.2.2

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 (102) hide show
  1. package/dist/action/button-group.js +45 -17
  2. package/dist/action/button.js +44 -27
  3. package/dist/action/toggle-group.js +176 -12
  4. package/dist/action/toggle.js +70 -17
  5. package/dist/display/avatar.js +118 -7
  6. package/dist/display/badge.js +33 -20
  7. package/dist/display/chart/chart-container.js +205 -45
  8. package/dist/display/chart/chart-legend.js +79 -14
  9. package/dist/display/chart/chart-tooltip.js +211 -40
  10. package/dist/display/chat/attachment/attachment-parts.js +56 -13
  11. package/dist/display/chat/attachment/attachment.js +70 -28
  12. package/dist/display/chat/bubble.js +80 -37
  13. package/dist/display/chat/marker.js +44 -15
  14. package/dist/display/chat/message-scroller.js +276 -14
  15. package/dist/display/chat/message.js +58 -13
  16. package/dist/display/content/item.js +134 -47
  17. package/dist/display/content/kbd.js +19 -5
  18. package/dist/display/media/aspect-ratio.js +27 -3
  19. package/dist/display/media/carousel-controls.js +162 -11
  20. package/dist/display/media/carousel.js +325 -65
  21. package/dist/display/rule-grid/rule-grid.js +86 -29
  22. package/dist/display/separator.js +56 -3
  23. package/dist/display/skeletons/layouts/skeleton-rule-grid.js +30 -6
  24. package/dist/display/skeletons/layouts/skeleton-table.js +44 -6
  25. package/dist/display/skeletons/shapes/skeleton-avatar.js +31 -13
  26. package/dist/display/skeletons/shapes/skeleton-button.js +31 -13
  27. package/dist/display/skeletons/shapes/skeleton-text.js +25 -7
  28. package/dist/display/skeletons/skeleton-parts.js +22 -6
  29. package/dist/display/status/alert.js +44 -18
  30. package/dist/display/status/empty.js +69 -22
  31. package/dist/display/status/progress.js +116 -16
  32. package/dist/display/status/skeleton.js +10 -3
  33. package/dist/display/status/spinner.js +11 -3
  34. package/dist/display/table.js +77 -17
  35. package/dist/feedback/toaster.js +98 -21
  36. package/dist/form/advanced/calendar-day-button.js +89 -12
  37. package/dist/form/advanced/calendar.js +349 -56
  38. package/dist/form/advanced/combobox/combobox-chips.js +151 -8
  39. package/dist/form/advanced/combobox/combobox-items.js +239 -14
  40. package/dist/form/advanced/combobox/combobox.js +386 -13
  41. package/dist/form/advanced/input-otp.js +201 -11
  42. package/dist/form/choice/checkbox.js +58 -3
  43. package/dist/form/choice/radio-group.js +94 -5
  44. package/dist/form/choice/select.js +479 -25
  45. package/dist/form/choice/slider.js +118 -4
  46. package/dist/form/choice/switch.js +53 -3
  47. package/dist/form/field/field-error.js +34 -14
  48. package/dist/form/field/field-separator.js +19 -3
  49. package/dist/form/field/field-set.js +21 -5
  50. package/dist/form/field/field-text.js +28 -7
  51. package/dist/form/field/field.js +43 -25
  52. package/dist/form/hook-form/form.js +338 -40
  53. package/dist/form/input-group.js +297 -47
  54. package/dist/form/input.js +13 -3
  55. package/dist/form/label.js +42 -3
  56. package/dist/form/native-select.js +39 -7
  57. package/dist/form/textarea.js +11 -3
  58. package/dist/layout/accordion.js +165 -8
  59. package/dist/layout/collapsible.js +75 -7
  60. package/dist/layout/resizable.js +122 -7
  61. package/dist/layout/scroll/direction.js +25 -3
  62. package/dist/layout/scroll/scroll-area.js +138 -5
  63. package/dist/layout/sidebar/sidebar-context.js +184 -51
  64. package/dist/layout/sidebar/sidebar-menu-sub.js +219 -14
  65. package/dist/layout/sidebar/sidebar-menu.js +319 -38
  66. package/dist/layout/sidebar/sidebar-sections.js +369 -22
  67. package/dist/layout/sidebar/sidebar.js +384 -28
  68. package/dist/layout/tabs.js +183 -18
  69. package/dist/layout/use-mobile.js +11 -11
  70. package/dist/navigation/breadcrumb.js +82 -17
  71. package/dist/navigation/menubar/menubar-items.js +322 -16
  72. package/dist/navigation/menubar/menubar-sub.js +125 -7
  73. package/dist/navigation/menubar/menubar.js +213 -13
  74. package/dist/navigation/navigation-menu.js +90 -18
  75. package/dist/navigation/pagination.js +91 -20
  76. package/dist/overlay/alert-dialog.js +485 -26
  77. package/dist/overlay/context-menu/context-menu-items.js +322 -16
  78. package/dist/overlay/context-menu/context-menu-sub.js +125 -7
  79. package/dist/overlay/context-menu/context-menu.js +140 -11
  80. package/dist/overlay/dialog.js +405 -24
  81. package/dist/overlay/floating/command.js +423 -20
  82. package/dist/overlay/floating/drawer.js +354 -22
  83. package/dist/overlay/floating/hover-card.js +107 -7
  84. package/dist/overlay/menu/dropdown-menu-choice.js +149 -7
  85. package/dist/overlay/menu/dropdown-menu-item.js +174 -9
  86. package/dist/overlay/menu/dropdown-menu-sub.js +124 -7
  87. package/dist/overlay/menu/dropdown-menu.js +147 -12
  88. package/dist/overlay/popover.js +106 -7
  89. package/dist/overlay/sheet.js +379 -26
  90. package/dist/overlay/tooltip.js +145 -9
  91. package/dist/shell/app-header.js +29 -5
  92. package/dist/shell/app-shell.js +19 -3
  93. package/dist/shell/breadcrumbs.js +46 -14
  94. package/dist/shell/docs/docs-header.js +210 -10
  95. package/dist/shell/docs/docs-shell.js +36 -3
  96. package/dist/shell/docs/docs-sidebar.js +41 -7
  97. package/dist/shell/docs/on-this-page.js +78 -7
  98. package/dist/shell/docs/use-active-section.js +44 -42
  99. package/dist/shell/navigation/app-sidebar.js +66 -6
  100. package/dist/shell/navigation/nav-group.js +53 -11
  101. package/dist/shell/theme-toggle.js +51 -4
  102. package/package.json +2 -2
@@ -1,25 +1,125 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { cn } from "cn";
4
5
  import * as ProgressPrimitive from "radix-ui/progress";
6
+ import * as React from "react";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
5
8
  const indicatorToneClass = {
6
- default: "bg-primary",
7
- good: "bg-good",
8
- warn: "bg-warn",
9
- destructive: "bg-destructive",
9
+ default: "bg-primary",
10
+ good: "bg-good",
11
+ warn: "bg-warn",
12
+ destructive: "bg-destructive"
10
13
  };
11
14
  function resolveTone(tone, percent) {
12
- if (tone !== "auto")
13
- return tone;
14
- if (percent >= 100)
15
- return "destructive";
16
- if (percent >= 80)
17
- return "warn";
18
- return "default";
15
+ if (tone !== "auto") return tone;
16
+ if (percent >= 100) return "destructive";
17
+ if (percent >= 80) return "warn";
18
+ return "default";
19
19
  }
20
- function Progress({ className, value, max = 100, tone = "default", ...props }) {
21
- const percent = max > 0 ? ((value ?? 0) / max) * 100 : 0;
22
- const resolvedTone = resolveTone(tone, percent);
23
- return (_jsx(ProgressPrimitive.Root, { "data-slot": "progress", "data-tone": resolvedTone, value: value, max: max, className: cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className), ...props, children: _jsx(ProgressPrimitive.Indicator, { "data-slot": "progress-indicator", className: cn("h-full w-full flex-1 transition-all", indicatorToneClass[resolvedTone]), style: { transform: `translateX(-${100 - Math.min(percent, 100)}%)` } }) }));
20
+ function Progress(t0) {
21
+ const $ = _c(25);
22
+ let className;
23
+ let props;
24
+ let t1;
25
+ let t2;
26
+ let value;
27
+ if ($[0] !== t0) {
28
+ ({
29
+ className,
30
+ value,
31
+ max: t1,
32
+ tone: t2,
33
+ ...props
34
+ } = t0);
35
+ $[0] = t0;
36
+ $[1] = className;
37
+ $[2] = props;
38
+ $[3] = t1;
39
+ $[4] = t2;
40
+ $[5] = value;
41
+ } else {
42
+ className = $[1];
43
+ props = $[2];
44
+ t1 = $[3];
45
+ t2 = $[4];
46
+ value = $[5];
47
+ }
48
+ const max = t1 === undefined ? 100 : t1;
49
+ const tone = t2 === undefined ? "default" : t2;
50
+ const percent = max > 0 ? (value ?? 0) / max * 100 : 0;
51
+ let t3;
52
+ if ($[6] !== percent || $[7] !== tone) {
53
+ t3 = resolveTone(tone, percent);
54
+ $[6] = percent;
55
+ $[7] = tone;
56
+ $[8] = t3;
57
+ } else {
58
+ t3 = $[8];
59
+ }
60
+ const resolvedTone = t3;
61
+ let t4;
62
+ if ($[9] !== className) {
63
+ t4 = cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className);
64
+ $[9] = className;
65
+ $[10] = t4;
66
+ } else {
67
+ t4 = $[10];
68
+ }
69
+ const t5 = indicatorToneClass[resolvedTone];
70
+ let t6;
71
+ if ($[11] !== t5) {
72
+ t6 = cn("h-full w-full flex-1 transition-all", t5);
73
+ $[11] = t5;
74
+ $[12] = t6;
75
+ } else {
76
+ t6 = $[12];
77
+ }
78
+ const t7 = `translateX(-${100 - Math.min(percent, 100)}%)`;
79
+ let t8;
80
+ if ($[13] !== t7) {
81
+ t8 = {
82
+ transform: t7
83
+ };
84
+ $[13] = t7;
85
+ $[14] = t8;
86
+ } else {
87
+ t8 = $[14];
88
+ }
89
+ let t9;
90
+ if ($[15] !== t6 || $[16] !== t8) {
91
+ t9 = /*#__PURE__*/_jsx(ProgressPrimitive.Indicator, {
92
+ "data-slot": "progress-indicator",
93
+ className: t6,
94
+ style: t8
95
+ });
96
+ $[15] = t6;
97
+ $[16] = t8;
98
+ $[17] = t9;
99
+ } else {
100
+ t9 = $[17];
101
+ }
102
+ let t10;
103
+ if ($[18] !== max || $[19] !== props || $[20] !== resolvedTone || $[21] !== t4 || $[22] !== t9 || $[23] !== value) {
104
+ t10 = /*#__PURE__*/_jsx(ProgressPrimitive.Root, {
105
+ "data-slot": "progress",
106
+ "data-tone": resolvedTone,
107
+ value: value,
108
+ max: max,
109
+ className: t4,
110
+ ...props,
111
+ children: t9
112
+ });
113
+ $[18] = max;
114
+ $[19] = props;
115
+ $[20] = resolvedTone;
116
+ $[21] = t4;
117
+ $[22] = t9;
118
+ $[23] = value;
119
+ $[24] = t10;
120
+ } else {
121
+ t10 = $[24];
122
+ }
123
+ return t10;
24
124
  }
25
125
  export { Progress };
@@ -1,6 +1,13 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { cn } from "cn";
3
- function Skeleton({ className, ...props }) {
4
- return (_jsx("div", { "data-slot": "skeleton", className: cn("animate-pulse rounded-md bg-skeleton", className), ...props }));
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ function Skeleton({
4
+ className,
5
+ ...props
6
+ }) {
7
+ return /*#__PURE__*/_jsx("div", {
8
+ "data-slot": "skeleton",
9
+ className: cn("animate-pulse rounded-md bg-skeleton", className),
10
+ ...props
11
+ });
5
12
  }
6
13
  export { Skeleton };
@@ -1,7 +1,15 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { InProgress as Loader2Icon } from "@carbon/icons-react";
3
2
  import { cn } from "cn";
4
- function Spinner({ className, ...props }) {
5
- return (_jsx(Loader2Icon, { role: "status", "aria-label": "Loading", className: cn("size-4 animate-spin", className), ...props }));
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ function Spinner({
5
+ className,
6
+ ...props
7
+ }) {
8
+ return /*#__PURE__*/_jsx(Loader2Icon, {
9
+ role: "status",
10
+ "aria-label": "Loading",
11
+ className: cn("size-4 animate-spin", className),
12
+ ...props
13
+ });
6
14
  }
7
15
  export { Spinner };
@@ -1,27 +1,87 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { cn } from "cn";
3
- function Table({ className, ...props }) {
4
- return (_jsx("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto scroll-fade-x", children: _jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom text-sm", className), ...props }) }));
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ function Table({
4
+ className,
5
+ ...props
6
+ }) {
7
+ return /*#__PURE__*/_jsx("div", {
8
+ "data-slot": "table-container",
9
+ className: "relative w-full overflow-x-auto scroll-fade-x",
10
+ children: /*#__PURE__*/_jsx("table", {
11
+ "data-slot": "table",
12
+ className: cn("w-full caption-bottom text-sm", className),
13
+ ...props
14
+ })
15
+ });
5
16
  }
6
- function TableHeader({ className, ...props }) {
7
- return _jsx("thead", { "data-slot": "table-header", className: cn("[&_tr]:border-b", className), ...props });
17
+ function TableHeader({
18
+ className,
19
+ ...props
20
+ }) {
21
+ return /*#__PURE__*/_jsx("thead", {
22
+ "data-slot": "table-header",
23
+ className: cn("[&_tr]:border-b", className),
24
+ ...props
25
+ });
8
26
  }
9
- function TableBody({ className, ...props }) {
10
- return (_jsx("tbody", { "data-slot": "table-body", className: cn("[&_tr:last-child]:border-0", className), ...props }));
27
+ function TableBody({
28
+ className,
29
+ ...props
30
+ }) {
31
+ return /*#__PURE__*/_jsx("tbody", {
32
+ "data-slot": "table-body",
33
+ className: cn("[&_tr:last-child]:border-0", className),
34
+ ...props
35
+ });
11
36
  }
12
- function TableFooter({ className, ...props }) {
13
- return (_jsx("tfoot", { "data-slot": "table-footer", className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props }));
37
+ function TableFooter({
38
+ className,
39
+ ...props
40
+ }) {
41
+ return /*#__PURE__*/_jsx("tfoot", {
42
+ "data-slot": "table-footer",
43
+ className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
44
+ ...props
45
+ });
14
46
  }
15
- function TableRow({ className, ...props }) {
16
- return (_jsx("tr", { "data-slot": "table-row", className: cn("border-b transition-colors duration-150 ease-out hover:bg-muted/40 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted", className), ...props }));
47
+ function TableRow({
48
+ className,
49
+ ...props
50
+ }) {
51
+ return /*#__PURE__*/_jsx("tr", {
52
+ "data-slot": "table-row",
53
+ className: cn("border-b transition-colors duration-150 ease-out hover:bg-muted/40 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted", className),
54
+ ...props
55
+ });
17
56
  }
18
- function TableHead({ className, ...props }) {
19
- return (_jsx("th", { "data-slot": "table-head", className: cn("eyebrow h-9 px-3 text-left align-middle font-normal whitespace-nowrap sm:px-4 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
57
+ function TableHead({
58
+ className,
59
+ ...props
60
+ }) {
61
+ return /*#__PURE__*/_jsx("th", {
62
+ "data-slot": "table-head",
63
+ className: cn("eyebrow h-9 px-3 text-left align-middle font-normal whitespace-nowrap sm:px-4 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
64
+ ...props
65
+ });
20
66
  }
21
- function TableCell({ className, ...props }) {
22
- return (_jsx("td", { "data-slot": "table-cell", className: cn("px-3 py-2.5 align-middle whitespace-nowrap tabular-nums sm:px-4 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
67
+ function TableCell({
68
+ className,
69
+ ...props
70
+ }) {
71
+ return /*#__PURE__*/_jsx("td", {
72
+ "data-slot": "table-cell",
73
+ className: cn("px-3 py-2.5 align-middle whitespace-nowrap tabular-nums sm:px-4 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
74
+ ...props
75
+ });
23
76
  }
24
- function TableCaption({ className, ...props }) {
25
- return (_jsx("caption", { "data-slot": "table-caption", className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
77
+ function TableCaption({
78
+ className,
79
+ ...props
80
+ }) {
81
+ return /*#__PURE__*/_jsx("caption", {
82
+ "data-slot": "table-caption",
83
+ className: cn("mt-4 text-sm text-muted-foreground", className),
84
+ ...props
85
+ });
26
86
  }
27
87
  export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
@@ -1,30 +1,107 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { CheckmarkOutline as CircleCheckIcon, Information as InfoIcon, InProgress as Loader2Icon, ErrorOutline as OctagonXIcon, WarningAlt as TriangleAlertIcon, } from "@carbon/icons-react";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
4
+ import { CheckmarkOutline as CircleCheckIcon, Information as InfoIcon, InProgress as Loader2Icon, ErrorOutline as OctagonXIcon, WarningAlt as TriangleAlertIcon } from "@carbon/icons-react";
4
5
  import { Toaster as Sonner } from "sonner";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
5
7
  const toasterColors = {
6
- "--normal-bg": "var(--popover)",
7
- "--normal-text": "var(--popover-foreground)",
8
- "--normal-border": "var(--border)",
9
- "--border-radius": "var(--radius)",
8
+ "--normal-bg": "var(--popover)",
9
+ "--normal-text": "var(--popover-foreground)",
10
+ "--normal-border": "var(--border)",
11
+ "--border-radius": "var(--radius)"
10
12
  };
11
13
  const statusRuleClassNames = {
12
- success: "border-l-2! border-l-good! [&_[data-icon]]:text-good",
13
- info: "border-l-2! border-l-info! [&_[data-icon]]:text-info",
14
- warning: "border-l-2! border-l-warn! [&_[data-icon]]:text-warn",
15
- error: "border-l-2! border-l-destructive! [&_[data-icon]]:text-destructive",
14
+ success: "border-l-2! border-l-good! [&_[data-icon]]:text-good",
15
+ info: "border-l-2! border-l-info! [&_[data-icon]]:text-info",
16
+ warning: "border-l-2! border-l-warn! [&_[data-icon]]:text-warn",
17
+ error: "border-l-2! border-l-destructive! [&_[data-icon]]:text-destructive"
16
18
  };
17
- function Toaster({ theme = "system", toastOptions, ...props }) {
18
- return (_jsx(Sonner, { theme: theme, className: "toaster group", toastOptions: {
19
- ...toastOptions,
20
- classNames: { ...statusRuleClassNames, ...toastOptions?.classNames },
21
- }, icons: {
22
- success: _jsx(CircleCheckIcon, { className: "size-4" }),
23
- info: _jsx(InfoIcon, { className: "size-4" }),
24
- warning: _jsx(TriangleAlertIcon, { className: "size-4" }),
25
- error: _jsx(OctagonXIcon, { className: "size-4" }),
26
- loading: _jsx(Loader2Icon, { className: "size-4 animate-spin" }),
27
- }, style: toasterColors, ...props }));
19
+ function Toaster(t0) {
20
+ const $ = _c(14);
21
+ let props;
22
+ let t1;
23
+ let toastOptions;
24
+ if ($[0] !== t0) {
25
+ ({
26
+ theme: t1,
27
+ toastOptions,
28
+ ...props
29
+ } = t0);
30
+ $[0] = t0;
31
+ $[1] = props;
32
+ $[2] = t1;
33
+ $[3] = toastOptions;
34
+ } else {
35
+ props = $[1];
36
+ t1 = $[2];
37
+ toastOptions = $[3];
38
+ }
39
+ const theme = t1 === undefined ? "system" : t1;
40
+ const t2 = toastOptions?.classNames;
41
+ let t3;
42
+ if ($[4] !== t2) {
43
+ t3 = {
44
+ ...statusRuleClassNames,
45
+ ...t2
46
+ };
47
+ $[4] = t2;
48
+ $[5] = t3;
49
+ } else {
50
+ t3 = $[5];
51
+ }
52
+ let t4;
53
+ if ($[6] !== t3 || $[7] !== toastOptions) {
54
+ t4 = {
55
+ ...toastOptions,
56
+ classNames: t3
57
+ };
58
+ $[6] = t3;
59
+ $[7] = toastOptions;
60
+ $[8] = t4;
61
+ } else {
62
+ t4 = $[8];
63
+ }
64
+ let t5;
65
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
66
+ t5 = {
67
+ success: /*#__PURE__*/_jsx(CircleCheckIcon, {
68
+ className: "size-4"
69
+ }),
70
+ info: /*#__PURE__*/_jsx(InfoIcon, {
71
+ className: "size-4"
72
+ }),
73
+ warning: /*#__PURE__*/_jsx(TriangleAlertIcon, {
74
+ className: "size-4"
75
+ }),
76
+ error: /*#__PURE__*/_jsx(OctagonXIcon, {
77
+ className: "size-4"
78
+ }),
79
+ loading: /*#__PURE__*/_jsx(Loader2Icon, {
80
+ className: "size-4 animate-spin"
81
+ })
82
+ };
83
+ $[9] = t5;
84
+ } else {
85
+ t5 = $[9];
86
+ }
87
+ let t6;
88
+ if ($[10] !== props || $[11] !== t4 || $[12] !== theme) {
89
+ t6 = /*#__PURE__*/_jsx(Sonner, {
90
+ theme: theme,
91
+ className: "toaster group",
92
+ toastOptions: t4,
93
+ icons: t5,
94
+ style: toasterColors,
95
+ ...props
96
+ });
97
+ $[10] = props;
98
+ $[11] = t4;
99
+ $[12] = theme;
100
+ $[13] = t6;
101
+ } else {
102
+ t6 = $[13];
103
+ }
104
+ return t6;
28
105
  }
29
106
  export { toast } from "sonner";
30
107
  export { Toaster };
@@ -1,19 +1,96 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { cn } from "cn";
4
5
  import * as React from "react";
5
6
  import { getDefaultClassNames } from "react-day-picker";
6
7
  import { Button } from "../../action/button.js";
7
- function CalendarDayButton({ className, day, modifiers, ...props }) {
8
- const defaultClassNames = getDefaultClassNames();
9
- const ref = React.useRef(null);
10
- React.useEffect(() => {
11
- if (modifiers.focused)
12
- ref.current?.focus();
13
- }, [modifiers.focused]);
14
- return (_jsx(Button, { ref: ref, variant: "ghost", size: "icon", "data-day": day.date.toLocaleDateString(), "data-selected-single": modifiers.selected &&
15
- !modifiers.range_start &&
16
- !modifiers.range_end &&
17
- !modifiers.range_middle, "data-range-start": modifiers.range_start, "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, className: cn("flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-2 group-data-[focused=true]/day:ring-ring/70 data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:rounded-none data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className), ...props }));
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ function CalendarDayButton(t0) {
10
+ const $ = _c(19);
11
+ let className;
12
+ let day;
13
+ let modifiers;
14
+ let props;
15
+ if ($[0] !== t0) {
16
+ ({
17
+ className,
18
+ day,
19
+ modifiers,
20
+ ...props
21
+ } = t0);
22
+ $[0] = t0;
23
+ $[1] = className;
24
+ $[2] = day;
25
+ $[3] = modifiers;
26
+ $[4] = props;
27
+ } else {
28
+ className = $[1];
29
+ day = $[2];
30
+ modifiers = $[3];
31
+ props = $[4];
32
+ }
33
+ const defaultClassNames = getDefaultClassNames();
34
+ const ref = React.useRef(null);
35
+ let t1;
36
+ let t2;
37
+ if ($[5] !== modifiers.focused) {
38
+ t1 = () => {
39
+ if (modifiers.focused) {
40
+ ref.current?.focus();
41
+ }
42
+ };
43
+ t2 = [modifiers.focused];
44
+ $[5] = modifiers.focused;
45
+ $[6] = t1;
46
+ $[7] = t2;
47
+ } else {
48
+ t1 = $[6];
49
+ t2 = $[7];
50
+ }
51
+ React.useEffect(t1, t2);
52
+ const T0 = Button;
53
+ const t3 = "ghost";
54
+ const t4 = "icon";
55
+ let t5;
56
+ if ($[8] !== day.date) {
57
+ t5 = day.date.toLocaleDateString();
58
+ $[8] = day.date;
59
+ $[9] = t5;
60
+ } else {
61
+ t5 = $[9];
62
+ }
63
+ const t6 = modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle;
64
+ const t7 = modifiers.range_start;
65
+ const t8 = modifiers.range_end;
66
+ const t9 = modifiers.range_middle;
67
+ const t10 = cn("flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-2 group-data-[focused=true]/day:ring-ring/70 data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:rounded-none data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className);
68
+ let t11;
69
+ if ($[10] !== T0 || $[11] !== modifiers.range_end || $[12] !== modifiers.range_middle || $[13] !== modifiers.range_start || $[14] !== props || $[15] !== t10 || $[16] !== t5 || $[17] !== t6) {
70
+ t11 = /*#__PURE__*/_jsx(T0, {
71
+ ref: ref,
72
+ variant: t3,
73
+ size: t4,
74
+ "data-day": t5,
75
+ "data-selected-single": t6,
76
+ "data-range-start": t7,
77
+ "data-range-end": t8,
78
+ "data-range-middle": t9,
79
+ className: t10,
80
+ ...props
81
+ });
82
+ $[10] = T0;
83
+ $[11] = modifiers.range_end;
84
+ $[12] = modifiers.range_middle;
85
+ $[13] = modifiers.range_start;
86
+ $[14] = props;
87
+ $[15] = t10;
88
+ $[16] = t5;
89
+ $[17] = t6;
90
+ $[18] = t11;
91
+ } else {
92
+ t11 = $[18];
93
+ }
94
+ return t11;
18
95
  }
19
96
  export { CalendarDayButton };