@inf-monkeys-tech/monkeys-design 0.4.35 → 0.4.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -0
- package/dist/components/base/index.d.mts +2 -2
- package/dist/components/base/index.d.ts +2 -2
- package/dist/components/base/index.js +445 -2
- package/dist/components/base/index.js.map +1 -1
- package/dist/components/base/index.mjs +445 -3
- package/dist/components/base/index.mjs.map +1 -1
- package/dist/components/login/index.d.mts +97 -1
- package/dist/components/login/index.d.ts +97 -1
- package/dist/components/login/index.js +262 -2
- package/dist/components/login/index.js.map +1 -1
- package/dist/components/login/index.mjs +262 -3
- package/dist/components/login/index.mjs.map +1 -1
- package/dist/components/workbench/index.d.mts +1 -1
- package/dist/components/workbench/index.d.ts +1 -1
- package/dist/components/workbench/index.js +444 -2
- package/dist/components/workbench/index.js.map +1 -1
- package/dist/components/workbench/index.mjs +444 -2
- package/dist/components/workbench/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +705 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +704 -3
- package/dist/index.mjs.map +1 -1
- package/dist/styles/login-page.scss +423 -0
- package/dist/{theme-Cuy60thu.d.ts → theme-Clm5dVb0.d.mts} +4 -2
- package/dist/{theme-CoG9vCPT.d.mts → theme-sIoU5-YC.d.ts} +4 -2
- package/dist/theme-system/index.d.mts +1 -1
- package/dist/theme-system/index.d.ts +1 -1
- package/dist/theme-system/index.js +444 -2
- package/dist/theme-system/index.js.map +1 -1
- package/dist/theme-system/index.mjs +444 -2
- package/dist/theme-system/index.mjs.map +1 -1
- package/dist/{types-CZALgtez.d.ts → types-Bn6PEDsX.d.mts} +43 -1
- package/dist/{types-CZALgtez.d.mts → types-Bn6PEDsX.d.ts} +43 -1
- package/package.json +5 -2
- package/dist/styles/artist-login.scss +0 -375
|
@@ -2297,6 +2297,448 @@ var BaseInput = react.forwardRef(
|
|
|
2297
2297
|
);
|
|
2298
2298
|
}
|
|
2299
2299
|
);
|
|
2300
|
+
function normalizeValues(values) {
|
|
2301
|
+
const nextValues = [];
|
|
2302
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2303
|
+
values?.forEach((value) => {
|
|
2304
|
+
if (seen.has(value)) return;
|
|
2305
|
+
seen.add(value);
|
|
2306
|
+
nextValues.push(value);
|
|
2307
|
+
});
|
|
2308
|
+
return nextValues;
|
|
2309
|
+
}
|
|
2310
|
+
function getNextEnabledIndex(options, currentIndex, direction) {
|
|
2311
|
+
if (!options.length) return -1;
|
|
2312
|
+
const startIndex = currentIndex >= 0 ? currentIndex : 0;
|
|
2313
|
+
for (let offset = 1; offset <= options.length; offset += 1) {
|
|
2314
|
+
const nextIndex = (startIndex + offset * direction + options.length) % options.length;
|
|
2315
|
+
if (!options[nextIndex]?.disabled) {
|
|
2316
|
+
return nextIndex;
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
return -1;
|
|
2320
|
+
}
|
|
2321
|
+
function getFirstEnabledIndex(options) {
|
|
2322
|
+
return options.findIndex((option) => !option.disabled);
|
|
2323
|
+
}
|
|
2324
|
+
function getSafeTagCount(maxTagCount, total) {
|
|
2325
|
+
if (maxTagCount === void 0) return total;
|
|
2326
|
+
if (!Number.isFinite(maxTagCount)) return total;
|
|
2327
|
+
return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
|
|
2328
|
+
}
|
|
2329
|
+
function getDefaultRemoveLabel(option) {
|
|
2330
|
+
return `Remove ${option.value}`;
|
|
2331
|
+
}
|
|
2332
|
+
react.forwardRef(
|
|
2333
|
+
function BaseMultiSelect2({
|
|
2334
|
+
options,
|
|
2335
|
+
value,
|
|
2336
|
+
defaultValue,
|
|
2337
|
+
name,
|
|
2338
|
+
placeholder = "Select options",
|
|
2339
|
+
icon,
|
|
2340
|
+
invalid = false,
|
|
2341
|
+
disabled = false,
|
|
2342
|
+
required = false,
|
|
2343
|
+
openForPreview = false,
|
|
2344
|
+
maxTagCount,
|
|
2345
|
+
removeLabel = getDefaultRemoveLabel,
|
|
2346
|
+
emptyLabel = "No options",
|
|
2347
|
+
appearance,
|
|
2348
|
+
className,
|
|
2349
|
+
classNames,
|
|
2350
|
+
style,
|
|
2351
|
+
id,
|
|
2352
|
+
"aria-invalid": nativeAriaInvalid,
|
|
2353
|
+
"aria-label": nativeAriaLabel,
|
|
2354
|
+
"aria-labelledby": nativeAriaLabelledBy,
|
|
2355
|
+
onValueChange,
|
|
2356
|
+
...rootProps
|
|
2357
|
+
}, ref) {
|
|
2358
|
+
const theme = resolveBaseAppearance(appearance);
|
|
2359
|
+
const generatedId = react.useId();
|
|
2360
|
+
const multiSelectId = id ?? generatedId;
|
|
2361
|
+
const controlId = `${multiSelectId}-control`;
|
|
2362
|
+
const listboxId = `${multiSelectId}-listbox`;
|
|
2363
|
+
const rootRef = react.useRef(null);
|
|
2364
|
+
const optionList = options ?? [];
|
|
2365
|
+
const forceOpen = openForPreview;
|
|
2366
|
+
const [uncontrolledOpen, setUncontrolledOpen] = react.useState(false);
|
|
2367
|
+
const open = forceOpen || uncontrolledOpen;
|
|
2368
|
+
const [uncontrolledValue, setUncontrolledValue] = react.useState(
|
|
2369
|
+
() => normalizeValues(defaultValue)
|
|
2370
|
+
);
|
|
2371
|
+
const [activeIndex, setActiveIndex] = react.useState(
|
|
2372
|
+
() => getFirstEnabledIndex(optionList)
|
|
2373
|
+
);
|
|
2374
|
+
const isControlled = value !== void 0;
|
|
2375
|
+
const selectedValues = react.useMemo(
|
|
2376
|
+
() => normalizeValues(isControlled ? value : uncontrolledValue),
|
|
2377
|
+
[isControlled, uncontrolledValue, value]
|
|
2378
|
+
);
|
|
2379
|
+
const selectedValueSet = react.useMemo(
|
|
2380
|
+
() => new Set(selectedValues),
|
|
2381
|
+
[selectedValues]
|
|
2382
|
+
);
|
|
2383
|
+
const optionByValue = react.useMemo(() => {
|
|
2384
|
+
const map = /* @__PURE__ */ new Map();
|
|
2385
|
+
optionList.forEach((option) => {
|
|
2386
|
+
if (!map.has(option.value)) {
|
|
2387
|
+
map.set(option.value, option);
|
|
2388
|
+
}
|
|
2389
|
+
});
|
|
2390
|
+
return map;
|
|
2391
|
+
}, [optionList]);
|
|
2392
|
+
const selectedOptions = react.useMemo(
|
|
2393
|
+
() => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
|
|
2394
|
+
(option) => option !== void 0
|
|
2395
|
+
),
|
|
2396
|
+
[optionByValue, selectedValues]
|
|
2397
|
+
);
|
|
2398
|
+
const firstEnabledIndex = react.useMemo(
|
|
2399
|
+
() => getFirstEnabledIndex(optionList),
|
|
2400
|
+
[optionList]
|
|
2401
|
+
);
|
|
2402
|
+
const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
|
|
2403
|
+
const visibleTagCount = getSafeTagCount(
|
|
2404
|
+
maxTagCount,
|
|
2405
|
+
selectedOptions.length
|
|
2406
|
+
);
|
|
2407
|
+
const visibleOptions = selectedOptions.slice(0, visibleTagCount);
|
|
2408
|
+
const overflowCount = selectedOptions.length - visibleOptions.length;
|
|
2409
|
+
const isPlaceholder = selectedOptions.length === 0;
|
|
2410
|
+
const setRootRef = (node) => {
|
|
2411
|
+
rootRef.current = node;
|
|
2412
|
+
if (typeof ref === "function") {
|
|
2413
|
+
ref(node);
|
|
2414
|
+
} else if (ref) {
|
|
2415
|
+
ref.current = node;
|
|
2416
|
+
}
|
|
2417
|
+
};
|
|
2418
|
+
const setOpen = (nextOpen) => {
|
|
2419
|
+
if (disabled || forceOpen) return;
|
|
2420
|
+
setUncontrolledOpen(nextOpen);
|
|
2421
|
+
if (nextOpen) {
|
|
2422
|
+
setActiveIndex(resolvedActiveIndex);
|
|
2423
|
+
}
|
|
2424
|
+
};
|
|
2425
|
+
react.useEffect(() => {
|
|
2426
|
+
if (!open || forceOpen) return void 0;
|
|
2427
|
+
const handlePointerDown = (event) => {
|
|
2428
|
+
if (!rootRef.current?.contains(event.target)) {
|
|
2429
|
+
setUncontrolledOpen(false);
|
|
2430
|
+
}
|
|
2431
|
+
};
|
|
2432
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
2433
|
+
return () => {
|
|
2434
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
2435
|
+
};
|
|
2436
|
+
}, [forceOpen, open]);
|
|
2437
|
+
react.useEffect(() => {
|
|
2438
|
+
if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
|
|
2439
|
+
setActiveIndex(resolvedActiveIndex);
|
|
2440
|
+
}
|
|
2441
|
+
}, [activeIndex, resolvedActiveIndex]);
|
|
2442
|
+
const commitValues = (nextValues) => {
|
|
2443
|
+
const normalizedValues = normalizeValues(nextValues);
|
|
2444
|
+
if (!isControlled) {
|
|
2445
|
+
setUncontrolledValue(normalizedValues);
|
|
2446
|
+
}
|
|
2447
|
+
onValueChange?.(normalizedValues);
|
|
2448
|
+
};
|
|
2449
|
+
const toggleOption = (option) => {
|
|
2450
|
+
if (!option || option.disabled || disabled) return;
|
|
2451
|
+
const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
|
|
2452
|
+
commitValues(nextValues);
|
|
2453
|
+
};
|
|
2454
|
+
const removeOption = (option) => {
|
|
2455
|
+
if (disabled) return;
|
|
2456
|
+
commitValues(
|
|
2457
|
+
selectedValues.filter((selectedValue) => selectedValue !== option.value)
|
|
2458
|
+
);
|
|
2459
|
+
};
|
|
2460
|
+
const focusOption = (direction) => {
|
|
2461
|
+
const nextIndex = getNextEnabledIndex(
|
|
2462
|
+
optionList,
|
|
2463
|
+
resolvedActiveIndex,
|
|
2464
|
+
direction
|
|
2465
|
+
);
|
|
2466
|
+
if (nextIndex >= 0) {
|
|
2467
|
+
setActiveIndex(nextIndex);
|
|
2468
|
+
}
|
|
2469
|
+
};
|
|
2470
|
+
const handleKeyDown = (event) => {
|
|
2471
|
+
if (disabled) return;
|
|
2472
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
2473
|
+
event.preventDefault();
|
|
2474
|
+
if (!open) {
|
|
2475
|
+
setOpen(true);
|
|
2476
|
+
setActiveIndex(firstEnabledIndex);
|
|
2477
|
+
return;
|
|
2478
|
+
}
|
|
2479
|
+
focusOption(event.key === "ArrowDown" ? 1 : -1);
|
|
2480
|
+
return;
|
|
2481
|
+
}
|
|
2482
|
+
if (event.key === "Home") {
|
|
2483
|
+
event.preventDefault();
|
|
2484
|
+
setOpen(true);
|
|
2485
|
+
setActiveIndex(firstEnabledIndex);
|
|
2486
|
+
return;
|
|
2487
|
+
}
|
|
2488
|
+
if (event.key === "End") {
|
|
2489
|
+
event.preventDefault();
|
|
2490
|
+
setOpen(true);
|
|
2491
|
+
for (let index = optionList.length - 1; index >= 0; index -= 1) {
|
|
2492
|
+
if (!optionList[index]?.disabled) {
|
|
2493
|
+
setActiveIndex(index);
|
|
2494
|
+
break;
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
return;
|
|
2498
|
+
}
|
|
2499
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
2500
|
+
event.preventDefault();
|
|
2501
|
+
if (!open) {
|
|
2502
|
+
setOpen(true);
|
|
2503
|
+
return;
|
|
2504
|
+
}
|
|
2505
|
+
toggleOption(optionList[resolvedActiveIndex]);
|
|
2506
|
+
return;
|
|
2507
|
+
}
|
|
2508
|
+
if (event.key === "Escape") {
|
|
2509
|
+
setOpen(false);
|
|
2510
|
+
}
|
|
2511
|
+
};
|
|
2512
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2513
|
+
"div",
|
|
2514
|
+
{
|
|
2515
|
+
...rootProps,
|
|
2516
|
+
id,
|
|
2517
|
+
ref: setRootRef,
|
|
2518
|
+
className: cn(
|
|
2519
|
+
theme.slots.controlWrapper,
|
|
2520
|
+
"overflow-visible",
|
|
2521
|
+
open && "z-50",
|
|
2522
|
+
invalid && theme.slots.controlInvalid,
|
|
2523
|
+
disabled && theme.slots.controlDisabled,
|
|
2524
|
+
classNames?.root,
|
|
2525
|
+
className
|
|
2526
|
+
),
|
|
2527
|
+
style: {
|
|
2528
|
+
...theme.styles.control,
|
|
2529
|
+
...invalid ? theme.styles.controlInvalid : void 0,
|
|
2530
|
+
...disabled ? theme.styles.controlDisabled : void 0,
|
|
2531
|
+
...style
|
|
2532
|
+
},
|
|
2533
|
+
children: [
|
|
2534
|
+
hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
|
|
2535
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2536
|
+
"div",
|
|
2537
|
+
{
|
|
2538
|
+
id: controlId,
|
|
2539
|
+
role: "combobox",
|
|
2540
|
+
tabIndex: disabled ? -1 : 0,
|
|
2541
|
+
"aria-haspopup": "listbox",
|
|
2542
|
+
"aria-expanded": open,
|
|
2543
|
+
"aria-controls": listboxId,
|
|
2544
|
+
"aria-disabled": disabled || void 0,
|
|
2545
|
+
"aria-required": required || void 0,
|
|
2546
|
+
"aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
|
|
2547
|
+
"aria-label": nativeAriaLabel,
|
|
2548
|
+
"aria-labelledby": nativeAriaLabelledBy,
|
|
2549
|
+
className: cn(
|
|
2550
|
+
theme.slots.controlBase,
|
|
2551
|
+
"flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
|
|
2552
|
+
disabled && "!cursor-not-allowed",
|
|
2553
|
+
classNames?.control
|
|
2554
|
+
),
|
|
2555
|
+
onClick: () => setOpen(!open),
|
|
2556
|
+
onKeyDown: handleKeyDown,
|
|
2557
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2558
|
+
"span",
|
|
2559
|
+
{
|
|
2560
|
+
className: cn(
|
|
2561
|
+
"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
|
|
2562
|
+
classNames?.tagList
|
|
2563
|
+
),
|
|
2564
|
+
children: [
|
|
2565
|
+
visibleOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2566
|
+
"span",
|
|
2567
|
+
{
|
|
2568
|
+
className: cn(
|
|
2569
|
+
"inline-flex max-w-full items-center gap-1 rounded-full border border-border/70 bg-muted/65 px-2 py-0.5 text-xs font-medium text-foreground",
|
|
2570
|
+
classNames?.tag
|
|
2571
|
+
),
|
|
2572
|
+
children: [
|
|
2573
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2574
|
+
"span",
|
|
2575
|
+
{
|
|
2576
|
+
className: cn(
|
|
2577
|
+
"max-w-40 truncate",
|
|
2578
|
+
classNames?.tagLabel
|
|
2579
|
+
),
|
|
2580
|
+
children: option.label
|
|
2581
|
+
}
|
|
2582
|
+
),
|
|
2583
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2584
|
+
"button",
|
|
2585
|
+
{
|
|
2586
|
+
type: "button",
|
|
2587
|
+
"aria-label": removeLabel(option),
|
|
2588
|
+
disabled,
|
|
2589
|
+
className: cn(
|
|
2590
|
+
"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-background/80 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed",
|
|
2591
|
+
classNames?.tagRemove
|
|
2592
|
+
),
|
|
2593
|
+
onClick: (event) => {
|
|
2594
|
+
event.preventDefault();
|
|
2595
|
+
event.stopPropagation();
|
|
2596
|
+
removeOption(option);
|
|
2597
|
+
},
|
|
2598
|
+
onMouseDown: (event) => {
|
|
2599
|
+
event.preventDefault();
|
|
2600
|
+
event.stopPropagation();
|
|
2601
|
+
},
|
|
2602
|
+
onKeyDown: (event) => event.stopPropagation(),
|
|
2603
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "x" })
|
|
2604
|
+
}
|
|
2605
|
+
)
|
|
2606
|
+
]
|
|
2607
|
+
},
|
|
2608
|
+
option.value
|
|
2609
|
+
)),
|
|
2610
|
+
overflowCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2611
|
+
"span",
|
|
2612
|
+
{
|
|
2613
|
+
className: cn(
|
|
2614
|
+
"inline-flex max-w-full items-center rounded-full border border-border/70 bg-muted/45 px-2 py-0.5 text-xs font-medium text-muted-foreground",
|
|
2615
|
+
classNames?.tag
|
|
2616
|
+
),
|
|
2617
|
+
children: [
|
|
2618
|
+
"+",
|
|
2619
|
+
overflowCount
|
|
2620
|
+
]
|
|
2621
|
+
}
|
|
2622
|
+
) : null,
|
|
2623
|
+
isPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2624
|
+
"span",
|
|
2625
|
+
{
|
|
2626
|
+
className: cn(
|
|
2627
|
+
"min-w-0 truncate",
|
|
2628
|
+
theme.slots.selectPlaceholder,
|
|
2629
|
+
classNames?.placeholder
|
|
2630
|
+
),
|
|
2631
|
+
children: placeholder
|
|
2632
|
+
}
|
|
2633
|
+
) : null
|
|
2634
|
+
]
|
|
2635
|
+
}
|
|
2636
|
+
)
|
|
2637
|
+
}
|
|
2638
|
+
),
|
|
2639
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2640
|
+
"span",
|
|
2641
|
+
{
|
|
2642
|
+
className: cn(
|
|
2643
|
+
theme.slots.selectChevron,
|
|
2644
|
+
open && "rotate-[225deg]",
|
|
2645
|
+
classNames?.chevron
|
|
2646
|
+
)
|
|
2647
|
+
}
|
|
2648
|
+
),
|
|
2649
|
+
name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2650
|
+
"input",
|
|
2651
|
+
{
|
|
2652
|
+
type: "hidden",
|
|
2653
|
+
name,
|
|
2654
|
+
value: selectedValue,
|
|
2655
|
+
className: classNames?.hiddenInput
|
|
2656
|
+
},
|
|
2657
|
+
selectedValue
|
|
2658
|
+
)) : null,
|
|
2659
|
+
open ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2660
|
+
"div",
|
|
2661
|
+
{
|
|
2662
|
+
id: listboxId,
|
|
2663
|
+
role: "listbox",
|
|
2664
|
+
"aria-multiselectable": "true",
|
|
2665
|
+
"aria-labelledby": controlId,
|
|
2666
|
+
className: cn(theme.slots.selectMenu, classNames?.menu),
|
|
2667
|
+
style: theme.styles.selectMenu,
|
|
2668
|
+
children: optionList.length > 0 ? optionList.map((option, index) => {
|
|
2669
|
+
const selected = selectedValueSet.has(option.value);
|
|
2670
|
+
const active = index === resolvedActiveIndex;
|
|
2671
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2672
|
+
"button",
|
|
2673
|
+
{
|
|
2674
|
+
type: "button",
|
|
2675
|
+
role: "option",
|
|
2676
|
+
"aria-selected": selected,
|
|
2677
|
+
disabled: option.disabled,
|
|
2678
|
+
className: cn(
|
|
2679
|
+
theme.slots.selectOption,
|
|
2680
|
+
"gap-2",
|
|
2681
|
+
active && theme.slots.selectOptionActive,
|
|
2682
|
+
selected && theme.slots.selectOptionSelected,
|
|
2683
|
+
option.disabled && theme.slots.selectOptionDisabled,
|
|
2684
|
+
classNames?.option
|
|
2685
|
+
),
|
|
2686
|
+
style: {
|
|
2687
|
+
...theme.styles.selectOption,
|
|
2688
|
+
...active ? theme.styles.selectOptionActive : void 0,
|
|
2689
|
+
...selected ? theme.styles.selectOptionSelected : void 0
|
|
2690
|
+
},
|
|
2691
|
+
onMouseEnter: () => {
|
|
2692
|
+
if (!option.disabled) {
|
|
2693
|
+
setActiveIndex(index);
|
|
2694
|
+
}
|
|
2695
|
+
},
|
|
2696
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
2697
|
+
onClick: () => toggleOption(option),
|
|
2698
|
+
children: [
|
|
2699
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2700
|
+
"span",
|
|
2701
|
+
{
|
|
2702
|
+
"aria-hidden": "true",
|
|
2703
|
+
className: cn(
|
|
2704
|
+
"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
|
|
2705
|
+
selected && "border-primary/40 bg-primary text-primary-foreground",
|
|
2706
|
+
classNames?.optionIndicator
|
|
2707
|
+
),
|
|
2708
|
+
children: selected ? "\u2713" : null
|
|
2709
|
+
}
|
|
2710
|
+
),
|
|
2711
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2712
|
+
"span",
|
|
2713
|
+
{
|
|
2714
|
+
className: cn(
|
|
2715
|
+
"min-w-0 flex-1 truncate",
|
|
2716
|
+
classNames?.optionLabel
|
|
2717
|
+
),
|
|
2718
|
+
children: option.label
|
|
2719
|
+
}
|
|
2720
|
+
)
|
|
2721
|
+
]
|
|
2722
|
+
},
|
|
2723
|
+
option.value
|
|
2724
|
+
);
|
|
2725
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2726
|
+
"div",
|
|
2727
|
+
{
|
|
2728
|
+
className: cn(
|
|
2729
|
+
"px-2.5 py-2 text-sm text-muted-foreground",
|
|
2730
|
+
classNames?.empty
|
|
2731
|
+
),
|
|
2732
|
+
children: emptyLabel
|
|
2733
|
+
}
|
|
2734
|
+
)
|
|
2735
|
+
}
|
|
2736
|
+
) : null
|
|
2737
|
+
]
|
|
2738
|
+
}
|
|
2739
|
+
);
|
|
2740
|
+
}
|
|
2741
|
+
);
|
|
2300
2742
|
function findOption(options, value) {
|
|
2301
2743
|
if (value === void 0) return void 0;
|
|
2302
2744
|
return options.find((option) => option.value === value);
|
|
@@ -2307,7 +2749,7 @@ function getInitialValue(options, defaultValue) {
|
|
|
2307
2749
|
}
|
|
2308
2750
|
return "";
|
|
2309
2751
|
}
|
|
2310
|
-
function
|
|
2752
|
+
function getNextEnabledIndex2(options, currentIndex, direction) {
|
|
2311
2753
|
if (!options.length) return -1;
|
|
2312
2754
|
for (let offset = 1; offset <= options.length; offset += 1) {
|
|
2313
2755
|
const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
|
|
@@ -2409,7 +2851,7 @@ var BaseSelect = react.forwardRef(
|
|
|
2409
2851
|
};
|
|
2410
2852
|
const focusOption = (direction) => {
|
|
2411
2853
|
const currentIndex = activeIndex >= 0 ? activeIndex : 0;
|
|
2412
|
-
const nextIndex =
|
|
2854
|
+
const nextIndex = getNextEnabledIndex2(optionList, currentIndex, direction);
|
|
2413
2855
|
if (nextIndex >= 0) {
|
|
2414
2856
|
commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
|
|
2415
2857
|
}
|