@geomak/ui 5.1.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +694 -407
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +285 -28
- package/dist/index.d.ts +285 -28
- package/dist/index.js +691 -408
- package/dist/index.js.map +1 -1
- package/dist/styles.css +102 -48
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -15,6 +15,7 @@ var ContextMenuPrimitive = require('@radix-ui/react-context-menu');
|
|
|
15
15
|
var Popover = require('@radix-ui/react-popover');
|
|
16
16
|
var SwitchPrimitive = require('@radix-ui/react-switch');
|
|
17
17
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
18
|
+
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
|
18
19
|
|
|
19
20
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
21
|
|
|
@@ -47,6 +48,7 @@ var ContextMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(ContextMenu
|
|
|
47
48
|
var Popover__namespace = /*#__PURE__*/_interopNamespace(Popover);
|
|
48
49
|
var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
|
|
49
50
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
51
|
+
var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
|
|
50
52
|
|
|
51
53
|
var Moon = ({ color = "gray" }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: color, viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: color, className: "w-8 h-8", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z" }) });
|
|
52
54
|
var Sun = ({ color = "yellow" }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: color, viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: color, className: "w-8 h-8", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" }) });
|
|
@@ -2165,46 +2167,112 @@ function Wizard({
|
|
|
2165
2167
|
] }) })
|
|
2166
2168
|
] });
|
|
2167
2169
|
}
|
|
2168
|
-
var
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2170
|
+
var FIELD_SIZE = {
|
|
2171
|
+
sm: { control: "h-control-sm", text: "text-xs", padX: "px-2.5", gap: "gap-1.5" },
|
|
2172
|
+
md: { control: "h-control-md", text: "text-sm", padX: "px-3", gap: "gap-2" },
|
|
2173
|
+
lg: { control: "h-control-lg", text: "text-sm", padX: "px-3.5", gap: "gap-2.5" }
|
|
2174
|
+
};
|
|
2175
|
+
var FOCUS_WITHIN = "focus-within:outline-none focus-within:border-accent focus-within:ring-[3px] focus-within:ring-focus-ring";
|
|
2176
|
+
var FOCUS_VISIBLE = "focus-visible:outline-none focus-visible:border-accent focus-visible:ring-[3px] focus-visible:ring-focus-ring";
|
|
2177
|
+
var FOCUS_WITHIN_ERROR = "focus-within:border-status-error focus-within:ring-focus-ring-error";
|
|
2178
|
+
var FOCUS_VISIBLE_ERROR = "focus-visible:border-status-error focus-visible:ring-focus-ring-error";
|
|
2179
|
+
function fieldShell({
|
|
2180
|
+
size = "md",
|
|
2181
|
+
hasError = false,
|
|
2182
|
+
disabled = false,
|
|
2183
|
+
focusWithin = false,
|
|
2184
|
+
sized = true
|
|
2185
|
+
} = {}) {
|
|
2186
|
+
const s = FIELD_SIZE[size];
|
|
2187
|
+
return [
|
|
2188
|
+
"w-full rounded-lg border bg-surface text-foreground",
|
|
2189
|
+
"transition-[color,box-shadow,border-color] duration-150",
|
|
2190
|
+
s.text,
|
|
2191
|
+
sized ? `${s.control} ${s.padX}` : "",
|
|
2192
|
+
// resting border
|
|
2193
|
+
hasError ? "border-status-error" : "border-border",
|
|
2194
|
+
// hover (only when interactive + no error)
|
|
2195
|
+
disabled ? "bg-surface-raised text-foreground-muted cursor-not-allowed" : hasError ? "" : "hover:border-border-strong",
|
|
2196
|
+
// focus
|
|
2197
|
+
focusWithin ? FOCUS_WITHIN : FOCUS_VISIBLE,
|
|
2198
|
+
hasError ? focusWithin ? FOCUS_WITHIN_ERROR : FOCUS_VISIBLE_ERROR : "",
|
|
2199
|
+
// placeholder colour for native inputs
|
|
2200
|
+
"placeholder:text-foreground-muted"
|
|
2201
|
+
].filter(Boolean).join(" ");
|
|
2202
|
+
}
|
|
2203
|
+
function Field({
|
|
2172
2204
|
label,
|
|
2173
2205
|
htmlFor,
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2206
|
+
errorId,
|
|
2207
|
+
errorMessage,
|
|
2208
|
+
layout = "vertical",
|
|
2209
|
+
required,
|
|
2210
|
+
labelStyle,
|
|
2211
|
+
labelWidth,
|
|
2212
|
+
className = "",
|
|
2213
|
+
children
|
|
2214
|
+
}) {
|
|
2215
|
+
const hasError = errorMessage != null;
|
|
2216
|
+
const horizontal = layout === "horizontal";
|
|
2217
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2181
2218
|
"div",
|
|
2182
2219
|
{
|
|
2183
|
-
className:
|
|
2184
|
-
|
|
2220
|
+
className: [
|
|
2221
|
+
"flex",
|
|
2222
|
+
horizontal ? "flex-row items-start gap-3" : "flex-col gap-1.5",
|
|
2223
|
+
className
|
|
2224
|
+
].filter(Boolean).join(" "),
|
|
2185
2225
|
children: [
|
|
2186
|
-
label && /* @__PURE__ */ jsxRuntime.
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
{
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
)
|
|
2204
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5 text-foreground-muted", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M10.5 3.75a6.75 6.75 0 100 13.5 6.75 6.75 0 000-13.5zM2.25 10.5a8.25 8.25 0 1114.59 5.28l4.69 4.69a.75.75 0 11-1.06 1.06l-4.69-4.69A8.25 8.25 0 012.25 10.5z", clipRule: "evenodd" }) })
|
|
2226
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2227
|
+
"label",
|
|
2228
|
+
{
|
|
2229
|
+
htmlFor,
|
|
2230
|
+
style: { width: horizontal ? labelWidth : void 0, ...labelStyle },
|
|
2231
|
+
className: [
|
|
2232
|
+
"text-sm font-medium text-foreground select-none",
|
|
2233
|
+
horizontal ? "mt-2 flex-shrink-0" : ""
|
|
2234
|
+
].filter(Boolean).join(" "),
|
|
2235
|
+
children: [
|
|
2236
|
+
label,
|
|
2237
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-status-error ml-0.5", "aria-hidden": "true", children: "*" })
|
|
2238
|
+
]
|
|
2239
|
+
}
|
|
2240
|
+
),
|
|
2241
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
2242
|
+
children,
|
|
2243
|
+
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-status-error text-xs mt-1", children: errorMessage })
|
|
2205
2244
|
] })
|
|
2206
2245
|
]
|
|
2207
2246
|
}
|
|
2247
|
+
);
|
|
2248
|
+
}
|
|
2249
|
+
var SearchIcon = /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-4 h-4", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M10.5 3.75a6.75 6.75 0 100 13.5 6.75 6.75 0 000-13.5zM2.25 10.5a8.25 8.25 0 1114.59 5.28l4.69 4.69a.75.75 0 11-1.06 1.06l-4.69-4.69A8.25 8.25 0 012.25 10.5z", clipRule: "evenodd" }) });
|
|
2250
|
+
var SearchInput = React8__default.default.forwardRef(function SearchInput2({ value, onChange, disabled, label, htmlFor, placeholder, name, inputStyle, style, layout = "vertical", size = "md", icon }, ref) {
|
|
2251
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Field, { label, htmlFor, layout, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2252
|
+
"div",
|
|
2253
|
+
{
|
|
2254
|
+
className: `flex items-center ${fieldShell({ size, disabled, focusWithin: true })}`,
|
|
2255
|
+
style,
|
|
2256
|
+
children: [
|
|
2257
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 mr-2 text-foreground-muted", children: icon ?? SearchIcon }),
|
|
2258
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2259
|
+
"input",
|
|
2260
|
+
{
|
|
2261
|
+
ref,
|
|
2262
|
+
disabled,
|
|
2263
|
+
value,
|
|
2264
|
+
onChange,
|
|
2265
|
+
type: "search",
|
|
2266
|
+
enterKeyHint: "search",
|
|
2267
|
+
name,
|
|
2268
|
+
id: htmlFor,
|
|
2269
|
+
className: "min-w-0 flex-1 bg-transparent outline-none disabled:cursor-not-allowed placeholder:text-foreground-muted",
|
|
2270
|
+
style: inputStyle,
|
|
2271
|
+
placeholder: placeholder ?? ""
|
|
2272
|
+
}
|
|
2273
|
+
)
|
|
2274
|
+
]
|
|
2275
|
+
}
|
|
2208
2276
|
) });
|
|
2209
2277
|
});
|
|
2210
2278
|
var SearchInput_default = SearchInput;
|
|
@@ -2232,7 +2300,8 @@ function Dropdown({
|
|
|
2232
2300
|
items = [],
|
|
2233
2301
|
labelStyle = {},
|
|
2234
2302
|
placeholder,
|
|
2235
|
-
showSelectedCount = false
|
|
2303
|
+
showSelectedCount = false,
|
|
2304
|
+
size = "md"
|
|
2236
2305
|
}) {
|
|
2237
2306
|
const [open, setOpen] = React8.useState(false);
|
|
2238
2307
|
const [selectedItems, setSelectedItems] = React8.useState([]);
|
|
@@ -2295,7 +2364,7 @@ function Dropdown({
|
|
|
2295
2364
|
"aria-invalid": hasError || void 0,
|
|
2296
2365
|
"aria-describedby": hasError ? errorId : void 0,
|
|
2297
2366
|
style,
|
|
2298
|
-
className: `flex items-center justify-between
|
|
2367
|
+
className: `flex items-center justify-between cursor-pointer select-none ${fieldShell({ size, hasError, disabled })}`,
|
|
2299
2368
|
tabIndex: disabled ? -1 : 0,
|
|
2300
2369
|
onKeyDown: (e) => {
|
|
2301
2370
|
if (disabled) return;
|
|
@@ -2308,7 +2377,7 @@ function Dropdown({
|
|
|
2308
2377
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2309
2378
|
"div",
|
|
2310
2379
|
{
|
|
2311
|
-
className:
|
|
2380
|
+
className: `${!style?.width ? "min-w-[200px]" : ""} flex items-center gap-1 overflow-hidden`,
|
|
2312
2381
|
children: !value || Array.isArray(value) && value.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-sm", children: placeholder }) : Array.isArray(value) ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2313
2382
|
value.slice(0, 1).map((val) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2314
2383
|
DropdownPill,
|
|
@@ -2322,7 +2391,7 @@ function Dropdown({
|
|
|
2322
2391
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(DropdownPill, { value: innerItems.find((it) => it.key === value)?.label })
|
|
2323
2392
|
}
|
|
2324
2393
|
),
|
|
2325
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `transition-transform duration-200
|
|
2394
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex-shrink-0 ml-2 text-foreground-muted transition-transform duration-200 ${open ? "rotate-180" : "rotate-0"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
|
|
2326
2395
|
]
|
|
2327
2396
|
}
|
|
2328
2397
|
) }),
|
|
@@ -2397,9 +2466,105 @@ function Dropdown({
|
|
|
2397
2466
|
]
|
|
2398
2467
|
}
|
|
2399
2468
|
),
|
|
2400
|
-
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-
|
|
2469
|
+
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-status-error text-xs mt-1", children: errorMessage })
|
|
2401
2470
|
] });
|
|
2402
2471
|
}
|
|
2472
|
+
var SHIMMER = [
|
|
2473
|
+
"relative overflow-hidden rounded-sm bg-surface-raised",
|
|
2474
|
+
'before:absolute before:inset-0 before:content-[""]',
|
|
2475
|
+
"before:bg-gradient-to-r before:from-transparent before:via-white/30 before:to-transparent",
|
|
2476
|
+
"before:animate-[shimmer_1.6s_linear_infinite]",
|
|
2477
|
+
// Respect prefers-reduced-motion — the resting bg-surface-raised is still
|
|
2478
|
+
// a perfectly legible placeholder for users who have animations off.
|
|
2479
|
+
"motion-reduce:before:hidden"
|
|
2480
|
+
].join(" ");
|
|
2481
|
+
function SkeletonBox({ width, height = 16, radius, className = "", style }) {
|
|
2482
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2483
|
+
"span",
|
|
2484
|
+
{
|
|
2485
|
+
role: "presentation",
|
|
2486
|
+
"aria-hidden": "true",
|
|
2487
|
+
className: `block ${SHIMMER} ${className}`,
|
|
2488
|
+
style: {
|
|
2489
|
+
width: width ?? "100%",
|
|
2490
|
+
height,
|
|
2491
|
+
borderRadius: radius ?? "var(--radius-md)",
|
|
2492
|
+
...style
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
);
|
|
2496
|
+
}
|
|
2497
|
+
function SkeletonText({
|
|
2498
|
+
lines = 3,
|
|
2499
|
+
lastLineWidth = 60,
|
|
2500
|
+
lineHeight = 14,
|
|
2501
|
+
gap = 8,
|
|
2502
|
+
className = "",
|
|
2503
|
+
style
|
|
2504
|
+
}) {
|
|
2505
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2506
|
+
"div",
|
|
2507
|
+
{
|
|
2508
|
+
role: "presentation",
|
|
2509
|
+
"aria-hidden": "true",
|
|
2510
|
+
className: `flex flex-col ${className}`,
|
|
2511
|
+
style: { gap, ...style },
|
|
2512
|
+
children: Array.from({ length: lines }).map((_, i) => {
|
|
2513
|
+
const isLast = i === lines - 1;
|
|
2514
|
+
const width = isLast && lines > 1 ? `${lastLineWidth}%` : "100%";
|
|
2515
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2516
|
+
"span",
|
|
2517
|
+
{
|
|
2518
|
+
className: `block ${SHIMMER}`,
|
|
2519
|
+
style: { height: lineHeight, width, borderRadius: "var(--radius-sm)" }
|
|
2520
|
+
},
|
|
2521
|
+
i
|
|
2522
|
+
);
|
|
2523
|
+
})
|
|
2524
|
+
}
|
|
2525
|
+
);
|
|
2526
|
+
}
|
|
2527
|
+
function SkeletonCircle({ size = 40, className = "", style }) {
|
|
2528
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2529
|
+
"span",
|
|
2530
|
+
{
|
|
2531
|
+
role: "presentation",
|
|
2532
|
+
"aria-hidden": "true",
|
|
2533
|
+
className: `block flex-shrink-0 ${SHIMMER} ${className}`,
|
|
2534
|
+
style: {
|
|
2535
|
+
width: size,
|
|
2536
|
+
height: size,
|
|
2537
|
+
borderRadius: "50%",
|
|
2538
|
+
...style
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
);
|
|
2542
|
+
}
|
|
2543
|
+
function SkeletonCard({ hasAvatar = true, lines = 3, className = "", style }) {
|
|
2544
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2545
|
+
"div",
|
|
2546
|
+
{
|
|
2547
|
+
role: "presentation",
|
|
2548
|
+
"aria-hidden": "true",
|
|
2549
|
+
className: `rounded-lg border border-border bg-surface p-4 ${className}`,
|
|
2550
|
+
style,
|
|
2551
|
+
children: [
|
|
2552
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 mb-4", children: [
|
|
2553
|
+
hasAvatar && /* @__PURE__ */ jsxRuntime.jsx(SkeletonCircle, { size: 36 }),
|
|
2554
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
|
|
2555
|
+
/* @__PURE__ */ jsxRuntime.jsx(SkeletonBox, { height: 12, width: "55%" }),
|
|
2556
|
+
/* @__PURE__ */ jsxRuntime.jsx(SkeletonBox, { height: 10, width: "35%" })
|
|
2557
|
+
] })
|
|
2558
|
+
] }),
|
|
2559
|
+
/* @__PURE__ */ jsxRuntime.jsx(SkeletonText, { lines, lastLineWidth: 55 }),
|
|
2560
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex gap-2", children: [
|
|
2561
|
+
/* @__PURE__ */ jsxRuntime.jsx(SkeletonBox, { height: 28, width: 72 }),
|
|
2562
|
+
/* @__PURE__ */ jsxRuntime.jsx(SkeletonBox, { height: 28, width: 56 })
|
|
2563
|
+
] })
|
|
2564
|
+
]
|
|
2565
|
+
}
|
|
2566
|
+
);
|
|
2567
|
+
}
|
|
2403
2568
|
var DEFAULT_PICKER = [
|
|
2404
2569
|
{ key: 1, value: 5, label: 5 },
|
|
2405
2570
|
{ key: 2, value: 10, label: 10 },
|
|
@@ -2585,7 +2750,9 @@ function Table({
|
|
|
2585
2750
|
expandRow = DEFAULT_EXPAND,
|
|
2586
2751
|
hasSearch = true,
|
|
2587
2752
|
footer = null,
|
|
2588
|
-
header = null
|
|
2753
|
+
header = null,
|
|
2754
|
+
loading = false,
|
|
2755
|
+
loadingRowCount = 8
|
|
2589
2756
|
}) {
|
|
2590
2757
|
const searchRef = React8.useRef(null);
|
|
2591
2758
|
const [searchTerm, setSearchTerm] = React8.useState("");
|
|
@@ -2669,9 +2836,16 @@ function Table({
|
|
|
2669
2836
|
)
|
|
2670
2837
|
] }),
|
|
2671
2838
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: header }),
|
|
2672
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full border-collapse", children: [
|
|
2839
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full border-collapse", "aria-busy": loading || void 0, children: [
|
|
2673
2840
|
/* @__PURE__ */ jsxRuntime.jsx(TableHeader, { columns, hasExpand: !!expandRow.enabled }),
|
|
2674
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2841
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2842
|
+
TableSkeletonBody,
|
|
2843
|
+
{
|
|
2844
|
+
columns,
|
|
2845
|
+
rowCount: loadingRowCount,
|
|
2846
|
+
hasExpand: !!expandRow.enabled
|
|
2847
|
+
}
|
|
2848
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2675
2849
|
TableBody,
|
|
2676
2850
|
{
|
|
2677
2851
|
columns,
|
|
@@ -2684,6 +2858,23 @@ function Table({
|
|
|
2684
2858
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: footer })
|
|
2685
2859
|
] });
|
|
2686
2860
|
}
|
|
2861
|
+
function TableSkeletonBody({
|
|
2862
|
+
columns,
|
|
2863
|
+
rowCount,
|
|
2864
|
+
hasExpand
|
|
2865
|
+
}) {
|
|
2866
|
+
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { "aria-hidden": "true", children: Array.from({ length: rowCount }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2867
|
+
"tr",
|
|
2868
|
+
{
|
|
2869
|
+
className: `border-b border-border ${i % 2 === 0 ? "bg-surface" : "bg-surface-raised"}`,
|
|
2870
|
+
children: [
|
|
2871
|
+
hasExpand && /* @__PURE__ */ jsxRuntime.jsx("td", { className: "p-0 align-middle w-9" }),
|
|
2872
|
+
columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-3 px-3 align-middle", children: /* @__PURE__ */ jsxRuntime.jsx(SkeletonBox, { height: 12, width: `${50 + i % 4 * 12}%` }) }, col.key))
|
|
2873
|
+
]
|
|
2874
|
+
},
|
|
2875
|
+
i
|
|
2876
|
+
)) });
|
|
2877
|
+
}
|
|
2687
2878
|
function ThemeSwitch({ checked, onChange, label = "Toggle dark mode" }) {
|
|
2688
2879
|
const id = React8.useId();
|
|
2689
2880
|
return /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "flex items-center gap-2 cursor-pointer select-none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3116,162 +3307,71 @@ function ThemeProvider({
|
|
|
3116
3307
|
)
|
|
3117
3308
|
] });
|
|
3118
3309
|
}
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
height,
|
|
3138
|
-
borderRadius: radius ?? "var(--radius-md)",
|
|
3139
|
-
...style
|
|
3140
|
-
}
|
|
3141
|
-
}
|
|
3142
|
-
);
|
|
3143
|
-
}
|
|
3144
|
-
function SkeletonText({
|
|
3145
|
-
lines = 3,
|
|
3146
|
-
lastLineWidth = 60,
|
|
3147
|
-
lineHeight = 14,
|
|
3148
|
-
gap = 8,
|
|
3149
|
-
className = "",
|
|
3150
|
-
style
|
|
3310
|
+
function TextInput({
|
|
3311
|
+
value,
|
|
3312
|
+
onChange,
|
|
3313
|
+
disabled,
|
|
3314
|
+
label,
|
|
3315
|
+
htmlFor,
|
|
3316
|
+
placeholder,
|
|
3317
|
+
name,
|
|
3318
|
+
type = "text",
|
|
3319
|
+
inputStyle,
|
|
3320
|
+
style,
|
|
3321
|
+
layout = "vertical",
|
|
3322
|
+
size = "md",
|
|
3323
|
+
onBlur,
|
|
3324
|
+
errorMessage,
|
|
3325
|
+
required,
|
|
3326
|
+
prefix,
|
|
3327
|
+
suffix
|
|
3151
3328
|
}) {
|
|
3152
|
-
|
|
3153
|
-
|
|
3329
|
+
const errorId = React8.useId();
|
|
3330
|
+
const hasError = errorMessage != null;
|
|
3331
|
+
const hasAdornment = prefix != null || suffix != null;
|
|
3332
|
+
const input = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3333
|
+
"input",
|
|
3154
3334
|
{
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
i
|
|
3169
|
-
);
|
|
3170
|
-
})
|
|
3335
|
+
autoComplete: "off",
|
|
3336
|
+
disabled,
|
|
3337
|
+
value,
|
|
3338
|
+
onChange,
|
|
3339
|
+
onBlur,
|
|
3340
|
+
type,
|
|
3341
|
+
name,
|
|
3342
|
+
id: htmlFor,
|
|
3343
|
+
"aria-invalid": hasError || void 0,
|
|
3344
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
3345
|
+
placeholder: placeholder ?? "",
|
|
3346
|
+
className: hasAdornment ? "min-w-0 flex-1 bg-transparent outline-none disabled:cursor-not-allowed placeholder:text-foreground-muted" : fieldShell({ size, hasError, disabled }),
|
|
3347
|
+
style: inputStyle
|
|
3171
3348
|
}
|
|
3172
3349
|
);
|
|
3173
|
-
}
|
|
3174
|
-
function SkeletonCircle({ size = 40, className = "", style }) {
|
|
3175
3350
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3176
|
-
|
|
3351
|
+
Field,
|
|
3177
3352
|
{
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3353
|
+
label,
|
|
3354
|
+
htmlFor,
|
|
3355
|
+
errorId,
|
|
3356
|
+
errorMessage,
|
|
3357
|
+
layout,
|
|
3358
|
+
required,
|
|
3359
|
+
className: style ? void 0 : void 0,
|
|
3360
|
+
children: hasAdornment ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3361
|
+
"div",
|
|
3362
|
+
{
|
|
3363
|
+
className: `flex items-center ${fieldShell({ size, hasError, disabled, focusWithin: true })}`,
|
|
3364
|
+
style,
|
|
3365
|
+
children: [
|
|
3366
|
+
prefix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 mr-2 text-foreground-muted", children: prefix }),
|
|
3367
|
+
input,
|
|
3368
|
+
suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 ml-2 text-foreground-muted", children: suffix })
|
|
3369
|
+
]
|
|
3370
|
+
}
|
|
3371
|
+
) : input
|
|
3187
3372
|
}
|
|
3188
3373
|
);
|
|
3189
3374
|
}
|
|
3190
|
-
function SkeletonCard({ hasAvatar = true, lines = 3, className = "", style }) {
|
|
3191
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3192
|
-
"div",
|
|
3193
|
-
{
|
|
3194
|
-
role: "presentation",
|
|
3195
|
-
"aria-hidden": "true",
|
|
3196
|
-
className: `rounded-lg border border-border bg-surface p-4 ${className}`,
|
|
3197
|
-
style,
|
|
3198
|
-
children: [
|
|
3199
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 mb-4", children: [
|
|
3200
|
-
hasAvatar && /* @__PURE__ */ jsxRuntime.jsx(SkeletonCircle, { size: 36 }),
|
|
3201
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col gap-2", children: [
|
|
3202
|
-
/* @__PURE__ */ jsxRuntime.jsx(SkeletonBox, { height: 12, width: "55%" }),
|
|
3203
|
-
/* @__PURE__ */ jsxRuntime.jsx(SkeletonBox, { height: 10, width: "35%" })
|
|
3204
|
-
] })
|
|
3205
|
-
] }),
|
|
3206
|
-
/* @__PURE__ */ jsxRuntime.jsx(SkeletonText, { lines, lastLineWidth: 55 }),
|
|
3207
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex gap-2", children: [
|
|
3208
|
-
/* @__PURE__ */ jsxRuntime.jsx(SkeletonBox, { height: 28, width: 72 }),
|
|
3209
|
-
/* @__PURE__ */ jsxRuntime.jsx(SkeletonBox, { height: 28, width: 56 })
|
|
3210
|
-
] })
|
|
3211
|
-
]
|
|
3212
|
-
}
|
|
3213
|
-
);
|
|
3214
|
-
}
|
|
3215
|
-
function TextInput({
|
|
3216
|
-
value,
|
|
3217
|
-
onChange,
|
|
3218
|
-
disabled,
|
|
3219
|
-
label,
|
|
3220
|
-
htmlFor,
|
|
3221
|
-
placeholder,
|
|
3222
|
-
name,
|
|
3223
|
-
inputStyle,
|
|
3224
|
-
style,
|
|
3225
|
-
layout,
|
|
3226
|
-
onBlur,
|
|
3227
|
-
errorMessage,
|
|
3228
|
-
labelColor
|
|
3229
|
-
}) {
|
|
3230
|
-
const errorId = React8.useId();
|
|
3231
|
-
const hasError = errorMessage != null;
|
|
3232
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-center justify-center", children: [
|
|
3233
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3234
|
-
"div",
|
|
3235
|
-
{
|
|
3236
|
-
className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-center gap-2"}`,
|
|
3237
|
-
style: style ?? {},
|
|
3238
|
-
children: [
|
|
3239
|
-
label && // Render <label> only when a label is provided. An empty
|
|
3240
|
-
// <label htmlFor=…> announces as an unlabeled control in
|
|
3241
|
-
// some screen readers.
|
|
3242
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3243
|
-
"label",
|
|
3244
|
-
{
|
|
3245
|
-
style: { color: labelColor || void 0 },
|
|
3246
|
-
className: `text-sm font-medium ml-1 max-content ${!labelColor && "text-foreground"}`,
|
|
3247
|
-
htmlFor,
|
|
3248
|
-
children: label
|
|
3249
|
-
}
|
|
3250
|
-
),
|
|
3251
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3252
|
-
"input",
|
|
3253
|
-
{
|
|
3254
|
-
autoComplete: "off",
|
|
3255
|
-
disabled,
|
|
3256
|
-
value,
|
|
3257
|
-
onChange,
|
|
3258
|
-
onBlur,
|
|
3259
|
-
type: "text",
|
|
3260
|
-
name,
|
|
3261
|
-
id: htmlFor,
|
|
3262
|
-
"aria-invalid": hasError || void 0,
|
|
3263
|
-
"aria-describedby": hasError ? errorId : void 0,
|
|
3264
|
-
className: `${hasError ? "border border-status-error" : "border border-border"} bg-surface text-foreground p-2 h-9 w-60 mt-1 rounded-lg disabled:bg-surface-raised disabled:text-foreground-muted disabled:cursor-not-allowed focus:outline-none focus:border-transparent focus:ring-2 focus:ring-accent transition-colors`,
|
|
3265
|
-
style: inputStyle ?? {},
|
|
3266
|
-
placeholder: placeholder ?? ""
|
|
3267
|
-
}
|
|
3268
|
-
)
|
|
3269
|
-
]
|
|
3270
|
-
}
|
|
3271
|
-
),
|
|
3272
|
-
hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-center text-status-error text-xs mt-1", children: errorMessage })
|
|
3273
|
-
] });
|
|
3274
|
-
}
|
|
3275
3375
|
function NumberInput({
|
|
3276
3376
|
step = 1,
|
|
3277
3377
|
value,
|
|
@@ -3280,8 +3380,10 @@ function NumberInput({
|
|
|
3280
3380
|
htmlFor,
|
|
3281
3381
|
name,
|
|
3282
3382
|
disabled,
|
|
3283
|
-
layout = "
|
|
3383
|
+
layout = "vertical",
|
|
3384
|
+
size = "md",
|
|
3284
3385
|
errorMessage,
|
|
3386
|
+
required,
|
|
3285
3387
|
inputStyle,
|
|
3286
3388
|
labelStyle,
|
|
3287
3389
|
placeholder,
|
|
@@ -3322,22 +3424,21 @@ function NumberInput({
|
|
|
3322
3424
|
if (Number.isNaN(parsed)) return;
|
|
3323
3425
|
onChange?.({ target: { value: round(parsed), id: htmlFor, name } });
|
|
3324
3426
|
};
|
|
3325
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3427
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3428
|
+
Field,
|
|
3429
|
+
{
|
|
3430
|
+
label,
|
|
3431
|
+
htmlFor,
|
|
3432
|
+
errorId,
|
|
3433
|
+
errorMessage,
|
|
3434
|
+
layout,
|
|
3435
|
+
required,
|
|
3436
|
+
labelStyle,
|
|
3437
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3337
3438
|
"div",
|
|
3338
3439
|
{
|
|
3339
3440
|
style,
|
|
3340
|
-
className: `flex items-center
|
|
3441
|
+
className: `flex items-center overflow-hidden pr-0 ${fieldShell({ size, hasError, disabled, focusWithin: true })}`,
|
|
3341
3442
|
children: [
|
|
3342
3443
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3343
3444
|
"input",
|
|
@@ -3354,13 +3455,13 @@ function NumberInput({
|
|
|
3354
3455
|
type: "number",
|
|
3355
3456
|
"aria-invalid": hasError || void 0,
|
|
3356
3457
|
"aria-describedby": hasError ? errorId : void 0,
|
|
3357
|
-
className: "bg-transparent
|
|
3358
|
-
style: inputStyle
|
|
3458
|
+
className: "min-w-0 flex-1 bg-transparent outline-none h-full disabled:cursor-not-allowed [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none placeholder:text-foreground-muted",
|
|
3459
|
+
style: inputStyle,
|
|
3359
3460
|
placeholder: placeholder ?? "",
|
|
3360
3461
|
readOnly
|
|
3361
3462
|
}
|
|
3362
3463
|
),
|
|
3363
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col border-l border-border
|
|
3464
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col self-stretch border-l border-border flex-shrink-0", children: [
|
|
3364
3465
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3365
3466
|
"button",
|
|
3366
3467
|
{
|
|
@@ -3369,7 +3470,7 @@ function NumberInput({
|
|
|
3369
3470
|
onClick: onIncrement,
|
|
3370
3471
|
disabled: disabled || readOnly || max !== void 0 && numeric >= max,
|
|
3371
3472
|
"aria-label": "Increase value",
|
|
3372
|
-
className: "flex-1 px-1.5 flex items-center justify-center hover:bg-surface-raised disabled:opacity-30 disabled:cursor-not-allowed transition-colors
|
|
3473
|
+
className: "flex-1 px-1.5 flex items-center justify-center text-foreground-muted hover:bg-surface-raised hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",
|
|
3373
3474
|
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, className: "h-3 w-3", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 15l7-7 7 7" }) })
|
|
3374
3475
|
}
|
|
3375
3476
|
),
|
|
@@ -3381,7 +3482,7 @@ function NumberInput({
|
|
|
3381
3482
|
onClick: onDecrement,
|
|
3382
3483
|
disabled: disabled || readOnly || min !== void 0 && numeric <= min,
|
|
3383
3484
|
"aria-label": "Decrease value",
|
|
3384
|
-
className: "flex-1 px-1.5 flex items-center justify-center hover:bg-surface-raised disabled:opacity-30 disabled:cursor-not-allowed transition-colors
|
|
3485
|
+
className: "flex-1 px-1.5 flex items-center justify-center text-foreground-muted hover:bg-surface-raised hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors border-t border-border",
|
|
3385
3486
|
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, className: "h-3 w-3", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
|
|
3386
3487
|
}
|
|
3387
3488
|
)
|
|
@@ -3389,10 +3490,18 @@ function NumberInput({
|
|
|
3389
3490
|
]
|
|
3390
3491
|
}
|
|
3391
3492
|
)
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
] });
|
|
3493
|
+
}
|
|
3494
|
+
);
|
|
3395
3495
|
}
|
|
3496
|
+
var EyeIcon = /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5", "aria-hidden": "true", children: [
|
|
3497
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 15a3 3 0 100-6 3 3 0 000 6z" }),
|
|
3498
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 010-1.113zM17.25 12a5.25 5.25 0 11-10.5 0 5.25 5.25 0 0110.5 0z", clipRule: "evenodd" })
|
|
3499
|
+
] });
|
|
3500
|
+
var EyeSlashIcon = /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-5 h-5", "aria-hidden": "true", children: [
|
|
3501
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.53 2.47a.75.75 0 00-1.06 1.06l18 18a.75.75 0 101.06-1.06l-18-18zM22.676 12.553a11.249 11.249 0 01-2.631 4.31l-3.099-3.099a5.25 5.25 0 00-6.71-6.71L7.759 4.577a11.217 11.217 0 014.242-.827c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113z" }),
|
|
3502
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.75 12c0 .18-.013.357-.037.53l-4.244-4.243A3.75 3.75 0 0115.75 12zM12.53 15.713l-4.243-4.244a3.75 3.75 0 004.243 4.243z" }),
|
|
3503
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.75 12c0-.619.107-1.213.304-1.764l-3.1-3.1a11.25 11.25 0 00-2.63 4.31c-.12.362-.12.752 0 1.114 1.489 4.467 5.704 7.69 10.675 7.69 1.5 0 2.933-.294 4.242-.827l-2.477-2.477A5.25 5.25 0 016.75 12z" })
|
|
3504
|
+
] });
|
|
3396
3505
|
function Password({
|
|
3397
3506
|
value,
|
|
3398
3507
|
onChange,
|
|
@@ -3403,73 +3512,66 @@ function Password({
|
|
|
3403
3512
|
name,
|
|
3404
3513
|
inputStyle,
|
|
3405
3514
|
style,
|
|
3406
|
-
layout,
|
|
3515
|
+
layout = "vertical",
|
|
3516
|
+
size = "md",
|
|
3407
3517
|
onBlur,
|
|
3408
3518
|
errorMessage,
|
|
3409
|
-
|
|
3410
|
-
|
|
3519
|
+
required,
|
|
3520
|
+
showIcon,
|
|
3521
|
+
hideIcon
|
|
3411
3522
|
}) {
|
|
3412
|
-
const [
|
|
3523
|
+
const [visible, setVisible] = React8.useState(false);
|
|
3413
3524
|
const errorId = React8.useId();
|
|
3414
3525
|
const hasError = errorMessage != null;
|
|
3415
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3526
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3527
|
+
Field,
|
|
3528
|
+
{
|
|
3529
|
+
label,
|
|
3530
|
+
htmlFor,
|
|
3531
|
+
errorId,
|
|
3532
|
+
errorMessage,
|
|
3533
|
+
layout,
|
|
3534
|
+
required,
|
|
3535
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3536
|
+
"div",
|
|
3419
3537
|
{
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
onClick: () => setPasswordVisible(!passwordVisible),
|
|
3452
|
-
"aria-label": passwordVisible ? "Hide password" : "Show password",
|
|
3453
|
-
children: passwordVisible ? (
|
|
3454
|
-
/* EyeSlash */
|
|
3455
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-6 h-6", children: [
|
|
3456
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.53 2.47a.75.75 0 00-1.06 1.06l18 18a.75.75 0 101.06-1.06l-18-18zM22.676 12.553a11.249 11.249 0 01-2.631 4.31l-3.099-3.099a5.25 5.25 0 00-6.71-6.71L7.759 4.577a11.217 11.217 0 014.242-.827c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113z" }),
|
|
3457
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.75 12c0 .18-.013.357-.037.53l-4.244-4.243A3.75 3.75 0 0115.75 12zM12.53 15.713l-4.243-4.244a3.75 3.75 0 004.243 4.243z" }),
|
|
3458
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.75 12c0-.619.107-1.213.304-1.764l-3.1-3.1a11.25 11.25 0 00-2.63 4.31c-.12.362-.12.752 0 1.114 1.489 4.467 5.704 7.69 10.675 7.69 1.5 0 2.933-.294 4.242-.827l-2.477-2.477A5.25 5.25 0 016.75 12z" })
|
|
3459
|
-
] })
|
|
3460
|
-
) : (
|
|
3461
|
-
/* Eye */
|
|
3462
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-6 h-6", children: [
|
|
3463
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 15a3 3 0 100-6 3 3 0 000 6z" }),
|
|
3464
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 010-1.113zM17.25 12a5.25 5.25 0 11-10.5 0 5.25 5.25 0 0110.5 0z", clipRule: "evenodd" })
|
|
3465
|
-
] })
|
|
3538
|
+
className: `flex items-center ${fieldShell({ size, hasError, disabled, focusWithin: true })}`,
|
|
3539
|
+
style,
|
|
3540
|
+
children: [
|
|
3541
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3542
|
+
"input",
|
|
3543
|
+
{
|
|
3544
|
+
autoComplete: "off",
|
|
3545
|
+
disabled,
|
|
3546
|
+
value,
|
|
3547
|
+
onChange,
|
|
3548
|
+
onBlur,
|
|
3549
|
+
type: visible ? "text" : "password",
|
|
3550
|
+
name,
|
|
3551
|
+
id: htmlFor,
|
|
3552
|
+
"aria-invalid": hasError || void 0,
|
|
3553
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
3554
|
+
placeholder: placeholder ?? "",
|
|
3555
|
+
className: "min-w-0 flex-1 bg-transparent outline-none disabled:cursor-not-allowed placeholder:text-foreground-muted",
|
|
3556
|
+
style: inputStyle
|
|
3557
|
+
}
|
|
3558
|
+
),
|
|
3559
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3560
|
+
"button",
|
|
3561
|
+
{
|
|
3562
|
+
type: "button",
|
|
3563
|
+
disabled,
|
|
3564
|
+
className: `flex-shrink-0 ml-2 ${FIELD_SIZE[size].gap} rounded text-foreground-muted hover:text-foreground transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed`,
|
|
3565
|
+
onClick: () => setVisible((v) => !v),
|
|
3566
|
+
"aria-label": visible ? "Hide password" : "Show password",
|
|
3567
|
+
children: visible ? hideIcon ?? EyeSlashIcon : showIcon ?? EyeIcon
|
|
3568
|
+
}
|
|
3466
3569
|
)
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
] });
|
|
3570
|
+
]
|
|
3571
|
+
}
|
|
3572
|
+
)
|
|
3573
|
+
}
|
|
3574
|
+
);
|
|
3473
3575
|
}
|
|
3474
3576
|
function Checkbox({
|
|
3475
3577
|
checked,
|
|
@@ -3550,6 +3652,96 @@ function Checkbox({
|
|
|
3550
3652
|
errorMessage && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-status-error pl-[26px]", children: errorMessage })
|
|
3551
3653
|
] });
|
|
3552
3654
|
}
|
|
3655
|
+
var DOT_SIZE = {
|
|
3656
|
+
sm: "h-3.5 w-3.5",
|
|
3657
|
+
md: "h-4 w-4",
|
|
3658
|
+
lg: "h-5 w-5"
|
|
3659
|
+
};
|
|
3660
|
+
var TEXT_SIZE = {
|
|
3661
|
+
sm: "text-xs",
|
|
3662
|
+
md: "text-sm",
|
|
3663
|
+
lg: "text-base"
|
|
3664
|
+
};
|
|
3665
|
+
function RadioGroup({
|
|
3666
|
+
options,
|
|
3667
|
+
value,
|
|
3668
|
+
defaultValue,
|
|
3669
|
+
onChange,
|
|
3670
|
+
name,
|
|
3671
|
+
label,
|
|
3672
|
+
orientation = "vertical",
|
|
3673
|
+
size = "md",
|
|
3674
|
+
disabled,
|
|
3675
|
+
required,
|
|
3676
|
+
errorMessage
|
|
3677
|
+
}) {
|
|
3678
|
+
const errorId = React8.useId();
|
|
3679
|
+
const groupId = React8.useId();
|
|
3680
|
+
const hasError = errorMessage != null;
|
|
3681
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3682
|
+
Field,
|
|
3683
|
+
{
|
|
3684
|
+
label,
|
|
3685
|
+
htmlFor: groupId,
|
|
3686
|
+
errorId,
|
|
3687
|
+
errorMessage,
|
|
3688
|
+
required,
|
|
3689
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3690
|
+
RadioGroupPrimitive__namespace.Root,
|
|
3691
|
+
{
|
|
3692
|
+
id: groupId,
|
|
3693
|
+
name,
|
|
3694
|
+
value,
|
|
3695
|
+
defaultValue,
|
|
3696
|
+
onValueChange: onChange,
|
|
3697
|
+
disabled,
|
|
3698
|
+
required,
|
|
3699
|
+
"aria-invalid": hasError || void 0,
|
|
3700
|
+
"aria-describedby": hasError ? errorId : void 0,
|
|
3701
|
+
orientation,
|
|
3702
|
+
className: orientation === "horizontal" ? "flex flex-row flex-wrap gap-5" : "flex flex-col gap-3",
|
|
3703
|
+
children: options.map((opt) => {
|
|
3704
|
+
const itemId = `${groupId}-${opt.value}`;
|
|
3705
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2.5", children: [
|
|
3706
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3707
|
+
RadioGroupPrimitive__namespace.Item,
|
|
3708
|
+
{
|
|
3709
|
+
id: itemId,
|
|
3710
|
+
value: opt.value,
|
|
3711
|
+
disabled: opt.disabled,
|
|
3712
|
+
className: [
|
|
3713
|
+
DOT_SIZE[size],
|
|
3714
|
+
"mt-0.5 flex-shrink-0 rounded-full border bg-surface transition-colors duration-150",
|
|
3715
|
+
"border-border-strong",
|
|
3716
|
+
"hover:border-accent",
|
|
3717
|
+
"data-[state=checked]:border-accent",
|
|
3718
|
+
"focus:outline-none focus-visible:ring-[3px] focus-visible:ring-focus-ring",
|
|
3719
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
3720
|
+
].join(" "),
|
|
3721
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block h-1/2 w-1/2 rounded-full bg-accent" }) })
|
|
3722
|
+
}
|
|
3723
|
+
),
|
|
3724
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3725
|
+
"label",
|
|
3726
|
+
{
|
|
3727
|
+
htmlFor: itemId,
|
|
3728
|
+
className: [
|
|
3729
|
+
"select-none",
|
|
3730
|
+
opt.disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
3731
|
+
].join(" "),
|
|
3732
|
+
children: [
|
|
3733
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `block ${TEXT_SIZE[size]} text-foreground`, children: opt.label }),
|
|
3734
|
+
opt.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-foreground-secondary mt-0.5", children: opt.description })
|
|
3735
|
+
]
|
|
3736
|
+
}
|
|
3737
|
+
)
|
|
3738
|
+
] }, opt.value);
|
|
3739
|
+
})
|
|
3740
|
+
}
|
|
3741
|
+
)
|
|
3742
|
+
}
|
|
3743
|
+
);
|
|
3744
|
+
}
|
|
3553
3745
|
function Switch({
|
|
3554
3746
|
checked = false,
|
|
3555
3747
|
onChange,
|
|
@@ -3582,29 +3774,70 @@ function AutoComplete({
|
|
|
3582
3774
|
inputStyle,
|
|
3583
3775
|
style,
|
|
3584
3776
|
layout = "vertical",
|
|
3585
|
-
items
|
|
3777
|
+
items,
|
|
3778
|
+
onSearch,
|
|
3779
|
+
debounce = 250,
|
|
3586
3780
|
onItemClick,
|
|
3587
|
-
emptyText = "No results found"
|
|
3781
|
+
emptyText = "No results found",
|
|
3782
|
+
loadingText = "Searching\u2026",
|
|
3783
|
+
size = "md",
|
|
3784
|
+
icon
|
|
3588
3785
|
}) {
|
|
3589
3786
|
const [term, setTerm] = React8.useState("");
|
|
3590
3787
|
const [open, setOpen] = React8.useState(false);
|
|
3591
|
-
const
|
|
3788
|
+
const [asyncItems, setAsyncItems] = React8.useState([]);
|
|
3789
|
+
const [loading, setLoading] = React8.useState(false);
|
|
3790
|
+
const isAsync = typeof onSearch === "function";
|
|
3791
|
+
const debounceRef = React8.useRef(null);
|
|
3792
|
+
const requestIdRef = React8.useRef(0);
|
|
3793
|
+
const staticFiltered = isAsync || !items ? [] : term.trim() ? items.filter(
|
|
3592
3794
|
({ key, label: label2 }) => label2.toLowerCase().includes(term.toLowerCase()) || key.toLowerCase().includes(term.toLowerCase())
|
|
3593
3795
|
) : [];
|
|
3796
|
+
React8.useEffect(() => {
|
|
3797
|
+
if (!isAsync) return;
|
|
3798
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
3799
|
+
if (!term.trim()) {
|
|
3800
|
+
setAsyncItems([]);
|
|
3801
|
+
setLoading(false);
|
|
3802
|
+
return;
|
|
3803
|
+
}
|
|
3804
|
+
const myId = ++requestIdRef.current;
|
|
3805
|
+
setLoading(true);
|
|
3806
|
+
debounceRef.current = setTimeout(async () => {
|
|
3807
|
+
try {
|
|
3808
|
+
const res = await onSearch(term);
|
|
3809
|
+
if (myId === requestIdRef.current) {
|
|
3810
|
+
setAsyncItems(res);
|
|
3811
|
+
}
|
|
3812
|
+
} catch {
|
|
3813
|
+
if (myId === requestIdRef.current) {
|
|
3814
|
+
setAsyncItems([]);
|
|
3815
|
+
}
|
|
3816
|
+
} finally {
|
|
3817
|
+
if (myId === requestIdRef.current) {
|
|
3818
|
+
setLoading(false);
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
}, debounce);
|
|
3822
|
+
return () => {
|
|
3823
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
3824
|
+
};
|
|
3825
|
+
}, [term, isAsync, debounce, onSearch]);
|
|
3826
|
+
const foundItems = isAsync ? asyncItems : staticFiltered;
|
|
3594
3827
|
const handleSelect = (item) => {
|
|
3595
3828
|
setTerm(`${item.label} (${item.value})`);
|
|
3596
3829
|
onItemClick?.(item.value);
|
|
3597
3830
|
setOpen(false);
|
|
3598
3831
|
};
|
|
3599
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
3832
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3600
3833
|
"div",
|
|
3601
3834
|
{
|
|
3602
|
-
className: `flex ${layout === "vertical" ? "flex-col" : "flex-row items-
|
|
3603
|
-
style
|
|
3835
|
+
className: `flex ${layout === "vertical" ? "flex-col gap-1.5" : "flex-row items-start gap-3"}`,
|
|
3836
|
+
style,
|
|
3604
3837
|
children: [
|
|
3605
|
-
label && /* @__PURE__ */ jsxRuntime.jsx("label", { className:
|
|
3606
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Popover__namespace.Root, { open: open && !disabled, onOpenChange: (o) => !disabled && setOpen(o), children: [
|
|
3607
|
-
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Anchor, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
3838
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: `text-sm font-medium text-foreground select-none ${layout === "horizontal" ? "mt-2 flex-shrink-0" : ""}`, children: label }),
|
|
3839
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col min-w-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs(Popover__namespace.Root, { open: open && !disabled, onOpenChange: (o) => !disabled && setOpen(o), children: [
|
|
3840
|
+
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Anchor, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex items-center ${fieldShell({ size, disabled, focusWithin: true })}`, children: [
|
|
3608
3841
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3609
3842
|
"input",
|
|
3610
3843
|
{
|
|
@@ -3617,16 +3850,17 @@ function AutoComplete({
|
|
|
3617
3850
|
onFocus: () => setOpen(true),
|
|
3618
3851
|
type: "text",
|
|
3619
3852
|
name,
|
|
3620
|
-
className: "
|
|
3621
|
-
style: inputStyle
|
|
3853
|
+
className: "min-w-0 flex-1 bg-transparent outline-none disabled:cursor-not-allowed placeholder:text-foreground-muted",
|
|
3854
|
+
style: inputStyle,
|
|
3622
3855
|
placeholder: placeholder ?? "",
|
|
3623
3856
|
autoComplete: "off",
|
|
3624
3857
|
"aria-haspopup": "listbox",
|
|
3625
3858
|
"aria-expanded": open,
|
|
3626
|
-
"aria-autocomplete": "list"
|
|
3859
|
+
"aria-autocomplete": "list",
|
|
3860
|
+
"aria-busy": loading || void 0
|
|
3627
3861
|
}
|
|
3628
3862
|
),
|
|
3629
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-
|
|
3863
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 w-4 h-4 flex-shrink-0 flex items-center justify-center text-accent", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner, { inline: true, size: "xs", spinnerColor: "currentColor" }) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 flex-shrink-0 text-foreground-muted", children: icon ?? /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-4 h-4", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M10.5 3.75a6.75 6.75 0 100 13.5 6.75 6.75 0 000-13.5zM2.25 10.5a8.25 8.25 0 1114.59 5.28l4.69 4.69a.75.75 0 11-1.06 1.06l-4.69-4.69A8.25 8.25 0 012.25 10.5z", clipRule: "evenodd" }) }) })
|
|
3630
3864
|
] }) }),
|
|
3631
3865
|
/* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3632
3866
|
Popover__namespace.Content,
|
|
@@ -3635,43 +3869,40 @@ function AutoComplete({
|
|
|
3635
3869
|
sideOffset: 4,
|
|
3636
3870
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
3637
3871
|
className: "w-64 bg-surface border border-border rounded-lg mt-1 shadow-md z-50 overflow-y-auto max-h-36 animate-in fade-in-0 zoom-in-95",
|
|
3638
|
-
children:
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
"
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
handleSelect(item);
|
|
3654
|
-
}
|
|
3655
|
-
},
|
|
3656
|
-
children: [
|
|
3657
|
-
item.icon,
|
|
3658
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3659
|
-
item.label,
|
|
3660
|
-
" (",
|
|
3661
|
-
item.value,
|
|
3662
|
-
")"
|
|
3663
|
-
] })
|
|
3664
|
-
]
|
|
3872
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full w-full flex items-center justify-center gap-2 py-4 text-sm text-foreground-secondary", children: [
|
|
3873
|
+
/* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner, { inline: true, size: "xs" }),
|
|
3874
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: loadingText })
|
|
3875
|
+
] }) : foundItems.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full flex flex-col items-center justify-center py-4 text-sm text-foreground-secondary", children: emptyText }) : /* @__PURE__ */ jsxRuntime.jsx("div", { role: "listbox", children: foundItems.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3876
|
+
"div",
|
|
3877
|
+
{
|
|
3878
|
+
role: "option",
|
|
3879
|
+
tabIndex: 0,
|
|
3880
|
+
className: "text-sm flex items-center gap-2 p-2 transition-colors duration-150 hover:bg-surface-raised cursor-pointer text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
3881
|
+
onClick: () => handleSelect(item),
|
|
3882
|
+
onKeyDown: (e) => {
|
|
3883
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3884
|
+
e.preventDefault();
|
|
3885
|
+
handleSelect(item);
|
|
3886
|
+
}
|
|
3665
3887
|
},
|
|
3666
|
-
|
|
3667
|
-
|
|
3888
|
+
children: [
|
|
3889
|
+
item.icon,
|
|
3890
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
3891
|
+
item.label,
|
|
3892
|
+
" (",
|
|
3893
|
+
item.value,
|
|
3894
|
+
")"
|
|
3895
|
+
] })
|
|
3896
|
+
]
|
|
3897
|
+
},
|
|
3898
|
+
item.key
|
|
3668
3899
|
)) })
|
|
3669
3900
|
}
|
|
3670
3901
|
) })
|
|
3671
|
-
] })
|
|
3902
|
+
] }) })
|
|
3672
3903
|
]
|
|
3673
3904
|
}
|
|
3674
|
-
)
|
|
3905
|
+
);
|
|
3675
3906
|
}
|
|
3676
3907
|
function flattenVisible(items, expanded, depth = 0, out = []) {
|
|
3677
3908
|
for (const node of items) {
|
|
@@ -3706,7 +3937,8 @@ function TreeSelect({
|
|
|
3706
3937
|
items = [],
|
|
3707
3938
|
placeholder = "Select\u2026",
|
|
3708
3939
|
parentsSelectable = true,
|
|
3709
|
-
defaultExpandedKeys = []
|
|
3940
|
+
defaultExpandedKeys = [],
|
|
3941
|
+
size = "md"
|
|
3710
3942
|
}) {
|
|
3711
3943
|
const errorId = React8.useId();
|
|
3712
3944
|
const hasError = errorMessage != null;
|
|
@@ -3805,7 +4037,7 @@ function TreeSelect({
|
|
|
3805
4037
|
"aria-invalid": hasError || void 0,
|
|
3806
4038
|
"aria-describedby": hasError ? errorId : void 0,
|
|
3807
4039
|
disabled,
|
|
3808
|
-
className: `flex items-center justify-between
|
|
4040
|
+
className: `flex items-center justify-between cursor-pointer select-none ${!style?.width ? "min-w-[240px]" : ""} ${fieldShell({ size, hasError, disabled })}`,
|
|
3809
4041
|
children: [
|
|
3810
4042
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm truncate text-left", children: selectedNode ? selectedNode.label : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted", children: placeholder }) }),
|
|
3811
4043
|
/* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: `h-4 w-4 flex-shrink-0 transition-transform duration-200 ${open ? "rotate-180" : ""}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
|
|
@@ -3932,111 +4164,162 @@ function TreeNodeRow({
|
|
|
3932
4164
|
}
|
|
3933
4165
|
);
|
|
3934
4166
|
}
|
|
4167
|
+
function formatBytes(bytes) {
|
|
4168
|
+
if (bytes === 0) return "0 B";
|
|
4169
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
4170
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
4171
|
+
return `${(bytes / Math.pow(1024, i)).toFixed(i === 0 ? 0 : 1)} ${units[i]}`;
|
|
4172
|
+
}
|
|
4173
|
+
var UploadGlyph = /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.5, className: "w-6 h-6", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 16V4m0 0L8 8m4-4l4 4M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2" }) });
|
|
4174
|
+
var FileGlyph = /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1.5, className: "w-5 h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14 3v4a1 1 0 001 1h4M5 3h9l5 5v11a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2z" }) });
|
|
3935
4175
|
function FileInput({
|
|
3936
4176
|
allowMultiple = false,
|
|
3937
4177
|
onChange,
|
|
3938
4178
|
name,
|
|
3939
|
-
|
|
4179
|
+
htmlFor,
|
|
4180
|
+
label,
|
|
4181
|
+
accept,
|
|
4182
|
+
prompt = "Click to upload or drag and drop",
|
|
4183
|
+
hint,
|
|
4184
|
+
maxSize,
|
|
4185
|
+
errorMessage,
|
|
4186
|
+
disabled,
|
|
4187
|
+
required,
|
|
4188
|
+
icon
|
|
3940
4189
|
}) {
|
|
3941
|
-
const
|
|
4190
|
+
const inputRef = React8.useRef(null);
|
|
4191
|
+
const errorId = React8.useId();
|
|
3942
4192
|
const [files, setFiles] = React8.useState([]);
|
|
4193
|
+
const [dragging, setDragging] = React8.useState(false);
|
|
4194
|
+
const [sizeError, setSizeError] = React8.useState(null);
|
|
4195
|
+
const effectiveError = errorMessage ?? sizeError ?? void 0;
|
|
3943
4196
|
const openPicker = () => {
|
|
3944
|
-
|
|
4197
|
+
if (!disabled) inputRef.current?.click();
|
|
3945
4198
|
};
|
|
3946
|
-
const
|
|
4199
|
+
const commit = (list) => {
|
|
4200
|
+
if (maxSize != null) {
|
|
4201
|
+
const tooBig = list.find((f) => f.size > maxSize);
|
|
4202
|
+
if (tooBig) {
|
|
4203
|
+
setSizeError(`"${tooBig.name}" exceeds the ${formatBytes(maxSize)} limit`);
|
|
4204
|
+
return;
|
|
4205
|
+
}
|
|
4206
|
+
}
|
|
4207
|
+
setSizeError(null);
|
|
3947
4208
|
setFiles(list);
|
|
3948
|
-
onChange?.({ target: { files: list } });
|
|
4209
|
+
onChange?.({ target: { files: list, name, id: htmlFor ?? name } });
|
|
3949
4210
|
};
|
|
3950
4211
|
const onDrop = (e) => {
|
|
3951
4212
|
e.preventDefault();
|
|
3952
|
-
|
|
3953
|
-
if (
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
const f = e.dataTransfer.items[i].getAsFile();
|
|
3957
|
-
if (f) fileList.push(f);
|
|
3958
|
-
}
|
|
3959
|
-
}
|
|
3960
|
-
} else {
|
|
3961
|
-
for (let i = 0; i < e.dataTransfer.files.length; i++) {
|
|
3962
|
-
fileList.push(e.dataTransfer.files[i]);
|
|
3963
|
-
}
|
|
3964
|
-
}
|
|
3965
|
-
handleFiles(fileList);
|
|
4213
|
+
setDragging(false);
|
|
4214
|
+
if (disabled) return;
|
|
4215
|
+
const dropped = Array.from(e.dataTransfer.files ?? []);
|
|
4216
|
+
commit(allowMultiple ? dropped : dropped.slice(0, 1));
|
|
3966
4217
|
};
|
|
3967
|
-
const
|
|
3968
|
-
|
|
4218
|
+
const removeFile = (idx) => {
|
|
4219
|
+
const next = files.filter((_, i) => i !== idx);
|
|
4220
|
+
setFiles(next);
|
|
4221
|
+
setSizeError(null);
|
|
4222
|
+
onChange?.({ target: { files: next, name, id: htmlFor ?? name, value: "" } });
|
|
4223
|
+
if (next.length === 0 && inputRef.current) inputRef.current.value = "";
|
|
3969
4224
|
};
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
e
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
onDrop,
|
|
3996
|
-
children: [
|
|
3997
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3998
|
-
"input",
|
|
3999
|
-
{
|
|
4000
|
-
id: name,
|
|
4001
|
-
name,
|
|
4002
|
-
onChange: localOnChange,
|
|
4003
|
-
ref: fileInput,
|
|
4004
|
-
hidden: true,
|
|
4005
|
-
type: "file",
|
|
4006
|
-
accept,
|
|
4007
|
-
multiple: allowMultiple
|
|
4008
|
-
}
|
|
4009
|
-
),
|
|
4010
|
-
files.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-full items-center justify-center gap-2", children: [
|
|
4011
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-16 h-16", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M11.47 2.47a.75.75 0 011.06 0l4.5 4.5a.75.75 0 01-1.06 1.06l-3.22-3.22V16.5a.75.75 0 01-1.5 0V4.81L8.03 8.03a.75.75 0 01-1.06-1.06l4.5-4.5zM3 15.75a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z", clipRule: "evenodd" }) }),
|
|
4012
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm", children: "Click or Drop a file" })
|
|
4013
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3 items-center justify-center w-full h-full p-3", children: files.map((file, id) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4014
|
-
"div",
|
|
4015
|
-
{
|
|
4016
|
-
className: "text-xs flex flex-col items-center w-20 h-24 text-center bg-surface-raised text-foreground p-4 rounded-md relative",
|
|
4017
|
-
children: [
|
|
4018
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4019
|
-
"button",
|
|
4020
|
-
{
|
|
4021
|
-
type: "button",
|
|
4022
|
-
onClick: removeFile,
|
|
4023
|
-
className: "bg-status-error rounded-full w-4 h-4 absolute right-[-5px] top-[-5px] cursor-pointer flex items-center justify-center focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
4024
|
-
"aria-label": "Remove file",
|
|
4025
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "#fff", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
4026
|
-
}
|
|
4027
|
-
),
|
|
4028
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", className: "w-10 h-10", "aria-hidden": "true", children: [
|
|
4029
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0016.5 9h-1.875a1.875 1.875 0 01-1.875-1.875V5.25A3.75 3.75 0 009 1.5H5.625z", clipRule: "evenodd" }),
|
|
4030
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.971 1.816A5.23 5.23 0 0114.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 013.434 1.279 9.768 9.768 0 00-6.963-6.963z" })
|
|
4031
|
-
] }),
|
|
4032
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ellipsis whitespace-nowrap overflow-hidden w-full", children: file.name })
|
|
4033
|
-
]
|
|
4225
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4226
|
+
Field,
|
|
4227
|
+
{
|
|
4228
|
+
label,
|
|
4229
|
+
htmlFor,
|
|
4230
|
+
errorId,
|
|
4231
|
+
errorMessage: effectiveError,
|
|
4232
|
+
required,
|
|
4233
|
+
children: [
|
|
4234
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4235
|
+
"div",
|
|
4236
|
+
{
|
|
4237
|
+
role: "button",
|
|
4238
|
+
tabIndex: disabled ? -1 : 0,
|
|
4239
|
+
"aria-label": typeof prompt === "string" ? prompt : "Upload file",
|
|
4240
|
+
"aria-disabled": disabled || void 0,
|
|
4241
|
+
"aria-invalid": effectiveError != null || void 0,
|
|
4242
|
+
"aria-describedby": effectiveError != null ? errorId : void 0,
|
|
4243
|
+
onClick: openPicker,
|
|
4244
|
+
onKeyDown: (e) => {
|
|
4245
|
+
if (disabled) return;
|
|
4246
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
4247
|
+
e.preventDefault();
|
|
4248
|
+
openPicker();
|
|
4249
|
+
}
|
|
4034
4250
|
},
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4251
|
+
onDragOver: (e) => {
|
|
4252
|
+
e.preventDefault();
|
|
4253
|
+
if (!disabled) setDragging(true);
|
|
4254
|
+
},
|
|
4255
|
+
onDragLeave: () => setDragging(false),
|
|
4256
|
+
onDrop,
|
|
4257
|
+
className: [
|
|
4258
|
+
"group flex flex-col items-center justify-center gap-3 w-full rounded-xl border border-dashed px-6 py-8 text-center",
|
|
4259
|
+
"transition-colors duration-150 focus:outline-none focus-visible:ring-[3px] focus-visible:ring-focus-ring",
|
|
4260
|
+
disabled ? "border-border bg-surface-raised cursor-not-allowed opacity-60" : effectiveError != null ? "border-status-error bg-surface cursor-pointer" : dragging ? "border-accent bg-surface-raised cursor-copy" : "border-border bg-surface hover:border-border-strong cursor-pointer"
|
|
4261
|
+
].join(" "),
|
|
4262
|
+
children: [
|
|
4263
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4264
|
+
"input",
|
|
4265
|
+
{
|
|
4266
|
+
id: htmlFor ?? name,
|
|
4267
|
+
name,
|
|
4268
|
+
onChange: (e) => commit(Array.from(e.target.files ?? [])),
|
|
4269
|
+
ref: inputRef,
|
|
4270
|
+
hidden: true,
|
|
4271
|
+
type: "file",
|
|
4272
|
+
accept,
|
|
4273
|
+
multiple: allowMultiple,
|
|
4274
|
+
disabled
|
|
4275
|
+
}
|
|
4276
|
+
),
|
|
4277
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4278
|
+
"span",
|
|
4279
|
+
{
|
|
4280
|
+
className: [
|
|
4281
|
+
"flex h-11 w-11 items-center justify-center rounded-full transition-colors duration-150",
|
|
4282
|
+
dragging ? "bg-accent text-accent-fg" : "bg-surface-raised text-foreground-secondary group-hover:text-foreground"
|
|
4283
|
+
].join(" "),
|
|
4284
|
+
children: icon ?? UploadGlyph
|
|
4285
|
+
}
|
|
4286
|
+
),
|
|
4287
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
|
|
4288
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-foreground", children: dragging ? "Drop to upload" : prompt }),
|
|
4289
|
+
hint && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-foreground-muted", children: hint })
|
|
4290
|
+
] })
|
|
4291
|
+
]
|
|
4292
|
+
}
|
|
4293
|
+
),
|
|
4294
|
+
files.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "mt-3 flex flex-col gap-2", children: files.map((file, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4295
|
+
"li",
|
|
4296
|
+
{
|
|
4297
|
+
className: "flex items-center gap-3 rounded-lg border border-border bg-surface px-3 py-2",
|
|
4298
|
+
children: [
|
|
4299
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 text-foreground-muted", children: FileGlyph }),
|
|
4300
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex-1 min-w-0", children: [
|
|
4301
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-sm text-foreground truncate", children: file.name }),
|
|
4302
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-foreground-muted", children: formatBytes(file.size) })
|
|
4303
|
+
] }),
|
|
4304
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4305
|
+
"button",
|
|
4306
|
+
{
|
|
4307
|
+
type: "button",
|
|
4308
|
+
onClick: (e) => {
|
|
4309
|
+
e.stopPropagation();
|
|
4310
|
+
removeFile(idx);
|
|
4311
|
+
},
|
|
4312
|
+
"aria-label": `Remove ${file.name}`,
|
|
4313
|
+
className: "flex-shrink-0 w-7 h-7 inline-flex items-center justify-center rounded-md text-foreground-muted hover:text-status-error hover:bg-surface-raised transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
4314
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
4315
|
+
}
|
|
4316
|
+
)
|
|
4317
|
+
]
|
|
4318
|
+
},
|
|
4319
|
+
`${idx}-${file.name}`
|
|
4320
|
+
)) })
|
|
4321
|
+
]
|
|
4322
|
+
}
|
|
4040
4323
|
);
|
|
4041
4324
|
}
|
|
4042
4325
|
var MONTH_NAMES = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
@@ -4091,7 +4374,8 @@ function DatePicker({
|
|
|
4091
4374
|
style,
|
|
4092
4375
|
format = defaultFormat,
|
|
4093
4376
|
weekStartsOn = 0,
|
|
4094
|
-
clearable = true
|
|
4377
|
+
clearable = true,
|
|
4378
|
+
size = "md"
|
|
4095
4379
|
}) {
|
|
4096
4380
|
const errorId = React8.useId();
|
|
4097
4381
|
const hasError = errorMessage != null;
|
|
@@ -4194,7 +4478,7 @@ function DatePicker({
|
|
|
4194
4478
|
"aria-describedby": hasError ? errorId : void 0,
|
|
4195
4479
|
"aria-haspopup": "dialog",
|
|
4196
4480
|
"aria-expanded": open,
|
|
4197
|
-
className: `flex items-center justify-between
|
|
4481
|
+
className: `flex items-center justify-between cursor-pointer select-none ${!style?.width ? "min-w-[200px]" : ""} ${fieldShell({ size, hasError, disabled })}`,
|
|
4198
4482
|
children: [
|
|
4199
4483
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `text-sm truncate ${displayValue ? "" : "text-foreground-muted"}`, children: displayValue || placeholder }),
|
|
4200
4484
|
/* @__PURE__ */ jsxRuntime.jsx(CalendarIcon, {})
|
|
@@ -4409,6 +4693,7 @@ exports.ContextMenu = ContextMenu;
|
|
|
4409
4693
|
exports.Drawer = Drawer;
|
|
4410
4694
|
exports.Dropdown = Dropdown;
|
|
4411
4695
|
exports.FadingBase = FadingBase;
|
|
4696
|
+
exports.Field = Field;
|
|
4412
4697
|
exports.FileInput = FileInput;
|
|
4413
4698
|
exports.Flex = Flex;
|
|
4414
4699
|
exports.Grid = Grid2;
|
|
@@ -4423,6 +4708,7 @@ exports.NumberInput = NumberInput;
|
|
|
4423
4708
|
exports.OpaqueGridCard = OpaqueGridCard;
|
|
4424
4709
|
exports.Password = Password;
|
|
4425
4710
|
exports.Portal = Portal;
|
|
4711
|
+
exports.RadioGroup = RadioGroup;
|
|
4426
4712
|
exports.ScalableContainer = ScalableContainer;
|
|
4427
4713
|
exports.SearchInput = SearchInput_default;
|
|
4428
4714
|
exports.Sidebar = Sidebar;
|
|
@@ -4445,6 +4731,7 @@ exports.Tree = Tree;
|
|
|
4445
4731
|
exports.TreeSelect = TreeSelect;
|
|
4446
4732
|
exports.Typography = Typography;
|
|
4447
4733
|
exports.Wizard = Wizard;
|
|
4734
|
+
exports.fieldShell = fieldShell;
|
|
4448
4735
|
exports.useNotification = useNotification;
|
|
4449
4736
|
//# sourceMappingURL=index.cjs.map
|
|
4450
4737
|
//# sourceMappingURL=index.cjs.map
|