@efiche/design 0.2.10 → 0.2.11
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 +1690 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +89 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +303 -0
- package/dist/index.js +1656 -0
- package/dist/index.js.map +1 -0
- package/package.json +10 -10
- package/dist/index.mjs +0 -152
- package/dist/index.mjs.map +0 -1
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1690 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
var __export = (target, all) => {
|
|
37
|
+
for (var name in all)
|
|
38
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
39
|
+
};
|
|
40
|
+
var __copyProps = (to, from, except, desc) => {
|
|
41
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
42
|
+
for (let key of __getOwnPropNames(from))
|
|
43
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
44
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
45
|
+
}
|
|
46
|
+
return to;
|
|
47
|
+
};
|
|
48
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
49
|
+
|
|
50
|
+
// src/components/index.ts
|
|
51
|
+
var index_exports = {};
|
|
52
|
+
__export(index_exports, {
|
|
53
|
+
Accordion: () => Accordion_default,
|
|
54
|
+
Alert: () => Alert_default,
|
|
55
|
+
AreaChart: () => AreaChart_default,
|
|
56
|
+
Avatar: () => Avatar_default,
|
|
57
|
+
Badge: () => Badge_default,
|
|
58
|
+
BarChart: () => BarChart_default,
|
|
59
|
+
Breadcrumb: () => Breadcrumb_default,
|
|
60
|
+
Button: () => Button_default,
|
|
61
|
+
Card: () => Card,
|
|
62
|
+
CardContent: () => CardContent,
|
|
63
|
+
CardDescription: () => CardDescription,
|
|
64
|
+
CardFooter: () => CardFooter,
|
|
65
|
+
CardHeader: () => CardHeader,
|
|
66
|
+
CardTitle: () => CardTitle,
|
|
67
|
+
Checkbox: () => Checkbox_default,
|
|
68
|
+
CopyButton: () => CopyButton_default,
|
|
69
|
+
FileUpload: () => FileUpload_default,
|
|
70
|
+
Input: () => Input_default,
|
|
71
|
+
Label: () => Label_default,
|
|
72
|
+
LineChart: () => LineChart_default,
|
|
73
|
+
PasswordInput: () => PasswordInput_default,
|
|
74
|
+
PieChart: () => PieChart_default,
|
|
75
|
+
Progress: () => Progress_default,
|
|
76
|
+
RadioGroup: () => RadioGroup_default,
|
|
77
|
+
Select: () => Select_default,
|
|
78
|
+
Skeleton: () => Skeleton_default,
|
|
79
|
+
Slider: () => Slider_default,
|
|
80
|
+
Spinner: () => Spinner_default,
|
|
81
|
+
Switch: () => Switch_default,
|
|
82
|
+
Table: () => Table,
|
|
83
|
+
TableBody: () => TableBody,
|
|
84
|
+
TableCell: () => TableCell,
|
|
85
|
+
TableHead: () => TableHead,
|
|
86
|
+
TableHeader: () => TableHeader,
|
|
87
|
+
TableRow: () => TableRow,
|
|
88
|
+
Tabs: () => Tabs_default,
|
|
89
|
+
Textarea: () => Textarea_default,
|
|
90
|
+
ThemeProvider: () => ThemeProvider,
|
|
91
|
+
Tooltip: () => Tooltip_default,
|
|
92
|
+
useTheme: () => useTheme
|
|
93
|
+
});
|
|
94
|
+
module.exports = __toCommonJS(index_exports);
|
|
95
|
+
|
|
96
|
+
// src/components/ThemeProvider.tsx
|
|
97
|
+
var import_react = require("react");
|
|
98
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
99
|
+
var ThemeContext = (0, import_react.createContext)(null);
|
|
100
|
+
var ThemeProvider = ({
|
|
101
|
+
children,
|
|
102
|
+
defaultTheme = "light"
|
|
103
|
+
}) => {
|
|
104
|
+
const [theme, setTheme] = (0, import_react.useState)(defaultTheme);
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext.Provider, { value: { theme, toggle: () => setTheme((t) => t === "light" ? "dark" : "light") }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: theme === "dark" ? "ds-theme-dark" : void 0, children }) });
|
|
106
|
+
};
|
|
107
|
+
var useTheme = () => {
|
|
108
|
+
const ctx = (0, import_react.useContext)(ThemeContext);
|
|
109
|
+
if (!ctx) throw new Error("useTheme must be used inside <ThemeProvider>");
|
|
110
|
+
return ctx;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// src/components/Charts/LineChart.tsx
|
|
114
|
+
var import_react2 = require("react");
|
|
115
|
+
var import_recharts = require("recharts");
|
|
116
|
+
|
|
117
|
+
// src/components/Charts/chartUtils.ts
|
|
118
|
+
var CHART_COLORS = [
|
|
119
|
+
"#3b82f6",
|
|
120
|
+
// blue
|
|
121
|
+
"#22c55e",
|
|
122
|
+
// green
|
|
123
|
+
"#f59e0b",
|
|
124
|
+
// amber
|
|
125
|
+
"#ef4444",
|
|
126
|
+
// red
|
|
127
|
+
"#8b5cf6",
|
|
128
|
+
// violet
|
|
129
|
+
"#06b6d4",
|
|
130
|
+
// cyan
|
|
131
|
+
"#f97316",
|
|
132
|
+
// orange
|
|
133
|
+
"#ec4899"
|
|
134
|
+
// pink
|
|
135
|
+
];
|
|
136
|
+
function getChartTheme(theme) {
|
|
137
|
+
const isDark = theme === "dark";
|
|
138
|
+
return {
|
|
139
|
+
gridColor: isDark ? "#334155" : "#e2e8f0",
|
|
140
|
+
axisStroke: isDark ? "#94a3b8" : "#64748b",
|
|
141
|
+
axisTick: { fill: isDark ? "#94a3b8" : "#64748b", fontSize: 12 },
|
|
142
|
+
primaryColor: isDark ? "#60a5fa" : "#3b82f6",
|
|
143
|
+
tooltipStyle: {
|
|
144
|
+
backgroundColor: isDark ? "#1e293b" : "#ffffff",
|
|
145
|
+
border: `1px solid ${isDark ? "#334155" : "#e2e8f0"}`,
|
|
146
|
+
borderRadius: "6px",
|
|
147
|
+
color: isDark ? "#f1f5f9" : "#0f172a",
|
|
148
|
+
fontSize: "0.8125rem"
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// src/components/Charts/LineChart.tsx
|
|
154
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
155
|
+
var LineChart = ({
|
|
156
|
+
data,
|
|
157
|
+
xKey,
|
|
158
|
+
lines,
|
|
159
|
+
height = 250,
|
|
160
|
+
legend = false,
|
|
161
|
+
grid = true,
|
|
162
|
+
theme = "light",
|
|
163
|
+
className,
|
|
164
|
+
style
|
|
165
|
+
}) => {
|
|
166
|
+
const containerRef = (0, import_react2.useRef)(null);
|
|
167
|
+
const [width, setWidth] = (0, import_react2.useState)(0);
|
|
168
|
+
const { gridColor, axisStroke, axisTick, tooltipStyle } = getChartTheme(theme);
|
|
169
|
+
(0, import_react2.useEffect)(() => {
|
|
170
|
+
if (!containerRef.current) return;
|
|
171
|
+
const measure = () => setWidth(containerRef.current.offsetWidth);
|
|
172
|
+
measure();
|
|
173
|
+
const ro = new ResizeObserver(measure);
|
|
174
|
+
ro.observe(containerRef.current);
|
|
175
|
+
return () => ro.disconnect();
|
|
176
|
+
}, []);
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: containerRef, className, style: __spreadValues({ minWidth: 250, width: "100%" }, style), children: width > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_recharts.LineChart, { width, height, data, children: [
|
|
178
|
+
grid && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.CartesianGrid, { strokeDasharray: "3 3", stroke: gridColor }),
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.XAxis, { dataKey: xKey, stroke: axisStroke, tick: axisTick }),
|
|
180
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.YAxis, { stroke: axisStroke, tick: axisTick }),
|
|
181
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.Tooltip, { contentStyle: tooltipStyle }),
|
|
182
|
+
legend && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.Legend, {}),
|
|
183
|
+
lines.map((line, i) => {
|
|
184
|
+
var _a, _b;
|
|
185
|
+
const color = (_a = line.color) != null ? _a : CHART_COLORS[i % CHART_COLORS.length];
|
|
186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
187
|
+
import_recharts.Line,
|
|
188
|
+
{
|
|
189
|
+
type: "monotone",
|
|
190
|
+
dataKey: line.dataKey,
|
|
191
|
+
name: (_b = line.label) != null ? _b : line.dataKey,
|
|
192
|
+
stroke: color,
|
|
193
|
+
strokeWidth: 2,
|
|
194
|
+
dot: { fill: color, r: 4 },
|
|
195
|
+
activeDot: { r: 6 },
|
|
196
|
+
isAnimationActive: false
|
|
197
|
+
},
|
|
198
|
+
line.dataKey
|
|
199
|
+
);
|
|
200
|
+
})
|
|
201
|
+
] }) });
|
|
202
|
+
};
|
|
203
|
+
var LineChart_default = LineChart;
|
|
204
|
+
|
|
205
|
+
// src/components/Charts/BarChart.tsx
|
|
206
|
+
var import_react3 = require("react");
|
|
207
|
+
var import_recharts2 = require("recharts");
|
|
208
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
209
|
+
var BarChart = ({
|
|
210
|
+
data,
|
|
211
|
+
xKey,
|
|
212
|
+
bars,
|
|
213
|
+
height = 250,
|
|
214
|
+
legend = false,
|
|
215
|
+
grid = true,
|
|
216
|
+
theme = "light",
|
|
217
|
+
className,
|
|
218
|
+
style
|
|
219
|
+
}) => {
|
|
220
|
+
const containerRef = (0, import_react3.useRef)(null);
|
|
221
|
+
const [width, setWidth] = (0, import_react3.useState)(0);
|
|
222
|
+
const { gridColor, axisStroke, axisTick, tooltipStyle } = getChartTheme(theme);
|
|
223
|
+
(0, import_react3.useEffect)(() => {
|
|
224
|
+
if (!containerRef.current) return;
|
|
225
|
+
const measure = () => setWidth(containerRef.current.offsetWidth);
|
|
226
|
+
measure();
|
|
227
|
+
const ro = new ResizeObserver(measure);
|
|
228
|
+
ro.observe(containerRef.current);
|
|
229
|
+
return () => ro.disconnect();
|
|
230
|
+
}, []);
|
|
231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: containerRef, className, style: __spreadValues({ minWidth: 250, width: "100%" }, style), children: width > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_recharts2.BarChart, { width, height, data, children: [
|
|
232
|
+
grid && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.CartesianGrid, { strokeDasharray: "3 3", stroke: gridColor }),
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.XAxis, { dataKey: xKey, stroke: axisStroke, tick: axisTick }),
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.YAxis, { stroke: axisStroke, tick: axisTick }),
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.Tooltip, { contentStyle: tooltipStyle }),
|
|
236
|
+
legend && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.Legend, {}),
|
|
237
|
+
bars.map((bar, i) => {
|
|
238
|
+
var _a, _b;
|
|
239
|
+
const color = (_a = bar.color) != null ? _a : CHART_COLORS[i % CHART_COLORS.length];
|
|
240
|
+
const isLast = i === bars.length - 1;
|
|
241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
242
|
+
import_recharts2.Bar,
|
|
243
|
+
{
|
|
244
|
+
dataKey: bar.dataKey,
|
|
245
|
+
name: (_b = bar.label) != null ? _b : bar.dataKey,
|
|
246
|
+
fill: color,
|
|
247
|
+
stackId: bar.stackId,
|
|
248
|
+
radius: bar.stackId && !isLast ? [0, 0, 0, 0] : [4, 4, 0, 0],
|
|
249
|
+
isAnimationActive: false
|
|
250
|
+
},
|
|
251
|
+
bar.dataKey
|
|
252
|
+
);
|
|
253
|
+
})
|
|
254
|
+
] }) });
|
|
255
|
+
};
|
|
256
|
+
var BarChart_default = BarChart;
|
|
257
|
+
|
|
258
|
+
// src/components/Charts/AreaChart.tsx
|
|
259
|
+
var import_react4 = require("react");
|
|
260
|
+
var import_recharts3 = require("recharts");
|
|
261
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
262
|
+
var AreaChart = ({
|
|
263
|
+
data,
|
|
264
|
+
xKey,
|
|
265
|
+
areas,
|
|
266
|
+
height = 250,
|
|
267
|
+
legend = false,
|
|
268
|
+
grid = true,
|
|
269
|
+
theme = "light",
|
|
270
|
+
className,
|
|
271
|
+
style
|
|
272
|
+
}) => {
|
|
273
|
+
const containerRef = (0, import_react4.useRef)(null);
|
|
274
|
+
const [width, setWidth] = (0, import_react4.useState)(0);
|
|
275
|
+
const { gridColor, axisStroke, axisTick, tooltipStyle } = getChartTheme(theme);
|
|
276
|
+
(0, import_react4.useEffect)(() => {
|
|
277
|
+
if (!containerRef.current) return;
|
|
278
|
+
const measure = () => setWidth(containerRef.current.offsetWidth);
|
|
279
|
+
measure();
|
|
280
|
+
const ro = new ResizeObserver(measure);
|
|
281
|
+
ro.observe(containerRef.current);
|
|
282
|
+
return () => ro.disconnect();
|
|
283
|
+
}, []);
|
|
284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref: containerRef, className, style: __spreadValues({ minWidth: 250, width: "100%" }, style), children: width > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_recharts3.AreaChart, { width, height, data, children: [
|
|
285
|
+
grid && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.CartesianGrid, { strokeDasharray: "3 3", stroke: gridColor }),
|
|
286
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.XAxis, { dataKey: xKey, stroke: axisStroke, tick: axisTick }),
|
|
287
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.YAxis, { stroke: axisStroke, tick: axisTick }),
|
|
288
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Tooltip, { contentStyle: tooltipStyle }),
|
|
289
|
+
legend && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Legend, {}),
|
|
290
|
+
areas.map((area, i) => {
|
|
291
|
+
var _a, _b, _c;
|
|
292
|
+
const color = (_a = area.color) != null ? _a : CHART_COLORS[i % CHART_COLORS.length];
|
|
293
|
+
const opacity = (_b = area.fillOpacity) != null ? _b : area.stackId ? 0.4 : 0.15;
|
|
294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
295
|
+
import_recharts3.Area,
|
|
296
|
+
{
|
|
297
|
+
type: "monotone",
|
|
298
|
+
dataKey: area.dataKey,
|
|
299
|
+
name: (_c = area.label) != null ? _c : area.dataKey,
|
|
300
|
+
stroke: color,
|
|
301
|
+
fill: color,
|
|
302
|
+
fillOpacity: opacity,
|
|
303
|
+
strokeWidth: 2,
|
|
304
|
+
stackId: area.stackId,
|
|
305
|
+
isAnimationActive: false
|
|
306
|
+
},
|
|
307
|
+
area.dataKey
|
|
308
|
+
);
|
|
309
|
+
})
|
|
310
|
+
] }) });
|
|
311
|
+
};
|
|
312
|
+
var AreaChart_default = AreaChart;
|
|
313
|
+
|
|
314
|
+
// src/components/Charts/PieChart.tsx
|
|
315
|
+
var import_react5 = require("react");
|
|
316
|
+
var import_recharts4 = require("recharts");
|
|
317
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
318
|
+
var PieChart = ({
|
|
319
|
+
data,
|
|
320
|
+
height = 250,
|
|
321
|
+
donut = false,
|
|
322
|
+
legend = false,
|
|
323
|
+
label = false,
|
|
324
|
+
theme = "light",
|
|
325
|
+
className,
|
|
326
|
+
style
|
|
327
|
+
}) => {
|
|
328
|
+
const containerRef = (0, import_react5.useRef)(null);
|
|
329
|
+
const [width, setWidth] = (0, import_react5.useState)(0);
|
|
330
|
+
const { tooltipStyle } = getChartTheme(theme);
|
|
331
|
+
(0, import_react5.useEffect)(() => {
|
|
332
|
+
if (!containerRef.current) return;
|
|
333
|
+
const measure = () => setWidth(containerRef.current.offsetWidth);
|
|
334
|
+
measure();
|
|
335
|
+
const ro = new ResizeObserver(measure);
|
|
336
|
+
ro.observe(containerRef.current);
|
|
337
|
+
return () => ro.disconnect();
|
|
338
|
+
}, []);
|
|
339
|
+
const dataWithColors = data.map((item, i) => {
|
|
340
|
+
var _a;
|
|
341
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
342
|
+
fill: (_a = item.fill) != null ? _a : CHART_COLORS[i % CHART_COLORS.length]
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
const outerRadius = 90;
|
|
346
|
+
const innerRadius = donut ? 55 : 0;
|
|
347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: containerRef, className, style: __spreadValues({ minWidth: 250, width: "100%" }, style), children: width > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_recharts4.PieChart, { width, height, children: [
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
349
|
+
import_recharts4.Pie,
|
|
350
|
+
{
|
|
351
|
+
data: dataWithColors,
|
|
352
|
+
cx: "50%",
|
|
353
|
+
cy: "50%",
|
|
354
|
+
outerRadius,
|
|
355
|
+
innerRadius,
|
|
356
|
+
dataKey: "value",
|
|
357
|
+
label: label ? ({ name, percent }) => `${name} ${((percent != null ? percent : 0) * 100).toFixed(0)}%` : void 0,
|
|
358
|
+
labelLine: label,
|
|
359
|
+
isAnimationActive: false
|
|
360
|
+
}
|
|
361
|
+
),
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_recharts4.Tooltip, { contentStyle: tooltipStyle }),
|
|
363
|
+
legend && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_recharts4.Legend, {})
|
|
364
|
+
] }) });
|
|
365
|
+
};
|
|
366
|
+
var PieChart_default = PieChart;
|
|
367
|
+
|
|
368
|
+
// src/components/Accordion/Accordion.tsx
|
|
369
|
+
var import_react6 = require("react");
|
|
370
|
+
var import_lucide_react = require("lucide-react");
|
|
371
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
372
|
+
var Accordion = ({ items, defaultValue, multiple = false }) => {
|
|
373
|
+
const [open, setOpen] = (0, import_react6.useState)(() => {
|
|
374
|
+
if (!defaultValue) return /* @__PURE__ */ new Set();
|
|
375
|
+
if (Array.isArray(defaultValue)) return new Set(defaultValue);
|
|
376
|
+
return /* @__PURE__ */ new Set([defaultValue]);
|
|
377
|
+
});
|
|
378
|
+
const [hovered, setHovered] = (0, import_react6.useState)(null);
|
|
379
|
+
const toggle = (value) => {
|
|
380
|
+
setOpen((prev) => {
|
|
381
|
+
const next = new Set(prev);
|
|
382
|
+
if (next.has(value)) {
|
|
383
|
+
next.delete(value);
|
|
384
|
+
} else {
|
|
385
|
+
if (!multiple) next.clear();
|
|
386
|
+
next.add(value);
|
|
387
|
+
}
|
|
388
|
+
return next;
|
|
389
|
+
});
|
|
390
|
+
};
|
|
391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: {
|
|
392
|
+
border: "1px solid var(--ds-border, #e2e8f0)",
|
|
393
|
+
borderRadius: "0.5rem",
|
|
394
|
+
overflow: "hidden"
|
|
395
|
+
}, children: items.map((item, index) => {
|
|
396
|
+
const isOpen = open.has(item.value);
|
|
397
|
+
const isHovered = hovered === item.value;
|
|
398
|
+
const isLast = index === items.length - 1;
|
|
399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
400
|
+
"div",
|
|
401
|
+
{
|
|
402
|
+
style: {
|
|
403
|
+
borderBottom: isLast ? "none" : "1px solid var(--ds-border, #e2e8f0)"
|
|
404
|
+
},
|
|
405
|
+
children: [
|
|
406
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
407
|
+
"button",
|
|
408
|
+
{
|
|
409
|
+
style: {
|
|
410
|
+
display: "flex",
|
|
411
|
+
alignItems: "center",
|
|
412
|
+
justifyContent: "space-between",
|
|
413
|
+
width: "100%",
|
|
414
|
+
padding: "1rem",
|
|
415
|
+
fontSize: "0.875rem",
|
|
416
|
+
fontWeight: 500,
|
|
417
|
+
background: isHovered ? "var(--ds-muted, #f1f5f9)" : "transparent",
|
|
418
|
+
border: "none",
|
|
419
|
+
cursor: "pointer",
|
|
420
|
+
textAlign: "left",
|
|
421
|
+
color: "var(--ds-text-primary, #0f172a)",
|
|
422
|
+
transition: "background-color 0.15s"
|
|
423
|
+
},
|
|
424
|
+
onClick: () => toggle(item.value),
|
|
425
|
+
onMouseEnter: () => setHovered(item.value),
|
|
426
|
+
onMouseLeave: () => setHovered(null),
|
|
427
|
+
"aria-expanded": isOpen,
|
|
428
|
+
children: [
|
|
429
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: item.trigger }),
|
|
430
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
431
|
+
import_lucide_react.ChevronDown,
|
|
432
|
+
{
|
|
433
|
+
size: 16,
|
|
434
|
+
style: {
|
|
435
|
+
flexShrink: 0,
|
|
436
|
+
color: "var(--ds-text-secondary, #64748b)",
|
|
437
|
+
transition: "transform 0.2s ease",
|
|
438
|
+
transform: isOpen ? "rotate(180deg)" : "rotate(0deg)"
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
)
|
|
442
|
+
]
|
|
443
|
+
}
|
|
444
|
+
),
|
|
445
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: {
|
|
446
|
+
maxHeight: isOpen ? "300px" : "0",
|
|
447
|
+
overflow: "hidden",
|
|
448
|
+
transition: "max-height 0.25s ease"
|
|
449
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: {
|
|
450
|
+
padding: "0 1rem 1rem",
|
|
451
|
+
fontSize: "0.875rem",
|
|
452
|
+
color: "var(--ds-text-secondary, #64748b)"
|
|
453
|
+
}, children: item.content }) })
|
|
454
|
+
]
|
|
455
|
+
},
|
|
456
|
+
item.value
|
|
457
|
+
);
|
|
458
|
+
}) });
|
|
459
|
+
};
|
|
460
|
+
var Accordion_default = Accordion;
|
|
461
|
+
|
|
462
|
+
// src/components/Alert/Alert.tsx
|
|
463
|
+
var import_lucide_react2 = require("lucide-react");
|
|
464
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
465
|
+
var variantMap = {
|
|
466
|
+
info: { bg: "var(--ds-info-bg, #eff6ff)", border: "var(--ds-info, #3b82f6)", icon: "var(--ds-info, #3b82f6)", title: "var(--ds-info-title, #1e3a8a)", desc: "var(--ds-info-desc, #1e40af)" },
|
|
467
|
+
success: { bg: "var(--ds-success-bg, #f0fdf4)", border: "var(--ds-success, #22c55e)", icon: "var(--ds-success, #22c55e)", title: "var(--ds-success-title, #14532d)", desc: "var(--ds-success-desc, #166534)" },
|
|
468
|
+
warning: { bg: "var(--ds-warning-bg, #fffbeb)", border: "var(--ds-warning, #f59e0b)", icon: "var(--ds-warning, #f59e0b)", title: "var(--ds-warning-title, #78350f)", desc: "var(--ds-warning-desc, #92400e)" },
|
|
469
|
+
danger: { bg: "var(--ds-danger-bg, #fef2f2)", border: "var(--ds-danger, #ef4444)", icon: "var(--ds-danger, #ef4444)", title: "var(--ds-danger-title, #7f1d1d)", desc: "var(--ds-danger-desc, #991b1b)" }
|
|
470
|
+
};
|
|
471
|
+
var icons = {
|
|
472
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.Info, { size: 16 }),
|
|
473
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.CheckCircle2, { size: 16 }),
|
|
474
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.AlertTriangle, { size: 16 }),
|
|
475
|
+
danger: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.AlertCircle, { size: 16 })
|
|
476
|
+
};
|
|
477
|
+
var Alert = ({ variant = "info", title, description }) => {
|
|
478
|
+
const v = variantMap[variant];
|
|
479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { role: "alert", style: {
|
|
480
|
+
display: "flex",
|
|
481
|
+
gap: "0.75rem",
|
|
482
|
+
padding: "1rem",
|
|
483
|
+
borderRadius: "0.5rem",
|
|
484
|
+
borderLeft: `4px solid ${v.border}`,
|
|
485
|
+
backgroundColor: v.bg
|
|
486
|
+
}, children: [
|
|
487
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { flexShrink: 0, marginTop: "0.125rem", color: v.icon }, children: icons[variant] }),
|
|
488
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { flex: 1 }, children: [
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: { fontWeight: 600, fontSize: "0.875rem", marginBottom: "0.25rem", marginTop: 0, color: v.title }, children: title }),
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: { fontSize: "0.875rem", margin: 0, color: v.desc }, children: description })
|
|
491
|
+
] })
|
|
492
|
+
] });
|
|
493
|
+
};
|
|
494
|
+
var Alert_default = Alert;
|
|
495
|
+
|
|
496
|
+
// src/components/Avatar/Avatar.tsx
|
|
497
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
498
|
+
var sizeMap = {
|
|
499
|
+
sm: { width: "2rem", height: "2rem", fontSize: "0.625rem" },
|
|
500
|
+
md: { width: "2.5rem", height: "2.5rem", fontSize: "0.875rem" },
|
|
501
|
+
lg: { width: "4rem", height: "4rem", fontSize: "1.25rem" }
|
|
502
|
+
};
|
|
503
|
+
var Avatar = ({ fallback, size = "md", style, className }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
504
|
+
"div",
|
|
505
|
+
{
|
|
506
|
+
className,
|
|
507
|
+
"aria-label": fallback,
|
|
508
|
+
style: __spreadValues(__spreadValues({
|
|
509
|
+
display: "inline-flex",
|
|
510
|
+
alignItems: "center",
|
|
511
|
+
justifyContent: "center",
|
|
512
|
+
borderRadius: "9999px",
|
|
513
|
+
backgroundColor: "var(--ds-accent, #f1f5f9)",
|
|
514
|
+
color: "var(--ds-text-primary, #0f172a)",
|
|
515
|
+
fontWeight: 600,
|
|
516
|
+
flexShrink: 0,
|
|
517
|
+
userSelect: "none"
|
|
518
|
+
}, sizeMap[size]), style),
|
|
519
|
+
children: fallback
|
|
520
|
+
}
|
|
521
|
+
);
|
|
522
|
+
var Avatar_default = Avatar;
|
|
523
|
+
|
|
524
|
+
// src/components/Badge/Badge.tsx
|
|
525
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
526
|
+
var variantMap2 = {
|
|
527
|
+
default: { backgroundColor: "var(--ds-primary, #3b82f6)", color: "#fff" },
|
|
528
|
+
secondary: { backgroundColor: "var(--ds-muted, #f1f5f9)", color: "var(--ds-text-secondary, #64748b)" },
|
|
529
|
+
outline: { backgroundColor: "transparent", border: "1px solid var(--ds-border, #e2e8f0)", color: "var(--ds-text-primary, #0f172a)" },
|
|
530
|
+
danger: { backgroundColor: "var(--ds-danger, #ef4444)", color: "#fff" },
|
|
531
|
+
success: { backgroundColor: "var(--ds-success, #22c55e)", color: "#fff" },
|
|
532
|
+
warning: { backgroundColor: "var(--ds-warning, #f59e0b)", color: "#fff" },
|
|
533
|
+
info: { backgroundColor: "var(--ds-info, #3b82f6)", color: "#fff" }
|
|
534
|
+
};
|
|
535
|
+
var sizeMap2 = {
|
|
536
|
+
sm: { padding: "0.125rem 0.5rem", fontSize: "0.625rem" },
|
|
537
|
+
md: { padding: "0.25rem 0.625rem", fontSize: "0.75rem" },
|
|
538
|
+
lg: { padding: "0.375rem 0.875rem", fontSize: "0.875rem" }
|
|
539
|
+
};
|
|
540
|
+
var Badge = ({ variant = "default", size = "md", children, style }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: __spreadValues(__spreadValues(__spreadValues({
|
|
541
|
+
display: "inline-flex",
|
|
542
|
+
alignItems: "center",
|
|
543
|
+
gap: "0.25rem",
|
|
544
|
+
borderRadius: "9999px",
|
|
545
|
+
fontWeight: 500,
|
|
546
|
+
whiteSpace: "nowrap"
|
|
547
|
+
}, variantMap2[variant]), sizeMap2[size]), style), children });
|
|
548
|
+
var Badge_default = Badge;
|
|
549
|
+
|
|
550
|
+
// src/components/Breadcrumb/Breadcrumb.tsx
|
|
551
|
+
var import_react7 = require("react");
|
|
552
|
+
var import_lucide_react3 = require("lucide-react");
|
|
553
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
554
|
+
var Breadcrumb = ({ items }) => {
|
|
555
|
+
const [hovered, setHovered] = (0, import_react7.useState)(null);
|
|
556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("nav", { "aria-label": "Breadcrumb", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ol", { style: {
|
|
557
|
+
display: "flex",
|
|
558
|
+
flexWrap: "wrap",
|
|
559
|
+
alignItems: "center",
|
|
560
|
+
listStyle: "none",
|
|
561
|
+
padding: 0,
|
|
562
|
+
margin: 0,
|
|
563
|
+
fontSize: "0.875rem"
|
|
564
|
+
}, children: items.map((item, i) => {
|
|
565
|
+
const isLast = i === items.length - 1;
|
|
566
|
+
const isHovered = hovered === item.label;
|
|
567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { style: { display: "flex", alignItems: "center" }, children: [
|
|
568
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
569
|
+
import_lucide_react3.ChevronRight,
|
|
570
|
+
{
|
|
571
|
+
size: 14,
|
|
572
|
+
"aria-hidden": true,
|
|
573
|
+
style: { color: "var(--ds-text-secondary, #64748b)", margin: "0 0.25rem", flexShrink: 0 }
|
|
574
|
+
}
|
|
575
|
+
),
|
|
576
|
+
isLast || !item.href ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: {
|
|
577
|
+
color: isLast ? "var(--ds-text-primary, #0f172a)" : "var(--ds-text-secondary, #64748b)",
|
|
578
|
+
fontWeight: isLast ? 500 : void 0,
|
|
579
|
+
cursor: isLast ? "default" : void 0
|
|
580
|
+
}, children: item.label }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
581
|
+
"a",
|
|
582
|
+
{
|
|
583
|
+
href: item.href,
|
|
584
|
+
onMouseEnter: () => setHovered(item.label),
|
|
585
|
+
onMouseLeave: () => setHovered(null),
|
|
586
|
+
style: {
|
|
587
|
+
color: "var(--ds-text-secondary, #64748b)",
|
|
588
|
+
textDecoration: isHovered ? "underline" : "none",
|
|
589
|
+
transition: "color 0.15s"
|
|
590
|
+
},
|
|
591
|
+
children: item.label
|
|
592
|
+
}
|
|
593
|
+
)
|
|
594
|
+
] }, item.label);
|
|
595
|
+
}) }) });
|
|
596
|
+
};
|
|
597
|
+
var Breadcrumb_default = Breadcrumb;
|
|
598
|
+
|
|
599
|
+
// src/components/Button/Button.tsx
|
|
600
|
+
var import_lucide_react4 = require("lucide-react");
|
|
601
|
+
var import_react8 = require("react");
|
|
602
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
603
|
+
var variantStyles = {
|
|
604
|
+
solid: { backgroundColor: "var(--ds-primary, #3b82f6)", color: "#fff", borderColor: "transparent" },
|
|
605
|
+
outline: { backgroundColor: "transparent", color: "var(--ds-primary, #3b82f6)", borderColor: "var(--ds-primary, #3b82f6)" },
|
|
606
|
+
ghost: { backgroundColor: "var(--ds-muted, #f1f5f9)", color: "var(--ds-text-primary, #0f172a)", borderColor: "transparent" },
|
|
607
|
+
danger: { backgroundColor: "var(--ds-danger, #ef4444)", color: "#fff", borderColor: "transparent" },
|
|
608
|
+
warning: { backgroundColor: "var(--ds-warning, #f59e0b)", color: "#fff", borderColor: "transparent" },
|
|
609
|
+
info: { backgroundColor: "var(--ds-info, #3b82f6)", color: "#fff", borderColor: "transparent" },
|
|
610
|
+
success: { backgroundColor: "var(--ds-success, #22c55e)", color: "#fff", borderColor: "transparent" }
|
|
611
|
+
};
|
|
612
|
+
var variantHoverStyles = {
|
|
613
|
+
solid: { opacity: 0.88 },
|
|
614
|
+
outline: { backgroundColor: "var(--ds-muted, #f1f5f9)" },
|
|
615
|
+
ghost: { backgroundColor: "var(--ds-card, #ffffff)" },
|
|
616
|
+
danger: { opacity: 0.88 },
|
|
617
|
+
warning: { opacity: 0.88 },
|
|
618
|
+
info: { opacity: 0.88 },
|
|
619
|
+
success: { opacity: 0.88 }
|
|
620
|
+
};
|
|
621
|
+
var sizeStyles = {
|
|
622
|
+
sm: { padding: "0.25rem 0.625rem", fontSize: "0.8rem" },
|
|
623
|
+
md: { padding: "0.5rem 1rem", fontSize: "0.875rem" },
|
|
624
|
+
lg: { padding: "0.75rem 1.5rem", fontSize: "1rem" }
|
|
625
|
+
};
|
|
626
|
+
var Button = (_a) => {
|
|
627
|
+
var _b = _a, {
|
|
628
|
+
text,
|
|
629
|
+
children,
|
|
630
|
+
loading = false,
|
|
631
|
+
disabled = false,
|
|
632
|
+
icon,
|
|
633
|
+
iconPosition = "left",
|
|
634
|
+
outline = false,
|
|
635
|
+
ghost = false,
|
|
636
|
+
danger = false,
|
|
637
|
+
warning = false,
|
|
638
|
+
info = false,
|
|
639
|
+
success = false,
|
|
640
|
+
variant,
|
|
641
|
+
small = false,
|
|
642
|
+
large = false,
|
|
643
|
+
size,
|
|
644
|
+
style: styleProp
|
|
645
|
+
} = _b, props = __objRest(_b, [
|
|
646
|
+
"text",
|
|
647
|
+
"children",
|
|
648
|
+
"loading",
|
|
649
|
+
"disabled",
|
|
650
|
+
"icon",
|
|
651
|
+
"iconPosition",
|
|
652
|
+
"outline",
|
|
653
|
+
"ghost",
|
|
654
|
+
"danger",
|
|
655
|
+
"warning",
|
|
656
|
+
"info",
|
|
657
|
+
"success",
|
|
658
|
+
"variant",
|
|
659
|
+
"small",
|
|
660
|
+
"large",
|
|
661
|
+
"size",
|
|
662
|
+
"style"
|
|
663
|
+
]);
|
|
664
|
+
const [hovered, setHovered] = (0, import_react8.useState)(false);
|
|
665
|
+
const resolvedVariant = variant != null ? variant : danger ? "danger" : warning ? "warning" : info ? "info" : success ? "success" : ghost ? "ghost" : outline ? "outline" : "solid";
|
|
666
|
+
const resolvedSize = size != null ? size : small ? "sm" : large ? "lg" : "md";
|
|
667
|
+
const isDisabled = disabled || loading;
|
|
668
|
+
const content = children != null ? children : text;
|
|
669
|
+
const showIcon = icon && !loading;
|
|
670
|
+
const computedStyle = __spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
671
|
+
display: "inline-flex",
|
|
672
|
+
alignItems: "center",
|
|
673
|
+
gap: "0.5rem",
|
|
674
|
+
border: "1px solid transparent",
|
|
675
|
+
borderRadius: "0.375rem",
|
|
676
|
+
fontWeight: 500,
|
|
677
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
678
|
+
transition: "opacity 0.15s, background-color 0.15s",
|
|
679
|
+
opacity: isDisabled ? 0.5 : 1,
|
|
680
|
+
pointerEvents: loading ? "none" : void 0
|
|
681
|
+
}, variantStyles[resolvedVariant]), sizeStyles[resolvedSize]), hovered && !isDisabled ? variantHoverStyles[resolvedVariant] : {}), styleProp);
|
|
682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
683
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("style", { href: "ds-spin", precedence: "low", children: `@keyframes ds-spin { to { transform: rotate(360deg); } }` }),
|
|
684
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
685
|
+
"button",
|
|
686
|
+
__spreadProps(__spreadValues({
|
|
687
|
+
disabled: isDisabled,
|
|
688
|
+
style: computedStyle,
|
|
689
|
+
onMouseEnter: () => setHovered(true),
|
|
690
|
+
onMouseLeave: () => setHovered(false)
|
|
691
|
+
}, props), {
|
|
692
|
+
children: [
|
|
693
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
694
|
+
import_lucide_react4.LoaderCircle,
|
|
695
|
+
{
|
|
696
|
+
"aria-hidden": true,
|
|
697
|
+
style: { width: "1em", height: "1em", animation: "ds-spin 0.75s linear infinite" }
|
|
698
|
+
}
|
|
699
|
+
) : null,
|
|
700
|
+
showIcon && iconPosition === "left" ? icon : null,
|
|
701
|
+
content,
|
|
702
|
+
showIcon && iconPosition === "right" ? icon : null
|
|
703
|
+
]
|
|
704
|
+
})
|
|
705
|
+
)
|
|
706
|
+
] });
|
|
707
|
+
};
|
|
708
|
+
var Button_default = Button;
|
|
709
|
+
|
|
710
|
+
// src/components/Card/Card.tsx
|
|
711
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
712
|
+
var Card = (_a) => {
|
|
713
|
+
var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
|
|
714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", __spreadValues({ style: __spreadValues({
|
|
715
|
+
border: "1px solid var(--ds-border, #e2e8f0)",
|
|
716
|
+
borderRadius: "0.5rem",
|
|
717
|
+
backgroundColor: "var(--ds-card, #ffffff)"
|
|
718
|
+
}, style) }, props));
|
|
719
|
+
};
|
|
720
|
+
var CardHeader = (_a) => {
|
|
721
|
+
var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
|
|
722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", __spreadValues({ style: __spreadValues({
|
|
723
|
+
display: "flex",
|
|
724
|
+
flexDirection: "column",
|
|
725
|
+
gap: "0.375rem",
|
|
726
|
+
padding: "1.5rem 1.5rem 0"
|
|
727
|
+
}, style) }, props));
|
|
728
|
+
};
|
|
729
|
+
var CardTitle = (_a) => {
|
|
730
|
+
var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
|
|
731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", __spreadValues({ style: __spreadValues({
|
|
732
|
+
fontSize: "1rem",
|
|
733
|
+
fontWeight: 600,
|
|
734
|
+
color: "var(--ds-text-primary, #0f172a)",
|
|
735
|
+
margin: 0,
|
|
736
|
+
lineHeight: 1.4
|
|
737
|
+
}, style) }, props));
|
|
738
|
+
};
|
|
739
|
+
var CardDescription = (_a) => {
|
|
740
|
+
var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
|
|
741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", __spreadValues({ style: __spreadValues({
|
|
742
|
+
fontSize: "0.875rem",
|
|
743
|
+
color: "var(--ds-text-secondary, #64748b)",
|
|
744
|
+
margin: 0
|
|
745
|
+
}, style) }, props));
|
|
746
|
+
};
|
|
747
|
+
var CardContent = (_a) => {
|
|
748
|
+
var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", __spreadValues({ style: __spreadValues({ padding: "1.5rem" }, style) }, props));
|
|
750
|
+
};
|
|
751
|
+
var CardFooter = (_a) => {
|
|
752
|
+
var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
|
|
753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", __spreadValues({ style: __spreadValues({
|
|
754
|
+
display: "flex",
|
|
755
|
+
alignItems: "center",
|
|
756
|
+
padding: "0 1.5rem 1.5rem"
|
|
757
|
+
}, style) }, props));
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
761
|
+
var import_react9 = require("react");
|
|
762
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
763
|
+
var Checkbox = ({
|
|
764
|
+
label,
|
|
765
|
+
checked,
|
|
766
|
+
defaultChecked = false,
|
|
767
|
+
disabled,
|
|
768
|
+
id,
|
|
769
|
+
onChange
|
|
770
|
+
}) => {
|
|
771
|
+
const [internal, setInternal] = (0, import_react9.useState)(defaultChecked);
|
|
772
|
+
const isChecked = checked !== void 0 ? checked : internal;
|
|
773
|
+
const handleChange = () => {
|
|
774
|
+
if (disabled) return;
|
|
775
|
+
const next = !isChecked;
|
|
776
|
+
setInternal(next);
|
|
777
|
+
onChange == null ? void 0 : onChange(next);
|
|
778
|
+
};
|
|
779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { htmlFor: id, style: {
|
|
780
|
+
display: "inline-flex",
|
|
781
|
+
alignItems: "center",
|
|
782
|
+
gap: "0.5rem",
|
|
783
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
784
|
+
userSelect: "none",
|
|
785
|
+
opacity: disabled ? 0.5 : 1
|
|
786
|
+
}, children: [
|
|
787
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
788
|
+
"input",
|
|
789
|
+
{
|
|
790
|
+
type: "checkbox",
|
|
791
|
+
id,
|
|
792
|
+
checked: isChecked,
|
|
793
|
+
disabled,
|
|
794
|
+
onChange: handleChange,
|
|
795
|
+
style: { position: "absolute", opacity: 0, width: 0, height: 0 }
|
|
796
|
+
}
|
|
797
|
+
),
|
|
798
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: {
|
|
799
|
+
width: "1.125rem",
|
|
800
|
+
height: "1.125rem",
|
|
801
|
+
border: `2px solid ${isChecked ? "var(--ds-primary, #3b82f6)" : "var(--ds-border, #e2e8f0)"}`,
|
|
802
|
+
borderRadius: "0.25rem",
|
|
803
|
+
display: "flex",
|
|
804
|
+
alignItems: "center",
|
|
805
|
+
justifyContent: "center",
|
|
806
|
+
flexShrink: 0,
|
|
807
|
+
transition: "background-color 0.15s, border-color 0.15s",
|
|
808
|
+
backgroundColor: isChecked ? "var(--ds-primary, #3b82f6)" : "var(--ds-card, #fff)"
|
|
809
|
+
}, children: isChecked && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { viewBox: "0 0 12 10", fill: "none", style: { width: "0.625rem", height: "0.625rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M1 5l3.5 3.5L11 1", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
|
|
810
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: "0.875rem", color: "var(--ds-text-primary, #0f172a)" }, children: label })
|
|
811
|
+
] });
|
|
812
|
+
};
|
|
813
|
+
var Checkbox_default = Checkbox;
|
|
814
|
+
|
|
815
|
+
// src/components/CopyButton/CopyButton.tsx
|
|
816
|
+
var import_lucide_react5 = require("lucide-react");
|
|
817
|
+
var import_react10 = require("react");
|
|
818
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
819
|
+
var CopyButton = ({ text }) => {
|
|
820
|
+
const [copied, setCopied] = (0, import_react10.useState)(false);
|
|
821
|
+
const [hovered, setHovered] = (0, import_react10.useState)(false);
|
|
822
|
+
const handleCopy = () => {
|
|
823
|
+
navigator.clipboard.writeText(text);
|
|
824
|
+
setCopied(true);
|
|
825
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
826
|
+
};
|
|
827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
828
|
+
"button",
|
|
829
|
+
{
|
|
830
|
+
onClick: handleCopy,
|
|
831
|
+
onMouseEnter: () => setHovered(true),
|
|
832
|
+
onMouseLeave: () => setHovered(false),
|
|
833
|
+
"aria-label": copied ? "Copied" : `Copy ${text}`,
|
|
834
|
+
style: {
|
|
835
|
+
display: "inline-flex",
|
|
836
|
+
alignItems: "center",
|
|
837
|
+
justifyContent: "center",
|
|
838
|
+
padding: "0.25rem",
|
|
839
|
+
border: "none",
|
|
840
|
+
borderRadius: "0.25rem",
|
|
841
|
+
backgroundColor: hovered ? "var(--ds-accent, #f1f5f9)" : "transparent",
|
|
842
|
+
color: hovered ? "var(--ds-text-primary, #0f172a)" : "var(--ds-text-secondary, #64748b)",
|
|
843
|
+
cursor: "pointer",
|
|
844
|
+
transition: "background-color 0.15s, color 0.15s"
|
|
845
|
+
},
|
|
846
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.Check, { style: { width: "1rem", height: "1rem" } }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.Copy, { style: { width: "1rem", height: "1rem" } })
|
|
847
|
+
}
|
|
848
|
+
);
|
|
849
|
+
};
|
|
850
|
+
var CopyButton_default = CopyButton;
|
|
851
|
+
|
|
852
|
+
// src/components/FileUpload/FileUpload.tsx
|
|
853
|
+
var import_lucide_react6 = require("lucide-react");
|
|
854
|
+
var import_react11 = require("react");
|
|
855
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
856
|
+
var FileUpload = ({ accept, multiple, disabled, onFileSelect }) => {
|
|
857
|
+
const [isDragging, setIsDragging] = (0, import_react11.useState)(false);
|
|
858
|
+
const [isHovered, setIsHovered] = (0, import_react11.useState)(false);
|
|
859
|
+
const [fileNames, setFileNames] = (0, import_react11.useState)([]);
|
|
860
|
+
const inputRef = (0, import_react11.useRef)(null);
|
|
861
|
+
const handleFiles = (list) => {
|
|
862
|
+
setFileNames(Array.from(list).map((f) => f.name));
|
|
863
|
+
onFileSelect == null ? void 0 : onFileSelect(list);
|
|
864
|
+
};
|
|
865
|
+
const isActive = isDragging || isHovered;
|
|
866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
867
|
+
"div",
|
|
868
|
+
{
|
|
869
|
+
onClick: () => {
|
|
870
|
+
var _a;
|
|
871
|
+
return !disabled && ((_a = inputRef.current) == null ? void 0 : _a.click());
|
|
872
|
+
},
|
|
873
|
+
onMouseEnter: () => !disabled && setIsHovered(true),
|
|
874
|
+
onMouseLeave: () => setIsHovered(false),
|
|
875
|
+
onDragOver: (e) => {
|
|
876
|
+
e.preventDefault();
|
|
877
|
+
setIsDragging(true);
|
|
878
|
+
},
|
|
879
|
+
onDragLeave: () => setIsDragging(false),
|
|
880
|
+
onDrop: (e) => {
|
|
881
|
+
e.preventDefault();
|
|
882
|
+
setIsDragging(false);
|
|
883
|
+
if (!disabled && e.dataTransfer.files.length) handleFiles(e.dataTransfer.files);
|
|
884
|
+
},
|
|
885
|
+
style: {
|
|
886
|
+
border: `2px dashed ${isActive ? "var(--ds-primary, #3b82f6)" : "var(--ds-border, #e2e8f0)"}`,
|
|
887
|
+
borderRadius: "0.5rem",
|
|
888
|
+
padding: "2rem",
|
|
889
|
+
display: "flex",
|
|
890
|
+
flexDirection: "column",
|
|
891
|
+
alignItems: "center",
|
|
892
|
+
gap: "0.5rem",
|
|
893
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
894
|
+
backgroundColor: isActive ? "var(--ds-primary-50, #eff6ff)" : "var(--ds-muted, #f1f5f9)",
|
|
895
|
+
transition: "border-color 0.15s, background-color 0.15s",
|
|
896
|
+
textAlign: "center",
|
|
897
|
+
opacity: disabled ? 0.5 : 1
|
|
898
|
+
},
|
|
899
|
+
children: [
|
|
900
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
901
|
+
"input",
|
|
902
|
+
{
|
|
903
|
+
ref: inputRef,
|
|
904
|
+
type: "file",
|
|
905
|
+
accept,
|
|
906
|
+
multiple,
|
|
907
|
+
disabled,
|
|
908
|
+
style: { display: "none" },
|
|
909
|
+
onChange: (e) => e.target.files && handleFiles(e.target.files)
|
|
910
|
+
}
|
|
911
|
+
),
|
|
912
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.Upload, { size: 32, style: { color: "var(--ds-text-secondary, #64748b)" } }),
|
|
913
|
+
fileNames.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { style: { fontSize: "0.875rem", color: "var(--ds-primary, #3b82f6)", fontWeight: 500, margin: 0 }, children: fileNames.join(", ") }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { style: { fontSize: "0.875rem", color: "var(--ds-text-secondary, #64748b)", margin: 0 }, children: [
|
|
914
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: "Click to upload" }),
|
|
915
|
+
" or drag and drop"
|
|
916
|
+
] })
|
|
917
|
+
]
|
|
918
|
+
}
|
|
919
|
+
);
|
|
920
|
+
};
|
|
921
|
+
var FileUpload_default = FileUpload;
|
|
922
|
+
|
|
923
|
+
// src/components/Input/Input.tsx
|
|
924
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
925
|
+
var inputCSS = `
|
|
926
|
+
[data-ds-input]::placeholder { color: var(--ds-text-secondary, #64748b); }
|
|
927
|
+
[data-ds-input]:focus { outline: none; border-color: var(--ds-primary, #3b82f6); box-shadow: 0 0 0 3px rgb(59 130 246 / 0.15); }
|
|
928
|
+
[data-ds-input]:disabled { opacity: 0.5; cursor: not-allowed; background-color: var(--ds-muted, #f1f5f9); }
|
|
929
|
+
[data-ds-input][data-error="true"]:focus { border-color: var(--ds-danger, #ef4444); box-shadow: 0 0 0 3px rgb(239 68 68 / 0.15); }
|
|
930
|
+
[data-ds-input][data-success="true"]:focus { border-color: var(--ds-success, #22c55e); box-shadow: 0 0 0 3px rgb(34 197 94 / 0.15); }
|
|
931
|
+
`;
|
|
932
|
+
var Input = (_a) => {
|
|
933
|
+
var _b = _a, { error, success, leftIcon, rightIcon, style } = _b, props = __objRest(_b, ["error", "success", "leftIcon", "rightIcon", "style"]);
|
|
934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
935
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("style", { href: "ds-input", precedence: "low", children: inputCSS }),
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { position: "relative", display: "flex", alignItems: "center", width: "100%" }, children: [
|
|
937
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: {
|
|
938
|
+
position: "absolute",
|
|
939
|
+
left: "0.625rem",
|
|
940
|
+
display: "flex",
|
|
941
|
+
alignItems: "center",
|
|
942
|
+
color: "var(--ds-text-secondary, #64748b)",
|
|
943
|
+
pointerEvents: "none"
|
|
944
|
+
}, children: leftIcon }),
|
|
945
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
946
|
+
"input",
|
|
947
|
+
__spreadValues({
|
|
948
|
+
"data-ds-input": "",
|
|
949
|
+
"data-error": error ? "true" : void 0,
|
|
950
|
+
"data-success": success ? "true" : void 0,
|
|
951
|
+
style: __spreadValues({
|
|
952
|
+
width: "100%",
|
|
953
|
+
height: "2.25rem",
|
|
954
|
+
paddingTop: 0,
|
|
955
|
+
paddingBottom: 0,
|
|
956
|
+
paddingLeft: leftIcon ? "2.25rem" : "0.75rem",
|
|
957
|
+
paddingRight: rightIcon ? "2.25rem" : "0.75rem",
|
|
958
|
+
border: `1px solid ${error ? "var(--ds-danger, #ef4444)" : success ? "var(--ds-success, #22c55e)" : "var(--ds-border, #e2e8f0)"}`,
|
|
959
|
+
borderRadius: "0.375rem",
|
|
960
|
+
fontSize: "0.875rem",
|
|
961
|
+
backgroundColor: "var(--ds-card, #fff)",
|
|
962
|
+
color: "var(--ds-text-primary, #0f172a)",
|
|
963
|
+
fontFamily: "inherit",
|
|
964
|
+
transition: "border-color 0.15s, box-shadow 0.15s"
|
|
965
|
+
}, style)
|
|
966
|
+
}, props)
|
|
967
|
+
),
|
|
968
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: {
|
|
969
|
+
position: "absolute",
|
|
970
|
+
right: "0.625rem",
|
|
971
|
+
display: "flex",
|
|
972
|
+
alignItems: "center",
|
|
973
|
+
color: "var(--ds-text-secondary, #64748b)",
|
|
974
|
+
pointerEvents: "none"
|
|
975
|
+
}, children: rightIcon })
|
|
976
|
+
] })
|
|
977
|
+
] });
|
|
978
|
+
};
|
|
979
|
+
var Input_default = Input;
|
|
980
|
+
|
|
981
|
+
// src/components/Label/Label.tsx
|
|
982
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
983
|
+
var Label = (_a) => {
|
|
984
|
+
var _b = _a, { children, required, style } = _b, props = __objRest(_b, ["children", "required", "style"]);
|
|
985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", __spreadProps(__spreadValues({ style: __spreadValues({
|
|
986
|
+
display: "block",
|
|
987
|
+
fontSize: "0.875rem",
|
|
988
|
+
fontWeight: 500,
|
|
989
|
+
color: "var(--ds-text-primary, #0f172a)",
|
|
990
|
+
marginBottom: "0.375rem"
|
|
991
|
+
}, style) }, props), { children: [
|
|
992
|
+
children,
|
|
993
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { color: "var(--ds-danger, #ef4444)", marginLeft: "0.25rem" }, children: "*" })
|
|
994
|
+
] }));
|
|
995
|
+
};
|
|
996
|
+
var Label_default = Label;
|
|
997
|
+
|
|
998
|
+
// src/components/PasswordInput/PasswordInput.tsx
|
|
999
|
+
var import_lucide_react7 = require("lucide-react");
|
|
1000
|
+
var import_react12 = require("react");
|
|
1001
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1002
|
+
var PasswordInput = (props) => {
|
|
1003
|
+
const [visible, setVisible] = (0, import_react12.useState)(false);
|
|
1004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1005
|
+
Input_default,
|
|
1006
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1007
|
+
type: visible ? "text" : "password",
|
|
1008
|
+
rightIcon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1009
|
+
"button",
|
|
1010
|
+
{
|
|
1011
|
+
type: "button",
|
|
1012
|
+
onClick: () => setVisible((v) => !v),
|
|
1013
|
+
style: { background: "none", border: "none", cursor: "pointer", padding: 0, display: "flex", pointerEvents: "all" },
|
|
1014
|
+
tabIndex: -1,
|
|
1015
|
+
children: visible ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react7.EyeOff, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react7.Eye, { size: 16 })
|
|
1016
|
+
}
|
|
1017
|
+
)
|
|
1018
|
+
})
|
|
1019
|
+
);
|
|
1020
|
+
};
|
|
1021
|
+
var PasswordInput_default = PasswordInput;
|
|
1022
|
+
|
|
1023
|
+
// src/components/Progress/Progress.tsx
|
|
1024
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1025
|
+
var Progress = ({ value = 0 }) => {
|
|
1026
|
+
const pct = Math.min(100, Math.max(0, value));
|
|
1027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1028
|
+
"div",
|
|
1029
|
+
{
|
|
1030
|
+
role: "progressbar",
|
|
1031
|
+
"aria-valuenow": pct,
|
|
1032
|
+
"aria-valuemin": 0,
|
|
1033
|
+
"aria-valuemax": 100,
|
|
1034
|
+
style: {
|
|
1035
|
+
width: "100%",
|
|
1036
|
+
height: "0.5rem",
|
|
1037
|
+
backgroundColor: "var(--ds-border, #e2e8f0)",
|
|
1038
|
+
borderRadius: "9999px",
|
|
1039
|
+
overflow: "hidden"
|
|
1040
|
+
},
|
|
1041
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: {
|
|
1042
|
+
height: "100%",
|
|
1043
|
+
width: `${pct}%`,
|
|
1044
|
+
backgroundColor: "var(--ds-primary, #3b82f6)",
|
|
1045
|
+
borderRadius: "9999px",
|
|
1046
|
+
transition: "width 0.3s ease"
|
|
1047
|
+
} })
|
|
1048
|
+
}
|
|
1049
|
+
);
|
|
1050
|
+
};
|
|
1051
|
+
var Progress_default = Progress;
|
|
1052
|
+
|
|
1053
|
+
// src/components/RadioGroup/RadioGroup.tsx
|
|
1054
|
+
var import_react13 = require("react");
|
|
1055
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1056
|
+
var RadioGroup = ({
|
|
1057
|
+
options,
|
|
1058
|
+
name,
|
|
1059
|
+
value,
|
|
1060
|
+
defaultValue = "",
|
|
1061
|
+
disabled,
|
|
1062
|
+
onChange
|
|
1063
|
+
}) => {
|
|
1064
|
+
const [internal, setInternal] = (0, import_react13.useState)(defaultValue);
|
|
1065
|
+
const selected = value !== void 0 ? value : internal;
|
|
1066
|
+
const handleChange = (val) => {
|
|
1067
|
+
if (disabled) return;
|
|
1068
|
+
setInternal(val);
|
|
1069
|
+
onChange == null ? void 0 : onChange(val);
|
|
1070
|
+
};
|
|
1071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: options.map((option) => {
|
|
1072
|
+
const isSelected = selected === option.value;
|
|
1073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { style: {
|
|
1074
|
+
display: "inline-flex",
|
|
1075
|
+
alignItems: "center",
|
|
1076
|
+
gap: "0.5rem",
|
|
1077
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
1078
|
+
userSelect: "none",
|
|
1079
|
+
opacity: disabled ? 0.5 : 1
|
|
1080
|
+
}, children: [
|
|
1081
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1082
|
+
"input",
|
|
1083
|
+
{
|
|
1084
|
+
type: "radio",
|
|
1085
|
+
name,
|
|
1086
|
+
value: option.value,
|
|
1087
|
+
checked: isSelected,
|
|
1088
|
+
disabled,
|
|
1089
|
+
onChange: () => handleChange(option.value),
|
|
1090
|
+
style: { position: "absolute", opacity: 0, width: 0, height: 0 }
|
|
1091
|
+
}
|
|
1092
|
+
),
|
|
1093
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: {
|
|
1094
|
+
width: "1.125rem",
|
|
1095
|
+
height: "1.125rem",
|
|
1096
|
+
borderRadius: "9999px",
|
|
1097
|
+
border: `2px solid ${isSelected ? "var(--ds-primary, #3b82f6)" : "var(--ds-border, #e2e8f0)"}`,
|
|
1098
|
+
display: "flex",
|
|
1099
|
+
alignItems: "center",
|
|
1100
|
+
justifyContent: "center",
|
|
1101
|
+
flexShrink: 0,
|
|
1102
|
+
backgroundColor: "var(--ds-card, #fff)",
|
|
1103
|
+
transition: "border-color 0.15s"
|
|
1104
|
+
}, children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: {
|
|
1105
|
+
width: "0.5rem",
|
|
1106
|
+
height: "0.5rem",
|
|
1107
|
+
borderRadius: "9999px",
|
|
1108
|
+
backgroundColor: "var(--ds-primary, #3b82f6)"
|
|
1109
|
+
} }) }),
|
|
1110
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { fontSize: "0.875rem", color: "var(--ds-text-primary, #0f172a)" }, children: option.label })
|
|
1111
|
+
] }, option.value);
|
|
1112
|
+
}) });
|
|
1113
|
+
};
|
|
1114
|
+
var RadioGroup_default = RadioGroup;
|
|
1115
|
+
|
|
1116
|
+
// src/components/Select/Select.tsx
|
|
1117
|
+
var import_lucide_react8 = require("lucide-react");
|
|
1118
|
+
var import_react14 = require("react");
|
|
1119
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1120
|
+
var selectCSS = `
|
|
1121
|
+
[data-ds-select-trigger]:focus { outline: none; border-color: var(--ds-primary, #3b82f6); box-shadow: 0 0 0 3px rgb(59 130 246 / 0.15); }
|
|
1122
|
+
`;
|
|
1123
|
+
var Select = ({
|
|
1124
|
+
options,
|
|
1125
|
+
value,
|
|
1126
|
+
defaultValue = "",
|
|
1127
|
+
placeholder = "Choose an option",
|
|
1128
|
+
disabled,
|
|
1129
|
+
onChange
|
|
1130
|
+
}) => {
|
|
1131
|
+
var _a;
|
|
1132
|
+
const [internal, setInternal] = (0, import_react14.useState)(defaultValue);
|
|
1133
|
+
const [open, setOpen] = (0, import_react14.useState)(false);
|
|
1134
|
+
const [hoveredOption, setHoveredOption] = (0, import_react14.useState)(null);
|
|
1135
|
+
const ref = (0, import_react14.useRef)(null);
|
|
1136
|
+
const selected = value !== void 0 ? value : internal;
|
|
1137
|
+
const selectedLabel = (_a = options.find((o) => o.value === selected)) == null ? void 0 : _a.label;
|
|
1138
|
+
const handleSelect = (val) => {
|
|
1139
|
+
setInternal(val);
|
|
1140
|
+
setOpen(false);
|
|
1141
|
+
onChange == null ? void 0 : onChange(val);
|
|
1142
|
+
};
|
|
1143
|
+
(0, import_react14.useEffect)(() => {
|
|
1144
|
+
const handleOutside = (e) => {
|
|
1145
|
+
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
1146
|
+
};
|
|
1147
|
+
document.addEventListener("mousedown", handleOutside);
|
|
1148
|
+
return () => document.removeEventListener("mousedown", handleOutside);
|
|
1149
|
+
}, []);
|
|
1150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
1151
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("style", { href: "ds-select", precedence: "low", children: selectCSS }),
|
|
1152
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { ref, style: {
|
|
1153
|
+
position: "relative",
|
|
1154
|
+
width: "100%",
|
|
1155
|
+
opacity: disabled ? 0.5 : 1,
|
|
1156
|
+
pointerEvents: disabled ? "none" : void 0
|
|
1157
|
+
}, children: [
|
|
1158
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1159
|
+
"button",
|
|
1160
|
+
{
|
|
1161
|
+
type: "button",
|
|
1162
|
+
"data-ds-select-trigger": "",
|
|
1163
|
+
onClick: () => !disabled && setOpen((o) => !o),
|
|
1164
|
+
disabled,
|
|
1165
|
+
style: {
|
|
1166
|
+
width: "100%",
|
|
1167
|
+
height: "2.25rem",
|
|
1168
|
+
padding: "0 0.75rem",
|
|
1169
|
+
border: `1px solid ${open ? "var(--ds-primary, #3b82f6)" : "var(--ds-border, #e2e8f0)"}`,
|
|
1170
|
+
borderRadius: "0.375rem",
|
|
1171
|
+
fontSize: "0.875rem",
|
|
1172
|
+
backgroundColor: "var(--ds-card, #fff)",
|
|
1173
|
+
cursor: "pointer",
|
|
1174
|
+
display: "flex",
|
|
1175
|
+
alignItems: "center",
|
|
1176
|
+
justifyContent: "space-between",
|
|
1177
|
+
gap: "0.5rem",
|
|
1178
|
+
boxShadow: open ? "0 0 0 3px rgb(59 130 246 / 0.15)" : "none",
|
|
1179
|
+
transition: "border-color 0.15s, box-shadow 0.15s",
|
|
1180
|
+
textAlign: "left",
|
|
1181
|
+
fontFamily: "inherit"
|
|
1182
|
+
},
|
|
1183
|
+
children: [
|
|
1184
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { color: selectedLabel ? "var(--ds-text-primary, #0f172a)" : "var(--ds-text-secondary, #64748b)" }, children: selectedLabel != null ? selectedLabel : placeholder }),
|
|
1185
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1186
|
+
import_lucide_react8.ChevronDown,
|
|
1187
|
+
{
|
|
1188
|
+
size: 16,
|
|
1189
|
+
style: {
|
|
1190
|
+
flexShrink: 0,
|
|
1191
|
+
color: "var(--ds-text-secondary, #64748b)",
|
|
1192
|
+
transition: "transform 0.15s",
|
|
1193
|
+
transform: open ? "rotate(180deg)" : "rotate(0deg)"
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
)
|
|
1197
|
+
]
|
|
1198
|
+
}
|
|
1199
|
+
),
|
|
1200
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: {
|
|
1201
|
+
position: "absolute",
|
|
1202
|
+
top: "calc(100% + 0.25rem)",
|
|
1203
|
+
left: 0,
|
|
1204
|
+
right: 0,
|
|
1205
|
+
zIndex: 50,
|
|
1206
|
+
backgroundColor: "var(--ds-card, #fff)",
|
|
1207
|
+
border: "1px solid var(--ds-border, #e2e8f0)",
|
|
1208
|
+
borderRadius: "0.375rem",
|
|
1209
|
+
boxShadow: "0 10px 15px -3px rgb(0 0 0 / 0.1)",
|
|
1210
|
+
overflow: "hidden"
|
|
1211
|
+
}, children: options.map((option) => {
|
|
1212
|
+
const isSelected = selected === option.value;
|
|
1213
|
+
const isHovered = hoveredOption === option.value;
|
|
1214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1215
|
+
"div",
|
|
1216
|
+
{
|
|
1217
|
+
onClick: () => handleSelect(option.value),
|
|
1218
|
+
onMouseEnter: () => setHoveredOption(option.value),
|
|
1219
|
+
onMouseLeave: () => setHoveredOption(null),
|
|
1220
|
+
style: {
|
|
1221
|
+
padding: "0.5rem 0.75rem",
|
|
1222
|
+
fontSize: "0.875rem",
|
|
1223
|
+
cursor: "pointer",
|
|
1224
|
+
display: "flex",
|
|
1225
|
+
alignItems: "center",
|
|
1226
|
+
gap: "0.5rem",
|
|
1227
|
+
color: "var(--ds-text-primary, #0f172a)",
|
|
1228
|
+
backgroundColor: isSelected || isHovered ? "var(--ds-muted, #f1f5f9)" : "transparent",
|
|
1229
|
+
fontWeight: isSelected ? 500 : void 0,
|
|
1230
|
+
transition: "background-color 0.1s"
|
|
1231
|
+
},
|
|
1232
|
+
children: [
|
|
1233
|
+
isSelected ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.Check, { size: 14, style: { color: "var(--ds-primary, #3b82f6)", flexShrink: 0 } }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { width: 14, flexShrink: 0 } }),
|
|
1234
|
+
option.label
|
|
1235
|
+
]
|
|
1236
|
+
},
|
|
1237
|
+
option.value
|
|
1238
|
+
);
|
|
1239
|
+
}) })
|
|
1240
|
+
] })
|
|
1241
|
+
] });
|
|
1242
|
+
};
|
|
1243
|
+
var Select_default = Select;
|
|
1244
|
+
|
|
1245
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
1246
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1247
|
+
var Skeleton = ({ height = "1rem", width = "100%", circle = false }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("style", { href: "ds-skeleton", precedence: "low", children: `
|
|
1249
|
+
@keyframes ds-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
|
|
1250
|
+
[data-ds-skeleton] { animation: ds-pulse 1.5s ease-in-out infinite; }
|
|
1251
|
+
` }),
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1253
|
+
"div",
|
|
1254
|
+
{
|
|
1255
|
+
"data-ds-skeleton": "",
|
|
1256
|
+
"aria-hidden": "true",
|
|
1257
|
+
style: {
|
|
1258
|
+
height,
|
|
1259
|
+
width,
|
|
1260
|
+
backgroundColor: "var(--ds-muted, #f1f5f9)",
|
|
1261
|
+
borderRadius: circle ? "9999px" : "0.375rem"
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
)
|
|
1265
|
+
] });
|
|
1266
|
+
var Skeleton_default = Skeleton;
|
|
1267
|
+
|
|
1268
|
+
// src/components/Slider/Slider.tsx
|
|
1269
|
+
var import_react15 = require("react");
|
|
1270
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1271
|
+
var sliderCSS = `
|
|
1272
|
+
[data-ds-slider] {
|
|
1273
|
+
-webkit-appearance: none;
|
|
1274
|
+
appearance: none;
|
|
1275
|
+
width: 100%;
|
|
1276
|
+
height: 0.375rem;
|
|
1277
|
+
border-radius: 9999px;
|
|
1278
|
+
outline: none;
|
|
1279
|
+
cursor: pointer;
|
|
1280
|
+
background: linear-gradient(
|
|
1281
|
+
to right,
|
|
1282
|
+
var(--ds-primary, #3b82f6) 0%,
|
|
1283
|
+
var(--ds-primary, #3b82f6) var(--fill, 50%),
|
|
1284
|
+
var(--ds-border, #e2e8f0) var(--fill, 50%),
|
|
1285
|
+
var(--ds-border, #e2e8f0) 100%
|
|
1286
|
+
);
|
|
1287
|
+
}
|
|
1288
|
+
[data-ds-slider]::-webkit-slider-thumb {
|
|
1289
|
+
-webkit-appearance: none;
|
|
1290
|
+
appearance: none;
|
|
1291
|
+
width: 1.125rem;
|
|
1292
|
+
height: 1.125rem;
|
|
1293
|
+
border-radius: 9999px;
|
|
1294
|
+
background-color: var(--ds-primary, #3b82f6);
|
|
1295
|
+
cursor: pointer;
|
|
1296
|
+
border: 2px solid #fff;
|
|
1297
|
+
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.2);
|
|
1298
|
+
transition: transform 0.1s;
|
|
1299
|
+
}
|
|
1300
|
+
[data-ds-slider]::-webkit-slider-thumb:hover { transform: scale(1.2); }
|
|
1301
|
+
[data-ds-slider]::-moz-range-thumb {
|
|
1302
|
+
width: 1.125rem;
|
|
1303
|
+
height: 1.125rem;
|
|
1304
|
+
border-radius: 9999px;
|
|
1305
|
+
background-color: var(--ds-primary, #3b82f6);
|
|
1306
|
+
cursor: pointer;
|
|
1307
|
+
border: 2px solid #fff;
|
|
1308
|
+
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.2);
|
|
1309
|
+
}
|
|
1310
|
+
[data-ds-slider]:disabled { cursor: not-allowed; }
|
|
1311
|
+
`;
|
|
1312
|
+
var Slider = ({
|
|
1313
|
+
value,
|
|
1314
|
+
defaultValue = 50,
|
|
1315
|
+
min = 0,
|
|
1316
|
+
max = 100,
|
|
1317
|
+
step = 1,
|
|
1318
|
+
disabled,
|
|
1319
|
+
onChange
|
|
1320
|
+
}) => {
|
|
1321
|
+
const [internal, setInternal] = (0, import_react15.useState)(defaultValue);
|
|
1322
|
+
const current = value !== void 0 ? value : internal;
|
|
1323
|
+
const fill = `${(current - min) / (max - min) * 100}%`;
|
|
1324
|
+
const handleChange = (e) => {
|
|
1325
|
+
const val = Number(e.target.value);
|
|
1326
|
+
setInternal(val);
|
|
1327
|
+
onChange == null ? void 0 : onChange(val);
|
|
1328
|
+
};
|
|
1329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1330
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { href: "ds-slider", precedence: "low", children: sliderCSS }),
|
|
1331
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: {
|
|
1332
|
+
width: "100%",
|
|
1333
|
+
padding: "0.25rem 0",
|
|
1334
|
+
opacity: disabled ? 0.5 : 1
|
|
1335
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1336
|
+
"input",
|
|
1337
|
+
{
|
|
1338
|
+
type: "range",
|
|
1339
|
+
"data-ds-slider": "",
|
|
1340
|
+
min,
|
|
1341
|
+
max,
|
|
1342
|
+
step,
|
|
1343
|
+
value: current,
|
|
1344
|
+
disabled,
|
|
1345
|
+
onChange: handleChange,
|
|
1346
|
+
style: { "--fill": fill }
|
|
1347
|
+
}
|
|
1348
|
+
) })
|
|
1349
|
+
] });
|
|
1350
|
+
};
|
|
1351
|
+
var Slider_default = Slider;
|
|
1352
|
+
|
|
1353
|
+
// src/components/Spinner/Spinner.tsx
|
|
1354
|
+
var import_lucide_react9 = require("lucide-react");
|
|
1355
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1356
|
+
var sizePx = { sm: 16, md: 24, lg: 32 };
|
|
1357
|
+
var Spinner = ({ size = "md" }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1358
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { href: "ds-spin", precedence: "low", children: `@keyframes ds-spin { to { transform: rotate(360deg); } }` }),
|
|
1359
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1360
|
+
import_lucide_react9.Loader2,
|
|
1361
|
+
{
|
|
1362
|
+
size: sizePx[size],
|
|
1363
|
+
"aria-label": "Loading",
|
|
1364
|
+
style: { color: "var(--ds-primary, #3b82f6)", animation: "ds-spin 0.75s linear infinite" }
|
|
1365
|
+
}
|
|
1366
|
+
)
|
|
1367
|
+
] });
|
|
1368
|
+
var Spinner_default = Spinner;
|
|
1369
|
+
|
|
1370
|
+
// src/components/Switch/Switch.tsx
|
|
1371
|
+
var import_react16 = require("react");
|
|
1372
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1373
|
+
var Switch = ({
|
|
1374
|
+
label,
|
|
1375
|
+
checked,
|
|
1376
|
+
defaultChecked = false,
|
|
1377
|
+
disabled,
|
|
1378
|
+
id,
|
|
1379
|
+
onChange
|
|
1380
|
+
}) => {
|
|
1381
|
+
const [internal, setInternal] = (0, import_react16.useState)(defaultChecked);
|
|
1382
|
+
const isOn = checked !== void 0 ? checked : internal;
|
|
1383
|
+
const handleToggle = () => {
|
|
1384
|
+
if (disabled) return;
|
|
1385
|
+
const next = !isOn;
|
|
1386
|
+
setInternal(next);
|
|
1387
|
+
onChange == null ? void 0 : onChange(next);
|
|
1388
|
+
};
|
|
1389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { htmlFor: id, style: {
|
|
1390
|
+
display: "inline-flex",
|
|
1391
|
+
alignItems: "center",
|
|
1392
|
+
gap: "0.625rem",
|
|
1393
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
1394
|
+
userSelect: "none",
|
|
1395
|
+
opacity: disabled ? 0.5 : 1
|
|
1396
|
+
}, children: [
|
|
1397
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1398
|
+
"input",
|
|
1399
|
+
{
|
|
1400
|
+
type: "checkbox",
|
|
1401
|
+
id,
|
|
1402
|
+
checked: isOn,
|
|
1403
|
+
disabled,
|
|
1404
|
+
onChange: handleToggle,
|
|
1405
|
+
style: { position: "absolute", opacity: 0, width: 0, height: 0 }
|
|
1406
|
+
}
|
|
1407
|
+
),
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: {
|
|
1409
|
+
width: "2.75rem",
|
|
1410
|
+
height: "1.5rem",
|
|
1411
|
+
borderRadius: "9999px",
|
|
1412
|
+
backgroundColor: isOn ? "var(--ds-primary, #3b82f6)" : "var(--ds-border, #e2e8f0)",
|
|
1413
|
+
position: "relative",
|
|
1414
|
+
transition: "background-color 0.2s",
|
|
1415
|
+
flexShrink: 0
|
|
1416
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: {
|
|
1417
|
+
position: "absolute",
|
|
1418
|
+
top: "0.175rem",
|
|
1419
|
+
left: "0.175rem",
|
|
1420
|
+
width: "1.15rem",
|
|
1421
|
+
height: "1.15rem",
|
|
1422
|
+
borderRadius: "9999px",
|
|
1423
|
+
backgroundColor: "#fff",
|
|
1424
|
+
boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.15)",
|
|
1425
|
+
transition: "transform 0.2s",
|
|
1426
|
+
transform: isOn ? "translateX(1.25rem)" : "translateX(0)"
|
|
1427
|
+
} }) }),
|
|
1428
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { style: { fontSize: "0.875rem", color: "var(--ds-text-primary, #0f172a)" }, children: label })
|
|
1429
|
+
] });
|
|
1430
|
+
};
|
|
1431
|
+
var Switch_default = Switch;
|
|
1432
|
+
|
|
1433
|
+
// src/components/Table/Table.tsx
|
|
1434
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1435
|
+
var tableCSS = `
|
|
1436
|
+
[data-ds-table-row]:hover [data-ds-table-cell] { background-color: var(--ds-muted, #f1f5f9); }
|
|
1437
|
+
`;
|
|
1438
|
+
var Table = (_a) => {
|
|
1439
|
+
var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
|
|
1440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("style", { href: "ds-table", precedence: "low", children: tableCSS }),
|
|
1442
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: {
|
|
1443
|
+
width: "100%",
|
|
1444
|
+
overflowX: "auto",
|
|
1445
|
+
border: "1px solid var(--ds-border, #e2e8f0)",
|
|
1446
|
+
borderRadius: "0.5rem"
|
|
1447
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("table", __spreadValues({ style: __spreadValues({
|
|
1448
|
+
width: "100%",
|
|
1449
|
+
borderCollapse: "collapse",
|
|
1450
|
+
fontSize: "0.875rem"
|
|
1451
|
+
}, style) }, props)) })
|
|
1452
|
+
] });
|
|
1453
|
+
};
|
|
1454
|
+
var TableHead = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("thead", __spreadValues({}, props));
|
|
1455
|
+
var TableBody = (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("tbody", __spreadValues({}, props));
|
|
1456
|
+
var TableRow = (_a) => {
|
|
1457
|
+
var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
|
|
1458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("tr", __spreadValues({ "data-ds-table-row": "", style }, props));
|
|
1459
|
+
};
|
|
1460
|
+
var TableHeader = (_a) => {
|
|
1461
|
+
var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
|
|
1462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("th", __spreadValues({ style: __spreadValues({
|
|
1463
|
+
padding: "0.75rem 1rem",
|
|
1464
|
+
textAlign: "left",
|
|
1465
|
+
fontWeight: 500,
|
|
1466
|
+
color: "var(--ds-text-secondary, #64748b)",
|
|
1467
|
+
backgroundColor: "var(--ds-muted, #f1f5f9)",
|
|
1468
|
+
borderBottom: "1px solid var(--ds-border, #e2e8f0)",
|
|
1469
|
+
whiteSpace: "nowrap"
|
|
1470
|
+
}, style) }, props));
|
|
1471
|
+
};
|
|
1472
|
+
var TableCell = (_a) => {
|
|
1473
|
+
var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
|
|
1474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1475
|
+
"td",
|
|
1476
|
+
__spreadValues({
|
|
1477
|
+
"data-ds-table-cell": "",
|
|
1478
|
+
style: __spreadValues({
|
|
1479
|
+
padding: "0.75rem 1rem",
|
|
1480
|
+
borderBottom: "1px solid var(--ds-border, #e2e8f0)",
|
|
1481
|
+
color: "var(--ds-text-primary, #0f172a)",
|
|
1482
|
+
transition: "background-color 0.1s"
|
|
1483
|
+
}, style)
|
|
1484
|
+
}, props)
|
|
1485
|
+
);
|
|
1486
|
+
};
|
|
1487
|
+
|
|
1488
|
+
// src/components/Tabs/Tabs.tsx
|
|
1489
|
+
var import_react17 = require("react");
|
|
1490
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1491
|
+
var Tabs = ({ tabs, defaultValue }) => {
|
|
1492
|
+
var _a, _b;
|
|
1493
|
+
const [active, setActive] = (0, import_react17.useState)((_b = defaultValue != null ? defaultValue : (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : "");
|
|
1494
|
+
const [hovered, setHovered] = (0, import_react17.useState)(null);
|
|
1495
|
+
const activeTab = tabs.find((t) => t.value === active);
|
|
1496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
1497
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { role: "tablist", style: {
|
|
1498
|
+
display: "inline-flex",
|
|
1499
|
+
backgroundColor: "var(--ds-muted, #f1f5f9)",
|
|
1500
|
+
borderRadius: "0.5rem",
|
|
1501
|
+
padding: "0.25rem",
|
|
1502
|
+
gap: "0.125rem"
|
|
1503
|
+
}, children: tabs.map((tab) => {
|
|
1504
|
+
const isActive = active === tab.value;
|
|
1505
|
+
const isHovered = hovered === tab.value;
|
|
1506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
1507
|
+
"button",
|
|
1508
|
+
{
|
|
1509
|
+
role: "tab",
|
|
1510
|
+
"aria-selected": isActive,
|
|
1511
|
+
onClick: () => setActive(tab.value),
|
|
1512
|
+
onMouseEnter: () => setHovered(tab.value),
|
|
1513
|
+
onMouseLeave: () => setHovered(null),
|
|
1514
|
+
style: {
|
|
1515
|
+
display: "inline-flex",
|
|
1516
|
+
alignItems: "center",
|
|
1517
|
+
gap: "0.375rem",
|
|
1518
|
+
padding: "0.375rem 0.75rem",
|
|
1519
|
+
fontSize: "0.875rem",
|
|
1520
|
+
fontWeight: 500,
|
|
1521
|
+
borderRadius: "0.375rem",
|
|
1522
|
+
background: isActive ? "var(--ds-card, #ffffff)" : "transparent",
|
|
1523
|
+
border: "none",
|
|
1524
|
+
cursor: "pointer",
|
|
1525
|
+
color: isActive || isHovered ? "var(--ds-text-primary, #0f172a)" : "var(--ds-text-secondary, #64748b)",
|
|
1526
|
+
boxShadow: isActive ? "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)" : "none",
|
|
1527
|
+
transition: "color 0.15s, background-color 0.15s, box-shadow 0.15s",
|
|
1528
|
+
whiteSpace: "nowrap"
|
|
1529
|
+
},
|
|
1530
|
+
children: [
|
|
1531
|
+
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { style: { display: "flex", alignItems: "center" }, children: tab.icon }),
|
|
1532
|
+
tab.label
|
|
1533
|
+
]
|
|
1534
|
+
},
|
|
1535
|
+
tab.value
|
|
1536
|
+
);
|
|
1537
|
+
}) }),
|
|
1538
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { role: "tabpanel", style: {
|
|
1539
|
+
paddingTop: "1rem",
|
|
1540
|
+
fontSize: "0.875rem",
|
|
1541
|
+
color: "var(--ds-text-secondary, #64748b)"
|
|
1542
|
+
}, children: activeTab == null ? void 0 : activeTab.content })
|
|
1543
|
+
] });
|
|
1544
|
+
};
|
|
1545
|
+
var Tabs_default = Tabs;
|
|
1546
|
+
|
|
1547
|
+
// src/components/Textarea/Textarea.tsx
|
|
1548
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1549
|
+
var textareaCSS = `
|
|
1550
|
+
[data-ds-textarea]::placeholder { color: var(--ds-text-secondary, #64748b); }
|
|
1551
|
+
[data-ds-textarea]:focus { outline: none; border-color: var(--ds-primary, #3b82f6); box-shadow: 0 0 0 3px rgb(59 130 246 / 0.15); }
|
|
1552
|
+
[data-ds-textarea]:disabled { opacity: 0.5; cursor: not-allowed; background-color: var(--ds-muted, #f1f5f9); }
|
|
1553
|
+
[data-ds-textarea][data-error="true"] { border-color: var(--ds-danger, #ef4444); }
|
|
1554
|
+
[data-ds-textarea][data-error="true"]:focus { border-color: var(--ds-danger, #ef4444); box-shadow: 0 0 0 3px rgb(239 68 68 / 0.15); }
|
|
1555
|
+
`;
|
|
1556
|
+
var Textarea = (_a) => {
|
|
1557
|
+
var _b = _a, { error, style } = _b, props = __objRest(_b, ["error", "style"]);
|
|
1558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
1559
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("style", { href: "ds-textarea", precedence: "low", children: textareaCSS }),
|
|
1560
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1561
|
+
"textarea",
|
|
1562
|
+
__spreadValues({
|
|
1563
|
+
"data-ds-textarea": "",
|
|
1564
|
+
"data-error": error ? "true" : void 0,
|
|
1565
|
+
style: __spreadValues({
|
|
1566
|
+
width: "100%",
|
|
1567
|
+
padding: "0.5rem 0.75rem",
|
|
1568
|
+
border: `1px solid ${error ? "var(--ds-danger, #ef4444)" : "var(--ds-border, #e2e8f0)"}`,
|
|
1569
|
+
borderRadius: "0.375rem",
|
|
1570
|
+
fontSize: "0.875rem",
|
|
1571
|
+
backgroundColor: "var(--ds-card, #fff)",
|
|
1572
|
+
color: "var(--ds-text-primary, #0f172a)",
|
|
1573
|
+
fontFamily: "inherit",
|
|
1574
|
+
resize: "vertical",
|
|
1575
|
+
transition: "border-color 0.15s, box-shadow 0.15s",
|
|
1576
|
+
minHeight: "6rem",
|
|
1577
|
+
boxSizing: "border-box"
|
|
1578
|
+
}, style)
|
|
1579
|
+
}, props)
|
|
1580
|
+
)
|
|
1581
|
+
] });
|
|
1582
|
+
};
|
|
1583
|
+
var Textarea_default = Textarea;
|
|
1584
|
+
|
|
1585
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
1586
|
+
var import_react18 = require("react");
|
|
1587
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1588
|
+
var positionStyle = {
|
|
1589
|
+
top: { bottom: "calc(100% + 8px)", left: "50%", transform: "translateX(-50%)" },
|
|
1590
|
+
bottom: { top: "calc(100% + 8px)", left: "50%", transform: "translateX(-50%)" },
|
|
1591
|
+
left: { right: "calc(100% + 8px)", top: "50%", transform: "translateY(-50%)" },
|
|
1592
|
+
right: { left: "calc(100% + 8px)", top: "50%", transform: "translateY(-50%)" }
|
|
1593
|
+
};
|
|
1594
|
+
var tooltipCSS = `
|
|
1595
|
+
[data-ds-tt]::before {
|
|
1596
|
+
content: '';
|
|
1597
|
+
position: absolute;
|
|
1598
|
+
border: 5px solid transparent;
|
|
1599
|
+
}
|
|
1600
|
+
[data-ds-tt="top"]::before { top: 100%; left: 50%; transform: translateX(-50%); border-top-color: var(--ds-tooltip-bg, #0f172a); }
|
|
1601
|
+
[data-ds-tt="bottom"]::before { bottom: 100%; left: 50%; transform: translateX(-50%); border-bottom-color: var(--ds-tooltip-bg, #0f172a); }
|
|
1602
|
+
[data-ds-tt="left"]::before { left: 100%; top: 50%; transform: translateY(-50%); border-left-color: var(--ds-tooltip-bg, #0f172a); }
|
|
1603
|
+
[data-ds-tt="right"]::before { right: 100%; top: 50%; transform: translateY(-50%); border-right-color: var(--ds-tooltip-bg, #0f172a); }
|
|
1604
|
+
`;
|
|
1605
|
+
var Tooltip5 = ({ content, children, position = "top" }) => {
|
|
1606
|
+
const [visible, setVisible] = (0, import_react18.useState)(false);
|
|
1607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
1608
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("style", { href: "ds-tooltip", precedence: "low", children: tooltipCSS }),
|
|
1609
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
1610
|
+
"span",
|
|
1611
|
+
{
|
|
1612
|
+
style: { position: "relative", display: "inline-flex" },
|
|
1613
|
+
onMouseEnter: () => setVisible(true),
|
|
1614
|
+
onMouseLeave: () => setVisible(false),
|
|
1615
|
+
onFocus: () => setVisible(true),
|
|
1616
|
+
onBlur: () => setVisible(false),
|
|
1617
|
+
children: [
|
|
1618
|
+
children,
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1620
|
+
"span",
|
|
1621
|
+
{
|
|
1622
|
+
role: "tooltip",
|
|
1623
|
+
"data-ds-tt": position,
|
|
1624
|
+
style: __spreadValues({
|
|
1625
|
+
position: "absolute",
|
|
1626
|
+
zIndex: 50,
|
|
1627
|
+
padding: "0.375rem 0.625rem",
|
|
1628
|
+
backgroundColor: "var(--ds-tooltip-bg, #0f172a)",
|
|
1629
|
+
color: "var(--ds-tooltip-text, #ffffff)",
|
|
1630
|
+
fontSize: "0.75rem",
|
|
1631
|
+
lineHeight: 1.4,
|
|
1632
|
+
borderRadius: "0.375rem",
|
|
1633
|
+
whiteSpace: "nowrap",
|
|
1634
|
+
pointerEvents: "none",
|
|
1635
|
+
opacity: visible ? 1 : 0,
|
|
1636
|
+
transition: "opacity 0.15s"
|
|
1637
|
+
}, positionStyle[position]),
|
|
1638
|
+
children: content
|
|
1639
|
+
}
|
|
1640
|
+
)
|
|
1641
|
+
]
|
|
1642
|
+
}
|
|
1643
|
+
)
|
|
1644
|
+
] });
|
|
1645
|
+
};
|
|
1646
|
+
var Tooltip_default = Tooltip5;
|
|
1647
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1648
|
+
0 && (module.exports = {
|
|
1649
|
+
Accordion,
|
|
1650
|
+
Alert,
|
|
1651
|
+
AreaChart,
|
|
1652
|
+
Avatar,
|
|
1653
|
+
Badge,
|
|
1654
|
+
BarChart,
|
|
1655
|
+
Breadcrumb,
|
|
1656
|
+
Button,
|
|
1657
|
+
Card,
|
|
1658
|
+
CardContent,
|
|
1659
|
+
CardDescription,
|
|
1660
|
+
CardFooter,
|
|
1661
|
+
CardHeader,
|
|
1662
|
+
CardTitle,
|
|
1663
|
+
Checkbox,
|
|
1664
|
+
CopyButton,
|
|
1665
|
+
FileUpload,
|
|
1666
|
+
Input,
|
|
1667
|
+
Label,
|
|
1668
|
+
LineChart,
|
|
1669
|
+
PasswordInput,
|
|
1670
|
+
PieChart,
|
|
1671
|
+
Progress,
|
|
1672
|
+
RadioGroup,
|
|
1673
|
+
Select,
|
|
1674
|
+
Skeleton,
|
|
1675
|
+
Slider,
|
|
1676
|
+
Spinner,
|
|
1677
|
+
Switch,
|
|
1678
|
+
Table,
|
|
1679
|
+
TableBody,
|
|
1680
|
+
TableCell,
|
|
1681
|
+
TableHead,
|
|
1682
|
+
TableHeader,
|
|
1683
|
+
TableRow,
|
|
1684
|
+
Tabs,
|
|
1685
|
+
Textarea,
|
|
1686
|
+
ThemeProvider,
|
|
1687
|
+
Tooltip,
|
|
1688
|
+
useTheme
|
|
1689
|
+
});
|
|
1690
|
+
//# sourceMappingURL=index.cjs.map
|