@craftzbay/ui 0.11.3 → 1.0.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 (166) hide show
  1. package/README.md +1 -1
  2. package/dist-lib/_virtual/_rolldown/runtime.js +11 -0
  3. package/dist-lib/components/ui/Accordion.js +42 -67
  4. package/dist-lib/components/ui/Accordion.js.map +1 -1
  5. package/dist-lib/components/ui/Alert.js +71 -77
  6. package/dist-lib/components/ui/Alert.js.map +1 -1
  7. package/dist-lib/components/ui/Avatar.js +67 -92
  8. package/dist-lib/components/ui/Avatar.js.map +1 -1
  9. package/dist-lib/components/ui/Badge.js +119 -74
  10. package/dist-lib/components/ui/Badge.js.map +1 -1
  11. package/dist-lib/components/ui/Breadcrumbs.js +62 -50
  12. package/dist-lib/components/ui/Breadcrumbs.js.map +1 -1
  13. package/dist-lib/components/ui/Button.js +129 -131
  14. package/dist-lib/components/ui/Button.js.map +1 -1
  15. package/dist-lib/components/ui/Calendar.d.ts +1 -1
  16. package/dist-lib/components/ui/Calendar.js +99 -136
  17. package/dist-lib/components/ui/Calendar.js.map +1 -1
  18. package/dist-lib/components/ui/Card.js +88 -94
  19. package/dist-lib/components/ui/Card.js.map +1 -1
  20. package/dist-lib/components/ui/Carousel.js +125 -170
  21. package/dist-lib/components/ui/Carousel.js.map +1 -1
  22. package/dist-lib/components/ui/Chart.d.ts +3 -3
  23. package/dist-lib/components/ui/Chart.js +435 -464
  24. package/dist-lib/components/ui/Chart.js.map +1 -1
  25. package/dist-lib/components/ui/Checkbox.js +60 -69
  26. package/dist-lib/components/ui/Checkbox.js.map +1 -1
  27. package/dist-lib/components/ui/Combobox.js +179 -192
  28. package/dist-lib/components/ui/Combobox.js.map +1 -1
  29. package/dist-lib/components/ui/CommandPalette.d.ts +2 -2
  30. package/dist-lib/components/ui/CommandPalette.js +106 -167
  31. package/dist-lib/components/ui/CommandPalette.js.map +1 -1
  32. package/dist-lib/components/ui/ContextMenu.d.ts +1 -1
  33. package/dist-lib/components/ui/ContextMenu.js +89 -154
  34. package/dist-lib/components/ui/ContextMenu.js.map +1 -1
  35. package/dist-lib/components/ui/DataGrid.d.ts +1 -1
  36. package/dist-lib/components/ui/DataGrid.js +99 -96
  37. package/dist-lib/components/ui/DataGrid.js.map +1 -1
  38. package/dist-lib/components/ui/DatePicker.js +151 -188
  39. package/dist-lib/components/ui/DatePicker.js.map +1 -1
  40. package/dist-lib/components/ui/DesignSystemProvider.d.ts +1 -1
  41. package/dist-lib/components/ui/DesignSystemProvider.js +120 -130
  42. package/dist-lib/components/ui/DesignSystemProvider.js.map +1 -1
  43. package/dist-lib/components/ui/Dialog.d.ts +3 -3
  44. package/dist-lib/components/ui/Dialog.js +108 -156
  45. package/dist-lib/components/ui/Dialog.js.map +1 -1
  46. package/dist-lib/components/ui/Drawer.d.ts +3 -3
  47. package/dist-lib/components/ui/Drawer.js +90 -124
  48. package/dist-lib/components/ui/Drawer.js.map +1 -1
  49. package/dist-lib/components/ui/DropdownMenu.d.ts +1 -1
  50. package/dist-lib/components/ui/DropdownMenu.js +92 -158
  51. package/dist-lib/components/ui/DropdownMenu.js.map +1 -1
  52. package/dist-lib/components/ui/EmptyState.js +31 -44
  53. package/dist-lib/components/ui/EmptyState.js.map +1 -1
  54. package/dist-lib/components/ui/ErrorState.js +57 -67
  55. package/dist-lib/components/ui/ErrorState.js.map +1 -1
  56. package/dist-lib/components/ui/FileUpload.js +113 -107
  57. package/dist-lib/components/ui/FileUpload.js.map +1 -1
  58. package/dist-lib/components/ui/Form.d.ts +6 -4
  59. package/dist-lib/components/ui/Form.js +117 -122
  60. package/dist-lib/components/ui/Form.js.map +1 -1
  61. package/dist-lib/components/ui/Icon.d.ts +1 -1
  62. package/dist-lib/components/ui/Icon.js +30 -29
  63. package/dist-lib/components/ui/Icon.js.map +1 -1
  64. package/dist-lib/components/ui/IconButton.js +61 -63
  65. package/dist-lib/components/ui/IconButton.js.map +1 -1
  66. package/dist-lib/components/ui/Input.js +133 -156
  67. package/dist-lib/components/ui/Input.js.map +1 -1
  68. package/dist-lib/components/ui/Kbd.js +14 -21
  69. package/dist-lib/components/ui/Kbd.js.map +1 -1
  70. package/dist-lib/components/ui/MultiSelect.js +176 -208
  71. package/dist-lib/components/ui/MultiSelect.js.map +1 -1
  72. package/dist-lib/components/ui/Pagination.js +152 -149
  73. package/dist-lib/components/ui/Pagination.js.map +1 -1
  74. package/dist-lib/components/ui/Popover.js +18 -33
  75. package/dist-lib/components/ui/Popover.js.map +1 -1
  76. package/dist-lib/components/ui/Progress.js +77 -99
  77. package/dist-lib/components/ui/Progress.js.map +1 -1
  78. package/dist-lib/components/ui/RadioGroup.js +51 -80
  79. package/dist-lib/components/ui/RadioGroup.js.map +1 -1
  80. package/dist-lib/components/ui/RelativeTime.js +22 -29
  81. package/dist-lib/components/ui/RelativeTime.js.map +1 -1
  82. package/dist-lib/components/ui/ScrollArea.js +39 -58
  83. package/dist-lib/components/ui/ScrollArea.js.map +1 -1
  84. package/dist-lib/components/ui/Select.js +108 -131
  85. package/dist-lib/components/ui/Select.js.map +1 -1
  86. package/dist-lib/components/ui/Separator.js +18 -24
  87. package/dist-lib/components/ui/Separator.js.map +1 -1
  88. package/dist-lib/components/ui/Sheet.d.ts +2 -2
  89. package/dist-lib/components/ui/Sheet.js +77 -129
  90. package/dist-lib/components/ui/Sheet.js.map +1 -1
  91. package/dist-lib/components/ui/Sidebar.d.ts +1 -1
  92. package/dist-lib/components/ui/Sidebar.js +168 -207
  93. package/dist-lib/components/ui/Sidebar.js.map +1 -1
  94. package/dist-lib/components/ui/Skeleton.js +17 -27
  95. package/dist-lib/components/ui/Skeleton.js.map +1 -1
  96. package/dist-lib/components/ui/Slider.js +45 -62
  97. package/dist-lib/components/ui/Slider.js.map +1 -1
  98. package/dist-lib/components/ui/Snackbar.js +75 -55
  99. package/dist-lib/components/ui/Snackbar.js.map +1 -1
  100. package/dist-lib/components/ui/Spinner.js +45 -52
  101. package/dist-lib/components/ui/Spinner.js.map +1 -1
  102. package/dist-lib/components/ui/Stepper.js +56 -108
  103. package/dist-lib/components/ui/Stepper.js.map +1 -1
  104. package/dist-lib/components/ui/Switch.js +46 -79
  105. package/dist-lib/components/ui/Switch.js.map +1 -1
  106. package/dist-lib/components/ui/Table.js +108 -169
  107. package/dist-lib/components/ui/Table.js.map +1 -1
  108. package/dist-lib/components/ui/Tabs.js +57 -88
  109. package/dist-lib/components/ui/Tabs.js.map +1 -1
  110. package/dist-lib/components/ui/TagInput.js +76 -109
  111. package/dist-lib/components/ui/TagInput.js.map +1 -1
  112. package/dist-lib/components/ui/Textarea.js +74 -86
  113. package/dist-lib/components/ui/Textarea.js.map +1 -1
  114. package/dist-lib/components/ui/Timeline.d.ts +3 -3
  115. package/dist-lib/components/ui/Timeline.js +61 -49
  116. package/dist-lib/components/ui/Timeline.js.map +1 -1
  117. package/dist-lib/components/ui/Toast.d.ts +1 -1
  118. package/dist-lib/components/ui/Toast.js +136 -150
  119. package/dist-lib/components/ui/Toast.js.map +1 -1
  120. package/dist-lib/components/ui/Tooltip.d.ts +2 -2
  121. package/dist-lib/components/ui/Tooltip.js +35 -56
  122. package/dist-lib/components/ui/Tooltip.js.map +1 -1
  123. package/dist-lib/components/ui/TopNav.js +46 -66
  124. package/dist-lib/components/ui/TopNav.js.map +1 -1
  125. package/dist-lib/components/ui/Tree.js +134 -168
  126. package/dist-lib/components/ui/Tree.js.map +1 -1
  127. package/dist-lib/hooks/use-debounce.js +24 -33
  128. package/dist-lib/hooks/use-debounce.js.map +1 -1
  129. package/dist-lib/hooks/use-delayed-loading.js +20 -18
  130. package/dist-lib/hooks/use-delayed-loading.js.map +1 -1
  131. package/dist-lib/hooks/use-field-ids.js +14 -16
  132. package/dist-lib/hooks/use-field-ids.js.map +1 -1
  133. package/dist-lib/hooks/use-media-query.js +15 -19
  134. package/dist-lib/hooks/use-media-query.js.map +1 -1
  135. package/dist-lib/hooks/use-modifier-key.d.ts +0 -4
  136. package/dist-lib/hooks/use-modifier-key.js +19 -16
  137. package/dist-lib/hooks/use-modifier-key.js.map +1 -1
  138. package/dist-lib/hooks/use-strings.js +10 -10
  139. package/dist-lib/hooks/use-strings.js.map +1 -1
  140. package/dist-lib/hooks/use-toast.js +73 -62
  141. package/dist-lib/hooks/use-toast.js.map +1 -1
  142. package/dist-lib/icon.js +2 -6
  143. package/dist-lib/icons/index.d.ts +1 -1
  144. package/dist-lib/icons/index.js +166 -163
  145. package/dist-lib/icons/index.js.map +1 -1
  146. package/dist-lib/illustrations/index.d.ts +7 -7
  147. package/dist-lib/illustrations/index.js +255 -106
  148. package/dist-lib/illustrations/index.js.map +1 -1
  149. package/dist-lib/index.js +69 -291
  150. package/dist-lib/lib/cva.js +2 -0
  151. package/dist-lib/lib/format.js +71 -87
  152. package/dist-lib/lib/format.js.map +1 -1
  153. package/dist-lib/lib/return-focus.js +11 -11
  154. package/dist-lib/lib/return-focus.js.map +1 -1
  155. package/dist-lib/lib/strings.js +167 -135
  156. package/dist-lib/lib/strings.js.map +1 -1
  157. package/dist-lib/lib/strings.mn.js +150 -113
  158. package/dist-lib/lib/strings.mn.js.map +1 -1
  159. package/dist-lib/lib/utils.js +9 -9
  160. package/dist-lib/lib/utils.js.map +1 -1
  161. package/dist-lib/styles.css +3 -1
  162. package/package.json +53 -53
  163. package/dist-lib/__tests__/helpers/color.d.ts +0 -9
  164. package/dist-lib/__tests__/helpers/theme.d.ts +0 -18
  165. package/dist-lib/icon.js.map +0 -1
  166. package/dist-lib/index.js.map +0 -1
