@craftzbay/ui 0.11.3 → 0.11.4

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 (163) hide show
  1. package/dist-lib/_virtual/_rolldown/runtime.js +11 -0
  2. package/dist-lib/components/ui/Accordion.js +42 -67
  3. package/dist-lib/components/ui/Accordion.js.map +1 -1
  4. package/dist-lib/components/ui/Alert.js +71 -77
  5. package/dist-lib/components/ui/Alert.js.map +1 -1
  6. package/dist-lib/components/ui/Avatar.js +67 -92
  7. package/dist-lib/components/ui/Avatar.js.map +1 -1
  8. package/dist-lib/components/ui/Badge.js +119 -74
  9. package/dist-lib/components/ui/Badge.js.map +1 -1
  10. package/dist-lib/components/ui/Breadcrumbs.js +62 -50
  11. package/dist-lib/components/ui/Breadcrumbs.js.map +1 -1
  12. package/dist-lib/components/ui/Button.js +129 -131
  13. package/dist-lib/components/ui/Button.js.map +1 -1
  14. package/dist-lib/components/ui/Calendar.d.ts +1 -1
  15. package/dist-lib/components/ui/Calendar.js +99 -136
  16. package/dist-lib/components/ui/Calendar.js.map +1 -1
  17. package/dist-lib/components/ui/Card.js +88 -94
  18. package/dist-lib/components/ui/Card.js.map +1 -1
  19. package/dist-lib/components/ui/Carousel.js +125 -170
  20. package/dist-lib/components/ui/Carousel.js.map +1 -1
  21. package/dist-lib/components/ui/Chart.d.ts +3 -3
  22. package/dist-lib/components/ui/Chart.js +435 -464
  23. package/dist-lib/components/ui/Chart.js.map +1 -1
  24. package/dist-lib/components/ui/Checkbox.js +60 -69
  25. package/dist-lib/components/ui/Checkbox.js.map +1 -1
  26. package/dist-lib/components/ui/Combobox.js +179 -192
  27. package/dist-lib/components/ui/Combobox.js.map +1 -1
  28. package/dist-lib/components/ui/CommandPalette.d.ts +2 -2
  29. package/dist-lib/components/ui/CommandPalette.js +106 -167
  30. package/dist-lib/components/ui/CommandPalette.js.map +1 -1
  31. package/dist-lib/components/ui/ContextMenu.d.ts +1 -1
  32. package/dist-lib/components/ui/ContextMenu.js +89 -154
  33. package/dist-lib/components/ui/ContextMenu.js.map +1 -1
  34. package/dist-lib/components/ui/DataGrid.d.ts +1 -1
  35. package/dist-lib/components/ui/DataGrid.js +99 -96
  36. package/dist-lib/components/ui/DataGrid.js.map +1 -1
  37. package/dist-lib/components/ui/DatePicker.js +151 -188
  38. package/dist-lib/components/ui/DatePicker.js.map +1 -1
  39. package/dist-lib/components/ui/DesignSystemProvider.d.ts +1 -1
  40. package/dist-lib/components/ui/DesignSystemProvider.js +120 -130
  41. package/dist-lib/components/ui/DesignSystemProvider.js.map +1 -1
  42. package/dist-lib/components/ui/Dialog.d.ts +3 -3
  43. package/dist-lib/components/ui/Dialog.js +108 -156
  44. package/dist-lib/components/ui/Dialog.js.map +1 -1
  45. package/dist-lib/components/ui/Drawer.d.ts +3 -3
  46. package/dist-lib/components/ui/Drawer.js +90 -124
  47. package/dist-lib/components/ui/Drawer.js.map +1 -1
  48. package/dist-lib/components/ui/DropdownMenu.d.ts +1 -1
  49. package/dist-lib/components/ui/DropdownMenu.js +92 -158
  50. package/dist-lib/components/ui/DropdownMenu.js.map +1 -1
  51. package/dist-lib/components/ui/EmptyState.js +31 -44
  52. package/dist-lib/components/ui/EmptyState.js.map +1 -1
  53. package/dist-lib/components/ui/ErrorState.js +57 -67
  54. package/dist-lib/components/ui/ErrorState.js.map +1 -1
  55. package/dist-lib/components/ui/FileUpload.js +113 -107
  56. package/dist-lib/components/ui/FileUpload.js.map +1 -1
  57. package/dist-lib/components/ui/Form.d.ts +6 -4
  58. package/dist-lib/components/ui/Form.js +117 -122
  59. package/dist-lib/components/ui/Form.js.map +1 -1
  60. package/dist-lib/components/ui/Icon.d.ts +1 -1
  61. package/dist-lib/components/ui/Icon.js +30 -29
  62. package/dist-lib/components/ui/Icon.js.map +1 -1
  63. package/dist-lib/components/ui/IconButton.js +61 -63
  64. package/dist-lib/components/ui/IconButton.js.map +1 -1
  65. package/dist-lib/components/ui/Input.js +133 -156
  66. package/dist-lib/components/ui/Input.js.map +1 -1
  67. package/dist-lib/components/ui/Kbd.js +14 -21
  68. package/dist-lib/components/ui/Kbd.js.map +1 -1
  69. package/dist-lib/components/ui/MultiSelect.js +176 -208
  70. package/dist-lib/components/ui/MultiSelect.js.map +1 -1
  71. package/dist-lib/components/ui/Pagination.js +152 -149
  72. package/dist-lib/components/ui/Pagination.js.map +1 -1
  73. package/dist-lib/components/ui/Popover.js +18 -33
  74. package/dist-lib/components/ui/Popover.js.map +1 -1
  75. package/dist-lib/components/ui/Progress.js +77 -99
  76. package/dist-lib/components/ui/Progress.js.map +1 -1
  77. package/dist-lib/components/ui/RadioGroup.js +51 -80
  78. package/dist-lib/components/ui/RadioGroup.js.map +1 -1
  79. package/dist-lib/components/ui/RelativeTime.js +22 -29
  80. package/dist-lib/components/ui/RelativeTime.js.map +1 -1
  81. package/dist-lib/components/ui/ScrollArea.js +39 -58
  82. package/dist-lib/components/ui/ScrollArea.js.map +1 -1
  83. package/dist-lib/components/ui/Select.js +108 -131
  84. package/dist-lib/components/ui/Select.js.map +1 -1
  85. package/dist-lib/components/ui/Separator.js +18 -24
  86. package/dist-lib/components/ui/Separator.js.map +1 -1
  87. package/dist-lib/components/ui/Sheet.d.ts +2 -2
  88. package/dist-lib/components/ui/Sheet.js +77 -129
  89. package/dist-lib/components/ui/Sheet.js.map +1 -1
  90. package/dist-lib/components/ui/Sidebar.d.ts +1 -1
  91. package/dist-lib/components/ui/Sidebar.js +168 -207
  92. package/dist-lib/components/ui/Sidebar.js.map +1 -1
  93. package/dist-lib/components/ui/Skeleton.js +17 -27
  94. package/dist-lib/components/ui/Skeleton.js.map +1 -1
  95. package/dist-lib/components/ui/Slider.js +45 -62
  96. package/dist-lib/components/ui/Slider.js.map +1 -1
  97. package/dist-lib/components/ui/Snackbar.js +75 -55
  98. package/dist-lib/components/ui/Snackbar.js.map +1 -1
  99. package/dist-lib/components/ui/Spinner.js +45 -52
  100. package/dist-lib/components/ui/Spinner.js.map +1 -1
  101. package/dist-lib/components/ui/Stepper.js +56 -108
  102. package/dist-lib/components/ui/Stepper.js.map +1 -1
  103. package/dist-lib/components/ui/Switch.js +46 -79
  104. package/dist-lib/components/ui/Switch.js.map +1 -1
  105. package/dist-lib/components/ui/Table.js +108 -169
  106. package/dist-lib/components/ui/Table.js.map +1 -1
  107. package/dist-lib/components/ui/Tabs.js +57 -88
  108. package/dist-lib/components/ui/Tabs.js.map +1 -1
  109. package/dist-lib/components/ui/TagInput.js +76 -109
  110. package/dist-lib/components/ui/TagInput.js.map +1 -1
  111. package/dist-lib/components/ui/Textarea.js +74 -86
  112. package/dist-lib/components/ui/Textarea.js.map +1 -1
  113. package/dist-lib/components/ui/Timeline.d.ts +3 -3
  114. package/dist-lib/components/ui/Timeline.js +61 -49
  115. package/dist-lib/components/ui/Timeline.js.map +1 -1
  116. package/dist-lib/components/ui/Toast.d.ts +1 -1
  117. package/dist-lib/components/ui/Toast.js +136 -150
  118. package/dist-lib/components/ui/Toast.js.map +1 -1
  119. package/dist-lib/components/ui/Tooltip.d.ts +2 -2
  120. package/dist-lib/components/ui/Tooltip.js +35 -56
  121. package/dist-lib/components/ui/Tooltip.js.map +1 -1
  122. package/dist-lib/components/ui/TopNav.js +46 -66
  123. package/dist-lib/components/ui/TopNav.js.map +1 -1
  124. package/dist-lib/components/ui/Tree.js +134 -168
  125. package/dist-lib/components/ui/Tree.js.map +1 -1
  126. package/dist-lib/hooks/use-debounce.js +27 -33
  127. package/dist-lib/hooks/use-debounce.js.map +1 -1
  128. package/dist-lib/hooks/use-delayed-loading.js +19 -18
  129. package/dist-lib/hooks/use-delayed-loading.js.map +1 -1
  130. package/dist-lib/hooks/use-field-ids.js +14 -16
  131. package/dist-lib/hooks/use-field-ids.js.map +1 -1
  132. package/dist-lib/hooks/use-media-query.js +15 -19
  133. package/dist-lib/hooks/use-media-query.js.map +1 -1
  134. package/dist-lib/hooks/use-modifier-key.js +20 -15
  135. package/dist-lib/hooks/use-modifier-key.js.map +1 -1
  136. package/dist-lib/hooks/use-strings.js +10 -10
  137. package/dist-lib/hooks/use-strings.js.map +1 -1
  138. package/dist-lib/hooks/use-toast.js +73 -62
  139. package/dist-lib/hooks/use-toast.js.map +1 -1
  140. package/dist-lib/icon.js +2 -6
  141. package/dist-lib/icons/index.js +166 -163
  142. package/dist-lib/icons/index.js.map +1 -1
  143. package/dist-lib/illustrations/index.d.ts +7 -7
  144. package/dist-lib/illustrations/index.js +255 -106
  145. package/dist-lib/illustrations/index.js.map +1 -1
  146. package/dist-lib/index.js +69 -291
  147. package/dist-lib/lib/cva.js +2 -0
  148. package/dist-lib/lib/format.js +71 -87
  149. package/dist-lib/lib/format.js.map +1 -1
  150. package/dist-lib/lib/return-focus.js +11 -11
  151. package/dist-lib/lib/return-focus.js.map +1 -1
  152. package/dist-lib/lib/strings.js +167 -135
  153. package/dist-lib/lib/strings.js.map +1 -1
  154. package/dist-lib/lib/strings.mn.js +150 -113
  155. package/dist-lib/lib/strings.mn.js.map +1 -1
  156. package/dist-lib/lib/utils.js +9 -9
  157. package/dist-lib/lib/utils.js.map +1 -1
  158. package/dist-lib/styles.css +3 -1
  159. package/package.json +50 -50
  160. package/dist-lib/__tests__/helpers/color.d.ts +0 -9
  161. package/dist-lib/__tests__/helpers/theme.d.ts +0 -18
  162. package/dist-lib/icon.js.map +0 -1
  163. package/dist-lib/index.js.map +0 -1
