@platned/ui 0.7.0 → 0.7.1
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 +1146 -913
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +79 -15
- package/dist/index.d.ts +79 -15
- package/dist/index.js +1234 -995
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2162,25 +2162,382 @@ var Select = (0, import_react16.forwardRef)(function Select2({
|
|
|
2162
2162
|
});
|
|
2163
2163
|
|
|
2164
2164
|
// src/components/forms/date-picker.tsx
|
|
2165
|
+
var import_react19 = require("react");
|
|
2166
|
+
var import_clsx16 = __toESM(require("clsx"), 1);
|
|
2167
|
+
var import_lucide_react3 = require("lucide-react");
|
|
2168
|
+
|
|
2169
|
+
// src/components/overlays/popover.tsx
|
|
2165
2170
|
var import_react17 = require("react");
|
|
2171
|
+
var import_radix_ui = require("radix-ui");
|
|
2172
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2173
|
+
var PopoverTriggerNode = (0, import_react17.createContext)(null);
|
|
2174
|
+
function Popover({ children, open, defaultOpen, onOpenChange, modal = false }) {
|
|
2175
|
+
const [node, setNode] = (0, import_react17.useState)(null);
|
|
2176
|
+
const trigger = (0, import_react17.useMemo)(() => ({ node, setNode, modal }), [node, modal]);
|
|
2177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2178
|
+
import_radix_ui.Popover.Root,
|
|
2179
|
+
{
|
|
2180
|
+
open,
|
|
2181
|
+
defaultOpen,
|
|
2182
|
+
onOpenChange,
|
|
2183
|
+
modal,
|
|
2184
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PopoverTriggerNode.Provider, { value: trigger, children })
|
|
2185
|
+
}
|
|
2186
|
+
);
|
|
2187
|
+
}
|
|
2188
|
+
var PopoverTrigger = (0, import_react17.forwardRef)(
|
|
2189
|
+
function PopoverTrigger2(props, ref) {
|
|
2190
|
+
const trigger = (0, import_react17.useContext)(PopoverTriggerNode);
|
|
2191
|
+
const fallbackId = (0, import_react17.useId)();
|
|
2192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2193
|
+
import_radix_ui.Popover.Trigger,
|
|
2194
|
+
{
|
|
2195
|
+
ref: composeRefs(ref, trigger?.setNode),
|
|
2196
|
+
id: props.id ?? fallbackId,
|
|
2197
|
+
...props
|
|
2198
|
+
}
|
|
2199
|
+
);
|
|
2200
|
+
}
|
|
2201
|
+
);
|
|
2202
|
+
var PopoverContent = (0, import_react17.forwardRef)(
|
|
2203
|
+
function PopoverContent2({ children, side = "bottom", align = "center", sideOffset = 8, label, container, className, onOpenAutoFocus, ...rest }, ref) {
|
|
2204
|
+
const trigger = (0, import_react17.useContext)(PopoverTriggerNode);
|
|
2205
|
+
const inherited = usePortalContainer();
|
|
2206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_radix_ui.Popover.Portal, { container: container ?? inherited ?? void 0, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2207
|
+
import_radix_ui.Popover.Content,
|
|
2208
|
+
{
|
|
2209
|
+
ref,
|
|
2210
|
+
side,
|
|
2211
|
+
align,
|
|
2212
|
+
sideOffset,
|
|
2213
|
+
collisionPadding: 8,
|
|
2214
|
+
onOpenAutoFocus,
|
|
2215
|
+
onEscapeKeyDown: (event) => void deferEscapeToInnerPopup(event),
|
|
2216
|
+
"aria-modal": trigger?.modal || void 0,
|
|
2217
|
+
"aria-label": label,
|
|
2218
|
+
"aria-labelledby": label ? void 0 : trigger?.node?.id || void 0,
|
|
2219
|
+
className: cn(
|
|
2220
|
+
"z-popover max-w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-default bg-default p-4 shadow-400",
|
|
2221
|
+
"focus:outline-none",
|
|
2222
|
+
className
|
|
2223
|
+
),
|
|
2224
|
+
...rest,
|
|
2225
|
+
children
|
|
2226
|
+
}
|
|
2227
|
+
) });
|
|
2228
|
+
}
|
|
2229
|
+
);
|
|
2230
|
+
var PopoverClose = (0, import_react17.forwardRef)(
|
|
2231
|
+
function PopoverClose2(props, ref) {
|
|
2232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_radix_ui.Popover.Close, { ref, ...props });
|
|
2233
|
+
}
|
|
2234
|
+
);
|
|
2235
|
+
var PopoverAnchor = (0, import_react17.forwardRef)(
|
|
2236
|
+
function PopoverAnchor2(props, ref) {
|
|
2237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_radix_ui.Popover.Anchor, { ref, ...props });
|
|
2238
|
+
}
|
|
2239
|
+
);
|
|
2240
|
+
|
|
2241
|
+
// src/components/forms/calendar.tsx
|
|
2242
|
+
var import_react18 = require("react");
|
|
2166
2243
|
var import_clsx15 = __toESM(require("clsx"), 1);
|
|
2167
2244
|
var import_lucide_react2 = require("lucide-react");
|
|
2168
|
-
var
|
|
2169
|
-
var
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2245
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2246
|
+
var CAPTION_SELECT = (0, import_clsx15.default)(
|
|
2247
|
+
"h-7 appearance-none rounded-md border border-default bg-default px-2 text-body-xs font-medium text-default",
|
|
2248
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default"
|
|
2249
|
+
);
|
|
2250
|
+
var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
2251
|
+
var sameDay = (a, b) => !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
2252
|
+
var addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
|
|
2253
|
+
var addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
2254
|
+
var isBefore = (a, b) => startOfDay(a).getTime() < startOfDay(b).getTime();
|
|
2255
|
+
var isAfter = (a, b) => startOfDay(a).getTime() > startOfDay(b).getTime();
|
|
2256
|
+
var inRange = (d, from, to) => startOfDay(d).getTime() > startOfDay(from).getTime() && startOfDay(d).getTime() < startOfDay(to).getTime();
|
|
2257
|
+
function monthGrid(month, weekStartsOn) {
|
|
2258
|
+
const first = new Date(month.getFullYear(), month.getMonth(), 1);
|
|
2259
|
+
const offset2 = (first.getDay() - weekStartsOn + 7) % 7;
|
|
2260
|
+
const start = addDays(first, -offset2);
|
|
2261
|
+
return Array.from({ length: 42 }, (_, i) => addDays(start, i));
|
|
2262
|
+
}
|
|
2263
|
+
function Calendar({
|
|
2264
|
+
mode = "single",
|
|
2265
|
+
value,
|
|
2266
|
+
range,
|
|
2267
|
+
onSelect,
|
|
2268
|
+
onRangeChange,
|
|
2269
|
+
defaultMonth,
|
|
2270
|
+
min,
|
|
2271
|
+
max,
|
|
2272
|
+
isDateDisabled,
|
|
2273
|
+
weekStartsOn = 1,
|
|
2274
|
+
locale,
|
|
2275
|
+
label = "Calendar",
|
|
2276
|
+
captionLayout = "label",
|
|
2277
|
+
startYear,
|
|
2278
|
+
endYear,
|
|
2279
|
+
className,
|
|
2280
|
+
...rest
|
|
2281
|
+
}) {
|
|
2282
|
+
const today = (0, import_react18.useMemo)(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
2283
|
+
const gridId = (0, import_react18.useId)();
|
|
2284
|
+
const [month, setMonth] = (0, import_react18.useState)(
|
|
2285
|
+
() => defaultMonth ?? value ?? range?.from ?? today
|
|
2286
|
+
);
|
|
2287
|
+
const [focusedDate, setFocusedDate] = (0, import_react18.useState)(
|
|
2288
|
+
() => value ?? range?.from ?? today
|
|
2289
|
+
);
|
|
2290
|
+
const cellRefs = (0, import_react18.useRef)(/* @__PURE__ */ new Map());
|
|
2291
|
+
const monthFormatter = (0, import_react18.useMemo)(
|
|
2292
|
+
() => new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }),
|
|
2293
|
+
[locale]
|
|
2294
|
+
);
|
|
2295
|
+
const dayNameFormatter = (0, import_react18.useMemo)(
|
|
2296
|
+
() => new Intl.DateTimeFormat(locale, { weekday: "short" }),
|
|
2297
|
+
[locale]
|
|
2298
|
+
);
|
|
2299
|
+
const monthNameFormatter = (0, import_react18.useMemo)(
|
|
2300
|
+
() => new Intl.DateTimeFormat(locale, { month: "long" }),
|
|
2301
|
+
[locale]
|
|
2302
|
+
);
|
|
2303
|
+
const fullDateFormatter = (0, import_react18.useMemo)(
|
|
2304
|
+
() => new Intl.DateTimeFormat(locale, { weekday: "long", day: "numeric", month: "long", year: "numeric" }),
|
|
2305
|
+
[locale]
|
|
2306
|
+
);
|
|
2307
|
+
const disabled = (0, import_react18.useCallback)(
|
|
2308
|
+
(date) => {
|
|
2309
|
+
if (min && isBefore(date, min)) return true;
|
|
2310
|
+
if (max && isAfter(date, max)) return true;
|
|
2311
|
+
return isDateDisabled?.(date) ?? false;
|
|
2312
|
+
},
|
|
2313
|
+
[min, max, isDateDisabled]
|
|
2314
|
+
);
|
|
2315
|
+
const key = (d) => `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
2316
|
+
const pendingFocus = (0, import_react18.useRef)(false);
|
|
2317
|
+
const focusDate = (0, import_react18.useCallback)((date) => {
|
|
2318
|
+
pendingFocus.current = true;
|
|
2319
|
+
setFocusedDate(date);
|
|
2320
|
+
setMonth(
|
|
2321
|
+
(current) => current.getFullYear() === date.getFullYear() && current.getMonth() === date.getMonth() ? current : new Date(date.getFullYear(), date.getMonth(), 1)
|
|
2322
|
+
);
|
|
2323
|
+
}, []);
|
|
2324
|
+
(0, import_react18.useEffect)(() => {
|
|
2325
|
+
if (!pendingFocus.current) return;
|
|
2326
|
+
const node = cellRefs.current.get(key(focusedDate));
|
|
2327
|
+
if (node) {
|
|
2328
|
+
node.focus();
|
|
2329
|
+
pendingFocus.current = false;
|
|
2330
|
+
}
|
|
2331
|
+
}, [focusedDate, month]);
|
|
2332
|
+
const select = (date) => {
|
|
2333
|
+
if (disabled(date)) return;
|
|
2334
|
+
setFocusedDate(date);
|
|
2335
|
+
if (mode === "single") {
|
|
2336
|
+
onSelect?.(date);
|
|
2337
|
+
return;
|
|
2338
|
+
}
|
|
2339
|
+
const current = range ?? { from: null, to: null };
|
|
2340
|
+
if (!current.from || current.to || isBefore(date, current.from)) {
|
|
2341
|
+
onRangeChange?.({ from: date, to: null });
|
|
2342
|
+
} else {
|
|
2343
|
+
onRangeChange?.({ from: current.from, to: date });
|
|
2344
|
+
}
|
|
2345
|
+
};
|
|
2346
|
+
const onKeyDown = (event) => {
|
|
2347
|
+
const moves = {
|
|
2348
|
+
ArrowLeft: () => addDays(focusedDate, -1),
|
|
2349
|
+
ArrowRight: () => addDays(focusedDate, 1),
|
|
2350
|
+
ArrowUp: () => addDays(focusedDate, -7),
|
|
2351
|
+
ArrowDown: () => addDays(focusedDate, 7),
|
|
2352
|
+
Home: () => addDays(focusedDate, -((focusedDate.getDay() - weekStartsOn + 7) % 7)),
|
|
2353
|
+
End: () => addDays(focusedDate, 6 - (focusedDate.getDay() - weekStartsOn + 7) % 7),
|
|
2354
|
+
// Shift moves a year (APG date-picker dialog); without it, a month.
|
|
2355
|
+
PageUp: () => new Date(focusedDate.getFullYear() - (event.shiftKey ? 1 : 0), focusedDate.getMonth() - (event.shiftKey ? 0 : 1), focusedDate.getDate()),
|
|
2356
|
+
PageDown: () => new Date(focusedDate.getFullYear() + (event.shiftKey ? 1 : 0), focusedDate.getMonth() + (event.shiftKey ? 0 : 1), focusedDate.getDate())
|
|
2357
|
+
};
|
|
2358
|
+
const move = moves[event.key];
|
|
2359
|
+
if (move) {
|
|
2360
|
+
event.preventDefault();
|
|
2361
|
+
focusDate(move());
|
|
2362
|
+
}
|
|
2363
|
+
};
|
|
2364
|
+
const firstYear = startYear ?? min?.getFullYear() ?? today.getFullYear() - 100;
|
|
2365
|
+
const lastYear = endYear ?? max?.getFullYear() ?? today.getFullYear() + 10;
|
|
2366
|
+
const years = Array.from({ length: Math.max(0, lastYear - firstYear) + 1 }, (_, i) => firstYear + i);
|
|
2367
|
+
const monthOutOfRange = (m) => !!min && (month.getFullYear() < min.getFullYear() || month.getFullYear() === min.getFullYear() && m < min.getMonth()) || !!max && (month.getFullYear() > max.getFullYear() || month.getFullYear() === max.getFullYear() && m > max.getMonth());
|
|
2368
|
+
const showMonth = (year, m) => {
|
|
2369
|
+
let next = new Date(year, m, 1);
|
|
2370
|
+
if (min && next < new Date(min.getFullYear(), min.getMonth(), 1)) next = new Date(min.getFullYear(), min.getMonth(), 1);
|
|
2371
|
+
if (max && next > new Date(max.getFullYear(), max.getMonth(), 1)) next = new Date(max.getFullYear(), max.getMonth(), 1);
|
|
2372
|
+
setMonth(next);
|
|
2373
|
+
const day = Math.min(focusedDate.getDate(), new Date(next.getFullYear(), next.getMonth() + 1, 0).getDate());
|
|
2374
|
+
setFocusedDate(new Date(next.getFullYear(), next.getMonth(), day));
|
|
2375
|
+
};
|
|
2376
|
+
const days = monthGrid(month, weekStartsOn);
|
|
2377
|
+
const weekdayNames = days.slice(0, 7).map((d) => dayNameFormatter.format(d));
|
|
2378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2379
|
+
"div",
|
|
2380
|
+
{
|
|
2381
|
+
"data-slot": "calendar",
|
|
2382
|
+
className: cn("w-fit rounded-xl border border-default bg-default p-3", className),
|
|
2383
|
+
...rest,
|
|
2384
|
+
children: [
|
|
2385
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
2386
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2387
|
+
IconButton,
|
|
2388
|
+
{
|
|
2389
|
+
variant: "subtle",
|
|
2390
|
+
size: "sm",
|
|
2391
|
+
"aria-label": "Previous month",
|
|
2392
|
+
disabled: !!min && isBefore(addMonths(month, -1), new Date(min.getFullYear(), min.getMonth(), 1)),
|
|
2393
|
+
onClick: () => setMonth(addMonths(month, -1)),
|
|
2394
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react2.ChevronLeftIcon, { "aria-hidden": true, size: 16 })
|
|
2395
|
+
}
|
|
2396
|
+
),
|
|
2397
|
+
captionLayout === "dropdown" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
2398
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2399
|
+
"select",
|
|
2400
|
+
{
|
|
2401
|
+
"aria-label": "Month",
|
|
2402
|
+
value: month.getMonth(),
|
|
2403
|
+
onChange: (event) => showMonth(month.getFullYear(), Number(event.target.value)),
|
|
2404
|
+
className: CAPTION_SELECT,
|
|
2405
|
+
children: Array.from({ length: 12 }, (_, m) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: m, disabled: monthOutOfRange(m), children: monthNameFormatter.format(new Date(2e3, m, 1)) }, m))
|
|
2406
|
+
}
|
|
2407
|
+
),
|
|
2408
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2409
|
+
"select",
|
|
2410
|
+
{
|
|
2411
|
+
"aria-label": "Year",
|
|
2412
|
+
value: month.getFullYear(),
|
|
2413
|
+
onChange: (event) => showMonth(Number(event.target.value), month.getMonth()),
|
|
2414
|
+
className: CAPTION_SELECT,
|
|
2415
|
+
children: years.map((year) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: year, children: year }, year))
|
|
2416
|
+
}
|
|
2417
|
+
),
|
|
2418
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-live": "polite", className: "sr-only", children: monthFormatter.format(month) })
|
|
2419
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-live": "polite", className: "text-body-sm font-semibold text-default", children: monthFormatter.format(month) }),
|
|
2420
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2421
|
+
IconButton,
|
|
2422
|
+
{
|
|
2423
|
+
variant: "subtle",
|
|
2424
|
+
size: "sm",
|
|
2425
|
+
"aria-label": "Next month",
|
|
2426
|
+
disabled: !!max && isAfter(addMonths(month, 1), new Date(max.getFullYear(), max.getMonth(), 1)),
|
|
2427
|
+
onClick: () => setMonth(addMonths(month, 1)),
|
|
2428
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react2.ChevronRightIcon, { "aria-hidden": true, size: 16 })
|
|
2429
|
+
}
|
|
2430
|
+
)
|
|
2431
|
+
] }),
|
|
2432
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2433
|
+
"div",
|
|
2434
|
+
{
|
|
2435
|
+
role: "grid",
|
|
2436
|
+
"aria-label": label,
|
|
2437
|
+
id: gridId,
|
|
2438
|
+
tabIndex: -1,
|
|
2439
|
+
onKeyDown,
|
|
2440
|
+
children: [
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { role: "row", className: "mb-1 grid grid-cols-7", children: weekdayNames.map((name) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2442
|
+
"div",
|
|
2443
|
+
{
|
|
2444
|
+
role: "columnheader",
|
|
2445
|
+
className: "flex h-8 items-center justify-center text-body-tiny font-medium text-default-tertiary",
|
|
2446
|
+
children: name
|
|
2447
|
+
},
|
|
2448
|
+
name
|
|
2449
|
+
)) }),
|
|
2450
|
+
Array.from({ length: 6 }, (_, week) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { role: "row", className: "grid grid-cols-7", children: days.slice(week * 7, week * 7 + 7).map((date) => {
|
|
2451
|
+
const outside = date.getMonth() !== month.getMonth();
|
|
2452
|
+
const isDisabled = disabled(date);
|
|
2453
|
+
const selected = mode === "single" ? sameDay(date, value) : sameDay(date, range?.from) || sameDay(date, range?.to);
|
|
2454
|
+
const between = mode === "range" && range?.from && range?.to ? inRange(date, range.from, range.to) : false;
|
|
2455
|
+
const isFocused = sameDay(date, focusedDate);
|
|
2456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { role: "gridcell", "aria-selected": selected || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2457
|
+
"button",
|
|
2458
|
+
{
|
|
2459
|
+
ref: (node) => {
|
|
2460
|
+
if (node) cellRefs.current.set(key(date), node);
|
|
2461
|
+
else cellRefs.current.delete(key(date));
|
|
2462
|
+
},
|
|
2463
|
+
type: "button",
|
|
2464
|
+
tabIndex: isFocused ? 0 : -1,
|
|
2465
|
+
disabled: isDisabled,
|
|
2466
|
+
"aria-label": fullDateFormatter.format(date),
|
|
2467
|
+
"aria-current": sameDay(date, today) ? "date" : void 0,
|
|
2468
|
+
onClick: () => select(date),
|
|
2469
|
+
onFocus: () => setFocusedDate(date),
|
|
2470
|
+
className: (0, import_clsx15.default)(
|
|
2471
|
+
"flex size-9 items-center justify-center rounded-lg text-body-sm tabular-nums transition-colors",
|
|
2472
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default",
|
|
2473
|
+
"disabled:cursor-not-allowed disabled:text-disabled disabled:hover:bg-transparent",
|
|
2474
|
+
selected ? "bg-brand font-semibold text-brand-on-brand" : between ? "rounded-none bg-brand-tertiary text-default" : outside ? "text-default-tertiary hover:bg-default-secondary" : "text-default hover:bg-default-secondary",
|
|
2475
|
+
// Today is marked by a ring rather than a fill, so it stays legible
|
|
2476
|
+
// when it is also the selected day.
|
|
2477
|
+
sameDay(date, today) && !selected && "ring-1 ring-inset ring-brand-tertiary"
|
|
2478
|
+
),
|
|
2479
|
+
children: date.getDate()
|
|
2480
|
+
}
|
|
2481
|
+
) }, key(date));
|
|
2482
|
+
}) }, week))
|
|
2483
|
+
]
|
|
2484
|
+
}
|
|
2485
|
+
)
|
|
2486
|
+
]
|
|
2487
|
+
}
|
|
2488
|
+
);
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
// src/components/forms/date-picker.tsx
|
|
2492
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2493
|
+
var triggerBase = {
|
|
2494
|
+
lg: "h-12 px-5 pr-12 text-body",
|
|
2495
|
+
md: "h-9 px-4 pr-8 text-body-sm",
|
|
2496
|
+
sm: "h-6 px-3 pr-6 text-body-tiny"
|
|
2173
2497
|
};
|
|
2174
2498
|
var iconWrap2 = {
|
|
2175
2499
|
lg: { right: "right-4", size: "size-5" },
|
|
2176
2500
|
md: { right: "right-3", size: "size-4" },
|
|
2177
2501
|
sm: { right: "right-2", size: "size-3" }
|
|
2178
2502
|
};
|
|
2179
|
-
var
|
|
2503
|
+
var ISO = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
2504
|
+
function parseIso(value) {
|
|
2505
|
+
const match = value ? ISO.exec(value) : null;
|
|
2506
|
+
if (!match) return null;
|
|
2507
|
+
const date = new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));
|
|
2508
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
2509
|
+
}
|
|
2510
|
+
function toIso(date) {
|
|
2511
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
2512
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
2513
|
+
}
|
|
2514
|
+
var DatePicker = (0, import_react19.forwardRef)(function DatePicker2({
|
|
2515
|
+
label,
|
|
2516
|
+
description,
|
|
2517
|
+
error,
|
|
2518
|
+
hint,
|
|
2519
|
+
size: sizeProp,
|
|
2520
|
+
className,
|
|
2521
|
+
disabled,
|
|
2522
|
+
required,
|
|
2523
|
+
id,
|
|
2524
|
+
value: valueProp,
|
|
2525
|
+
defaultValue,
|
|
2526
|
+
onChange,
|
|
2527
|
+
onValueChange,
|
|
2528
|
+
onBlur,
|
|
2529
|
+
placeholder = "Pick a date",
|
|
2530
|
+
locale,
|
|
2531
|
+
weekStartsOn,
|
|
2532
|
+
captionLayout = "dropdown",
|
|
2533
|
+
startYear,
|
|
2534
|
+
endYear,
|
|
2535
|
+
min,
|
|
2536
|
+
max,
|
|
2537
|
+
...props
|
|
2538
|
+
}, ref) {
|
|
2180
2539
|
const size2 = useControlSize(sizeProp);
|
|
2181
|
-
|
|
2182
|
-
const iw = iconWrap2[size2];
|
|
2183
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2184
2541
|
Field,
|
|
2185
2542
|
{
|
|
2186
2543
|
id,
|
|
@@ -2188,79 +2545,190 @@ var DatePicker = (0, import_react17.forwardRef)(function DatePicker2({ label, de
|
|
|
2188
2545
|
disabled,
|
|
2189
2546
|
required,
|
|
2190
2547
|
hasDescription: !!description,
|
|
2191
|
-
hasError,
|
|
2548
|
+
hasError: !!error,
|
|
2192
2549
|
hasHint: !!hint,
|
|
2193
2550
|
className,
|
|
2194
2551
|
children: [
|
|
2195
|
-
label && /* @__PURE__ */ (0,
|
|
2196
|
-
description && /* @__PURE__ */ (0,
|
|
2197
|
-
/* @__PURE__ */ (0,
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
] }),
|
|
2224
|
-
hasError && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FieldError, { children: error }),
|
|
2225
|
-
!hasError && hint && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FieldHint, { children: hint })
|
|
2552
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FieldLabel, { children: label }),
|
|
2553
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FieldDescription, { children: description }),
|
|
2554
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2555
|
+
DateControl,
|
|
2556
|
+
{
|
|
2557
|
+
ref,
|
|
2558
|
+
size: size2,
|
|
2559
|
+
invalid: !!error,
|
|
2560
|
+
disabled,
|
|
2561
|
+
required,
|
|
2562
|
+
value: valueProp,
|
|
2563
|
+
defaultValue,
|
|
2564
|
+
onChange,
|
|
2565
|
+
onValueChange,
|
|
2566
|
+
onBlur,
|
|
2567
|
+
placeholder,
|
|
2568
|
+
locale,
|
|
2569
|
+
weekStartsOn,
|
|
2570
|
+
captionLayout,
|
|
2571
|
+
startYear,
|
|
2572
|
+
endYear,
|
|
2573
|
+
min: typeof min === "number" ? String(min) : min,
|
|
2574
|
+
max: typeof max === "number" ? String(max) : max,
|
|
2575
|
+
label,
|
|
2576
|
+
inputProps: props
|
|
2577
|
+
}
|
|
2578
|
+
),
|
|
2579
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FieldError, { children: error }) : hint && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FieldHint, { children: hint })
|
|
2226
2580
|
]
|
|
2227
2581
|
}
|
|
2228
2582
|
);
|
|
2229
2583
|
});
|
|
2230
|
-
var
|
|
2231
|
-
|
|
2584
|
+
var DateControl = (0, import_react19.forwardRef)(function DateControl2({
|
|
2585
|
+
size: size2,
|
|
2586
|
+
invalid,
|
|
2587
|
+
disabled,
|
|
2588
|
+
required,
|
|
2589
|
+
value,
|
|
2590
|
+
defaultValue,
|
|
2591
|
+
onChange,
|
|
2592
|
+
onValueChange,
|
|
2593
|
+
onBlur,
|
|
2594
|
+
placeholder,
|
|
2595
|
+
locale,
|
|
2596
|
+
weekStartsOn,
|
|
2597
|
+
captionLayout,
|
|
2598
|
+
startYear,
|
|
2599
|
+
endYear,
|
|
2600
|
+
min,
|
|
2601
|
+
max,
|
|
2602
|
+
label,
|
|
2603
|
+
inputProps: { name, ...inputProps }
|
|
2604
|
+
}, ref) {
|
|
2232
2605
|
const field = useFieldControl();
|
|
2606
|
+
const fieldContext = useFieldContext();
|
|
2607
|
+
const valueId = (0, import_react19.useId)();
|
|
2608
|
+
const dialogId = (0, import_react19.useId)();
|
|
2609
|
+
const [open, setOpen] = (0, import_react19.useState)(false);
|
|
2610
|
+
const [internal, setInternal] = (0, import_react19.useState)(defaultValue ?? "");
|
|
2611
|
+
const iso = value ?? internal;
|
|
2612
|
+
const date = parseIso(iso);
|
|
2613
|
+
const triggerRef = (0, import_react19.useRef)(null);
|
|
2614
|
+
const inputRef = (0, import_react19.useRef)(null);
|
|
2615
|
+
const contentRef = (0, import_react19.useRef)(null);
|
|
2233
2616
|
const isInvalid = invalid || !!field["aria-invalid"];
|
|
2234
|
-
const isDisabled =
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
"[&::-webkit-calendar-picker-indicator]:opacity-0",
|
|
2246
|
-
"[&::-webkit-calendar-picker-indicator]:absolute",
|
|
2247
|
-
"[&::-webkit-calendar-picker-indicator]:right-0",
|
|
2248
|
-
"[&::-webkit-calendar-picker-indicator]:h-full",
|
|
2249
|
-
"[&::-webkit-calendar-picker-indicator]:w-10",
|
|
2250
|
-
"[&::-webkit-calendar-picker-indicator]:cursor-pointer",
|
|
2251
|
-
inputBase2[size2],
|
|
2252
|
-
isDisabled ? "cursor-not-allowed border-disabled bg-disabled text-disabled" : isInvalid ? "border-danger-secondary focus-visible:border-danger focus-visible:ring-danger" : "border-default focus-visible:border-brand focus-visible:ring-brand",
|
|
2253
|
-
className
|
|
2254
|
-
),
|
|
2255
|
-
...props
|
|
2617
|
+
const isDisabled = disabled ?? field.disabled;
|
|
2618
|
+
const iw = iconWrap2[size2];
|
|
2619
|
+
const formatter = (0, import_react19.useMemo)(() => new Intl.DateTimeFormat(locale, { dateStyle: "medium" }), [locale]);
|
|
2620
|
+
const commit = (next) => {
|
|
2621
|
+
const nextIso = toIso(next);
|
|
2622
|
+
if (value === void 0) setInternal(nextIso);
|
|
2623
|
+
onValueChange?.(nextIso);
|
|
2624
|
+
const input = inputRef.current;
|
|
2625
|
+
if (input) {
|
|
2626
|
+
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set?.call(input, nextIso);
|
|
2627
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
2256
2628
|
}
|
|
2257
|
-
|
|
2629
|
+
setOpen(false);
|
|
2630
|
+
};
|
|
2631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative flex items-center", children: [
|
|
2632
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
2633
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2634
|
+
"button",
|
|
2635
|
+
{
|
|
2636
|
+
ref: triggerRef,
|
|
2637
|
+
type: "button",
|
|
2638
|
+
role: "combobox",
|
|
2639
|
+
"aria-haspopup": "dialog",
|
|
2640
|
+
"aria-expanded": open,
|
|
2641
|
+
"aria-controls": open ? dialogId : void 0,
|
|
2642
|
+
"aria-labelledby": fieldContext ? `${fieldContext.labelId} ${valueId}` : void 0,
|
|
2643
|
+
"aria-label": fieldContext ? void 0 : label,
|
|
2644
|
+
"data-size": size2,
|
|
2645
|
+
...field,
|
|
2646
|
+
disabled: isDisabled,
|
|
2647
|
+
onBlur,
|
|
2648
|
+
className: (0, import_clsx16.default)(
|
|
2649
|
+
"w-full appearance-none rounded-lg border text-left outline-none transition-colors",
|
|
2650
|
+
"bg-default text-default",
|
|
2651
|
+
"focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-default",
|
|
2652
|
+
triggerBase[size2],
|
|
2653
|
+
isDisabled ? "cursor-not-allowed border-disabled bg-disabled text-disabled" : isInvalid ? "border-danger-secondary focus-visible:border-danger focus-visible:ring-danger" : "border-default focus-visible:border-brand focus-visible:ring-brand"
|
|
2654
|
+
),
|
|
2655
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { id: valueId, className: (0, import_clsx16.default)("block truncate", !date && "text-default-tertiary"), children: date ? formatter.format(date) : placeholder })
|
|
2656
|
+
}
|
|
2657
|
+
) }),
|
|
2658
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2659
|
+
PopoverContent,
|
|
2660
|
+
{
|
|
2661
|
+
ref: contentRef,
|
|
2662
|
+
id: dialogId,
|
|
2663
|
+
label: label ? `Choose ${label.toLowerCase()}` : "Choose date",
|
|
2664
|
+
align: "start",
|
|
2665
|
+
className: "w-auto max-w-none p-0",
|
|
2666
|
+
onOpenAutoFocus: (event) => {
|
|
2667
|
+
event.preventDefault();
|
|
2668
|
+
contentRef.current?.querySelector('[role="grid"] [tabindex="0"]')?.focus();
|
|
2669
|
+
},
|
|
2670
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2671
|
+
Calendar,
|
|
2672
|
+
{
|
|
2673
|
+
value: date,
|
|
2674
|
+
onSelect: commit,
|
|
2675
|
+
min: parseIso(min) ?? void 0,
|
|
2676
|
+
max: parseIso(max) ?? void 0,
|
|
2677
|
+
locale,
|
|
2678
|
+
weekStartsOn,
|
|
2679
|
+
captionLayout,
|
|
2680
|
+
startYear,
|
|
2681
|
+
endYear,
|
|
2682
|
+
label: label ?? "Calendar",
|
|
2683
|
+
className: "border-0"
|
|
2684
|
+
}
|
|
2685
|
+
)
|
|
2686
|
+
}
|
|
2687
|
+
)
|
|
2688
|
+
] }),
|
|
2689
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2690
|
+
"span",
|
|
2691
|
+
{
|
|
2692
|
+
"aria-hidden": true,
|
|
2693
|
+
className: (0, import_clsx16.default)(
|
|
2694
|
+
"pointer-events-none absolute",
|
|
2695
|
+
iw.right,
|
|
2696
|
+
iw.size,
|
|
2697
|
+
"flex items-center justify-center",
|
|
2698
|
+
isDisabled ? "text-icon-disabled" : "text-icon-default-secondary"
|
|
2699
|
+
),
|
|
2700
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react3.CalendarIcon, { className: "size-full" })
|
|
2701
|
+
}
|
|
2702
|
+
),
|
|
2703
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2704
|
+
"input",
|
|
2705
|
+
{
|
|
2706
|
+
ref: composeRefs(ref, inputRef),
|
|
2707
|
+
type: "date",
|
|
2708
|
+
"aria-hidden": true,
|
|
2709
|
+
tabIndex: -1,
|
|
2710
|
+
...inputProps,
|
|
2711
|
+
name,
|
|
2712
|
+
value: iso,
|
|
2713
|
+
min,
|
|
2714
|
+
max,
|
|
2715
|
+
required,
|
|
2716
|
+
disabled: isDisabled,
|
|
2717
|
+
onChange: (event) => {
|
|
2718
|
+
if (value === void 0) setInternal(event.target.value);
|
|
2719
|
+
onChange?.(event);
|
|
2720
|
+
},
|
|
2721
|
+
onFocus: () => triggerRef.current?.focus(),
|
|
2722
|
+
className: "pointer-events-none absolute inset-x-0 bottom-0 h-px w-full opacity-0"
|
|
2723
|
+
}
|
|
2724
|
+
)
|
|
2725
|
+
] });
|
|
2258
2726
|
});
|
|
2259
2727
|
|
|
2260
2728
|
// src/components/forms/stepper.tsx
|
|
2261
|
-
var
|
|
2262
|
-
var
|
|
2263
|
-
var
|
|
2729
|
+
var import_clsx17 = __toESM(require("clsx"), 1);
|
|
2730
|
+
var import_lucide_react4 = require("lucide-react");
|
|
2731
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2264
2732
|
var STATUS_TEXT = {
|
|
2265
2733
|
complete: "completed",
|
|
2266
2734
|
active: "current step",
|
|
@@ -2273,41 +2741,41 @@ var SIZE2 = {
|
|
|
2273
2741
|
function StepIndicator({ status, size: size2 }) {
|
|
2274
2742
|
const s = SIZE2[size2];
|
|
2275
2743
|
if (status === "complete") {
|
|
2276
|
-
return /* @__PURE__ */ (0,
|
|
2744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2277
2745
|
"span",
|
|
2278
2746
|
{
|
|
2279
2747
|
"aria-hidden": true,
|
|
2280
|
-
className: (0,
|
|
2748
|
+
className: (0, import_clsx17.default)(
|
|
2281
2749
|
"flex shrink-0 items-center justify-center rounded-full bg-brand text-brand-on-brand",
|
|
2282
2750
|
s.indicator
|
|
2283
2751
|
),
|
|
2284
|
-
children: /* @__PURE__ */ (0,
|
|
2752
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react4.CheckIcon, { size: s.glyph })
|
|
2285
2753
|
}
|
|
2286
2754
|
);
|
|
2287
2755
|
}
|
|
2288
2756
|
if (status === "active") {
|
|
2289
|
-
return /* @__PURE__ */ (0,
|
|
2757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2290
2758
|
"span",
|
|
2291
2759
|
{
|
|
2292
2760
|
"aria-hidden": true,
|
|
2293
|
-
className: (0,
|
|
2761
|
+
className: (0, import_clsx17.default)(
|
|
2294
2762
|
"flex shrink-0 items-center justify-center rounded-full border-2 border-brand-emphasis",
|
|
2295
2763
|
s.indicator
|
|
2296
2764
|
),
|
|
2297
|
-
children: /* @__PURE__ */ (0,
|
|
2765
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "size-2.5 rounded-full bg-brand" })
|
|
2298
2766
|
}
|
|
2299
2767
|
);
|
|
2300
2768
|
}
|
|
2301
|
-
return /* @__PURE__ */ (0,
|
|
2769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2302
2770
|
"span",
|
|
2303
2771
|
{
|
|
2304
2772
|
"aria-hidden": true,
|
|
2305
|
-
className: (0,
|
|
2773
|
+
className: (0, import_clsx17.default)("shrink-0 rounded-full border-2 border-disabled", s.indicator)
|
|
2306
2774
|
}
|
|
2307
2775
|
);
|
|
2308
2776
|
}
|
|
2309
2777
|
function ChevronSeparator() {
|
|
2310
|
-
return /* @__PURE__ */ (0,
|
|
2778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react4.ChevronRightIcon, { className: "mx-1 size-4 shrink-0 text-default-tertiary", "aria-hidden": true });
|
|
2311
2779
|
}
|
|
2312
2780
|
var labelClass = {
|
|
2313
2781
|
complete: "text-brand font-semibold",
|
|
@@ -2318,26 +2786,26 @@ function Stepper({ steps, size: size2 = "md", label = "Progress", className }) {
|
|
|
2318
2786
|
const s = SIZE2[size2];
|
|
2319
2787
|
return (
|
|
2320
2788
|
// An <ol> cannot be wrapped without breaking the list relationship with its <li>s.
|
|
2321
|
-
/* @__PURE__ */ (0,
|
|
2789
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2322
2790
|
"ol",
|
|
2323
2791
|
{
|
|
2324
|
-
className: (0,
|
|
2792
|
+
className: (0, import_clsx17.default)("flex items-center overflow-x-auto", SCROLLBAR_CLASSES, className),
|
|
2325
2793
|
"aria-label": label,
|
|
2326
|
-
children: steps.map((step, i) => /* @__PURE__ */ (0,
|
|
2794
|
+
children: steps.map((step, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2327
2795
|
"li",
|
|
2328
2796
|
{
|
|
2329
2797
|
className: "flex items-center",
|
|
2330
2798
|
"aria-current": step.status === "active" ? "step" : void 0,
|
|
2331
2799
|
children: [
|
|
2332
|
-
/* @__PURE__ */ (0,
|
|
2333
|
-
/* @__PURE__ */ (0,
|
|
2334
|
-
/* @__PURE__ */ (0,
|
|
2335
|
-
/* @__PURE__ */ (0,
|
|
2800
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "flex items-center gap-1.5", children: [
|
|
2801
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StepIndicator, { status: step.status, size: size2 }),
|
|
2802
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: (0, import_clsx17.default)("whitespace-nowrap", s.label, labelClass[step.status]), children: step.label }),
|
|
2803
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "sr-only", children: [
|
|
2336
2804
|
", ",
|
|
2337
2805
|
STATUS_TEXT[step.status]
|
|
2338
2806
|
] })
|
|
2339
2807
|
] }),
|
|
2340
|
-
i < steps.length - 1 && /* @__PURE__ */ (0,
|
|
2808
|
+
i < steps.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronSeparator, {})
|
|
2341
2809
|
]
|
|
2342
2810
|
},
|
|
2343
2811
|
step.label
|
|
@@ -2348,9 +2816,9 @@ function Stepper({ steps, size: size2 = "md", label = "Progress", className }) {
|
|
|
2348
2816
|
}
|
|
2349
2817
|
|
|
2350
2818
|
// src/components/forms/multiselect-card.tsx
|
|
2351
|
-
var
|
|
2352
|
-
var
|
|
2353
|
-
var
|
|
2819
|
+
var import_clsx18 = __toESM(require("clsx"), 1);
|
|
2820
|
+
var import_lucide_react5 = require("lucide-react");
|
|
2821
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2354
2822
|
var SIZE3 = {
|
|
2355
2823
|
default: {
|
|
2356
2824
|
pad: "p-4",
|
|
@@ -2380,7 +2848,7 @@ function MultiSelectCard({
|
|
|
2380
2848
|
className
|
|
2381
2849
|
}) {
|
|
2382
2850
|
const s = SIZE3[size2];
|
|
2383
|
-
return /* @__PURE__ */ (0,
|
|
2851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2384
2852
|
"button",
|
|
2385
2853
|
{
|
|
2386
2854
|
type: "button",
|
|
@@ -2388,7 +2856,7 @@ function MultiSelectCard({
|
|
|
2388
2856
|
"aria-checked": selected,
|
|
2389
2857
|
disabled,
|
|
2390
2858
|
onClick: onToggle,
|
|
2391
|
-
className: (0,
|
|
2859
|
+
className: (0, import_clsx18.default)(
|
|
2392
2860
|
"relative w-full rounded-2xl border-2 text-left transition-all",
|
|
2393
2861
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default",
|
|
2394
2862
|
"disabled:cursor-not-allowed disabled:opacity-60",
|
|
@@ -2397,40 +2865,40 @@ function MultiSelectCard({
|
|
|
2397
2865
|
className
|
|
2398
2866
|
),
|
|
2399
2867
|
children: [
|
|
2400
|
-
/* @__PURE__ */ (0,
|
|
2401
|
-
/* @__PURE__ */ (0,
|
|
2868
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start justify-between gap-2", children: [
|
|
2869
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2402
2870
|
"span",
|
|
2403
2871
|
{
|
|
2404
2872
|
"aria-hidden": true,
|
|
2405
|
-
className: (0,
|
|
2873
|
+
className: (0, import_clsx18.default)(
|
|
2406
2874
|
"flex shrink-0 items-center justify-center",
|
|
2407
2875
|
s.iconBox,
|
|
2408
2876
|
selected ? "bg-brand" : "bg-brand-tertiary"
|
|
2409
2877
|
),
|
|
2410
|
-
children: /* @__PURE__ */ (0,
|
|
2878
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: (0, import_clsx18.default)(s.icon, selected ? "text-icon-brand-on-brand" : "text-icon-brand"), children: icon })
|
|
2411
2879
|
}
|
|
2412
2880
|
),
|
|
2413
|
-
selected ? /* @__PURE__ */ (0,
|
|
2881
|
+
selected ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2414
2882
|
"span",
|
|
2415
2883
|
{
|
|
2416
2884
|
"aria-hidden": true,
|
|
2417
|
-
className: (0,
|
|
2885
|
+
className: (0, import_clsx18.default)(
|
|
2418
2886
|
"flex shrink-0 items-center justify-center rounded-full bg-brand text-icon-brand-on-brand",
|
|
2419
2887
|
s.mark
|
|
2420
2888
|
),
|
|
2421
|
-
children: /* @__PURE__ */ (0,
|
|
2889
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react5.CheckIcon, { className: "size-3", strokeWidth: 2.5 })
|
|
2422
2890
|
}
|
|
2423
|
-
) : /* @__PURE__ */ (0,
|
|
2891
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2424
2892
|
"span",
|
|
2425
2893
|
{
|
|
2426
2894
|
"aria-hidden": true,
|
|
2427
|
-
className: (0,
|
|
2895
|
+
className: (0, import_clsx18.default)("shrink-0 rounded-full border-2 border-default", s.mark)
|
|
2428
2896
|
}
|
|
2429
2897
|
)
|
|
2430
2898
|
] }),
|
|
2431
|
-
/* @__PURE__ */ (0,
|
|
2432
|
-
/* @__PURE__ */ (0,
|
|
2433
|
-
description && /* @__PURE__ */ (0,
|
|
2899
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: s.gap, children: [
|
|
2900
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: (0, import_clsx18.default)("font-semibold", s.title, selected ? "text-brand" : "text-default"), children: title }),
|
|
2901
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "mt-0.5 text-body-tiny text-default-secondary", children: description })
|
|
2434
2902
|
] })
|
|
2435
2903
|
]
|
|
2436
2904
|
}
|
|
@@ -2438,8 +2906,8 @@ function MultiSelectCard({
|
|
|
2438
2906
|
}
|
|
2439
2907
|
|
|
2440
2908
|
// src/components/forms/switch.tsx
|
|
2441
|
-
var
|
|
2442
|
-
var
|
|
2909
|
+
var import_react20 = require("react");
|
|
2910
|
+
var import_clsx19 = __toESM(require("clsx"), 1);
|
|
2443
2911
|
|
|
2444
2912
|
// src/lib/compose-event-handlers.ts
|
|
2445
2913
|
function composeEventHandlers(theirs, ours) {
|
|
@@ -2450,12 +2918,12 @@ function composeEventHandlers(theirs, ours) {
|
|
|
2450
2918
|
}
|
|
2451
2919
|
|
|
2452
2920
|
// src/components/forms/switch.tsx
|
|
2453
|
-
var
|
|
2921
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2454
2922
|
var SIZE4 = {
|
|
2455
2923
|
sm: { track: "h-5 w-9", knob: "size-4", translate: "translate-x-4" },
|
|
2456
2924
|
md: { track: "h-6 w-11", knob: "size-5", translate: "translate-x-5" }
|
|
2457
2925
|
};
|
|
2458
|
-
var Switch = (0,
|
|
2926
|
+
var Switch = (0, import_react20.forwardRef)(function Switch2({
|
|
2459
2927
|
checked: checkedProp,
|
|
2460
2928
|
defaultChecked = false,
|
|
2461
2929
|
onCheckedChange,
|
|
@@ -2478,11 +2946,11 @@ var Switch = (0, import_react18.forwardRef)(function Switch2({
|
|
|
2478
2946
|
defaultValue: defaultChecked,
|
|
2479
2947
|
onChange: onCheckedChange
|
|
2480
2948
|
});
|
|
2481
|
-
const generatedId = (0,
|
|
2949
|
+
const generatedId = (0, import_react20.useId)();
|
|
2482
2950
|
const controlId = id ?? generatedId;
|
|
2483
2951
|
const descriptionId = `${controlId}-description`;
|
|
2484
2952
|
const s = SIZE4[size2];
|
|
2485
|
-
const control = /* @__PURE__ */ (0,
|
|
2953
|
+
const control = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2486
2954
|
"button",
|
|
2487
2955
|
{
|
|
2488
2956
|
ref,
|
|
@@ -2496,7 +2964,7 @@ var Switch = (0, import_react18.forwardRef)(function Switch2({
|
|
|
2496
2964
|
"aria-describedby": description ? descriptionId : void 0,
|
|
2497
2965
|
disabled,
|
|
2498
2966
|
onClick: composeEventHandlers(onClick, () => setChecked(!checked)),
|
|
2499
|
-
className: (0,
|
|
2967
|
+
className: (0, import_clsx19.default)(
|
|
2500
2968
|
"group flex items-center gap-2",
|
|
2501
2969
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default",
|
|
2502
2970
|
disabled && "cursor-not-allowed opacity-50",
|
|
@@ -2504,11 +2972,11 @@ var Switch = (0, import_react18.forwardRef)(function Switch2({
|
|
|
2504
2972
|
),
|
|
2505
2973
|
...rest,
|
|
2506
2974
|
children: [
|
|
2507
|
-
/* @__PURE__ */ (0,
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2508
2976
|
"span",
|
|
2509
2977
|
{
|
|
2510
2978
|
"aria-hidden": true,
|
|
2511
|
-
className: (0,
|
|
2979
|
+
className: (0, import_clsx19.default)(
|
|
2512
2980
|
"relative inline-flex shrink-0 rounded-full transition-colors",
|
|
2513
2981
|
s.track,
|
|
2514
2982
|
// The unchecked track is borderless per the spec. A border here would also shift
|
|
@@ -2516,10 +2984,10 @@ var Switch = (0, import_react18.forwardRef)(function Switch2({
|
|
|
2516
2984
|
// against the padding box.
|
|
2517
2985
|
disabled ? "bg-disabled" : checked ? "bg-brand group-hover:bg-brand-hover" : "bg-default-secondary group-hover:bg-default-secondary-hover"
|
|
2518
2986
|
),
|
|
2519
|
-
children: /* @__PURE__ */ (0,
|
|
2987
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2520
2988
|
"span",
|
|
2521
2989
|
{
|
|
2522
|
-
className: (0,
|
|
2990
|
+
className: (0, import_clsx19.default)(
|
|
2523
2991
|
"absolute left-0.5 top-0.5 rounded-full bg-default shadow-100 transition-transform",
|
|
2524
2992
|
s.knob,
|
|
2525
2993
|
checked ? s.translate : "translate-x-0"
|
|
@@ -2528,11 +2996,11 @@ var Switch = (0, import_react18.forwardRef)(function Switch2({
|
|
|
2528
2996
|
)
|
|
2529
2997
|
}
|
|
2530
2998
|
),
|
|
2531
|
-
label && /* @__PURE__ */ (0,
|
|
2999
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-body-xs text-default", children: label })
|
|
2532
3000
|
]
|
|
2533
3001
|
}
|
|
2534
3002
|
);
|
|
2535
|
-
const formInput = name ? /* @__PURE__ */ (0,
|
|
3003
|
+
const formInput = name ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2536
3004
|
"input",
|
|
2537
3005
|
{
|
|
2538
3006
|
type: "checkbox",
|
|
@@ -2549,19 +3017,19 @@ var Switch = (0, import_react18.forwardRef)(function Switch2({
|
|
|
2549
3017
|
}
|
|
2550
3018
|
) : null;
|
|
2551
3019
|
if (!description) {
|
|
2552
|
-
return formInput ? /* @__PURE__ */ (0,
|
|
3020
|
+
return formInput ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: (0, import_clsx19.default)("relative inline-flex", className), children: [
|
|
2553
3021
|
control,
|
|
2554
3022
|
formInput
|
|
2555
3023
|
] }) : control;
|
|
2556
3024
|
}
|
|
2557
|
-
return /* @__PURE__ */ (0,
|
|
3025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: (0, import_clsx19.default)("relative flex flex-col", className), children: [
|
|
2558
3026
|
control,
|
|
2559
3027
|
formInput,
|
|
2560
|
-
/* @__PURE__ */ (0,
|
|
3028
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2561
3029
|
"span",
|
|
2562
3030
|
{
|
|
2563
3031
|
id: descriptionId,
|
|
2564
|
-
className: (0,
|
|
3032
|
+
className: (0, import_clsx19.default)(
|
|
2565
3033
|
"mt-0.5 text-body-tiny",
|
|
2566
3034
|
size2 === "md" ? "pl-[52px]" : "pl-[44px]",
|
|
2567
3035
|
disabled ? "text-disabled" : "text-default-secondary"
|
|
@@ -2573,9 +3041,9 @@ var Switch = (0, import_react18.forwardRef)(function Switch2({
|
|
|
2573
3041
|
});
|
|
2574
3042
|
|
|
2575
3043
|
// src/components/forms/toggle.tsx
|
|
2576
|
-
var
|
|
2577
|
-
var
|
|
2578
|
-
var
|
|
3044
|
+
var import_react21 = require("react");
|
|
3045
|
+
var import_clsx20 = __toESM(require("clsx"), 1);
|
|
3046
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2579
3047
|
var SIZE5 = {
|
|
2580
3048
|
sm: "h-8 min-w-8 px-2 text-body-tiny [&_svg]:size-3.5",
|
|
2581
3049
|
md: "h-9 min-w-9 px-2.5 text-body-xs [&_svg]:size-4",
|
|
@@ -2585,7 +3053,7 @@ var VARIANT = {
|
|
|
2585
3053
|
ghost: "border border-transparent bg-transparent",
|
|
2586
3054
|
outline: "border border-default bg-default"
|
|
2587
3055
|
};
|
|
2588
|
-
var Toggle = (0,
|
|
3056
|
+
var Toggle = (0, import_react21.forwardRef)(function Toggle2({
|
|
2589
3057
|
pressed: pressedProp,
|
|
2590
3058
|
defaultPressed = false,
|
|
2591
3059
|
onPressedChange,
|
|
@@ -2597,7 +3065,7 @@ var Toggle = (0, import_react19.forwardRef)(function Toggle2({
|
|
|
2597
3065
|
onClick,
|
|
2598
3066
|
...rest
|
|
2599
3067
|
}, ref) {
|
|
2600
|
-
const group = (0,
|
|
3068
|
+
const group = (0, import_react21.useContext)(ToggleGroupContext);
|
|
2601
3069
|
const [standalonePressed, setStandalonePressed] = useControllableState({
|
|
2602
3070
|
value: pressedProp,
|
|
2603
3071
|
defaultValue: defaultPressed,
|
|
@@ -2605,7 +3073,7 @@ var Toggle = (0, import_react19.forwardRef)(function Toggle2({
|
|
|
2605
3073
|
});
|
|
2606
3074
|
const pressed = group ? group.isPressed(rest.value) : standalonePressed;
|
|
2607
3075
|
const isDisabled = disabled ?? group?.disabled;
|
|
2608
|
-
return /* @__PURE__ */ (0,
|
|
3076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2609
3077
|
"button",
|
|
2610
3078
|
{
|
|
2611
3079
|
ref,
|
|
@@ -2636,7 +3104,7 @@ var Toggle = (0, import_react19.forwardRef)(function Toggle2({
|
|
|
2636
3104
|
}
|
|
2637
3105
|
);
|
|
2638
3106
|
});
|
|
2639
|
-
var ToggleGroupContext = (0,
|
|
3107
|
+
var ToggleGroupContext = (0, import_react21.createContext)(null);
|
|
2640
3108
|
function ToggleGroup({
|
|
2641
3109
|
children,
|
|
2642
3110
|
type = "single",
|
|
@@ -2658,8 +3126,8 @@ function ToggleGroup({
|
|
|
2658
3126
|
orientation: orientation === "vertical" ? "vertical" : "horizontal",
|
|
2659
3127
|
loop: true
|
|
2660
3128
|
});
|
|
2661
|
-
const cursor = (0,
|
|
2662
|
-
const context = (0,
|
|
3129
|
+
const cursor = (0, import_react21.useRef)(0);
|
|
3130
|
+
const context = (0, import_react21.useMemo)(
|
|
2663
3131
|
() => ({
|
|
2664
3132
|
isPressed: (itemValue) => Array.isArray(value) ? value.includes(itemValue) : value === itemValue,
|
|
2665
3133
|
toggle: (itemValue) => {
|
|
@@ -2679,13 +3147,13 @@ function ToggleGroup({
|
|
|
2679
3147
|
[value, setValue, type, disabled, roving]
|
|
2680
3148
|
);
|
|
2681
3149
|
cursor.current = 0;
|
|
2682
|
-
return /* @__PURE__ */ (0,
|
|
3150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ToggleGroupContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2683
3151
|
"div",
|
|
2684
3152
|
{
|
|
2685
3153
|
role: "group",
|
|
2686
3154
|
"aria-label": label,
|
|
2687
3155
|
"data-slot": "toggle-group",
|
|
2688
|
-
className: (0,
|
|
3156
|
+
className: (0, import_clsx20.default)(
|
|
2689
3157
|
"inline-flex gap-0.5",
|
|
2690
3158
|
orientation === "vertical" ? "flex-col" : "flex-row items-center",
|
|
2691
3159
|
className
|
|
@@ -2696,16 +3164,16 @@ function ToggleGroup({
|
|
|
2696
3164
|
}
|
|
2697
3165
|
) });
|
|
2698
3166
|
}
|
|
2699
|
-
var ToggleGroupItem = (0,
|
|
3167
|
+
var ToggleGroupItem = (0, import_react21.forwardRef)(
|
|
2700
3168
|
function ToggleGroupItem2({ value, children, onFocus, ...rest }, ref) {
|
|
2701
|
-
const group = (0,
|
|
3169
|
+
const group = (0, import_react21.useContext)(ToggleGroupContext);
|
|
2702
3170
|
if (!group) throw new Error("<ToggleGroupItem> must be used inside <ToggleGroup>");
|
|
2703
3171
|
const index = group.claimIndex();
|
|
2704
3172
|
const { ref: rovingRef, ...itemProps } = group.roving.itemProps(index, {
|
|
2705
3173
|
disabled: rest.disabled ?? group.disabled,
|
|
2706
3174
|
label: typeof children === "string" ? children : void 0
|
|
2707
3175
|
});
|
|
2708
|
-
return /* @__PURE__ */ (0,
|
|
3176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2709
3177
|
Toggle,
|
|
2710
3178
|
{
|
|
2711
3179
|
ref: composeRefs(ref, rovingRef),
|
|
@@ -2724,10 +3192,10 @@ var ToggleGroupItem = (0, import_react19.forwardRef)(
|
|
|
2724
3192
|
);
|
|
2725
3193
|
|
|
2726
3194
|
// src/components/forms/input-otp.tsx
|
|
2727
|
-
var
|
|
2728
|
-
var
|
|
2729
|
-
var
|
|
2730
|
-
var InputOTP = (0,
|
|
3195
|
+
var import_react22 = require("react");
|
|
3196
|
+
var import_clsx21 = __toESM(require("clsx"), 1);
|
|
3197
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3198
|
+
var InputOTP = (0, import_react22.forwardRef)(function InputOTP2({
|
|
2731
3199
|
length = 6,
|
|
2732
3200
|
value: valueProp,
|
|
2733
3201
|
defaultValue = "",
|
|
@@ -2746,9 +3214,9 @@ var InputOTP = (0, import_react20.forwardRef)(function InputOTP2({
|
|
|
2746
3214
|
defaultValue,
|
|
2747
3215
|
onChange: onValueChange
|
|
2748
3216
|
});
|
|
2749
|
-
const inputRef = (0,
|
|
2750
|
-
const [focused, setFocused] = (0,
|
|
2751
|
-
const describedById = (0,
|
|
3217
|
+
const inputRef = (0, import_react22.useRef)(null);
|
|
3218
|
+
const [focused, setFocused] = (0, import_react22.useState)(false);
|
|
3219
|
+
const describedById = (0, import_react22.useId)();
|
|
2752
3220
|
const pattern = mode === "numeric" ? /[^0-9]/g : /[^a-zA-Z0-9]/g;
|
|
2753
3221
|
const commit = (next) => {
|
|
2754
3222
|
const cleaned = next.replace(pattern, "").slice(0, length);
|
|
@@ -2757,14 +3225,14 @@ var InputOTP = (0, import_react20.forwardRef)(function InputOTP2({
|
|
|
2757
3225
|
};
|
|
2758
3226
|
const chars = value.split("");
|
|
2759
3227
|
const activeIndex = Math.min(value.length, length - 1);
|
|
2760
|
-
return /* @__PURE__ */ (0,
|
|
2761
|
-
/* @__PURE__ */ (0,
|
|
3228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: (0, import_clsx21.default)("inline-flex flex-col gap-1.5", className), children: [
|
|
3229
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2762
3230
|
"div",
|
|
2763
3231
|
{
|
|
2764
3232
|
className: "relative inline-flex items-center gap-2",
|
|
2765
3233
|
onClick: () => inputRef.current?.focus(),
|
|
2766
3234
|
children: [
|
|
2767
|
-
/* @__PURE__ */ (0,
|
|
3235
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2768
3236
|
"input",
|
|
2769
3237
|
{
|
|
2770
3238
|
ref: composeRefs(inputRef, ref),
|
|
@@ -2793,11 +3261,11 @@ var InputOTP = (0, import_react20.forwardRef)(function InputOTP2({
|
|
|
2793
3261
|
className: "absolute inset-0 z-raised w-full cursor-default bg-transparent text-transparent caret-transparent outline-none"
|
|
2794
3262
|
}
|
|
2795
3263
|
),
|
|
2796
|
-
Array.from({ length }, (_, index) => /* @__PURE__ */ (0,
|
|
3264
|
+
Array.from({ length }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2797
3265
|
"span",
|
|
2798
3266
|
{
|
|
2799
3267
|
"aria-hidden": true,
|
|
2800
|
-
className: (0,
|
|
3268
|
+
className: (0, import_clsx21.default)(
|
|
2801
3269
|
"flex h-12 w-10 items-center justify-center rounded-lg border text-body font-semibold tabular-nums transition-colors",
|
|
2802
3270
|
groupAfter && index === groupAfter && "ml-3",
|
|
2803
3271
|
disabled ? "border-disabled bg-disabled text-disabled" : invalid ? "border-danger-secondary bg-default text-default" : "border-default bg-default text-default",
|
|
@@ -2810,15 +3278,15 @@ var InputOTP = (0, import_react20.forwardRef)(function InputOTP2({
|
|
|
2810
3278
|
]
|
|
2811
3279
|
}
|
|
2812
3280
|
),
|
|
2813
|
-
/* @__PURE__ */ (0,
|
|
3281
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { id: describedById, className: "sr-only", children: `Enter the ${length}-character code. ${value.length} of ${length} entered.` })
|
|
2814
3282
|
] });
|
|
2815
3283
|
});
|
|
2816
3284
|
|
|
2817
3285
|
// src/components/forms/file-drop-zone.tsx
|
|
2818
|
-
var
|
|
2819
|
-
var
|
|
2820
|
-
var
|
|
2821
|
-
var
|
|
3286
|
+
var import_react23 = require("react");
|
|
3287
|
+
var import_clsx22 = __toESM(require("clsx"), 1);
|
|
3288
|
+
var import_lucide_react6 = require("lucide-react");
|
|
3289
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2822
3290
|
var DEFAULT_ACCEPT = ".pdf,.jpg,.jpeg,.png";
|
|
2823
3291
|
var DEFAULT_MAX_SIZE_BYTES = 10 * 1024 * 1024;
|
|
2824
3292
|
function formatFileSize(bytes) {
|
|
@@ -2839,8 +3307,8 @@ function useFilePicker({
|
|
|
2839
3307
|
maxSizeBytes = DEFAULT_MAX_SIZE_BYTES,
|
|
2840
3308
|
onFileSelected
|
|
2841
3309
|
} = {}) {
|
|
2842
|
-
const inputRef = (0,
|
|
2843
|
-
const [error, setError] = (0,
|
|
3310
|
+
const inputRef = (0, import_react23.useRef)(null);
|
|
3311
|
+
const [error, setError] = (0, import_react23.useState)(null);
|
|
2844
3312
|
function handleFiles(files) {
|
|
2845
3313
|
const file = files?.[0];
|
|
2846
3314
|
if (!file) return;
|
|
@@ -2880,13 +3348,13 @@ function FileDropZone({
|
|
|
2880
3348
|
onFileSelected,
|
|
2881
3349
|
disabled = false
|
|
2882
3350
|
}) {
|
|
2883
|
-
const [isDragging, setIsDragging] = (0,
|
|
3351
|
+
const [isDragging, setIsDragging] = (0, import_react23.useState)(false);
|
|
2884
3352
|
const picker = useFilePicker({ accept, maxSizeBytes, onFileSelected });
|
|
2885
3353
|
const { error, handleFiles } = picker;
|
|
2886
3354
|
const inputRef = picker.inputProps.ref;
|
|
2887
|
-
return /* @__PURE__ */ (0,
|
|
2888
|
-
/* @__PURE__ */ (0,
|
|
2889
|
-
/* @__PURE__ */ (0,
|
|
3355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { ...picker.inputProps, disabled }),
|
|
3357
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2890
3358
|
"div",
|
|
2891
3359
|
{
|
|
2892
3360
|
role: "button",
|
|
@@ -2916,40 +3384,40 @@ function FileDropZone({
|
|
|
2916
3384
|
setIsDragging(false);
|
|
2917
3385
|
if (!disabled) handleFiles(e.dataTransfer.files);
|
|
2918
3386
|
},
|
|
2919
|
-
className: (0,
|
|
3387
|
+
className: (0, import_clsx22.default)(
|
|
2920
3388
|
"flex flex-col items-center justify-center gap-1 rounded-lg border-2 border-dashed py-4 px-4 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1",
|
|
2921
|
-
disabled ? "cursor-not-allowed border-disabled bg-disabled" : (0,
|
|
3389
|
+
disabled ? "cursor-not-allowed border-disabled bg-disabled" : (0, import_clsx22.default)(
|
|
2922
3390
|
"cursor-pointer",
|
|
2923
3391
|
isDragging ? "border-brand bg-brand-tertiary" : "border-default bg-default-secondary hover:border-brand hover:bg-brand-tertiary"
|
|
2924
3392
|
),
|
|
2925
3393
|
className
|
|
2926
3394
|
),
|
|
2927
3395
|
children: [
|
|
2928
|
-
/* @__PURE__ */ (0,
|
|
3396
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2929
3397
|
"span",
|
|
2930
3398
|
{
|
|
2931
3399
|
"aria-hidden": true,
|
|
2932
3400
|
className: disabled ? "text-disabled" : isDragging ? "text-brand" : "text-default-secondary",
|
|
2933
|
-
children: /* @__PURE__ */ (0,
|
|
3401
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react6.UploadIcon, { className: "size-5" })
|
|
2934
3402
|
}
|
|
2935
3403
|
),
|
|
2936
|
-
/* @__PURE__ */ (0,
|
|
2937
|
-
/* @__PURE__ */ (0,
|
|
3404
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: (0, import_clsx22.default)("text-body-sm font-medium", disabled ? "text-disabled" : "text-default"), children: "Upload file" }),
|
|
3405
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-body-xs text-default-secondary text-center", children: description })
|
|
2938
3406
|
]
|
|
2939
3407
|
}
|
|
2940
3408
|
),
|
|
2941
|
-
error && /* @__PURE__ */ (0,
|
|
3409
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { role: "alert", className: "text-body-xs text-danger", children: error })
|
|
2942
3410
|
] });
|
|
2943
3411
|
}
|
|
2944
3412
|
|
|
2945
3413
|
// src/components/forms/tag-input.tsx
|
|
2946
|
-
var
|
|
2947
|
-
var
|
|
3414
|
+
var import_react24 = require("react");
|
|
3415
|
+
var import_clsx24 = __toESM(require("clsx"), 1);
|
|
2948
3416
|
|
|
2949
3417
|
// src/components/status/badge.tsx
|
|
2950
|
-
var
|
|
2951
|
-
var
|
|
2952
|
-
var
|
|
3418
|
+
var import_clsx23 = __toESM(require("clsx"), 1);
|
|
3419
|
+
var import_lucide_react7 = require("lucide-react");
|
|
3420
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2953
3421
|
var defaultClasses = {
|
|
2954
3422
|
gray: "bg-badge-gray text-badge-gray",
|
|
2955
3423
|
red: "bg-badge-red text-badge-red",
|
|
@@ -2962,15 +3430,15 @@ var defaultClasses = {
|
|
|
2962
3430
|
slate: "bg-badge-slate text-badge-slate"
|
|
2963
3431
|
};
|
|
2964
3432
|
var subtleClasses = {
|
|
2965
|
-
gray: "border border-badge-gray text-
|
|
2966
|
-
red: "border border-badge-red text-
|
|
2967
|
-
yellow: "border border-badge-yellow text-
|
|
2968
|
-
lime: "border border-badge-lime text-
|
|
2969
|
-
green: "border border-badge-green text-
|
|
2970
|
-
teal: "border border-badge-teal text-
|
|
2971
|
-
blue: "border border-badge-blue text-
|
|
2972
|
-
pink: "border border-badge-pink text-
|
|
2973
|
-
slate: "border border-badge-slate text-
|
|
3433
|
+
gray: "border border-badge-gray text-badge-gray",
|
|
3434
|
+
red: "border border-badge-red text-badge-red",
|
|
3435
|
+
yellow: "border border-badge-yellow text-badge-yellow",
|
|
3436
|
+
lime: "border border-badge-lime text-badge-lime",
|
|
3437
|
+
green: "border border-badge-green text-badge-green",
|
|
3438
|
+
teal: "border border-badge-teal text-badge-teal",
|
|
3439
|
+
blue: "border border-badge-blue text-badge-blue",
|
|
3440
|
+
pink: "border border-badge-pink text-badge-pink",
|
|
3441
|
+
slate: "border border-badge-slate text-badge-slate"
|
|
2974
3442
|
};
|
|
2975
3443
|
function Badge({
|
|
2976
3444
|
label,
|
|
@@ -2982,47 +3450,47 @@ function Badge({
|
|
|
2982
3450
|
className
|
|
2983
3451
|
}) {
|
|
2984
3452
|
const isDefault = variant === "default";
|
|
2985
|
-
return /* @__PURE__ */ (0,
|
|
3453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2986
3454
|
"span",
|
|
2987
3455
|
{
|
|
2988
3456
|
"data-variant": variant,
|
|
2989
|
-
className: (0,
|
|
3457
|
+
className: (0, import_clsx23.default)(
|
|
2990
3458
|
"inline-flex items-center rounded-full px-2 py-0.5",
|
|
2991
3459
|
size2 === "sm" ? "gap-1" : "gap-1.5",
|
|
2992
3460
|
isDefault ? defaultClasses[color] : subtleClasses[color],
|
|
2993
3461
|
className
|
|
2994
3462
|
),
|
|
2995
3463
|
children: [
|
|
2996
|
-
indicator && /* @__PURE__ */ (0,
|
|
3464
|
+
indicator && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2997
3465
|
"span",
|
|
2998
3466
|
{
|
|
2999
|
-
className: (0,
|
|
3467
|
+
className: (0, import_clsx23.default)(
|
|
3000
3468
|
"shrink-0 rounded-full bg-current",
|
|
3001
3469
|
size2 === "sm" ? "h-1.5 w-1.5" : "h-2 w-2"
|
|
3002
3470
|
)
|
|
3003
3471
|
}
|
|
3004
3472
|
),
|
|
3005
|
-
/* @__PURE__ */ (0,
|
|
3473
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3006
3474
|
"span",
|
|
3007
3475
|
{
|
|
3008
|
-
className: (0,
|
|
3476
|
+
className: (0, import_clsx23.default)(
|
|
3009
3477
|
"whitespace-nowrap",
|
|
3010
|
-
size2 === "sm" ? (0,
|
|
3478
|
+
size2 === "sm" ? (0, import_clsx23.default)("text-body-tiny", isDefault && "font-semibold") : "text-body-xs"
|
|
3011
3479
|
),
|
|
3012
3480
|
children: label
|
|
3013
3481
|
}
|
|
3014
3482
|
),
|
|
3015
|
-
onClose && /* @__PURE__ */ (0,
|
|
3483
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3016
3484
|
"button",
|
|
3017
3485
|
{
|
|
3018
3486
|
type: "button",
|
|
3019
3487
|
onClick: onClose,
|
|
3020
|
-
className: (0,
|
|
3488
|
+
className: (0, import_clsx23.default)(
|
|
3021
3489
|
"inline-flex shrink-0 items-center justify-center rounded-full opacity-60 transition-opacity hover:opacity-100",
|
|
3022
3490
|
size2 === "sm" ? "h-3 w-3" : "h-4 w-4"
|
|
3023
3491
|
),
|
|
3024
3492
|
"aria-label": `Remove ${label}`,
|
|
3025
|
-
children: /* @__PURE__ */ (0,
|
|
3493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react7.XIcon, { className: "h-full w-full", strokeWidth: 2.5, "aria-hidden": true })
|
|
3026
3494
|
}
|
|
3027
3495
|
)
|
|
3028
3496
|
]
|
|
@@ -3031,12 +3499,12 @@ function Badge({
|
|
|
3031
3499
|
}
|
|
3032
3500
|
|
|
3033
3501
|
// src/components/forms/tag-input.tsx
|
|
3034
|
-
var
|
|
3502
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3035
3503
|
var defaultParse = (raw) => ({ value: raw.trim() });
|
|
3036
3504
|
function TagInput({ label, hint, error, required, disabled, id, className, ...rest }) {
|
|
3037
|
-
const [parseError, setParseError] = (0,
|
|
3505
|
+
const [parseError, setParseError] = (0, import_react24.useState)(null);
|
|
3038
3506
|
const shownError = error ?? parseError ?? void 0;
|
|
3039
|
-
return /* @__PURE__ */ (0,
|
|
3507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3040
3508
|
Field,
|
|
3041
3509
|
{
|
|
3042
3510
|
id,
|
|
@@ -3046,9 +3514,9 @@ function TagInput({ label, hint, error, required, disabled, id, className, ...re
|
|
|
3046
3514
|
hasHint: Boolean(hint),
|
|
3047
3515
|
className,
|
|
3048
3516
|
children: [
|
|
3049
|
-
label && /* @__PURE__ */ (0,
|
|
3050
|
-
/* @__PURE__ */ (0,
|
|
3051
|
-
shownError ? /* @__PURE__ */ (0,
|
|
3517
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FieldLabel, { children: label }),
|
|
3518
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TagInputControl, { disabled, required, invalid: Boolean(shownError), onParseError: setParseError, ...rest }),
|
|
3519
|
+
shownError ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FieldError, { children: shownError }) : hint && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FieldHint, { children: hint })
|
|
3052
3520
|
]
|
|
3053
3521
|
}
|
|
3054
3522
|
);
|
|
@@ -3078,9 +3546,9 @@ function TagInputControl({
|
|
|
3078
3546
|
delimiter.lastIndex = 0;
|
|
3079
3547
|
return delimiter.test(text);
|
|
3080
3548
|
};
|
|
3081
|
-
const [draft, setDraft] = (0,
|
|
3082
|
-
const [rejected, setRejected] = (0,
|
|
3083
|
-
(0,
|
|
3549
|
+
const [draft, setDraft] = (0, import_react24.useState)("");
|
|
3550
|
+
const [rejected, setRejected] = (0, import_react24.useState)(null);
|
|
3551
|
+
(0, import_react24.useEffect)(() => {
|
|
3084
3552
|
onParseError(rejected);
|
|
3085
3553
|
onInvalidChange?.(rejected !== null);
|
|
3086
3554
|
}, [rejected, onParseError, onInvalidChange]);
|
|
@@ -3125,7 +3593,7 @@ function TagInputControl({
|
|
|
3125
3593
|
event.preventDefault();
|
|
3126
3594
|
commit(`${draft}${text}`);
|
|
3127
3595
|
}
|
|
3128
|
-
return /* @__PURE__ */ (0,
|
|
3596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3129
3597
|
"div",
|
|
3130
3598
|
{
|
|
3131
3599
|
"data-invalid": invalid || void 0,
|
|
@@ -3137,7 +3605,7 @@ function TagInputControl({
|
|
|
3137
3605
|
"data-[disabled]:cursor-not-allowed data-[disabled]:border-disabled data-[disabled]:bg-disabled"
|
|
3138
3606
|
),
|
|
3139
3607
|
children: [
|
|
3140
|
-
values.map((value) => /* @__PURE__ */ (0,
|
|
3608
|
+
values.map((value) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3141
3609
|
Badge,
|
|
3142
3610
|
{
|
|
3143
3611
|
label: value,
|
|
@@ -3146,7 +3614,7 @@ function TagInputControl({
|
|
|
3146
3614
|
},
|
|
3147
3615
|
value
|
|
3148
3616
|
)),
|
|
3149
|
-
/* @__PURE__ */ (0,
|
|
3617
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3150
3618
|
"input",
|
|
3151
3619
|
{
|
|
3152
3620
|
...field,
|
|
@@ -3162,30 +3630,30 @@ function TagInputControl({
|
|
|
3162
3630
|
onKeyDown: handleKeyDown,
|
|
3163
3631
|
onPaste: handlePaste,
|
|
3164
3632
|
onBlur: () => commit(draft),
|
|
3165
|
-
className: (0,
|
|
3633
|
+
className: (0, import_clsx24.default)(
|
|
3166
3634
|
"min-w-[8rem] flex-1 bg-transparent px-1 text-body-sm text-default outline-none",
|
|
3167
3635
|
"placeholder:text-default-tertiary disabled:cursor-not-allowed"
|
|
3168
3636
|
)
|
|
3169
3637
|
}
|
|
3170
3638
|
),
|
|
3171
|
-
name && values.map((value) => /* @__PURE__ */ (0,
|
|
3639
|
+
name && values.map((value) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "hidden", name, value }, value))
|
|
3172
3640
|
]
|
|
3173
3641
|
}
|
|
3174
3642
|
);
|
|
3175
3643
|
}
|
|
3176
3644
|
|
|
3177
3645
|
// src/components/forms/form-card.tsx
|
|
3178
|
-
var
|
|
3179
|
-
var
|
|
3180
|
-
var
|
|
3646
|
+
var import_clsx25 = __toESM(require("clsx"), 1);
|
|
3647
|
+
var import_lucide_react8 = require("lucide-react");
|
|
3648
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3181
3649
|
function FormCard({
|
|
3182
3650
|
children,
|
|
3183
3651
|
className
|
|
3184
3652
|
}) {
|
|
3185
|
-
return /* @__PURE__ */ (0,
|
|
3653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3186
3654
|
"div",
|
|
3187
3655
|
{
|
|
3188
|
-
className: (0,
|
|
3656
|
+
className: (0, import_clsx25.default)(
|
|
3189
3657
|
"overflow-hidden rounded-xl border border-default bg-default",
|
|
3190
3658
|
className
|
|
3191
3659
|
),
|
|
@@ -3194,9 +3662,9 @@ function FormCard({
|
|
|
3194
3662
|
);
|
|
3195
3663
|
}
|
|
3196
3664
|
function FormCardHeader({ title, subtitle }) {
|
|
3197
|
-
return /* @__PURE__ */ (0,
|
|
3198
|
-
/* @__PURE__ */ (0,
|
|
3199
|
-
subtitle && /* @__PURE__ */ (0,
|
|
3665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "border-b border-default px-7 py-6", children: [
|
|
3666
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: "text-heading-sm font-semibold text-default leading-snug", children: title }),
|
|
3667
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "mt-1 text-body-xs text-default-secondary", children: subtitle })
|
|
3200
3668
|
] });
|
|
3201
3669
|
}
|
|
3202
3670
|
function FormCardFooter({
|
|
@@ -3214,8 +3682,8 @@ function FormCardFooter({
|
|
|
3214
3682
|
// opens (WCAG 2.2 SC 2.4.11 Focus Not Obscured). Below `sm` Back/Continue share one
|
|
3215
3683
|
// full-width row and the draft action wraps under them; DOM order stays draft → back →
|
|
3216
3684
|
// continue for keyboards. Ported from SCIC in 0.7.0.
|
|
3217
|
-
/* @__PURE__ */ (0,
|
|
3218
|
-
onSaveDraft ? /* @__PURE__ */ (0,
|
|
3685
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-3 border-t border-default px-4 py-4 sm:px-7 sm:py-5", children: [
|
|
3686
|
+
onSaveDraft ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3219
3687
|
Button,
|
|
3220
3688
|
{
|
|
3221
3689
|
variant: "neutral",
|
|
@@ -3225,25 +3693,25 @@ function FormCardFooter({
|
|
|
3225
3693
|
className: "order-last w-full justify-center sm:order-none sm:w-auto",
|
|
3226
3694
|
children: "Save as draft"
|
|
3227
3695
|
}
|
|
3228
|
-
) : /* @__PURE__ */ (0,
|
|
3229
|
-
/* @__PURE__ */ (0,
|
|
3230
|
-
!backDisabled && /* @__PURE__ */ (0,
|
|
3696
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "hidden sm:block" }),
|
|
3697
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex w-full items-center gap-2 sm:w-auto", children: [
|
|
3698
|
+
!backDisabled && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3231
3699
|
Button,
|
|
3232
3700
|
{
|
|
3233
3701
|
variant: "neutral",
|
|
3234
3702
|
size: "md",
|
|
3235
|
-
leadingIcon: /* @__PURE__ */ (0,
|
|
3703
|
+
leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react8.ArrowLeftIcon, { "aria-hidden": true, size: 16 }),
|
|
3236
3704
|
onClick: onBack,
|
|
3237
3705
|
className: "flex-1 justify-center sm:flex-none",
|
|
3238
3706
|
children: "Back"
|
|
3239
3707
|
}
|
|
3240
3708
|
),
|
|
3241
|
-
/* @__PURE__ */ (0,
|
|
3709
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3242
3710
|
Button,
|
|
3243
3711
|
{
|
|
3244
3712
|
variant: "primary",
|
|
3245
3713
|
size: "md",
|
|
3246
|
-
trailingIcon: continueIcon === null ? void 0 : continueIcon ?? /* @__PURE__ */ (0,
|
|
3714
|
+
trailingIcon: continueIcon === null ? void 0 : continueIcon ?? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react8.ArrowRightIcon, { "aria-hidden": true, size: 16 }),
|
|
3247
3715
|
onClick: onContinue,
|
|
3248
3716
|
disabled: continueDisabled,
|
|
3249
3717
|
className: "flex-1 justify-center sm:flex-none",
|
|
@@ -3256,8 +3724,8 @@ function FormCardFooter({
|
|
|
3256
3724
|
}
|
|
3257
3725
|
|
|
3258
3726
|
// src/components/status/role-badge.tsx
|
|
3259
|
-
var
|
|
3260
|
-
var
|
|
3727
|
+
var import_clsx26 = __toESM(require("clsx"), 1);
|
|
3728
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3261
3729
|
var ROLE_TONES = {
|
|
3262
3730
|
"Super Admin": "slate",
|
|
3263
3731
|
"Admin": "slate",
|
|
@@ -3286,11 +3754,11 @@ var HEX6 = /^#[0-9a-fA-F]{6}$/;
|
|
|
3286
3754
|
function RoleBadge({ role, size: size2 = "sm", tone, color }) {
|
|
3287
3755
|
const rawColor = color && HEX6.test(color) ? color : void 0;
|
|
3288
3756
|
const resolved = tone ?? ROLE_TONES[role] ?? FALLBACK_TONE;
|
|
3289
|
-
return /* @__PURE__ */ (0,
|
|
3757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3290
3758
|
"span",
|
|
3291
3759
|
{
|
|
3292
3760
|
"data-tone": tone,
|
|
3293
|
-
className: (0,
|
|
3761
|
+
className: (0, import_clsx26.default)(
|
|
3294
3762
|
"inline-flex items-center rounded-full font-medium whitespace-nowrap",
|
|
3295
3763
|
size2 === "sm" ? "px-2 py-0.5 text-body-tiny" : "px-3 py-1 text-body-xs",
|
|
3296
3764
|
!rawColor && TONE_STYLES[resolved]
|
|
@@ -3302,10 +3770,10 @@ function RoleBadge({ role, size: size2 = "sm", tone, color }) {
|
|
|
3302
3770
|
}
|
|
3303
3771
|
|
|
3304
3772
|
// src/components/forms/combobox.tsx
|
|
3305
|
-
var
|
|
3306
|
-
var
|
|
3307
|
-
var
|
|
3308
|
-
var
|
|
3773
|
+
var import_react25 = require("react");
|
|
3774
|
+
var import_clsx27 = __toESM(require("clsx"), 1);
|
|
3775
|
+
var import_lucide_react9 = require("lucide-react");
|
|
3776
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3309
3777
|
var HEIGHT = {
|
|
3310
3778
|
lg: "h-12 px-4 text-body",
|
|
3311
3779
|
md: "h-9 px-3 text-body-sm",
|
|
@@ -3333,23 +3801,23 @@ function Combobox({
|
|
|
3333
3801
|
defaultValue,
|
|
3334
3802
|
onChange: onValueChange
|
|
3335
3803
|
});
|
|
3336
|
-
const [open, setOpen] = (0,
|
|
3337
|
-
const [query, setQuery] = (0,
|
|
3338
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
3339
|
-
const baseId = (0,
|
|
3804
|
+
const [open, setOpen] = (0, import_react25.useState)(false);
|
|
3805
|
+
const [query, setQuery] = (0, import_react25.useState)("");
|
|
3806
|
+
const [activeIndex, setActiveIndex] = (0, import_react25.useState)(0);
|
|
3807
|
+
const baseId = (0, import_react25.useId)();
|
|
3340
3808
|
const listboxId = `${baseId}-listbox`;
|
|
3341
3809
|
const optionId = (index) => `${baseId}-option-${index}`;
|
|
3342
|
-
const inputRef = (0,
|
|
3343
|
-
const listRef = (0,
|
|
3344
|
-
const rootRef = (0,
|
|
3810
|
+
const inputRef = (0, import_react25.useRef)(null);
|
|
3811
|
+
const listRef = (0, import_react25.useRef)(null);
|
|
3812
|
+
const rootRef = (0, import_react25.useRef)(null);
|
|
3345
3813
|
const field = useFieldControl();
|
|
3346
|
-
const matches = (0,
|
|
3814
|
+
const matches = (0, import_react25.useMemo)(() => {
|
|
3347
3815
|
const predicate = filter ?? ((option, q) => option.label.toLowerCase().includes(q.toLowerCase()));
|
|
3348
3816
|
return query ? options.filter((option) => predicate(option, query)) : options;
|
|
3349
3817
|
}, [options, query, filter]);
|
|
3350
3818
|
const selected = options.find((option) => option.value === value) ?? null;
|
|
3351
3819
|
const displayValue = open ? query : selected?.label ?? "";
|
|
3352
|
-
const close = (0,
|
|
3820
|
+
const close = (0, import_react25.useCallback)((restoreFocus = true) => {
|
|
3353
3821
|
setOpen(false);
|
|
3354
3822
|
setQuery("");
|
|
3355
3823
|
if (restoreFocus) inputRef.current?.focus();
|
|
@@ -3378,20 +3846,20 @@ function Combobox({
|
|
|
3378
3846
|
sideOffset: 4,
|
|
3379
3847
|
matchAnchorWidth: true
|
|
3380
3848
|
});
|
|
3381
|
-
(0,
|
|
3849
|
+
(0, import_react25.useEffect)(() => {
|
|
3382
3850
|
refs.setReference(rootRef.current);
|
|
3383
3851
|
}, [refs, open]);
|
|
3384
|
-
(0,
|
|
3852
|
+
(0, import_react25.useEffect)(() => {
|
|
3385
3853
|
setActiveIndex(0);
|
|
3386
3854
|
}, [query, options]);
|
|
3387
|
-
(0,
|
|
3855
|
+
(0, import_react25.useEffect)(() => {
|
|
3388
3856
|
if (!open) return;
|
|
3389
3857
|
const node = listRef.current?.querySelector(`#${CSS.escape(optionId(activeIndex))}`);
|
|
3390
3858
|
if (node instanceof Element && typeof node.scrollIntoView === "function") {
|
|
3391
3859
|
node.scrollIntoView({ block: "nearest" });
|
|
3392
3860
|
}
|
|
3393
3861
|
});
|
|
3394
|
-
(0,
|
|
3862
|
+
(0, import_react25.useEffect)(() => {
|
|
3395
3863
|
if (!open) return;
|
|
3396
3864
|
function onPointerDown(event) {
|
|
3397
3865
|
const withinRoot = rootRef.current?.contains(event.target);
|
|
@@ -3402,18 +3870,18 @@ function Combobox({
|
|
|
3402
3870
|
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
3403
3871
|
}, [open, close]);
|
|
3404
3872
|
let renderedGroup;
|
|
3405
|
-
return /* @__PURE__ */ (0,
|
|
3406
|
-
/* @__PURE__ */ (0,
|
|
3873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { ref: rootRef, className: (0, import_clsx27.default)("relative w-full", className), children: [
|
|
3874
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3407
3875
|
"div",
|
|
3408
3876
|
{
|
|
3409
|
-
className: (0,
|
|
3877
|
+
className: (0, import_clsx27.default)(
|
|
3410
3878
|
"flex w-full items-center gap-2 rounded-lg border transition-colors",
|
|
3411
3879
|
HEIGHT[size2],
|
|
3412
3880
|
"focus-within:ring-2 focus-within:ring-offset-1 focus-within:ring-offset-default",
|
|
3413
3881
|
disabled ? "cursor-not-allowed border-disabled bg-disabled" : invalid || field["aria-invalid"] ? "border-danger-secondary focus-within:border-danger focus-within:ring-danger" : "border-default bg-default focus-within:border-brand focus-within:ring-brand"
|
|
3414
3882
|
),
|
|
3415
3883
|
children: [
|
|
3416
|
-
/* @__PURE__ */ (0,
|
|
3884
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3417
3885
|
"input",
|
|
3418
3886
|
{
|
|
3419
3887
|
ref: inputRef,
|
|
@@ -3475,18 +3943,18 @@ function Combobox({
|
|
|
3475
3943
|
break;
|
|
3476
3944
|
}
|
|
3477
3945
|
},
|
|
3478
|
-
className: (0,
|
|
3946
|
+
className: (0, import_clsx27.default)(
|
|
3479
3947
|
"min-w-0 flex-1 bg-transparent text-default outline-none",
|
|
3480
3948
|
"placeholder:text-default-tertiary",
|
|
3481
3949
|
"disabled:cursor-not-allowed disabled:text-disabled"
|
|
3482
3950
|
)
|
|
3483
3951
|
}
|
|
3484
3952
|
),
|
|
3485
|
-
/* @__PURE__ */ (0,
|
|
3486
|
-
|
|
3953
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3954
|
+
import_lucide_react9.ChevronDownIcon,
|
|
3487
3955
|
{
|
|
3488
3956
|
"aria-hidden": true,
|
|
3489
|
-
className: (0,
|
|
3957
|
+
className: (0, import_clsx27.default)(
|
|
3490
3958
|
"shrink-0 transition-transform",
|
|
3491
3959
|
size2 === "sm" ? "size-3" : "size-4",
|
|
3492
3960
|
disabled ? "text-icon-disabled" : "text-icon-default-secondary",
|
|
@@ -3497,7 +3965,7 @@ function Combobox({
|
|
|
3497
3965
|
]
|
|
3498
3966
|
}
|
|
3499
3967
|
),
|
|
3500
|
-
open && /* @__PURE__ */ (0,
|
|
3968
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3501
3969
|
"div",
|
|
3502
3970
|
{
|
|
3503
3971
|
ref: (node) => {
|
|
@@ -3508,16 +3976,16 @@ function Combobox({
|
|
|
3508
3976
|
role: "listbox",
|
|
3509
3977
|
"aria-label": label,
|
|
3510
3978
|
style: { ...floatingStyles, width: "var(--panel-anchor-width)" },
|
|
3511
|
-
className: (0,
|
|
3979
|
+
className: (0, import_clsx27.default)("z-popover", OVERLAY_PANEL, OVERLAY_PANEL_SCROLL),
|
|
3512
3980
|
children: [
|
|
3513
|
-
matches.length === 0 && /* @__PURE__ */ (0,
|
|
3981
|
+
matches.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "px-2.5 py-2 text-body-xs text-default-secondary", children: emptyMessage }),
|
|
3514
3982
|
matches.map((option, index) => {
|
|
3515
3983
|
const isSelected = option.value === value;
|
|
3516
3984
|
const isActive = index === activeIndex;
|
|
3517
3985
|
const groupHeading = option.group !== renderedGroup ? option.group : void 0;
|
|
3518
3986
|
renderedGroup = option.group;
|
|
3519
|
-
return /* @__PURE__ */ (0,
|
|
3520
|
-
groupHeading && /* @__PURE__ */ (0,
|
|
3987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
3988
|
+
groupHeading && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3521
3989
|
"div",
|
|
3522
3990
|
{
|
|
3523
3991
|
role: "presentation",
|
|
@@ -3525,7 +3993,7 @@ function Combobox({
|
|
|
3525
3993
|
children: groupHeading
|
|
3526
3994
|
}
|
|
3527
3995
|
),
|
|
3528
|
-
/* @__PURE__ */ (0,
|
|
3996
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3529
3997
|
"div",
|
|
3530
3998
|
{
|
|
3531
3999
|
id: optionId(index),
|
|
@@ -3535,18 +4003,18 @@ function Combobox({
|
|
|
3535
4003
|
onPointerDown: (event) => event.preventDefault(),
|
|
3536
4004
|
onClick: () => commit(option),
|
|
3537
4005
|
onPointerEnter: () => !option.disabled && setActiveIndex(index),
|
|
3538
|
-
className: (0,
|
|
4006
|
+
className: (0, import_clsx27.default)(
|
|
3539
4007
|
OVERLAY_ITEM_BASE,
|
|
3540
4008
|
OVERLAY_ITEM_SIZE.md,
|
|
3541
4009
|
"items-center",
|
|
3542
|
-
option.disabled ? "cursor-not-allowed text-disabled" : isActive ? (0,
|
|
4010
|
+
option.disabled ? "cursor-not-allowed text-disabled" : isActive ? (0, import_clsx27.default)(OVERLAY_ITEM_ACTIVE, "text-default") : "text-default"
|
|
3543
4011
|
),
|
|
3544
|
-
children: renderOption ? renderOption(option, isSelected) : /* @__PURE__ */ (0,
|
|
3545
|
-
/* @__PURE__ */ (0,
|
|
3546
|
-
/* @__PURE__ */ (0,
|
|
3547
|
-
option.description && /* @__PURE__ */ (0,
|
|
4012
|
+
children: renderOption ? renderOption(option, isSelected) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
4013
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
4014
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "block truncate", children: option.label }),
|
|
4015
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "block truncate text-body-tiny text-default-secondary", children: option.description })
|
|
3548
4016
|
] }),
|
|
3549
|
-
isSelected && /* @__PURE__ */ (0,
|
|
4017
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react9.CheckIcon, { "aria-hidden": true, className: "size-3.5 shrink-0 text-brand", strokeWidth: 3 })
|
|
3550
4018
|
] })
|
|
3551
4019
|
}
|
|
3552
4020
|
)
|
|
@@ -3559,7 +4027,7 @@ function Combobox({
|
|
|
3559
4027
|
}
|
|
3560
4028
|
|
|
3561
4029
|
// src/components/forms/role-combo-box.tsx
|
|
3562
|
-
var
|
|
4030
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3563
4031
|
var ROLE_COMBO_OPTIONS = [
|
|
3564
4032
|
{ role: "Reviewer", description: "Reviews onboarding requests" },
|
|
3565
4033
|
{ role: "Admin", description: "Full org control" },
|
|
@@ -3582,7 +4050,7 @@ function RoleComboBox({
|
|
|
3582
4050
|
label: option.role,
|
|
3583
4051
|
description: option.description
|
|
3584
4052
|
}));
|
|
3585
|
-
return /* @__PURE__ */ (0,
|
|
4053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3586
4054
|
Combobox,
|
|
3587
4055
|
{
|
|
3588
4056
|
options: comboboxOptions,
|
|
@@ -3594,17 +4062,17 @@ function RoleComboBox({
|
|
|
3594
4062
|
clearable: false,
|
|
3595
4063
|
emptyMessage: "No roles match",
|
|
3596
4064
|
className,
|
|
3597
|
-
renderOption: (option) => /* @__PURE__ */ (0,
|
|
3598
|
-
/* @__PURE__ */ (0,
|
|
3599
|
-
/* @__PURE__ */ (0,
|
|
4065
|
+
renderOption: (option) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
4066
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RoleBadge, { role: option.value, size: "sm" }),
|
|
4067
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "min-w-0 flex-1 truncate text-body-xs text-default-secondary", children: option.description })
|
|
3600
4068
|
] })
|
|
3601
4069
|
}
|
|
3602
4070
|
);
|
|
3603
4071
|
}
|
|
3604
4072
|
|
|
3605
4073
|
// src/components/forms/country-select.tsx
|
|
3606
|
-
var
|
|
3607
|
-
var
|
|
4074
|
+
var import_react26 = require("react");
|
|
4075
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3608
4076
|
var ISO_3166_ALPHA_2 = "AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW";
|
|
3609
4077
|
var COUNTRY_CODES = ISO_3166_ALPHA_2.split(" ");
|
|
3610
4078
|
function countryOptions(codes = COUNTRY_CODES, locale) {
|
|
@@ -3624,12 +4092,12 @@ function CountrySelect({
|
|
|
3624
4092
|
}) {
|
|
3625
4093
|
const keep = [props.value, props.defaultValue].filter((v) => !!v);
|
|
3626
4094
|
const keepKey = keep.join("|");
|
|
3627
|
-
const options = (0,
|
|
4095
|
+
const options = (0, import_react26.useMemo)(() => {
|
|
3628
4096
|
const list = countryOptions(countries, locale);
|
|
3629
4097
|
const missing = keep.filter((v) => !list.some((o) => o.value === v));
|
|
3630
4098
|
return [...countryOptions(missing, locale), ...list];
|
|
3631
4099
|
}, [countries, locale, keepKey]);
|
|
3632
|
-
return /* @__PURE__ */ (0,
|
|
4100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3633
4101
|
Combobox,
|
|
3634
4102
|
{
|
|
3635
4103
|
...props,
|
|
@@ -3645,8 +4113,8 @@ function CountrySelect({
|
|
|
3645
4113
|
}
|
|
3646
4114
|
|
|
3647
4115
|
// src/components/forms/time-zone-select.tsx
|
|
3648
|
-
var
|
|
3649
|
-
var
|
|
4116
|
+
var import_react27 = require("react");
|
|
4117
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3650
4118
|
var RENAMED = {
|
|
3651
4119
|
"America/Godthab": "America/Nuuk",
|
|
3652
4120
|
"Asia/Calcutta": "Asia/Kolkata",
|
|
@@ -3698,13 +4166,13 @@ function TimeZoneSelect({
|
|
|
3698
4166
|
const atTime = at?.getTime();
|
|
3699
4167
|
const keep = [props.value, props.defaultValue].filter((v) => !!v);
|
|
3700
4168
|
const keepKey = keep.join("|");
|
|
3701
|
-
const options = (0,
|
|
4169
|
+
const options = (0, import_react27.useMemo)(() => {
|
|
3702
4170
|
const when = atTime === void 0 ? /* @__PURE__ */ new Date() : new Date(atTime);
|
|
3703
4171
|
const list = timeZoneOptions(timeZones, when);
|
|
3704
4172
|
const missing = keep.filter((v) => !list.some((o) => o.value === v));
|
|
3705
4173
|
return [...missing.map((v) => zoneOption(v, when)), ...list];
|
|
3706
4174
|
}, [timeZones, atTime, keepKey]);
|
|
3707
|
-
return /* @__PURE__ */ (0,
|
|
4175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3708
4176
|
Combobox,
|
|
3709
4177
|
{
|
|
3710
4178
|
...props,
|
|
@@ -3720,10 +4188,10 @@ function TimeZoneSelect({
|
|
|
3720
4188
|
}
|
|
3721
4189
|
|
|
3722
4190
|
// src/components/forms/command.tsx
|
|
3723
|
-
var
|
|
3724
|
-
var
|
|
3725
|
-
var
|
|
3726
|
-
var
|
|
4191
|
+
var import_react28 = require("react");
|
|
4192
|
+
var import_clsx28 = __toESM(require("clsx"), 1);
|
|
4193
|
+
var import_lucide_react10 = require("lucide-react");
|
|
4194
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3727
4195
|
function Command({
|
|
3728
4196
|
items,
|
|
3729
4197
|
label = "Command palette",
|
|
@@ -3733,13 +4201,13 @@ function Command({
|
|
|
3733
4201
|
autoFocus = true,
|
|
3734
4202
|
className
|
|
3735
4203
|
}) {
|
|
3736
|
-
const [query, setQuery] = (0,
|
|
3737
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
3738
|
-
const baseId = (0,
|
|
4204
|
+
const [query, setQuery] = (0, import_react28.useState)("");
|
|
4205
|
+
const [activeIndex, setActiveIndex] = (0, import_react28.useState)(0);
|
|
4206
|
+
const baseId = (0, import_react28.useId)();
|
|
3739
4207
|
const listboxId = `${baseId}-listbox`;
|
|
3740
4208
|
const optionId = (index) => `${baseId}-option-${index}`;
|
|
3741
|
-
const listRef = (0,
|
|
3742
|
-
const matches = (0,
|
|
4209
|
+
const listRef = (0, import_react28.useRef)(null);
|
|
4210
|
+
const matches = (0, import_react28.useMemo)(() => {
|
|
3743
4211
|
if (!query) return items;
|
|
3744
4212
|
const q = query.toLowerCase();
|
|
3745
4213
|
return items.filter((item) => {
|
|
@@ -3748,10 +4216,10 @@ function Command({
|
|
|
3748
4216
|
return item.keywords?.some((keyword) => keyword.toLowerCase().includes(q)) ?? false;
|
|
3749
4217
|
});
|
|
3750
4218
|
}, [items, query]);
|
|
3751
|
-
(0,
|
|
4219
|
+
(0, import_react28.useEffect)(() => {
|
|
3752
4220
|
setActiveIndex(0);
|
|
3753
4221
|
}, [query]);
|
|
3754
|
-
(0,
|
|
4222
|
+
(0, import_react28.useEffect)(() => {
|
|
3755
4223
|
const node = listRef.current?.querySelector(`#${CSS.escape(optionId(activeIndex))}`);
|
|
3756
4224
|
if (node instanceof Element && typeof node.scrollIntoView === "function") {
|
|
3757
4225
|
node.scrollIntoView({ block: "nearest" });
|
|
@@ -3774,10 +4242,10 @@ function Command({
|
|
|
3774
4242
|
});
|
|
3775
4243
|
};
|
|
3776
4244
|
let renderedGroup;
|
|
3777
|
-
return /* @__PURE__ */ (0,
|
|
3778
|
-
/* @__PURE__ */ (0,
|
|
3779
|
-
/* @__PURE__ */ (0,
|
|
3780
|
-
/* @__PURE__ */ (0,
|
|
4245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: (0, import_clsx28.default)("flex w-full flex-col", className), children: [
|
|
4246
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2 border-b border-default px-3.5 py-3", children: [
|
|
4247
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react10.SearchIcon, { "aria-hidden": true, className: "size-4 shrink-0 text-icon-default-secondary" }),
|
|
4248
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3781
4249
|
"input",
|
|
3782
4250
|
{
|
|
3783
4251
|
role: "combobox",
|
|
@@ -3824,22 +4292,22 @@ function Command({
|
|
|
3824
4292
|
}
|
|
3825
4293
|
)
|
|
3826
4294
|
] }),
|
|
3827
|
-
/* @__PURE__ */ (0,
|
|
4295
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3828
4296
|
"div",
|
|
3829
4297
|
{
|
|
3830
4298
|
ref: listRef,
|
|
3831
4299
|
id: listboxId,
|
|
3832
4300
|
role: "listbox",
|
|
3833
4301
|
"aria-label": label,
|
|
3834
|
-
className: (0,
|
|
4302
|
+
className: (0, import_clsx28.default)("max-h-80 overflow-y-auto p-1.5", SCROLLBAR_CLASSES),
|
|
3835
4303
|
children: [
|
|
3836
|
-
matches.length === 0 && /* @__PURE__ */ (0,
|
|
4304
|
+
matches.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "px-2.5 py-6 text-center text-body-sm text-default-secondary", children: emptyMessage }),
|
|
3837
4305
|
matches.map((item, index) => {
|
|
3838
4306
|
const isActive = index === activeIndex;
|
|
3839
4307
|
const groupHeading = item.group !== renderedGroup ? item.group : void 0;
|
|
3840
4308
|
renderedGroup = item.group;
|
|
3841
|
-
return /* @__PURE__ */ (0,
|
|
3842
|
-
groupHeading && /* @__PURE__ */ (0,
|
|
4309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
4310
|
+
groupHeading && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3843
4311
|
"div",
|
|
3844
4312
|
{
|
|
3845
4313
|
role: "presentation",
|
|
@@ -3847,7 +4315,7 @@ function Command({
|
|
|
3847
4315
|
children: groupHeading
|
|
3848
4316
|
}
|
|
3849
4317
|
),
|
|
3850
|
-
/* @__PURE__ */ (0,
|
|
4318
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3851
4319
|
"div",
|
|
3852
4320
|
{
|
|
3853
4321
|
id: optionId(index),
|
|
@@ -3857,19 +4325,19 @@ function Command({
|
|
|
3857
4325
|
onPointerDown: (event) => event.preventDefault(),
|
|
3858
4326
|
onClick: () => run(item),
|
|
3859
4327
|
onPointerEnter: () => !item.disabled && setActiveIndex(index),
|
|
3860
|
-
className: (0,
|
|
4328
|
+
className: (0, import_clsx28.default)(
|
|
3861
4329
|
OVERLAY_ITEM_BASE,
|
|
3862
4330
|
OVERLAY_ITEM_SIZE.md,
|
|
3863
4331
|
"items-center",
|
|
3864
|
-
item.disabled ? "cursor-not-allowed text-disabled" : isActive ? (0,
|
|
4332
|
+
item.disabled ? "cursor-not-allowed text-disabled" : isActive ? (0, import_clsx28.default)(OVERLAY_ITEM_ACTIVE, "text-default") : "text-default"
|
|
3865
4333
|
),
|
|
3866
4334
|
children: [
|
|
3867
|
-
item.icon && /* @__PURE__ */ (0,
|
|
3868
|
-
/* @__PURE__ */ (0,
|
|
3869
|
-
/* @__PURE__ */ (0,
|
|
3870
|
-
item.description && /* @__PURE__ */ (0,
|
|
4335
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { "aria-hidden": true, className: "flex size-4 shrink-0 items-center justify-center", children: item.icon }),
|
|
4336
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
4337
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "block truncate", children: item.label }),
|
|
4338
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "block truncate text-body-tiny text-default-secondary", children: item.description })
|
|
3871
4339
|
] }),
|
|
3872
|
-
item.shortcut && /* @__PURE__ */ (0,
|
|
4340
|
+
item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "ml-auto flex shrink-0 items-center gap-1", children: item.shortcut })
|
|
3873
4341
|
]
|
|
3874
4342
|
}
|
|
3875
4343
|
)
|
|
@@ -3878,13 +4346,13 @@ function Command({
|
|
|
3878
4346
|
]
|
|
3879
4347
|
}
|
|
3880
4348
|
),
|
|
3881
|
-
/* @__PURE__ */ (0,
|
|
4349
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { "aria-live": "polite", className: "sr-only", children: `${matches.length} ${matches.length === 1 ? "result" : "results"}` })
|
|
3882
4350
|
] });
|
|
3883
4351
|
}
|
|
3884
4352
|
|
|
3885
4353
|
// src/components/status/status-badge.tsx
|
|
3886
|
-
var
|
|
3887
|
-
var
|
|
4354
|
+
var import_clsx29 = __toESM(require("clsx"), 1);
|
|
4355
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3888
4356
|
var TONE_STYLES2 = {
|
|
3889
4357
|
neutral: "bg-status-neutral text-status-neutral",
|
|
3890
4358
|
info: "bg-status-info text-status-info",
|
|
@@ -3915,18 +4383,18 @@ function StatusBadge({
|
|
|
3915
4383
|
icon,
|
|
3916
4384
|
className
|
|
3917
4385
|
}) {
|
|
3918
|
-
return /* @__PURE__ */ (0,
|
|
4386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3919
4387
|
"span",
|
|
3920
4388
|
{
|
|
3921
4389
|
"data-tone": tone,
|
|
3922
|
-
className: (0,
|
|
4390
|
+
className: (0, import_clsx29.default)(
|
|
3923
4391
|
"inline-flex items-center gap-1.5 rounded-full font-medium leading-tight whitespace-nowrap",
|
|
3924
4392
|
SIZE_STYLES[size2],
|
|
3925
4393
|
TONE_STYLES2[tone],
|
|
3926
4394
|
className
|
|
3927
4395
|
),
|
|
3928
4396
|
children: [
|
|
3929
|
-
icon ? /* @__PURE__ */ (0,
|
|
4397
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "shrink-0", children: icon }) : dot && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: (0, import_clsx29.default)("size-1.5 shrink-0 rounded-full", DOT_STYLES[tone]) }),
|
|
3930
4398
|
label
|
|
3931
4399
|
]
|
|
3932
4400
|
}
|
|
@@ -3934,8 +4402,8 @@ function StatusBadge({
|
|
|
3934
4402
|
}
|
|
3935
4403
|
|
|
3936
4404
|
// src/components/status/status-dot.tsx
|
|
3937
|
-
var
|
|
3938
|
-
var
|
|
4405
|
+
var import_clsx30 = __toESM(require("clsx"), 1);
|
|
4406
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3939
4407
|
var dotTones = {
|
|
3940
4408
|
brand: "bg-brand",
|
|
3941
4409
|
positive: "bg-positive",
|
|
@@ -3945,63 +4413,63 @@ var dotTones = {
|
|
|
3945
4413
|
default: "bg-default-tertiary"
|
|
3946
4414
|
};
|
|
3947
4415
|
function StatusDot({ tone = "default", color, className }) {
|
|
3948
|
-
return /* @__PURE__ */ (0,
|
|
4416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3949
4417
|
"span",
|
|
3950
4418
|
{
|
|
3951
4419
|
"data-tone": tone,
|
|
3952
|
-
className: (0,
|
|
4420
|
+
className: (0, import_clsx30.default)("inline-block size-1.5 shrink-0 rounded-full", !color && dotTones[tone], className),
|
|
3953
4421
|
style: color ? { backgroundColor: color } : void 0
|
|
3954
4422
|
}
|
|
3955
4423
|
);
|
|
3956
4424
|
}
|
|
3957
4425
|
|
|
3958
4426
|
// src/components/status/status-chip.tsx
|
|
3959
|
-
var
|
|
3960
|
-
var
|
|
4427
|
+
var import_clsx31 = __toESM(require("clsx"), 1);
|
|
4428
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3961
4429
|
function StatusChip({ label, count, tone = "default", dotColor, bg, className }) {
|
|
3962
|
-
return /* @__PURE__ */ (0,
|
|
4430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3963
4431
|
"span",
|
|
3964
4432
|
{
|
|
3965
4433
|
"data-tone": tone,
|
|
3966
|
-
className: (0,
|
|
4434
|
+
className: (0, import_clsx31.default)(
|
|
3967
4435
|
"inline-flex items-center gap-1.5 rounded-full px-3 py-1",
|
|
3968
4436
|
!bg && "bg-default-secondary",
|
|
3969
4437
|
className
|
|
3970
4438
|
),
|
|
3971
4439
|
style: bg ? { backgroundColor: bg } : void 0,
|
|
3972
4440
|
children: [
|
|
3973
|
-
/* @__PURE__ */ (0,
|
|
3974
|
-
/* @__PURE__ */ (0,
|
|
3975
|
-
/* @__PURE__ */ (0,
|
|
4441
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StatusDot, { tone, color: dotColor }),
|
|
4442
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-body-xs font-medium text-default", children: count }),
|
|
4443
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-body-xs text-default-secondary", children: label })
|
|
3976
4444
|
]
|
|
3977
4445
|
}
|
|
3978
4446
|
);
|
|
3979
4447
|
}
|
|
3980
4448
|
|
|
3981
4449
|
// src/components/status/count-badge.tsx
|
|
3982
|
-
var
|
|
3983
|
-
var
|
|
4450
|
+
var import_clsx32 = __toESM(require("clsx"), 1);
|
|
4451
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3984
4452
|
function CountBadge({ count, label, tone = "positive", className }) {
|
|
3985
|
-
return /* @__PURE__ */ (0,
|
|
4453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
3986
4454
|
"span",
|
|
3987
4455
|
{
|
|
3988
4456
|
"data-tone": tone,
|
|
3989
|
-
className: (0,
|
|
4457
|
+
className: (0, import_clsx32.default)(
|
|
3990
4458
|
"inline-flex items-center gap-1.5 rounded-full border border-default px-3 py-1 text-body-xs font-medium text-default",
|
|
3991
4459
|
className
|
|
3992
4460
|
),
|
|
3993
4461
|
children: [
|
|
3994
|
-
/* @__PURE__ */ (0,
|
|
4462
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(StatusDot, { tone }),
|
|
3995
4463
|
count,
|
|
3996
|
-
label && /* @__PURE__ */ (0,
|
|
4464
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-default-secondary", children: label })
|
|
3997
4465
|
]
|
|
3998
4466
|
}
|
|
3999
4467
|
);
|
|
4000
4468
|
}
|
|
4001
4469
|
|
|
4002
4470
|
// src/components/status/tag-pill.tsx
|
|
4003
|
-
var
|
|
4004
|
-
var
|
|
4471
|
+
var import_clsx33 = __toESM(require("clsx"), 1);
|
|
4472
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4005
4473
|
var toneStyles = {
|
|
4006
4474
|
default: "bg-default-secondary text-default-secondary",
|
|
4007
4475
|
brand: "bg-brand-tertiary text-brand",
|
|
@@ -4010,11 +4478,11 @@ var toneStyles = {
|
|
|
4010
4478
|
danger: "bg-danger-tertiary text-danger"
|
|
4011
4479
|
};
|
|
4012
4480
|
function TagPill({ label, tone = "default", bg, color, className }) {
|
|
4013
|
-
return /* @__PURE__ */ (0,
|
|
4481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4014
4482
|
"span",
|
|
4015
4483
|
{
|
|
4016
4484
|
"data-tone": tone,
|
|
4017
|
-
className: (0,
|
|
4485
|
+
className: (0, import_clsx33.default)(
|
|
4018
4486
|
"inline-flex items-center rounded-full px-2 py-0.5 text-body-xs font-medium",
|
|
4019
4487
|
!bg && !color && toneStyles[tone],
|
|
4020
4488
|
className
|
|
@@ -4029,8 +4497,8 @@ function TagPill({ label, tone = "default", bg, color, className }) {
|
|
|
4029
4497
|
}
|
|
4030
4498
|
|
|
4031
4499
|
// src/components/status/trail-chip.tsx
|
|
4032
|
-
var
|
|
4033
|
-
var
|
|
4500
|
+
var import_clsx34 = __toESM(require("clsx"), 1);
|
|
4501
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4034
4502
|
var DOT = {
|
|
4035
4503
|
neutral: "bg-status-dot-neutral",
|
|
4036
4504
|
info: "bg-status-dot-info",
|
|
@@ -4041,31 +4509,31 @@ var DOT = {
|
|
|
4041
4509
|
danger: "bg-status-dot-danger"
|
|
4042
4510
|
};
|
|
4043
4511
|
function TrailChip({ label, value, tone = "info", dotColor, className }) {
|
|
4044
|
-
return /* @__PURE__ */ (0,
|
|
4512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
4045
4513
|
"div",
|
|
4046
4514
|
{
|
|
4047
4515
|
"data-tone": tone,
|
|
4048
|
-
className: (0,
|
|
4516
|
+
className: (0, import_clsx34.default)(
|
|
4049
4517
|
"flex items-center gap-2 rounded-full border border-default bg-default px-3 py-1.5",
|
|
4050
4518
|
className
|
|
4051
4519
|
),
|
|
4052
4520
|
children: [
|
|
4053
|
-
/* @__PURE__ */ (0,
|
|
4521
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4054
4522
|
"span",
|
|
4055
4523
|
{
|
|
4056
|
-
className: (0,
|
|
4524
|
+
className: (0, import_clsx34.default)("size-1.5 shrink-0 rounded-full", !dotColor && DOT[tone]),
|
|
4057
4525
|
style: dotColor ? { backgroundColor: dotColor } : void 0
|
|
4058
4526
|
}
|
|
4059
4527
|
),
|
|
4060
|
-
/* @__PURE__ */ (0,
|
|
4061
|
-
/* @__PURE__ */ (0,
|
|
4528
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-body-tiny font-semibold uppercase tracking-wide text-default-secondary", children: label }),
|
|
4529
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-body-xs font-medium text-default", children: value })
|
|
4062
4530
|
]
|
|
4063
4531
|
}
|
|
4064
4532
|
);
|
|
4065
4533
|
}
|
|
4066
4534
|
|
|
4067
4535
|
// src/components/status/user-status-pill.tsx
|
|
4068
|
-
var
|
|
4536
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4069
4537
|
var STATUS_META = {
|
|
4070
4538
|
active: { label: "Active", tone: "positive" },
|
|
4071
4539
|
// `caution` (pale yellow), not `warning` (orange) — Pending is one step below a
|
|
@@ -4075,13 +4543,13 @@ var STATUS_META = {
|
|
|
4075
4543
|
};
|
|
4076
4544
|
function UserStatusPill({ status }) {
|
|
4077
4545
|
const { label, tone } = STATUS_META[status];
|
|
4078
|
-
return /* @__PURE__ */ (0,
|
|
4546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(StatusBadge, { label, tone });
|
|
4079
4547
|
}
|
|
4080
4548
|
|
|
4081
4549
|
// src/components/status/check-indicator.tsx
|
|
4082
|
-
var
|
|
4083
|
-
var
|
|
4084
|
-
var
|
|
4550
|
+
var import_clsx35 = __toESM(require("clsx"), 1);
|
|
4551
|
+
var import_lucide_react11 = require("lucide-react");
|
|
4552
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4085
4553
|
var STATUS_STYLES = {
|
|
4086
4554
|
passed: "bg-status-check-passed border-status-check-passed text-status-check-passed",
|
|
4087
4555
|
in_progress: "bg-status-check-progress border-status-check-progress text-status-check-progress",
|
|
@@ -4093,25 +4561,25 @@ var STATUS_STYLES = {
|
|
|
4093
4561
|
function StatusGlyph({ status }) {
|
|
4094
4562
|
switch (status) {
|
|
4095
4563
|
case "passed":
|
|
4096
|
-
return /* @__PURE__ */ (0,
|
|
4564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react11.CheckIcon, { className: "size-3", strokeWidth: 3, "aria-hidden": true });
|
|
4097
4565
|
case "failed":
|
|
4098
|
-
return /* @__PURE__ */ (0,
|
|
4566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react11.XIcon, { className: "size-3", strokeWidth: 3, "aria-hidden": true });
|
|
4099
4567
|
case "waived":
|
|
4100
|
-
return /* @__PURE__ */ (0,
|
|
4568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react11.MinusIcon, { className: "size-3", strokeWidth: 3, "aria-hidden": true });
|
|
4101
4569
|
case "in_progress":
|
|
4102
|
-
return /* @__PURE__ */ (0,
|
|
4570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react11.LoaderCircleIcon, { className: "size-3", strokeWidth: 3, "aria-hidden": true });
|
|
4103
4571
|
case "action_required":
|
|
4104
|
-
return /* @__PURE__ */ (0,
|
|
4572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react11.CircleAlertIcon, { className: "size-3.5", strokeWidth: 2.5, "aria-hidden": true });
|
|
4105
4573
|
case "pending":
|
|
4106
4574
|
return null;
|
|
4107
4575
|
}
|
|
4108
4576
|
}
|
|
4109
4577
|
function CheckIndicator({ status, label, className }) {
|
|
4110
|
-
return /* @__PURE__ */ (0,
|
|
4578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
4111
4579
|
"div",
|
|
4112
4580
|
{
|
|
4113
4581
|
"data-status": status,
|
|
4114
|
-
className: (0,
|
|
4582
|
+
className: (0, import_clsx35.default)(
|
|
4115
4583
|
"flex size-[22px] shrink-0 items-center justify-center rounded-full border-[1.5px]",
|
|
4116
4584
|
STATUS_STYLES[status],
|
|
4117
4585
|
className
|
|
@@ -4119,14 +4587,14 @@ function CheckIndicator({ status, label, className }) {
|
|
|
4119
4587
|
role: label ? "img" : void 0,
|
|
4120
4588
|
"aria-label": label,
|
|
4121
4589
|
"aria-hidden": label ? void 0 : true,
|
|
4122
|
-
children: /* @__PURE__ */ (0,
|
|
4590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(StatusGlyph, { status })
|
|
4123
4591
|
}
|
|
4124
4592
|
);
|
|
4125
4593
|
}
|
|
4126
4594
|
|
|
4127
4595
|
// src/components/status/entity-icon-badge.tsx
|
|
4128
|
-
var
|
|
4129
|
-
var
|
|
4596
|
+
var import_clsx36 = __toESM(require("clsx"), 1);
|
|
4597
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4130
4598
|
var sizeStyles4 = {
|
|
4131
4599
|
sm: "size-8",
|
|
4132
4600
|
md: "size-10"
|
|
@@ -4144,11 +4612,11 @@ var toneStyles2 = {
|
|
|
4144
4612
|
neutral: "bg-neutral-tertiary text-icon-neutral"
|
|
4145
4613
|
};
|
|
4146
4614
|
function EntityIconBadge({ size: size2 = "sm", tone = "default", shape = "square", bg, iconColor, children, className }) {
|
|
4147
|
-
return /* @__PURE__ */ (0,
|
|
4615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4148
4616
|
"span",
|
|
4149
4617
|
{
|
|
4150
4618
|
"data-tone": tone,
|
|
4151
|
-
className: (0,
|
|
4619
|
+
className: (0, import_clsx36.default)(
|
|
4152
4620
|
"inline-flex shrink-0 items-center justify-center",
|
|
4153
4621
|
sizeStyles4[size2],
|
|
4154
4622
|
shapeStyles[shape][size2],
|
|
@@ -4165,13 +4633,13 @@ function EntityIconBadge({ size: size2 = "sm", tone = "default", shape = "square
|
|
|
4165
4633
|
}
|
|
4166
4634
|
|
|
4167
4635
|
// src/components/forms/checkbox.tsx
|
|
4168
|
-
var
|
|
4169
|
-
var
|
|
4636
|
+
var import_react29 = require("react");
|
|
4637
|
+
var import_clsx38 = __toESM(require("clsx"), 1);
|
|
4170
4638
|
|
|
4171
4639
|
// src/components/forms/check-control.tsx
|
|
4172
|
-
var
|
|
4173
|
-
var
|
|
4174
|
-
var
|
|
4640
|
+
var import_clsx37 = __toESM(require("clsx"), 1);
|
|
4641
|
+
var import_lucide_react12 = require("lucide-react");
|
|
4642
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4175
4643
|
var CHECK_SIZE = {
|
|
4176
4644
|
sm: { box: "size-4", glyph: "size-2.5", dot: "size-1.5" },
|
|
4177
4645
|
md: { box: "size-[18px]", glyph: "size-3", dot: "size-2" }
|
|
@@ -4186,11 +4654,11 @@ function CheckControl({
|
|
|
4186
4654
|
}) {
|
|
4187
4655
|
const s = CHECK_SIZE[size2];
|
|
4188
4656
|
const on = checked || indeterminate;
|
|
4189
|
-
return /* @__PURE__ */ (0,
|
|
4657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4190
4658
|
"span",
|
|
4191
4659
|
{
|
|
4192
4660
|
"aria-hidden": true,
|
|
4193
|
-
className: (0,
|
|
4661
|
+
className: (0, import_clsx37.default)(
|
|
4194
4662
|
"mt-px flex shrink-0 items-center justify-center border-[1.5px] transition-colors",
|
|
4195
4663
|
s.box,
|
|
4196
4664
|
type === "radio" ? "rounded-full" : "rounded-[4px]",
|
|
@@ -4199,18 +4667,18 @@ function CheckControl({
|
|
|
4199
4667
|
"peer-focus-visible:ring-2 peer-focus-visible:ring-brand peer-focus-visible:ring-offset-1 peer-focus-visible:ring-offset-default",
|
|
4200
4668
|
disabled ? on ? "border-disabled bg-disabled text-disabled-on-disabled" : "border-disabled bg-disabled" : on ? "border-brand-emphasis bg-brand text-brand-on-brand" : invalid ? "border-danger bg-default" : "border-default-secondary bg-default"
|
|
4201
4669
|
),
|
|
4202
|
-
children: type === "checkbox" ? indeterminate ? /* @__PURE__ */ (0,
|
|
4670
|
+
children: type === "checkbox" ? indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react12.MinusIcon, { className: s.glyph, strokeWidth: 3 }) : checked ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react12.CheckIcon, { className: s.glyph, strokeWidth: 3 }) : null : checked ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: (0, import_clsx37.default)("rounded-full bg-current", s.dot) }) : null
|
|
4203
4671
|
}
|
|
4204
4672
|
);
|
|
4205
4673
|
}
|
|
4206
4674
|
|
|
4207
4675
|
// src/components/forms/checkbox.tsx
|
|
4208
|
-
var
|
|
4676
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4209
4677
|
var LABEL_TEXT2 = {
|
|
4210
4678
|
sm: "text-body-tiny",
|
|
4211
4679
|
md: "text-body-xs"
|
|
4212
4680
|
};
|
|
4213
|
-
var Checkbox = (0,
|
|
4681
|
+
var Checkbox = (0, import_react29.forwardRef)(function Checkbox2({
|
|
4214
4682
|
checked: checkedProp,
|
|
4215
4683
|
defaultChecked = false,
|
|
4216
4684
|
onCheckedChange,
|
|
@@ -4229,24 +4697,24 @@ var Checkbox = (0, import_react27.forwardRef)(function Checkbox2({
|
|
|
4229
4697
|
defaultValue: defaultChecked,
|
|
4230
4698
|
onChange: onCheckedChange
|
|
4231
4699
|
});
|
|
4232
|
-
const inputRef = (0,
|
|
4233
|
-
const generatedId = (0,
|
|
4700
|
+
const inputRef = (0, import_react29.useRef)(null);
|
|
4701
|
+
const generatedId = (0, import_react29.useId)();
|
|
4234
4702
|
const controlId = id ?? generatedId;
|
|
4235
4703
|
const descriptionId = `${controlId}-description`;
|
|
4236
|
-
(0,
|
|
4704
|
+
(0, import_react29.useEffect)(() => {
|
|
4237
4705
|
if (inputRef.current) inputRef.current.indeterminate = indeterminate;
|
|
4238
4706
|
}, [indeterminate]);
|
|
4239
|
-
return /* @__PURE__ */ (0,
|
|
4240
|
-
/* @__PURE__ */ (0,
|
|
4707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: (0, import_clsx38.default)("flex flex-col", className), children: [
|
|
4708
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4241
4709
|
"label",
|
|
4242
4710
|
{
|
|
4243
4711
|
htmlFor: controlId,
|
|
4244
|
-
className: (0,
|
|
4712
|
+
className: (0, import_clsx38.default)(
|
|
4245
4713
|
"group inline-flex items-start gap-2.5",
|
|
4246
4714
|
disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer"
|
|
4247
4715
|
),
|
|
4248
4716
|
children: [
|
|
4249
|
-
/* @__PURE__ */ (0,
|
|
4717
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4250
4718
|
"input",
|
|
4251
4719
|
{
|
|
4252
4720
|
ref: composeRefs(inputRef, ref),
|
|
@@ -4261,7 +4729,7 @@ var Checkbox = (0, import_react27.forwardRef)(function Checkbox2({
|
|
|
4261
4729
|
...props
|
|
4262
4730
|
}
|
|
4263
4731
|
),
|
|
4264
|
-
/* @__PURE__ */ (0,
|
|
4732
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4265
4733
|
CheckControl,
|
|
4266
4734
|
{
|
|
4267
4735
|
type: "checkbox",
|
|
@@ -4272,15 +4740,15 @@ var Checkbox = (0, import_react27.forwardRef)(function Checkbox2({
|
|
|
4272
4740
|
size: size2
|
|
4273
4741
|
}
|
|
4274
4742
|
),
|
|
4275
|
-
label && /* @__PURE__ */ (0,
|
|
4743
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: (0, import_clsx38.default)(LABEL_TEXT2[size2], "text-default"), children: label })
|
|
4276
4744
|
]
|
|
4277
4745
|
}
|
|
4278
4746
|
),
|
|
4279
|
-
description && /* @__PURE__ */ (0,
|
|
4747
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4280
4748
|
"span",
|
|
4281
4749
|
{
|
|
4282
4750
|
id: descriptionId,
|
|
4283
|
-
className: (0,
|
|
4751
|
+
className: (0, import_clsx38.default)(
|
|
4284
4752
|
"mt-0.5 pl-[26px]",
|
|
4285
4753
|
LABEL_TEXT2[size2],
|
|
4286
4754
|
disabled ? "text-disabled" : "text-default-secondary"
|
|
@@ -4292,11 +4760,11 @@ var Checkbox = (0, import_react27.forwardRef)(function Checkbox2({
|
|
|
4292
4760
|
});
|
|
4293
4761
|
|
|
4294
4762
|
// src/components/forms/radio-group.tsx
|
|
4295
|
-
var
|
|
4296
|
-
var
|
|
4297
|
-
var
|
|
4298
|
-
var RadioGroupContext = (0,
|
|
4299
|
-
var RadioGroup = (0,
|
|
4763
|
+
var import_react30 = require("react");
|
|
4764
|
+
var import_clsx39 = __toESM(require("clsx"), 1);
|
|
4765
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4766
|
+
var RadioGroupContext = (0, import_react30.createContext)(null);
|
|
4767
|
+
var RadioGroup = (0, import_react30.forwardRef)(function RadioGroup2({
|
|
4300
4768
|
children,
|
|
4301
4769
|
value: valueProp,
|
|
4302
4770
|
defaultValue,
|
|
@@ -4311,13 +4779,13 @@ var RadioGroup = (0, import_react28.forwardRef)(function RadioGroup2({
|
|
|
4311
4779
|
className,
|
|
4312
4780
|
...rest
|
|
4313
4781
|
}, ref) {
|
|
4314
|
-
const generatedName = (0,
|
|
4782
|
+
const generatedName = (0, import_react30.useId)();
|
|
4315
4783
|
const [value, setValue] = useControllableState({
|
|
4316
4784
|
value: valueProp,
|
|
4317
4785
|
defaultValue,
|
|
4318
4786
|
onChange: onValueChange
|
|
4319
4787
|
});
|
|
4320
|
-
return /* @__PURE__ */ (0,
|
|
4788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4321
4789
|
RadioGroupContext.Provider,
|
|
4322
4790
|
{
|
|
4323
4791
|
value: {
|
|
@@ -4328,7 +4796,7 @@ var RadioGroup = (0, import_react28.forwardRef)(function RadioGroup2({
|
|
|
4328
4796
|
disabled,
|
|
4329
4797
|
invalid
|
|
4330
4798
|
},
|
|
4331
|
-
children: /* @__PURE__ */ (0,
|
|
4799
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4332
4800
|
"div",
|
|
4333
4801
|
{
|
|
4334
4802
|
ref,
|
|
@@ -4338,7 +4806,7 @@ var RadioGroup = (0, import_react28.forwardRef)(function RadioGroup2({
|
|
|
4338
4806
|
"aria-invalid": invalid || void 0,
|
|
4339
4807
|
"aria-orientation": orientation,
|
|
4340
4808
|
"data-slot": "radio-group",
|
|
4341
|
-
className: (0,
|
|
4809
|
+
className: (0, import_clsx39.default)(
|
|
4342
4810
|
"flex",
|
|
4343
4811
|
orientation === "vertical" ? "flex-col gap-2.5" : "flex-row flex-wrap gap-4",
|
|
4344
4812
|
className
|
|
@@ -4354,25 +4822,25 @@ var LABEL_TEXT3 = {
|
|
|
4354
4822
|
sm: "text-body-tiny",
|
|
4355
4823
|
md: "text-body-xs"
|
|
4356
4824
|
};
|
|
4357
|
-
var Radio = (0,
|
|
4358
|
-
const group = (0,
|
|
4825
|
+
var Radio = (0, import_react30.forwardRef)(function Radio2({ value, label, description, disabled, id, className, ...props }, ref) {
|
|
4826
|
+
const group = (0, import_react30.useContext)(RadioGroupContext);
|
|
4359
4827
|
if (!group) throw new Error("<Radio> must be used inside <RadioGroup>");
|
|
4360
|
-
const generatedId = (0,
|
|
4828
|
+
const generatedId = (0, import_react30.useId)();
|
|
4361
4829
|
const controlId = id ?? generatedId;
|
|
4362
4830
|
const descriptionId = `${controlId}-description`;
|
|
4363
4831
|
const isDisabled = disabled ?? group.disabled;
|
|
4364
4832
|
const checked = group.value === value;
|
|
4365
|
-
return /* @__PURE__ */ (0,
|
|
4366
|
-
/* @__PURE__ */ (0,
|
|
4833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: (0, import_clsx39.default)("flex flex-col", className), children: [
|
|
4834
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
4367
4835
|
"label",
|
|
4368
4836
|
{
|
|
4369
4837
|
htmlFor: controlId,
|
|
4370
|
-
className: (0,
|
|
4838
|
+
className: (0, import_clsx39.default)(
|
|
4371
4839
|
"group inline-flex items-start gap-2.5",
|
|
4372
4840
|
isDisabled ? "cursor-not-allowed opacity-60" : "cursor-pointer"
|
|
4373
4841
|
),
|
|
4374
4842
|
children: [
|
|
4375
|
-
/* @__PURE__ */ (0,
|
|
4843
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4376
4844
|
"input",
|
|
4377
4845
|
{
|
|
4378
4846
|
ref,
|
|
@@ -4388,7 +4856,7 @@ var Radio = (0, import_react28.forwardRef)(function Radio2({ value, label, descr
|
|
|
4388
4856
|
...props
|
|
4389
4857
|
}
|
|
4390
4858
|
),
|
|
4391
|
-
/* @__PURE__ */ (0,
|
|
4859
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4392
4860
|
CheckControl,
|
|
4393
4861
|
{
|
|
4394
4862
|
type: "radio",
|
|
@@ -4398,15 +4866,15 @@ var Radio = (0, import_react28.forwardRef)(function Radio2({ value, label, descr
|
|
|
4398
4866
|
size: group.size
|
|
4399
4867
|
}
|
|
4400
4868
|
),
|
|
4401
|
-
label && /* @__PURE__ */ (0,
|
|
4869
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: (0, import_clsx39.default)(LABEL_TEXT3[group.size], "text-default"), children: label })
|
|
4402
4870
|
]
|
|
4403
4871
|
}
|
|
4404
4872
|
),
|
|
4405
|
-
description && /* @__PURE__ */ (0,
|
|
4873
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4406
4874
|
"span",
|
|
4407
4875
|
{
|
|
4408
4876
|
id: descriptionId,
|
|
4409
|
-
className: (0,
|
|
4877
|
+
className: (0, import_clsx39.default)(
|
|
4410
4878
|
"mt-0.5 pl-[26px]",
|
|
4411
4879
|
LABEL_TEXT3[group.size],
|
|
4412
4880
|
isDisabled ? "text-disabled" : "text-default-secondary"
|
|
@@ -4418,11 +4886,11 @@ var Radio = (0, import_react28.forwardRef)(function Radio2({ value, label, descr
|
|
|
4418
4886
|
});
|
|
4419
4887
|
|
|
4420
4888
|
// src/components/forms/radio-cards.tsx
|
|
4421
|
-
var
|
|
4422
|
-
var
|
|
4423
|
-
var
|
|
4424
|
-
var RadioCardsContext = (0,
|
|
4425
|
-
var RadioCards = (0,
|
|
4889
|
+
var import_react31 = require("react");
|
|
4890
|
+
var import_clsx40 = __toESM(require("clsx"), 1);
|
|
4891
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4892
|
+
var RadioCardsContext = (0, import_react31.createContext)(null);
|
|
4893
|
+
var RadioCards = (0, import_react31.forwardRef)(function RadioCards2({
|
|
4426
4894
|
children,
|
|
4427
4895
|
value: valueProp,
|
|
4428
4896
|
defaultValue,
|
|
@@ -4435,17 +4903,17 @@ var RadioCards = (0, import_react29.forwardRef)(function RadioCards2({
|
|
|
4435
4903
|
className,
|
|
4436
4904
|
...rest
|
|
4437
4905
|
}, ref) {
|
|
4438
|
-
const generatedName = (0,
|
|
4906
|
+
const generatedName = (0, import_react31.useId)();
|
|
4439
4907
|
const [value, setValue] = useControllableState({
|
|
4440
4908
|
value: valueProp,
|
|
4441
4909
|
defaultValue,
|
|
4442
4910
|
onChange: onValueChange
|
|
4443
4911
|
});
|
|
4444
|
-
return /* @__PURE__ */ (0,
|
|
4912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4445
4913
|
RadioCardsContext.Provider,
|
|
4446
4914
|
{
|
|
4447
4915
|
value: { name: name ?? generatedName, value, setValue, size: size2, disabled, required },
|
|
4448
|
-
children: /* @__PURE__ */ (0,
|
|
4916
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4449
4917
|
"div",
|
|
4450
4918
|
{
|
|
4451
4919
|
ref,
|
|
@@ -4465,14 +4933,14 @@ var SIZE6 = {
|
|
|
4465
4933
|
default: { pad: "p-4", iconBox: "size-10 rounded-xl", icon: "size-5", mark: "size-5", gap: "mt-3", title: "text-body-sm" },
|
|
4466
4934
|
sm: { pad: "p-3", iconBox: "size-8 rounded-lg", icon: "size-4", mark: "size-4", gap: "mt-2", title: "text-body-xs" }
|
|
4467
4935
|
};
|
|
4468
|
-
var RadioCardsItem = (0,
|
|
4469
|
-
const group = (0,
|
|
4936
|
+
var RadioCardsItem = (0, import_react31.forwardRef)(function RadioCardsItem2({ value, title, description, icon, disabled: itemDisabled = false, className }, ref) {
|
|
4937
|
+
const group = (0, import_react31.useContext)(RadioCardsContext);
|
|
4470
4938
|
if (!group) throw new Error("<RadioCardsItem> must be used inside <RadioCards>");
|
|
4471
4939
|
const s = SIZE6[group.size];
|
|
4472
4940
|
const disabled = group.disabled || itemDisabled;
|
|
4473
|
-
const titleId = (0,
|
|
4474
|
-
const descriptionId = (0,
|
|
4475
|
-
return /* @__PURE__ */ (0,
|
|
4941
|
+
const titleId = (0, import_react31.useId)();
|
|
4942
|
+
const descriptionId = (0, import_react31.useId)();
|
|
4943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
4476
4944
|
"label",
|
|
4477
4945
|
{
|
|
4478
4946
|
"data-slot": "radio-cards-item",
|
|
@@ -4487,7 +4955,7 @@ var RadioCardsItem = (0, import_react29.forwardRef)(function RadioCardsItem2({ v
|
|
|
4487
4955
|
className
|
|
4488
4956
|
),
|
|
4489
4957
|
children: [
|
|
4490
|
-
/* @__PURE__ */ (0,
|
|
4958
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4491
4959
|
"input",
|
|
4492
4960
|
{
|
|
4493
4961
|
ref,
|
|
@@ -4503,35 +4971,35 @@ var RadioCardsItem = (0, import_react29.forwardRef)(function RadioCardsItem2({ v
|
|
|
4503
4971
|
className: "sr-only"
|
|
4504
4972
|
}
|
|
4505
4973
|
),
|
|
4506
|
-
/* @__PURE__ */ (0,
|
|
4507
|
-
icon ? /* @__PURE__ */ (0,
|
|
4974
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-start justify-between gap-2", children: [
|
|
4975
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4508
4976
|
"span",
|
|
4509
4977
|
{
|
|
4510
4978
|
"aria-hidden": true,
|
|
4511
|
-
className: (0,
|
|
4979
|
+
className: (0, import_clsx40.default)(
|
|
4512
4980
|
"flex shrink-0 items-center justify-center bg-brand-tertiary",
|
|
4513
4981
|
"[label:has(:checked)_&]:bg-brand",
|
|
4514
4982
|
s.iconBox
|
|
4515
4983
|
),
|
|
4516
|
-
children: /* @__PURE__ */ (0,
|
|
4984
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: (0, import_clsx40.default)(s.icon, "text-icon-brand [label:has(:checked)_&]:text-icon-brand-on-brand"), children: icon })
|
|
4517
4985
|
}
|
|
4518
|
-
) : /* @__PURE__ */ (0,
|
|
4519
|
-
/* @__PURE__ */ (0,
|
|
4986
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", {}),
|
|
4987
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4520
4988
|
"span",
|
|
4521
4989
|
{
|
|
4522
4990
|
"aria-hidden": true,
|
|
4523
|
-
className: (0,
|
|
4991
|
+
className: (0, import_clsx40.default)(
|
|
4524
4992
|
"flex shrink-0 items-center justify-center rounded-full border-2 border-default",
|
|
4525
4993
|
"[label:has(:checked)_&]:border-brand",
|
|
4526
4994
|
s.mark
|
|
4527
4995
|
),
|
|
4528
|
-
children: /* @__PURE__ */ (0,
|
|
4996
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "size-2 scale-0 rounded-full bg-brand transition-transform [label:has(:checked)_&]:scale-100" })
|
|
4529
4997
|
}
|
|
4530
4998
|
)
|
|
4531
4999
|
] }),
|
|
4532
|
-
/* @__PURE__ */ (0,
|
|
4533
|
-
/* @__PURE__ */ (0,
|
|
4534
|
-
description && /* @__PURE__ */ (0,
|
|
5000
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: s.gap, children: [
|
|
5001
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { id: titleId, className: (0, import_clsx40.default)("block font-semibold text-default [label:has(:checked)_&]:text-brand", s.title), children: title }),
|
|
5002
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { id: descriptionId, className: "mt-0.5 block text-body-tiny text-default-secondary", children: description })
|
|
4535
5003
|
] })
|
|
4536
5004
|
]
|
|
4537
5005
|
}
|
|
@@ -4539,10 +5007,10 @@ var RadioCardsItem = (0, import_react29.forwardRef)(function RadioCardsItem2({ v
|
|
|
4539
5007
|
});
|
|
4540
5008
|
|
|
4541
5009
|
// src/components/forms/checkbox-group.tsx
|
|
4542
|
-
var
|
|
4543
|
-
var
|
|
4544
|
-
var CheckboxGroupContext = (0,
|
|
4545
|
-
var CheckboxGroup = (0,
|
|
5010
|
+
var import_react32 = require("react");
|
|
5011
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
5012
|
+
var CheckboxGroupContext = (0, import_react32.createContext)(null);
|
|
5013
|
+
var CheckboxGroup = (0, import_react32.forwardRef)(function CheckboxGroup2({
|
|
4546
5014
|
children,
|
|
4547
5015
|
legend,
|
|
4548
5016
|
value: valueProp,
|
|
@@ -4555,7 +5023,7 @@ var CheckboxGroup = (0, import_react30.forwardRef)(function CheckboxGroup2({
|
|
|
4555
5023
|
required = false,
|
|
4556
5024
|
className
|
|
4557
5025
|
}, ref) {
|
|
4558
|
-
const generatedName = (0,
|
|
5026
|
+
const generatedName = (0, import_react32.useId)();
|
|
4559
5027
|
const [value, setValue] = useControllableState({
|
|
4560
5028
|
value: valueProp,
|
|
4561
5029
|
defaultValue,
|
|
@@ -4570,8 +5038,8 @@ var CheckboxGroup = (0, import_react30.forwardRef)(function CheckboxGroup2({
|
|
|
4570
5038
|
disabled,
|
|
4571
5039
|
required: required && value.length === 0
|
|
4572
5040
|
};
|
|
4573
|
-
return /* @__PURE__ */ (0,
|
|
4574
|
-
/* @__PURE__ */ (0,
|
|
5041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(FieldSet, { ref, "data-slot": "checkbox-group", "data-required": required || void 0, className, children: [
|
|
5042
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4575
5043
|
FieldLegend,
|
|
4576
5044
|
{
|
|
4577
5045
|
variant: "label",
|
|
@@ -4579,14 +5047,14 @@ var CheckboxGroup = (0, import_react30.forwardRef)(function CheckboxGroup2({
|
|
|
4579
5047
|
children: legend
|
|
4580
5048
|
}
|
|
4581
5049
|
),
|
|
4582
|
-
/* @__PURE__ */ (0,
|
|
5050
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: cn("flex", orientation === "vertical" ? "flex-col gap-2.5" : "flex-row flex-wrap gap-4"), children })
|
|
4583
5051
|
] }) });
|
|
4584
5052
|
});
|
|
4585
|
-
var CheckboxGroupItem = (0,
|
|
5053
|
+
var CheckboxGroupItem = (0, import_react32.forwardRef)(
|
|
4586
5054
|
function CheckboxGroupItem2({ value, label, description, disabled }, ref) {
|
|
4587
|
-
const group = (0,
|
|
5055
|
+
const group = (0, import_react32.useContext)(CheckboxGroupContext);
|
|
4588
5056
|
if (!group) throw new Error("<CheckboxGroupItem> must be used inside <CheckboxGroup>");
|
|
4589
|
-
return /* @__PURE__ */ (0,
|
|
5057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4590
5058
|
Checkbox,
|
|
4591
5059
|
{
|
|
4592
5060
|
ref,
|
|
@@ -4605,8 +5073,8 @@ var CheckboxGroupItem = (0, import_react30.forwardRef)(
|
|
|
4605
5073
|
);
|
|
4606
5074
|
|
|
4607
5075
|
// src/components/forms/segmented-control.tsx
|
|
4608
|
-
var
|
|
4609
|
-
var
|
|
5076
|
+
var import_clsx41 = __toESM(require("clsx"), 1);
|
|
5077
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
4610
5078
|
function SegmentedControl({
|
|
4611
5079
|
options,
|
|
4612
5080
|
value: valueProp,
|
|
@@ -4629,12 +5097,12 @@ function SegmentedControl({
|
|
|
4629
5097
|
loop: true,
|
|
4630
5098
|
defaultIndex: selectedIndex
|
|
4631
5099
|
});
|
|
4632
|
-
return /* @__PURE__ */ (0,
|
|
5100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4633
5101
|
"div",
|
|
4634
5102
|
{
|
|
4635
5103
|
role: "radiogroup",
|
|
4636
5104
|
"aria-label": label,
|
|
4637
|
-
className: (0,
|
|
5105
|
+
className: (0, import_clsx41.default)(
|
|
4638
5106
|
"inline-flex items-center rounded-xl border border-default bg-default-secondary p-0.5",
|
|
4639
5107
|
className
|
|
4640
5108
|
),
|
|
@@ -4645,7 +5113,7 @@ function SegmentedControl({
|
|
|
4645
5113
|
disabled: option.disabled,
|
|
4646
5114
|
label: option.label
|
|
4647
5115
|
});
|
|
4648
|
-
return /* @__PURE__ */ (0,
|
|
5116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4649
5117
|
"button",
|
|
4650
5118
|
{
|
|
4651
5119
|
type: "button",
|
|
@@ -4659,7 +5127,7 @@ function SegmentedControl({
|
|
|
4659
5127
|
if (!option.disabled) setValue(option.value);
|
|
4660
5128
|
},
|
|
4661
5129
|
onClick: () => !option.disabled && setValue(option.value),
|
|
4662
|
-
className: (0,
|
|
5130
|
+
className: (0, import_clsx41.default)(
|
|
4663
5131
|
"rounded-lg px-3.5 py-1.5 text-body-xs font-medium transition-colors",
|
|
4664
5132
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default-secondary",
|
|
4665
5133
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
@@ -4675,10 +5143,10 @@ function SegmentedControl({
|
|
|
4675
5143
|
}
|
|
4676
5144
|
|
|
4677
5145
|
// src/components/forms/slider.tsx
|
|
4678
|
-
var
|
|
4679
|
-
var
|
|
4680
|
-
var
|
|
4681
|
-
var Slider = (0,
|
|
5146
|
+
var import_react33 = require("react");
|
|
5147
|
+
var import_clsx42 = __toESM(require("clsx"), 1);
|
|
5148
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5149
|
+
var Slider = (0, import_react33.forwardRef)(function Slider2({
|
|
4682
5150
|
value,
|
|
4683
5151
|
defaultValue,
|
|
4684
5152
|
onValueChange,
|
|
@@ -4690,312 +5158,108 @@ var Slider = (0, import_react31.forwardRef)(function Slider2({
|
|
|
4690
5158
|
showValue = false,
|
|
4691
5159
|
formatValue,
|
|
4692
5160
|
disabled = false,
|
|
4693
|
-
id,
|
|
4694
|
-
className,
|
|
4695
|
-
...props
|
|
4696
|
-
}, ref) {
|
|
4697
|
-
const generatedId = (0,
|
|
4698
|
-
const controlId = id ?? generatedId;
|
|
4699
|
-
const descriptionId = `${controlId}-description`;
|
|
4700
|
-
const current = value ?? defaultValue ?? min;
|
|
4701
|
-
const display = formatValue ? formatValue(current) : String(current);
|
|
4702
|
-
return /* @__PURE__ */ (0,
|
|
4703
|
-
(label || showValue) && /* @__PURE__ */ (0,
|
|
4704
|
-
label && /* @__PURE__ */ (0,
|
|
4705
|
-
"label",
|
|
4706
|
-
{
|
|
4707
|
-
htmlFor: controlId,
|
|
4708
|
-
className: (0,
|
|
4709
|
-
children: label
|
|
4710
|
-
}
|
|
4711
|
-
),
|
|
4712
|
-
showValue && /* @__PURE__ */ (0,
|
|
4713
|
-
] }),
|
|
4714
|
-
description && /* @__PURE__ */ (0,
|
|
4715
|
-
"p",
|
|
4716
|
-
{
|
|
4717
|
-
id: descriptionId,
|
|
4718
|
-
className: (0,
|
|
4719
|
-
children: description
|
|
4720
|
-
}
|
|
4721
|
-
),
|
|
4722
|
-
/* @__PURE__ */ (0,
|
|
4723
|
-
"input",
|
|
4724
|
-
{
|
|
4725
|
-
ref,
|
|
4726
|
-
id: controlId,
|
|
4727
|
-
type: "range",
|
|
4728
|
-
min,
|
|
4729
|
-
max,
|
|
4730
|
-
step,
|
|
4731
|
-
value,
|
|
4732
|
-
defaultValue: value === void 0 ? defaultValue : void 0,
|
|
4733
|
-
disabled,
|
|
4734
|
-
"aria-describedby": description ? descriptionId : void 0,
|
|
4735
|
-
"aria-valuetext": formatValue ? display : void 0,
|
|
4736
|
-
onChange: (event) => onValueChange?.(Number(event.target.value)),
|
|
4737
|
-
className: (0,
|
|
4738
|
-
"h-5 w-full cursor-pointer appearance-none bg-transparent",
|
|
4739
|
-
"focus-visible:outline-none",
|
|
4740
|
-
disabled && "cursor-not-allowed opacity-50",
|
|
4741
|
-
// Track
|
|
4742
|
-
"[&::-webkit-slider-runnable-track]:h-1.5 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:bg-default-tertiary",
|
|
4743
|
-
"[&::-moz-range-track]:h-1.5 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:bg-default-tertiary",
|
|
4744
|
-
"[&::-moz-range-progress]:h-1.5 [&::-moz-range-progress]:rounded-full [&::-moz-range-progress]:bg-brand",
|
|
4745
|
-
// Thumb. The negative margin centres it on the track, since the input box is
|
|
4746
|
-
// taller than the track to keep a comfortable pointer target.
|
|
4747
|
-
"[&::-webkit-slider-thumb]:-mt-[7px] [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-brand [&::-webkit-slider-thumb]:bg-default [&::-webkit-slider-thumb]:shadow-100",
|
|
4748
|
-
"[&::-moz-range-thumb]:size-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-brand [&::-moz-range-thumb]:bg-default",
|
|
4749
|
-
// Focus ring on the thumb, not the whole 100%-wide input — a ring around the
|
|
4750
|
-
// full track reads as the row being focused rather than the handle.
|
|
4751
|
-
"focus-visible:[&::-webkit-slider-thumb]:ring-2 focus-visible:[&::-webkit-slider-thumb]:ring-brand focus-visible:[&::-webkit-slider-thumb]:ring-offset-1",
|
|
4752
|
-
"focus-visible:[&::-moz-range-thumb]:ring-2 focus-visible:[&::-moz-range-thumb]:ring-brand"
|
|
4753
|
-
),
|
|
4754
|
-
...props
|
|
4755
|
-
}
|
|
4756
|
-
)
|
|
4757
|
-
] });
|
|
4758
|
-
});
|
|
4759
|
-
|
|
4760
|
-
// src/components/forms/label.tsx
|
|
4761
|
-
var
|
|
4762
|
-
var
|
|
4763
|
-
var
|
|
4764
|
-
var SIZE7 = {
|
|
4765
|
-
lg: "text-body",
|
|
4766
|
-
md: "text-body-sm",
|
|
4767
|
-
sm: "text-body-tiny"
|
|
4768
|
-
};
|
|
4769
|
-
var Label = (0,
|
|
4770
|
-
const field = useFieldContext();
|
|
4771
|
-
const resolvedSize = size2 ?? field?.size ?? "md";
|
|
4772
|
-
return /* @__PURE__ */ (0,
|
|
4773
|
-
"label",
|
|
4774
|
-
{
|
|
4775
|
-
ref,
|
|
4776
|
-
htmlFor: htmlFor ?? field?.controlId,
|
|
4777
|
-
"data-slot": "label",
|
|
4778
|
-
className: (0, import_clsx42.default)(
|
|
4779
|
-
"select-none",
|
|
4780
|
-
SIZE7[resolvedSize],
|
|
4781
|
-
field?.disabled ? "text-disabled" : "text-default",
|
|
4782
|
-
className
|
|
4783
|
-
),
|
|
4784
|
-
...rest,
|
|
4785
|
-
children
|
|
4786
|
-
}
|
|
4787
|
-
);
|
|
4788
|
-
});
|
|
4789
|
-
|
|
4790
|
-
// src/components/forms/calendar.tsx
|
|
4791
|
-
var import_react33 = require("react");
|
|
4792
|
-
var import_clsx43 = __toESM(require("clsx"), 1);
|
|
4793
|
-
var import_lucide_react12 = require("lucide-react");
|
|
4794
|
-
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
4795
|
-
var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
4796
|
-
var sameDay = (a, b) => !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
4797
|
-
var addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
|
|
4798
|
-
var addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
|
|
4799
|
-
var isBefore = (a, b) => startOfDay(a).getTime() < startOfDay(b).getTime();
|
|
4800
|
-
var isAfter = (a, b) => startOfDay(a).getTime() > startOfDay(b).getTime();
|
|
4801
|
-
var inRange = (d, from, to) => startOfDay(d).getTime() > startOfDay(from).getTime() && startOfDay(d).getTime() < startOfDay(to).getTime();
|
|
4802
|
-
function monthGrid(month, weekStartsOn) {
|
|
4803
|
-
const first = new Date(month.getFullYear(), month.getMonth(), 1);
|
|
4804
|
-
const offset2 = (first.getDay() - weekStartsOn + 7) % 7;
|
|
4805
|
-
const start = addDays(first, -offset2);
|
|
4806
|
-
return Array.from({ length: 42 }, (_, i) => addDays(start, i));
|
|
4807
|
-
}
|
|
4808
|
-
function Calendar({
|
|
4809
|
-
mode = "single",
|
|
4810
|
-
value,
|
|
4811
|
-
range,
|
|
4812
|
-
onSelect,
|
|
4813
|
-
onRangeChange,
|
|
4814
|
-
defaultMonth,
|
|
4815
|
-
min,
|
|
4816
|
-
max,
|
|
4817
|
-
isDateDisabled,
|
|
4818
|
-
weekStartsOn = 1,
|
|
4819
|
-
locale,
|
|
4820
|
-
label = "Calendar",
|
|
4821
|
-
className,
|
|
4822
|
-
...rest
|
|
4823
|
-
}) {
|
|
4824
|
-
const today = (0, import_react33.useMemo)(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
4825
|
-
const gridId = (0, import_react33.useId)();
|
|
4826
|
-
const [month, setMonth] = (0, import_react33.useState)(
|
|
4827
|
-
() => defaultMonth ?? value ?? range?.from ?? today
|
|
4828
|
-
);
|
|
4829
|
-
const [focusedDate, setFocusedDate] = (0, import_react33.useState)(
|
|
4830
|
-
() => value ?? range?.from ?? today
|
|
4831
|
-
);
|
|
4832
|
-
const cellRefs = (0, import_react33.useRef)(/* @__PURE__ */ new Map());
|
|
4833
|
-
const monthFormatter = (0, import_react33.useMemo)(
|
|
4834
|
-
() => new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }),
|
|
4835
|
-
[locale]
|
|
4836
|
-
);
|
|
4837
|
-
const dayNameFormatter = (0, import_react33.useMemo)(
|
|
4838
|
-
() => new Intl.DateTimeFormat(locale, { weekday: "short" }),
|
|
4839
|
-
[locale]
|
|
4840
|
-
);
|
|
4841
|
-
const fullDateFormatter = (0, import_react33.useMemo)(
|
|
4842
|
-
() => new Intl.DateTimeFormat(locale, { weekday: "long", day: "numeric", month: "long", year: "numeric" }),
|
|
4843
|
-
[locale]
|
|
4844
|
-
);
|
|
4845
|
-
const disabled = (0, import_react33.useCallback)(
|
|
4846
|
-
(date) => {
|
|
4847
|
-
if (min && isBefore(date, min)) return true;
|
|
4848
|
-
if (max && isAfter(date, max)) return true;
|
|
4849
|
-
return isDateDisabled?.(date) ?? false;
|
|
4850
|
-
},
|
|
4851
|
-
[min, max, isDateDisabled]
|
|
4852
|
-
);
|
|
4853
|
-
const key = (d) => `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
4854
|
-
const pendingFocus = (0, import_react33.useRef)(false);
|
|
4855
|
-
const focusDate = (0, import_react33.useCallback)((date) => {
|
|
4856
|
-
pendingFocus.current = true;
|
|
4857
|
-
setFocusedDate(date);
|
|
4858
|
-
setMonth(
|
|
4859
|
-
(current) => current.getFullYear() === date.getFullYear() && current.getMonth() === date.getMonth() ? current : new Date(date.getFullYear(), date.getMonth(), 1)
|
|
4860
|
-
);
|
|
4861
|
-
}, []);
|
|
4862
|
-
(0, import_react33.useEffect)(() => {
|
|
4863
|
-
if (!pendingFocus.current) return;
|
|
4864
|
-
const node = cellRefs.current.get(key(focusedDate));
|
|
4865
|
-
if (node) {
|
|
4866
|
-
node.focus();
|
|
4867
|
-
pendingFocus.current = false;
|
|
4868
|
-
}
|
|
4869
|
-
}, [focusedDate, month]);
|
|
4870
|
-
const select = (date) => {
|
|
4871
|
-
if (disabled(date)) return;
|
|
4872
|
-
setFocusedDate(date);
|
|
4873
|
-
if (mode === "single") {
|
|
4874
|
-
onSelect?.(date);
|
|
4875
|
-
return;
|
|
4876
|
-
}
|
|
4877
|
-
const current = range ?? { from: null, to: null };
|
|
4878
|
-
if (!current.from || current.to || isBefore(date, current.from)) {
|
|
4879
|
-
onRangeChange?.({ from: date, to: null });
|
|
4880
|
-
} else {
|
|
4881
|
-
onRangeChange?.({ from: current.from, to: date });
|
|
4882
|
-
}
|
|
4883
|
-
};
|
|
4884
|
-
const onKeyDown = (event) => {
|
|
4885
|
-
const moves = {
|
|
4886
|
-
ArrowLeft: () => addDays(focusedDate, -1),
|
|
4887
|
-
ArrowRight: () => addDays(focusedDate, 1),
|
|
4888
|
-
ArrowUp: () => addDays(focusedDate, -7),
|
|
4889
|
-
ArrowDown: () => addDays(focusedDate, 7),
|
|
4890
|
-
Home: () => addDays(focusedDate, -((focusedDate.getDay() - weekStartsOn + 7) % 7)),
|
|
4891
|
-
End: () => addDays(focusedDate, 6 - (focusedDate.getDay() - weekStartsOn + 7) % 7),
|
|
4892
|
-
PageUp: () => addDays(focusedDate, 0) && new Date(focusedDate.getFullYear(), focusedDate.getMonth() - 1, focusedDate.getDate()),
|
|
4893
|
-
PageDown: () => new Date(focusedDate.getFullYear(), focusedDate.getMonth() + 1, focusedDate.getDate())
|
|
4894
|
-
};
|
|
4895
|
-
const move = moves[event.key];
|
|
4896
|
-
if (move) {
|
|
4897
|
-
event.preventDefault();
|
|
4898
|
-
focusDate(move());
|
|
4899
|
-
}
|
|
4900
|
-
};
|
|
4901
|
-
const days = monthGrid(month, weekStartsOn);
|
|
4902
|
-
const weekdayNames = days.slice(0, 7).map((d) => dayNameFormatter.format(d));
|
|
4903
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
4904
|
-
"div",
|
|
5161
|
+
id,
|
|
5162
|
+
className,
|
|
5163
|
+
...props
|
|
5164
|
+
}, ref) {
|
|
5165
|
+
const generatedId = (0, import_react33.useId)();
|
|
5166
|
+
const controlId = id ?? generatedId;
|
|
5167
|
+
const descriptionId = `${controlId}-description`;
|
|
5168
|
+
const current = value ?? defaultValue ?? min;
|
|
5169
|
+
const display = formatValue ? formatValue(current) : String(current);
|
|
5170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: (0, import_clsx42.default)("flex w-full flex-col gap-1.5", className), children: [
|
|
5171
|
+
(label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
5172
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5173
|
+
"label",
|
|
5174
|
+
{
|
|
5175
|
+
htmlFor: controlId,
|
|
5176
|
+
className: (0, import_clsx42.default)("text-body-sm", disabled ? "text-disabled" : "text-default"),
|
|
5177
|
+
children: label
|
|
5178
|
+
}
|
|
5179
|
+
),
|
|
5180
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-body-sm font-medium tabular-nums text-default", children: display })
|
|
5181
|
+
] }),
|
|
5182
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5183
|
+
"p",
|
|
5184
|
+
{
|
|
5185
|
+
id: descriptionId,
|
|
5186
|
+
className: (0, import_clsx42.default)("text-body-xs", disabled ? "text-disabled" : "text-default-secondary"),
|
|
5187
|
+
children: description
|
|
5188
|
+
}
|
|
5189
|
+
),
|
|
5190
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5191
|
+
"input",
|
|
5192
|
+
{
|
|
5193
|
+
ref,
|
|
5194
|
+
id: controlId,
|
|
5195
|
+
type: "range",
|
|
5196
|
+
min,
|
|
5197
|
+
max,
|
|
5198
|
+
step,
|
|
5199
|
+
value,
|
|
5200
|
+
defaultValue: value === void 0 ? defaultValue : void 0,
|
|
5201
|
+
disabled,
|
|
5202
|
+
"aria-describedby": description ? descriptionId : void 0,
|
|
5203
|
+
"aria-valuetext": formatValue ? display : void 0,
|
|
5204
|
+
onChange: (event) => onValueChange?.(Number(event.target.value)),
|
|
5205
|
+
className: (0, import_clsx42.default)(
|
|
5206
|
+
"h-5 w-full cursor-pointer appearance-none bg-transparent",
|
|
5207
|
+
"focus-visible:outline-none",
|
|
5208
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
5209
|
+
// Track
|
|
5210
|
+
"[&::-webkit-slider-runnable-track]:h-1.5 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:bg-default-tertiary",
|
|
5211
|
+
"[&::-moz-range-track]:h-1.5 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:bg-default-tertiary",
|
|
5212
|
+
"[&::-moz-range-progress]:h-1.5 [&::-moz-range-progress]:rounded-full [&::-moz-range-progress]:bg-brand",
|
|
5213
|
+
// Thumb. The negative margin centres it on the track, since the input box is
|
|
5214
|
+
// taller than the track to keep a comfortable pointer target.
|
|
5215
|
+
"[&::-webkit-slider-thumb]:-mt-[7px] [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-brand [&::-webkit-slider-thumb]:bg-default [&::-webkit-slider-thumb]:shadow-100",
|
|
5216
|
+
"[&::-moz-range-thumb]:size-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-brand [&::-moz-range-thumb]:bg-default",
|
|
5217
|
+
// Focus ring on the thumb, not the whole 100%-wide input — a ring around the
|
|
5218
|
+
// full track reads as the row being focused rather than the handle.
|
|
5219
|
+
"focus-visible:[&::-webkit-slider-thumb]:ring-2 focus-visible:[&::-webkit-slider-thumb]:ring-brand focus-visible:[&::-webkit-slider-thumb]:ring-offset-1",
|
|
5220
|
+
"focus-visible:[&::-moz-range-thumb]:ring-2 focus-visible:[&::-moz-range-thumb]:ring-brand"
|
|
5221
|
+
),
|
|
5222
|
+
...props
|
|
5223
|
+
}
|
|
5224
|
+
)
|
|
5225
|
+
] });
|
|
5226
|
+
});
|
|
5227
|
+
|
|
5228
|
+
// src/components/forms/label.tsx
|
|
5229
|
+
var import_react34 = require("react");
|
|
5230
|
+
var import_clsx43 = __toESM(require("clsx"), 1);
|
|
5231
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5232
|
+
var SIZE7 = {
|
|
5233
|
+
lg: "text-body",
|
|
5234
|
+
md: "text-body-sm",
|
|
5235
|
+
sm: "text-body-tiny"
|
|
5236
|
+
};
|
|
5237
|
+
var Label = (0, import_react34.forwardRef)(function Label2({ children, size: size2, className, htmlFor, ...rest }, ref) {
|
|
5238
|
+
const field = useFieldContext();
|
|
5239
|
+
const resolvedSize = size2 ?? field?.size ?? "md";
|
|
5240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5241
|
+
"label",
|
|
4905
5242
|
{
|
|
4906
|
-
|
|
4907
|
-
|
|
5243
|
+
ref,
|
|
5244
|
+
htmlFor: htmlFor ?? field?.controlId,
|
|
5245
|
+
"data-slot": "label",
|
|
5246
|
+
className: (0, import_clsx43.default)(
|
|
5247
|
+
"select-none",
|
|
5248
|
+
SIZE7[resolvedSize],
|
|
5249
|
+
field?.disabled ? "text-disabled" : "text-default",
|
|
5250
|
+
className
|
|
5251
|
+
),
|
|
4908
5252
|
...rest,
|
|
4909
|
-
children
|
|
4910
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
4911
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
4912
|
-
IconButton,
|
|
4913
|
-
{
|
|
4914
|
-
variant: "subtle",
|
|
4915
|
-
size: "sm",
|
|
4916
|
-
"aria-label": "Previous month",
|
|
4917
|
-
disabled: !!min && isBefore(addMonths(month, -1), new Date(min.getFullYear(), min.getMonth(), 1)),
|
|
4918
|
-
onClick: () => setMonth(addMonths(month, -1)),
|
|
4919
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react12.ChevronLeftIcon, { "aria-hidden": true, size: 16 })
|
|
4920
|
-
}
|
|
4921
|
-
),
|
|
4922
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { "aria-live": "polite", className: "text-body-sm font-semibold text-default", children: monthFormatter.format(month) }),
|
|
4923
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
4924
|
-
IconButton,
|
|
4925
|
-
{
|
|
4926
|
-
variant: "subtle",
|
|
4927
|
-
size: "sm",
|
|
4928
|
-
"aria-label": "Next month",
|
|
4929
|
-
disabled: !!max && isAfter(addMonths(month, 1), new Date(max.getFullYear(), max.getMonth(), 1)),
|
|
4930
|
-
onClick: () => setMonth(addMonths(month, 1)),
|
|
4931
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react12.ChevronRightIcon, { "aria-hidden": true, size: 16 })
|
|
4932
|
-
}
|
|
4933
|
-
)
|
|
4934
|
-
] }),
|
|
4935
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
4936
|
-
"div",
|
|
4937
|
-
{
|
|
4938
|
-
role: "grid",
|
|
4939
|
-
"aria-label": label,
|
|
4940
|
-
id: gridId,
|
|
4941
|
-
tabIndex: -1,
|
|
4942
|
-
onKeyDown,
|
|
4943
|
-
children: [
|
|
4944
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { role: "row", className: "mb-1 grid grid-cols-7", children: weekdayNames.map((name) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
4945
|
-
"div",
|
|
4946
|
-
{
|
|
4947
|
-
role: "columnheader",
|
|
4948
|
-
className: "flex h-8 items-center justify-center text-body-tiny font-medium text-default-tertiary",
|
|
4949
|
-
children: name
|
|
4950
|
-
},
|
|
4951
|
-
name
|
|
4952
|
-
)) }),
|
|
4953
|
-
Array.from({ length: 6 }, (_, week) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { role: "row", className: "grid grid-cols-7", children: days.slice(week * 7, week * 7 + 7).map((date) => {
|
|
4954
|
-
const outside = date.getMonth() !== month.getMonth();
|
|
4955
|
-
const isDisabled = disabled(date);
|
|
4956
|
-
const selected = mode === "single" ? sameDay(date, value) : sameDay(date, range?.from) || sameDay(date, range?.to);
|
|
4957
|
-
const between = mode === "range" && range?.from && range?.to ? inRange(date, range.from, range.to) : false;
|
|
4958
|
-
const isFocused = sameDay(date, focusedDate);
|
|
4959
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { role: "gridcell", "aria-selected": selected || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
4960
|
-
"button",
|
|
4961
|
-
{
|
|
4962
|
-
ref: (node) => {
|
|
4963
|
-
if (node) cellRefs.current.set(key(date), node);
|
|
4964
|
-
else cellRefs.current.delete(key(date));
|
|
4965
|
-
},
|
|
4966
|
-
type: "button",
|
|
4967
|
-
tabIndex: isFocused ? 0 : -1,
|
|
4968
|
-
disabled: isDisabled,
|
|
4969
|
-
"aria-label": fullDateFormatter.format(date),
|
|
4970
|
-
"aria-current": sameDay(date, today) ? "date" : void 0,
|
|
4971
|
-
onClick: () => select(date),
|
|
4972
|
-
onFocus: () => setFocusedDate(date),
|
|
4973
|
-
className: (0, import_clsx43.default)(
|
|
4974
|
-
"flex size-9 items-center justify-center rounded-lg text-body-sm tabular-nums transition-colors",
|
|
4975
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-1 focus-visible:ring-offset-default",
|
|
4976
|
-
"disabled:cursor-not-allowed disabled:text-disabled disabled:hover:bg-transparent",
|
|
4977
|
-
selected ? "bg-brand font-semibold text-brand-on-brand" : between ? "rounded-none bg-brand-tertiary text-default" : outside ? "text-default-tertiary hover:bg-default-secondary" : "text-default hover:bg-default-secondary",
|
|
4978
|
-
// Today is marked by a ring rather than a fill, so it stays legible
|
|
4979
|
-
// when it is also the selected day.
|
|
4980
|
-
sameDay(date, today) && !selected && "ring-1 ring-inset ring-brand-tertiary"
|
|
4981
|
-
),
|
|
4982
|
-
children: date.getDate()
|
|
4983
|
-
}
|
|
4984
|
-
) }, key(date));
|
|
4985
|
-
}) }, week))
|
|
4986
|
-
]
|
|
4987
|
-
}
|
|
4988
|
-
)
|
|
4989
|
-
]
|
|
5253
|
+
children
|
|
4990
5254
|
}
|
|
4991
5255
|
);
|
|
4992
|
-
}
|
|
5256
|
+
});
|
|
4993
5257
|
|
|
4994
5258
|
// src/components/forms/input-group.tsx
|
|
4995
|
-
var
|
|
5259
|
+
var import_react35 = require("react");
|
|
4996
5260
|
var import_clsx44 = __toESM(require("clsx"), 1);
|
|
4997
5261
|
var import_lucide_react13 = require("lucide-react");
|
|
4998
|
-
var
|
|
5262
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4999
5263
|
var HEIGHT2 = {
|
|
5000
5264
|
lg: "h-12 text-body",
|
|
5001
5265
|
md: "h-9 text-body-sm",
|
|
@@ -5006,9 +5270,9 @@ var PAD = {
|
|
|
5006
5270
|
md: "px-3 gap-1.5",
|
|
5007
5271
|
sm: "px-2 gap-1"
|
|
5008
5272
|
};
|
|
5009
|
-
var InputGroup = (0,
|
|
5273
|
+
var InputGroup = (0, import_react35.forwardRef)(function InputGroup2({ children, size: sizeProp, invalid = false, disabled = false, className, ...rest }, ref) {
|
|
5010
5274
|
const size2 = useControlSize(sizeProp);
|
|
5011
|
-
return /* @__PURE__ */ (0,
|
|
5275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5012
5276
|
"div",
|
|
5013
5277
|
{
|
|
5014
5278
|
ref,
|
|
@@ -5030,10 +5294,10 @@ var InputGroup = (0, import_react34.forwardRef)(function InputGroup2({ children,
|
|
|
5030
5294
|
}
|
|
5031
5295
|
);
|
|
5032
5296
|
});
|
|
5033
|
-
var InputGroupInput = (0,
|
|
5297
|
+
var InputGroupInput = (0, import_react35.forwardRef)(
|
|
5034
5298
|
function InputGroupInput2({ className, ...props }, ref) {
|
|
5035
5299
|
const field = useFieldControl();
|
|
5036
|
-
return /* @__PURE__ */ (0,
|
|
5300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5037
5301
|
"input",
|
|
5038
5302
|
{
|
|
5039
5303
|
ref,
|
|
@@ -5049,9 +5313,9 @@ var InputGroupInput = (0, import_react34.forwardRef)(
|
|
|
5049
5313
|
);
|
|
5050
5314
|
}
|
|
5051
5315
|
);
|
|
5052
|
-
var InputGroupAddon = (0,
|
|
5316
|
+
var InputGroupAddon = (0, import_react35.forwardRef)(
|
|
5053
5317
|
function InputGroupAddon2({ children, align = "inline-start", decorative = true, className, ...rest }, ref) {
|
|
5054
|
-
return /* @__PURE__ */ (0,
|
|
5318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5055
5319
|
"span",
|
|
5056
5320
|
{
|
|
5057
5321
|
ref,
|
|
@@ -5070,9 +5334,9 @@ var InputGroupAddon = (0, import_react34.forwardRef)(
|
|
|
5070
5334
|
);
|
|
5071
5335
|
}
|
|
5072
5336
|
);
|
|
5073
|
-
var InputGroupText = (0,
|
|
5337
|
+
var InputGroupText = (0, import_react35.forwardRef)(
|
|
5074
5338
|
function InputGroupText2({ children, className, ...rest }, ref) {
|
|
5075
|
-
return /* @__PURE__ */ (0,
|
|
5339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5076
5340
|
"span",
|
|
5077
5341
|
{
|
|
5078
5342
|
ref,
|
|
@@ -5083,12 +5347,12 @@ var InputGroupText = (0, import_react34.forwardRef)(
|
|
|
5083
5347
|
);
|
|
5084
5348
|
}
|
|
5085
5349
|
);
|
|
5086
|
-
var SearchInput = (0,
|
|
5350
|
+
var SearchInput = (0, import_react35.forwardRef)(function SearchInput2({ size: sizeProp, onClear, label = "Search", disabled, value, className, ...props }, ref) {
|
|
5087
5351
|
const size2 = useControlSize(sizeProp);
|
|
5088
5352
|
const hasValue = value !== void 0 && value !== "";
|
|
5089
|
-
return /* @__PURE__ */ (0,
|
|
5090
|
-
/* @__PURE__ */ (0,
|
|
5091
|
-
/* @__PURE__ */ (0,
|
|
5353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(InputGroup, { size: size2, disabled, className, children: [
|
|
5354
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(InputGroupAddon, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react13.SearchIcon, { className: size2 === "sm" ? "size-3" : "size-4" }) }),
|
|
5355
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5092
5356
|
InputGroupInput,
|
|
5093
5357
|
{
|
|
5094
5358
|
ref,
|
|
@@ -5100,7 +5364,7 @@ var SearchInput = (0, import_react34.forwardRef)(function SearchInput2({ size: s
|
|
|
5100
5364
|
...props
|
|
5101
5365
|
}
|
|
5102
5366
|
),
|
|
5103
|
-
onClear && hasValue && /* @__PURE__ */ (0,
|
|
5367
|
+
onClear && hasValue && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(InputGroupAddon, { align: "inline-end", decorative: false, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5104
5368
|
"button",
|
|
5105
5369
|
{
|
|
5106
5370
|
type: "button",
|
|
@@ -5108,15 +5372,15 @@ var SearchInput = (0, import_react34.forwardRef)(function SearchInput2({ size: s
|
|
|
5108
5372
|
onClick: onClear,
|
|
5109
5373
|
disabled,
|
|
5110
5374
|
className: "flex items-center justify-center rounded transition-colors hover:text-default focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand",
|
|
5111
|
-
children: /* @__PURE__ */ (0,
|
|
5375
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react13.XIcon, { "aria-hidden": true, className: size2 === "sm" ? "size-3" : "size-4" })
|
|
5112
5376
|
}
|
|
5113
5377
|
) })
|
|
5114
5378
|
] });
|
|
5115
5379
|
});
|
|
5116
5380
|
|
|
5117
5381
|
// src/components/overlays/modal.tsx
|
|
5118
|
-
var
|
|
5119
|
-
var
|
|
5382
|
+
var import_react36 = require("react");
|
|
5383
|
+
var import_radix_ui2 = require("radix-ui");
|
|
5120
5384
|
var import_lucide_react14 = require("lucide-react");
|
|
5121
5385
|
|
|
5122
5386
|
// src/components/overlays/toaster-guard.ts
|
|
@@ -5126,7 +5390,7 @@ function isInsideToaster(target) {
|
|
|
5126
5390
|
}
|
|
5127
5391
|
|
|
5128
5392
|
// src/components/overlays/modal.tsx
|
|
5129
|
-
var
|
|
5393
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5130
5394
|
var SIZE8 = {
|
|
5131
5395
|
sm: "sm:max-w-[420px]",
|
|
5132
5396
|
md: "sm:max-w-[540px]",
|
|
@@ -5134,10 +5398,10 @@ var SIZE8 = {
|
|
|
5134
5398
|
xl: "sm:max-w-[800px]"
|
|
5135
5399
|
};
|
|
5136
5400
|
var TONE_ICON = {
|
|
5137
|
-
info: /* @__PURE__ */ (0,
|
|
5138
|
-
positive: /* @__PURE__ */ (0,
|
|
5139
|
-
warning: /* @__PURE__ */ (0,
|
|
5140
|
-
danger: /* @__PURE__ */ (0,
|
|
5401
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react14.InfoIcon, { "aria-hidden": true, className: "size-5" }),
|
|
5402
|
+
positive: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react14.CircleCheckBigIcon, { "aria-hidden": true, className: "size-5" }),
|
|
5403
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react14.TriangleAlertIcon, { "aria-hidden": true, className: "size-5" }),
|
|
5404
|
+
danger: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react14.OctagonAlertIcon, { "aria-hidden": true, className: "size-5" })
|
|
5141
5405
|
};
|
|
5142
5406
|
var TONE_BADGE = {
|
|
5143
5407
|
info: "brand",
|
|
@@ -5150,14 +5414,14 @@ var FOOTER_ALIGN = {
|
|
|
5150
5414
|
between: "justify-between",
|
|
5151
5415
|
end: "justify-end"
|
|
5152
5416
|
};
|
|
5153
|
-
var ModalNaming = (0,
|
|
5154
|
-
var Modal = (0,
|
|
5155
|
-
return /* @__PURE__ */ (0,
|
|
5417
|
+
var ModalNaming = (0, import_react36.createContext)(null);
|
|
5418
|
+
var Modal = (0, import_react36.forwardRef)(function Modal2({ open, defaultOpen, onOpenChange, container, ...shell }, ref) {
|
|
5419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_radix_ui2.Dialog.Root, { open, defaultOpen, onOpenChange, children: [
|
|
5156
5420
|
extractTrigger(shell.children),
|
|
5157
|
-
/* @__PURE__ */ (0,
|
|
5421
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_radix_ui2.Dialog.Portal, { container: container ?? void 0, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ModalShell, { ref, ...shell }) })
|
|
5158
5422
|
] });
|
|
5159
5423
|
});
|
|
5160
|
-
var ModalShell = (0,
|
|
5424
|
+
var ModalShell = (0, import_react36.forwardRef)(
|
|
5161
5425
|
function ModalShell2({
|
|
5162
5426
|
label,
|
|
5163
5427
|
children,
|
|
@@ -5169,14 +5433,14 @@ var ModalShell = (0, import_react35.forwardRef)(
|
|
|
5169
5433
|
onInteractOutside,
|
|
5170
5434
|
initialFocus
|
|
5171
5435
|
}, ref) {
|
|
5172
|
-
const [hasTitle, setHasTitle] = (0,
|
|
5173
|
-
const [hasDescription, setHasDescription] = (0,
|
|
5174
|
-
const [contentNode, setContentNode] = (0,
|
|
5175
|
-
const [returnFocusTo] = (0,
|
|
5436
|
+
const [hasTitle, setHasTitle] = (0, import_react36.useState)(false);
|
|
5437
|
+
const [hasDescription, setHasDescription] = (0, import_react36.useState)(false);
|
|
5438
|
+
const [contentNode, setContentNode] = (0, import_react36.useState)(null);
|
|
5439
|
+
const [returnFocusTo] = (0, import_react36.useState)(
|
|
5176
5440
|
() => typeof document === "undefined" ? null : document.activeElement
|
|
5177
5441
|
);
|
|
5178
|
-
return /* @__PURE__ */ (0,
|
|
5179
|
-
|
|
5442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5443
|
+
import_radix_ui2.Dialog.Overlay,
|
|
5180
5444
|
{
|
|
5181
5445
|
className: cn(
|
|
5182
5446
|
// The overlay wraps the content (a Radix-supported layout), so it also does the
|
|
@@ -5184,8 +5448,8 @@ var ModalShell = (0, import_react35.forwardRef)(
|
|
|
5184
5448
|
"fixed inset-0 z-modal flex items-end justify-center sm:items-center",
|
|
5185
5449
|
OVERLAY_SCRIM
|
|
5186
5450
|
),
|
|
5187
|
-
children: /* @__PURE__ */ (0,
|
|
5188
|
-
|
|
5451
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
5452
|
+
import_radix_ui2.Dialog.Content,
|
|
5189
5453
|
{
|
|
5190
5454
|
ref: composeRefs(ref, setContentNode),
|
|
5191
5455
|
role,
|
|
@@ -5226,22 +5490,22 @@ var ModalShell = (0, import_react35.forwardRef)(
|
|
|
5226
5490
|
className
|
|
5227
5491
|
),
|
|
5228
5492
|
children: [
|
|
5229
|
-
!hasTitle && label && /* @__PURE__ */ (0,
|
|
5230
|
-
showClose && /* @__PURE__ */ (0,
|
|
5493
|
+
!hasTitle && label && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_radix_ui2.Dialog.Title, { className: "sr-only", children: label }),
|
|
5494
|
+
showClose && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_radix_ui2.Dialog.Close, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5231
5495
|
IconButton,
|
|
5232
5496
|
{
|
|
5233
5497
|
variant: "subtle",
|
|
5234
5498
|
size: "sm",
|
|
5235
5499
|
"aria-label": "Close dialog",
|
|
5236
5500
|
className: "absolute right-6 top-5 z-raised",
|
|
5237
|
-
children: /* @__PURE__ */ (0,
|
|
5501
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react14.XIcon, { size: 16, "aria-hidden": true })
|
|
5238
5502
|
}
|
|
5239
5503
|
) }),
|
|
5240
|
-
/* @__PURE__ */ (0,
|
|
5504
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5241
5505
|
ModalNaming.Provider,
|
|
5242
5506
|
{
|
|
5243
5507
|
value: { registerTitle: setHasTitle, registerDescription: setHasDescription },
|
|
5244
|
-
children: /* @__PURE__ */ (0,
|
|
5508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PortalContainerProvider, { container: contentNode, children: withoutTrigger(children) })
|
|
5245
5509
|
}
|
|
5246
5510
|
)
|
|
5247
5511
|
]
|
|
@@ -5251,15 +5515,15 @@ var ModalShell = (0, import_react35.forwardRef)(
|
|
|
5251
5515
|
);
|
|
5252
5516
|
}
|
|
5253
5517
|
);
|
|
5254
|
-
var ModalTrigger = (0,
|
|
5518
|
+
var ModalTrigger = (0, import_react36.forwardRef)(
|
|
5255
5519
|
function ModalTrigger2(props, ref) {
|
|
5256
|
-
return /* @__PURE__ */ (0,
|
|
5520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_radix_ui2.Dialog.Trigger, { ref, ...props });
|
|
5257
5521
|
}
|
|
5258
5522
|
);
|
|
5259
5523
|
ModalTrigger.__modalTrigger = true;
|
|
5260
|
-
var ModalClose = (0,
|
|
5524
|
+
var ModalClose = (0, import_react36.forwardRef)(
|
|
5261
5525
|
function ModalClose2(props, ref) {
|
|
5262
|
-
return /* @__PURE__ */ (0,
|
|
5526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_radix_ui2.Dialog.Close, { ref, ...props });
|
|
5263
5527
|
}
|
|
5264
5528
|
);
|
|
5265
5529
|
function isTrigger(node) {
|
|
@@ -5271,8 +5535,8 @@ function extractTrigger(children) {
|
|
|
5271
5535
|
function withoutTrigger(children) {
|
|
5272
5536
|
return Array.isArray(children) ? children.filter((child) => !isTrigger(child)) : isTrigger(children) ? null : children;
|
|
5273
5537
|
}
|
|
5274
|
-
var ModalHeader = (0,
|
|
5275
|
-
return /* @__PURE__ */ (0,
|
|
5538
|
+
var ModalHeader = (0, import_react36.forwardRef)(function ModalHeader2({ children, tone = "default", divider = true, className, ...rest }, ref) {
|
|
5539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
5276
5540
|
"div",
|
|
5277
5541
|
{
|
|
5278
5542
|
ref,
|
|
@@ -5286,43 +5550,43 @@ var ModalHeader = (0, import_react35.forwardRef)(function ModalHeader2({ childre
|
|
|
5286
5550
|
),
|
|
5287
5551
|
...rest,
|
|
5288
5552
|
children: [
|
|
5289
|
-
tone !== "default" && /* @__PURE__ */ (0,
|
|
5290
|
-
/* @__PURE__ */ (0,
|
|
5553
|
+
tone !== "default" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(EntityIconBadge, { size: "md", shape: "circle", tone: TONE_BADGE[tone], children: TONE_ICON[tone] }),
|
|
5554
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "min-w-0 flex-1", children })
|
|
5291
5555
|
]
|
|
5292
5556
|
}
|
|
5293
5557
|
);
|
|
5294
5558
|
});
|
|
5295
|
-
var ModalTitle = (0,
|
|
5296
|
-
const naming = (0,
|
|
5297
|
-
(0,
|
|
5559
|
+
var ModalTitle = (0, import_react36.forwardRef)(function ModalTitle2({ children, className, ...rest }, ref) {
|
|
5560
|
+
const naming = (0, import_react36.useContext)(ModalNaming);
|
|
5561
|
+
(0, import_react36.useEffect)(() => {
|
|
5298
5562
|
naming?.registerTitle(true);
|
|
5299
5563
|
return () => naming?.registerTitle(false);
|
|
5300
5564
|
}, [naming]);
|
|
5301
5565
|
const classes = cn("text-heading-sm font-semibold text-default", className);
|
|
5302
5566
|
if (!naming) {
|
|
5303
|
-
return /* @__PURE__ */ (0,
|
|
5567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h2", { ref, className: classes, ...rest, children });
|
|
5304
5568
|
}
|
|
5305
|
-
return /* @__PURE__ */ (0,
|
|
5569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_radix_ui2.Dialog.Title, { ref, className: classes, ...rest, children });
|
|
5306
5570
|
});
|
|
5307
|
-
var ModalDescription = (0,
|
|
5571
|
+
var ModalDescription = (0, import_react36.forwardRef)(
|
|
5308
5572
|
function ModalDescription2({ children, className, ...rest }, ref) {
|
|
5309
|
-
const naming = (0,
|
|
5310
|
-
(0,
|
|
5573
|
+
const naming = (0, import_react36.useContext)(ModalNaming);
|
|
5574
|
+
(0, import_react36.useEffect)(() => {
|
|
5311
5575
|
naming?.registerDescription(true);
|
|
5312
5576
|
return () => naming?.registerDescription(false);
|
|
5313
5577
|
}, [naming]);
|
|
5314
5578
|
const classes = cn("mt-0.5 text-body-xs text-default-secondary", className);
|
|
5315
5579
|
if (!naming) {
|
|
5316
|
-
return /* @__PURE__ */ (0,
|
|
5580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { ref, className: classes, ...rest, children });
|
|
5317
5581
|
}
|
|
5318
|
-
return /* @__PURE__ */ (0,
|
|
5582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_radix_ui2.Dialog.Description, { ref, className: classes, ...rest, children });
|
|
5319
5583
|
}
|
|
5320
5584
|
);
|
|
5321
|
-
var ModalBody = (0,
|
|
5322
|
-
return /* @__PURE__ */ (0,
|
|
5585
|
+
var ModalBody = (0, import_react36.forwardRef)(function ModalBody2({ children, className, ...rest }, ref) {
|
|
5586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { ref, className: cn("px-6 py-5", className), ...rest, children });
|
|
5323
5587
|
});
|
|
5324
|
-
var ModalFooter = (0,
|
|
5325
|
-
return /* @__PURE__ */ (0,
|
|
5588
|
+
var ModalFooter = (0, import_react36.forwardRef)(function ModalFooter2({ children, align = "end", divider = true, className, ...rest }, ref) {
|
|
5589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5326
5590
|
"div",
|
|
5327
5591
|
{
|
|
5328
5592
|
ref,
|
|
@@ -5339,9 +5603,9 @@ var ModalFooter = (0, import_react35.forwardRef)(function ModalFooter2({ childre
|
|
|
5339
5603
|
});
|
|
5340
5604
|
|
|
5341
5605
|
// src/components/overlays/tooltip.tsx
|
|
5342
|
-
var
|
|
5343
|
-
var
|
|
5344
|
-
var
|
|
5606
|
+
var import_react37 = require("react");
|
|
5607
|
+
var import_radix_ui3 = require("radix-ui");
|
|
5608
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5345
5609
|
function Tooltip({
|
|
5346
5610
|
children,
|
|
5347
5611
|
title,
|
|
@@ -5356,28 +5620,28 @@ function Tooltip({
|
|
|
5356
5620
|
className
|
|
5357
5621
|
}) {
|
|
5358
5622
|
const container = usePortalContainer();
|
|
5359
|
-
const labelId = (0,
|
|
5623
|
+
const labelId = (0, import_react37.useId)();
|
|
5360
5624
|
const labelled = association === "labelledby";
|
|
5361
|
-
const content = /* @__PURE__ */ (0,
|
|
5362
|
-
title && /* @__PURE__ */ (0,
|
|
5363
|
-
body && /* @__PURE__ */ (0,
|
|
5625
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
5626
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "font-semibold", children: title }),
|
|
5627
|
+
body && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: cn(title && "mt-0.5 opacity-80"), children: body })
|
|
5364
5628
|
] });
|
|
5365
|
-
return /* @__PURE__ */ (0,
|
|
5366
|
-
/* @__PURE__ */ (0,
|
|
5367
|
-
|
|
5629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_radix_ui3.Tooltip.Provider, { delayDuration: openDelay, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_radix_ui3.Tooltip.Root, { open, defaultOpen, onOpenChange, children: [
|
|
5630
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5631
|
+
import_radix_ui3.Tooltip.Trigger,
|
|
5368
5632
|
{
|
|
5369
5633
|
asChild: true,
|
|
5370
5634
|
...labelled ? { "aria-labelledby": labelId, "aria-describedby": void 0 } : {},
|
|
5371
5635
|
children
|
|
5372
5636
|
}
|
|
5373
5637
|
),
|
|
5374
|
-
labelled && /* @__PURE__ */ (0,
|
|
5638
|
+
labelled && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { id: labelId, hidden: true, children: [
|
|
5375
5639
|
title,
|
|
5376
5640
|
body ? " " : null,
|
|
5377
5641
|
body
|
|
5378
5642
|
] }),
|
|
5379
|
-
/* @__PURE__ */ (0,
|
|
5380
|
-
|
|
5643
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_radix_ui3.Tooltip.Portal, { container: container ?? void 0, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5644
|
+
import_radix_ui3.Tooltip.Content,
|
|
5381
5645
|
{
|
|
5382
5646
|
side,
|
|
5383
5647
|
align,
|
|
@@ -5394,77 +5658,6 @@ function Tooltip({
|
|
|
5394
5658
|
] }) });
|
|
5395
5659
|
}
|
|
5396
5660
|
|
|
5397
|
-
// src/components/overlays/popover.tsx
|
|
5398
|
-
var import_react37 = require("react");
|
|
5399
|
-
var import_radix_ui3 = require("radix-ui");
|
|
5400
|
-
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5401
|
-
var PopoverTriggerNode = (0, import_react37.createContext)(null);
|
|
5402
|
-
function Popover({ children, open, defaultOpen, onOpenChange, modal = false }) {
|
|
5403
|
-
const [node, setNode] = (0, import_react37.useState)(null);
|
|
5404
|
-
const trigger = (0, import_react37.useMemo)(() => ({ node, setNode, modal }), [node, modal]);
|
|
5405
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5406
|
-
import_radix_ui3.Popover.Root,
|
|
5407
|
-
{
|
|
5408
|
-
open,
|
|
5409
|
-
defaultOpen,
|
|
5410
|
-
onOpenChange,
|
|
5411
|
-
modal,
|
|
5412
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PopoverTriggerNode.Provider, { value: trigger, children })
|
|
5413
|
-
}
|
|
5414
|
-
);
|
|
5415
|
-
}
|
|
5416
|
-
var PopoverTrigger = (0, import_react37.forwardRef)(
|
|
5417
|
-
function PopoverTrigger2(props, ref) {
|
|
5418
|
-
const trigger = (0, import_react37.useContext)(PopoverTriggerNode);
|
|
5419
|
-
const fallbackId = (0, import_react37.useId)();
|
|
5420
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5421
|
-
import_radix_ui3.Popover.Trigger,
|
|
5422
|
-
{
|
|
5423
|
-
ref: composeRefs(ref, trigger?.setNode),
|
|
5424
|
-
id: props.id ?? fallbackId,
|
|
5425
|
-
...props
|
|
5426
|
-
}
|
|
5427
|
-
);
|
|
5428
|
-
}
|
|
5429
|
-
);
|
|
5430
|
-
var PopoverContent = (0, import_react37.forwardRef)(
|
|
5431
|
-
function PopoverContent2({ children, side = "bottom", align = "center", sideOffset = 8, label, container, className, ...rest }, ref) {
|
|
5432
|
-
const trigger = (0, import_react37.useContext)(PopoverTriggerNode);
|
|
5433
|
-
const inherited = usePortalContainer();
|
|
5434
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_radix_ui3.Popover.Portal, { container: container ?? inherited ?? void 0, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5435
|
-
import_radix_ui3.Popover.Content,
|
|
5436
|
-
{
|
|
5437
|
-
ref,
|
|
5438
|
-
side,
|
|
5439
|
-
align,
|
|
5440
|
-
sideOffset,
|
|
5441
|
-
collisionPadding: 8,
|
|
5442
|
-
onEscapeKeyDown: (event) => void deferEscapeToInnerPopup(event),
|
|
5443
|
-
"aria-modal": trigger?.modal || void 0,
|
|
5444
|
-
"aria-label": label,
|
|
5445
|
-
"aria-labelledby": label ? void 0 : trigger?.node?.id || void 0,
|
|
5446
|
-
className: cn(
|
|
5447
|
-
"z-popover max-w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-default bg-default p-4 shadow-400",
|
|
5448
|
-
"focus:outline-none",
|
|
5449
|
-
className
|
|
5450
|
-
),
|
|
5451
|
-
...rest,
|
|
5452
|
-
children
|
|
5453
|
-
}
|
|
5454
|
-
) });
|
|
5455
|
-
}
|
|
5456
|
-
);
|
|
5457
|
-
var PopoverClose = (0, import_react37.forwardRef)(
|
|
5458
|
-
function PopoverClose2(props, ref) {
|
|
5459
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_radix_ui3.Popover.Close, { ref, ...props });
|
|
5460
|
-
}
|
|
5461
|
-
);
|
|
5462
|
-
var PopoverAnchor = (0, import_react37.forwardRef)(
|
|
5463
|
-
function PopoverAnchor2(props, ref) {
|
|
5464
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_radix_ui3.Popover.Anchor, { ref, ...props });
|
|
5465
|
-
}
|
|
5466
|
-
);
|
|
5467
|
-
|
|
5468
5661
|
// src/components/overlays/hover-card.tsx
|
|
5469
5662
|
var import_react38 = require("react");
|
|
5470
5663
|
var import_radix_ui4 = require("radix-ui");
|
|
@@ -8239,8 +8432,8 @@ function PaginationBar({
|
|
|
8239
8432
|
SelectControl,
|
|
8240
8433
|
{
|
|
8241
8434
|
"aria-label": "Rows per page",
|
|
8242
|
-
size: "
|
|
8243
|
-
className: "w-
|
|
8435
|
+
size: "md",
|
|
8436
|
+
className: "w-20",
|
|
8244
8437
|
value: String(pageSize),
|
|
8245
8438
|
options: options.map((size2) => ({ value: String(size2), label: String(size2) })),
|
|
8246
8439
|
onValueChange: (value) => onPageSizeChange?.(Number(value))
|
|
@@ -10087,25 +10280,37 @@ var import_react68 = require("react");
|
|
|
10087
10280
|
var import_clsx90 = __toESM(require("clsx"), 1);
|
|
10088
10281
|
var import_lucide_react29 = require("lucide-react");
|
|
10089
10282
|
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
10090
|
-
var Table = (0, import_react68.forwardRef)(function Table2({ label, density = "default", fixed = false, className, children, ...rest }, ref) {
|
|
10283
|
+
var Table = (0, import_react68.forwardRef)(function Table2({ label, density = "default", fixed = false, maxHeight, className, children, ...rest }, ref) {
|
|
10091
10284
|
return (
|
|
10092
10285
|
// The scroll container is separate from the table so the header stays inside the
|
|
10093
10286
|
// scrolling region — a table that is its own scroll container cannot have a sticky
|
|
10094
10287
|
// header.
|
|
10095
10288
|
// The scroll wrapper is required for a <table>, which cannot itself scroll, so this
|
|
10096
10289
|
// takes the scrollbar styling rather than ScrollArea.
|
|
10097
|
-
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
10098
|
-
"
|
|
10290
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
10291
|
+
"div",
|
|
10099
10292
|
{
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10293
|
+
className: (0, import_clsx90.default)(
|
|
10294
|
+
"w-full",
|
|
10295
|
+
maxHeight ? (0, import_clsx90.default)("overflow-auto overscroll-contain", FOCUS_RING_INSET) : "overflow-x-auto",
|
|
10296
|
+
SCROLLBAR_CLASSES
|
|
10297
|
+
),
|
|
10298
|
+
style: maxHeight ? { maxHeight } : void 0,
|
|
10299
|
+
...maxHeight ? { role: "region", tabIndex: 0, "aria-label": label ? `${label} (scrolls)` : "Table (scrolls)" } : {},
|
|
10300
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
10301
|
+
"table",
|
|
10302
|
+
{
|
|
10303
|
+
ref,
|
|
10304
|
+
"aria-label": label,
|
|
10305
|
+
"data-slot": "table",
|
|
10306
|
+
"data-density": density,
|
|
10307
|
+
className: cn("w-full border-collapse", fixed && "table-fixed", className),
|
|
10308
|
+
...rest,
|
|
10309
|
+
children
|
|
10310
|
+
}
|
|
10311
|
+
)
|
|
10107
10312
|
}
|
|
10108
|
-
)
|
|
10313
|
+
)
|
|
10109
10314
|
);
|
|
10110
10315
|
});
|
|
10111
10316
|
var TableCaption = (0, import_react68.forwardRef)(
|
|
@@ -10439,7 +10644,7 @@ function DataTableViewOptions({ table, label = "Columns" }) {
|
|
|
10439
10644
|
const columns = table.getAllLeafColumns().filter((column) => column.getCanHide());
|
|
10440
10645
|
if (columns.length === 0) return null;
|
|
10441
10646
|
return /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(DropdownMenu, { children: [
|
|
10442
|
-
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Button, { variant: "neutral", size: "
|
|
10647
|
+
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Button, { variant: "neutral", size: "md", leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_lucide_react30.Columns3Icon, { "aria-hidden": true }), children: label }) }),
|
|
10443
10648
|
/* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
10444
10649
|
/* @__PURE__ */ (0, import_jsx_runtime115.jsx)(DropdownMenuLabel, { children: "Show columns" }),
|
|
10445
10650
|
columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
@@ -10542,18 +10747,18 @@ function TableCellProgress({
|
|
|
10542
10747
|
className
|
|
10543
10748
|
}) {
|
|
10544
10749
|
const clamped = Math.min(100, Math.max(0, percent));
|
|
10545
|
-
return /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: (0, import_clsx93.default)("flex
|
|
10750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: (0, import_clsx93.default)("flex w-full min-w-0 items-center gap-2", className), children: [
|
|
10546
10751
|
/* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
10547
10752
|
ProgressBar,
|
|
10548
10753
|
{
|
|
10549
10754
|
value: clamped,
|
|
10550
10755
|
tone,
|
|
10551
|
-
size: "sm",
|
|
10552
|
-
className:
|
|
10756
|
+
size: size2 === "sm" ? "xs" : "sm",
|
|
10757
|
+
className: "min-w-12 flex-1",
|
|
10553
10758
|
"aria-label": `${clamped}%`
|
|
10554
10759
|
}
|
|
10555
10760
|
),
|
|
10556
|
-
/* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("span", { className: "text-body-tiny leading-none text-default-secondary", children: [
|
|
10761
|
+
/* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("span", { className: "shrink-0 text-body-tiny leading-none tabular-nums text-default-secondary", children: [
|
|
10557
10762
|
percent,
|
|
10558
10763
|
"%"
|
|
10559
10764
|
] })
|
|
@@ -10654,17 +10859,19 @@ function useHeaderWidths(padding2, deps) {
|
|
|
10654
10859
|
}
|
|
10655
10860
|
function useScrollEdges() {
|
|
10656
10861
|
const [node, setNode] = (0, import_react71.useState)(null);
|
|
10657
|
-
const [edges, setEdges] = (0, import_react71.useState)({ overflowing: false, atStart: true, atEnd: true });
|
|
10862
|
+
const [edges, setEdges] = (0, import_react71.useState)({ overflowing: false, atStart: true, atEnd: true, overflowingY: false, atTop: true });
|
|
10658
10863
|
const measure = (0, import_react71.useCallback)(() => {
|
|
10659
10864
|
if (!node) return;
|
|
10660
|
-
const { scrollLeft, scrollWidth, clientWidth } = node;
|
|
10865
|
+
const { scrollLeft, scrollWidth, clientWidth, scrollTop, scrollHeight, clientHeight } = node;
|
|
10661
10866
|
const next = {
|
|
10662
10867
|
overflowing: scrollWidth > clientWidth + 1,
|
|
10663
10868
|
atStart: scrollLeft <= 1,
|
|
10664
|
-
atEnd: scrollLeft + clientWidth >= scrollWidth - 1
|
|
10869
|
+
atEnd: scrollLeft + clientWidth >= scrollWidth - 1,
|
|
10870
|
+
overflowingY: scrollHeight > clientHeight + 1,
|
|
10871
|
+
atTop: scrollTop <= 1
|
|
10665
10872
|
};
|
|
10666
10873
|
setEdges(
|
|
10667
|
-
(previous) => previous.overflowing === next.overflowing && previous.atStart === next.atStart && previous.atEnd === next.atEnd ? previous : next
|
|
10874
|
+
(previous) => previous.overflowing === next.overflowing && previous.atStart === next.atStart && previous.atEnd === next.atEnd && previous.overflowingY === next.overflowingY && previous.atTop === next.atTop ? previous : next
|
|
10668
10875
|
);
|
|
10669
10876
|
}, [node]);
|
|
10670
10877
|
(0, import_react71.useLayoutEffect)(() => {
|
|
@@ -10710,6 +10917,7 @@ function DataTable({
|
|
|
10710
10917
|
density = "default",
|
|
10711
10918
|
align = "center",
|
|
10712
10919
|
responsive = true,
|
|
10920
|
+
maxHeight,
|
|
10713
10921
|
manual = {},
|
|
10714
10922
|
state = {},
|
|
10715
10923
|
onSortingChange,
|
|
@@ -10819,14 +11027,15 @@ function DataTable({
|
|
|
10819
11027
|
renderRowLink,
|
|
10820
11028
|
getRowTone,
|
|
10821
11029
|
getRowDimmed,
|
|
10822
|
-
getRowLabel
|
|
11030
|
+
getRowLabel,
|
|
11031
|
+
maxHeight
|
|
10823
11032
|
};
|
|
10824
11033
|
return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { "data-slot": "data-table", className: cn("flex flex-col gap-3", className), children: [
|
|
10825
11034
|
showToolbar && /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
10826
11035
|
search && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
10827
11036
|
SearchInput,
|
|
10828
11037
|
{
|
|
10829
|
-
size: "
|
|
11038
|
+
size: "md",
|
|
10830
11039
|
label: search.label ?? "Search",
|
|
10831
11040
|
placeholder: search.placeholder ?? "Search\u2026",
|
|
10832
11041
|
value: searchValue,
|
|
@@ -10840,7 +11049,7 @@ function DataTable({
|
|
|
10840
11049
|
] }),
|
|
10841
11050
|
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)("p", { role: "status", "aria-live": "polite", className: "sr-only", children: filtering && !loading ? `${resultCount} ${resultCount === 1 ? "result" : "results"}` : "" }),
|
|
10842
11051
|
/* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { ref: wrapRef, className: "overflow-hidden rounded-xl border border-default bg-default", children: [
|
|
10843
|
-
mode === "cards" ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(CardList, { ...view }) : /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(TableView, { ...view }),
|
|
11052
|
+
mode === "cards" ? maxHeight ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(CardScroll, { label, maxHeight, children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(CardList, { ...view }) }) : /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(CardList, { ...view }) : /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(TableView, { ...view }),
|
|
10844
11053
|
showPager && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "border-t border-default px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(DataTablePagination, { table, pageSizeOptions }) }),
|
|
10845
11054
|
footer && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "border-t border-default px-4 py-3", children: footer })
|
|
10846
11055
|
] })
|
|
@@ -10863,7 +11072,8 @@ function TableView({
|
|
|
10863
11072
|
getRowHref,
|
|
10864
11073
|
renderRowLink,
|
|
10865
11074
|
getRowTone,
|
|
10866
|
-
getRowDimmed
|
|
11075
|
+
getRowDimmed,
|
|
11076
|
+
maxHeight
|
|
10867
11077
|
}) {
|
|
10868
11078
|
const d = DENSITY2[density];
|
|
10869
11079
|
const columns = table.getVisibleLeafColumns();
|
|
@@ -10891,15 +11101,23 @@ function TableView({
|
|
|
10891
11101
|
],
|
|
10892
11102
|
(id === stickyStart || id === stickyEnd) && (header ? "bg-default-secondary" : ["bg-default", rowAction && "group-hover:bg-default-secondary"])
|
|
10893
11103
|
);
|
|
10894
|
-
const
|
|
11104
|
+
const scrolls = scroll.overflowing || Boolean(maxHeight) && scroll.overflowingY;
|
|
11105
|
+
const direction = scroll.overflowing && maxHeight && scroll.overflowingY ? "scrolls" : scroll.overflowing ? "scrolls horizontally" : "scrolls vertically";
|
|
11106
|
+
const regionLabel = `${label ?? "Table"} (${direction})`;
|
|
11107
|
+
const pinnedHeader = maxHeight ? (0, import_clsx94.default)("sticky top-0 z-sticky bg-default-secondary", !scroll.atTop && "shadow-[inset_0_-1px_0_var(--color-border-default-default)]") : void 0;
|
|
10895
11108
|
return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "relative", children: [
|
|
10896
11109
|
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
10897
11110
|
"div",
|
|
10898
11111
|
{
|
|
10899
11112
|
ref: scroll.ref,
|
|
10900
11113
|
onScroll: scroll.onScroll,
|
|
10901
|
-
className: cn(
|
|
10902
|
-
|
|
11114
|
+
className: cn(
|
|
11115
|
+
maxHeight ? "overflow-auto overscroll-contain" : "overflow-x-auto overscroll-x-contain",
|
|
11116
|
+
SCROLLBAR_CLASSES,
|
|
11117
|
+
scrolls && FOCUS_RING_INSET
|
|
11118
|
+
),
|
|
11119
|
+
style: maxHeight ? { maxHeight } : void 0,
|
|
11120
|
+
...scrolls ? { role: "region", tabIndex: 0, "aria-label": regionLabel } : {},
|
|
10903
11121
|
children: /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
|
|
10904
11122
|
"table",
|
|
10905
11123
|
{
|
|
@@ -10936,6 +11154,7 @@ function TableView({
|
|
|
10936
11154
|
TEXT_ALIGN[meta?.align ?? "start"],
|
|
10937
11155
|
!meta?.interactive && "overflow-hidden",
|
|
10938
11156
|
stickyClass(header.column.id, true),
|
|
11157
|
+
pinnedHeader,
|
|
10939
11158
|
meta?.headerClassName
|
|
10940
11159
|
),
|
|
10941
11160
|
children: header.isPlaceholder ? null : typeof definition === "string" || definition === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("span", { ref: meta?.hideHeader ? void 0 : headers.register(header.column.id), className: "inline-block", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(DataTableColumnHeader, { column: header.column }) }) : (0, import_react_table.flexRender)(definition, header.getContext())
|
|
@@ -11055,6 +11274,20 @@ function BodyCell({
|
|
|
11055
11274
|
}
|
|
11056
11275
|
);
|
|
11057
11276
|
}
|
|
11277
|
+
function CardScroll({ label, maxHeight, children }) {
|
|
11278
|
+
const scroll = useScrollEdges();
|
|
11279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
11280
|
+
"div",
|
|
11281
|
+
{
|
|
11282
|
+
ref: scroll.ref,
|
|
11283
|
+
onScroll: scroll.onScroll,
|
|
11284
|
+
style: { maxHeight },
|
|
11285
|
+
className: cn("overflow-y-auto overscroll-contain", SCROLLBAR_CLASSES, scroll.overflowingY && FOCUS_RING_INSET),
|
|
11286
|
+
...scroll.overflowingY ? { role: "region", tabIndex: 0, "aria-label": `${label ?? "Table"} (scrolls vertically)` } : {},
|
|
11287
|
+
children
|
|
11288
|
+
}
|
|
11289
|
+
);
|
|
11290
|
+
}
|
|
11058
11291
|
function CardList({
|
|
11059
11292
|
table,
|
|
11060
11293
|
label,
|
|
@@ -11135,7 +11368,7 @@ function CardList({
|
|
|
11135
11368
|
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "flex max-w-[45%] shrink-0 justify-end [&_.whitespace-nowrap]:whitespace-normal", children: render(slots.status.id) }),
|
|
11136
11369
|
slots.actions && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "relative z-raised shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(CellInteractionGuard, { children: render(slots.actions.id) }) })
|
|
11137
11370
|
] }),
|
|
11138
|
-
slots.fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("dl", { className: "grid grid-cols-[repeat(auto-
|
|
11371
|
+
slots.fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("dl", { className: "grid grid-cols-[repeat(auto-fit,minmax(min(100%,8.5rem),1fr))] gap-x-4 gap-y-2.5", children: slots.fields.map(({ id, column }) => /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: (0, import_clsx94.default)("min-w-0", column.columnDef.meta?.interactive && "relative z-raised"), children: [
|
|
11139
11372
|
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)("dt", { className: "text-body-tiny text-default-secondary", children: columnLabel(column) }),
|
|
11140
11373
|
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)("dd", { className: "mt-0.5 min-w-0 text-body-xs text-default", children: column.columnDef.meta?.interactive ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(CellInteractionGuard, { children: render(id) }) : render(id) })
|
|
11141
11374
|
] }, id)) })
|