@sustaina/shared-ui 1.33.0 → 1.33.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.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +38 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10644,6 +10644,7 @@ var useFieldNames_default = useFieldNames;
|
|
|
10644
10644
|
var ROW_HEIGHT = 32;
|
|
10645
10645
|
var MIN_HEIGHT_EMPTY = 76;
|
|
10646
10646
|
var VirtualizedCommand = ({
|
|
10647
|
+
name,
|
|
10647
10648
|
height = 292,
|
|
10648
10649
|
options,
|
|
10649
10650
|
emptyContent = "No data.",
|
|
@@ -10751,7 +10752,14 @@ var VirtualizedCommand = ({
|
|
|
10751
10752
|
}
|
|
10752
10753
|
}, [value, filteredOptions, virtualizer, getValueField]);
|
|
10753
10754
|
return /* @__PURE__ */ jsxs(Command, { shouldFilter: false, onKeyDown: handleKeyDown, onFocus, onBlur, children: [
|
|
10754
|
-
showSearch && /* @__PURE__ */ jsx(
|
|
10755
|
+
showSearch && /* @__PURE__ */ jsx(
|
|
10756
|
+
CommandInput,
|
|
10757
|
+
{
|
|
10758
|
+
onValueChange: handleSearch,
|
|
10759
|
+
placeholder: searchPlaceholder,
|
|
10760
|
+
"data-testid": `command-input-${name}`
|
|
10761
|
+
}
|
|
10762
|
+
),
|
|
10755
10763
|
/* @__PURE__ */ jsxs(
|
|
10756
10764
|
CommandList,
|
|
10757
10765
|
{
|
|
@@ -10765,7 +10773,7 @@ var VirtualizedCommand = ({
|
|
|
10765
10773
|
onMouseDown: () => setIsKeyboardNavActive(false),
|
|
10766
10774
|
onMouseMove: () => setIsKeyboardNavActive(false),
|
|
10767
10775
|
children: [
|
|
10768
|
-
/* @__PURE__ */ jsx(CommandEmpty, { children: internalOptions.length === 0 ? emptyContent : notFoundContent }),
|
|
10776
|
+
/* @__PURE__ */ jsx(CommandEmpty, { "data-testid": `command-item-empty-${name}`, children: internalOptions.length === 0 ? emptyContent : notFoundContent }),
|
|
10769
10777
|
/* @__PURE__ */ jsx(
|
|
10770
10778
|
CommandGroup,
|
|
10771
10779
|
{
|
|
@@ -10774,7 +10782,7 @@ var VirtualizedCommand = ({
|
|
|
10774
10782
|
width: "100%",
|
|
10775
10783
|
position: "relative"
|
|
10776
10784
|
},
|
|
10777
|
-
children: virtualOptions.map((virtualOption) => {
|
|
10785
|
+
children: virtualOptions.map((virtualOption, index) => {
|
|
10778
10786
|
const option = filteredOptions[virtualOption.index];
|
|
10779
10787
|
const optionLabel = getLabelField(option);
|
|
10780
10788
|
const optionValue = getValueField(option);
|
|
@@ -10795,6 +10803,7 @@ var VirtualizedCommand = ({
|
|
|
10795
10803
|
onMouseLeave: () => !isKeyboardNavActive && setFocusedIndex(-1),
|
|
10796
10804
|
onSelect: (selectedValue) => onSelect?.(selectedValue, option),
|
|
10797
10805
|
disabled: disabledOption?.(option),
|
|
10806
|
+
"data-testid": `command-item-${index}-${optionValue}`,
|
|
10798
10807
|
children: [
|
|
10799
10808
|
typeof labelRendered === "string" ? /* @__PURE__ */ jsx(truncated_default, { tooltipProps: { disabled: true }, children: labelRendered }) : labelRendered,
|
|
10800
10809
|
/* @__PURE__ */ jsx(
|
|
@@ -10820,18 +10829,28 @@ var VirtualizedCommand = ({
|
|
|
10820
10829
|
};
|
|
10821
10830
|
var VirtualizedCommand_default = VirtualizedCommand;
|
|
10822
10831
|
var ComboboxInner = ({
|
|
10832
|
+
name,
|
|
10833
|
+
dropdownName,
|
|
10823
10834
|
defaultValue,
|
|
10824
10835
|
className,
|
|
10825
10836
|
options,
|
|
10826
10837
|
value,
|
|
10827
10838
|
disabled,
|
|
10828
|
-
placeholder: placeholder2
|
|
10839
|
+
placeholder: placeholder2,
|
|
10829
10840
|
fieldNames,
|
|
10830
10841
|
showClear = false,
|
|
10831
10842
|
onSelect,
|
|
10832
10843
|
onFocus,
|
|
10833
10844
|
onBlur,
|
|
10834
|
-
|
|
10845
|
+
disabledOption,
|
|
10846
|
+
emptyContent,
|
|
10847
|
+
filterOption,
|
|
10848
|
+
height,
|
|
10849
|
+
labelRender,
|
|
10850
|
+
notFoundContent,
|
|
10851
|
+
searchPlaceholder,
|
|
10852
|
+
showSearch,
|
|
10853
|
+
...props
|
|
10835
10854
|
}, ref) => {
|
|
10836
10855
|
const { getValueField } = useFieldNames_default({ fieldNames });
|
|
10837
10856
|
const [open, setOpen] = React4.useState(false);
|
|
@@ -10869,12 +10888,14 @@ var ComboboxInner = ({
|
|
|
10869
10888
|
"button",
|
|
10870
10889
|
{
|
|
10871
10890
|
ref,
|
|
10891
|
+
name,
|
|
10872
10892
|
type: "button",
|
|
10873
10893
|
role: "combobox",
|
|
10874
10894
|
"aria-expanded": open,
|
|
10875
10895
|
className: cn(
|
|
10876
10896
|
"flex w-full items-center justify-between gap-2 rounded-md border bg-white px-3 h-9 text-sm whitespace-nowrap shadow-xs outline-none border-input",
|
|
10877
10897
|
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive disabled:cursor-not-allowed disabled:opacity-50",
|
|
10898
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
10878
10899
|
"transition-all",
|
|
10879
10900
|
className
|
|
10880
10901
|
),
|
|
@@ -10882,6 +10903,8 @@ var ComboboxInner = ({
|
|
|
10882
10903
|
disabled,
|
|
10883
10904
|
onFocus,
|
|
10884
10905
|
onBlur,
|
|
10906
|
+
"data-testid": `combobox-trigger-${name}`,
|
|
10907
|
+
...props,
|
|
10885
10908
|
children: [
|
|
10886
10909
|
/* @__PURE__ */ jsx(
|
|
10887
10910
|
truncated_default,
|
|
@@ -10901,6 +10924,7 @@ var ComboboxInner = ({
|
|
|
10901
10924
|
"inline-flex items-center justify-center p-0 cursor-pointer transition-all size-[15px]"
|
|
10902
10925
|
),
|
|
10903
10926
|
onClick: handleClear,
|
|
10927
|
+
"data-testid": `combobox-clear-button-${name}`,
|
|
10904
10928
|
children: /* @__PURE__ */ jsx(X, { className: "size-[15px] bg-black text-white border border-black hover:bg-[#333] rounded-full" })
|
|
10905
10929
|
}
|
|
10906
10930
|
)
|
|
@@ -10917,10 +10941,18 @@ var ComboboxInner = ({
|
|
|
10917
10941
|
children: /* @__PURE__ */ jsx(
|
|
10918
10942
|
VirtualizedCommand_default,
|
|
10919
10943
|
{
|
|
10920
|
-
|
|
10944
|
+
name: dropdownName,
|
|
10945
|
+
emptyContent,
|
|
10946
|
+
height,
|
|
10947
|
+
notFoundContent,
|
|
10948
|
+
searchPlaceholder,
|
|
10949
|
+
showSearch,
|
|
10921
10950
|
fieldNames,
|
|
10922
10951
|
options,
|
|
10923
10952
|
value: selectedValue,
|
|
10953
|
+
disabledOption,
|
|
10954
|
+
filterOption,
|
|
10955
|
+
labelRender,
|
|
10924
10956
|
onSelect: handleSelect
|
|
10925
10957
|
}
|
|
10926
10958
|
)
|