infinity-ui-elements 1.8.3 → 1.8.5
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/components/Dropdown/DropdownMenu.d.ts +3 -2
- package/dist/components/Dropdown/DropdownMenu.d.ts.map +1 -1
- package/dist/components/FormFooter/FormFooter.d.ts.map +1 -1
- package/dist/components/FormHeader/FormHeader.d.ts.map +1 -1
- package/dist/components/SearchableDropdown/SearchableDropdown.d.ts +4 -1
- package/dist/components/SearchableDropdown/SearchableDropdown.d.ts.map +1 -1
- package/dist/components/SearchableDropdown/SearchableDropdown.stories.d.ts +6 -0
- package/dist/components/SearchableDropdown/SearchableDropdown.stories.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts +6 -2
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +76 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +76 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1393,17 +1393,17 @@ const FormFooter = React__namespace.forwardRef(({ helperText, trailingText, vali
|
|
|
1393
1393
|
// Size-based configurations
|
|
1394
1394
|
const sizeConfig = {
|
|
1395
1395
|
small: {
|
|
1396
|
-
|
|
1396
|
+
textClassName: "text-caption-small-regular",
|
|
1397
1397
|
iconSize: 12,
|
|
1398
1398
|
gap: "gap-1",
|
|
1399
1399
|
},
|
|
1400
1400
|
medium: {
|
|
1401
|
-
|
|
1401
|
+
textClassName: "text-caption-medium-regular",
|
|
1402
1402
|
iconSize: 14,
|
|
1403
1403
|
gap: "gap-1",
|
|
1404
1404
|
},
|
|
1405
1405
|
large: {
|
|
1406
|
-
|
|
1406
|
+
textClassName: "text-caption-large-regular",
|
|
1407
1407
|
iconSize: 16,
|
|
1408
1408
|
gap: "gap-1.5",
|
|
1409
1409
|
},
|
|
@@ -1412,20 +1412,22 @@ const FormFooter = React__namespace.forwardRef(({ helperText, trailingText, vali
|
|
|
1412
1412
|
// Determine text color based on validation state and disabled state
|
|
1413
1413
|
const getTextColor = () => {
|
|
1414
1414
|
if (isDisabled)
|
|
1415
|
-
return "disabled";
|
|
1415
|
+
return "text-surface-ink-neutral-disabled";
|
|
1416
1416
|
if (validationState === "positive")
|
|
1417
|
-
return "positive";
|
|
1417
|
+
return "text-feedback-ink-positive-intense";
|
|
1418
1418
|
if (validationState === "negative")
|
|
1419
|
-
return "negative";
|
|
1419
|
+
return "text-feedback-ink-negative-subtle";
|
|
1420
1420
|
if (validationState === "default")
|
|
1421
|
-
return "
|
|
1422
|
-
return "
|
|
1421
|
+
return "text-surface-ink-neutral-subtle";
|
|
1422
|
+
return "text-surface-ink-neutral-subtle";
|
|
1423
1423
|
};
|
|
1424
|
+
const helperTextColorClass = getTextColor();
|
|
1425
|
+
const trailingTextColorClass = getTextColor();
|
|
1424
1426
|
// Don't render anything if there's no content
|
|
1425
1427
|
if (!helperText && !trailingText) {
|
|
1426
1428
|
return null;
|
|
1427
1429
|
}
|
|
1428
|
-
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("flex items-center justify-between px-1", config.gap, className), children: [helperText && (jsxRuntime.jsxs("div", { className: cn("flex items-center", config.gap), children: [validationState === "positive" && (jsxRuntime.jsx("svg", { width: config.iconSize, height: config.iconSize, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-feedback-ink-positive-intense shrink-0", children: jsxRuntime.jsx("path", { d: "M3 7L6 10L11 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })), validationState === "negative" && (jsxRuntime.jsxs("svg", { width: config.iconSize, height: config.iconSize, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-feedback-ink-negative-subtle shrink-0", children: [jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "6", stroke: "currentColor", strokeWidth: "1" }), jsxRuntime.jsx("path", { d: "M7 4V7.5M7 10V9.5", stroke: "currentColor", strokeWidth: "1", strokeLinecap: "round" })] })), jsxRuntime.jsx(
|
|
1430
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("flex items-center justify-between px-1", config.gap, className), children: [helperText && (jsxRuntime.jsxs("div", { className: cn("flex items-center", config.gap), children: [validationState === "positive" && (jsxRuntime.jsx("svg", { width: config.iconSize, height: config.iconSize, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-feedback-ink-positive-intense shrink-0", children: jsxRuntime.jsx("path", { d: "M3 7L6 10L11 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })), validationState === "negative" && (jsxRuntime.jsxs("svg", { width: config.iconSize, height: config.iconSize, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "text-feedback-ink-negative-subtle shrink-0", children: [jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "6", stroke: "currentColor", strokeWidth: "1" }), jsxRuntime.jsx("path", { d: "M7 4V7.5M7 10V9.5", stroke: "currentColor", strokeWidth: "1", strokeLinecap: "round" })] })), jsxRuntime.jsx("span", { className: cn(config.textClassName, helperTextColorClass, "italic font-size-100 leading-100", helperTextClassName), children: helperText })] })), trailingText && (jsxRuntime.jsx("span", { className: cn(config.textClassName, trailingTextColorClass, "font-size-100 leading-100 shrink-0", trailingTextClassName), children: trailingText }))] }));
|
|
1429
1431
|
});
|
|
1430
1432
|
FormFooter.displayName = "FormFooter";
|
|
1431
1433
|
|
|
@@ -1563,7 +1565,7 @@ const Checkbox = React__namespace.forwardRef(({ label, errorText, size = "medium
|
|
|
1563
1565
|
},
|
|
1564
1566
|
medium: {
|
|
1565
1567
|
gap: "gap-2.5",
|
|
1566
|
-
labelSize: "text-body-
|
|
1568
|
+
labelSize: "text-body-small-regular",
|
|
1567
1569
|
iconSize: 12,
|
|
1568
1570
|
},
|
|
1569
1571
|
large: {
|
|
@@ -1889,10 +1891,10 @@ const DropdownMenu = React__namespace.forwardRef(({ items = [], customContent, s
|
|
|
1889
1891
|
if (isEmpty || items.length === 0) {
|
|
1890
1892
|
return (jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center py-8 px-6 text-center", children: [emptyIcon || (jsxRuntime.jsx(lucideReact.Search, { className: "w-12 h-12 text-surface-ink-neutral-muted mb-4" })), jsxRuntime.jsx(Text, { as: "h3", variant: "body", size: "small", weight: "semibold", className: "text-surface-ink-neutral-normal mb-2", children: emptyTitle }), jsxRuntime.jsx(Text, { as: "p", variant: "body", size: "small", weight: "regular", className: "text-surface-ink-neutral-muted mb-3", children: emptyDescription }), emptyLinkText && (jsxRuntime.jsx(Link, { type: "anchor", color: "primary", size: "small", onClick: onEmptyLinkClick, children: emptyLinkText }))] }));
|
|
1891
1893
|
}
|
|
1892
|
-
return (jsxRuntime.jsxs("div", { className: "py-3 px-3 max-h-[400px] overflow-y-auto", children: [sectionHeading && (jsxRuntime.jsx(Text, { as: "div", variant: "body", size: "small", weight: "medium", className: "text-surface-ink-neutral-muted px-3 py-2 mb-1", children: sectionHeading })), jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: items.map((item, index) => (jsxRuntime.jsx(ListItem, { title: item.
|
|
1894
|
+
return (jsxRuntime.jsxs("div", { className: "py-3 px-3 max-h-[400px] overflow-y-auto", children: [sectionHeading && (jsxRuntime.jsx(Text, { as: "div", variant: "body", size: "small", weight: "medium", className: "text-surface-ink-neutral-muted px-3 py-2 mb-1", children: sectionHeading })), jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: items.map((item, index) => (jsxRuntime.jsx(ListItem, { title: item.label, description: item.description, leadingIcon: item.leadingIcon, trailingIcon: item.trailingIcon, showChevron: showChevron, isDisabled: item.isDisabled, isSelected: index === focusedIndex, variant: item.variant, onClick: () => {
|
|
1893
1895
|
item.onClick?.();
|
|
1894
1896
|
onClose?.();
|
|
1895
|
-
}, containerClassName: cn(index === focusedIndex && "bg-action-fill-primary-faded") }, item.
|
|
1897
|
+
}, containerClassName: cn(index === focusedIndex && "bg-action-fill-primary-faded") }, item.value))) })] }));
|
|
1896
1898
|
};
|
|
1897
1899
|
const widthClass = width === "full" ? "w-full" : width === "auto" ? "w-auto" : "";
|
|
1898
1900
|
const footerVisible = showFooter ?? !disableFooter;
|
|
@@ -2202,23 +2204,26 @@ const FormHeader = React__namespace.forwardRef(({ label, size = "medium", isOpti
|
|
|
2202
2204
|
// Size-based configurations
|
|
2203
2205
|
const sizeConfig = {
|
|
2204
2206
|
small: {
|
|
2205
|
-
|
|
2207
|
+
textClassName: "text-body-xsmall-semibold",
|
|
2208
|
+
textClassNameRegular: "text-caption-small-regular",
|
|
2206
2209
|
iconSize: 12,
|
|
2207
2210
|
gap: "gap-1.5",
|
|
2208
2211
|
},
|
|
2209
2212
|
medium: {
|
|
2210
|
-
|
|
2213
|
+
textClassName: "text-body-small-semibold",
|
|
2214
|
+
textClassNameRegular: "text-caption-medium-regular",
|
|
2211
2215
|
iconSize: 14,
|
|
2212
2216
|
gap: "gap-2",
|
|
2213
2217
|
},
|
|
2214
2218
|
large: {
|
|
2215
|
-
|
|
2219
|
+
textClassName: "text-body-medium-semibold",
|
|
2220
|
+
textClassNameRegular: "text-caption-large-regular",
|
|
2216
2221
|
iconSize: 16,
|
|
2217
2222
|
gap: "gap-2.5",
|
|
2218
2223
|
},
|
|
2219
2224
|
};
|
|
2220
2225
|
const config = sizeConfig[size];
|
|
2221
|
-
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("flex items-center justify-between px-1", config.gap, className), children: [jsxRuntime.jsxs("div", { className: cn("flex items-center", config.gap), children: [jsxRuntime.jsxs("label", { htmlFor: htmlFor, className: cn("flex items-center", labelClassName), children: [jsxRuntime.jsx(
|
|
2226
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("flex items-center justify-between px-1", config.gap, className), children: [jsxRuntime.jsxs("div", { className: cn("flex items-center", config.gap), children: [jsxRuntime.jsxs("label", { htmlFor: htmlFor, className: cn("flex items-center", labelClassName), children: [jsxRuntime.jsx("span", { className: cn(config.textClassName, "text-surface-neutral-subtle"), children: label }), isRequired && (jsxRuntime.jsx("span", { className: cn(config.textClassName, "text-color-negative ml-0.5"), children: "*" })), isOptional && (jsxRuntime.jsx("span", { className: cn(config.textClassNameRegular, "text-surface-neutral-muted italic ml-1"), children: "(optional)" }))] }), infoDescription && (jsxRuntime.jsx(Tooltip, { description: infoDescription, heading: infoHeading, children: jsxRuntime.jsx(Icon, { name: "info", size: config.iconSize }) }))] }), linkText && (jsxRuntime.jsx(Link, { href: linkHref, onClick: onLinkClick, type: "action", color: "primary", size: size === "large" ? "small" : "xsmall", children: linkText }))] }));
|
|
2222
2227
|
});
|
|
2223
2228
|
FormHeader.displayName = "FormHeader";
|
|
2224
2229
|
|
|
@@ -2270,7 +2275,7 @@ const Modal = React__namespace.forwardRef(({ isOpen, onClose, title, description
|
|
|
2270
2275
|
});
|
|
2271
2276
|
Modal.displayName = "Modal";
|
|
2272
2277
|
|
|
2273
|
-
const selectVariants = classVarianceAuthority.cva("relative flex items-center gap-2 border rounded-
|
|
2278
|
+
const selectVariants = classVarianceAuthority.cva("relative flex items-center gap-2 border rounded-large transition-all font-display font-size-100 leading-100", {
|
|
2274
2279
|
variants: {
|
|
2275
2280
|
size: {
|
|
2276
2281
|
small: "h-[28px] px-3 text-xs gap-2",
|
|
@@ -2463,7 +2468,13 @@ const Select = React__namespace.forwardRef(({ className, options = [], value: co
|
|
|
2463
2468
|
}, [isOpen, value, options, isDisabled, isLoading]);
|
|
2464
2469
|
// Transform options to dropdown menu items
|
|
2465
2470
|
const menuItems = options.map((option) => ({
|
|
2466
|
-
|
|
2471
|
+
value: option.value,
|
|
2472
|
+
label: option.label ?? String(option.value),
|
|
2473
|
+
description: option.description,
|
|
2474
|
+
leadingIcon: option.leadingIcon,
|
|
2475
|
+
trailingIcon: option.trailingIcon,
|
|
2476
|
+
isDisabled: option.isDisabled,
|
|
2477
|
+
variant: option.variant,
|
|
2467
2478
|
onClick: () => handleSelect(option),
|
|
2468
2479
|
}));
|
|
2469
2480
|
const widthStyle = menuWidth === "full" ? "100%" : menuWidth === "auto" ? "auto" : menuWidth;
|
|
@@ -2488,9 +2499,7 @@ const Select = React__namespace.forwardRef(({ className, options = [], value: co
|
|
|
2488
2499
|
? "text-feedback-ink-positive-intense"
|
|
2489
2500
|
: currentValidationState === "negative"
|
|
2490
2501
|
? "text-feedback-ink-negative-subtle"
|
|
2491
|
-
: "text-surface-ink-neutral-muted"), children: prefix })), jsxRuntime.jsx("span", { className: cn("flex-1 text-left truncate", !selectedOption && "text-surface-ink-neutral-muted", isDisabled && "text-surface-ink-neutral-disabled"), children: isLoading
|
|
2492
|
-
? "Loading..."
|
|
2493
|
-
: selectedOption?.label || selectedOption?.title || placeholder }), showClearButton && hasValue && !isDisabled && !isLoading && (jsxRuntime.jsx("button", { type: "button", onClick: handleClear, className: "shrink-0 flex items-center justify-center text-surface-ink-neutral-muted hover:text-surface-ink-neutral-normal transition-colors", tabIndex: -1, children: jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }) })), suffix && !showClearButton && (jsxRuntime.jsx("span", { className: cn("shrink-0 flex items-center", isDisabled
|
|
2502
|
+
: "text-surface-ink-neutral-muted"), children: prefix })), jsxRuntime.jsx("span", { className: cn("flex-1 text-left truncate", !selectedOption && "text-surface-ink-neutral-muted", isDisabled && "text-surface-ink-neutral-disabled"), children: isLoading ? "Loading..." : selectedOption?.label || placeholder }), showClearButton && hasValue && !isDisabled && !isLoading && (jsxRuntime.jsx("button", { type: "button", onClick: handleClear, className: "shrink-0 flex items-center justify-center text-surface-ink-neutral-muted hover:text-surface-ink-neutral-normal transition-colors", tabIndex: -1, children: jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }) })), suffix && !showClearButton && (jsxRuntime.jsx("span", { className: cn("shrink-0 flex items-center", isDisabled
|
|
2494
2503
|
? "text-surface-ink-neutral-disabled"
|
|
2495
2504
|
: currentValidationState === "positive"
|
|
2496
2505
|
? "text-feedback-ink-positive-intense"
|
|
@@ -2906,10 +2915,10 @@ TextField.displayName = "TextField";
|
|
|
2906
2915
|
|
|
2907
2916
|
const defaultFilter = (item, query) => {
|
|
2908
2917
|
const searchQuery = query.toLowerCase();
|
|
2909
|
-
return (item.
|
|
2918
|
+
return (item.label.toLowerCase().includes(searchQuery) ||
|
|
2910
2919
|
(item.description?.toLowerCase().includes(searchQuery) ?? false));
|
|
2911
2920
|
};
|
|
2912
|
-
const SearchableDropdown = React__namespace.forwardRef(({ className, items = [], sectionHeading, isLoading = false, emptyTitle = "No Search Results Found", emptyDescription = "Add description of what the user can search for here.", emptyLinkText = "Link to support site", onEmptyLinkClick, primaryButtonText
|
|
2921
|
+
const SearchableDropdown = React__namespace.forwardRef(({ className, items = [], sectionHeading, isLoading = false, emptyTitle = "No Search Results Found", emptyDescription = "Add description of what the user can search for here.", emptyLinkText = "Link to support site", onEmptyLinkClick, primaryButtonText, secondaryButtonText, onPrimaryClick, onSecondaryClick, dropdownWidth = "full", showChevron = false, emptyIcon, disableFooter = false, footerLayout = "horizontal", onSearchChange, onItemSelect, filterFunction = defaultFilter, searchValue: controlledSearchValue, defaultSearchValue = "", dropdownClassName, minSearchLength = 0, showOnFocus = true, showAddNew = false, containerClassName, ...textFieldProps }, ref) => {
|
|
2913
2922
|
const [uncontrolledSearchValue, setUncontrolledSearchValue] = React__namespace.useState(defaultSearchValue);
|
|
2914
2923
|
const [isOpen, setIsOpen] = React__namespace.useState(false);
|
|
2915
2924
|
const [focusedIndex, setFocusedIndex] = React__namespace.useState(-1);
|
|
@@ -2958,7 +2967,7 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
2958
2967
|
const handleItemSelect = (item) => {
|
|
2959
2968
|
onItemSelect?.(item);
|
|
2960
2969
|
if (controlledSearchValue === undefined) {
|
|
2961
|
-
setUncontrolledSearchValue(item.
|
|
2970
|
+
setUncontrolledSearchValue(item.label);
|
|
2962
2971
|
}
|
|
2963
2972
|
setIsOpen(false);
|
|
2964
2973
|
inputRef.current?.focus();
|
|
@@ -2969,6 +2978,40 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
2969
2978
|
return items;
|
|
2970
2979
|
return items.filter((item) => filterFunction(item, searchValue));
|
|
2971
2980
|
}, [items, searchValue, filterFunction]);
|
|
2981
|
+
// Add "Add New" option if showAddNew is true and no items match
|
|
2982
|
+
const itemsWithAddNew = React__namespace.useMemo(() => {
|
|
2983
|
+
if (!showAddNew || !searchValue || filteredItems.length > 0) {
|
|
2984
|
+
return filteredItems;
|
|
2985
|
+
}
|
|
2986
|
+
const addNewItem = {
|
|
2987
|
+
value: searchValue,
|
|
2988
|
+
label: `+ Add ${searchValue}`,
|
|
2989
|
+
variant: "primary",
|
|
2990
|
+
onClick: () => {
|
|
2991
|
+
const newItem = {
|
|
2992
|
+
value: searchValue,
|
|
2993
|
+
label: searchValue,
|
|
2994
|
+
};
|
|
2995
|
+
onItemSelect?.(newItem);
|
|
2996
|
+
if (controlledSearchValue === undefined) {
|
|
2997
|
+
setUncontrolledSearchValue(searchValue);
|
|
2998
|
+
}
|
|
2999
|
+
setIsOpen(false);
|
|
3000
|
+
inputRef.current?.focus();
|
|
3001
|
+
},
|
|
3002
|
+
};
|
|
3003
|
+
return [addNewItem];
|
|
3004
|
+
}, [
|
|
3005
|
+
showAddNew,
|
|
3006
|
+
searchValue,
|
|
3007
|
+
filteredItems,
|
|
3008
|
+
onItemSelect,
|
|
3009
|
+
controlledSearchValue,
|
|
3010
|
+
]);
|
|
3011
|
+
// Reset focused index when items change
|
|
3012
|
+
React__namespace.useEffect(() => {
|
|
3013
|
+
setFocusedIndex(-1);
|
|
3014
|
+
}, [itemsWithAddNew.length]);
|
|
2972
3015
|
// Close dropdown when clicking outside
|
|
2973
3016
|
React__namespace.useEffect(() => {
|
|
2974
3017
|
const handleClickOutside = (event) => {
|
|
@@ -2998,7 +3041,7 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
2998
3041
|
switch (e.key) {
|
|
2999
3042
|
case "ArrowDown":
|
|
3000
3043
|
e.preventDefault();
|
|
3001
|
-
setFocusedIndex((prev) => prev <
|
|
3044
|
+
setFocusedIndex((prev) => prev < itemsWithAddNew.length - 1 ? prev + 1 : prev);
|
|
3002
3045
|
break;
|
|
3003
3046
|
case "ArrowUp":
|
|
3004
3047
|
e.preventDefault();
|
|
@@ -3006,8 +3049,8 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
3006
3049
|
break;
|
|
3007
3050
|
case "Enter":
|
|
3008
3051
|
e.preventDefault();
|
|
3009
|
-
if (focusedIndex >= 0 &&
|
|
3010
|
-
handleItemSelect(
|
|
3052
|
+
if (focusedIndex >= 0 && itemsWithAddNew[focusedIndex]) {
|
|
3053
|
+
handleItemSelect(itemsWithAddNew[focusedIndex]);
|
|
3011
3054
|
}
|
|
3012
3055
|
break;
|
|
3013
3056
|
case "Escape":
|
|
@@ -3018,9 +3061,10 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
3018
3061
|
}
|
|
3019
3062
|
};
|
|
3020
3063
|
// Update items with onClick handlers that call handleItemSelect
|
|
3021
|
-
|
|
3064
|
+
// Only add onClick if it doesn't already exist (for Add New items)
|
|
3065
|
+
const itemsWithHandlers = itemsWithAddNew.map((item) => ({
|
|
3022
3066
|
...item,
|
|
3023
|
-
onClick: () => handleItemSelect(item),
|
|
3067
|
+
onClick: item.onClick || (() => handleItemSelect(item)),
|
|
3024
3068
|
}));
|
|
3025
3069
|
const showDropdown = isOpen && searchValue.length >= minSearchLength;
|
|
3026
3070
|
const dropdownMenu = showDropdown && (jsxRuntime.jsx("div", { ref: menuRef, style: {
|
|
@@ -3029,7 +3073,9 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
3029
3073
|
left: `${position.left}px`,
|
|
3030
3074
|
width: dropdownWidth === "full" ? `${position.width}px` : "auto",
|
|
3031
3075
|
zIndex: 9999,
|
|
3032
|
-
}, children: jsxRuntime.jsx(DropdownMenu, { items: itemsWithHandlers, sectionHeading: sectionHeading, isLoading: isLoading, isEmpty:
|
|
3076
|
+
}, children: jsxRuntime.jsx(DropdownMenu, { items: itemsWithHandlers, sectionHeading: sectionHeading, isLoading: isLoading, isEmpty: itemsWithAddNew.length === 0 && !showAddNew, emptyTitle: emptyTitle, emptyDescription: emptyDescription, emptyLinkText: emptyLinkText, onEmptyLinkClick: onEmptyLinkClick, primaryButtonText: primaryButtonText, secondaryButtonText: secondaryButtonText, onPrimaryClick: onPrimaryClick, onSecondaryClick: onSecondaryClick, showChevron: showChevron, emptyIcon: emptyIcon, disableFooter: disableFooter, showFooter: (primaryButtonText || secondaryButtonText) && !disableFooter
|
|
3077
|
+
? true
|
|
3078
|
+
: false, footerLayout: footerLayout, onClose: () => setIsOpen(false), focusedIndex: focusedIndex, className: dropdownClassName, width: dropdownWidth === "full" ? "full" : "auto" }) }));
|
|
3033
3079
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { ref: dropdownRef, className: cn("relative", containerClassName), children: jsxRuntime.jsx(TextField, { ref: inputRef, value: searchValue, onChange: handleSearchChange, onFocus: handleFocus, onKeyDown: handleKeyDown, containerClassName: "mb-0", ...textFieldProps }) }), typeof document !== "undefined" &&
|
|
3034
3080
|
dropdownMenu &&
|
|
3035
3081
|
reactDom.createPortal(dropdownMenu, document.body)] }));
|