@@ -1,135 +1,125 @@
1
1
  "use client";
2
- import { jsxs as f, jsx as h } from "react/jsx-runtime";
3
- import { useMemo as m, useId as p } from "react";
4
- import { cn as $ } from "../../lib/utils.js";
5
- import { useStrings as v, StringsContext as j } from "../../hooks/use-strings.js";
6
- import { mergeStrings as y } from "../../lib/strings.js";
7
- function S(c) {
8
- return "light" in c && typeof c.light == "object";
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { mergeStrings as t } from "../../lib/strings.js";
4
+ import { StringsContext as n, useStrings as r } from "../../hooks/use-strings.js";
5
+ import { useId as i, useMemo as a } from "react";
6
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ //#region src/components/ui/DesignSystemProvider.tsx
8
+ function c(e) {
9
+ return "light" in e && typeof e.light == "object";
9
10
  }
10
- function s(c) {
11
- return Object.entries(c).map(([e, l]) => `${e.startsWith("--") ? e : `--${e}`}:${l}`).join(";");
11
+ function l(e) {
12
+ return Object.entries(e).map(([e, t]) => `${e.startsWith("--") ? e : `--${e}`}:${t}`).join(";");
12
13
  }
13
- function W({
14
- tokens: c,
15
- strings: e,
16
- className: l,
17
- children: k,
18
- style: i,
19
- ...u
20
- }) {
21
- const r = v(), d = m(
22
- () => y(r, e),
23
- [r, e]
24
- ), n = p(), a = { ...i };
25
- let t = null;
26
- if (c)
27
- if (S(c)) {
28
- const o = `[data-brand-scope="${n}"]`;
29
- t = `${o}{${s(c.light)}}`, c.dark && (t += `.dark ${o},.dark${o}{${s(c.dark)}}`);
30
- } else
31
- for (const [o, g] of Object.entries(c)) {
32
- const b = o.startsWith("--") ? o : `--${o}`;
33
- a[b] = g;
34
- }
35
- return /* @__PURE__ */ f(j.Provider, { value: d, children: [
36
- t && /* @__PURE__ */ h("style", { "data-brand-scope-style": n, children: t }),
37
- /* @__PURE__ */ h("div", { "data-brand-scope": n, className: $("contents", l), style: a, ...u, children: k })
38
- ] });
14
+ function u({ tokens: u, strings: d, className: f, children: p, style: m, ...h }) {
15
+ let g = r(), _ = a(() => t(g, d), [g, d]), v = i(), y = { ...m }, b = null;
16
+ if (u) {
17
+ if (c(u)) {
18
+ let e = `[data-brand-scope="${v}"]`;
19
+ b = `${e}{${l(u.light)}}`, u.dark && (b += `.dark ${e},.dark${e}{${l(u.dark)}}`);
20
+ } else for (let [e, t] of Object.entries(u)) {
21
+ let n = e.startsWith("--") ? e : `--${e}`;
22
+ y[n] = t;
23
+ }
24
+ }
25
+ return /* @__PURE__ */ s(n.Provider, {
26
+ value: _,
27
+ children: [b && /* @__PURE__ */ o("style", {
28
+ "data-brand-scope-style": v,
29
+ children: b
30
+ }), /* @__PURE__ */ o("div", {
31
+ "data-brand-scope": v,
32
+ className: e("contents", f),
33
+ style: y,
34
+ ...h,
35
+ children: p
36
+ })]
37
+ });
39
38
  }
40
- const C = {
41
- /** The library default — graphite indigo. */
42
- default: { light: {} },
43
- /** Blue. */
44
- blue: {
45
- light: {
46
- accent: "oklch(0.55 0.16 250)",
47
- "color-accent-700": "oklch(0.47 0.16 250)",
48
- "color-accent-800": "oklch(0.39 0.14 250)",
49
- "accent-subtle": "oklch(0.96 0.03 250)",
50
- "accent-subtle-foreground": "oklch(0.45 0.15 250)",
51
- ring: "oklch(0.62 0.16 250)"
52
- },
53
- dark: {
54
- accent: "oklch(0.64 0.15 250)",
55
- "accent-subtle": "oklch(0.24 0.06 250)",
56
- "accent-subtle-foreground": "oklch(0.82 0.1 250)",
57
- ring: "oklch(0.68 0.15 250)"
58
- }
59
- },
60
- /** Violet. */
61
- violet: {
62
- light: {
63
- accent: "oklch(0.53 0.20 295)",
64
- "color-accent-700": "oklch(0.45 0.18 295)",
65
- "color-accent-800": "oklch(0.38 0.16 295)",
66
- "accent-subtle": "oklch(0.96 0.03 295)",
67
- "accent-subtle-foreground": "oklch(0.46 0.18 295)",
68
- ring: "oklch(0.60 0.20 295)"
69
- },
70
- dark: {
71
- accent: "oklch(0.64 0.18 295)",
72
- "accent-subtle": "oklch(0.25 0.07 295)",
73
- "accent-subtle-foreground": "oklch(0.83 0.12 295)",
74
- ring: "oklch(0.68 0.18 295)"
75
- }
76
- },
77
- /** Emerald. */
78
- emerald: {
79
- light: {
80
- accent: "oklch(0.55 0.13 160)",
81
- "color-accent-700": "oklch(0.47 0.13 160)",
82
- "color-accent-800": "oklch(0.39 0.12 160)",
83
- "accent-subtle": "oklch(0.96 0.03 160)",
84
- "accent-subtle-foreground": "oklch(0.42 0.12 160)",
85
- ring: "oklch(0.60 0.13 160)"
86
- },
87
- dark: {
88
- accent: "oklch(0.64 0.14 160)",
89
- "accent-subtle": "oklch(0.23 0.05 160)",
90
- "accent-subtle-foreground": "oklch(0.8 0.12 160)",
91
- ring: "oklch(0.68 0.14 160)"
92
- }
93
- },
94
- /** Rose. */
95
- rose: {
96
- light: {
97
- accent: "oklch(0.57 0.19 12)",
98
- "color-accent-700": "oklch(0.49 0.18 12)",
99
- "color-accent-800": "oklch(0.41 0.16 12)",
100
- "accent-subtle": "oklch(0.96 0.03 12)",
101
- "accent-subtle-foreground": "oklch(0.48 0.18 12)",
102
- ring: "oklch(0.62 0.19 12)"
103
- },
104
- dark: {
105
- accent: "oklch(0.65 0.18 12)",
106
- "accent-subtle": "oklch(0.25 0.07 12)",
107
- "accent-subtle-foreground": "oklch(0.83 0.12 12)",
108
- ring: "oklch(0.7 0.18 12)"
109
- }
110
- },
111
- /** Amber. */
112
- amber: {
113
- light: {
114
- // 0.56 keeps white text at 4.8:1 (0.62 was 3.8:1).
115
- accent: "oklch(0.56 0.14 65)",
116
- "color-accent-700": "oklch(0.54 0.13 65)",
117
- "color-accent-800": "oklch(0.46 0.12 65)",
118
- "accent-subtle": "oklch(0.96 0.04 75)",
119
- "accent-subtle-foreground": "oklch(0.48 0.12 65)",
120
- ring: "oklch(0.64 0.14 65)"
121
- // 3.17:1 on background-muted (0.66 was 2.93)
122
- },
123
- dark: {
124
- accent: "oklch(0.66 0.14 65)",
125
- "accent-subtle": "oklch(0.26 0.05 70)",
126
- "accent-subtle-foreground": "oklch(0.85 0.12 80)",
127
- ring: "oklch(0.72 0.14 65)"
128
- }
129
- }
39
+ var d = {
40
+ default: { light: {} },
41
+ blue: {
42
+ light: {
43
+ accent: "oklch(0.55 0.16 250)",
44
+ "color-accent-700": "oklch(0.47 0.16 250)",
45
+ "color-accent-800": "oklch(0.39 0.14 250)",
46
+ "accent-subtle": "oklch(0.96 0.03 250)",
47
+ "accent-subtle-foreground": "oklch(0.45 0.15 250)",
48
+ ring: "oklch(0.62 0.16 250)"
49
+ },
50
+ dark: {
51
+ accent: "oklch(0.64 0.15 250)",
52
+ "accent-subtle": "oklch(0.24 0.06 250)",
53
+ "accent-subtle-foreground": "oklch(0.82 0.1 250)",
54
+ ring: "oklch(0.68 0.15 250)"
55
+ }
56
+ },
57
+ violet: {
58
+ light: {
59
+ accent: "oklch(0.53 0.20 295)",
60
+ "color-accent-700": "oklch(0.45 0.18 295)",
61
+ "color-accent-800": "oklch(0.38 0.16 295)",
62
+ "accent-subtle": "oklch(0.96 0.03 295)",
63
+ "accent-subtle-foreground": "oklch(0.46 0.18 295)",
64
+ ring: "oklch(0.60 0.20 295)"
65
+ },
66
+ dark: {
67
+ accent: "oklch(0.64 0.18 295)",
68
+ "accent-subtle": "oklch(0.25 0.07 295)",
69
+ "accent-subtle-foreground": "oklch(0.83 0.12 295)",
70
+ ring: "oklch(0.68 0.18 295)"
71
+ }
72
+ },
73
+ emerald: {
74
+ light: {
75
+ accent: "oklch(0.55 0.13 160)",
76
+ "color-accent-700": "oklch(0.47 0.13 160)",
77
+ "color-accent-800": "oklch(0.39 0.12 160)",
78
+ "accent-subtle": "oklch(0.96 0.03 160)",
79
+ "accent-subtle-foreground": "oklch(0.42 0.12 160)",
80
+ ring: "oklch(0.60 0.13 160)"
81
+ },
82
+ dark: {
83
+ accent: "oklch(0.64 0.14 160)",
84
+ "accent-subtle": "oklch(0.23 0.05 160)",
85
+ "accent-subtle-foreground": "oklch(0.8 0.12 160)",
86
+ ring: "oklch(0.68 0.14 160)"
87
+ }
88
+ },
89
+ rose: {
90
+ light: {
91
+ accent: "oklch(0.57 0.19 12)",
92
+ "color-accent-700": "oklch(0.49 0.18 12)",
93
+ "color-accent-800": "oklch(0.41 0.16 12)",
94
+ "accent-subtle": "oklch(0.96 0.03 12)",
95
+ "accent-subtle-foreground": "oklch(0.48 0.18 12)",
96
+ ring: "oklch(0.62 0.19 12)"
97
+ },
98
+ dark: {
99
+ accent: "oklch(0.65 0.18 12)",
100
+ "accent-subtle": "oklch(0.25 0.07 12)",
101
+ "accent-subtle-foreground": "oklch(0.83 0.12 12)",
102
+ ring: "oklch(0.7 0.18 12)"
103
+ }
104
+ },
105
+ amber: {
106
+ light: {
107
+ accent: "oklch(0.56 0.14 65)",
108
+ "color-accent-700": "oklch(0.54 0.13 65)",
109
+ "color-accent-800": "oklch(0.46 0.12 65)",
110
+ "accent-subtle": "oklch(0.96 0.04 75)",
111
+ "accent-subtle-foreground": "oklch(0.48 0.12 65)",
112
+ ring: "oklch(0.64 0.14 65)"
113
+ },
114
+ dark: {
115
+ accent: "oklch(0.66 0.14 65)",
116
+ "accent-subtle": "oklch(0.26 0.05 70)",
117
+ "accent-subtle-foreground": "oklch(0.85 0.12 80)",
118
+ ring: "oklch(0.72 0.14 65)"
119
+ }
120
+ }
130
121
  };
131
- export {
132
- W as DesignSystemProvider,
133
- C as brandPresets
134
- };
135
- //# sourceMappingURL=DesignSystemProvider.js.map
122
+ //#endregion
123
+ export { u as DesignSystemProvider, d as brandPresets };
124
+
125
+ //# sourceMappingURL=DesignSystemProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DesignSystemProvider.js","sources":["../../../src/components/ui/DesignSystemProvider.tsx"],"sourcesContent":["'use client';\n\nimport { useId, useMemo, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\nimport { StringsContext, useStrings } from '@/hooks/use-strings';\nimport { mergeStrings, type DeepPartial, type UiStrings } from '@/lib/strings';\n\n/**\n * Per-brand token overrides. Keys are CSS variable names (without the `--`\n * prefix); values are CSS values. Any unspecified token falls back to the\n * design system default.\n *\n * @example\n * <DesignSystemProvider tokens={{ accent: '#ff5555', 'radius-md': '10px' }}>\n * <App />\n * </DesignSystemProvider>\n *\n * @example Swap in one of the built-in accent presets\n * <DesignSystemProvider tokens={brandPresets.violet}>\n * <Card>...</Card>\n * </DesignSystemProvider>\n */\nexport type BrandTokens = Record<string, string>;\n\n/**\n * Mode-aware token overrides: `light` applies always, `dark` wins under the\n * `.dark` class (on `<html>` or any ancestor). Use this for anything with a\n * different value per mode — accent, subtle surfaces, ring.\n */\nexport interface BrandTokenPair {\n light: BrandTokens;\n dark?: BrandTokens;\n}\n\nfunction isPair(t: BrandTokens | BrandTokenPair): t is BrandTokenPair {\n return 'light' in t && typeof t.light === 'object';\n}\n\nfunction toDeclarations(tokens: BrandTokens): string {\n return Object.entries(tokens)\n .map(([k, v]) => `${k.startsWith('--') ? k : `--${k}`}:${v}`)\n .join(';');\n}\n\nexport interface DesignSystemProviderProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Token overrides (CSS variable name → value). A flat record applies in both\n * modes; a `{ light, dark }` pair applies `dark` under `.dark`.\n */\n tokens?: BrandTokens | BrandTokenPair;\n /**\n * Override any of the library's built-in UI strings (aria-labels,\n * placeholders, empty states). Partial — merged over the parent provider /\n * English defaults. Pass `mnStrings` for Mongolian.\n */\n strings?: DeepPartial<UiStrings>;\n /** Children to scope this brand to. */\n children: ReactNode;\n}\n\nexport function DesignSystemProvider({\n tokens,\n strings,\n className,\n children,\n style,\n ...props\n}: DesignSystemProviderProps) {\n // Build the inline style from tokens — wrapping every key with `--` so\n // consumers can pass either `accent` or `color-accent` without remembering\n // the prefix dance.\n const parentStrings = useStrings();\n const resolvedStrings = useMemo(\n () => mergeStrings(parentStrings, strings),\n [parentStrings, strings],\n );\n const scopeId = useId();\n const css: CSSProperties = { ...style };\n let sheet: string | null = null;\n if (tokens) {\n if (isPair(tokens)) {\n // Mode-aware tokens cannot be inline (inline beats `.dark` rules), so\n // they go through a scoped <style>: light on the scope, dark under .dark.\n const scope = `[data-brand-scope=\"${scopeId}\"]`;\n sheet = `${scope}{${toDeclarations(tokens.light)}}`;\n if (tokens.dark) {\n sheet += `.dark ${scope},.dark${scope}{${toDeclarations(tokens.dark)}}`;\n }\n } else {\n for (const [k, v] of Object.entries(tokens)) {\n const key = k.startsWith('--') ? k : `--${k}`;\n (css as Record<string, string>)[key] = v;\n }\n }\n }\n\n return (\n <StringsContext.Provider value={resolvedStrings}>\n {sheet && <style data-brand-scope-style={scopeId}>{sheet}</style>}\n <div data-brand-scope={scopeId} className={cn('contents', className)} style={css} {...props}>\n {children}\n </div>\n </StringsContext.Provider>\n );\n}\n\n/**\n * Built-in accent presets — swap the system's single accent colour without\n * touching anything else.\n *\n * These override the *semantic* tokens the utilities resolve to. theme.css\n * maps the accent utilities with `@theme inline` (e.g. `bg-accent` →\n * `var(--accent)`, `bg-accent-soft` → `var(--accent-subtle)`), so the override\n * must target `--accent` / `--accent-subtle` / `--accent-subtle-foreground` /\n * `--ring` — NOT `--color-accent` (which `inline` never emits). The hover/\n * active steps (`--color-accent-700/800`) come from the raw palette and are\n * mode-agnostic. Values mirror the `[data-accent]` presets in theme.css: the\n * dark half lifts the accent to the 400 step (readable as text on neutral-950)\n * and darkens the subtle surface. `default` is the built-in graphite-indigo.\n */\nexport const brandPresets = {\n /** The library default — graphite indigo. */\n default: { light: {} } as BrandTokenPair,\n /** Blue. */\n blue: {\n light: {\n accent: 'oklch(0.55 0.16 250)',\n 'color-accent-700': 'oklch(0.47 0.16 250)',\n 'color-accent-800': 'oklch(0.39 0.14 250)',\n 'accent-subtle': 'oklch(0.96 0.03 250)',\n 'accent-subtle-foreground': 'oklch(0.45 0.15 250)',\n ring: 'oklch(0.62 0.16 250)',\n },\n dark: {\n accent: 'oklch(0.64 0.15 250)',\n 'accent-subtle': 'oklch(0.24 0.06 250)',\n 'accent-subtle-foreground': 'oklch(0.82 0.1 250)',\n ring: 'oklch(0.68 0.15 250)',\n },\n },\n /** Violet. */\n violet: {\n light: {\n accent: 'oklch(0.53 0.20 295)',\n 'color-accent-700': 'oklch(0.45 0.18 295)',\n 'color-accent-800': 'oklch(0.38 0.16 295)',\n 'accent-subtle': 'oklch(0.96 0.03 295)',\n 'accent-subtle-foreground': 'oklch(0.46 0.18 295)',\n ring: 'oklch(0.60 0.20 295)',\n },\n dark: {\n accent: 'oklch(0.64 0.18 295)',\n 'accent-subtle': 'oklch(0.25 0.07 295)',\n 'accent-subtle-foreground': 'oklch(0.83 0.12 295)',\n ring: 'oklch(0.68 0.18 295)',\n },\n },\n /** Emerald. */\n emerald: {\n light: {\n accent: 'oklch(0.55 0.13 160)',\n 'color-accent-700': 'oklch(0.47 0.13 160)',\n 'color-accent-800': 'oklch(0.39 0.12 160)',\n 'accent-subtle': 'oklch(0.96 0.03 160)',\n 'accent-subtle-foreground': 'oklch(0.42 0.12 160)',\n ring: 'oklch(0.60 0.13 160)',\n },\n dark: {\n accent: 'oklch(0.64 0.14 160)',\n 'accent-subtle': 'oklch(0.23 0.05 160)',\n 'accent-subtle-foreground': 'oklch(0.8 0.12 160)',\n ring: 'oklch(0.68 0.14 160)',\n },\n },\n /** Rose. */\n rose: {\n light: {\n accent: 'oklch(0.57 0.19 12)',\n 'color-accent-700': 'oklch(0.49 0.18 12)',\n 'color-accent-800': 'oklch(0.41 0.16 12)',\n 'accent-subtle': 'oklch(0.96 0.03 12)',\n 'accent-subtle-foreground': 'oklch(0.48 0.18 12)',\n ring: 'oklch(0.62 0.19 12)',\n },\n dark: {\n accent: 'oklch(0.65 0.18 12)',\n 'accent-subtle': 'oklch(0.25 0.07 12)',\n 'accent-subtle-foreground': 'oklch(0.83 0.12 12)',\n ring: 'oklch(0.7 0.18 12)',\n },\n },\n /** Amber. */\n amber: {\n light: {\n // 0.56 keeps white text at 4.8:1 (0.62 was 3.8:1).\n accent: 'oklch(0.56 0.14 65)',\n 'color-accent-700': 'oklch(0.54 0.13 65)',\n 'color-accent-800': 'oklch(0.46 0.12 65)',\n 'accent-subtle': 'oklch(0.96 0.04 75)',\n 'accent-subtle-foreground': 'oklch(0.48 0.12 65)',\n ring: 'oklch(0.64 0.14 65)', // 3.17:1 on background-muted (0.66 was 2.93)\n },\n dark: {\n accent: 'oklch(0.66 0.14 65)',\n 'accent-subtle': 'oklch(0.26 0.05 70)',\n 'accent-subtle-foreground': 'oklch(0.85 0.12 80)',\n ring: 'oklch(0.72 0.14 65)',\n },\n },\n} satisfies Record<string, BrandTokenPair>;\n\nexport type BrandName = keyof typeof brandPresets;\n"],"names":["isPair","t","toDeclarations","tokens","k","v","DesignSystemProvider","strings","className","children","style","props","parentStrings","useStrings","resolvedStrings","useMemo","mergeStrings","scopeId","useId","css","sheet","scope","key","jsxs","StringsContext","jsx","cn","brandPresets"],"mappings":"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"}
1
+ {"version":3,"file":"DesignSystemProvider.js","names":[],"sources":["../../../src/components/ui/DesignSystemProvider.tsx"],"sourcesContent":["'use client';\n\nimport { useId, useMemo, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\nimport { StringsContext, useStrings } from '@/hooks/use-strings';\nimport { mergeStrings, type DeepPartial, type UiStrings } from '@/lib/strings';\n\n/**\n * Per-brand token overrides. Keys are CSS variable names (without the `--`\n * prefix); values are CSS values. Any unspecified token falls back to the\n * design system default.\n *\n * @example\n * <DesignSystemProvider tokens={{ accent: '#ff5555', 'radius-md': '10px' }}>\n * <App />\n * </DesignSystemProvider>\n *\n * @example Swap in one of the built-in accent presets\n * <DesignSystemProvider tokens={brandPresets.violet}>\n * <Card>...</Card>\n * </DesignSystemProvider>\n */\nexport type BrandTokens = Record<string, string>;\n\n/**\n * Mode-aware token overrides: `light` applies always, `dark` wins under the\n * `.dark` class (on `<html>` or any ancestor). Use this for anything with a\n * different value per mode — accent, subtle surfaces, ring.\n */\nexport interface BrandTokenPair {\n light: BrandTokens;\n dark?: BrandTokens;\n}\n\nfunction isPair(t: BrandTokens | BrandTokenPair): t is BrandTokenPair {\n return 'light' in t && typeof t.light === 'object';\n}\n\nfunction toDeclarations(tokens: BrandTokens): string {\n return Object.entries(tokens)\n .map(([k, v]) => `${k.startsWith('--') ? k : `--${k}`}:${v}`)\n .join(';');\n}\n\nexport interface DesignSystemProviderProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Token overrides (CSS variable name → value). A flat record applies in both\n * modes; a `{ light, dark }` pair applies `dark` under `.dark`.\n */\n tokens?: BrandTokens | BrandTokenPair;\n /**\n * Override any of the library's built-in UI strings (aria-labels,\n * placeholders, empty states). Partial — merged over the parent provider /\n * English defaults. Pass `mnStrings` for Mongolian.\n */\n strings?: DeepPartial<UiStrings>;\n /** Children to scope this brand to. */\n children: ReactNode;\n}\n\nexport function DesignSystemProvider({\n tokens,\n strings,\n className,\n children,\n style,\n ...props\n}: DesignSystemProviderProps) {\n // Build the inline style from tokens — wrapping every key with `--` so\n // consumers can pass either `accent` or `color-accent` without remembering\n // the prefix dance.\n const parentStrings = useStrings();\n const resolvedStrings = useMemo(\n () => mergeStrings(parentStrings, strings),\n [parentStrings, strings],\n );\n const scopeId = useId();\n const css: CSSProperties = { ...style };\n let sheet: string | null = null;\n if (tokens) {\n if (isPair(tokens)) {\n // Mode-aware tokens cannot be inline (inline beats `.dark` rules), so\n // they go through a scoped <style>: light on the scope, dark under .dark.\n const scope = `[data-brand-scope=\"${scopeId}\"]`;\n sheet = `${scope}{${toDeclarations(tokens.light)}}`;\n if (tokens.dark) {\n sheet += `.dark ${scope},.dark${scope}{${toDeclarations(tokens.dark)}}`;\n }\n } else {\n for (const [k, v] of Object.entries(tokens)) {\n const key = k.startsWith('--') ? k : `--${k}`;\n (css as Record<string, string>)[key] = v;\n }\n }\n }\n\n return (\n <StringsContext.Provider value={resolvedStrings}>\n {sheet && <style data-brand-scope-style={scopeId}>{sheet}</style>}\n <div data-brand-scope={scopeId} className={cn('contents', className)} style={css} {...props}>\n {children}\n </div>\n </StringsContext.Provider>\n );\n}\n\n/**\n * Built-in accent presets — swap the system's single accent colour without\n * touching anything else.\n *\n * These override the *semantic* tokens the utilities resolve to. theme.css\n * maps the accent utilities with `@theme inline` (e.g. `bg-accent` →\n * `var(--accent)`, `bg-accent-soft` → `var(--accent-subtle)`), so the override\n * must target `--accent` / `--accent-subtle` / `--accent-subtle-foreground` /\n * `--ring` — NOT `--color-accent` (which `inline` never emits). The hover/\n * active steps (`--color-accent-700/800`) come from the raw palette and are\n * mode-agnostic. Values mirror the `[data-accent]` presets in theme.css: the\n * dark half lifts the accent to the 400 step (readable as text on neutral-950)\n * and darkens the subtle surface. `default` is the built-in graphite-indigo.\n */\nexport const brandPresets = {\n /** The library default — graphite indigo. */\n default: { light: {} } as BrandTokenPair,\n /** Blue. */\n blue: {\n light: {\n accent: 'oklch(0.55 0.16 250)',\n 'color-accent-700': 'oklch(0.47 0.16 250)',\n 'color-accent-800': 'oklch(0.39 0.14 250)',\n 'accent-subtle': 'oklch(0.96 0.03 250)',\n 'accent-subtle-foreground': 'oklch(0.45 0.15 250)',\n ring: 'oklch(0.62 0.16 250)',\n },\n dark: {\n accent: 'oklch(0.64 0.15 250)',\n 'accent-subtle': 'oklch(0.24 0.06 250)',\n 'accent-subtle-foreground': 'oklch(0.82 0.1 250)',\n ring: 'oklch(0.68 0.15 250)',\n },\n },\n /** Violet. */\n violet: {\n light: {\n accent: 'oklch(0.53 0.20 295)',\n 'color-accent-700': 'oklch(0.45 0.18 295)',\n 'color-accent-800': 'oklch(0.38 0.16 295)',\n 'accent-subtle': 'oklch(0.96 0.03 295)',\n 'accent-subtle-foreground': 'oklch(0.46 0.18 295)',\n ring: 'oklch(0.60 0.20 295)',\n },\n dark: {\n accent: 'oklch(0.64 0.18 295)',\n 'accent-subtle': 'oklch(0.25 0.07 295)',\n 'accent-subtle-foreground': 'oklch(0.83 0.12 295)',\n ring: 'oklch(0.68 0.18 295)',\n },\n },\n /** Emerald. */\n emerald: {\n light: {\n accent: 'oklch(0.55 0.13 160)',\n 'color-accent-700': 'oklch(0.47 0.13 160)',\n 'color-accent-800': 'oklch(0.39 0.12 160)',\n 'accent-subtle': 'oklch(0.96 0.03 160)',\n 'accent-subtle-foreground': 'oklch(0.42 0.12 160)',\n ring: 'oklch(0.60 0.13 160)',\n },\n dark: {\n accent: 'oklch(0.64 0.14 160)',\n 'accent-subtle': 'oklch(0.23 0.05 160)',\n 'accent-subtle-foreground': 'oklch(0.8 0.12 160)',\n ring: 'oklch(0.68 0.14 160)',\n },\n },\n /** Rose. */\n rose: {\n light: {\n accent: 'oklch(0.57 0.19 12)',\n 'color-accent-700': 'oklch(0.49 0.18 12)',\n 'color-accent-800': 'oklch(0.41 0.16 12)',\n 'accent-subtle': 'oklch(0.96 0.03 12)',\n 'accent-subtle-foreground': 'oklch(0.48 0.18 12)',\n ring: 'oklch(0.62 0.19 12)',\n },\n dark: {\n accent: 'oklch(0.65 0.18 12)',\n 'accent-subtle': 'oklch(0.25 0.07 12)',\n 'accent-subtle-foreground': 'oklch(0.83 0.12 12)',\n ring: 'oklch(0.7 0.18 12)',\n },\n },\n /** Amber. */\n amber: {\n light: {\n // 0.56 keeps white text at 4.8:1 (0.62 was 3.8:1).\n accent: 'oklch(0.56 0.14 65)',\n 'color-accent-700': 'oklch(0.54 0.13 65)',\n 'color-accent-800': 'oklch(0.46 0.12 65)',\n 'accent-subtle': 'oklch(0.96 0.04 75)',\n 'accent-subtle-foreground': 'oklch(0.48 0.12 65)',\n ring: 'oklch(0.64 0.14 65)', // 3.17:1 on background-muted (0.66 was 2.93)\n },\n dark: {\n accent: 'oklch(0.66 0.14 65)',\n 'accent-subtle': 'oklch(0.26 0.05 70)',\n 'accent-subtle-foreground': 'oklch(0.85 0.12 80)',\n ring: 'oklch(0.72 0.14 65)',\n },\n },\n} satisfies Record<string, BrandTokenPair>;\n\nexport type BrandName = keyof typeof brandPresets;\n"],"mappings":";;;;;;;AAkCA,SAAS,EAAO,GAAsD;CACpE,OAAO,WAAW,KAAK,OAAO,EAAE,SAAU;AAC5C;AAEA,SAAS,EAAe,GAA6B;CACnD,OAAO,OAAO,QAAQ,CAAM,CAAC,CAC1B,KAAK,CAAC,GAAG,OAAO,GAAG,EAAE,WAAW,IAAI,IAAI,IAAI,KAAK,IAAI,GAAG,GAAG,CAAC,CAC5D,KAAK,GAAG;AACb;AAkBA,SAAgB,EAAqB,EACnC,WACA,YACA,cACA,aACA,UACA,GAAG,KACyB;CAI5B,IAAM,IAAgB,EAAW,GAC3B,IAAkB,QAChB,EAAa,GAAe,CAAO,GACzC,CAAC,GAAe,CAAO,CACzB,GACM,IAAU,EAAM,GAChB,IAAqB,EAAE,GAAG,EAAM,GAClC,IAAuB;CAC3B,IAAI,GAAQ;EACV,IAAI,EAAO,CAAM,GAAG;GAGlB,IAAM,IAAQ,sBAAsB,EAAQ;GAE5C,AADA,IAAQ,GAAG,EAAM,GAAG,EAAe,EAAO,KAAK,EAAE,IAC7C,EAAO,SACT,KAAS,SAAS,EAAM,QAAQ,EAAM,GAAG,EAAe,EAAO,IAAI,EAAE;EAEzE,OACE,KAAK,IAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,CAAM,GAAG;GAC3C,IAAM,IAAM,EAAE,WAAW,IAAI,IAAI,IAAI,KAAK;GAC1C,EAAgC,KAAO;EACzC;CAEJ;CAEA,OACE,kBAAC,EAAe,UAAhB;EAAyB,OAAO;EAAhC,UAAA,CACG,KAAS,kBAAC,SAAD;GAAO,0BAAwB;GAAU,UAAA;EAAa,CAAA,GAChE,kBAAC,OAAD;GAAK,oBAAkB;GAAS,WAAW,EAAG,YAAY,CAAS;GAAG,OAAO;GAAK,GAAI;GACnF;EACE,CAAA,CACkB;;AAE7B;AAgBA,IAAa,IAAe;CAE1B,SAAS,EAAE,OAAO,CAAC,EAAE;CAErB,MAAM;EACJ,OAAO;GACL,QAAQ;GACR,oBAAoB;GACpB,oBAAoB;GACpB,iBAAiB;GACjB,4BAA4B;GAC5B,MAAM;EACR;EACA,MAAM;GACJ,QAAQ;GACR,iBAAiB;GACjB,4BAA4B;GAC5B,MAAM;EACR;CACF;CAEA,QAAQ;EACN,OAAO;GACL,QAAQ;GACR,oBAAoB;GACpB,oBAAoB;GACpB,iBAAiB;GACjB,4BAA4B;GAC5B,MAAM;EACR;EACA,MAAM;GACJ,QAAQ;GACR,iBAAiB;GACjB,4BAA4B;GAC5B,MAAM;EACR;CACF;CAEA,SAAS;EACP,OAAO;GACL,QAAQ;GACR,oBAAoB;GACpB,oBAAoB;GACpB,iBAAiB;GACjB,4BAA4B;GAC5B,MAAM;EACR;EACA,MAAM;GACJ,QAAQ;GACR,iBAAiB;GACjB,4BAA4B;GAC5B,MAAM;EACR;CACF;CAEA,MAAM;EACJ,OAAO;GACL,QAAQ;GACR,oBAAoB;GACpB,oBAAoB;GACpB,iBAAiB;GACjB,4BAA4B;GAC5B,MAAM;EACR;EACA,MAAM;GACJ,QAAQ;GACR,iBAAiB;GACjB,4BAA4B;GAC5B,MAAM;EACR;CACF;CAEA,OAAO;EACL,OAAO;GAEL,QAAQ;GACR,oBAAoB;GACpB,oBAAoB;GACpB,iBAAiB;GACjB,4BAA4B;GAC5B,MAAM;EACR;EACA,MAAM;GACJ,QAAQ;GACR,iBAAiB;GACjB,4BAA4B;GAC5B,MAAM;EACR;CACF;AACF"}
@@ -22,11 +22,11 @@ export interface DialogContentProps extends ComponentPropsWithoutRef<typeof Dial
22
22
  returnFocusTo?: ReturnFocusRef;
23
23
  }
24
24
  export declare const DialogContent: import('react').ForwardRefExoticComponent<DialogContentProps & import('react').RefAttributes<HTMLDivElement>>;
25
- export declare function DialogHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
25
+ export declare function DialogHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
26
26
  export declare namespace DialogHeader {
27
27
  var displayName: string;
28
28
  }
29
- export declare function DialogFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
29
+ export declare function DialogFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
30
30
  export declare namespace DialogFooter {
31
31
  var displayName: string;
32
32
  }
@@ -71,7 +71,7 @@ export interface ConfirmationDialogProps {
71
71
  * State consequences in the description.
72
72
  * @dont Use for low-risk reversible actions — those don't need a dialog.
73
73
  */
74
- export declare function ConfirmationDialog({ open, onOpenChange, title, description, confirmLabel, cancelLabel, confirmVariant, onConfirm, loading, formatError, }: ConfirmationDialogProps): import("react/jsx-runtime").JSX.Element;
74
+ export declare function ConfirmationDialog({ open, onOpenChange, title, description, confirmLabel, cancelLabel, confirmVariant, onConfirm, loading, formatError, }: ConfirmationDialogProps): import("react").JSX.Element;
75
75
  export declare namespace ConfirmationDialog {
76
76
  var displayName: string;
77
77
  }
@@ -1,165 +1,117 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as s } from "react/jsx-runtime";
3
- import { useState as b, forwardRef as c } from "react";
4
- import * as n from "@radix-ui/react-dialog";
5
- import { X as S } from "../../icons/index.js";
6
- import { cn as r } from "../../lib/utils.js";
7
- import { useStrings as C } from "../../hooks/use-strings.js";
8
- import { Button as N } from "./Button.js";
9
- import { withReturnFocus as k } from "../../lib/return-focus.js";
10
- const B = n.Root, Q = n.Trigger, E = n.Portal, H = n.Close, w = c(function({ className: a, ...i }, o) {
11
- return /* @__PURE__ */ e(
12
- n.Overlay,
13
- {
14
- ref: o,
15
- className: r(
16
- "bg-overlay fixed inset-0 z-[var(--z-overlay)]",
17
- "data-[state=open]:animate-in data-[state=closed]:animate-out",
18
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
19
- a
20
- ),
21
- ...i
22
- }
23
- );
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { useStrings as t } from "../../hooks/use-strings.js";
4
+ import { X as n } from "../../icons/index.js";
5
+ import { Button as r } from "./Button.js";
6
+ import { withReturnFocus as i } from "../../lib/return-focus.js";
7
+ import { forwardRef as a, useState as o } from "react";
8
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
+ import * as l from "@radix-ui/react-dialog";
10
+ //#region src/components/ui/Dialog.tsx
11
+ var u = l.Root, d = l.Trigger, f = l.Portal, p = l.Close, m = a(function({ className: t, ...n }, r) {
12
+ return /* @__PURE__ */ s(l.Overlay, {
13
+ ref: r,
14
+ className: e("bg-overlay fixed inset-0 z-[var(--z-overlay)]", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", t),
15
+ ...n
16
+ });
24
17
  });
25
- w.displayName = "DialogOverlay";
26
- const z = c(function({ className: a, children: i, showClose: o = !0, size: l = "md", returnFocusTo: m, onCloseAutoFocus: g, ...u }, f) {
27
- const p = C();
28
- return /* @__PURE__ */ s(E, { children: [
29
- /* @__PURE__ */ e(w, {}),
30
- /* @__PURE__ */ s(
31
- n.Content,
32
- {
33
- ref: f,
34
- onCloseAutoFocus: k(m, g),
35
- className: r(
36
- "fixed top-1/2 left-1/2 z-[var(--z-modal)] -translate-x-1/2 -translate-y-1/2",
37
- "border-border bg-card text-card-foreground w-[calc(100%-2rem)] rounded-xl border shadow-lg",
38
- "p-6",
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
- l === "sm" && "max-w-[400px]",
43
- l === "md" && "max-w-[520px]",
44
- l === "lg" && "max-w-[720px]",
45
- a
46
- ),
47
- ...u,
48
- children: [
49
- i,
50
- o && /* @__PURE__ */ e(
51
- n.Close,
52
- {
53
- "aria-label": p.dialog.close,
54
- className: r(
55
- "text-foreground-subtle absolute top-4 right-4 inline-flex size-8 items-center justify-center rounded-md",
56
- "hover:bg-background-muted hover:text-foreground",
57
- "focus-visible:ring-ring focus-visible:ring-offset-card outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
58
- "transition-colors duration-[var(--duration-fast)]"
59
- ),
60
- children: /* @__PURE__ */ e(S, { className: "size-4", "aria-hidden": !0 })
61
- }
62
- )
63
- ]
64
- }
65
- )
66
- ] });
18
+ m.displayName = "DialogOverlay";
19
+ var h = a(function({ className: r, children: a, showClose: o = !0, size: u = "md", returnFocusTo: d, onCloseAutoFocus: p, ...h }, g) {
20
+ let _ = t();
21
+ return /* @__PURE__ */ c(f, { children: [/* @__PURE__ */ s(m, {}), /* @__PURE__ */ c(l.Content, {
22
+ ref: g,
23
+ onCloseAutoFocus: i(d, p),
24
+ className: e("fixed top-1/2 left-1/2 z-[var(--z-modal)] -translate-x-1/2 -translate-y-1/2", "border-border bg-card text-card-foreground w-[calc(100%-2rem)] rounded-xl border shadow-lg", "p-6", "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", u === "sm" && "max-w-[400px]", u === "md" && "max-w-[520px]", u === "lg" && "max-w-[720px]", r),
25
+ ...h,
26
+ children: [a, o && /* @__PURE__ */ s(l.Close, {
27
+ "aria-label": _.dialog.close,
28
+ className: e("text-foreground-subtle absolute top-4 right-4 inline-flex size-8 items-center justify-center rounded-md", "hover:bg-background-muted hover:text-foreground", "focus-visible:ring-ring focus-visible:ring-offset-card outline-none focus-visible:ring-2 focus-visible:ring-offset-2", "transition-colors duration-[var(--duration-fast)]"),
29
+ children: /* @__PURE__ */ s(n, {
30
+ className: "size-4",
31
+ "aria-hidden": !0
32
+ })
33
+ })]
34
+ })] });
67
35
  });
68
- z.displayName = "DialogContent";
69
- function F({ className: t, ...a }) {
70
- return /* @__PURE__ */ e("div", { className: r("flex flex-col gap-1 pb-4", t), ...a });
36
+ h.displayName = "DialogContent";
37
+ function g({ className: t, ...n }) {
38
+ return /* @__PURE__ */ s("div", {
39
+ className: e("flex flex-col gap-1 pb-4", t),
40
+ ...n
41
+ });
71
42
  }
72
- F.displayName = "DialogHeader";
73
- function T({ className: t, ...a }) {
74
- return /* @__PURE__ */ e(
75
- "div",
76
- {
77
- className: r("flex flex-col-reverse gap-2 pt-6 sm:flex-row sm:justify-end", t),
78
- ...a
79
- }
80
- );
43
+ g.displayName = "DialogHeader";
44
+ function _({ className: t, ...n }) {
45
+ return /* @__PURE__ */ s("div", {
46
+ className: e("flex flex-col-reverse gap-2 pt-6 sm:flex-row sm:justify-end", t),
47
+ ...n
48
+ });
81
49
  }
82
- T.displayName = "DialogFooter";
83
- const O = c(function({ className: a, ...i }, o) {
84
- return /* @__PURE__ */ e(
85
- n.Title,
86
- {
87
- ref: o,
88
- className: r("text-foreground text-lg leading-tight font-semibold", a),
89
- ...i
90
- }
91
- );
50
+ _.displayName = "DialogFooter";
51
+ var v = a(function({ className: t, ...n }, r) {
52
+ return /* @__PURE__ */ s(l.Title, {
53
+ ref: r,
54
+ className: e("text-foreground text-lg leading-tight font-semibold", t),
55
+ ...n
56
+ });
92
57
  });
93
- O.displayName = "DialogTitle";
94
- const j = c(function({ className: a, ...i }, o) {
95
- return /* @__PURE__ */ e(
96
- n.Description,
97
- {
98
- ref: o,
99
- className: r("text-foreground-muted text-sm", a),
100
- ...i
101
- }
102
- );
58
+ v.displayName = "DialogTitle";
59
+ var y = a(function({ className: t, ...n }, r) {
60
+ return /* @__PURE__ */ s(l.Description, {
61
+ ref: r,
62
+ className: e("text-foreground-muted text-sm", t),
63
+ ...n
64
+ });
103
65
  });
104
- j.displayName = "DialogDescription";
105
- function A({
106
- open: t,
107
- onOpenChange: a,
108
- title: i,
109
- description: o,
110
- confirmLabel: l,
111
- cancelLabel: m,
112
- confirmVariant: g = "primary",
113
- onConfirm: u,
114
- loading: f,
115
- formatError: p = X
116
- }) {
117
- const x = C(), [P, h] = b(!1), [v, D] = b(null), y = !!f || P, R = async () => {
118
- D(null), h(!0);
119
- try {
120
- await u();
121
- } catch (d) {
122
- D(p(d));
123
- } finally {
124
- h(!1);
125
- }
126
- };
127
- return /* @__PURE__ */ e(
128
- B,
129
- {
130
- open: t,
131
- onOpenChange: (d) => {
132
- d || D(null), a(d);
133
- },
134
- children: /* @__PURE__ */ s(z, { size: "sm", ...o ? {} : { "aria-describedby": void 0 }, children: [
135
- /* @__PURE__ */ s(F, { children: [
136
- /* @__PURE__ */ e(O, { children: i }),
137
- o && /* @__PURE__ */ e(j, { children: o })
138
- ] }),
139
- v && /* @__PURE__ */ e("p", { role: "alert", className: "text-danger-text text-sm", children: v }),
140
- /* @__PURE__ */ s(T, { children: [
141
- /* @__PURE__ */ e(H, { asChild: !0, children: /* @__PURE__ */ e(N, { variant: "outline", disabled: y, children: m ?? x.confirmationDialog.cancel }) }),
142
- /* @__PURE__ */ e(N, { variant: g, loading: y, onClick: R, children: l ?? x.confirmationDialog.confirm })
143
- ] })
144
- ] })
145
- }
146
- );
66
+ y.displayName = "DialogDescription";
67
+ function b({ open: e, onOpenChange: n, title: i, description: a, confirmLabel: l, cancelLabel: d, confirmVariant: f = "primary", onConfirm: m, loading: b, formatError: S = x }) {
68
+ let C = t(), [w, T] = o(!1), [E, D] = o(null), O = !!b || w, k = async () => {
69
+ D(null), T(!0);
70
+ try {
71
+ await m();
72
+ } catch (e) {
73
+ D(S(e));
74
+ } finally {
75
+ T(!1);
76
+ }
77
+ };
78
+ return /* @__PURE__ */ s(u, {
79
+ open: e,
80
+ onOpenChange: (e) => {
81
+ e || D(null), n(e);
82
+ },
83
+ children: /* @__PURE__ */ c(h, {
84
+ size: "sm",
85
+ ...a ? {} : { "aria-describedby": void 0 },
86
+ children: [
87
+ /* @__PURE__ */ c(g, { children: [/* @__PURE__ */ s(v, { children: i }), a && /* @__PURE__ */ s(y, { children: a })] }),
88
+ E && /* @__PURE__ */ s("p", {
89
+ role: "alert",
90
+ className: "text-danger-text text-sm",
91
+ children: E
92
+ }),
93
+ /* @__PURE__ */ c(_, { children: [/* @__PURE__ */ s(p, {
94
+ asChild: !0,
95
+ children: /* @__PURE__ */ s(r, {
96
+ variant: "outline",
97
+ disabled: O,
98
+ children: d ?? C.confirmationDialog.cancel
99
+ })
100
+ }), /* @__PURE__ */ s(r, {
101
+ variant: f,
102
+ loading: O,
103
+ onClick: k,
104
+ children: l ?? C.confirmationDialog.confirm
105
+ })] })
106
+ ]
107
+ })
108
+ });
147
109
  }
148
- function X(t) {
149
- return t instanceof Error ? t.message : String(t);
110
+ function x(e) {
111
+ return e instanceof Error ? e.message : String(e);
150
112
  }
151
- A.displayName = "ConfirmationDialog";
152
- export {
153
- A as ConfirmationDialog,
154
- B as Dialog,
155
- H as DialogClose,
156
- z as DialogContent,
157
- j as DialogDescription,
158
- T as DialogFooter,
159
- F as DialogHeader,
160
- w as DialogOverlay,
161
- E as DialogPortal,
162
- O as DialogTitle,
163
- Q as DialogTrigger
164
- };
165
- //# sourceMappingURL=Dialog.js.map
113
+ b.displayName = "ConfirmationDialog";
114
+ //#endregion
115
+ export { b as ConfirmationDialog, u as Dialog, p as DialogClose, h as DialogContent, y as DialogDescription, _ as DialogFooter, g as DialogHeader, m as DialogOverlay, f as DialogPortal, v as DialogTitle, d as DialogTrigger };
116
+
117
+ //# sourceMappingURL=Dialog.js.map