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