@@ -1,169 +1,103 @@
1
1
  "use client";
2
- import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { Check as t, ChevronRight as n, Circle as r } from "../../icons/index.js";
3
4
  import { forwardRef as i } from "react";
4
- import * as o from "@radix-ui/react-dropdown-menu";
5
- import { Check as l, Circle as m, ChevronRight as f } from "../../icons/index.js";
6
- import { cn as d } from "../../lib/utils.js";
7
- const R = o.Root, k = o.Trigger, T = o.Group, g = o.Portal, j = o.Sub, G = o.RadioGroup, p = d(
8
- "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-foreground outline-none",
9
- "data-[highlighted]:bg-background-muted data-[highlighted]:text-foreground",
10
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
11
- "transition-colors duration-[var(--duration-fast)]"
12
- ), b = i(function({ className: e, inset: t, children: n, ...a }, u) {
13
- return /* @__PURE__ */ c(
14
- o.SubTrigger,
15
- {
16
- ref: u,
17
- className: d(
18
- p,
19
- "data-[state=open]:bg-background-muted",
20
- t && "pl-8",
21
- e
22
- ),
23
- ...a,
24
- children: [
25
- n,
26
- /* @__PURE__ */ r(f, { className: "text-foreground-subtle ml-auto size-4", "aria-hidden": !0 })
27
- ]
28
- }
29
- );
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ import * as s from "@radix-ui/react-dropdown-menu";
7
+ //#region src/components/ui/DropdownMenu.tsx
8
+ var c = s.Root, l = s.Trigger, u = s.Group, d = s.Portal, f = s.Sub, p = s.RadioGroup, m = e("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-foreground outline-none", "data-[highlighted]:bg-background-muted data-[highlighted]:text-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", "transition-colors duration-[var(--duration-fast)]"), h = i(function({ className: t, inset: r, children: i, ...c }, l) {
9
+ return /* @__PURE__ */ o(s.SubTrigger, {
10
+ ref: l,
11
+ className: e(m, "data-[state=open]:bg-background-muted", r && "pl-8", t),
12
+ ...c,
13
+ children: [i, /* @__PURE__ */ a(n, {
14
+ className: "text-foreground-subtle ml-auto size-4",
15
+ "aria-hidden": !0
16
+ })]
17
+ });
30
18
  });
31
- b.displayName = "DropdownMenuSubTrigger";
32
- const w = i(function({ className: e, ...t }, n) {
33
- return /* @__PURE__ */ r(
34
- o.SubContent,
35
- {
36
- ref: n,
37
- className: d(
38
- "border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[8rem] overflow-hidden rounded-lg border p-1 shadow-md",
39
- "data-[state=open]:animate-in data-[state=closed]:animate-out",
40
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
41
- "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
42
- e
43
- ),
44
- ...t
45
- }
46
- );
19
+ h.displayName = "DropdownMenuSubTrigger";
20
+ var g = i(function({ className: t, ...n }, r) {
21
+ return /* @__PURE__ */ a(s.SubContent, {
22
+ ref: r,
23
+ className: e("border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[8rem] overflow-hidden rounded-lg border p-1 shadow-md", "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-95 data-[state=open]:zoom-in-95", t),
24
+ ...n
25
+ });
47
26
  });
48
- w.displayName = "DropdownMenuSubContent";
49
- const h = i(function({ className: e, sideOffset: t = 4, align: n = "end", ...a }, u) {
50
- return /* @__PURE__ */ r(g, { children: /* @__PURE__ */ r(
51
- o.Content,
52
- {
53
- ref: u,
54
- sideOffset: t,
55
- align: n,
56
- className: d(
57
- "border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[12rem] overflow-hidden rounded-lg border p-1 shadow-md",
58
- "data-[state=open]:animate-in data-[state=closed]:animate-out",
59
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
60
- "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
61
- "data-[side=bottom]:slide-in-from-top-1 data-[side=top]:slide-in-from-bottom-1",
62
- e
63
- ),
64
- ...a
65
- }
66
- ) });
27
+ g.displayName = "DropdownMenuSubContent";
28
+ var _ = i(function({ className: t, sideOffset: n = 4, align: r = "end", ...i }, o) {
29
+ return /* @__PURE__ */ a(d, { children: /* @__PURE__ */ a(s.Content, {
30
+ ref: o,
31
+ sideOffset: n,
32
+ align: r,
33
+ className: e("border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[12rem] overflow-hidden rounded-lg border p-1 shadow-md", "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-95 data-[state=open]:zoom-in-95", "data-[side=bottom]:slide-in-from-top-1 data-[side=top]:slide-in-from-bottom-1", t),
34
+ ...i
35
+ }) });
67
36
  });
68
- h.displayName = "DropdownMenuContent";
69
- const D = i(function({ className: e, inset: t, destructive: n, ...a }, u) {
70
- return /* @__PURE__ */ r(
71
- o.Item,
72
- {
73
- ref: u,
74
- className: d(
75
- p,
76
- t && "pl-8",
77
- n && "text-danger-text data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger-text",
78
- e
79
- ),
80
- ...a
81
- }
82
- );
37
+ _.displayName = "DropdownMenuContent";
38
+ var v = i(function({ className: t, inset: n, destructive: r, ...i }, o) {
39
+ return /* @__PURE__ */ a(s.Item, {
40
+ ref: o,
41
+ className: e(m, n && "pl-8", r && "text-danger-text data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger-text", t),
42
+ ...i
43
+ });
83
44
  });
84
- D.displayName = "DropdownMenuItem";
85
- const M = i(function({ className: e, children: t, checked: n, ...a }, u) {
86
- return /* @__PURE__ */ c(
87
- o.CheckboxItem,
88
- {
89
- ref: u,
90
- checked: n,
91
- className: d(p, "pl-8", e),
92
- ...a,
93
- children: [
94
- /* @__PURE__ */ r("span", { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ r(o.ItemIndicator, { children: /* @__PURE__ */ r(l, { className: "text-accent size-4", "aria-hidden": !0 }) }) }),
95
- t
96
- ]
97
- }
98
- );
45
+ v.displayName = "DropdownMenuItem";
46
+ var y = i(function({ className: n, children: r, checked: i, ...c }, l) {
47
+ return /* @__PURE__ */ o(s.CheckboxItem, {
48
+ ref: l,
49
+ checked: i,
50
+ className: e(m, "pl-8", n),
51
+ ...c,
52
+ children: [/* @__PURE__ */ a("span", {
53
+ className: "absolute left-2 flex size-4 items-center justify-center",
54
+ children: /* @__PURE__ */ a(s.ItemIndicator, { children: /* @__PURE__ */ a(t, {
55
+ className: "text-accent size-4",
56
+ "aria-hidden": !0
57
+ }) })
58
+ }), r]
59
+ });
99
60
  });
100
- M.displayName = "DropdownMenuCheckboxItem";
101
- const x = i(function({ className: e, children: t, ...n }, a) {
102
- return /* @__PURE__ */ c(
103
- o.RadioItem,
104
- {
105
- ref: a,
106
- className: d(p, "pl-8", e),
107
- ...n,
108
- children: [
109
- /* @__PURE__ */ r("span", { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ r(o.ItemIndicator, { children: /* @__PURE__ */ r(m, { className: "fill-accent text-accent size-2", "aria-hidden": !0 }) }) }),
110
- t
111
- ]
112
- }
113
- );
61
+ y.displayName = "DropdownMenuCheckboxItem";
62
+ var b = i(function({ className: t, children: n, ...i }, c) {
63
+ return /* @__PURE__ */ o(s.RadioItem, {
64
+ ref: c,
65
+ className: e(m, "pl-8", t),
66
+ ...i,
67
+ children: [/* @__PURE__ */ a("span", {
68
+ className: "absolute left-2 flex size-4 items-center justify-center",
69
+ children: /* @__PURE__ */ a(s.ItemIndicator, { children: /* @__PURE__ */ a(r, {
70
+ className: "fill-accent text-accent size-2",
71
+ "aria-hidden": !0
72
+ }) })
73
+ }), n]
74
+ });
114
75
  });
115
- x.displayName = "DropdownMenuRadioItem";
116
- const N = i(function({ className: e, inset: t, ...n }, a) {
117
- return /* @__PURE__ */ r(
118
- o.Label,
119
- {
120
- ref: a,
121
- className: d(
122
- "text-foreground-subtle px-2 py-1.5 text-xs font-medium",
123
- t && "pl-8",
124
- e
125
- ),
126
- ...n
127
- }
128
- );
76
+ b.displayName = "DropdownMenuRadioItem";
77
+ var x = i(function({ className: t, inset: n, ...r }, i) {
78
+ return /* @__PURE__ */ a(s.Label, {
79
+ ref: i,
80
+ className: e("text-foreground-subtle px-2 py-1.5 text-xs font-medium", n && "pl-8", t),
81
+ ...r
82
+ });
129
83
  });
130
- N.displayName = "DropdownMenuLabel";
131
- const C = i(function({ className: e, ...t }, n) {
132
- return /* @__PURE__ */ r(
133
- o.Separator,
134
- {
135
- ref: n,
136
- className: d("bg-border -mx-1 my-1 h-px", e),
137
- ...t
138
- }
139
- );
84
+ x.displayName = "DropdownMenuLabel";
85
+ var S = i(function({ className: t, ...n }, r) {
86
+ return /* @__PURE__ */ a(s.Separator, {
87
+ ref: r,
88
+ className: e("bg-border -mx-1 my-1 h-px", t),
89
+ ...n
90
+ });
140
91
  });
141
- C.displayName = "DropdownMenuSeparator";
142
- function I({ className: s, ...e }) {
143
- return /* @__PURE__ */ r(
144
- "span",
145
- {
146
- className: d("text-foreground-subtle ml-auto font-mono text-xs tracking-widest", s),
147
- ...e
148
- }
149
- );
92
+ S.displayName = "DropdownMenuSeparator";
93
+ function C({ className: t, ...n }) {
94
+ return /* @__PURE__ */ a("span", {
95
+ className: e("text-foreground-subtle ml-auto font-mono text-xs tracking-widest", t),
96
+ ...n
97
+ });
150
98
  }
151
- I.displayName = "DropdownMenuShortcut";
152
- export {
153
- R as DropdownMenu,
154
- M as DropdownMenuCheckboxItem,
155
- h as DropdownMenuContent,
156
- T as DropdownMenuGroup,
157
- D as DropdownMenuItem,
158
- N as DropdownMenuLabel,
159
- g as DropdownMenuPortal,
160
- G as DropdownMenuRadioGroup,
161
- x as DropdownMenuRadioItem,
162
- C as DropdownMenuSeparator,
163
- I as DropdownMenuShortcut,
164
- j as DropdownMenuSub,
165
- w as DropdownMenuSubContent,
166
- b as DropdownMenuSubTrigger,
167
- k as DropdownMenuTrigger
168
- };
169
- //# sourceMappingURL=DropdownMenu.js.map
99
+ C.displayName = "DropdownMenuShortcut";
100
+ //#endregion
101
+ export { c as DropdownMenu, y as DropdownMenuCheckboxItem, _ as DropdownMenuContent, u as DropdownMenuGroup, v as DropdownMenuItem, x as DropdownMenuLabel, d as DropdownMenuPortal, p as DropdownMenuRadioGroup, b as DropdownMenuRadioItem, S as DropdownMenuSeparator, C as DropdownMenuShortcut, f as DropdownMenuSub, g as DropdownMenuSubContent, h as DropdownMenuSubTrigger, l as DropdownMenuTrigger };
102
+
103
+ //# sourceMappingURL=DropdownMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenu.js","sources":["../../../src/components/ui/DropdownMenu.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type HTMLAttributes,\n} from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { Check, ChevronRight, Circle } from '@/icons';\nimport { cn } from '@/lib/utils';\n\n/* -----------------------------------------------------------------------------\n * Full dropdown menu surface with submenu support, separators, checkbox /\n * radio items, and keyboard shortcut labels (Kbd).\n * --------------------------------------------------------------------------- */\n\nexport const DropdownMenu = DropdownMenuPrimitive.Root;\nexport const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nexport const DropdownMenuGroup = DropdownMenuPrimitive.Group;\nexport const DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nexport const DropdownMenuSub = DropdownMenuPrimitive.Sub;\nexport const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst itemClasses = cn(\n 'relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-foreground outline-none',\n 'data-[highlighted]:bg-background-muted data-[highlighted]:text-foreground',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n 'transition-colors duration-[var(--duration-fast)]',\n);\n\nexport const DropdownMenuSubTrigger = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(function DropdownMenuSubTrigger({ className, inset, children, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n itemClasses,\n 'data-[state=open]:bg-background-muted',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"text-foreground-subtle ml-auto size-4\" aria-hidden />\n </DropdownMenuPrimitive.SubTrigger>\n );\n});\nDropdownMenuSubTrigger.displayName = 'DropdownMenuSubTrigger';\n\nexport const DropdownMenuSubContent = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(function DropdownMenuSubContent({ className, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[8rem] overflow-hidden rounded-lg border p-1 shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n className,\n )}\n {...props}\n />\n );\n});\nDropdownMenuSubContent.displayName = 'DropdownMenuSubContent';\n\nexport const DropdownMenuContent = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Content>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n // `align` defaults to 'end' (Radix default is 'center'): triggers are\n // usually right-aligned icon buttons in toolbars/table rows. Pass\n // `align=\"start\"` for left-anchored triggers.\n>(function DropdownMenuContent({ className, sideOffset = 4, align = 'end', ...props }, ref) {\n return (\n <DropdownMenuPortal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n align={align}\n className={cn(\n 'border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[12rem] overflow-hidden rounded-lg border p-1 shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n 'data-[side=bottom]:slide-in-from-top-1 data-[side=top]:slide-in-from-bottom-1',\n className,\n )}\n {...props}\n />\n </DropdownMenuPortal>\n );\n});\nDropdownMenuContent.displayName = 'DropdownMenuContent';\n\nexport const DropdownMenuItem = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Item>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n destructive?: boolean;\n }\n>(function DropdownMenuItem({ className, inset, destructive, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n itemClasses,\n inset && 'pl-8',\n destructive &&\n 'text-danger-text data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger-text',\n className,\n )}\n {...props}\n />\n );\n});\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nexport const DropdownMenuCheckboxItem = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(function DropdownMenuCheckboxItem({ className, children, checked, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(itemClasses, 'pl-8', className)}\n {...props}\n >\n <span className=\"absolute left-2 flex size-4 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"text-accent size-4\" aria-hidden />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = 'DropdownMenuCheckboxItem';\n\nexport const DropdownMenuRadioItem = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(function DropdownMenuRadioItem({ className, children, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(itemClasses, 'pl-8', className)}\n {...props}\n >\n <span className=\"absolute left-2 flex size-4 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"fill-accent text-accent size-2\" aria-hidden />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = 'DropdownMenuRadioItem';\n\nexport const DropdownMenuLabel = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Label>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(function DropdownMenuLabel({ className, inset, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n 'text-foreground-subtle px-2 py-1.5 text-xs font-medium',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n );\n});\nDropdownMenuLabel.displayName = 'DropdownMenuLabel';\n\nexport const DropdownMenuSeparator = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(function DropdownMenuSeparator({ className, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('bg-border -mx-1 my-1 h-px', className)}\n {...props}\n />\n );\n});\nDropdownMenuSeparator.displayName = 'DropdownMenuSeparator';\n\n/**\n * Trailing right-aligned shortcut label inside a menu item. Pair with `<Kbd>`\n * inside the Kbd component file if you want stylised keys.\n */\nexport function DropdownMenuShortcut({ className, ...props }: HTMLAttributes<HTMLSpanElement>) {\n return (\n <span\n className={cn('text-foreground-subtle ml-auto font-mono text-xs tracking-widest', className)}\n {...props}\n />\n );\n}\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut';\n\n/**\n * @example\n * <DropdownMenu>\n * <DropdownMenuTrigger asChild><IconButton aria-label=\"More\" icon={<MoreHorizontal />} /></DropdownMenuTrigger>\n * <DropdownMenuContent>\n * <DropdownMenuItem>Open<DropdownMenuShortcut>⌘O</DropdownMenuShortcut></DropdownMenuItem>\n * <DropdownMenuItem>Rename</DropdownMenuItem>\n * <DropdownMenuSeparator />\n * <DropdownMenuItem destructive>Delete</DropdownMenuItem>\n * </DropdownMenuContent>\n * </DropdownMenu>\n *\n * @do Group destructive items at the bottom with a separator.\n * @dont Mix link navigation and action items in the same menu — split into\n * two menus or two groups with labels.\n */\n"],"names":["DropdownMenu","DropdownMenuPrimitive","DropdownMenuTrigger","DropdownMenuGroup","DropdownMenuPortal","DropdownMenuSub","DropdownMenuRadioGroup","itemClasses","cn","DropdownMenuSubTrigger","forwardRef","className","inset","children","props","ref","jsxs","jsx","ChevronRight","DropdownMenuSubContent","DropdownMenuContent","sideOffset","align","DropdownMenuItem","destructive","DropdownMenuCheckboxItem","checked","Check","DropdownMenuRadioItem","Circle","DropdownMenuLabel","DropdownMenuSeparator","DropdownMenuShortcut"],"mappings":"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"}
1
+ {"version":3,"file":"DropdownMenu.js","names":[],"sources":["../../../src/components/ui/DropdownMenu.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type HTMLAttributes,\n} from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { Check, ChevronRight, Circle } from '@/icons';\nimport { cn } from '@/lib/utils';\n\n/* -----------------------------------------------------------------------------\n * Full dropdown menu surface with submenu support, separators, checkbox /\n * radio items, and keyboard shortcut labels (Kbd).\n * --------------------------------------------------------------------------- */\n\nexport const DropdownMenu = DropdownMenuPrimitive.Root;\nexport const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nexport const DropdownMenuGroup = DropdownMenuPrimitive.Group;\nexport const DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nexport const DropdownMenuSub = DropdownMenuPrimitive.Sub;\nexport const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst itemClasses = cn(\n 'relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-foreground outline-none',\n 'data-[highlighted]:bg-background-muted data-[highlighted]:text-foreground',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n 'transition-colors duration-[var(--duration-fast)]',\n);\n\nexport const DropdownMenuSubTrigger = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(function DropdownMenuSubTrigger({ className, inset, children, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n itemClasses,\n 'data-[state=open]:bg-background-muted',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"text-foreground-subtle ml-auto size-4\" aria-hidden />\n </DropdownMenuPrimitive.SubTrigger>\n );\n});\nDropdownMenuSubTrigger.displayName = 'DropdownMenuSubTrigger';\n\nexport const DropdownMenuSubContent = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(function DropdownMenuSubContent({ className, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[8rem] overflow-hidden rounded-lg border p-1 shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n className,\n )}\n {...props}\n />\n );\n});\nDropdownMenuSubContent.displayName = 'DropdownMenuSubContent';\n\nexport const DropdownMenuContent = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Content>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n // `align` defaults to 'end' (Radix default is 'center'): triggers are\n // usually right-aligned icon buttons in toolbars/table rows. Pass\n // `align=\"start\"` for left-anchored triggers.\n>(function DropdownMenuContent({ className, sideOffset = 4, align = 'end', ...props }, ref) {\n return (\n <DropdownMenuPortal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n align={align}\n className={cn(\n 'border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[12rem] overflow-hidden rounded-lg border p-1 shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n 'data-[side=bottom]:slide-in-from-top-1 data-[side=top]:slide-in-from-bottom-1',\n className,\n )}\n {...props}\n />\n </DropdownMenuPortal>\n );\n});\nDropdownMenuContent.displayName = 'DropdownMenuContent';\n\nexport const DropdownMenuItem = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Item>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n destructive?: boolean;\n }\n>(function DropdownMenuItem({ className, inset, destructive, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n itemClasses,\n inset && 'pl-8',\n destructive &&\n 'text-danger-text data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger-text',\n className,\n )}\n {...props}\n />\n );\n});\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nexport const DropdownMenuCheckboxItem = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(function DropdownMenuCheckboxItem({ className, children, checked, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n checked={checked}\n className={cn(itemClasses, 'pl-8', className)}\n {...props}\n >\n <span className=\"absolute left-2 flex size-4 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"text-accent size-4\" aria-hidden />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = 'DropdownMenuCheckboxItem';\n\nexport const DropdownMenuRadioItem = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(function DropdownMenuRadioItem({ className, children, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(itemClasses, 'pl-8', className)}\n {...props}\n >\n <span className=\"absolute left-2 flex size-4 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"fill-accent text-accent size-2\" aria-hidden />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = 'DropdownMenuRadioItem';\n\nexport const DropdownMenuLabel = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Label>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(function DropdownMenuLabel({ className, inset, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n 'text-foreground-subtle px-2 py-1.5 text-xs font-medium',\n inset && 'pl-8',\n className,\n )}\n {...props}\n />\n );\n});\nDropdownMenuLabel.displayName = 'DropdownMenuLabel';\n\nexport const DropdownMenuSeparator = forwardRef<\n ElementRef<typeof DropdownMenuPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(function DropdownMenuSeparator({ className, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('bg-border -mx-1 my-1 h-px', className)}\n {...props}\n />\n );\n});\nDropdownMenuSeparator.displayName = 'DropdownMenuSeparator';\n\n/**\n * Trailing right-aligned shortcut label inside a menu item. Pair with `<Kbd>`\n * inside the Kbd component file if you want stylised keys.\n */\nexport function DropdownMenuShortcut({ className, ...props }: HTMLAttributes<HTMLSpanElement>) {\n return (\n <span\n className={cn('text-foreground-subtle ml-auto font-mono text-xs tracking-widest', className)}\n {...props}\n />\n );\n}\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut';\n\n/**\n * @example\n * <DropdownMenu>\n * <DropdownMenuTrigger asChild><IconButton aria-label=\"More\" icon={<MoreHorizontal />} /></DropdownMenuTrigger>\n * <DropdownMenuContent>\n * <DropdownMenuItem>Open<DropdownMenuShortcut>⌘O</DropdownMenuShortcut></DropdownMenuItem>\n * <DropdownMenuItem>Rename</DropdownMenuItem>\n * <DropdownMenuSeparator />\n * <DropdownMenuItem destructive>Delete</DropdownMenuItem>\n * </DropdownMenuContent>\n * </DropdownMenu>\n *\n * @do Group destructive items at the bottom with a separator.\n * @dont Mix link navigation and action items in the same menu — split into\n * two menus or two groups with labels.\n */\n"],"mappings":";;;;;;;AAiBA,IAAa,IAAe,EAAsB,MACrC,IAAsB,EAAsB,SAC5C,IAAoB,EAAsB,OAC1C,IAAqB,EAAsB,QAC3C,IAAkB,EAAsB,KACxC,IAAyB,EAAsB,YAEtD,IAAc,EAClB,2HACA,6EACA,kEACA,mDACF,GAEa,IAAyB,EAKpC,SAAgC,EAAE,cAAW,UAAO,aAAU,GAAG,KAAS,GAAK;CAC/E,OACE,kBAAC,EAAsB,YAAvB;EACO;EACL,WAAW,EACT,GACA,yCACA,KAAS,QACT,CACF;EACA,GAAI;EARN,UAAA,CAUG,GACD,kBAAC,GAAD;GAAc,WAAU;GAAwC,eAAA;EAAa,CAAA,CAC7C;;AAEtC,CAAC;AACD,EAAuB,cAAc;AAErC,IAAa,IAAyB,EAGpC,SAAgC,EAAE,cAAW,GAAG,KAAS,GAAK;CAC9D,OACE,kBAAC,EAAsB,YAAvB;EACO;EACL,WAAW,EACT,sIACA,gEACA,8DACA,gEACA,CACF;EACA,GAAI;CACL,CAAA;AAEL,CAAC;AACD,EAAuB,cAAc;AAErC,IAAa,IAAsB,EAMjC,SAA6B,EAAE,cAAW,gBAAa,GAAG,WAAQ,OAAO,GAAG,KAAS,GAAK;CAC1F,OACE,kBAAC,GAAD,EAAA,UACE,kBAAC,EAAsB,SAAvB;EACO;EACO;EACL;EACP,WAAW,EACT,uIACA,gEACA,8DACA,gEACA,iFACA,CACF;EACA,GAAI;CACL,CAAA,EACiB,CAAA;AAExB,CAAC;AACD,EAAoB,cAAc;AAElC,IAAa,IAAmB,EAM9B,SAA0B,EAAE,cAAW,UAAO,gBAAa,GAAG,KAAS,GAAK;CAC5E,OACE,kBAAC,EAAsB,MAAvB;EACO;EACL,WAAW,EACT,GACA,KAAS,QACT,KACE,0FACF,CACF;EACA,GAAI;CACL,CAAA;AAEL,CAAC;AACD,EAAiB,cAAc;AAE/B,IAAa,IAA2B,EAGtC,SAAkC,EAAE,cAAW,aAAU,YAAS,GAAG,KAAS,GAAK;CACnF,OACE,kBAAC,EAAsB,cAAvB;EACO;EACI;EACT,WAAW,EAAG,GAAa,QAAQ,CAAS;EAC5C,GAAI;EAJN,UAAA,CAME,kBAAC,QAAD;GAAM,WAAU;GACd,UAAA,kBAAC,EAAsB,eAAvB,EAAA,UACE,kBAAC,GAAD;IAAO,WAAU;IAAqB,eAAA;GAAa,CAAA,EAChB,CAAA;EACjC,CAAA,GACL,CACiC;;AAExC,CAAC;AACD,EAAyB,cAAc;AAEvC,IAAa,IAAwB,EAGnC,SAA+B,EAAE,cAAW,aAAU,GAAG,KAAS,GAAK;CACvE,OACE,kBAAC,EAAsB,WAAvB;EACO;EACL,WAAW,EAAG,GAAa,QAAQ,CAAS;EAC5C,GAAI;EAHN,UAAA,CAKE,kBAAC,QAAD;GAAM,WAAU;GACd,UAAA,kBAAC,EAAsB,eAAvB,EAAA,UACE,kBAAC,GAAD;IAAQ,WAAU;IAAiC,eAAA;GAAa,CAAA,EAC7B,CAAA;EACjC,CAAA,GACL,CAC8B;;AAErC,CAAC;AACD,EAAsB,cAAc;AAEpC,IAAa,IAAoB,EAK/B,SAA2B,EAAE,cAAW,UAAO,GAAG,KAAS,GAAK;CAChE,OACE,kBAAC,EAAsB,OAAvB;EACO;EACL,WAAW,EACT,0DACA,KAAS,QACT,CACF;EACA,GAAI;CACL,CAAA;AAEL,CAAC;AACD,EAAkB,cAAc;AAEhC,IAAa,IAAwB,EAGnC,SAA+B,EAAE,cAAW,GAAG,KAAS,GAAK;CAC7D,OACE,kBAAC,EAAsB,WAAvB;EACO;EACL,WAAW,EAAG,6BAA6B,CAAS;EACpD,GAAI;CACL,CAAA;AAEL,CAAC;AACD,EAAsB,cAAc;AAMpC,SAAgB,EAAqB,EAAE,cAAW,GAAG,KAA0C;CAC7F,OACE,kBAAC,QAAD;EACE,WAAW,EAAG,oEAAoE,CAAS;EAC3F,GAAI;CACL,CAAA;AAEL;AACA,EAAqB,cAAc"}
@@ -1,46 +1,33 @@
1
1
  "use client";
2
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
3
- import { forwardRef as f, createElement as u } from "react";
4
- import { cn as x } from "../../lib/utils.js";
5
- import { InboxEmpty as g } from "../../illustrations/index.js";
6
- const p = f(function({
7
- icon: t,
8
- illustration: r,
9
- title: l,
10
- description: m,
11
- action: d,
12
- secondaryAction: s,
13
- headingLevel: n = 3,
14
- className: o,
15
- ...i
16
- }, c) {
17
- return /* @__PURE__ */ a(
18
- "div",
19
- {
20
- ref: c,
21
- className: x(
22
- "border-border bg-background-subtle flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed p-10 text-center",
23
- o
24
- ),
25
- ...i,
26
- children: [
27
- r || (t ? /* @__PURE__ */ e("div", { className: "bg-background-muted text-foreground-muted inline-flex size-12 items-center justify-center rounded-full [&_svg]:size-6", children: t }) : /* @__PURE__ */ e(g, { className: "size-24" })),
28
- u(
29
- `h${n}`,
30
- { className: "text-base font-semibold text-foreground leading-tight" },
31
- l
32
- ),
33
- m && /* @__PURE__ */ e("p", { className: "text-foreground-muted max-w-md text-sm leading-relaxed", children: m }),
34
- (d || s) && /* @__PURE__ */ a("div", { className: "mt-2 flex items-center gap-2", children: [
35
- d,
36
- s
37
- ] })
38
- ]
39
- }
40
- );
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { InboxEmpty as t } from "../../illustrations/index.js";
4
+ import { createElement as n, forwardRef as r } from "react";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region src/components/ui/EmptyState.tsx
7
+ var o = r(function({ icon: r, illustration: o, title: s, description: c, action: l, secondaryAction: u, headingLevel: d = 3, className: f, ...p }, m) {
8
+ return /* @__PURE__ */ a("div", {
9
+ ref: m,
10
+ className: e("border-border bg-background-subtle flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed p-10 text-center", f),
11
+ ...p,
12
+ children: [
13
+ o || (r ? /* @__PURE__ */ i("div", {
14
+ className: "bg-background-muted text-foreground-muted inline-flex size-12 items-center justify-center rounded-full [&_svg]:size-6",
15
+ children: r
16
+ }) : /* @__PURE__ */ i(t, { className: "size-24" })),
17
+ n(`h${d}`, { className: "text-base font-semibold text-foreground leading-tight" }, s),
18
+ c && /* @__PURE__ */ i("p", {
19
+ className: "text-foreground-muted max-w-md text-sm leading-relaxed",
20
+ children: c
21
+ }),
22
+ (l || u) && /* @__PURE__ */ a("div", {
23
+ className: "mt-2 flex items-center gap-2",
24
+ children: [l, u]
25
+ })
26
+ ]
27
+ });
41
28
  });
42
- p.displayName = "EmptyState";
43
- export {
44
- p as EmptyState
45
- };
46
- //# sourceMappingURL=EmptyState.js.map
29
+ o.displayName = "EmptyState";
30
+ //#endregion
31
+ export { o as EmptyState };
32
+
33
+ //# sourceMappingURL=EmptyState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState.js","sources":["../../../src/components/ui/EmptyState.tsx"],"sourcesContent":["'use client';\n\nimport { createElement, forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\nimport { InboxEmpty } from '@/illustrations';\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /**\n * Small Lucide-sized icon rendered inside a 48px circular container.\n * Use for compact empty states (table cells, sidebar panes, cards).\n */\n icon?: ReactNode;\n /**\n * Full-size illustration rendered without the icon container. Takes\n * precedence over `icon`. If neither is set, the default `InboxEmpty`\n * line illustration is used.\n */\n illustration?: ReactNode;\n /** Heading. One short sentence. */\n title: ReactNode;\n /** Description. One or two sentences max. */\n description?: ReactNode;\n /** Primary action — usually a `<Button>` that creates the missing item. */\n action?: ReactNode;\n /** Secondary helper link — \"Learn more\", \"Import existing\", etc. */\n secondaryAction?: ReactNode;\n /** Heading level of the title. Default 3 — match the surrounding outline. */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n}\n\n/**\n * Shown when a list / dataset / surface has no content yet. Tone is helpful,\n * never apologetic.\n *\n * @example Default — uses the built-in InboxEmpty illustration\n * <EmptyState\n * title=\"No projects yet\"\n * description=\"Create a project to start tracking work.\"\n * action={<Button>New project</Button>}\n * />\n *\n * @example Compact — small Lucide icon for dense layouts\n * <EmptyState\n * icon={<Folder className=\"size-6\" />}\n * title=\"No items\"\n * />\n *\n * @example Custom illustration\n * <EmptyState\n * illustration={<Illustrations.NoSearchResults className=\"size-32\" />}\n * title=\"No results\"\n * />\n */\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n {\n icon,\n illustration,\n title,\n description,\n action,\n secondaryAction,\n headingLevel = 3,\n className,\n ...props\n },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cn(\n 'border-border bg-background-subtle flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed p-10 text-center',\n className,\n )}\n {...props}\n >\n {/* Visual: illustration > icon > default illustration */}\n {illustration ? (\n illustration\n ) : icon ? (\n <div className=\"bg-background-muted text-foreground-muted inline-flex size-12 items-center justify-center rounded-full [&_svg]:size-6\">\n {icon}\n </div>\n ) : (\n <InboxEmpty className=\"size-24\" />\n )}\n {createElement(\n `h${headingLevel}`,\n { className: 'text-base font-semibold text-foreground leading-tight' },\n title,\n )}\n {description && (\n <p className=\"text-foreground-muted max-w-md text-sm leading-relaxed\">{description}</p>\n )}\n {(action || secondaryAction) && (\n <div className=\"mt-2 flex items-center gap-2\">\n {action}\n {secondaryAction}\n </div>\n )}\n </div>\n );\n});\nEmptyState.displayName = 'EmptyState';\n"],"names":["EmptyState","forwardRef","icon","illustration","title","description","action","secondaryAction","headingLevel","className","props","ref","jsxs","cn","jsx","InboxEmpty","createElement"],"mappings":";;;;;AAqDO,MAAMA,IAAaC,EAA4C,SACpE;AAAA,EACE,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,WAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,WAAWE;AAAA,QACT;AAAA,QACAJ;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,MAGH,UAAA;AAAA,QAAAP,MAEGD,IACF,gBAAAY,EAAC,OAAA,EAAI,WAAU,yHACZ,UAAAZ,EAAA,CACH,IAEA,gBAAAY,EAACC,GAAA,EAAW,WAAU,WAAU;AAAA,QAEjCC;AAAA,UACC,IAAIR,CAAY;AAAA,UAChB,EAAE,WAAW,wDAAA;AAAA,UACbJ;AAAA,QAAA;AAAA,QAEDC,KACC,gBAAAS,EAAC,KAAA,EAAE,WAAU,0DAA0D,UAAAT,GAAY;AAAA,SAEnFC,KAAUC,MACV,gBAAAK,EAAC,OAAA,EAAI,WAAU,gCACZ,UAAA;AAAA,UAAAN;AAAA,UACAC;AAAA,QAAA,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;AACDP,EAAW,cAAc;"}
1
+ {"version":3,"file":"EmptyState.js","names":[],"sources":["../../../src/components/ui/EmptyState.tsx"],"sourcesContent":["'use client';\n\nimport { createElement, forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\nimport { InboxEmpty } from '@/illustrations';\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /**\n * Small Lucide-sized icon rendered inside a 48px circular container.\n * Use for compact empty states (table cells, sidebar panes, cards).\n */\n icon?: ReactNode;\n /**\n * Full-size illustration rendered without the icon container. Takes\n * precedence over `icon`. If neither is set, the default `InboxEmpty`\n * line illustration is used.\n */\n illustration?: ReactNode;\n /** Heading. One short sentence. */\n title: ReactNode;\n /** Description. One or two sentences max. */\n description?: ReactNode;\n /** Primary action — usually a `<Button>` that creates the missing item. */\n action?: ReactNode;\n /** Secondary helper link — \"Learn more\", \"Import existing\", etc. */\n secondaryAction?: ReactNode;\n /** Heading level of the title. Default 3 — match the surrounding outline. */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n}\n\n/**\n * Shown when a list / dataset / surface has no content yet. Tone is helpful,\n * never apologetic.\n *\n * @example Default — uses the built-in InboxEmpty illustration\n * <EmptyState\n * title=\"No projects yet\"\n * description=\"Create a project to start tracking work.\"\n * action={<Button>New project</Button>}\n * />\n *\n * @example Compact — small Lucide icon for dense layouts\n * <EmptyState\n * icon={<Folder className=\"size-6\" />}\n * title=\"No items\"\n * />\n *\n * @example Custom illustration\n * <EmptyState\n * illustration={<Illustrations.NoSearchResults className=\"size-32\" />}\n * title=\"No results\"\n * />\n */\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n {\n icon,\n illustration,\n title,\n description,\n action,\n secondaryAction,\n headingLevel = 3,\n className,\n ...props\n },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cn(\n 'border-border bg-background-subtle flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed p-10 text-center',\n className,\n )}\n {...props}\n >\n {/* Visual: illustration > icon > default illustration */}\n {illustration ? (\n illustration\n ) : icon ? (\n <div className=\"bg-background-muted text-foreground-muted inline-flex size-12 items-center justify-center rounded-full [&_svg]:size-6\">\n {icon}\n </div>\n ) : (\n <InboxEmpty className=\"size-24\" />\n )}\n {createElement(\n `h${headingLevel}`,\n { className: 'text-base font-semibold text-foreground leading-tight' },\n title,\n )}\n {description && (\n <p className=\"text-foreground-muted max-w-md text-sm leading-relaxed\">{description}</p>\n )}\n {(action || secondaryAction) && (\n <div className=\"mt-2 flex items-center gap-2\">\n {action}\n {secondaryAction}\n </div>\n )}\n </div>\n );\n});\nEmptyState.displayName = 'EmptyState';\n"],"mappings":";;;;;;AAqDA,IAAa,IAAa,EAA4C,SACpE,EACE,SACA,iBACA,UACA,gBACA,WACA,oBACA,kBAAe,GACf,cACA,GAAG,KAEL,GACA;CACA,OACE,kBAAC,OAAD;EACO;EACL,WAAW,EACT,uIACA,CACF;EACA,GAAI;EANN,UAAA;GASG,MAEG,IACF,kBAAC,OAAD;IAAK,WAAU;IACZ,UAAA;GACE,CAAA,IAEL,kBAAC,GAAD,EAAY,WAAU,UAAW,CAAA;GAElC,EACC,IAAI,KACJ,EAAE,WAAW,wDAAwD,GACrE,CACF;GACC,KACC,kBAAC,KAAD;IAAG,WAAU;IAA0D,UAAA;GAAe,CAAA;IAEtF,KAAU,MACV,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,GACA,CACE;;EAEJ;;AAET,CAAC;AACD,EAAW,cAAc"}
@@ -1,69 +1,59 @@
1
1
  "use client";
2
- import { jsxs as g, jsx as r } from "react/jsx-runtime";
3
- import { forwardRef as S, createElement as x } from "react";
4
- import { cn as b } from "../../lib/utils.js";
5
- import { useStrings as N } from "../../hooks/use-strings.js";
6
- import { ConnectionLost as v, ServerError as h, NotFound as E, Locked as z } from "../../illustrations/index.js";
7
- import { Button as D } from "./Button.js";
8
- const T = (e) => ({
9
- 403: {
10
- illustration: /* @__PURE__ */ r(z, { className: "size-32" }),
11
- title: e.errorState.forbiddenTitle,
12
- description: e.errorState.forbiddenDescription
13
- },
14
- 404: {
15
- illustration: /* @__PURE__ */ r(E, { className: "size-32" }),
16
- title: e.errorState.notFoundTitle,
17
- description: e.errorState.notFoundDescription
18
- },
19
- 500: {
20
- illustration: /* @__PURE__ */ r(h, { className: "size-32" }),
21
- title: e.errorState.serverTitle,
22
- description: e.errorState.serverDescription
23
- },
24
- generic: {
25
- illustration: /* @__PURE__ */ r(v, { className: "size-32" }),
26
- title: e.errorState.genericTitle,
27
- description: e.errorState.genericDescription
28
- }
29
- }), j = S(function({
30
- variant: s = "generic",
31
- title: a,
32
- description: l,
33
- illustration: c,
34
- action: i,
35
- onRetry: o,
36
- headingLevel: d = 3,
37
- live: m,
38
- className: p,
39
- ...u
40
- }, f) {
41
- const n = N(), t = T(n)[s];
42
- return /* @__PURE__ */ g(
43
- "div",
44
- {
45
- ref: f,
46
- className: b(
47
- "border-border bg-background-subtle flex flex-col items-center justify-center gap-3 rounded-lg border p-10 text-center",
48
- p
49
- ),
50
- "aria-live": m ? "polite" : void 0,
51
- ...u,
52
- children: [
53
- c ?? t.illustration,
54
- x(
55
- `h${d}`,
56
- { className: "text-base font-semibold text-foreground leading-tight" },
57
- a ?? t.title
58
- ),
59
- /* @__PURE__ */ r("p", { className: "text-foreground-muted max-w-md text-sm leading-relaxed", children: l ?? t.description }),
60
- (i || o) && /* @__PURE__ */ r("div", { className: "mt-2 flex items-center gap-2", children: i ?? /* @__PURE__ */ r(D, { onClick: o, variant: "outline", children: n.errorState.tryAgain }) })
61
- ]
62
- }
63
- );
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { useStrings as t } from "../../hooks/use-strings.js";
4
+ import { ConnectionLost as n, Locked as r, NotFound as i, ServerError as a } from "../../illustrations/index.js";
5
+ import { Button as o } from "./Button.js";
6
+ import { createElement as s, forwardRef as c } from "react";
7
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
+ //#region src/components/ui/ErrorState.tsx
9
+ var d = (e) => ({
10
+ 403: {
11
+ illustration: /* @__PURE__ */ l(r, { className: "size-32" }),
12
+ title: e.errorState.forbiddenTitle,
13
+ description: e.errorState.forbiddenDescription
14
+ },
15
+ 404: {
16
+ illustration: /* @__PURE__ */ l(i, { className: "size-32" }),
17
+ title: e.errorState.notFoundTitle,
18
+ description: e.errorState.notFoundDescription
19
+ },
20
+ 500: {
21
+ illustration: /* @__PURE__ */ l(a, { className: "size-32" }),
22
+ title: e.errorState.serverTitle,
23
+ description: e.errorState.serverDescription
24
+ },
25
+ generic: {
26
+ illustration: /* @__PURE__ */ l(n, { className: "size-32" }),
27
+ title: e.errorState.genericTitle,
28
+ description: e.errorState.genericDescription
29
+ }
30
+ }), f = c(function({ variant: n = "generic", title: r, description: i, illustration: a, action: c, onRetry: f, headingLevel: p = 3, live: m, className: h, ...g }, _) {
31
+ let v = t(), y = d(v)[n];
32
+ return /* @__PURE__ */ u("div", {
33
+ ref: _,
34
+ className: e("border-border bg-background-subtle flex flex-col items-center justify-center gap-3 rounded-lg border p-10 text-center", h),
35
+ "aria-live": m ? "polite" : void 0,
36
+ ...g,
37
+ children: [
38
+ a ?? y.illustration,
39
+ s(`h${p}`, { className: "text-base font-semibold text-foreground leading-tight" }, r ?? y.title),
40
+ /* @__PURE__ */ l("p", {
41
+ className: "text-foreground-muted max-w-md text-sm leading-relaxed",
42
+ children: i ?? y.description
43
+ }),
44
+ (c || f) && /* @__PURE__ */ l("div", {
45
+ className: "mt-2 flex items-center gap-2",
46
+ children: c ?? /* @__PURE__ */ l(o, {
47
+ onClick: f,
48
+ variant: "outline",
49
+ children: v.errorState.tryAgain
50
+ })
51
+ })
52
+ ]
53
+ });
64
54
  });
65
- j.displayName = "ErrorState";
66
- export {
67
- j as ErrorState
68
- };
69
- //# sourceMappingURL=ErrorState.js.map
55
+ f.displayName = "ErrorState";
56
+ //#endregion
57
+ export { f as ErrorState };
58
+
59
+ //# sourceMappingURL=ErrorState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorState.js","sources":["../../../src/components/ui/ErrorState.tsx"],"sourcesContent":["'use client';\n\nimport { createElement, forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\nimport type { UiStrings } from '@/lib/strings';\nimport { NotFound, ServerError, ConnectionLost, Locked } from '@/illustrations';\nimport { Button } from './Button';\n\nexport interface ErrorStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** `403` permission-denied, `404` not-found, `500` server, or `generic` (catch-all). */\n variant?: '403' | '404' | '500' | 'generic';\n /** Override the default title. */\n title?: ReactNode;\n /** Override the default description. */\n description?: ReactNode;\n /**\n * Override the variant's default illustration. Pass any ReactNode (e.g.\n * `<Illustrations.Construction className=\"size-32\" />`).\n */\n illustration?: ReactNode;\n /** Custom action node. Replaces the default retry button. */\n action?: ReactNode;\n /** When provided, renders a default \"Try again\" button calling this handler. */\n onRetry?: () => void;\n /** Heading level of the title. Default 3 — match the surrounding outline. */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n /**\n * Announce the error politely when it appears in-place (e.g. a failed\n * refetch inside a panel). Off by default — page-level errors are read as\n * part of the page and must not double-announce.\n */\n live?: boolean;\n}\n\nconst presets = (s: UiStrings) => ({\n '403': {\n illustration: <Locked className=\"size-32\" />,\n title: s.errorState.forbiddenTitle,\n description: s.errorState.forbiddenDescription,\n },\n '404': {\n illustration: <NotFound className=\"size-32\" />,\n title: s.errorState.notFoundTitle,\n description: s.errorState.notFoundDescription,\n },\n '500': {\n illustration: <ServerError className=\"size-32\" />,\n title: s.errorState.serverTitle,\n description: s.errorState.serverDescription,\n },\n generic: {\n illustration: <ConnectionLost className=\"size-32\" />,\n title: s.errorState.genericTitle,\n description: s.errorState.genericDescription,\n },\n});\n\n/**\n * Page-level error placeholder. Pair with `onRetry` for transient failures.\n *\n * @example 404 (uses built-in line illustration)\n * <ErrorState variant=\"404\" />\n *\n * @example 500 with retry\n * <ErrorState variant=\"500\" onRetry={refetch} />\n *\n * @example 403 with a way out (no retry — permission won't change on reload)\n * <ErrorState variant=\"403\" action={<Button variant=\"outline\" asChild><a href=\"/\">Go home</a></Button>} />\n *\n * @example Custom\n * <ErrorState\n * title=\"Quota exceeded\"\n * description=\"Your plan allows 1,000 events/day.\"\n * illustration={<Illustrations.Construction className=\"size-32\" />}\n * action={<Button>Upgrade plan</Button>}\n * />\n *\n * @do Match the tone to the cause — server errors apologise, user errors\n * explain. Always offer a next step.\n * @dont Show a raw stack trace to end users.\n */\nexport const ErrorState = forwardRef<HTMLDivElement, ErrorStateProps>(function ErrorState(\n {\n variant = 'generic',\n title,\n description,\n illustration,\n action,\n onRetry,\n headingLevel = 3,\n live,\n className,\n ...props\n },\n ref,\n) {\n const strings = useStrings();\n const preset = presets(strings)[variant];\n return (\n <div\n ref={ref}\n className={cn(\n 'border-border bg-background-subtle flex flex-col items-center justify-center gap-3 rounded-lg border p-10 text-center',\n className,\n )}\n aria-live={live ? 'polite' : undefined}\n {...props}\n >\n {illustration ?? preset.illustration}\n {createElement(\n `h${headingLevel}`,\n { className: 'text-base font-semibold text-foreground leading-tight' },\n title ?? preset.title,\n )}\n <p className=\"text-foreground-muted max-w-md text-sm leading-relaxed\">\n {description ?? preset.description}\n </p>\n {(action || onRetry) && (\n <div className=\"mt-2 flex items-center gap-2\">\n {action ?? (\n <Button onClick={onRetry} variant=\"outline\">\n {strings.errorState.tryAgain}\n </Button>\n )}\n </div>\n )}\n </div>\n );\n});\nErrorState.displayName = 'ErrorState';\n"],"names":["presets","s","jsx","Locked","NotFound","ServerError","ConnectionLost","ErrorState","forwardRef","variant","title","description","illustration","action","onRetry","headingLevel","live","className","props","ref","strings","useStrings","preset","jsxs","cn","createElement","Button"],"mappings":";;;;;;;AAmCA,MAAMA,IAAU,CAACC,OAAkB;AAAA,EACjC,KAAO;AAAA,IACL,cAAc,gBAAAC,EAACC,GAAA,EAAO,WAAU,UAAA,CAAU;AAAA,IAC1C,OAAOF,EAAE,WAAW;AAAA,IACpB,aAAaA,EAAE,WAAW;AAAA,EAAA;AAAA,EAE5B,KAAO;AAAA,IACL,cAAc,gBAAAC,EAACE,GAAA,EAAS,WAAU,UAAA,CAAU;AAAA,IAC5C,OAAOH,EAAE,WAAW;AAAA,IACpB,aAAaA,EAAE,WAAW;AAAA,EAAA;AAAA,EAE5B,KAAO;AAAA,IACL,cAAc,gBAAAC,EAACG,GAAA,EAAY,WAAU,UAAA,CAAU;AAAA,IAC/C,OAAOJ,EAAE,WAAW;AAAA,IACpB,aAAaA,EAAE,WAAW;AAAA,EAAA;AAAA,EAE5B,SAAS;AAAA,IACP,cAAc,gBAAAC,EAACI,GAAA,EAAe,WAAU,UAAA,CAAU;AAAA,IAClD,OAAOL,EAAE,WAAW;AAAA,IACpB,aAAaA,EAAE,WAAW;AAAA,EAAA;AAE9B,IA0BaM,IAAaC,EAA4C,SACpE;AAAA,EACE,SAAAC,IAAU;AAAA,EACV,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAUC,EAAA,GACVC,IAAStB,EAAQoB,CAAO,EAAEX,CAAO;AACvC,SACE,gBAAAc;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAJ;AAAA,MACA,WAAWK;AAAA,QACT;AAAA,QACAP;AAAA,MAAA;AAAA,MAEF,aAAWD,IAAO,WAAW;AAAA,MAC5B,GAAGE;AAAA,MAEH,UAAA;AAAA,QAAAN,KAAgBU,EAAO;AAAA,QACvBG;AAAA,UACC,IAAIV,CAAY;AAAA,UAChB,EAAE,WAAW,wDAAA;AAAA,UACbL,KAASY,EAAO;AAAA,QAAA;AAAA,0BAEjB,KAAA,EAAE,WAAU,0DACV,UAAAX,KAAeW,EAAO,aACzB;AAAA,SACET,KAAUC,MACV,gBAAAZ,EAAC,OAAA,EAAI,WAAU,gCACZ,UAAAW,KACC,gBAAAX,EAACwB,GAAA,EAAO,SAASZ,GAAS,SAAQ,WAC/B,UAAAM,EAAQ,WAAW,UACtB,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;AACDb,EAAW,cAAc;"}
1
+ {"version":3,"file":"ErrorState.js","names":[],"sources":["../../../src/components/ui/ErrorState.tsx"],"sourcesContent":["'use client';\n\nimport { createElement, forwardRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\nimport type { UiStrings } from '@/lib/strings';\nimport { NotFound, ServerError, ConnectionLost, Locked } from '@/illustrations';\nimport { Button } from './Button';\n\nexport interface ErrorStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** `403` permission-denied, `404` not-found, `500` server, or `generic` (catch-all). */\n variant?: '403' | '404' | '500' | 'generic';\n /** Override the default title. */\n title?: ReactNode;\n /** Override the default description. */\n description?: ReactNode;\n /**\n * Override the variant's default illustration. Pass any ReactNode (e.g.\n * `<Illustrations.Construction className=\"size-32\" />`).\n */\n illustration?: ReactNode;\n /** Custom action node. Replaces the default retry button. */\n action?: ReactNode;\n /** When provided, renders a default \"Try again\" button calling this handler. */\n onRetry?: () => void;\n /** Heading level of the title. Default 3 — match the surrounding outline. */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n /**\n * Announce the error politely when it appears in-place (e.g. a failed\n * refetch inside a panel). Off by default — page-level errors are read as\n * part of the page and must not double-announce.\n */\n live?: boolean;\n}\n\nconst presets = (s: UiStrings) => ({\n '403': {\n illustration: <Locked className=\"size-32\" />,\n title: s.errorState.forbiddenTitle,\n description: s.errorState.forbiddenDescription,\n },\n '404': {\n illustration: <NotFound className=\"size-32\" />,\n title: s.errorState.notFoundTitle,\n description: s.errorState.notFoundDescription,\n },\n '500': {\n illustration: <ServerError className=\"size-32\" />,\n title: s.errorState.serverTitle,\n description: s.errorState.serverDescription,\n },\n generic: {\n illustration: <ConnectionLost className=\"size-32\" />,\n title: s.errorState.genericTitle,\n description: s.errorState.genericDescription,\n },\n});\n\n/**\n * Page-level error placeholder. Pair with `onRetry` for transient failures.\n *\n * @example 404 (uses built-in line illustration)\n * <ErrorState variant=\"404\" />\n *\n * @example 500 with retry\n * <ErrorState variant=\"500\" onRetry={refetch} />\n *\n * @example 403 with a way out (no retry — permission won't change on reload)\n * <ErrorState variant=\"403\" action={<Button variant=\"outline\" asChild><a href=\"/\">Go home</a></Button>} />\n *\n * @example Custom\n * <ErrorState\n * title=\"Quota exceeded\"\n * description=\"Your plan allows 1,000 events/day.\"\n * illustration={<Illustrations.Construction className=\"size-32\" />}\n * action={<Button>Upgrade plan</Button>}\n * />\n *\n * @do Match the tone to the cause — server errors apologise, user errors\n * explain. Always offer a next step.\n * @dont Show a raw stack trace to end users.\n */\nexport const ErrorState = forwardRef<HTMLDivElement, ErrorStateProps>(function ErrorState(\n {\n variant = 'generic',\n title,\n description,\n illustration,\n action,\n onRetry,\n headingLevel = 3,\n live,\n className,\n ...props\n },\n ref,\n) {\n const strings = useStrings();\n const preset = presets(strings)[variant];\n return (\n <div\n ref={ref}\n className={cn(\n 'border-border bg-background-subtle flex flex-col items-center justify-center gap-3 rounded-lg border p-10 text-center',\n className,\n )}\n aria-live={live ? 'polite' : undefined}\n {...props}\n >\n {illustration ?? preset.illustration}\n {createElement(\n `h${headingLevel}`,\n { className: 'text-base font-semibold text-foreground leading-tight' },\n title ?? preset.title,\n )}\n <p className=\"text-foreground-muted max-w-md text-sm leading-relaxed\">\n {description ?? preset.description}\n </p>\n {(action || onRetry) && (\n <div className=\"mt-2 flex items-center gap-2\">\n {action ?? (\n <Button onClick={onRetry} variant=\"outline\">\n {strings.errorState.tryAgain}\n </Button>\n )}\n </div>\n )}\n </div>\n );\n});\nErrorState.displayName = 'ErrorState';\n"],"mappings":";;;;;;;;AAmCA,IAAM,KAAW,OAAkB;CACjC,KAAO;EACL,cAAc,kBAAC,GAAD,EAAQ,WAAU,UAAW,CAAA;EAC3C,OAAO,EAAE,WAAW;EACpB,aAAa,EAAE,WAAW;CAC5B;CACA,KAAO;EACL,cAAc,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA;EAC7C,OAAO,EAAE,WAAW;EACpB,aAAa,EAAE,WAAW;CAC5B;CACA,KAAO;EACL,cAAc,kBAAC,GAAD,EAAa,WAAU,UAAW,CAAA;EAChD,OAAO,EAAE,WAAW;EACpB,aAAa,EAAE,WAAW;CAC5B;CACA,SAAS;EACP,cAAc,kBAAC,GAAD,EAAgB,WAAU,UAAW,CAAA;EACnD,OAAO,EAAE,WAAW;EACpB,aAAa,EAAE,WAAW;CAC5B;AACF,IA0Ba,IAAa,EAA4C,SACpE,EACE,aAAU,WACV,UACA,gBACA,iBACA,WACA,YACA,kBAAe,GACf,SACA,cACA,GAAG,KAEL,GACA;CACA,IAAM,IAAU,EAAW,GACrB,IAAS,EAAQ,CAAO,CAAC,CAAC;CAChC,OACE,kBAAC,OAAD;EACO;EACL,WAAW,EACT,yHACA,CACF;EACA,aAAW,IAAO,WAAW,KAAA;EAC7B,GAAI;EAPN,UAAA;GASG,KAAgB,EAAO;GACvB,EACC,IAAI,KACJ,EAAE,WAAW,wDAAwD,GACrE,KAAS,EAAO,KAClB;GACA,kBAAC,KAAD;IAAG,WAAU;IACV,UAAA,KAAe,EAAO;GACtB,CAAA;IACD,KAAU,MACV,kBAAC,OAAD;IAAK,WAAU;IACZ,UAAA,KACC,kBAAC,GAAD;KAAQ,SAAS;KAAS,SAAQ;KAC/B,UAAA,EAAQ,WAAW;IACd,CAAA;GAEP,CAAA;EAEJ;;AAET,CAAC;AACD,EAAW,cAAc"}