@tomny-dev/uzi 0.5.0 → 0.6.0-pr.60.171.1.16c745f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/components/card/Card.d.ts +7 -5
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/page-container/PageContainer.d.ts +2 -1
- package/dist/components/page-container/PageContainer.d.ts.map +1 -1
- package/dist/components/surface/Surface.d.ts +16 -0
- package/dist/components/surface/Surface.d.ts.map +1 -0
- package/dist/components/toolbar/Toolbar.d.ts +13 -0
- package/dist/components/toolbar/Toolbar.d.ts.map +1 -0
- package/dist/index.cjs +36 -31
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -32
- package/dist/index10.cjs.map +1 -1
- package/dist/index10.js +19 -15
- package/dist/index10.js.map +1 -1
- package/dist/index11.cjs +21 -18
- package/dist/index11.cjs.map +1 -1
- package/dist/index11.js +8 -15
- package/dist/index11.js.map +1 -1
- package/dist/index12.cjs +7 -14
- package/dist/index12.cjs.map +1 -1
- package/dist/index12.js +15 -37
- package/dist/index12.js.map +1 -1
- package/dist/index13.cjs +18 -52
- package/dist/index13.cjs.map +1 -1
- package/dist/index13.js +15 -77
- package/dist/index13.js.map +1 -1
- package/dist/index14.cjs +15 -80
- package/dist/index14.cjs.map +1 -1
- package/dist/index14.js +37 -13
- package/dist/index14.js.map +1 -1
- package/dist/index15.cjs +52 -18
- package/dist/index15.cjs.map +1 -1
- package/dist/index15.js +77 -9
- package/dist/index15.js.map +1 -1
- package/dist/index16.cjs +79 -8
- package/dist/index16.cjs.map +1 -1
- package/dist/index16.js +13 -41
- package/dist/index16.js.map +1 -1
- package/dist/index17.cjs +18 -60
- package/dist/index17.cjs.map +1 -1
- package/dist/index17.js +9 -428
- package/dist/index17.js.map +1 -1
- package/dist/index18.cjs +8 -430
- package/dist/index18.cjs.map +1 -1
- package/dist/index18.js +42 -4
- package/dist/index18.js.map +1 -1
- package/dist/index19.cjs +61 -5
- package/dist/index19.cjs.map +1 -1
- package/dist/index19.js +430 -13
- package/dist/index19.js.map +1 -1
- package/dist/index20.cjs +430 -12
- package/dist/index20.cjs.map +1 -1
- package/dist/index20.js +4 -4
- package/dist/index20.js.map +1 -1
- package/dist/index21.cjs +5 -5
- package/dist/index21.cjs.map +1 -1
- package/dist/index21.js +12 -9
- package/dist/index21.js.map +1 -1
- package/dist/index22.cjs +12 -9
- package/dist/index22.cjs.map +1 -1
- package/dist/index22.js +4 -4
- package/dist/index22.js.map +1 -1
- package/dist/index23.cjs +5 -5
- package/dist/index23.cjs.map +1 -1
- package/dist/index23.js +9 -12
- package/dist/index23.js.map +1 -1
- package/dist/index24.cjs +9 -12
- package/dist/index24.cjs.map +1 -1
- package/dist/index24.js +4 -38
- package/dist/index24.js.map +1 -1
- package/dist/index25.cjs +5 -55
- package/dist/index25.cjs.map +1 -1
- package/dist/index25.js +11 -116
- package/dist/index25.js.map +1 -1
- package/dist/index26.cjs +10 -116
- package/dist/index26.cjs.map +1 -1
- package/dist/index26.js +31 -19
- package/dist/index26.js.map +1 -1
- package/dist/index27.cjs +42 -24
- package/dist/index27.cjs.map +1 -1
- package/dist/index27.js +106 -93
- package/dist/index27.js.map +1 -1
- package/dist/index28.cjs +106 -93
- package/dist/index28.cjs.map +1 -1
- package/dist/index28.js +26 -23
- package/dist/index28.js.map +1 -1
- package/dist/index29.cjs +37 -25
- package/dist/index29.cjs.map +1 -1
- package/dist/index29.js +107 -26
- package/dist/index29.js.map +1 -1
- package/dist/index30.cjs +110 -37
- package/dist/index30.cjs.map +1 -1
- package/dist/index30.js +21 -113
- package/dist/index30.js.map +1 -1
- package/dist/index31.cjs +19 -125
- package/dist/index31.cjs.map +1 -1
- package/dist/index31.js +26 -17
- package/dist/index31.js.map +1 -1
- package/dist/index32.cjs +37 -20
- package/dist/index32.cjs.map +1 -1
- package/dist/index32.js +108 -104
- package/dist/index32.js.map +1 -1
- package/dist/index33.cjs +122 -103
- package/dist/index33.cjs.map +1 -1
- package/dist/index33.js +17 -4
- package/dist/index33.js.map +1 -1
- package/dist/index34.cjs +20 -5
- package/dist/index34.cjs.map +1 -1
- package/dist/index34.js +106 -58
- package/dist/index34.js.map +1 -1
- package/dist/index35.cjs +106 -57
- package/dist/index35.cjs.map +1 -1
- package/dist/index35.js +4 -22
- package/dist/index35.js.map +1 -1
- package/dist/index36.cjs +5 -31
- package/dist/index36.cjs.map +1 -1
- package/dist/index36.js +55 -44
- package/dist/index36.js.map +1 -1
- package/dist/index37.cjs +55 -44
- package/dist/index37.cjs.map +1 -1
- package/dist/index37.js +21 -31
- package/dist/index37.js.map +1 -1
- package/dist/index38.cjs +30 -45
- package/dist/index38.cjs.map +1 -1
- package/dist/index38.js +46 -141
- package/dist/index38.js.map +1 -1
- package/dist/index39.cjs +46 -141
- package/dist/index39.cjs.map +1 -1
- package/dist/index39.js +31 -41
- package/dist/index39.js.map +1 -1
- package/dist/index40.cjs +45 -60
- package/dist/index40.cjs.map +1 -1
- package/dist/index40.js +139 -163
- package/dist/index40.js.map +1 -1
- package/dist/index41.cjs +137 -161
- package/dist/index41.cjs.map +1 -1
- package/dist/index41.js +41 -12
- package/dist/index41.js.map +1 -1
- package/dist/index42.cjs +60 -14
- package/dist/index42.cjs.map +1 -1
- package/dist/index42.js +167 -15
- package/dist/index42.js.map +1 -1
- package/dist/index43.cjs +166 -14
- package/dist/index43.cjs.map +1 -1
- package/dist/index43.js +12 -15
- package/dist/index43.js.map +1 -1
- package/dist/index44.cjs +14 -21
- package/dist/index44.cjs.map +1 -1
- package/dist/index44.js +15 -28
- package/dist/index44.js.map +1 -1
- package/dist/index45.cjs +14 -27
- package/dist/index45.cjs.map +1 -1
- package/dist/index45.js +10 -8
- package/dist/index45.js.map +1 -1
- package/dist/index46.cjs +11 -8
- package/dist/index46.cjs.map +1 -1
- package/dist/index46.js +22 -15
- package/dist/index46.js.map +1 -1
- package/dist/index47.cjs +22 -15
- package/dist/index47.cjs.map +1 -1
- package/dist/index47.js +9 -13
- package/dist/index47.js.map +1 -1
- package/dist/index48.cjs +10 -16
- package/dist/index48.cjs.map +1 -1
- package/dist/index48.js +18 -25
- package/dist/index48.js.map +1 -1
- package/dist/index49.cjs +18 -25
- package/dist/index49.cjs.map +1 -1
- package/dist/index49.js +17 -14
- package/dist/index49.js.map +1 -1
- package/dist/index50.cjs +24 -17
- package/dist/index50.cjs.map +1 -1
- package/dist/index50.js +28 -28
- package/dist/index50.js.map +1 -1
- package/dist/index51.cjs +27 -28
- package/dist/index51.cjs.map +1 -1
- package/dist/index51.js +14 -17
- package/dist/index51.js.map +1 -1
- package/dist/index52.cjs +17 -22
- package/dist/index52.cjs.map +1 -1
- package/dist/index52.js +23 -23
- package/dist/index52.js.map +1 -1
- package/dist/index53.cjs +23 -23
- package/dist/index53.cjs.map +1 -1
- package/dist/index53.js +17 -10
- package/dist/index53.js.map +1 -1
- package/dist/index54.cjs +22 -11
- package/dist/index54.cjs.map +1 -1
- package/dist/index54.js +28 -14
- package/dist/index54.js.map +1 -1
- package/dist/index55.cjs +28 -13
- package/dist/index55.cjs.map +1 -1
- package/dist/index55.js +17 -11
- package/dist/index55.js.map +1 -1
- package/dist/index56.cjs +23 -13
- package/dist/index56.cjs.map +1 -1
- package/dist/index56.js +24 -16
- package/dist/index56.js.map +1 -1
- package/dist/index57.cjs +24 -15
- package/dist/index57.cjs.map +1 -1
- package/dist/index57.js +10 -9
- package/dist/index57.js.map +1 -1
- package/dist/index58.cjs +11 -12
- package/dist/index58.cjs.map +1 -1
- package/dist/index58.js +12 -87
- package/dist/index58.js.map +1 -1
- package/dist/index59.cjs +12 -89
- package/dist/index59.cjs.map +1 -1
- package/dist/index59.js +11 -21
- package/dist/index59.js.map +1 -1
- package/dist/index60.cjs +13 -30
- package/dist/index60.cjs.map +1 -1
- package/dist/index60.js +17 -43
- package/dist/index60.js.map +1 -1
- package/dist/index61.cjs +16 -44
- package/dist/index61.cjs.map +1 -1
- package/dist/index61.js +9 -57
- package/dist/index61.js.map +1 -1
- package/dist/index62.cjs +11 -83
- package/dist/index62.cjs.map +1 -1
- package/dist/index62.js +83 -426
- package/dist/index62.js.map +1 -1
- package/dist/index63.cjs +82 -427
- package/dist/index63.cjs.map +1 -1
- package/dist/index63.js +21 -59
- package/dist/index63.js.map +1 -1
- package/dist/index64.cjs +30 -87
- package/dist/index64.cjs.map +1 -1
- package/dist/index64.js +44 -240
- package/dist/index64.js.map +1 -1
- package/dist/index65.cjs +43 -239
- package/dist/index65.cjs.map +1 -1
- package/dist/index65.js +57 -43
- package/dist/index65.js.map +1 -1
- package/dist/index66.cjs +84 -63
- package/dist/index66.cjs.map +1 -1
- package/dist/index66.js +426 -73
- package/dist/index66.js.map +1 -1
- package/dist/index67.cjs +426 -71
- package/dist/index67.cjs.map +1 -1
- package/dist/index67.js +59 -21
- package/dist/index67.js.map +1 -1
- package/dist/index68.cjs +87 -30
- package/dist/index68.cjs.map +1 -1
- package/dist/index68.js +233 -88
- package/dist/index68.js.map +1 -1
- package/dist/index69.cjs +232 -89
- package/dist/index69.cjs.map +1 -1
- package/dist/index69.js +40 -16
- package/dist/index69.js.map +1 -1
- package/dist/index70.cjs +56 -20
- package/dist/index70.cjs.map +1 -1
- package/dist/index70.js +72 -145
- package/dist/index70.js.map +1 -1
- package/dist/index71.cjs +72 -145
- package/dist/index71.cjs.map +1 -1
- package/dist/index71.js +25 -0
- package/dist/index71.js.map +1 -0
- package/dist/index72.cjs +34 -0
- package/dist/index72.cjs.map +1 -0
- package/dist/index72.js +101 -0
- package/dist/index72.js.map +1 -0
- package/dist/index73.cjs +105 -0
- package/dist/index73.cjs.map +1 -0
- package/dist/index73.js +23 -0
- package/dist/index73.js.map +1 -0
- package/dist/index74.cjs +31 -0
- package/dist/index74.cjs.map +1 -0
- package/dist/index74.js +159 -0
- package/dist/index74.js.map +1 -0
- package/dist/index75.cjs +161 -0
- package/dist/index75.cjs.map +1 -0
- package/dist/index8.js.map +1 -1
- package/dist/index9.cjs.map +1 -1
- package/dist/index9.js.map +1 -1
- package/dist/style.css +216 -45
- package/package.json +2 -2
package/dist/index33.cjs
CHANGED
|
@@ -1,115 +1,134 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const require_runtime = require("./index2.cjs");
|
|
3
|
+
const require_cx = require("./index4.cjs");
|
|
4
|
+
const require_dropdown_menu_module = require("./index32.cjs");
|
|
4
5
|
let react = require("react");
|
|
6
|
+
react = require_runtime.__toESM(react, 1);
|
|
5
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var ThemeContext = (0, react.createContext)(void 0);
|
|
12
|
-
function isTheme(value) {
|
|
13
|
-
return require_constants.UZI_THEMES.includes(value);
|
|
8
|
+
let _radix_ui_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
9
|
+
_radix_ui_react_dropdown_menu = require_runtime.__toESM(_radix_ui_react_dropdown_menu, 1);
|
|
10
|
+
//#region src/components/dropdown-menu/DropdownMenu.tsx
|
|
11
|
+
function DropdownMenu(props) {
|
|
12
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Root, { ...props });
|
|
14
13
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
14
|
+
function DropdownMenuTrigger(props) {
|
|
15
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Trigger, { ...props });
|
|
17
16
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
17
|
+
function DropdownMenuGroup(props) {
|
|
18
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Group, { ...props });
|
|
21
19
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
(0,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
isAccentControlled,
|
|
78
|
-
onAccentChange
|
|
79
|
-
]);
|
|
80
|
-
const toggleTheme = (0, react.useCallback)(() => {
|
|
81
|
-
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
|
82
|
-
}, [resolvedTheme, setTheme]);
|
|
83
|
-
const value = (0, react.useMemo)(() => ({
|
|
84
|
-
theme: currentTheme,
|
|
85
|
-
resolvedTheme,
|
|
86
|
-
accent: currentAccent,
|
|
87
|
-
setTheme,
|
|
88
|
-
setAccent,
|
|
89
|
-
toggleTheme
|
|
90
|
-
}), [
|
|
91
|
-
currentAccent,
|
|
92
|
-
currentTheme,
|
|
93
|
-
resolvedTheme,
|
|
94
|
-
setAccent,
|
|
95
|
-
setTheme,
|
|
96
|
-
toggleTheme
|
|
97
|
-
]);
|
|
98
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeContext.Provider, {
|
|
99
|
-
value,
|
|
100
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ToastContext.ToastProvider, {
|
|
101
|
-
config: toastConfig,
|
|
102
|
-
children
|
|
103
|
-
})
|
|
20
|
+
function DropdownMenuPortal(props) {
|
|
21
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Portal, { ...props });
|
|
22
|
+
}
|
|
23
|
+
function DropdownMenuSub(props) {
|
|
24
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Sub, { ...props });
|
|
25
|
+
}
|
|
26
|
+
function DropdownMenuRadioGroup(props) {
|
|
27
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.RadioGroup, { ...props });
|
|
28
|
+
}
|
|
29
|
+
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Content, {
|
|
31
|
+
sideOffset,
|
|
32
|
+
className: require_cx.cx(require_dropdown_menu_module.default.content, className),
|
|
33
|
+
...props
|
|
34
|
+
}) });
|
|
35
|
+
}
|
|
36
|
+
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
37
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Item, {
|
|
38
|
+
"data-inset": inset ? "true" : void 0,
|
|
39
|
+
className: require_cx.cx(require_dropdown_menu_module.default.item, variant === "destructive" && require_dropdown_menu_module.default.itemDestructive, className),
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function DropdownMenuCheckboxItem({ className, children, ...props }) {
|
|
44
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dropdown_menu.CheckboxItem, {
|
|
45
|
+
className: require_cx.cx(require_dropdown_menu_module.default.item, require_dropdown_menu_module.default.insetItem, className),
|
|
46
|
+
...props,
|
|
47
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
48
|
+
className: require_dropdown_menu_module.default.indicator,
|
|
49
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.ItemIndicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
50
|
+
viewBox: "0 0 16 16",
|
|
51
|
+
width: "16",
|
|
52
|
+
height: "16",
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
className: require_dropdown_menu_module.default.indicatorIcon,
|
|
55
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
56
|
+
d: "M3.5 8.5 6.5 11.5 12.5 4.5",
|
|
57
|
+
fill: "none",
|
|
58
|
+
stroke: "currentColor",
|
|
59
|
+
strokeWidth: "1.8",
|
|
60
|
+
strokeLinecap: "round",
|
|
61
|
+
strokeLinejoin: "round"
|
|
62
|
+
})
|
|
63
|
+
}) })
|
|
64
|
+
}), children]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
68
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dropdown_menu.RadioItem, {
|
|
69
|
+
className: require_cx.cx(require_dropdown_menu_module.default.item, require_dropdown_menu_module.default.insetItem, className),
|
|
70
|
+
...props,
|
|
71
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
72
|
+
className: require_dropdown_menu_module.default.indicator,
|
|
73
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.ItemIndicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_dropdown_menu_module.default.radioDot }) })
|
|
74
|
+
}), children]
|
|
104
75
|
});
|
|
105
76
|
}
|
|
106
|
-
function
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
77
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
78
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Label, {
|
|
79
|
+
"data-inset": inset ? "true" : void 0,
|
|
80
|
+
className: require_cx.cx(require_dropdown_menu_module.default.label, className),
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
85
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Separator, {
|
|
86
|
+
className: require_cx.cx(require_dropdown_menu_module.default.separator, className),
|
|
87
|
+
...props
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
91
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dropdown_menu.SubTrigger, {
|
|
92
|
+
"data-inset": inset ? "true" : void 0,
|
|
93
|
+
className: require_cx.cx(require_dropdown_menu_module.default.item, className),
|
|
94
|
+
...props,
|
|
95
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
96
|
+
viewBox: "0 0 16 16",
|
|
97
|
+
width: "16",
|
|
98
|
+
height: "16",
|
|
99
|
+
"aria-hidden": "true",
|
|
100
|
+
className: require_dropdown_menu_module.default.chevron,
|
|
101
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
102
|
+
d: "M6 3.5 10.5 8 6 12.5",
|
|
103
|
+
fill: "none",
|
|
104
|
+
stroke: "currentColor",
|
|
105
|
+
strokeWidth: "1.6",
|
|
106
|
+
strokeLinecap: "round",
|
|
107
|
+
strokeLinejoin: "round"
|
|
108
|
+
})
|
|
109
|
+
})]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function DropdownMenuSubContent({ className, ...props }) {
|
|
113
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.SubContent, {
|
|
114
|
+
className: require_cx.cx(require_dropdown_menu_module.default.content, className),
|
|
115
|
+
...props
|
|
116
|
+
});
|
|
110
117
|
}
|
|
111
118
|
//#endregion
|
|
112
|
-
exports.
|
|
113
|
-
exports.
|
|
119
|
+
exports.DropdownMenu = DropdownMenu;
|
|
120
|
+
exports.DropdownMenuCheckboxItem = DropdownMenuCheckboxItem;
|
|
121
|
+
exports.DropdownMenuContent = DropdownMenuContent;
|
|
122
|
+
exports.DropdownMenuGroup = DropdownMenuGroup;
|
|
123
|
+
exports.DropdownMenuItem = DropdownMenuItem;
|
|
124
|
+
exports.DropdownMenuLabel = DropdownMenuLabel;
|
|
125
|
+
exports.DropdownMenuPortal = DropdownMenuPortal;
|
|
126
|
+
exports.DropdownMenuRadioGroup = DropdownMenuRadioGroup;
|
|
127
|
+
exports.DropdownMenuRadioItem = DropdownMenuRadioItem;
|
|
128
|
+
exports.DropdownMenuSeparator = DropdownMenuSeparator;
|
|
129
|
+
exports.DropdownMenuSub = DropdownMenuSub;
|
|
130
|
+
exports.DropdownMenuSubContent = DropdownMenuSubContent;
|
|
131
|
+
exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
|
|
132
|
+
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
114
133
|
|
|
115
134
|
//# sourceMappingURL=index33.cjs.map
|
package/dist/index33.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index33.cjs","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index33.cjs","names":[],"sources":["../src/components/dropdown-menu/DropdownMenu.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { cx } from \"../../utils/cx\";\nimport styles from \"./dropdown-menu.module.css\";\n\nexport function DropdownMenu(\n props: React.ComponentProps<typeof DropdownMenuPrimitive.Root>,\n) {\n return <DropdownMenuPrimitive.Root {...props} />;\n}\n\nexport function DropdownMenuTrigger(\n props: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>,\n) {\n return <DropdownMenuPrimitive.Trigger {...props} />;\n}\n\nexport function DropdownMenuGroup(\n props: React.ComponentProps<typeof DropdownMenuPrimitive.Group>,\n) {\n return <DropdownMenuPrimitive.Group {...props} />;\n}\n\nexport function DropdownMenuPortal(\n props: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>,\n) {\n return <DropdownMenuPrimitive.Portal {...props} />;\n}\n\nexport function DropdownMenuSub(\n props: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>,\n) {\n return <DropdownMenuPrimitive.Sub {...props} />;\n}\n\nexport function DropdownMenuRadioGroup(\n props: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>,\n) {\n return <DropdownMenuPrimitive.RadioGroup {...props} />;\n}\n\nexport function DropdownMenuContent({\n className,\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n sideOffset={sideOffset}\n className={cx(styles.content, className)}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nexport function DropdownMenuItem({\n className,\n inset,\n variant = \"default\",\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n variant?: \"default\" | \"destructive\";\n}) {\n return (\n <DropdownMenuPrimitive.Item\n data-inset={inset ? \"true\" : undefined}\n className={cx(\n styles.item,\n variant === \"destructive\" && styles.itemDestructive,\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function DropdownMenuCheckboxItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n className={cx(\n styles.item,\n styles.insetItem,\n className,\n )}\n {...props}\n >\n <span className={styles.indicator}>\n <DropdownMenuPrimitive.ItemIndicator>\n <svg\n viewBox=\"0 0 16 16\"\n width=\"16\"\n height=\"16\"\n aria-hidden=\"true\"\n className={styles.indicatorIcon}\n >\n <path\n d=\"M3.5 8.5 6.5 11.5 12.5 4.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.8\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n}\n\nexport function DropdownMenuRadioItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {\n return (\n <DropdownMenuPrimitive.RadioItem\n className={cx(\n styles.item,\n styles.insetItem,\n className,\n )}\n {...props}\n >\n <span className={styles.indicator}>\n <DropdownMenuPrimitive.ItemIndicator>\n <span className={styles.radioDot} />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n}\n\nexport function DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n}) {\n return (\n <DropdownMenuPrimitive.Label\n data-inset={inset ? \"true\" : undefined}\n className={cx(styles.label, className)}\n {...props}\n />\n );\n}\n\nexport function DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n className={cx(styles.separator, className)}\n {...props}\n />\n );\n}\n\nexport function DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n}) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-inset={inset ? \"true\" : undefined}\n className={cx(styles.item, className)}\n {...props}\n >\n {children}\n <svg\n viewBox=\"0 0 16 16\"\n width=\"16\"\n height=\"16\"\n aria-hidden=\"true\"\n className={styles.chevron}\n >\n <path\n d=\"M6 3.5 10.5 8 6 12.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.6\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </DropdownMenuPrimitive.SubTrigger>\n );\n}\n\nexport function DropdownMenuSubContent({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.SubContent\n className={cx(styles.content, className)}\n {...props}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AAOA,SAAgB,aACd,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,8BAAsB,MAAvB,EAA4B,GAAI,MAAQ,CAAA;AACjD;AAEA,SAAgB,oBACd,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,8BAAsB,SAAvB,EAA+B,GAAI,MAAQ,CAAA;AACpD;AAEA,SAAgB,kBACd,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,8BAAsB,OAAvB,EAA6B,GAAI,MAAQ,CAAA;AAClD;AAEA,SAAgB,mBACd,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,8BAAsB,QAAvB,EAA8B,GAAI,MAAQ,CAAA;AACnD;AAEA,SAAgB,gBACd,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,8BAAsB,KAAvB,EAA2B,GAAI,MAAQ,CAAA;AAChD;AAEA,SAAgB,uBACd,OACA;CACA,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,8BAAsB,YAAvB,EAAkC,GAAI,MAAQ,CAAA;AACvD;AAEA,SAAgB,oBAAoB,EAClC,WACA,aAAa,GACb,GAAG,SAC0D;CAC7D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,8BAAsB,QAAvB,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,8BAAsB,SAAvB;EACc;EACZ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/dist/index33.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
//#region src/
|
|
2
|
-
var
|
|
3
|
-
|
|
1
|
+
//#region src/theme/constants.ts
|
|
2
|
+
var UZI_THEMES = [
|
|
3
|
+
"light",
|
|
4
|
+
"dark",
|
|
5
|
+
"system"
|
|
6
|
+
];
|
|
7
|
+
var UZI_ACCENTS = [
|
|
8
|
+
"blue",
|
|
9
|
+
"cyan",
|
|
10
|
+
"violet",
|
|
11
|
+
"emerald",
|
|
12
|
+
"amber",
|
|
13
|
+
"rose"
|
|
14
|
+
];
|
|
15
|
+
var THEME_STORAGE_KEY = "uzi-theme";
|
|
16
|
+
var ACCENT_STORAGE_KEY = "uzi-accent";
|
|
4
17
|
//#endregion
|
|
5
|
-
export {
|
|
18
|
+
export { ACCENT_STORAGE_KEY, THEME_STORAGE_KEY, UZI_ACCENTS, UZI_THEMES };
|
|
6
19
|
|
|
7
20
|
//# sourceMappingURL=index33.js.map
|
package/dist/index33.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index33.js","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index33.js","names":[],"sources":["../src/theme/constants.ts"],"sourcesContent":["export const UZI_THEMES = [\"light\", \"dark\", \"system\"] as const;\nexport const UZI_ACCENTS = [\"blue\", \"cyan\", \"violet\", \"emerald\", \"amber\", \"rose\"] as const;\n\nexport const THEME_STORAGE_KEY = \"uzi-theme\";\nexport const ACCENT_STORAGE_KEY = \"uzi-accent\";\n"],"mappings":";AAAA,IAAa,aAAa;CAAC;CAAS;CAAQ;AAAQ;AACpD,IAAa,cAAc;CAAC;CAAQ;CAAQ;CAAU;CAAW;CAAS;AAAM;AAEhF,IAAa,oBAAoB;AACjC,IAAa,qBAAqB"}
|
package/dist/index34.cjs
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
//#region src/
|
|
2
|
-
var
|
|
3
|
-
|
|
1
|
+
//#region src/theme/constants.ts
|
|
2
|
+
var UZI_THEMES = [
|
|
3
|
+
"light",
|
|
4
|
+
"dark",
|
|
5
|
+
"system"
|
|
6
|
+
];
|
|
7
|
+
var UZI_ACCENTS = [
|
|
8
|
+
"blue",
|
|
9
|
+
"cyan",
|
|
10
|
+
"violet",
|
|
11
|
+
"emerald",
|
|
12
|
+
"amber",
|
|
13
|
+
"rose"
|
|
14
|
+
];
|
|
15
|
+
var THEME_STORAGE_KEY = "uzi-theme";
|
|
16
|
+
var ACCENT_STORAGE_KEY = "uzi-accent";
|
|
4
17
|
//#endregion
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
18
|
+
exports.ACCENT_STORAGE_KEY = ACCENT_STORAGE_KEY;
|
|
19
|
+
exports.THEME_STORAGE_KEY = THEME_STORAGE_KEY;
|
|
20
|
+
exports.UZI_ACCENTS = UZI_ACCENTS;
|
|
21
|
+
exports.UZI_THEMES = UZI_THEMES;
|
|
7
22
|
|
|
8
23
|
//# sourceMappingURL=index34.cjs.map
|
package/dist/index34.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index34.cjs","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index34.cjs","names":[],"sources":["../src/theme/constants.ts"],"sourcesContent":["export const UZI_THEMES = [\"light\", \"dark\", \"system\"] as const;\nexport const UZI_ACCENTS = [\"blue\", \"cyan\", \"violet\", \"emerald\", \"amber\", \"rose\"] as const;\n\nexport const THEME_STORAGE_KEY = \"uzi-theme\";\nexport const ACCENT_STORAGE_KEY = \"uzi-accent\";\n"],"mappings":";AAAA,IAAa,aAAa;CAAC;CAAS;CAAQ;AAAQ;AACpD,IAAa,cAAc;CAAC;CAAQ;CAAQ;CAAU;CAAW;CAAS;AAAM;AAEhF,IAAa,oBAAoB;AACjC,IAAa,qBAAqB"}
|
package/dist/index34.js
CHANGED
|
@@ -1,66 +1,114 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
fill: "none",
|
|
15
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
16
|
-
d: "M20 15.2A8.5 8.5 0 0 1 8.8 4 9 9 0 1 0 20 15.2Z",
|
|
17
|
-
stroke: "currentColor",
|
|
18
|
-
strokeWidth: "1.8",
|
|
19
|
-
strokeLinecap: "round",
|
|
20
|
-
strokeLinejoin: "round"
|
|
21
|
-
})
|
|
22
|
-
});
|
|
2
|
+
import { ToastProvider } from "./index19.js";
|
|
3
|
+
import { ACCENT_STORAGE_KEY as ACCENT_STORAGE_KEY$1, THEME_STORAGE_KEY as THEME_STORAGE_KEY$1, UZI_ACCENTS, UZI_THEMES } from "./index33.js";
|
|
4
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/theme/ThemeProvider.tsx
|
|
7
|
+
var THEME_STORAGE_KEY = THEME_STORAGE_KEY$1;
|
|
8
|
+
var ACCENT_STORAGE_KEY = ACCENT_STORAGE_KEY$1;
|
|
9
|
+
var THEME_ATTRIBUTE = "data-uzi-theme";
|
|
10
|
+
var ACCENT_ATTRIBUTE = "data-uzi-accent";
|
|
11
|
+
var ThemeContext = createContext(void 0);
|
|
12
|
+
function isTheme(value) {
|
|
13
|
+
return UZI_THEMES.includes(value);
|
|
23
14
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
26
|
-
viewBox: "0 0 24 24",
|
|
27
|
-
"aria-hidden": "true",
|
|
28
|
-
width: "16",
|
|
29
|
-
height: "16",
|
|
30
|
-
fill: "none",
|
|
31
|
-
children: [/* @__PURE__ */ jsx("circle", {
|
|
32
|
-
cx: "12",
|
|
33
|
-
cy: "12",
|
|
34
|
-
r: "4",
|
|
35
|
-
stroke: "currentColor",
|
|
36
|
-
strokeWidth: "1.8"
|
|
37
|
-
}), /* @__PURE__ */ jsx("path", {
|
|
38
|
-
d: "M12 2.75v2.5M12 18.75v2.5M21.25 12h-2.5M5.25 12h-2.5M18.54 5.46l-1.77 1.77M7.23 16.77l-1.77 1.77M18.54 18.54l-1.77-1.77M7.23 7.23 5.46 5.46",
|
|
39
|
-
stroke: "currentColor",
|
|
40
|
-
strokeWidth: "1.8",
|
|
41
|
-
strokeLinecap: "round"
|
|
42
|
-
})]
|
|
43
|
-
});
|
|
15
|
+
function isAccent(value) {
|
|
16
|
+
return UZI_ACCENTS.includes(value);
|
|
44
17
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
18
|
+
function getSystemTheme() {
|
|
19
|
+
if (typeof window === "undefined") return "light";
|
|
20
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
21
|
+
}
|
|
22
|
+
function ThemeProvider({ children, theme, defaultTheme = "system", accent, defaultAccent = "blue", onThemeChange, onAccentChange, storageKey = THEME_STORAGE_KEY, accentStorageKey = ACCENT_STORAGE_KEY, disableStorage = false, toastConfig }) {
|
|
23
|
+
const [internalTheme, setInternalTheme] = useState(defaultTheme);
|
|
24
|
+
const [internalAccent, setInternalAccent] = useState(defaultAccent);
|
|
25
|
+
const [systemTheme, setSystemTheme] = useState("light");
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setSystemTheme(getSystemTheme());
|
|
28
|
+
if (!disableStorage) {
|
|
29
|
+
const storedTheme = window.localStorage.getItem(storageKey);
|
|
30
|
+
if (isTheme(storedTheme)) setInternalTheme(storedTheme);
|
|
31
|
+
const storedAccent = window.localStorage.getItem(accentStorageKey);
|
|
32
|
+
if (isAccent(storedAccent)) setInternalAccent(storedAccent);
|
|
33
|
+
}
|
|
34
|
+
}, [
|
|
35
|
+
disableStorage,
|
|
36
|
+
storageKey,
|
|
37
|
+
accentStorageKey
|
|
38
|
+
]);
|
|
39
|
+
const isThemeControlled = theme !== void 0;
|
|
40
|
+
const isAccentControlled = accent !== void 0;
|
|
41
|
+
const currentTheme = isThemeControlled ? theme : internalTheme;
|
|
42
|
+
const currentAccent = isAccentControlled ? accent : internalAccent;
|
|
43
|
+
const resolvedTheme = currentTheme === "system" ? systemTheme : currentTheme;
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (typeof window === "undefined") return;
|
|
46
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
47
|
+
const handleChange = () => setSystemTheme(mediaQuery.matches ? "dark" : "light");
|
|
48
|
+
handleChange();
|
|
49
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
50
|
+
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
51
|
+
}, []);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (typeof document === "undefined") return;
|
|
54
|
+
const root = document.documentElement;
|
|
55
|
+
root.setAttribute(THEME_ATTRIBUTE, resolvedTheme);
|
|
56
|
+
root.setAttribute(ACCENT_ATTRIBUTE, currentAccent);
|
|
57
|
+
root.style.colorScheme = resolvedTheme;
|
|
58
|
+
root.classList.toggle("dark", resolvedTheme === "dark");
|
|
59
|
+
}, [currentAccent, resolvedTheme]);
|
|
60
|
+
const setTheme = useCallback((nextTheme) => {
|
|
61
|
+
if (!isThemeControlled) setInternalTheme(nextTheme);
|
|
62
|
+
if (!disableStorage && typeof window !== "undefined") window.localStorage.setItem(storageKey, nextTheme);
|
|
63
|
+
onThemeChange?.(nextTheme);
|
|
64
|
+
}, [
|
|
65
|
+
disableStorage,
|
|
66
|
+
isThemeControlled,
|
|
67
|
+
onThemeChange,
|
|
68
|
+
storageKey
|
|
69
|
+
]);
|
|
70
|
+
const setAccent = useCallback((nextAccent) => {
|
|
71
|
+
if (!isAccentControlled) setInternalAccent(nextAccent);
|
|
72
|
+
if (!disableStorage && typeof window !== "undefined") window.localStorage.setItem(accentStorageKey, nextAccent);
|
|
73
|
+
onAccentChange?.(nextAccent);
|
|
74
|
+
}, [
|
|
75
|
+
accentStorageKey,
|
|
76
|
+
disableStorage,
|
|
77
|
+
isAccentControlled,
|
|
78
|
+
onAccentChange
|
|
79
|
+
]);
|
|
80
|
+
const toggleTheme = useCallback(() => {
|
|
81
|
+
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
|
82
|
+
}, [resolvedTheme, setTheme]);
|
|
83
|
+
const value = useMemo(() => ({
|
|
84
|
+
theme: currentTheme,
|
|
85
|
+
resolvedTheme,
|
|
86
|
+
accent: currentAccent,
|
|
87
|
+
setTheme,
|
|
88
|
+
setAccent,
|
|
89
|
+
toggleTheme
|
|
90
|
+
}), [
|
|
91
|
+
currentAccent,
|
|
92
|
+
currentTheme,
|
|
93
|
+
resolvedTheme,
|
|
94
|
+
setAccent,
|
|
95
|
+
setTheme,
|
|
96
|
+
toggleTheme
|
|
97
|
+
]);
|
|
98
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
99
|
+
value,
|
|
100
|
+
children: /* @__PURE__ */ jsx(ToastProvider, {
|
|
101
|
+
config: toastConfig,
|
|
102
|
+
children
|
|
103
|
+
})
|
|
61
104
|
});
|
|
62
105
|
}
|
|
106
|
+
function useTheme() {
|
|
107
|
+
const context = useContext(ThemeContext);
|
|
108
|
+
if (!context) throw new Error("useTheme must be used within a ThemeProvider");
|
|
109
|
+
return context;
|
|
110
|
+
}
|
|
63
111
|
//#endregion
|
|
64
|
-
export {
|
|
112
|
+
export { ThemeProvider, useTheme };
|
|
65
113
|
|
|
66
114
|
//# sourceMappingURL=index34.js.map
|
package/dist/index34.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index34.js","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index34.js","names":[],"sources":["../src/theme/ThemeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n} from \"react\";\nimport { UZI_THEMES, UZI_ACCENTS, THEME_STORAGE_KEY as DEFAULT_THEME_KEY, ACCENT_STORAGE_KEY as DEFAULT_ACCENT_KEY } from \"./constants\";\nimport { ToastProvider } from \"../components/toast/ToastContext\";\nimport type { ToastConfig } from \"../components/toast/types\";\n\nexport type UziTheme = typeof UZI_THEMES[number];\nexport type UziResolvedTheme = \"light\" | \"dark\";\nexport type UziAccent = typeof UZI_ACCENTS[number];\n\ntype ThemeContextValue = {\n theme: UziTheme;\n resolvedTheme: UziResolvedTheme;\n accent: UziAccent;\n setTheme: (theme: UziTheme) => void;\n setAccent: (accent: UziAccent) => void;\n toggleTheme: () => void;\n};\n\ntype ThemeProviderProps = {\n children: ReactNode;\n theme?: UziTheme;\n defaultTheme?: UziTheme;\n accent?: UziAccent;\n defaultAccent?: UziAccent;\n onThemeChange?: (theme: UziTheme) => void;\n onAccentChange?: (accent: UziAccent) => void;\n storageKey?: string;\n accentStorageKey?: string;\n disableStorage?: boolean;\n toastConfig?: ToastConfig;\n};\n\nconst THEME_STORAGE_KEY = DEFAULT_THEME_KEY;\nconst ACCENT_STORAGE_KEY = DEFAULT_ACCENT_KEY;\nconst THEME_ATTRIBUTE = \"data-uzi-theme\";\nconst ACCENT_ATTRIBUTE = \"data-uzi-accent\";\n\nconst ThemeContext = createContext<ThemeContextValue | undefined>(undefined);\n\nfunction isTheme(value: string | null): value is UziTheme {\n return UZI_THEMES.includes(value as UziTheme);\n}\n\nfunction isAccent(value: string | null): value is UziAccent {\n return UZI_ACCENTS.includes(value as UziAccent);\n}\n\nfunction getSystemTheme(): UziResolvedTheme {\n if (typeof window === \"undefined\") return \"light\";\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n}\n\nexport function ThemeProvider({\n children,\n theme,\n defaultTheme = \"system\",\n accent,\n defaultAccent = \"blue\",\n onThemeChange,\n onAccentChange,\n storageKey = THEME_STORAGE_KEY,\n accentStorageKey = ACCENT_STORAGE_KEY,\n disableStorage = false,\n toastConfig,\n}: ThemeProviderProps) {\n const [internalTheme, setInternalTheme] = useState<UziTheme>(defaultTheme);\n const [internalAccent, setInternalAccent] = useState<UziAccent>(defaultAccent);\n const [systemTheme, setSystemTheme] = useState<UziResolvedTheme>(\"light\");\n\n useEffect(() => {\n setSystemTheme(getSystemTheme());\n if (!disableStorage) {\n const storedTheme = window.localStorage.getItem(storageKey);\n if (isTheme(storedTheme)) setInternalTheme(storedTheme);\n const storedAccent = window.localStorage.getItem(accentStorageKey);\n if (isAccent(storedAccent)) setInternalAccent(storedAccent);\n }\n }, [disableStorage, storageKey, accentStorageKey]);\n\n const isThemeControlled = theme !== undefined;\n const isAccentControlled = accent !== undefined;\n\n const currentTheme = isThemeControlled ? theme : internalTheme;\n const currentAccent = isAccentControlled ? accent : internalAccent;\n const resolvedTheme = currentTheme === \"system\" ? systemTheme : currentTheme;\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n\n const mediaQuery = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const handleChange = () => setSystemTheme(mediaQuery.matches ? \"dark\" : \"light\");\n\n handleChange();\n mediaQuery.addEventListener(\"change\", handleChange);\n return () => mediaQuery.removeEventListener(\"change\", handleChange);\n }, []);\n\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n const root = document.documentElement;\n root.setAttribute(THEME_ATTRIBUTE, resolvedTheme);\n root.setAttribute(ACCENT_ATTRIBUTE, currentAccent);\n root.style.colorScheme = resolvedTheme;\n root.classList.toggle(\"dark\", resolvedTheme === \"dark\");\n }, [currentAccent, resolvedTheme]);\n\n const setTheme = useCallback(\n (nextTheme: UziTheme) => {\n if (!isThemeControlled) setInternalTheme(nextTheme);\n if (!disableStorage && typeof window !== \"undefined\") {\n window.localStorage.setItem(storageKey, nextTheme);\n }\n onThemeChange?.(nextTheme);\n },\n [disableStorage, isThemeControlled, onThemeChange, storageKey],\n );\n\n const setAccent = useCallback(\n (nextAccent: UziAccent) => {\n if (!isAccentControlled) setInternalAccent(nextAccent);\n if (!disableStorage && typeof window !== \"undefined\") {\n window.localStorage.setItem(accentStorageKey, nextAccent);\n }\n onAccentChange?.(nextAccent);\n },\n [accentStorageKey, disableStorage, isAccentControlled, onAccentChange],\n );\n\n const toggleTheme = useCallback(() => {\n setTheme(resolvedTheme === \"dark\" ? \"light\" : \"dark\");\n }, [resolvedTheme, setTheme]);\n\n const value = useMemo<ThemeContextValue>(\n () => ({\n theme: currentTheme,\n resolvedTheme,\n accent: currentAccent,\n setTheme,\n setAccent,\n toggleTheme,\n }),\n [currentAccent, currentTheme, resolvedTheme, setAccent, setTheme, toggleTheme],\n );\n\n return (\n <ThemeContext.Provider value={value}>\n <ToastProvider config={toastConfig}>{children}</ToastProvider>\n </ThemeContext.Provider>\n );\n}\n\nexport function useTheme() {\n const context = useContext(ThemeContext);\n if (!context) throw new Error(\"useTheme must be used within a ThemeProvider\");\n return context;\n}\n"],"mappings":";;;;;;AA0CA,IAAM,oBAAoB;AAC1B,IAAM,qBAAqB;AAC3B,IAAM,kBAAkB;AACxB,IAAM,mBAAmB;AAEzB,IAAM,eAAe,cAA6C,KAAA,CAAS;AAE3E,SAAS,QAAQ,OAAyC;CACxD,OAAO,WAAW,SAAS,KAAiB;AAC9C;AAEA,SAAS,SAAS,OAA0C;CAC1D,OAAO,YAAY,SAAS,KAAkB;AAChD;AAEA,SAAS,iBAAmC;CAC1C,IAAI,OAAO,WAAW,aAAa,OAAO;CAC1C,OAAO,OAAO,WAAW,8BAA8B,CAAC,CAAC,UAAU,SAAS;AAC9E;AAEA,SAAgB,cAAc,EAC5B,UACA,OACA,eAAe,UACf,QACA,gBAAgB,QAChB,eACA,gBACA,aAAa,mBACb,mBAAmB,oBACnB,iBAAiB,OACjB,eACqB;CACrB,MAAM,CAAC,eA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