@inf-monkeys-tech/monkeys-design 0.4.34 → 0.4.35
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/LICENSE +21 -21
- package/README.md +226 -226
- package/dist/components/base/index.d.mts +2 -2
- package/dist/components/base/index.d.ts +2 -2
- package/dist/components/base/index.js +2 -445
- package/dist/components/base/index.js.map +1 -1
- package/dist/components/base/index.mjs +3 -445
- package/dist/components/base/index.mjs.map +1 -1
- package/dist/components/data-explorer/index.js.map +1 -1
- package/dist/components/data-explorer/index.mjs.map +1 -1
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/components/login/index.js.map +1 -1
- package/dist/components/login/index.mjs.map +1 -1
- package/dist/components/toast/index.d.mts +75 -0
- package/dist/components/toast/index.d.ts +75 -0
- package/dist/components/toast/index.js +283 -0
- package/dist/components/toast/index.js.map +1 -0
- package/dist/components/toast/index.mjs +273 -0
- package/dist/components/toast/index.mjs.map +1 -0
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/toolbar/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 +2 -444
- package/dist/components/workbench/index.js.map +1 -1
- package/dist/components/workbench/index.mjs +2 -444
- package/dist/components/workbench/index.mjs.map +1 -1
- package/dist/icons/oauth/index.js.map +1 -1
- package/dist/icons/oauth/index.mjs.map +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +286 -455
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +278 -455
- package/dist/index.mjs.map +1 -1
- package/dist/palette/index.js.map +1 -1
- package/dist/palette/index.mjs.map +1 -1
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/index.mjs.map +1 -1
- package/dist/styles/artist-login.scss +374 -374
- package/dist/styles/global.scss +21 -21
- package/dist/styles/workflow-board.scss +440 -440
- package/dist/styles/workflow-nodes.css +340 -340
- package/dist/{theme-sIoU5-YC.d.ts → theme-CoG9vCPT.d.mts} +2 -4
- package/dist/{theme-Clm5dVb0.d.mts → theme-Cuy60thu.d.ts} +2 -4
- package/dist/theme-system/index.d.mts +1 -1
- package/dist/theme-system/index.d.ts +1 -1
- package/dist/theme-system/index.js +2 -444
- package/dist/theme-system/index.js.map +1 -1
- package/dist/theme-system/index.mjs +2 -444
- package/dist/theme-system/index.mjs.map +1 -1
- package/dist/themes/artist/index.js.map +1 -1
- package/dist/themes/artist/index.mjs.map +1 -1
- package/dist/themes/bsd/index.js.map +1 -1
- package/dist/themes/bsd/index.mjs.map +1 -1
- package/dist/themes/concept/index.js.map +1 -1
- package/dist/themes/concept/index.mjs.map +1 -1
- package/dist/themes/default/index.js.map +1 -1
- package/dist/themes/default/index.mjs.map +1 -1
- package/dist/{types-Bn6PEDsX.d.mts → types-CZALgtez.d.mts} +1 -43
- package/dist/{types-Bn6PEDsX.d.ts → types-CZALgtez.d.ts} +1 -43
- package/package.json +146 -139
|
@@ -9774,448 +9774,6 @@ forwardRef(
|
|
|
9774
9774
|
);
|
|
9775
9775
|
}
|
|
9776
9776
|
);
|
|
9777
|
-
function normalizeValues(values) {
|
|
9778
|
-
const nextValues = [];
|
|
9779
|
-
const seen = /* @__PURE__ */ new Set();
|
|
9780
|
-
values?.forEach((value) => {
|
|
9781
|
-
if (seen.has(value)) return;
|
|
9782
|
-
seen.add(value);
|
|
9783
|
-
nextValues.push(value);
|
|
9784
|
-
});
|
|
9785
|
-
return nextValues;
|
|
9786
|
-
}
|
|
9787
|
-
function getNextEnabledIndex(options, currentIndex, direction) {
|
|
9788
|
-
if (!options.length) return -1;
|
|
9789
|
-
const startIndex = currentIndex >= 0 ? currentIndex : 0;
|
|
9790
|
-
for (let offset = 1; offset <= options.length; offset += 1) {
|
|
9791
|
-
const nextIndex = (startIndex + offset * direction + options.length) % options.length;
|
|
9792
|
-
if (!options[nextIndex]?.disabled) {
|
|
9793
|
-
return nextIndex;
|
|
9794
|
-
}
|
|
9795
|
-
}
|
|
9796
|
-
return -1;
|
|
9797
|
-
}
|
|
9798
|
-
function getFirstEnabledIndex(options) {
|
|
9799
|
-
return options.findIndex((option) => !option.disabled);
|
|
9800
|
-
}
|
|
9801
|
-
function getSafeTagCount(maxTagCount, total) {
|
|
9802
|
-
if (maxTagCount === void 0) return total;
|
|
9803
|
-
if (!Number.isFinite(maxTagCount)) return total;
|
|
9804
|
-
return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
|
|
9805
|
-
}
|
|
9806
|
-
function getDefaultRemoveLabel(option) {
|
|
9807
|
-
return `Remove ${option.value}`;
|
|
9808
|
-
}
|
|
9809
|
-
forwardRef(
|
|
9810
|
-
function BaseMultiSelect2({
|
|
9811
|
-
options,
|
|
9812
|
-
value,
|
|
9813
|
-
defaultValue,
|
|
9814
|
-
name,
|
|
9815
|
-
placeholder = "Select options",
|
|
9816
|
-
icon,
|
|
9817
|
-
invalid = false,
|
|
9818
|
-
disabled = false,
|
|
9819
|
-
required = false,
|
|
9820
|
-
openForPreview = false,
|
|
9821
|
-
maxTagCount,
|
|
9822
|
-
removeLabel = getDefaultRemoveLabel,
|
|
9823
|
-
emptyLabel = "No options",
|
|
9824
|
-
appearance,
|
|
9825
|
-
className,
|
|
9826
|
-
classNames,
|
|
9827
|
-
style,
|
|
9828
|
-
id,
|
|
9829
|
-
"aria-invalid": nativeAriaInvalid,
|
|
9830
|
-
"aria-label": nativeAriaLabel,
|
|
9831
|
-
"aria-labelledby": nativeAriaLabelledBy,
|
|
9832
|
-
onValueChange,
|
|
9833
|
-
...rootProps
|
|
9834
|
-
}, ref) {
|
|
9835
|
-
const theme = resolveBaseAppearance(appearance);
|
|
9836
|
-
const generatedId = useId();
|
|
9837
|
-
const multiSelectId = id ?? generatedId;
|
|
9838
|
-
const controlId = `${multiSelectId}-control`;
|
|
9839
|
-
const listboxId = `${multiSelectId}-listbox`;
|
|
9840
|
-
const rootRef = useRef(null);
|
|
9841
|
-
const optionList = options ?? [];
|
|
9842
|
-
const forceOpen = openForPreview;
|
|
9843
|
-
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
|
|
9844
|
-
const open = forceOpen || uncontrolledOpen;
|
|
9845
|
-
const [uncontrolledValue, setUncontrolledValue] = useState(
|
|
9846
|
-
() => normalizeValues(defaultValue)
|
|
9847
|
-
);
|
|
9848
|
-
const [activeIndex, setActiveIndex] = useState(
|
|
9849
|
-
() => getFirstEnabledIndex(optionList)
|
|
9850
|
-
);
|
|
9851
|
-
const isControlled = value !== void 0;
|
|
9852
|
-
const selectedValues = useMemo(
|
|
9853
|
-
() => normalizeValues(isControlled ? value : uncontrolledValue),
|
|
9854
|
-
[isControlled, uncontrolledValue, value]
|
|
9855
|
-
);
|
|
9856
|
-
const selectedValueSet = useMemo(
|
|
9857
|
-
() => new Set(selectedValues),
|
|
9858
|
-
[selectedValues]
|
|
9859
|
-
);
|
|
9860
|
-
const optionByValue = useMemo(() => {
|
|
9861
|
-
const map = /* @__PURE__ */ new Map();
|
|
9862
|
-
optionList.forEach((option) => {
|
|
9863
|
-
if (!map.has(option.value)) {
|
|
9864
|
-
map.set(option.value, option);
|
|
9865
|
-
}
|
|
9866
|
-
});
|
|
9867
|
-
return map;
|
|
9868
|
-
}, [optionList]);
|
|
9869
|
-
const selectedOptions = useMemo(
|
|
9870
|
-
() => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
|
|
9871
|
-
(option) => option !== void 0
|
|
9872
|
-
),
|
|
9873
|
-
[optionByValue, selectedValues]
|
|
9874
|
-
);
|
|
9875
|
-
const firstEnabledIndex = useMemo(
|
|
9876
|
-
() => getFirstEnabledIndex(optionList),
|
|
9877
|
-
[optionList]
|
|
9878
|
-
);
|
|
9879
|
-
const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
|
|
9880
|
-
const visibleTagCount = getSafeTagCount(
|
|
9881
|
-
maxTagCount,
|
|
9882
|
-
selectedOptions.length
|
|
9883
|
-
);
|
|
9884
|
-
const visibleOptions = selectedOptions.slice(0, visibleTagCount);
|
|
9885
|
-
const overflowCount = selectedOptions.length - visibleOptions.length;
|
|
9886
|
-
const isPlaceholder = selectedOptions.length === 0;
|
|
9887
|
-
const setRootRef = (node) => {
|
|
9888
|
-
rootRef.current = node;
|
|
9889
|
-
if (typeof ref === "function") {
|
|
9890
|
-
ref(node);
|
|
9891
|
-
} else if (ref) {
|
|
9892
|
-
ref.current = node;
|
|
9893
|
-
}
|
|
9894
|
-
};
|
|
9895
|
-
const setOpen = (nextOpen) => {
|
|
9896
|
-
if (disabled || forceOpen) return;
|
|
9897
|
-
setUncontrolledOpen(nextOpen);
|
|
9898
|
-
if (nextOpen) {
|
|
9899
|
-
setActiveIndex(resolvedActiveIndex);
|
|
9900
|
-
}
|
|
9901
|
-
};
|
|
9902
|
-
useEffect(() => {
|
|
9903
|
-
if (!open || forceOpen) return void 0;
|
|
9904
|
-
const handlePointerDown = (event) => {
|
|
9905
|
-
if (!rootRef.current?.contains(event.target)) {
|
|
9906
|
-
setUncontrolledOpen(false);
|
|
9907
|
-
}
|
|
9908
|
-
};
|
|
9909
|
-
document.addEventListener("pointerdown", handlePointerDown);
|
|
9910
|
-
return () => {
|
|
9911
|
-
document.removeEventListener("pointerdown", handlePointerDown);
|
|
9912
|
-
};
|
|
9913
|
-
}, [forceOpen, open]);
|
|
9914
|
-
useEffect(() => {
|
|
9915
|
-
if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
|
|
9916
|
-
setActiveIndex(resolvedActiveIndex);
|
|
9917
|
-
}
|
|
9918
|
-
}, [activeIndex, resolvedActiveIndex]);
|
|
9919
|
-
const commitValues = (nextValues) => {
|
|
9920
|
-
const normalizedValues = normalizeValues(nextValues);
|
|
9921
|
-
if (!isControlled) {
|
|
9922
|
-
setUncontrolledValue(normalizedValues);
|
|
9923
|
-
}
|
|
9924
|
-
onValueChange?.(normalizedValues);
|
|
9925
|
-
};
|
|
9926
|
-
const toggleOption = (option) => {
|
|
9927
|
-
if (!option || option.disabled || disabled) return;
|
|
9928
|
-
const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
|
|
9929
|
-
commitValues(nextValues);
|
|
9930
|
-
};
|
|
9931
|
-
const removeOption = (option) => {
|
|
9932
|
-
if (disabled) return;
|
|
9933
|
-
commitValues(
|
|
9934
|
-
selectedValues.filter((selectedValue) => selectedValue !== option.value)
|
|
9935
|
-
);
|
|
9936
|
-
};
|
|
9937
|
-
const focusOption = (direction) => {
|
|
9938
|
-
const nextIndex = getNextEnabledIndex(
|
|
9939
|
-
optionList,
|
|
9940
|
-
resolvedActiveIndex,
|
|
9941
|
-
direction
|
|
9942
|
-
);
|
|
9943
|
-
if (nextIndex >= 0) {
|
|
9944
|
-
setActiveIndex(nextIndex);
|
|
9945
|
-
}
|
|
9946
|
-
};
|
|
9947
|
-
const handleKeyDown = (event) => {
|
|
9948
|
-
if (disabled) return;
|
|
9949
|
-
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
9950
|
-
event.preventDefault();
|
|
9951
|
-
if (!open) {
|
|
9952
|
-
setOpen(true);
|
|
9953
|
-
setActiveIndex(firstEnabledIndex);
|
|
9954
|
-
return;
|
|
9955
|
-
}
|
|
9956
|
-
focusOption(event.key === "ArrowDown" ? 1 : -1);
|
|
9957
|
-
return;
|
|
9958
|
-
}
|
|
9959
|
-
if (event.key === "Home") {
|
|
9960
|
-
event.preventDefault();
|
|
9961
|
-
setOpen(true);
|
|
9962
|
-
setActiveIndex(firstEnabledIndex);
|
|
9963
|
-
return;
|
|
9964
|
-
}
|
|
9965
|
-
if (event.key === "End") {
|
|
9966
|
-
event.preventDefault();
|
|
9967
|
-
setOpen(true);
|
|
9968
|
-
for (let index = optionList.length - 1; index >= 0; index -= 1) {
|
|
9969
|
-
if (!optionList[index]?.disabled) {
|
|
9970
|
-
setActiveIndex(index);
|
|
9971
|
-
break;
|
|
9972
|
-
}
|
|
9973
|
-
}
|
|
9974
|
-
return;
|
|
9975
|
-
}
|
|
9976
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
9977
|
-
event.preventDefault();
|
|
9978
|
-
if (!open) {
|
|
9979
|
-
setOpen(true);
|
|
9980
|
-
return;
|
|
9981
|
-
}
|
|
9982
|
-
toggleOption(optionList[resolvedActiveIndex]);
|
|
9983
|
-
return;
|
|
9984
|
-
}
|
|
9985
|
-
if (event.key === "Escape") {
|
|
9986
|
-
setOpen(false);
|
|
9987
|
-
}
|
|
9988
|
-
};
|
|
9989
|
-
return /* @__PURE__ */ jsxs(
|
|
9990
|
-
"div",
|
|
9991
|
-
{
|
|
9992
|
-
...rootProps,
|
|
9993
|
-
id,
|
|
9994
|
-
ref: setRootRef,
|
|
9995
|
-
className: cn(
|
|
9996
|
-
theme.slots.controlWrapper,
|
|
9997
|
-
"overflow-visible",
|
|
9998
|
-
open && "z-50",
|
|
9999
|
-
invalid && theme.slots.controlInvalid,
|
|
10000
|
-
disabled && theme.slots.controlDisabled,
|
|
10001
|
-
classNames?.root,
|
|
10002
|
-
className
|
|
10003
|
-
),
|
|
10004
|
-
style: {
|
|
10005
|
-
...theme.styles.control,
|
|
10006
|
-
...invalid ? theme.styles.controlInvalid : void 0,
|
|
10007
|
-
...disabled ? theme.styles.controlDisabled : void 0,
|
|
10008
|
-
...style
|
|
10009
|
-
},
|
|
10010
|
-
children: [
|
|
10011
|
-
hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
|
|
10012
|
-
/* @__PURE__ */ jsx(
|
|
10013
|
-
"div",
|
|
10014
|
-
{
|
|
10015
|
-
id: controlId,
|
|
10016
|
-
role: "combobox",
|
|
10017
|
-
tabIndex: disabled ? -1 : 0,
|
|
10018
|
-
"aria-haspopup": "listbox",
|
|
10019
|
-
"aria-expanded": open,
|
|
10020
|
-
"aria-controls": listboxId,
|
|
10021
|
-
"aria-disabled": disabled || void 0,
|
|
10022
|
-
"aria-required": required || void 0,
|
|
10023
|
-
"aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
|
|
10024
|
-
"aria-label": nativeAriaLabel,
|
|
10025
|
-
"aria-labelledby": nativeAriaLabelledBy,
|
|
10026
|
-
className: cn(
|
|
10027
|
-
theme.slots.controlBase,
|
|
10028
|
-
"flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
|
|
10029
|
-
disabled && "!cursor-not-allowed",
|
|
10030
|
-
classNames?.control
|
|
10031
|
-
),
|
|
10032
|
-
onClick: () => setOpen(!open),
|
|
10033
|
-
onKeyDown: handleKeyDown,
|
|
10034
|
-
children: /* @__PURE__ */ jsxs(
|
|
10035
|
-
"span",
|
|
10036
|
-
{
|
|
10037
|
-
className: cn(
|
|
10038
|
-
"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
|
|
10039
|
-
classNames?.tagList
|
|
10040
|
-
),
|
|
10041
|
-
children: [
|
|
10042
|
-
visibleOptions.map((option) => /* @__PURE__ */ jsxs(
|
|
10043
|
-
"span",
|
|
10044
|
-
{
|
|
10045
|
-
className: cn(
|
|
10046
|
-
"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",
|
|
10047
|
-
classNames?.tag
|
|
10048
|
-
),
|
|
10049
|
-
children: [
|
|
10050
|
-
/* @__PURE__ */ jsx(
|
|
10051
|
-
"span",
|
|
10052
|
-
{
|
|
10053
|
-
className: cn(
|
|
10054
|
-
"max-w-40 truncate",
|
|
10055
|
-
classNames?.tagLabel
|
|
10056
|
-
),
|
|
10057
|
-
children: option.label
|
|
10058
|
-
}
|
|
10059
|
-
),
|
|
10060
|
-
/* @__PURE__ */ jsx(
|
|
10061
|
-
"button",
|
|
10062
|
-
{
|
|
10063
|
-
type: "button",
|
|
10064
|
-
"aria-label": removeLabel(option),
|
|
10065
|
-
disabled,
|
|
10066
|
-
className: cn(
|
|
10067
|
-
"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",
|
|
10068
|
-
classNames?.tagRemove
|
|
10069
|
-
),
|
|
10070
|
-
onClick: (event) => {
|
|
10071
|
-
event.preventDefault();
|
|
10072
|
-
event.stopPropagation();
|
|
10073
|
-
removeOption(option);
|
|
10074
|
-
},
|
|
10075
|
-
onMouseDown: (event) => {
|
|
10076
|
-
event.preventDefault();
|
|
10077
|
-
event.stopPropagation();
|
|
10078
|
-
},
|
|
10079
|
-
onKeyDown: (event) => event.stopPropagation(),
|
|
10080
|
-
children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "x" })
|
|
10081
|
-
}
|
|
10082
|
-
)
|
|
10083
|
-
]
|
|
10084
|
-
},
|
|
10085
|
-
option.value
|
|
10086
|
-
)),
|
|
10087
|
-
overflowCount > 0 ? /* @__PURE__ */ jsxs(
|
|
10088
|
-
"span",
|
|
10089
|
-
{
|
|
10090
|
-
className: cn(
|
|
10091
|
-
"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",
|
|
10092
|
-
classNames?.tag
|
|
10093
|
-
),
|
|
10094
|
-
children: [
|
|
10095
|
-
"+",
|
|
10096
|
-
overflowCount
|
|
10097
|
-
]
|
|
10098
|
-
}
|
|
10099
|
-
) : null,
|
|
10100
|
-
isPlaceholder ? /* @__PURE__ */ jsx(
|
|
10101
|
-
"span",
|
|
10102
|
-
{
|
|
10103
|
-
className: cn(
|
|
10104
|
-
"min-w-0 truncate",
|
|
10105
|
-
theme.slots.selectPlaceholder,
|
|
10106
|
-
classNames?.placeholder
|
|
10107
|
-
),
|
|
10108
|
-
children: placeholder
|
|
10109
|
-
}
|
|
10110
|
-
) : null
|
|
10111
|
-
]
|
|
10112
|
-
}
|
|
10113
|
-
)
|
|
10114
|
-
}
|
|
10115
|
-
),
|
|
10116
|
-
/* @__PURE__ */ jsx(
|
|
10117
|
-
"span",
|
|
10118
|
-
{
|
|
10119
|
-
className: cn(
|
|
10120
|
-
theme.slots.selectChevron,
|
|
10121
|
-
open && "rotate-[225deg]",
|
|
10122
|
-
classNames?.chevron
|
|
10123
|
-
)
|
|
10124
|
-
}
|
|
10125
|
-
),
|
|
10126
|
-
name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsx(
|
|
10127
|
-
"input",
|
|
10128
|
-
{
|
|
10129
|
-
type: "hidden",
|
|
10130
|
-
name,
|
|
10131
|
-
value: selectedValue,
|
|
10132
|
-
className: classNames?.hiddenInput
|
|
10133
|
-
},
|
|
10134
|
-
selectedValue
|
|
10135
|
-
)) : null,
|
|
10136
|
-
open ? /* @__PURE__ */ jsx(
|
|
10137
|
-
"div",
|
|
10138
|
-
{
|
|
10139
|
-
id: listboxId,
|
|
10140
|
-
role: "listbox",
|
|
10141
|
-
"aria-multiselectable": "true",
|
|
10142
|
-
"aria-labelledby": controlId,
|
|
10143
|
-
className: cn(theme.slots.selectMenu, classNames?.menu),
|
|
10144
|
-
style: theme.styles.selectMenu,
|
|
10145
|
-
children: optionList.length > 0 ? optionList.map((option, index) => {
|
|
10146
|
-
const selected = selectedValueSet.has(option.value);
|
|
10147
|
-
const active = index === resolvedActiveIndex;
|
|
10148
|
-
return /* @__PURE__ */ jsxs(
|
|
10149
|
-
"button",
|
|
10150
|
-
{
|
|
10151
|
-
type: "button",
|
|
10152
|
-
role: "option",
|
|
10153
|
-
"aria-selected": selected,
|
|
10154
|
-
disabled: option.disabled,
|
|
10155
|
-
className: cn(
|
|
10156
|
-
theme.slots.selectOption,
|
|
10157
|
-
"gap-2",
|
|
10158
|
-
active && theme.slots.selectOptionActive,
|
|
10159
|
-
selected && theme.slots.selectOptionSelected,
|
|
10160
|
-
option.disabled && theme.slots.selectOptionDisabled,
|
|
10161
|
-
classNames?.option
|
|
10162
|
-
),
|
|
10163
|
-
style: {
|
|
10164
|
-
...theme.styles.selectOption,
|
|
10165
|
-
...active ? theme.styles.selectOptionActive : void 0,
|
|
10166
|
-
...selected ? theme.styles.selectOptionSelected : void 0
|
|
10167
|
-
},
|
|
10168
|
-
onMouseEnter: () => {
|
|
10169
|
-
if (!option.disabled) {
|
|
10170
|
-
setActiveIndex(index);
|
|
10171
|
-
}
|
|
10172
|
-
},
|
|
10173
|
-
onMouseDown: (event) => event.preventDefault(),
|
|
10174
|
-
onClick: () => toggleOption(option),
|
|
10175
|
-
children: [
|
|
10176
|
-
/* @__PURE__ */ jsx(
|
|
10177
|
-
"span",
|
|
10178
|
-
{
|
|
10179
|
-
"aria-hidden": "true",
|
|
10180
|
-
className: cn(
|
|
10181
|
-
"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
|
|
10182
|
-
selected && "border-primary/40 bg-primary text-primary-foreground",
|
|
10183
|
-
classNames?.optionIndicator
|
|
10184
|
-
),
|
|
10185
|
-
children: selected ? "\u2713" : null
|
|
10186
|
-
}
|
|
10187
|
-
),
|
|
10188
|
-
/* @__PURE__ */ jsx(
|
|
10189
|
-
"span",
|
|
10190
|
-
{
|
|
10191
|
-
className: cn(
|
|
10192
|
-
"min-w-0 flex-1 truncate",
|
|
10193
|
-
classNames?.optionLabel
|
|
10194
|
-
),
|
|
10195
|
-
children: option.label
|
|
10196
|
-
}
|
|
10197
|
-
)
|
|
10198
|
-
]
|
|
10199
|
-
},
|
|
10200
|
-
option.value
|
|
10201
|
-
);
|
|
10202
|
-
}) : /* @__PURE__ */ jsx(
|
|
10203
|
-
"div",
|
|
10204
|
-
{
|
|
10205
|
-
className: cn(
|
|
10206
|
-
"px-2.5 py-2 text-sm text-muted-foreground",
|
|
10207
|
-
classNames?.empty
|
|
10208
|
-
),
|
|
10209
|
-
children: emptyLabel
|
|
10210
|
-
}
|
|
10211
|
-
)
|
|
10212
|
-
}
|
|
10213
|
-
) : null
|
|
10214
|
-
]
|
|
10215
|
-
}
|
|
10216
|
-
);
|
|
10217
|
-
}
|
|
10218
|
-
);
|
|
10219
9777
|
function findOption(options, value) {
|
|
10220
9778
|
if (value === void 0) return void 0;
|
|
10221
9779
|
return options.find((option) => option.value === value);
|
|
@@ -10226,7 +9784,7 @@ function getInitialValue(options, defaultValue) {
|
|
|
10226
9784
|
}
|
|
10227
9785
|
return "";
|
|
10228
9786
|
}
|
|
10229
|
-
function
|
|
9787
|
+
function getNextEnabledIndex(options, currentIndex, direction) {
|
|
10230
9788
|
if (!options.length) return -1;
|
|
10231
9789
|
for (let offset = 1; offset <= options.length; offset += 1) {
|
|
10232
9790
|
const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
|
|
@@ -10328,7 +9886,7 @@ forwardRef(
|
|
|
10328
9886
|
};
|
|
10329
9887
|
const focusOption = (direction) => {
|
|
10330
9888
|
const currentIndex = activeIndex >= 0 ? activeIndex : 0;
|
|
10331
|
-
const nextIndex =
|
|
9889
|
+
const nextIndex = getNextEnabledIndex(optionList, currentIndex, direction);
|
|
10332
9890
|
if (nextIndex >= 0) {
|
|
10333
9891
|
commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
|
|
10334
9892
|
}
|