@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.d.mts
CHANGED
|
@@ -1390,6 +1390,7 @@ type VirtualizedCommandFieldNames<TData extends OptionData> = {
|
|
|
1390
1390
|
value?: keyof TData;
|
|
1391
1391
|
};
|
|
1392
1392
|
type VirtualizedCommandProps<TData extends OptionData> = {
|
|
1393
|
+
name?: string;
|
|
1393
1394
|
options?: VirtualizedCommandOption<TData>[];
|
|
1394
1395
|
height?: number;
|
|
1395
1396
|
searchPlaceholder?: string;
|
|
@@ -1405,9 +1406,11 @@ type VirtualizedCommandProps<TData extends OptionData> = {
|
|
|
1405
1406
|
onBlur?: (event: React$1.FocusEvent<HTMLDivElement, Element>) => void;
|
|
1406
1407
|
onFocus?: (event: React$1.FocusEvent<HTMLDivElement, Element>) => void;
|
|
1407
1408
|
};
|
|
1408
|
-
declare const VirtualizedCommand: <TData extends OptionData>({ height, options, emptyContent, searchPlaceholder, value, notFoundContent, showSearch, fieldNames, disabledOption, filterOption, onSelect, labelRender, onBlur, onFocus }: VirtualizedCommandProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
1409
|
+
declare const VirtualizedCommand: <TData extends OptionData>({ name, height, options, emptyContent, searchPlaceholder, value, notFoundContent, showSearch, fieldNames, disabledOption, filterOption, onSelect, labelRender, onBlur, onFocus }: VirtualizedCommandProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
1409
1410
|
|
|
1410
|
-
type ComboboxProps<TData extends OptionData> = Omit<VirtualizedCommandProps<TData>, "onFocus" | "onBlur"> & {
|
|
1411
|
+
type ComboboxProps<TData extends OptionData> = React$1.AriaAttributes & Omit<VirtualizedCommandProps<TData>, "onFocus" | "onBlur"> & {
|
|
1412
|
+
name?: string;
|
|
1413
|
+
dropdownName?: string;
|
|
1411
1414
|
defaultValue?: string;
|
|
1412
1415
|
className?: string;
|
|
1413
1416
|
disabled?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1390,6 +1390,7 @@ type VirtualizedCommandFieldNames<TData extends OptionData> = {
|
|
|
1390
1390
|
value?: keyof TData;
|
|
1391
1391
|
};
|
|
1392
1392
|
type VirtualizedCommandProps<TData extends OptionData> = {
|
|
1393
|
+
name?: string;
|
|
1393
1394
|
options?: VirtualizedCommandOption<TData>[];
|
|
1394
1395
|
height?: number;
|
|
1395
1396
|
searchPlaceholder?: string;
|
|
@@ -1405,9 +1406,11 @@ type VirtualizedCommandProps<TData extends OptionData> = {
|
|
|
1405
1406
|
onBlur?: (event: React$1.FocusEvent<HTMLDivElement, Element>) => void;
|
|
1406
1407
|
onFocus?: (event: React$1.FocusEvent<HTMLDivElement, Element>) => void;
|
|
1407
1408
|
};
|
|
1408
|
-
declare const VirtualizedCommand: <TData extends OptionData>({ height, options, emptyContent, searchPlaceholder, value, notFoundContent, showSearch, fieldNames, disabledOption, filterOption, onSelect, labelRender, onBlur, onFocus }: VirtualizedCommandProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
1409
|
+
declare const VirtualizedCommand: <TData extends OptionData>({ name, height, options, emptyContent, searchPlaceholder, value, notFoundContent, showSearch, fieldNames, disabledOption, filterOption, onSelect, labelRender, onBlur, onFocus }: VirtualizedCommandProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
1409
1410
|
|
|
1410
|
-
type ComboboxProps<TData extends OptionData> = Omit<VirtualizedCommandProps<TData>, "onFocus" | "onBlur"> & {
|
|
1411
|
+
type ComboboxProps<TData extends OptionData> = React$1.AriaAttributes & Omit<VirtualizedCommandProps<TData>, "onFocus" | "onBlur"> & {
|
|
1412
|
+
name?: string;
|
|
1413
|
+
dropdownName?: string;
|
|
1411
1414
|
defaultValue?: string;
|
|
1412
1415
|
className?: string;
|
|
1413
1416
|
disabled?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -10684,6 +10684,7 @@ var useFieldNames_default = useFieldNames;
|
|
|
10684
10684
|
var ROW_HEIGHT = 32;
|
|
10685
10685
|
var MIN_HEIGHT_EMPTY = 76;
|
|
10686
10686
|
var VirtualizedCommand = ({
|
|
10687
|
+
name,
|
|
10687
10688
|
height = 292,
|
|
10688
10689
|
options,
|
|
10689
10690
|
emptyContent = "No data.",
|
|
@@ -10791,7 +10792,14 @@ var VirtualizedCommand = ({
|
|
|
10791
10792
|
}
|
|
10792
10793
|
}, [value, filteredOptions, virtualizer, getValueField]);
|
|
10793
10794
|
return /* @__PURE__ */ jsxRuntime.jsxs(Command, { shouldFilter: false, onKeyDown: handleKeyDown, onFocus, onBlur, children: [
|
|
10794
|
-
showSearch && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10795
|
+
showSearch && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10796
|
+
CommandInput,
|
|
10797
|
+
{
|
|
10798
|
+
onValueChange: handleSearch,
|
|
10799
|
+
placeholder: searchPlaceholder,
|
|
10800
|
+
"data-testid": `command-input-${name}`
|
|
10801
|
+
}
|
|
10802
|
+
),
|
|
10795
10803
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10796
10804
|
CommandList,
|
|
10797
10805
|
{
|
|
@@ -10805,7 +10813,7 @@ var VirtualizedCommand = ({
|
|
|
10805
10813
|
onMouseDown: () => setIsKeyboardNavActive(false),
|
|
10806
10814
|
onMouseMove: () => setIsKeyboardNavActive(false),
|
|
10807
10815
|
children: [
|
|
10808
|
-
/* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: internalOptions.length === 0 ? emptyContent : notFoundContent }),
|
|
10816
|
+
/* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { "data-testid": `command-item-empty-${name}`, children: internalOptions.length === 0 ? emptyContent : notFoundContent }),
|
|
10809
10817
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10810
10818
|
CommandGroup,
|
|
10811
10819
|
{
|
|
@@ -10814,7 +10822,7 @@ var VirtualizedCommand = ({
|
|
|
10814
10822
|
width: "100%",
|
|
10815
10823
|
position: "relative"
|
|
10816
10824
|
},
|
|
10817
|
-
children: virtualOptions.map((virtualOption) => {
|
|
10825
|
+
children: virtualOptions.map((virtualOption, index) => {
|
|
10818
10826
|
const option = filteredOptions[virtualOption.index];
|
|
10819
10827
|
const optionLabel = getLabelField(option);
|
|
10820
10828
|
const optionValue = getValueField(option);
|
|
@@ -10835,6 +10843,7 @@ var VirtualizedCommand = ({
|
|
|
10835
10843
|
onMouseLeave: () => !isKeyboardNavActive && setFocusedIndex(-1),
|
|
10836
10844
|
onSelect: (selectedValue) => onSelect?.(selectedValue, option),
|
|
10837
10845
|
disabled: disabledOption?.(option),
|
|
10846
|
+
"data-testid": `command-item-${index}-${optionValue}`,
|
|
10838
10847
|
children: [
|
|
10839
10848
|
typeof labelRendered === "string" ? /* @__PURE__ */ jsxRuntime.jsx(truncated_default, { tooltipProps: { disabled: true }, children: labelRendered }) : labelRendered,
|
|
10840
10849
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10860,18 +10869,28 @@ var VirtualizedCommand = ({
|
|
|
10860
10869
|
};
|
|
10861
10870
|
var VirtualizedCommand_default = VirtualizedCommand;
|
|
10862
10871
|
var ComboboxInner = ({
|
|
10872
|
+
name,
|
|
10873
|
+
dropdownName,
|
|
10863
10874
|
defaultValue,
|
|
10864
10875
|
className,
|
|
10865
10876
|
options,
|
|
10866
10877
|
value,
|
|
10867
10878
|
disabled,
|
|
10868
|
-
placeholder: placeholder2
|
|
10879
|
+
placeholder: placeholder2,
|
|
10869
10880
|
fieldNames,
|
|
10870
10881
|
showClear = false,
|
|
10871
10882
|
onSelect,
|
|
10872
10883
|
onFocus,
|
|
10873
10884
|
onBlur,
|
|
10874
|
-
|
|
10885
|
+
disabledOption,
|
|
10886
|
+
emptyContent,
|
|
10887
|
+
filterOption,
|
|
10888
|
+
height,
|
|
10889
|
+
labelRender,
|
|
10890
|
+
notFoundContent,
|
|
10891
|
+
searchPlaceholder,
|
|
10892
|
+
showSearch,
|
|
10893
|
+
...props
|
|
10875
10894
|
}, ref) => {
|
|
10876
10895
|
const { getValueField } = useFieldNames_default({ fieldNames });
|
|
10877
10896
|
const [open, setOpen] = React4__namespace.useState(false);
|
|
@@ -10909,12 +10928,14 @@ var ComboboxInner = ({
|
|
|
10909
10928
|
"button",
|
|
10910
10929
|
{
|
|
10911
10930
|
ref,
|
|
10931
|
+
name,
|
|
10912
10932
|
type: "button",
|
|
10913
10933
|
role: "combobox",
|
|
10914
10934
|
"aria-expanded": open,
|
|
10915
10935
|
className: cn(
|
|
10916
10936
|
"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",
|
|
10917
10937
|
"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",
|
|
10938
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
10918
10939
|
"transition-all",
|
|
10919
10940
|
className
|
|
10920
10941
|
),
|
|
@@ -10922,6 +10943,8 @@ var ComboboxInner = ({
|
|
|
10922
10943
|
disabled,
|
|
10923
10944
|
onFocus,
|
|
10924
10945
|
onBlur,
|
|
10946
|
+
"data-testid": `combobox-trigger-${name}`,
|
|
10947
|
+
...props,
|
|
10925
10948
|
children: [
|
|
10926
10949
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10927
10950
|
truncated_default,
|
|
@@ -10941,6 +10964,7 @@ var ComboboxInner = ({
|
|
|
10941
10964
|
"inline-flex items-center justify-center p-0 cursor-pointer transition-all size-[15px]"
|
|
10942
10965
|
),
|
|
10943
10966
|
onClick: handleClear,
|
|
10967
|
+
"data-testid": `combobox-clear-button-${name}`,
|
|
10944
10968
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-[15px] bg-black text-white border border-black hover:bg-[#333] rounded-full" })
|
|
10945
10969
|
}
|
|
10946
10970
|
)
|
|
@@ -10957,10 +10981,18 @@ var ComboboxInner = ({
|
|
|
10957
10981
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10958
10982
|
VirtualizedCommand_default,
|
|
10959
10983
|
{
|
|
10960
|
-
|
|
10984
|
+
name: dropdownName,
|
|
10985
|
+
emptyContent,
|
|
10986
|
+
height,
|
|
10987
|
+
notFoundContent,
|
|
10988
|
+
searchPlaceholder,
|
|
10989
|
+
showSearch,
|
|
10961
10990
|
fieldNames,
|
|
10962
10991
|
options,
|
|
10963
10992
|
value: selectedValue,
|
|
10993
|
+
disabledOption,
|
|
10994
|
+
filterOption,
|
|
10995
|
+
labelRender,
|
|
10964
10996
|
onSelect: handleSelect
|
|
10965
10997
|
}
|
|
10966
10998
|
)
|