@hyddenlabs/hydn-ui 0.3.0-alpha.104 → 0.3.0-alpha.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +507 -313
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -17
- package/dist/index.d.ts +39 -17
- package/dist/index.js +383 -207
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1,157 +1,215 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var React6 = require('react');
|
|
3
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var
|
|
5
|
-
var iconsReact = require('@tabler/icons-react');
|
|
5
|
+
var TablerIcons = require('@tabler/icons-react');
|
|
6
6
|
var reactRouterDom = require('react-router-dom');
|
|
7
7
|
var reactDom = require('react-dom');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
function _interopNamespace(e) {
|
|
12
|
+
if (e && e.__esModule) return e;
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n.default = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var React6__default = /*#__PURE__*/_interopDefault(React6);
|
|
30
|
+
var TablerIcons__namespace = /*#__PURE__*/_interopNamespace(TablerIcons);
|
|
12
31
|
|
|
13
32
|
// src/components/forms/button/button.tsx
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const solidVariantClasses = {
|
|
37
|
-
neutral: "bg-neutral text-neutral-foreground hover:bg-neutral/90 active:bg-neutral/80",
|
|
38
|
-
primary: "bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80",
|
|
39
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/90 active:bg-secondary/80",
|
|
40
|
-
accent: "bg-accent text-accent-foreground hover:bg-accent/90 active:bg-accent/80",
|
|
41
|
-
info: "bg-info text-info-foreground hover:bg-info/90 active:bg-info/80",
|
|
42
|
-
success: "bg-success text-success-foreground hover:bg-success/90 active:bg-success/80",
|
|
43
|
-
warning: "bg-warning text-warning-foreground hover:bg-warning/90 active:bg-warning/80",
|
|
44
|
-
error: "bg-destructive text-destructive-foreground hover:bg-destructive/90 active:bg-destructive/80"
|
|
45
|
-
};
|
|
46
|
-
const outlineVariantClasses = {
|
|
47
|
-
neutral: "border-2 border-neutral text-neutral bg-transparent hover:bg-neutral hover:text-neutral-foreground",
|
|
48
|
-
primary: "border-2 border-primary text-primary bg-transparent hover:bg-primary hover:text-primary-foreground",
|
|
49
|
-
secondary: "border-2 border-secondary text-secondary bg-transparent hover:bg-secondary hover:text-secondary-foreground",
|
|
50
|
-
accent: "border-2 border-accent text-accent bg-transparent hover:bg-accent hover:text-accent-foreground",
|
|
51
|
-
info: "border-2 border-info text-info bg-transparent hover:bg-info hover:text-info-foreground",
|
|
52
|
-
success: "border-2 border-success text-success bg-transparent hover:bg-success hover:text-success-foreground",
|
|
53
|
-
warning: "border-2 border-warning text-warning bg-transparent hover:bg-warning hover:text-warning-foreground",
|
|
54
|
-
error: "border-2 border-destructive text-destructive bg-transparent hover:bg-destructive hover:text-destructive-foreground"
|
|
55
|
-
};
|
|
56
|
-
const ghostVariantClasses = {
|
|
57
|
-
neutral: "bg-transparent text-foreground hover:bg-neutral/10 active:bg-neutral/20",
|
|
58
|
-
primary: "bg-transparent text-primary hover:bg-primary/10 active:bg-primary/20",
|
|
59
|
-
secondary: "bg-transparent text-secondary hover:bg-secondary/10 active:bg-secondary/20",
|
|
60
|
-
accent: "bg-transparent text-accent hover:bg-accent/10 active:bg-accent/20",
|
|
61
|
-
info: "bg-transparent text-info hover:bg-info/10 active:bg-info/20",
|
|
62
|
-
success: "bg-transparent text-success hover:bg-success/10 active:bg-success/20",
|
|
63
|
-
warning: "bg-transparent text-warning hover:bg-warning/10 active:bg-warning/20",
|
|
64
|
-
error: "bg-transparent text-destructive hover:bg-destructive/10 active:bg-destructive/20"
|
|
65
|
-
};
|
|
66
|
-
const softVariantClasses = {
|
|
67
|
-
neutral: "bg-neutral/20 text-foreground hover:bg-neutral/30 active:bg-neutral/40",
|
|
68
|
-
primary: "bg-primary/20 text-primary hover:bg-primary/30 active:bg-primary/40",
|
|
69
|
-
secondary: "bg-secondary/20 text-secondary hover:bg-secondary/30 active:bg-secondary/40",
|
|
70
|
-
accent: "bg-accent/20 text-accent hover:bg-accent/30 active:bg-accent/40",
|
|
71
|
-
info: "bg-info/20 text-info hover:bg-info/30 active:bg-info/40",
|
|
72
|
-
success: "bg-success/20 text-success hover:bg-success/30 active:bg-success/40",
|
|
73
|
-
warning: "bg-warning/20 text-warning hover:bg-warning/30 active:bg-warning/40",
|
|
74
|
-
error: "bg-destructive/20 text-destructive hover:bg-destructive/30 active:bg-destructive/40"
|
|
75
|
-
};
|
|
76
|
-
const linkVariantClasses = {
|
|
77
|
-
neutral: "bg-transparent text-foreground underline-offset-4 hover:underline",
|
|
78
|
-
primary: "bg-transparent text-primary underline-offset-4 hover:underline",
|
|
79
|
-
secondary: "bg-transparent text-secondary underline-offset-4 hover:underline",
|
|
80
|
-
accent: "bg-transparent text-accent underline-offset-4 hover:underline",
|
|
81
|
-
info: "bg-transparent text-info underline-offset-4 hover:underline",
|
|
82
|
-
success: "bg-transparent text-success underline-offset-4 hover:underline",
|
|
83
|
-
warning: "bg-transparent text-warning underline-offset-4 hover:underline",
|
|
84
|
-
error: "bg-transparent text-destructive underline-offset-4 hover:underline"
|
|
85
|
-
};
|
|
86
|
-
const getStyleClasses = () => {
|
|
87
|
-
const variantKey = variant;
|
|
88
|
-
switch (style) {
|
|
89
|
-
case "outline":
|
|
90
|
-
return `${outlineVariantClasses[variantKey]} active:scale-95`;
|
|
91
|
-
case "ghost":
|
|
92
|
-
return ghostVariantClasses[variantKey];
|
|
93
|
-
case "link":
|
|
94
|
-
return linkVariantClasses[variantKey];
|
|
95
|
-
case "soft":
|
|
96
|
-
return softVariantClasses[variantKey];
|
|
97
|
-
case "solid":
|
|
98
|
-
default:
|
|
99
|
-
return `${solidVariantClasses[variantKey]} shadow-sm hover:shadow-md`;
|
|
33
|
+
var Button = React6__default.default.forwardRef(
|
|
34
|
+
({
|
|
35
|
+
children,
|
|
36
|
+
onClick,
|
|
37
|
+
ariaLabel,
|
|
38
|
+
disabled = false,
|
|
39
|
+
type = "button",
|
|
40
|
+
className = "",
|
|
41
|
+
icon,
|
|
42
|
+
iconPosition = "left",
|
|
43
|
+
variant = "neutral",
|
|
44
|
+
style = "solid",
|
|
45
|
+
size = "md",
|
|
46
|
+
rounded = "default",
|
|
47
|
+
loading = false,
|
|
48
|
+
fullWidth = false,
|
|
49
|
+
wide = false,
|
|
50
|
+
active = false
|
|
51
|
+
}, ref) => {
|
|
52
|
+
const isIconOnly = icon && !children;
|
|
53
|
+
if (isIconOnly && !ariaLabel) {
|
|
54
|
+
console.warn("Button: Icon-only buttons require an ariaLabel for accessibility");
|
|
100
55
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"
|
|
56
|
+
const solidVariantClasses = {
|
|
57
|
+
neutral: "bg-neutral text-neutral-foreground hover:bg-neutral/90 active:bg-neutral/80",
|
|
58
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80",
|
|
59
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/90 active:bg-secondary/80",
|
|
60
|
+
accent: "bg-accent text-accent-foreground hover:bg-accent/90 active:bg-accent/80",
|
|
61
|
+
info: "bg-info text-info-foreground hover:bg-info/90 active:bg-info/80",
|
|
62
|
+
success: "bg-success text-success-foreground hover:bg-success/90 active:bg-success/80",
|
|
63
|
+
warning: "bg-warning text-warning-foreground hover:bg-warning/90 active:bg-warning/80",
|
|
64
|
+
error: "bg-destructive text-destructive-foreground hover:bg-destructive/90 active:bg-destructive/80"
|
|
65
|
+
};
|
|
66
|
+
const outlineVariantClasses = {
|
|
67
|
+
neutral: "border-2 border-neutral text-neutral bg-transparent hover:bg-neutral hover:text-neutral-foreground",
|
|
68
|
+
primary: "border-2 border-primary text-primary bg-transparent hover:bg-primary hover:text-primary-foreground",
|
|
69
|
+
secondary: "border-2 border-secondary text-secondary bg-transparent hover:bg-secondary hover:text-secondary-foreground",
|
|
70
|
+
accent: "border-2 border-accent text-accent bg-transparent hover:bg-accent hover:text-accent-foreground",
|
|
71
|
+
info: "border-2 border-info text-info bg-transparent hover:bg-info hover:text-info-foreground",
|
|
72
|
+
success: "border-2 border-success text-success bg-transparent hover:bg-success hover:text-success-foreground",
|
|
73
|
+
warning: "border-2 border-warning text-warning bg-transparent hover:bg-warning hover:text-warning-foreground",
|
|
74
|
+
error: "border-2 border-destructive text-destructive bg-transparent hover:bg-destructive hover:text-destructive-foreground"
|
|
75
|
+
};
|
|
76
|
+
const ghostVariantClasses = {
|
|
77
|
+
neutral: "bg-transparent text-foreground hover:bg-neutral/10 active:bg-neutral/20",
|
|
78
|
+
primary: "bg-transparent text-primary hover:bg-primary/10 active:bg-primary/20",
|
|
79
|
+
secondary: "bg-transparent text-secondary hover:bg-secondary/10 active:bg-secondary/20",
|
|
80
|
+
accent: "bg-transparent text-accent hover:bg-accent/10 active:bg-accent/20",
|
|
81
|
+
info: "bg-transparent text-info hover:bg-info/10 active:bg-info/20",
|
|
82
|
+
success: "bg-transparent text-success hover:bg-success/10 active:bg-success/20",
|
|
83
|
+
warning: "bg-transparent text-warning hover:bg-warning/10 active:bg-warning/20",
|
|
84
|
+
error: "bg-transparent text-destructive hover:bg-destructive/10 active:bg-destructive/20"
|
|
85
|
+
};
|
|
86
|
+
const softVariantClasses = {
|
|
87
|
+
neutral: "bg-neutral/20 text-foreground hover:bg-neutral/30 active:bg-neutral/40",
|
|
88
|
+
primary: "bg-primary/20 text-primary hover:bg-primary/30 active:bg-primary/40",
|
|
89
|
+
secondary: "bg-secondary/20 text-secondary hover:bg-secondary/30 active:bg-secondary/40",
|
|
90
|
+
accent: "bg-accent/20 text-accent hover:bg-accent/30 active:bg-accent/40",
|
|
91
|
+
info: "bg-info/20 text-info hover:bg-info/30 active:bg-info/40",
|
|
92
|
+
success: "bg-success/20 text-success hover:bg-success/30 active:bg-success/40",
|
|
93
|
+
warning: "bg-warning/20 text-warning hover:bg-warning/30 active:bg-warning/40",
|
|
94
|
+
error: "bg-destructive/20 text-destructive hover:bg-destructive/30 active:bg-destructive/40"
|
|
95
|
+
};
|
|
96
|
+
const linkVariantClasses = {
|
|
97
|
+
neutral: "bg-transparent text-foreground underline-offset-4 hover:underline",
|
|
98
|
+
primary: "bg-transparent text-primary underline-offset-4 hover:underline",
|
|
99
|
+
secondary: "bg-transparent text-secondary underline-offset-4 hover:underline",
|
|
100
|
+
accent: "bg-transparent text-accent underline-offset-4 hover:underline",
|
|
101
|
+
info: "bg-transparent text-info underline-offset-4 hover:underline",
|
|
102
|
+
success: "bg-transparent text-success underline-offset-4 hover:underline",
|
|
103
|
+
warning: "bg-transparent text-warning underline-offset-4 hover:underline",
|
|
104
|
+
error: "bg-transparent text-destructive underline-offset-4 hover:underline"
|
|
105
|
+
};
|
|
106
|
+
const getStyleClasses = () => {
|
|
107
|
+
const variantKey = variant;
|
|
108
|
+
switch (style) {
|
|
109
|
+
case "outline":
|
|
110
|
+
return `${outlineVariantClasses[variantKey]} active:scale-95`;
|
|
111
|
+
case "ghost":
|
|
112
|
+
return ghostVariantClasses[variantKey];
|
|
113
|
+
case "link":
|
|
114
|
+
return linkVariantClasses[variantKey];
|
|
115
|
+
case "soft":
|
|
116
|
+
return softVariantClasses[variantKey];
|
|
117
|
+
case "solid":
|
|
118
|
+
default:
|
|
119
|
+
return `${solidVariantClasses[variantKey]} shadow-sm hover:shadow-md`;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const sizeClasses2 = {
|
|
123
|
+
xs: "h-8 sm:h-6 px-3 sm:px-2 text-sm sm:text-xs min-h-8 sm:min-h-6",
|
|
124
|
+
sm: "h-10 sm:h-8 px-4 sm:px-3 text-base sm:text-sm min-h-10 sm:min-h-8",
|
|
125
|
+
md: "h-12 sm:h-10 px-5 sm:px-4 text-base min-h-12 sm:min-h-10",
|
|
126
|
+
lg: "h-14 sm:h-12 px-7 sm:px-6 text-lg min-h-14 sm:min-h-12",
|
|
127
|
+
xl: "h-16 sm:h-14 px-9 sm:px-8 text-xl min-h-16 sm:min-h-14"
|
|
128
|
+
};
|
|
129
|
+
const roundedClasses = {
|
|
130
|
+
default: "rounded-md",
|
|
131
|
+
pill: "rounded-full",
|
|
132
|
+
square: "rounded-none aspect-square",
|
|
133
|
+
circle: "rounded-full aspect-square"
|
|
134
|
+
};
|
|
135
|
+
const displayIcon = loading ? /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
136
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
137
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
"path",
|
|
139
|
+
{
|
|
140
|
+
className: "opacity-75",
|
|
141
|
+
fill: "currentColor",
|
|
142
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] }) : icon;
|
|
146
|
+
const styleClasses = getStyleClasses();
|
|
147
|
+
const widthClasses = fullWidth ? "w-full" : wide ? "px-8" : "";
|
|
148
|
+
const activeClasses = active ? "active:scale-95" : "";
|
|
149
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
150
|
+
"button",
|
|
119
151
|
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
152
|
+
ref,
|
|
153
|
+
type,
|
|
154
|
+
onClick,
|
|
155
|
+
"aria-label": ariaLabel,
|
|
156
|
+
disabled: disabled || loading,
|
|
157
|
+
className: `inline-flex items-center justify-center ${roundedClasses[rounded]} font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 ${styleClasses} ${sizeClasses2[size]} ${isIconOnly ? "p-0" : ""} ${widthClasses} ${activeClasses} ${className}`,
|
|
158
|
+
children: [
|
|
159
|
+
displayIcon && iconPosition === "left" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex ${children ? "mr-2" : ""}`, children: displayIcon }),
|
|
160
|
+
children,
|
|
161
|
+
displayIcon && iconPosition === "right" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex ${children ? "ml-2" : ""}`, children: displayIcon })
|
|
162
|
+
]
|
|
123
163
|
}
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
Button.displayName = "Button";
|
|
168
|
+
var button_default = Button;
|
|
169
|
+
var sizeMap = {
|
|
170
|
+
xs: 16,
|
|
171
|
+
sm: 18,
|
|
172
|
+
md: 22,
|
|
173
|
+
lg: 26,
|
|
174
|
+
xl: 30,
|
|
175
|
+
"2xl": 36
|
|
176
|
+
};
|
|
177
|
+
var Icon = ({
|
|
178
|
+
name,
|
|
179
|
+
size = "md",
|
|
180
|
+
color = "currentColor",
|
|
181
|
+
strokeWidth = 2,
|
|
182
|
+
className = "",
|
|
183
|
+
onClick
|
|
184
|
+
}) => {
|
|
185
|
+
const pascalName = name.split(/[-_]/).filter((s) => s).map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("");
|
|
186
|
+
const componentName = pascalName.startsWith("Icon") ? pascalName : "Icon" + pascalName;
|
|
187
|
+
const IconComponent = TablerIcons__namespace[componentName];
|
|
188
|
+
if (!IconComponent) return null;
|
|
189
|
+
const pixelSize = typeof size === "number" ? size : sizeMap[size] || sizeMap.md;
|
|
190
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
191
|
+
IconComponent,
|
|
131
192
|
{
|
|
132
|
-
|
|
193
|
+
size: pixelSize,
|
|
194
|
+
color,
|
|
195
|
+
strokeWidth,
|
|
196
|
+
className,
|
|
133
197
|
onClick,
|
|
134
|
-
"aria-
|
|
135
|
-
disabled: disabled || loading,
|
|
136
|
-
className: `inline-flex items-center justify-center ${roundedClasses[rounded]} font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 ${styleClasses} ${sizeClasses2[size]} ${isIconOnly ? "p-0" : ""} ${widthClasses} ${activeClasses} ${className}`,
|
|
137
|
-
children: [
|
|
138
|
-
displayIcon && iconPosition === "left" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex ${children ? "mr-2" : ""}`, children: displayIcon }),
|
|
139
|
-
children,
|
|
140
|
-
displayIcon && iconPosition === "right" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex ${children ? "ml-2" : ""}`, children: displayIcon })
|
|
141
|
-
]
|
|
198
|
+
"aria-hidden": "true"
|
|
142
199
|
}
|
|
143
200
|
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
var button_default = Button;
|
|
201
|
+
};
|
|
202
|
+
Icon.displayName = "Icon";
|
|
147
203
|
function Input({
|
|
148
204
|
value,
|
|
149
205
|
onChange,
|
|
206
|
+
onFocus,
|
|
150
207
|
placeholder,
|
|
151
208
|
disabled = false,
|
|
152
209
|
type = "text",
|
|
153
210
|
className = "",
|
|
154
211
|
ariaLabel,
|
|
212
|
+
ref,
|
|
155
213
|
id,
|
|
156
214
|
name,
|
|
157
215
|
required = false,
|
|
@@ -174,7 +232,9 @@ function Input({
|
|
|
174
232
|
{
|
|
175
233
|
type,
|
|
176
234
|
value,
|
|
235
|
+
ref,
|
|
177
236
|
onChange,
|
|
237
|
+
onFocus,
|
|
178
238
|
placeholder,
|
|
179
239
|
disabled,
|
|
180
240
|
"aria-label": ariaLabel,
|
|
@@ -221,9 +281,9 @@ function Checkbox({
|
|
|
221
281
|
}
|
|
222
282
|
Checkbox.displayName = "Checkbox";
|
|
223
283
|
var checkbox_default = Checkbox;
|
|
224
|
-
var RadioGroupContext =
|
|
284
|
+
var RadioGroupContext = React6.createContext(null);
|
|
225
285
|
var useRadioGroup = () => {
|
|
226
|
-
const context =
|
|
286
|
+
const context = React6.useContext(RadioGroupContext);
|
|
227
287
|
return context;
|
|
228
288
|
};
|
|
229
289
|
function RadioGroup({
|
|
@@ -269,7 +329,7 @@ function Radio({
|
|
|
269
329
|
success: "border-success focus:ring-success",
|
|
270
330
|
warning: "border-warning focus:ring-warning"
|
|
271
331
|
};
|
|
272
|
-
const generatedId =
|
|
332
|
+
const generatedId = React6.useId();
|
|
273
333
|
const inputId = id || `radio-${value || generatedId}`;
|
|
274
334
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
275
335
|
"div",
|
|
@@ -368,13 +428,13 @@ function MultiSelect({
|
|
|
368
428
|
size = "md",
|
|
369
429
|
className = ""
|
|
370
430
|
}) {
|
|
371
|
-
const [isOpen, setIsOpen] =
|
|
372
|
-
const [searchQuery, setSearchQuery] =
|
|
373
|
-
const [focusedIndex, setFocusedIndex] =
|
|
374
|
-
const containerRef =
|
|
375
|
-
const searchInputRef =
|
|
431
|
+
const [isOpen, setIsOpen] = React6.useState(false);
|
|
432
|
+
const [searchQuery, setSearchQuery] = React6.useState("");
|
|
433
|
+
const [focusedIndex, setFocusedIndex] = React6.useState(-1);
|
|
434
|
+
const containerRef = React6.useRef(null);
|
|
435
|
+
const searchInputRef = React6.useRef(null);
|
|
376
436
|
const selectedValues = value || [];
|
|
377
|
-
|
|
437
|
+
React6.useEffect(() => {
|
|
378
438
|
const handleClickOutside = (event) => {
|
|
379
439
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
380
440
|
setIsOpen(false);
|
|
@@ -387,7 +447,7 @@ function MultiSelect({
|
|
|
387
447
|
}
|
|
388
448
|
return void 0;
|
|
389
449
|
}, [isOpen]);
|
|
390
|
-
|
|
450
|
+
React6.useEffect(() => {
|
|
391
451
|
if (isOpen && searchInputRef.current) {
|
|
392
452
|
searchInputRef.current.focus();
|
|
393
453
|
}
|
|
@@ -497,7 +557,7 @@ function MultiSelect({
|
|
|
497
557
|
className: "hover:bg-primary/20 rounded-sm transition-colors duration-150",
|
|
498
558
|
"aria-label": `Remove ${label}`,
|
|
499
559
|
tabIndex: -1,
|
|
500
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
560
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconX, { size: currentSize.icon - 4 })
|
|
501
561
|
}
|
|
502
562
|
)
|
|
503
563
|
]
|
|
@@ -513,11 +573,11 @@ function MultiSelect({
|
|
|
513
573
|
className: "p-1 hover:bg-muted rounded transition-colors",
|
|
514
574
|
"aria-label": "Clear all",
|
|
515
575
|
tabIndex: -1,
|
|
516
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
576
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconX, { size: currentSize.icon })
|
|
517
577
|
}
|
|
518
578
|
),
|
|
519
579
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
520
|
-
|
|
580
|
+
TablerIcons.IconChevronDown,
|
|
521
581
|
{
|
|
522
582
|
size: currentSize.icon,
|
|
523
583
|
className: `text-muted-foreground transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
@@ -564,7 +624,7 @@ function MultiSelect({
|
|
|
564
624
|
disabled: isDisabled,
|
|
565
625
|
children: [
|
|
566
626
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", children: option.label }),
|
|
567
|
-
isSelected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
627
|
+
isSelected && /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconCheck, { size: currentSize.icon, className: "flex-shrink-0 animate-scaleIn" })
|
|
568
628
|
]
|
|
569
629
|
},
|
|
570
630
|
option.value
|
|
@@ -780,48 +840,153 @@ ButtonGroup.displayName = "ButtonGroup";
|
|
|
780
840
|
var button_group_default = ButtonGroup;
|
|
781
841
|
function Text({
|
|
782
842
|
children,
|
|
843
|
+
as = "p",
|
|
783
844
|
variant = "body",
|
|
784
845
|
size,
|
|
785
846
|
weight = "semibold",
|
|
786
|
-
|
|
847
|
+
align,
|
|
848
|
+
leading,
|
|
849
|
+
tracking,
|
|
850
|
+
transform,
|
|
851
|
+
decoration,
|
|
852
|
+
italic = false,
|
|
853
|
+
truncate = false,
|
|
854
|
+
lineClamp,
|
|
855
|
+
wrap,
|
|
856
|
+
wordBreak,
|
|
857
|
+
opacity,
|
|
858
|
+
hasMargin = false,
|
|
859
|
+
selectable,
|
|
787
860
|
className = "",
|
|
788
|
-
|
|
861
|
+
id,
|
|
862
|
+
htmlFor
|
|
789
863
|
}) {
|
|
790
864
|
const variantClasses = {
|
|
791
865
|
body: "text-foreground",
|
|
792
866
|
muted: "text-muted-foreground",
|
|
793
|
-
small: "text-muted-foreground"
|
|
867
|
+
small: "text-muted-foreground",
|
|
868
|
+
primary: "text-primary",
|
|
869
|
+
secondary: "text-secondary-foreground",
|
|
870
|
+
success: "text-success",
|
|
871
|
+
warning: "text-warning",
|
|
872
|
+
error: "text-destructive",
|
|
873
|
+
inherit: "text-inherit"
|
|
794
874
|
};
|
|
795
875
|
const sizeClasses2 = {
|
|
796
876
|
xs: "text-sm sm:text-xs",
|
|
797
877
|
sm: "text-base sm:text-sm",
|
|
798
878
|
base: "text-base",
|
|
799
879
|
lg: "text-lg",
|
|
800
|
-
xl: "text-xl"
|
|
880
|
+
xl: "text-xl",
|
|
881
|
+
"2xl": "text-2xl"
|
|
801
882
|
};
|
|
802
883
|
const weightClasses = {
|
|
884
|
+
light: "font-light",
|
|
803
885
|
normal: "font-normal",
|
|
804
886
|
medium: "font-medium",
|
|
805
887
|
semibold: "font-semibold",
|
|
806
|
-
bold: "font-bold"
|
|
888
|
+
bold: "font-bold",
|
|
889
|
+
extrabold: "font-extrabold"
|
|
890
|
+
};
|
|
891
|
+
const alignClasses = {
|
|
892
|
+
left: "text-left",
|
|
893
|
+
center: "text-center",
|
|
894
|
+
right: "text-right",
|
|
895
|
+
justify: "text-justify"
|
|
896
|
+
};
|
|
897
|
+
const leadingClasses = {
|
|
898
|
+
none: "leading-none",
|
|
899
|
+
tight: "leading-tight",
|
|
900
|
+
snug: "leading-snug",
|
|
901
|
+
normal: "leading-normal",
|
|
902
|
+
relaxed: "leading-relaxed",
|
|
903
|
+
loose: "leading-loose"
|
|
904
|
+
};
|
|
905
|
+
const trackingClasses = {
|
|
906
|
+
tighter: "tracking-tighter",
|
|
907
|
+
tight: "tracking-tight",
|
|
908
|
+
normal: "tracking-normal",
|
|
909
|
+
wide: "tracking-wide",
|
|
910
|
+
wider: "tracking-wider",
|
|
911
|
+
widest: "tracking-widest"
|
|
912
|
+
};
|
|
913
|
+
const transformClasses = {
|
|
914
|
+
uppercase: "uppercase",
|
|
915
|
+
lowercase: "lowercase",
|
|
916
|
+
capitalize: "capitalize",
|
|
917
|
+
normal: "normal-case"
|
|
918
|
+
};
|
|
919
|
+
const decorationClasses = {
|
|
920
|
+
underline: "underline",
|
|
921
|
+
"line-through": "line-through",
|
|
922
|
+
none: "no-underline"
|
|
923
|
+
};
|
|
924
|
+
const wrapClasses = {
|
|
925
|
+
wrap: "text-wrap",
|
|
926
|
+
nowrap: "text-nowrap",
|
|
927
|
+
balance: "text-balance",
|
|
928
|
+
pretty: "text-pretty"
|
|
929
|
+
};
|
|
930
|
+
const wordBreakClasses = {
|
|
931
|
+
normal: "break-normal",
|
|
932
|
+
words: "break-words",
|
|
933
|
+
all: "break-all",
|
|
934
|
+
keep: "break-keep"
|
|
935
|
+
};
|
|
936
|
+
const opacityClasses = {
|
|
937
|
+
0: "opacity-0",
|
|
938
|
+
25: "opacity-25",
|
|
939
|
+
50: "opacity-50",
|
|
940
|
+
75: "opacity-75",
|
|
941
|
+
100: "opacity-100"
|
|
942
|
+
};
|
|
943
|
+
const lineClampClasses = {
|
|
944
|
+
1: "line-clamp-1",
|
|
945
|
+
2: "line-clamp-2",
|
|
946
|
+
3: "line-clamp-3",
|
|
947
|
+
4: "line-clamp-4",
|
|
948
|
+
5: "line-clamp-5",
|
|
949
|
+
6: "line-clamp-6"
|
|
807
950
|
};
|
|
808
951
|
const defaultSizes = {
|
|
809
952
|
body: "lg",
|
|
810
|
-
// bigger default body text
|
|
811
953
|
muted: "base",
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
954
|
+
small: "sm",
|
|
955
|
+
primary: "base",
|
|
956
|
+
secondary: "base",
|
|
957
|
+
success: "base",
|
|
958
|
+
warning: "base",
|
|
959
|
+
error: "base",
|
|
960
|
+
inherit: "base"
|
|
815
961
|
};
|
|
816
962
|
const finalSize = size || defaultSizes[variant];
|
|
817
|
-
const margin =
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
963
|
+
const margin = hasMargin ? "mb-3 sm:mb-4" : "";
|
|
964
|
+
const classes = [
|
|
965
|
+
variantClasses[variant],
|
|
966
|
+
sizeClasses2[finalSize],
|
|
967
|
+
weightClasses[weight],
|
|
968
|
+
margin,
|
|
969
|
+
align && alignClasses[align],
|
|
970
|
+
leading && leadingClasses[leading],
|
|
971
|
+
tracking && trackingClasses[tracking],
|
|
972
|
+
transform && transformClasses[transform],
|
|
973
|
+
decoration && decorationClasses[decoration],
|
|
974
|
+
italic && "italic",
|
|
975
|
+
truncate && "truncate",
|
|
976
|
+
lineClamp && lineClampClasses[lineClamp],
|
|
977
|
+
wrap && wrapClasses[wrap],
|
|
978
|
+
wordBreak && wordBreakClasses[wordBreak],
|
|
979
|
+
opacity !== void 0 && opacityClasses[opacity],
|
|
980
|
+
selectable === true && "select-all",
|
|
981
|
+
selectable === false && "select-none",
|
|
982
|
+
className
|
|
983
|
+
].filter(Boolean).join(" ");
|
|
984
|
+
const elementProps = {
|
|
985
|
+
className: classes,
|
|
986
|
+
...id && { id },
|
|
987
|
+
...htmlFor && as === "label" && { htmlFor }
|
|
988
|
+
};
|
|
989
|
+
return React6.createElement(as, elementProps, children);
|
|
825
990
|
}
|
|
826
991
|
Text.displayName = "Text";
|
|
827
992
|
var text_default = Text;
|
|
@@ -859,7 +1024,7 @@ function Stack({
|
|
|
859
1024
|
"div",
|
|
860
1025
|
{
|
|
861
1026
|
"data-component": "Stack",
|
|
862
|
-
className: `flex ${directionClass} ${spacingClasses[spacing]} ${alignClasses[align]} ${justifyClass} ${className}`,
|
|
1027
|
+
className: `flex flex-wrap ${directionClass} ${spacingClasses[spacing]} ${alignClasses[align]} ${justifyClass} ${className}`,
|
|
863
1028
|
children
|
|
864
1029
|
}
|
|
865
1030
|
);
|
|
@@ -877,17 +1042,17 @@ function FormField({
|
|
|
877
1042
|
validationState = "default"
|
|
878
1043
|
}) {
|
|
879
1044
|
const effectiveValidationState = error ? "error" : validationState;
|
|
880
|
-
const childWithValidation =
|
|
1045
|
+
const childWithValidation = React6.isValidElement(children) ? React6.cloneElement(children, {
|
|
881
1046
|
validationState: effectiveValidationState
|
|
882
1047
|
}) : children;
|
|
883
1048
|
return /* @__PURE__ */ jsxRuntime.jsxs(stack_default, { direction: "vertical", spacing: "sm", className, children: [
|
|
884
|
-
label && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor, children: /* @__PURE__ */ jsxRuntime.jsxs(text_default, { variant: "body", size: "sm",
|
|
1049
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor, children: /* @__PURE__ */ jsxRuntime.jsxs(text_default, { variant: "body", size: "sm", className: "font-medium", children: [
|
|
885
1050
|
label,
|
|
886
1051
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
887
1052
|
] }) }),
|
|
888
1053
|
childWithValidation,
|
|
889
|
-
error && /* @__PURE__ */ jsxRuntime.jsx(text_default, { variant: "body", size: "sm",
|
|
890
|
-
!error && helperText && /* @__PURE__ */ jsxRuntime.jsx(text_default, { variant: "muted", size: "sm",
|
|
1054
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(text_default, { variant: "body", size: "sm", className: "text-destructive", children: error }),
|
|
1055
|
+
!error && helperText && /* @__PURE__ */ jsxRuntime.jsx(text_default, { variant: "muted", size: "sm", children: helperText })
|
|
891
1056
|
] });
|
|
892
1057
|
}
|
|
893
1058
|
FormField.displayName = "FormField";
|
|
@@ -927,8 +1092,8 @@ function InputGroup({ children, prefix, suffix, className = "" }) {
|
|
|
927
1092
|
InputGroup.displayName = "InputGroup";
|
|
928
1093
|
var input_group_default = InputGroup;
|
|
929
1094
|
function Calendar({ value, onChange, minDate, maxDate, disabled = false, className = "" }) {
|
|
930
|
-
const [currentMonth, setCurrentMonth] =
|
|
931
|
-
const [selectedDate, setSelectedDate] =
|
|
1095
|
+
const [currentMonth, setCurrentMonth] = React6.useState(value || /* @__PURE__ */ new Date());
|
|
1096
|
+
const [selectedDate, setSelectedDate] = React6.useState(value);
|
|
932
1097
|
const getDaysInMonth = (date) => {
|
|
933
1098
|
return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
934
1099
|
};
|
|
@@ -1064,14 +1229,14 @@ function DatePicker({
|
|
|
1064
1229
|
className = "",
|
|
1065
1230
|
size = "md"
|
|
1066
1231
|
}) {
|
|
1067
|
-
const [isOpen, setIsOpen] =
|
|
1068
|
-
const [selectedDate, setSelectedDate] =
|
|
1069
|
-
const containerRef =
|
|
1070
|
-
const inputRef =
|
|
1071
|
-
|
|
1232
|
+
const [isOpen, setIsOpen] = React6.useState(false);
|
|
1233
|
+
const [selectedDate, setSelectedDate] = React6.useState(value);
|
|
1234
|
+
const containerRef = React6.useRef(null);
|
|
1235
|
+
const inputRef = React6.useRef(null);
|
|
1236
|
+
React6.useEffect(() => {
|
|
1072
1237
|
setSelectedDate(value);
|
|
1073
1238
|
}, [value]);
|
|
1074
|
-
|
|
1239
|
+
React6.useEffect(() => {
|
|
1075
1240
|
const handleClickOutside = (event) => {
|
|
1076
1241
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
1077
1242
|
setIsOpen(false);
|
|
@@ -1083,7 +1248,7 @@ function DatePicker({
|
|
|
1083
1248
|
}
|
|
1084
1249
|
return void 0;
|
|
1085
1250
|
}, [isOpen]);
|
|
1086
|
-
|
|
1251
|
+
React6.useEffect(() => {
|
|
1087
1252
|
const handleEscape = (event) => {
|
|
1088
1253
|
if (event.key === "Escape" && isOpen) {
|
|
1089
1254
|
setIsOpen(false);
|
|
@@ -1196,7 +1361,7 @@ function DatePicker({
|
|
|
1196
1361
|
)
|
|
1197
1362
|
}
|
|
1198
1363
|
) : clearable ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-6 h-6 flex-shrink-0" }) : null,
|
|
1199
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1364
|
+
/* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconCalendar, { size: currentSize.icon, className: "text-muted-foreground flex-shrink-0" })
|
|
1200
1365
|
] })
|
|
1201
1366
|
]
|
|
1202
1367
|
}
|
|
@@ -1417,7 +1582,7 @@ function NavbarToggle({
|
|
|
1417
1582
|
className: `lg:hidden flex items-center justify-center w-9 h-9 md:w-8 md:h-8 rounded text-foreground/70 hover:text-foreground hover:bg-muted transition-colors focus:outline-none focus:ring-2 focus:ring-ring ${className}`.trim(),
|
|
1418
1583
|
"aria-label": mobileMenuOpen ? "Close menu" : "Open menu",
|
|
1419
1584
|
type: "button",
|
|
1420
|
-
children: mobileMenuOpen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1585
|
+
children: mobileMenuOpen ? /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconX, { size: 20, className: "md:w-5 md:h-5" }) : /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconMenu2, { size: 20, className: "md:w-5 md:h-5" })
|
|
1421
1586
|
}
|
|
1422
1587
|
),
|
|
1423
1588
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1427,7 +1592,7 @@ function NavbarToggle({
|
|
|
1427
1592
|
className: `hidden lg:flex items-center justify-center w-8 h-8 rounded text-foreground/70 hover:text-foreground hover:bg-muted transition-colors focus:outline-none focus:ring-2 focus:ring-ring ${className}`.trim(),
|
|
1428
1593
|
"aria-label": sidebarCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
1429
1594
|
type: "button",
|
|
1430
|
-
children: sidebarCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1595
|
+
children: sidebarCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconLayoutSidebarRightExpand, { size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconLayoutSidebarRightCollapse, { size: 20 })
|
|
1431
1596
|
}
|
|
1432
1597
|
)
|
|
1433
1598
|
] });
|
|
@@ -1440,8 +1605,8 @@ var PageTransition = ({
|
|
|
1440
1605
|
type = "fade",
|
|
1441
1606
|
className = ""
|
|
1442
1607
|
}) => {
|
|
1443
|
-
const [isVisible, setIsVisible] =
|
|
1444
|
-
|
|
1608
|
+
const [isVisible, setIsVisible] = React6__default.default.useState(false);
|
|
1609
|
+
React6__default.default.useEffect(() => {
|
|
1445
1610
|
requestAnimationFrame(() => {
|
|
1446
1611
|
requestAnimationFrame(() => {
|
|
1447
1612
|
setIsVisible(true);
|
|
@@ -1472,7 +1637,7 @@ var PageTransition = ({
|
|
|
1472
1637
|
PageTransition.displayName = "PageTransition";
|
|
1473
1638
|
var page_transition_default = PageTransition;
|
|
1474
1639
|
function Tabs({ tabs, defaultTab, className = "", ariaLabel = "Tabs", noBorder = false }) {
|
|
1475
|
-
const [activeTab, setActiveTab] =
|
|
1640
|
+
const [activeTab, setActiveTab] = React6.useState(defaultTab || tabs[0]?.id);
|
|
1476
1641
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
|
|
1477
1642
|
/* @__PURE__ */ jsxRuntime.jsx("div", { role: "tablist", "aria-label": ariaLabel, className: `flex ${noBorder ? "" : "border-b-2 border-border/50"}`, children: tabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1478
1643
|
"button",
|
|
@@ -1502,7 +1667,7 @@ function Tabs({ tabs, defaultTab, className = "", ariaLabel = "Tabs", noBorder =
|
|
|
1502
1667
|
}
|
|
1503
1668
|
Tabs.displayName = "Tabs";
|
|
1504
1669
|
var tabs_default = Tabs;
|
|
1505
|
-
var DropdownContext =
|
|
1670
|
+
var DropdownContext = React6.createContext(null);
|
|
1506
1671
|
function Dropdown({
|
|
1507
1672
|
trigger,
|
|
1508
1673
|
children,
|
|
@@ -1510,18 +1675,21 @@ function Dropdown({
|
|
|
1510
1675
|
align = "start",
|
|
1511
1676
|
autoClose = true,
|
|
1512
1677
|
size = "md",
|
|
1678
|
+
variant = "neutral",
|
|
1679
|
+
buttonStyle = "solid",
|
|
1513
1680
|
minWidth,
|
|
1514
1681
|
maxWidth,
|
|
1515
1682
|
menuClassName = ""
|
|
1516
1683
|
}) {
|
|
1517
|
-
const [isOpen, setIsOpen] =
|
|
1518
|
-
const dropdownRef =
|
|
1519
|
-
const
|
|
1520
|
-
const
|
|
1521
|
-
const
|
|
1522
|
-
const
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1684
|
+
const [isOpen, setIsOpen] = React6.useState(false);
|
|
1685
|
+
const dropdownRef = React6.useRef(null);
|
|
1686
|
+
const triggerRef = React6.useRef(null);
|
|
1687
|
+
const menuRef = React6.useRef(null);
|
|
1688
|
+
const itemsRef = React6.useRef([]);
|
|
1689
|
+
const [activeIndex, setActiveIndex] = React6.useState(-1);
|
|
1690
|
+
const close = React6.useCallback(() => setIsOpen(false), []);
|
|
1691
|
+
const open = React6.useCallback(() => setIsOpen(true), []);
|
|
1692
|
+
React6.useEffect(() => {
|
|
1525
1693
|
if (!isOpen) return;
|
|
1526
1694
|
const handleKey = (e) => {
|
|
1527
1695
|
if (!menuRef.current) return;
|
|
@@ -1541,7 +1709,7 @@ function Dropdown({
|
|
|
1541
1709
|
if (e.key === "Escape") {
|
|
1542
1710
|
e.preventDefault();
|
|
1543
1711
|
close();
|
|
1544
|
-
|
|
1712
|
+
triggerRef.current?.focus();
|
|
1545
1713
|
}
|
|
1546
1714
|
if (e.key === "Tab") {
|
|
1547
1715
|
e.preventDefault();
|
|
@@ -1556,7 +1724,7 @@ function Dropdown({
|
|
|
1556
1724
|
document.addEventListener("keydown", handleKey);
|
|
1557
1725
|
return () => document.removeEventListener("keydown", handleKey);
|
|
1558
1726
|
}, [isOpen, activeIndex, close]);
|
|
1559
|
-
|
|
1727
|
+
React6.useEffect(() => {
|
|
1560
1728
|
if (!isOpen) return;
|
|
1561
1729
|
const handleClickOutside = (event) => {
|
|
1562
1730
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
@@ -1566,7 +1734,7 @@ function Dropdown({
|
|
|
1566
1734
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1567
1735
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1568
1736
|
}, [isOpen, close]);
|
|
1569
|
-
|
|
1737
|
+
React6.useLayoutEffect(() => {
|
|
1570
1738
|
let raf;
|
|
1571
1739
|
if (isOpen) {
|
|
1572
1740
|
const itemEls = itemsRef.current.filter(Boolean);
|
|
@@ -1583,7 +1751,7 @@ function Dropdown({
|
|
|
1583
1751
|
if (raf) cancelAnimationFrame(raf);
|
|
1584
1752
|
};
|
|
1585
1753
|
}, [isOpen]);
|
|
1586
|
-
const registerItem =
|
|
1754
|
+
const registerItem = React6.useCallback((el, index) => {
|
|
1587
1755
|
if (typeof index === "number" && index >= 0) {
|
|
1588
1756
|
itemsRef.current[index] = el;
|
|
1589
1757
|
return;
|
|
@@ -1594,18 +1762,35 @@ function Dropdown({
|
|
|
1594
1762
|
}
|
|
1595
1763
|
if (!itemsRef.current.includes(el)) itemsRef.current.push(el);
|
|
1596
1764
|
}, []);
|
|
1765
|
+
const { title, subtitle, icon, hideChevron } = trigger;
|
|
1766
|
+
const iconNode = icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: 16, color: "currentColor" }) : null;
|
|
1597
1767
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: dropdownRef, className: `relative ${className}`, children: [
|
|
1598
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1599
|
-
|
|
1768
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1769
|
+
button_default,
|
|
1600
1770
|
{
|
|
1601
|
-
|
|
1771
|
+
ref: triggerRef,
|
|
1772
|
+
variant,
|
|
1773
|
+
style: buttonStyle,
|
|
1602
1774
|
onClick: () => isOpen ? close() : open(),
|
|
1603
|
-
className: "bg-transparent border-0 p-0 cursor-pointer outline-none",
|
|
1604
|
-
type: "button",
|
|
1605
1775
|
"aria-expanded": isOpen,
|
|
1606
1776
|
"aria-haspopup": "true",
|
|
1607
1777
|
"aria-controls": isOpen ? "dropdown-menu" : void 0,
|
|
1608
|
-
children:
|
|
1778
|
+
children: [
|
|
1779
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
1780
|
+
iconNode && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: iconNode }),
|
|
1781
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: subtitle ? "text-left" : "", children: [
|
|
1782
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: subtitle ? "block font-semibold" : "", children: title }),
|
|
1783
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-muted-foreground font-normal", children: subtitle })
|
|
1784
|
+
] })
|
|
1785
|
+
] }),
|
|
1786
|
+
!hideChevron && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1787
|
+
TablerIcons.IconChevronDown,
|
|
1788
|
+
{
|
|
1789
|
+
size: 14,
|
|
1790
|
+
className: `ml-1 transition-transform duration-200 ${isOpen ? "rotate-180" : ""}`
|
|
1791
|
+
}
|
|
1792
|
+
)
|
|
1793
|
+
]
|
|
1609
1794
|
}
|
|
1610
1795
|
),
|
|
1611
1796
|
isOpen && /* @__PURE__ */ jsxRuntime.jsx(DropdownContext.Provider, { value: { requestClose: close, autoClose, registerItem, minWidth }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1613,7 +1798,7 @@ function Dropdown({
|
|
|
1613
1798
|
{
|
|
1614
1799
|
id: "dropdown-menu",
|
|
1615
1800
|
ref: menuRef,
|
|
1616
|
-
className: `absolute mt-2 bg-popover text-popover-foreground border border-border rounded-md shadow-lg z-50 ${size === "sm" ? "min-w-[140px] text-xs py-1" : "min-w-[180px]"} max-h-
|
|
1801
|
+
className: `absolute mt-2 bg-popover text-popover-foreground border border-border rounded-md shadow-lg z-50 ${size === "sm" ? "min-w-[140px] text-xs py-1" : "min-w-[180px]"} max-h-80 overflow-y-auto origin-top animate-scaleIn focus:outline-none ${align === "start" ? "left-0" : align === "end" ? "right-0" : "left-1/2 -translate-x-1/2"} ${menuClassName}`,
|
|
1617
1802
|
style: {
|
|
1618
1803
|
minWidth: minWidth || void 0,
|
|
1619
1804
|
maxWidth: maxWidth || void 0
|
|
@@ -1639,7 +1824,7 @@ function DropdownItem({
|
|
|
1639
1824
|
endIcon,
|
|
1640
1825
|
size = "md"
|
|
1641
1826
|
}) {
|
|
1642
|
-
const ctx =
|
|
1827
|
+
const ctx = React6.useContext(DropdownContext);
|
|
1643
1828
|
const base = `${size === "sm" ? "text-[11px] leading-tight px-2.5 py-1.5 rounded-md" : "px-3.5 py-2 rounded-md"} w-full text-left select-none transition-colors outline-none disabled:opacity-40 disabled:pointer-events-none`;
|
|
1644
1829
|
const focus = "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-popover";
|
|
1645
1830
|
const palette = {
|
|
@@ -1655,6 +1840,8 @@ function DropdownItem({
|
|
|
1655
1840
|
};
|
|
1656
1841
|
const variantClasses = palette[variant] || palette.default;
|
|
1657
1842
|
const hasIcons = icon || endIcon;
|
|
1843
|
+
const iconNode = icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: 16, color: "currentColor" }) : null;
|
|
1844
|
+
const endIconNode = endIcon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: endIcon, size: 16, color: "currentColor" }) : null;
|
|
1658
1845
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1659
1846
|
"button",
|
|
1660
1847
|
{
|
|
@@ -1669,12 +1856,12 @@ function DropdownItem({
|
|
|
1669
1856
|
},
|
|
1670
1857
|
className: `${base} ${focus} ${variantClasses} ${hasIcons ? "flex flex-row items-center gap-2.5" : "flex flex-col"} ${className}`,
|
|
1671
1858
|
children: [
|
|
1672
|
-
|
|
1859
|
+
iconNode && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `shrink-0 ${size === "sm" ? "text-[14px]" : "text-[16px]"}`, children: iconNode }),
|
|
1673
1860
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex-1 min-w-0", children: [
|
|
1674
1861
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `block ${size === "sm" ? "font-medium" : "font-medium"} leading-snug`, children }),
|
|
1675
1862
|
description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `block ${size === "sm" ? "text-[10px]" : "text-xs"} text-foreground/60 mt-0.5 line-clamp-2`, children: description })
|
|
1676
1863
|
] }),
|
|
1677
|
-
|
|
1864
|
+
endIconNode && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `shrink-0 ${size === "sm" ? "text-[14px]" : "text-[16px]"}`, children: endIconNode })
|
|
1678
1865
|
]
|
|
1679
1866
|
}
|
|
1680
1867
|
);
|
|
@@ -1768,8 +1955,8 @@ Pagination.displayName = "Pagination";
|
|
|
1768
1955
|
var pagination_default = Pagination;
|
|
1769
1956
|
function Sidebar({ children, className = "", width = "16rem" }) {
|
|
1770
1957
|
const widthClass = width === "16rem" ? "w-64" : width === "4rem" ? "w-16" : "";
|
|
1771
|
-
const enhancedChildren =
|
|
1772
|
-
if (!
|
|
1958
|
+
const enhancedChildren = React6__default.default.Children.map(children, (child) => {
|
|
1959
|
+
if (!React6__default.default.isValidElement(child)) return child;
|
|
1773
1960
|
const childProps = child.props || {};
|
|
1774
1961
|
if ("href" in childProps) {
|
|
1775
1962
|
const existing = typeof childProps.className === "string" ? childProps.className : "";
|
|
@@ -1780,7 +1967,7 @@ function Sidebar({ children, className = "", width = "16rem" }) {
|
|
|
1780
1967
|
...child.props,
|
|
1781
1968
|
className: `${existing} ${sidebarItemClasses}`.trim()
|
|
1782
1969
|
};
|
|
1783
|
-
return
|
|
1970
|
+
return React6__default.default.cloneElement(child, newProps, wrappedChildren);
|
|
1784
1971
|
}
|
|
1785
1972
|
return child;
|
|
1786
1973
|
});
|
|
@@ -1882,7 +2069,7 @@ function Stepper({
|
|
|
1882
2069
|
transition-colors transition-[background-color,border-color] duration-300 ease-in-out
|
|
1883
2070
|
${styles.circle}
|
|
1884
2071
|
`,
|
|
1885
|
-
children: status === "completed" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2072
|
+
children: status === "completed" ? /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconCheck, { className: "w-5 h-5" }) : step.icon ? step.icon : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold", children: index + 1 })
|
|
1886
2073
|
}
|
|
1887
2074
|
),
|
|
1888
2075
|
index < steps.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1923,7 +2110,7 @@ function Stepper({
|
|
|
1923
2110
|
transition-colors transition-[background-color,border-color] duration-300 ease-in-out
|
|
1924
2111
|
${styles.circle}
|
|
1925
2112
|
`,
|
|
1926
|
-
children: status === "completed" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2113
|
+
children: status === "completed" ? /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconCheck, { className: "w-5 h-5" }) : step.icon ? step.icon : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold", children: index + 1 })
|
|
1927
2114
|
}
|
|
1928
2115
|
),
|
|
1929
2116
|
index < steps.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1957,20 +2144,20 @@ function Stepper({
|
|
|
1957
2144
|
Stepper.displayName = "Stepper";
|
|
1958
2145
|
var stepper_default = Stepper;
|
|
1959
2146
|
function Toast({ message, children, type = "info", onClose, className = "", duration = 5e3 }) {
|
|
1960
|
-
const [isClosing, setIsClosing] =
|
|
2147
|
+
const [isClosing, setIsClosing] = React6.useState(false);
|
|
1961
2148
|
const typeClasses = {
|
|
1962
2149
|
info: "bg-info text-info-foreground",
|
|
1963
2150
|
success: "bg-success text-success-foreground",
|
|
1964
2151
|
warning: "bg-warning text-warning-foreground",
|
|
1965
2152
|
error: "bg-destructive text-destructive-foreground"
|
|
1966
2153
|
};
|
|
1967
|
-
const handleClose =
|
|
2154
|
+
const handleClose = React6.useCallback(() => {
|
|
1968
2155
|
setIsClosing(true);
|
|
1969
2156
|
setTimeout(() => {
|
|
1970
2157
|
onClose?.();
|
|
1971
2158
|
}, 300);
|
|
1972
2159
|
}, [onClose]);
|
|
1973
|
-
|
|
2160
|
+
React6.useEffect(() => {
|
|
1974
2161
|
if (duration > 0) {
|
|
1975
2162
|
const timer = setTimeout(() => {
|
|
1976
2163
|
handleClose();
|
|
@@ -2004,11 +2191,11 @@ function Tooltip({
|
|
|
2004
2191
|
usePortal = false,
|
|
2005
2192
|
className = ""
|
|
2006
2193
|
}) {
|
|
2007
|
-
const [showTooltip, setShowTooltip] =
|
|
2008
|
-
const [tooltipPosition, setTooltipPosition] =
|
|
2009
|
-
const triggerRef =
|
|
2194
|
+
const [showTooltip, setShowTooltip] = React6.useState(false);
|
|
2195
|
+
const [tooltipPosition, setTooltipPosition] = React6.useState({ top: 0, left: 0 });
|
|
2196
|
+
const triggerRef = React6.useRef(null);
|
|
2010
2197
|
const isVisible = open || showTooltip;
|
|
2011
|
-
|
|
2198
|
+
React6.useEffect(() => {
|
|
2012
2199
|
if (usePortal && isVisible && triggerRef.current) {
|
|
2013
2200
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
2014
2201
|
const positions = {
|
|
@@ -2140,11 +2327,11 @@ function useOverlay(options) {
|
|
|
2140
2327
|
exitDuration = 300,
|
|
2141
2328
|
unmountOnExit = true
|
|
2142
2329
|
} = options;
|
|
2143
|
-
const previouslyFocusedRef =
|
|
2144
|
-
const containerRef =
|
|
2145
|
-
const [shouldRender, setShouldRender] =
|
|
2146
|
-
const [phase, setPhase] =
|
|
2147
|
-
|
|
2330
|
+
const previouslyFocusedRef = React6.useRef(null);
|
|
2331
|
+
const containerRef = React6.useRef(null);
|
|
2332
|
+
const [shouldRender, setShouldRender] = React6.useState(isOpen);
|
|
2333
|
+
const [phase, setPhase] = React6.useState("mount");
|
|
2334
|
+
React6.useLayoutEffect(() => {
|
|
2148
2335
|
if (isOpen && !shouldRender) {
|
|
2149
2336
|
setShouldRender(true);
|
|
2150
2337
|
setPhase("mount");
|
|
@@ -2170,7 +2357,7 @@ function useOverlay(options) {
|
|
|
2170
2357
|
setPhase("animating-out");
|
|
2171
2358
|
}
|
|
2172
2359
|
}, [isOpen, shouldRender, phase, animationFrames]);
|
|
2173
|
-
|
|
2360
|
+
React6.useEffect(() => {
|
|
2174
2361
|
if (phase === "animating-out" && unmountOnExit) {
|
|
2175
2362
|
const timeout = setTimeout(() => {
|
|
2176
2363
|
setShouldRender(false);
|
|
@@ -2180,7 +2367,7 @@ function useOverlay(options) {
|
|
|
2180
2367
|
}
|
|
2181
2368
|
return void 0;
|
|
2182
2369
|
}, [phase, exitDuration, unmountOnExit]);
|
|
2183
|
-
|
|
2370
|
+
React6.useEffect(() => {
|
|
2184
2371
|
if (isOpen) {
|
|
2185
2372
|
if (typeof document !== "undefined") {
|
|
2186
2373
|
if (restoreFocus) previouslyFocusedRef.current = document.activeElement;
|
|
@@ -2196,7 +2383,7 @@ function useOverlay(options) {
|
|
|
2196
2383
|
}
|
|
2197
2384
|
};
|
|
2198
2385
|
}, [isOpen, lockScroll, restoreFocus]);
|
|
2199
|
-
|
|
2386
|
+
React6.useEffect(() => {
|
|
2200
2387
|
if (phase === "visible" && containerRef.current) {
|
|
2201
2388
|
const el = containerRef.current;
|
|
2202
2389
|
try {
|
|
@@ -2206,7 +2393,7 @@ function useOverlay(options) {
|
|
|
2206
2393
|
}
|
|
2207
2394
|
}
|
|
2208
2395
|
}, [phase]);
|
|
2209
|
-
const handleKeyDown =
|
|
2396
|
+
const handleKeyDown = React6.useCallback(
|
|
2210
2397
|
(e) => {
|
|
2211
2398
|
if (!focusTrap || phase !== "visible" || e.key !== "Tab" || !containerRef.current) return;
|
|
2212
2399
|
const node = containerRef.current;
|
|
@@ -2228,14 +2415,14 @@ function useOverlay(options) {
|
|
|
2228
2415
|
},
|
|
2229
2416
|
[focusTrap, phase]
|
|
2230
2417
|
);
|
|
2231
|
-
|
|
2418
|
+
React6.useEffect(() => {
|
|
2232
2419
|
if (focusTrap && phase === "visible") {
|
|
2233
2420
|
document.addEventListener("keydown", handleKeyDown);
|
|
2234
2421
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
2235
2422
|
}
|
|
2236
2423
|
return void 0;
|
|
2237
2424
|
}, [phase, focusTrap, handleKeyDown]);
|
|
2238
|
-
const getPhaseClass =
|
|
2425
|
+
const getPhaseClass = React6.useCallback(
|
|
2239
2426
|
(openClass, closedClass) => {
|
|
2240
2427
|
return phase === "animating-in" || phase === "visible" ? openClass : closedClass;
|
|
2241
2428
|
},
|
|
@@ -2269,7 +2456,7 @@ function Modal({
|
|
|
2269
2456
|
animationFrames: 2,
|
|
2270
2457
|
restoreFocus: true
|
|
2271
2458
|
});
|
|
2272
|
-
|
|
2459
|
+
React6__default.default.useEffect(() => {
|
|
2273
2460
|
if (!isOpen) return;
|
|
2274
2461
|
const handleEscape = (e) => {
|
|
2275
2462
|
if (e.key === "Escape") {
|
|
@@ -2362,7 +2549,7 @@ function DeleteDialog({
|
|
|
2362
2549
|
onClick: onClose,
|
|
2363
2550
|
disabled: isLoading,
|
|
2364
2551
|
className: "bg-muted hover:bg-muted/80 text-muted-foreground",
|
|
2365
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2552
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconX, { size: 16 }),
|
|
2366
2553
|
children: cancelText
|
|
2367
2554
|
}
|
|
2368
2555
|
),
|
|
@@ -2372,7 +2559,7 @@ function DeleteDialog({
|
|
|
2372
2559
|
onClick: onConfirm,
|
|
2373
2560
|
disabled: isLoading,
|
|
2374
2561
|
className: "bg-destructive hover:bg-destructive/90 text-destructive-foreground",
|
|
2375
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2562
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconTrash, { size: 16 }),
|
|
2376
2563
|
children: isLoading ? "Deleting..." : confirmText
|
|
2377
2564
|
}
|
|
2378
2565
|
)
|
|
@@ -2384,10 +2571,10 @@ function DeleteDialog({
|
|
|
2384
2571
|
DeleteDialog.displayName = "DeleteDialog";
|
|
2385
2572
|
var delete_dialog_default = DeleteDialog;
|
|
2386
2573
|
function Popover({ trigger, children, content, position = "bottom", className = "" }) {
|
|
2387
|
-
const [isOpen, setIsOpen] =
|
|
2388
|
-
const popoverRef =
|
|
2574
|
+
const [isOpen, setIsOpen] = React6.useState(false);
|
|
2575
|
+
const popoverRef = React6.useRef(null);
|
|
2389
2576
|
const triggerContent = children || trigger;
|
|
2390
|
-
|
|
2577
|
+
React6.useEffect(() => {
|
|
2391
2578
|
const handleClickOutside = (event) => {
|
|
2392
2579
|
if (popoverRef.current && !popoverRef.current.contains(event.target)) {
|
|
2393
2580
|
setIsOpen(false);
|
|
@@ -2447,7 +2634,7 @@ function Alert({
|
|
|
2447
2634
|
position = "relative",
|
|
2448
2635
|
duration = 0
|
|
2449
2636
|
}) {
|
|
2450
|
-
const [isClosing, setIsClosing] =
|
|
2637
|
+
const [isClosing, setIsClosing] = React6.useState(false);
|
|
2451
2638
|
const typeClasses = {
|
|
2452
2639
|
info: "bg-info/20 text-foreground border-info/50 backdrop-blur-sm",
|
|
2453
2640
|
success: "bg-success/20 text-foreground border-success/50 backdrop-blur-sm",
|
|
@@ -2460,13 +2647,13 @@ function Alert({
|
|
|
2460
2647
|
warning: "text-warning",
|
|
2461
2648
|
error: "text-destructive"
|
|
2462
2649
|
};
|
|
2463
|
-
const handleClose =
|
|
2650
|
+
const handleClose = React6.useCallback(() => {
|
|
2464
2651
|
setIsClosing(true);
|
|
2465
2652
|
setTimeout(() => {
|
|
2466
2653
|
onClose?.();
|
|
2467
2654
|
}, 300);
|
|
2468
2655
|
}, [onClose]);
|
|
2469
|
-
|
|
2656
|
+
React6.useEffect(() => {
|
|
2470
2657
|
if (duration > 0 && onClose) {
|
|
2471
2658
|
const timer = setTimeout(() => {
|
|
2472
2659
|
handleClose();
|
|
@@ -2577,13 +2764,7 @@ function Spinner({ size = "md", variant = "primary", className = "", speed, ...p
|
|
|
2577
2764
|
}
|
|
2578
2765
|
Spinner.displayName = "Spinner";
|
|
2579
2766
|
var spinner_default = Spinner;
|
|
2580
|
-
function ProgressBar({
|
|
2581
|
-
value,
|
|
2582
|
-
max = 100,
|
|
2583
|
-
showLabel = false,
|
|
2584
|
-
variant = "default",
|
|
2585
|
-
className = ""
|
|
2586
|
-
}) {
|
|
2767
|
+
function ProgressBar({ value, max = 100, showLabel, variant = "default", className = "" }) {
|
|
2587
2768
|
const percentage = Math.min(value / max * 100, 100);
|
|
2588
2769
|
const variantClasses = {
|
|
2589
2770
|
default: "bg-primary",
|
|
@@ -2591,8 +2772,8 @@ function ProgressBar({
|
|
|
2591
2772
|
warning: "bg-warning",
|
|
2592
2773
|
error: "bg-destructive"
|
|
2593
2774
|
};
|
|
2594
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className
|
|
2595
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
2775
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex items-center gap-3 ${className}`, children: [
|
|
2776
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 bg-muted/30 rounded-full h-2.5 overflow-hidden shadow-inner", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2596
2777
|
"div",
|
|
2597
2778
|
{
|
|
2598
2779
|
role: "progressbar",
|
|
@@ -2603,7 +2784,7 @@ function ProgressBar({
|
|
|
2603
2784
|
style: { width: `${percentage}%` }
|
|
2604
2785
|
}
|
|
2605
2786
|
) }),
|
|
2606
|
-
showLabel && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2787
|
+
showLabel && /* @__PURE__ */ jsxRuntime.jsxs(text_default, { variant: "muted", weight: "medium", size: "sm", children: [
|
|
2607
2788
|
Math.round(percentage),
|
|
2608
2789
|
"%"
|
|
2609
2790
|
] })
|
|
@@ -2936,12 +3117,12 @@ function TableCell({ children, className = "", align = "left", ...props }) {
|
|
|
2936
3117
|
return /* @__PURE__ */ jsxRuntime.jsx("td", { className: `px-6 py-4 whitespace-nowrap ${alignClasses[align]} ${className}`, ...props, children });
|
|
2937
3118
|
}
|
|
2938
3119
|
function useTable({ data, initialSort, pageSize = 10 }) {
|
|
2939
|
-
const [sortConfig, setSortConfig] =
|
|
3120
|
+
const [sortConfig, setSortConfig] = React6.useState(
|
|
2940
3121
|
initialSort ? { key: initialSort.key, direction: initialSort.direction } : null
|
|
2941
3122
|
);
|
|
2942
|
-
const [currentPage, setCurrentPage] =
|
|
2943
|
-
const [selectedRows, setSelectedRows] =
|
|
2944
|
-
const sortedData =
|
|
3123
|
+
const [currentPage, setCurrentPage] = React6.useState(1);
|
|
3124
|
+
const [selectedRows, setSelectedRows] = React6.useState(/* @__PURE__ */ new Set());
|
|
3125
|
+
const sortedData = React6.useMemo(() => {
|
|
2945
3126
|
if (!sortConfig) return data;
|
|
2946
3127
|
const sorted = [...data].sort((a, b) => {
|
|
2947
3128
|
const aValue = a[sortConfig.key];
|
|
@@ -3095,12 +3276,12 @@ function DataTable({
|
|
|
3095
3276
|
if (!sortable) return null;
|
|
3096
3277
|
const isSorted = sortConfig?.key === columnKey;
|
|
3097
3278
|
if (!isSorted) {
|
|
3098
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3279
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconSelector, { className: "w-4 h-4 ml-1 text-muted-foreground" });
|
|
3099
3280
|
}
|
|
3100
3281
|
if (sortConfig?.direction === "asc") {
|
|
3101
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3282
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconChevronUp, { className: "w-4 h-4 ml-1 text-primary" });
|
|
3102
3283
|
}
|
|
3103
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3284
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconChevronDown, { className: "w-4 h-4 ml-1 text-primary" });
|
|
3104
3285
|
};
|
|
3105
3286
|
if (data.length === 0) {
|
|
3106
3287
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border border-border rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(empty_state_default, { title: emptyMessage, icon: emptyIcon, className: "py-12" }) });
|
|
@@ -3272,7 +3453,7 @@ function Chip({
|
|
|
3272
3453
|
${disabled ? "cursor-not-allowed" : "cursor-pointer"}
|
|
3273
3454
|
`,
|
|
3274
3455
|
"aria-label": "Remove",
|
|
3275
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3456
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconX, { className: size === "sm" ? "w-2.5 h-2.5" : size === "md" ? "w-3 h-3" : "w-3.5 h-3.5" })
|
|
3276
3457
|
}
|
|
3277
3458
|
)
|
|
3278
3459
|
]
|
|
@@ -3399,7 +3580,7 @@ function Grid({
|
|
|
3399
3580
|
}
|
|
3400
3581
|
Grid.displayName = "Grid";
|
|
3401
3582
|
var grid_default = Grid;
|
|
3402
|
-
function Heading({ children, level = 1, className = "",
|
|
3583
|
+
function Heading({ children, level = 1, className = "", hasMargin = false }) {
|
|
3403
3584
|
const levelClasses = {
|
|
3404
3585
|
1: "text-3xl sm:text-4xl lg:text-5xl font-bold",
|
|
3405
3586
|
2: "text-2xl sm:text-3xl lg:text-4xl font-bold",
|
|
@@ -3409,15 +3590,15 @@ function Heading({ children, level = 1, className = "", noMargin = false }) {
|
|
|
3409
3590
|
6: "text-sm sm:text-base font-medium"
|
|
3410
3591
|
};
|
|
3411
3592
|
const marginClasses = {
|
|
3412
|
-
1: "mb-4",
|
|
3413
|
-
2: "mb-3",
|
|
3414
|
-
3: "mb-3",
|
|
3415
|
-
4: "mb-2",
|
|
3416
|
-
5: "mb-2",
|
|
3417
|
-
6: "mb-2"
|
|
3418
|
-
};
|
|
3419
|
-
const margin =
|
|
3420
|
-
return
|
|
3593
|
+
1: "mb-3 sm:mb-4",
|
|
3594
|
+
2: "mb-2 sm:mb-3",
|
|
3595
|
+
3: "mb-2 sm:mb-3",
|
|
3596
|
+
4: "mb-1 sm:mb-2",
|
|
3597
|
+
5: "mb-1 sm:mb-2",
|
|
3598
|
+
6: "mb-1 sm:mb-2"
|
|
3599
|
+
};
|
|
3600
|
+
const margin = hasMargin ? marginClasses[level] : "";
|
|
3601
|
+
return React6.createElement(
|
|
3421
3602
|
`h${level}`,
|
|
3422
3603
|
{
|
|
3423
3604
|
className: `text-foreground ${levelClasses[level]} ${margin} ${className}`
|
|
@@ -3430,8 +3611,8 @@ var heading_default = Heading;
|
|
|
3430
3611
|
function PricingTable({ title, description, children, columns = 3, className = "" }) {
|
|
3431
3612
|
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: `py-16 md:py-20 ${className}`, children: /* @__PURE__ */ jsxRuntime.jsxs(container_default, { size: "xl", children: [
|
|
3432
3613
|
(title || description) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center mb-12 md:mb-16 max-w-3xl mx-auto", children: [
|
|
3433
|
-
title && /* @__PURE__ */ jsxRuntime.jsx(heading_default, { level: 2, className: "text-3xl md:text-4xl font-bold
|
|
3434
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(text_default, { className: "text-lg md:text-xl text-muted", children: description })
|
|
3614
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(heading_default, { level: 2, hasMargin: true, className: "text-3xl md:text-4xl font-bold", children: title }),
|
|
3615
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(text_default, { hasMargin: true, className: "text-lg md:text-xl text-muted", children: description })
|
|
3435
3616
|
] }),
|
|
3436
3617
|
/* @__PURE__ */ jsxRuntime.jsx(grid_default, { itemSize: "lg", maxCols: columns, gap: "lg", className: "items-stretch", children })
|
|
3437
3618
|
] }) });
|
|
@@ -3457,18 +3638,18 @@ function Card({
|
|
|
3457
3638
|
filled: "bg-muted text-foreground"
|
|
3458
3639
|
};
|
|
3459
3640
|
const sizeClasses2 = {
|
|
3460
|
-
xs: "w-full sm:w-36",
|
|
3461
|
-
sm: "w-full sm:w-64",
|
|
3462
|
-
md: "w-full sm:w-96",
|
|
3463
|
-
lg: "w-full sm:w-[28rem]",
|
|
3464
|
-
xl: "w-full sm:w-[32rem]"
|
|
3641
|
+
xs: "w-full sm:max-w-36",
|
|
3642
|
+
sm: "w-full sm:max-w-64",
|
|
3643
|
+
md: "w-full sm:max-w-96",
|
|
3644
|
+
lg: "w-full sm:max-w-[28rem]",
|
|
3645
|
+
xl: "w-full sm:max-w-[32rem]"
|
|
3465
3646
|
};
|
|
3466
3647
|
const widthClasses = {
|
|
3467
|
-
auto: size
|
|
3648
|
+
auto: size ? sizeClasses2[size] : "max-w-full",
|
|
3468
3649
|
full: "w-full",
|
|
3469
3650
|
fit: "w-fit"
|
|
3470
3651
|
};
|
|
3471
|
-
const hoverClasses = hoverable ? "transition-all duration-300 hover:shadow-xl hover:-translate-y-1
|
|
3652
|
+
const hoverClasses = hoverable ? "transition-all duration-300 hover:shadow-xl hover:-translate-y-1" : "transition-shadow duration-200";
|
|
3472
3653
|
const imagePositionClasses = {
|
|
3473
3654
|
top: "flex-col",
|
|
3474
3655
|
bottom: "flex-col-reverse",
|
|
@@ -3575,8 +3756,10 @@ function PricingTier({
|
|
|
3575
3756
|
children: [
|
|
3576
3757
|
/* @__PURE__ */ jsxRuntime.jsxs(card_header_default, { className: `relative text-center border-none bg-transparent px-6 pt-12 pb-0`, children: [
|
|
3577
3758
|
badge && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-2 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsxRuntime.jsx(badge_default, { variant: "primary", className: "px-4 py-1 shadow-md", children: badge }) }),
|
|
3578
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3579
|
-
|
|
3759
|
+
/* @__PURE__ */ jsxRuntime.jsxs(stack_default, { direction: "horizontal", spacing: "sm", justify: "between", align: "center", className: "w-full", children: [
|
|
3760
|
+
/* @__PURE__ */ jsxRuntime.jsx(text_default, { size: "2xl", weight: "extrabold", variant: "body", children: name }),
|
|
3761
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(text_default, { variant: "muted", className: "text-sm", children: description })
|
|
3762
|
+
] })
|
|
3580
3763
|
] }),
|
|
3581
3764
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-3 pb-8 text-center px-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-center gap-1", children: [
|
|
3582
3765
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-5xl font-bold text-foreground", children: price }),
|
|
@@ -3584,7 +3767,7 @@ function PricingTier({
|
|
|
3584
3767
|
] }) }),
|
|
3585
3768
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 space-y-4 py-6 px-6 border-t border-border/50", children: features.map((feature, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
3586
3769
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3587
|
-
|
|
3770
|
+
TablerIcons.IconCheck,
|
|
3588
3771
|
{
|
|
3589
3772
|
size: 20,
|
|
3590
3773
|
className: `flex-shrink-0 mt-0.5 ${feature.included ? "text-success" : "text-muted-foreground opacity-30"}`
|
|
@@ -3610,7 +3793,7 @@ function PricingTier({
|
|
|
3610
3793
|
PricingTier.displayName = "PricingTier";
|
|
3611
3794
|
var pricing_tier_default = PricingTier;
|
|
3612
3795
|
function CodeBlock({ code, className = "", showCopy = true }) {
|
|
3613
|
-
const [copied, setCopied] =
|
|
3796
|
+
const [copied, setCopied] = React6.useState(false);
|
|
3614
3797
|
const handleCopy = async () => {
|
|
3615
3798
|
try {
|
|
3616
3799
|
await navigator.clipboard.writeText(code);
|
|
@@ -3866,7 +4049,7 @@ function Page({ children, className = "" }) {
|
|
|
3866
4049
|
Page.displayName = "Page";
|
|
3867
4050
|
var page_default = Page;
|
|
3868
4051
|
function AccordionItem({ title, children, defaultOpen = false }) {
|
|
3869
|
-
const [isOpen, setIsOpen] =
|
|
4052
|
+
const [isOpen, setIsOpen] = React6.useState(defaultOpen);
|
|
3870
4053
|
return /* @__PURE__ */ jsxRuntime.jsxs("article", { className: "border-b border-border", children: [
|
|
3871
4054
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3872
4055
|
"button",
|
|
@@ -3928,9 +4111,9 @@ function Hero({
|
|
|
3928
4111
|
variant === "gradient" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-primary/20 to-transparent" }),
|
|
3929
4112
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-x-0 bottom-0 h-32 bg-gradient-to-t from-background to-transparent pointer-events-none" }),
|
|
3930
4113
|
/* @__PURE__ */ jsxRuntime.jsx(container_default, { size: "lg", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: centered ? "text-center mx-auto max-w-4xl" : "max-w-4xl", children: [
|
|
3931
|
-
subtitle && /* @__PURE__ */ jsxRuntime.jsx(text_default, { className: "text-lg md:text-xl font-semibold text-primary
|
|
4114
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx(text_default, { hasMargin: true, className: "text-lg md:text-xl font-semibold text-primary", weight: "semibold", children: subtitle }),
|
|
3932
4115
|
/* @__PURE__ */ jsxRuntime.jsx(heading_default, { level: 1, className: `${titleSizes[size]} font-extrabold mb-6 tracking-tight`, children: title }),
|
|
3933
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(text_default, { className: "text-lg md:text-xl mb-8 text-muted-foreground max-w-2xl mx-auto", children: description }),
|
|
4116
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(text_default, { hasMargin: true, className: "text-lg md:text-xl mb-8 text-muted-foreground max-w-2xl mx-auto", children: description }),
|
|
3934
4117
|
(primaryAction || secondaryAction) && /* @__PURE__ */ jsxRuntime.jsxs(stack_default, { direction: "horizontal", spacing: "md", className: `flex-wrap ${centered ? "justify-center" : ""}`, children: [
|
|
3935
4118
|
primaryAction && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3936
4119
|
button_default,
|
|
@@ -3974,16 +4157,10 @@ function FeatureSection({
|
|
|
3974
4157
|
className = ""
|
|
3975
4158
|
}) {
|
|
3976
4159
|
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: `py-16 md:py-20 ${className}`, children: /* @__PURE__ */ jsxRuntime.jsxs(container_default, { size: "xl", children: [
|
|
3977
|
-
(title || description) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3978
|
-
|
|
3979
|
-
{
|
|
3980
|
-
|
|
3981
|
-
children: [
|
|
3982
|
-
title && /* @__PURE__ */ jsxRuntime.jsx(heading_default, { level: 2, className: "text-3xl md:text-4xl font-bold mb-4", children: title }),
|
|
3983
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(text_default, { className: "text-lg md:text-xl", children: description })
|
|
3984
|
-
]
|
|
3985
|
-
}
|
|
3986
|
-
),
|
|
4160
|
+
(title || description) && /* @__PURE__ */ jsxRuntime.jsxs(stack_default, { spacing: "md", className: `mb-12 md:mb-16 ${centered ? "text-center max-w-3xl mx-auto" : "max-w-3xl"}`, children: [
|
|
4161
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(heading_default, { level: 2, hasMargin: true, children: title }),
|
|
4162
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(text_default, { className: "text-lg md:text-xl", children: description })
|
|
4163
|
+
] }),
|
|
3987
4164
|
/* @__PURE__ */ jsxRuntime.jsx(grid_default, { itemSize: "md", maxCols: columns, gap: "lg", children: features.map((feature, index) => /* @__PURE__ */ jsxRuntime.jsxs("article", { className: centered ? "text-center" : "", children: [
|
|
3988
4165
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3989
4166
|
"span",
|
|
@@ -4084,7 +4261,7 @@ function Footer({ sections, copyright, social, className = "" }) {
|
|
|
4084
4261
|
{
|
|
4085
4262
|
className: `${sections && sections.length > 0 ? "border-t border-border" : ""} py-6 flex flex-col md:flex-row items-center justify-between gap-4`,
|
|
4086
4263
|
children: [
|
|
4087
|
-
copyright && /* @__PURE__ */ jsxRuntime.jsx(text_default, { variant: "muted", className: "text-sm text-center md:text-left", children: copyright }),
|
|
4264
|
+
copyright && /* @__PURE__ */ jsxRuntime.jsx(text_default, { hasMargin: true, variant: "muted", className: "text-sm text-center md:text-left", children: copyright }),
|
|
4088
4265
|
social && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-4", children: social })
|
|
4089
4266
|
]
|
|
4090
4267
|
}
|
|
@@ -4094,7 +4271,7 @@ function Footer({ sections, copyright, social, className = "" }) {
|
|
|
4094
4271
|
Footer.displayName = "Footer";
|
|
4095
4272
|
var footer_default = Footer;
|
|
4096
4273
|
function useScrollReset(deps, container) {
|
|
4097
|
-
|
|
4274
|
+
React6.useEffect(() => {
|
|
4098
4275
|
let cancelled = false;
|
|
4099
4276
|
const maxRaf = 6;
|
|
4100
4277
|
let rafCount = 0;
|
|
@@ -4103,6 +4280,23 @@ function useScrollReset(deps, container) {
|
|
|
4103
4280
|
};
|
|
4104
4281
|
const setAllScrollTop = () => {
|
|
4105
4282
|
if (cancelled) return;
|
|
4283
|
+
try {
|
|
4284
|
+
const hash = typeof window !== "undefined" ? window.location.hash : "";
|
|
4285
|
+
if (hash && hash.startsWith("#")) {
|
|
4286
|
+
const id = decodeURIComponent(hash.slice(1));
|
|
4287
|
+
const resolved2 = isRef(container) ? container.current : container;
|
|
4288
|
+
const root = resolved2 ?? document;
|
|
4289
|
+
const target = root.querySelector ? root.querySelector(`#${CSS.escape(id)}`) : null;
|
|
4290
|
+
if (target) {
|
|
4291
|
+
try {
|
|
4292
|
+
target.scrollIntoView({ block: "start" });
|
|
4293
|
+
} catch (e) {
|
|
4294
|
+
}
|
|
4295
|
+
return;
|
|
4296
|
+
}
|
|
4297
|
+
}
|
|
4298
|
+
} catch (e) {
|
|
4299
|
+
}
|
|
4106
4300
|
window.scrollTo(0, 0);
|
|
4107
4301
|
const resolved = isRef(container) ? container.current : container;
|
|
4108
4302
|
if (resolved) resolved.scrollTop = 0;
|
|
@@ -4142,10 +4336,10 @@ function LeftNavLayout({
|
|
|
4142
4336
|
embedded = false,
|
|
4143
4337
|
mainContentRef
|
|
4144
4338
|
}) {
|
|
4145
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
4146
|
-
const navRef =
|
|
4147
|
-
const scrollPosRef =
|
|
4148
|
-
const internalContentRef =
|
|
4339
|
+
const [internalCollapsed, setInternalCollapsed] = React6.useState(false);
|
|
4340
|
+
const navRef = React6.useRef(null);
|
|
4341
|
+
const scrollPosRef = React6.useRef(0);
|
|
4342
|
+
const internalContentRef = React6.useRef(null);
|
|
4149
4343
|
const contentRef = mainContentRef || internalContentRef;
|
|
4150
4344
|
const collapsed = controlledCollapsed ?? internalCollapsed;
|
|
4151
4345
|
const setCollapsed = (value) => {
|
|
@@ -4157,7 +4351,7 @@ function LeftNavLayout({
|
|
|
4157
4351
|
};
|
|
4158
4352
|
const mobileMenuOpen = controlledMobileMenuOpen ?? false;
|
|
4159
4353
|
const toggleCollapsed = () => setCollapsed(!collapsed);
|
|
4160
|
-
|
|
4354
|
+
React6.useEffect(() => {
|
|
4161
4355
|
if (navRef.current) {
|
|
4162
4356
|
navRef.current.scrollTop = scrollPosRef.current;
|
|
4163
4357
|
}
|
|
@@ -4216,7 +4410,7 @@ function LeftNavLayout({
|
|
|
4216
4410
|
`,
|
|
4217
4411
|
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
4218
4412
|
type: "button",
|
|
4219
|
-
children: collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4413
|
+
children: collapsed ? /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconChevronRight, { size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(TablerIcons.IconChevronLeft, { size: 20 })
|
|
4220
4414
|
}
|
|
4221
4415
|
)
|
|
4222
4416
|
]
|
|
@@ -4259,15 +4453,15 @@ function LeftNavItem({
|
|
|
4259
4453
|
title,
|
|
4260
4454
|
preventNavigation = false
|
|
4261
4455
|
}) {
|
|
4262
|
-
const navRef =
|
|
4263
|
-
const [isCollapsed, setIsCollapsed] =
|
|
4456
|
+
const navRef = React6.useRef(null);
|
|
4457
|
+
const [isCollapsed, setIsCollapsed] = React6.useState(() => {
|
|
4264
4458
|
if (typeof window !== "undefined") {
|
|
4265
4459
|
const navElement = document.querySelector("nav[data-collapsed]");
|
|
4266
4460
|
return navElement?.getAttribute("data-collapsed") === "true";
|
|
4267
4461
|
}
|
|
4268
4462
|
return false;
|
|
4269
4463
|
});
|
|
4270
|
-
|
|
4464
|
+
React6.useEffect(() => {
|
|
4271
4465
|
const checkCollapsed = () => {
|
|
4272
4466
|
const navElement2 = navRef.current?.closest("nav");
|
|
4273
4467
|
if (navElement2) {
|
|
@@ -4381,26 +4575,26 @@ function Logo({ size = "md", className = "" }) {
|
|
|
4381
4575
|
const sizeClass = sizeClasses[size];
|
|
4382
4576
|
return /* @__PURE__ */ jsxRuntime.jsx("img", { src: "/icons/logo.svg", alt: "Hydden Logo", className: `${sizeClass} ${className}`, loading: "lazy" });
|
|
4383
4577
|
}
|
|
4384
|
-
var ThemeContext =
|
|
4578
|
+
var ThemeContext = React6.createContext(void 0);
|
|
4385
4579
|
function ThemeProvider({
|
|
4386
4580
|
children,
|
|
4387
4581
|
defaultTheme = "light",
|
|
4388
4582
|
storageKey = "hydn-theme",
|
|
4389
4583
|
themes = ["light", "dark"]
|
|
4390
4584
|
}) {
|
|
4391
|
-
const [theme, setThemeState] =
|
|
4585
|
+
const [theme, setThemeState] = React6.useState(() => {
|
|
4392
4586
|
if (typeof window !== "undefined") {
|
|
4393
4587
|
const stored = localStorage.getItem(storageKey);
|
|
4394
4588
|
return stored && themes.includes(stored) ? stored : defaultTheme;
|
|
4395
4589
|
}
|
|
4396
4590
|
return defaultTheme;
|
|
4397
4591
|
});
|
|
4398
|
-
|
|
4592
|
+
React6.useEffect(() => {
|
|
4399
4593
|
const root = window.document.documentElement;
|
|
4400
4594
|
root.classList.remove(...themes);
|
|
4401
4595
|
root.classList.add(theme);
|
|
4402
4596
|
}, [theme, themes]);
|
|
4403
|
-
const setTheme =
|
|
4597
|
+
const setTheme = React6.useCallback(
|
|
4404
4598
|
(newTheme) => {
|
|
4405
4599
|
if (themes.includes(newTheme)) {
|
|
4406
4600
|
localStorage.setItem(storageKey, newTheme);
|
|
@@ -4411,7 +4605,7 @@ function ThemeProvider({
|
|
|
4411
4605
|
},
|
|
4412
4606
|
[themes, storageKey]
|
|
4413
4607
|
);
|
|
4414
|
-
const value =
|
|
4608
|
+
const value = React6.useMemo(
|
|
4415
4609
|
() => ({
|
|
4416
4610
|
theme,
|
|
4417
4611
|
setTheme,
|
|
@@ -4422,7 +4616,7 @@ function ThemeProvider({
|
|
|
4422
4616
|
return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value, children });
|
|
4423
4617
|
}
|
|
4424
4618
|
function useTheme() {
|
|
4425
|
-
const context =
|
|
4619
|
+
const context = React6.useContext(ThemeContext);
|
|
4426
4620
|
if (!context) {
|
|
4427
4621
|
throw new Error("useTheme must be used within a ThemeProvider");
|
|
4428
4622
|
}
|
|
@@ -4485,7 +4679,7 @@ function ColorModeToggle({ className = "" }) {
|
|
|
4485
4679
|
}
|
|
4486
4680
|
ColorModeToggle.displayName = "ColorModeToggle";
|
|
4487
4681
|
var color_mode_toggle_default = ColorModeToggle;
|
|
4488
|
-
var AuthContext =
|
|
4682
|
+
var AuthContext = React6.createContext(void 0);
|
|
4489
4683
|
function AuthProvider({ config, children }) {
|
|
4490
4684
|
const {
|
|
4491
4685
|
onLogin,
|
|
@@ -4495,11 +4689,11 @@ function AuthProvider({ config, children }) {
|
|
|
4495
4689
|
useSessionStorage = false,
|
|
4496
4690
|
autoRefresh = true
|
|
4497
4691
|
} = config;
|
|
4498
|
-
const [user, setUser] =
|
|
4499
|
-
const [isLoading, setIsLoading] =
|
|
4500
|
-
const [error, setError] =
|
|
4692
|
+
const [user, setUser] = React6.useState(null);
|
|
4693
|
+
const [isLoading, setIsLoading] = React6.useState(true);
|
|
4694
|
+
const [error, setError] = React6.useState(null);
|
|
4501
4695
|
const storage = useSessionStorage ? sessionStorage : localStorage;
|
|
4502
|
-
|
|
4696
|
+
React6.useEffect(() => {
|
|
4503
4697
|
const loadUser = async () => {
|
|
4504
4698
|
try {
|
|
4505
4699
|
if (onRefresh && autoRefresh) {
|
|
@@ -4519,7 +4713,7 @@ function AuthProvider({ config, children }) {
|
|
|
4519
4713
|
};
|
|
4520
4714
|
loadUser();
|
|
4521
4715
|
}, [storageKey, storage, onRefresh, autoRefresh]);
|
|
4522
|
-
|
|
4716
|
+
React6.useEffect(() => {
|
|
4523
4717
|
if (user) {
|
|
4524
4718
|
storage.setItem(storageKey, JSON.stringify(user));
|
|
4525
4719
|
} else {
|
|
@@ -4590,7 +4784,7 @@ function AuthProvider({ config, children }) {
|
|
|
4590
4784
|
return /* @__PURE__ */ jsxRuntime.jsx(AuthContext.Provider, { value, children });
|
|
4591
4785
|
}
|
|
4592
4786
|
function useAuth() {
|
|
4593
|
-
const context =
|
|
4787
|
+
const context = React6.useContext(AuthContext);
|
|
4594
4788
|
if (!context) {
|
|
4595
4789
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
4596
4790
|
}
|