infinity-ui-elements 1.8.15 → 1.8.17
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/SearchableDropdown/SearchableDropdown.d.ts +6 -0
- package/dist/components/SearchableDropdown/SearchableDropdown.d.ts.map +1 -1
- package/dist/components/SearchableDropdown/SearchableDropdown.stories.d.ts +1 -0
- package/dist/components/SearchableDropdown/SearchableDropdown.stories.d.ts.map +1 -1
- package/dist/components/Table/Table.d.ts +1 -0
- package/dist/components/Table/Table.d.ts.map +1 -1
- package/dist/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/components/Table/TableBody.d.ts +1 -1
- package/dist/components/Table/TableBody.d.ts.map +1 -1
- package/dist/components/Table/TableHeader.d.ts +1 -1
- package/dist/components/Table/TableHeader.d.ts.map +1 -1
- package/dist/components/Table/tableVariants.d.ts +3 -3
- package/dist/components/Table/tableVariants.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +27 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +27 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2019,7 +2019,7 @@ const FormHeader = React.forwardRef(({ label, size = "medium", isOptional = fals
|
|
|
2019
2019
|
});
|
|
2020
2020
|
FormHeader.displayName = "FormHeader";
|
|
2021
2021
|
|
|
2022
|
-
const datePickerVariants = cva("relative flex items-center gap-2 border rounded-large transition-all font-
|
|
2022
|
+
const datePickerVariants = cva("relative flex items-center gap-2 border rounded-large transition-all font-functional font-size-100 leading-100", {
|
|
2023
2023
|
variants: {
|
|
2024
2024
|
size: {
|
|
2025
2025
|
small: "h-[28px] px-3 text-xs gap-2",
|
|
@@ -2558,7 +2558,7 @@ const Modal = React.forwardRef(({ isOpen, onClose, title, description, footer, c
|
|
|
2558
2558
|
});
|
|
2559
2559
|
Modal.displayName = "Modal";
|
|
2560
2560
|
|
|
2561
|
-
const selectVariants = cva("relative flex items-center gap-2 border rounded-large transition-all font-
|
|
2561
|
+
const selectVariants = cva("relative flex items-center gap-2 border rounded-large transition-all font-functional font-size-100 leading-100", {
|
|
2562
2562
|
variants: {
|
|
2563
2563
|
size: {
|
|
2564
2564
|
small: "h-[28px] px-3 text-xs gap-2",
|
|
@@ -3201,7 +3201,7 @@ const defaultFilter = (item, query) => {
|
|
|
3201
3201
|
return (item.label.toLowerCase().includes(searchQuery) ||
|
|
3202
3202
|
(item.description?.toLowerCase().includes(searchQuery) ?? false));
|
|
3203
3203
|
};
|
|
3204
|
-
const SearchableDropdown = React.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, onAddNew, containerClassName, ...textFieldProps }, ref) => {
|
|
3204
|
+
const SearchableDropdown = React.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, showAddNewIfDoesNotMatch = true, onAddNew, containerClassName, ...textFieldProps }, ref) => {
|
|
3205
3205
|
const [uncontrolledSearchValue, setUncontrolledSearchValue] = React.useState(defaultSearchValue);
|
|
3206
3206
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
3207
3207
|
const [focusedIndex, setFocusedIndex] = React.useState(-1);
|
|
@@ -3261,9 +3261,9 @@ const SearchableDropdown = React.forwardRef(({ className, items = [], sectionHea
|
|
|
3261
3261
|
return items;
|
|
3262
3262
|
return items.filter((item) => filterFunction(item, searchValue));
|
|
3263
3263
|
}, [items, searchValue, filterFunction]);
|
|
3264
|
-
// Add "Add New" option
|
|
3264
|
+
// Add "Add New" option based on showAddNew and showAddNewIfDoesNotMatch props
|
|
3265
3265
|
const itemsWithAddNew = React.useMemo(() => {
|
|
3266
|
-
if (!showAddNew || !searchValue
|
|
3266
|
+
if (!showAddNew || !searchValue) {
|
|
3267
3267
|
return filteredItems;
|
|
3268
3268
|
}
|
|
3269
3269
|
const addNewItem = {
|
|
@@ -3288,9 +3288,21 @@ const SearchableDropdown = React.forwardRef(({ className, items = [], sectionHea
|
|
|
3288
3288
|
inputRef.current?.focus();
|
|
3289
3289
|
},
|
|
3290
3290
|
};
|
|
3291
|
-
|
|
3291
|
+
// If showAddNewIfDoesNotMatch is true, only show "Add New" when no items match
|
|
3292
|
+
// If false, always show "Add New" at the top
|
|
3293
|
+
if (showAddNewIfDoesNotMatch) {
|
|
3294
|
+
if (filteredItems.length > 0) {
|
|
3295
|
+
return filteredItems;
|
|
3296
|
+
}
|
|
3297
|
+
return [addNewItem];
|
|
3298
|
+
}
|
|
3299
|
+
else {
|
|
3300
|
+
// Always show "Add New" at the top
|
|
3301
|
+
return [addNewItem, ...filteredItems];
|
|
3302
|
+
}
|
|
3292
3303
|
}, [
|
|
3293
3304
|
showAddNew,
|
|
3305
|
+
showAddNewIfDoesNotMatch,
|
|
3294
3306
|
searchValue,
|
|
3295
3307
|
filteredItems,
|
|
3296
3308
|
onItemSelect,
|
|
@@ -3429,7 +3441,7 @@ const Skeleton = React.forwardRef(({ className, containerClassName, containerSty
|
|
|
3429
3441
|
});
|
|
3430
3442
|
Skeleton.displayName = "Skeleton";
|
|
3431
3443
|
|
|
3432
|
-
const selectTriggerVariants = cva("flex items-center gap-1 transition-all font-
|
|
3444
|
+
const selectTriggerVariants = cva("flex items-center gap-1 transition-all font-functional font-size-100 leading-100", {
|
|
3433
3445
|
variants: {
|
|
3434
3446
|
size: {
|
|
3435
3447
|
small: "px-2 text-xs",
|
|
@@ -3782,6 +3794,7 @@ const tableVariants = cva("w-full border-collapse", {
|
|
|
3782
3794
|
small: "text-body-small-medium",
|
|
3783
3795
|
medium: "text-body-medium-medium",
|
|
3784
3796
|
large: "text-body-large-medium",
|
|
3797
|
+
auto: "text-body-medium-medium",
|
|
3785
3798
|
},
|
|
3786
3799
|
},
|
|
3787
3800
|
defaultVariants: {
|
|
@@ -3795,6 +3808,7 @@ const tableHeaderVariants = cva("text-body-medium-regular text-left text-surface
|
|
|
3795
3808
|
small: "px-3 py-2 h-[32px]",
|
|
3796
3809
|
medium: "px-4 py-3 h-[40px]",
|
|
3797
3810
|
large: "px-6 py-4 h-[48px]",
|
|
3811
|
+
auto: "px-4 py-3 h-[56px]",
|
|
3798
3812
|
},
|
|
3799
3813
|
},
|
|
3800
3814
|
defaultVariants: {
|
|
@@ -3807,6 +3821,7 @@ const tableCellVariants = cva("text-body-medium-regular border-b border-surface-
|
|
|
3807
3821
|
small: "px-3 py-2 h-[40px]",
|
|
3808
3822
|
medium: "px-4 py-3 h-[72px]",
|
|
3809
3823
|
large: "px-6 py-4 h-[56px]",
|
|
3824
|
+
auto: "px-4 py-3",
|
|
3810
3825
|
},
|
|
3811
3826
|
state: {
|
|
3812
3827
|
default: "",
|
|
@@ -3826,6 +3841,7 @@ function TableHeader({ headerGroups, enableRowSelection, enableSelectAll, showHe
|
|
|
3826
3841
|
small: 32,
|
|
3827
3842
|
medium: 40,
|
|
3828
3843
|
large: 48,
|
|
3844
|
+
auto: 56,
|
|
3829
3845
|
}[size] ?? 40;
|
|
3830
3846
|
return (jsx("thead", { className: cn(showHeaderBackground ? "bg-surface-fill-neutral-moderate" : "bg-white", stickyHeader && "sticky top-0 z-10"), children: headerGroups.map((headerGroup, groupIndex) => {
|
|
3831
3847
|
const stickyTop = stickyHeader ? groupIndex * headerHeight : undefined;
|
|
@@ -3927,6 +3943,7 @@ function TableComponent({ className, wrapperClassName, containerClassName, varia
|
|
|
3927
3943
|
small: 16,
|
|
3928
3944
|
medium: 20,
|
|
3929
3945
|
large: 24,
|
|
3946
|
+
auto: "auto",
|
|
3930
3947
|
};
|
|
3931
3948
|
const skeletonCellHeight = normalizeSizeValue(loadingSkeletonHeight ?? skeletonHeightMap[sizeKey]);
|
|
3932
3949
|
const selectionSkeletonSize = sizeKey === "small" ? 14 : sizeKey === "large" ? 20 : 16;
|
|
@@ -3975,7 +3992,7 @@ function TableComponent({ className, wrapperClassName, containerClassName, varia
|
|
|
3975
3992
|
return renderDefaultEmptyState({ colSpan: table.getAllColumns().length });
|
|
3976
3993
|
};
|
|
3977
3994
|
// ==================== Render ====================
|
|
3978
|
-
return (jsx("div", { ref: ref, className: cn("w-full", wrapperClassName), ...props, children: jsx("div", { className: cn("relative", enableHorizontalScroll ? "overflow-x-auto" : "overflow-x-hidden", maxHeight && "overflow-y-auto", containerClassName), style: containerStyle, children: jsxs("table", { className: cn(tableVariants({ variant, size }), className), children: [jsx(TableHeader, { headerGroups: headerGroups, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, showHeaderBackground: showHeaderBackground, stickyHeader: stickyHeader, size: size
|
|
3995
|
+
return (jsx("div", { ref: ref, className: cn("w-full", wrapperClassName), ...props, children: jsx("div", { className: cn("relative", enableHorizontalScroll ? "overflow-x-auto" : "overflow-x-hidden", maxHeight && "overflow-y-auto", containerClassName), style: containerStyle, children: jsxs("table", { className: cn(tableVariants({ variant, size }), className), children: [jsx(TableHeader, { headerGroups: headerGroups, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, showHeaderBackground: showHeaderBackground, stickyHeader: stickyHeader, size: size, headerClassName: headerClassName, onToggleAllRows: (e) => table.getToggleAllRowsSelectedHandler()(e), isAllRowsSelected: table.getIsAllRowsSelected(), isSomeRowsSelected: table.getIsSomeRowsSelected(), getColumnStyle: getColumnStyle }), resolvedLoading ? (jsx("tbody", { children: renderLoadingContent() })) : !hasData ? (jsx("tbody", { children: renderEmptyState() })) : (jsx(TableBody, { rows: table.getRowModel().rows, enableRowSelection: enableRowSelection, size: size || "medium", variant: variant || "default", showRowHover: showRowHover, cellClassName: cellClassName, onRowClick: onRowClick, getRowClassName: getRowClassName, handleRowClick: handleRowClickInternal, getColumnStyle: getColumnStyle }))] }) }) }));
|
|
3979
3996
|
}
|
|
3980
3997
|
// ==================== Export ====================
|
|
3981
3998
|
const Table = React.forwardRef(TableComponent);
|
|
@@ -4132,7 +4149,7 @@ const Tabs = React.forwardRef(({ tabs, selectedTabId, defaultSelectedTabId, onTa
|
|
|
4132
4149
|
});
|
|
4133
4150
|
Tabs.displayName = "Tabs";
|
|
4134
4151
|
|
|
4135
|
-
const textAreaVariants = cva("relative flex flex-col border rounded-large transition-all font-
|
|
4152
|
+
const textAreaVariants = cva("relative flex flex-col border rounded-large transition-all font-functional font-size-100 leading-100", {
|
|
4136
4153
|
variants: {
|
|
4137
4154
|
size: {
|
|
4138
4155
|
small: "p-3 min-h-[56px] text-xs gap-2",
|
|
@@ -4213,7 +4230,7 @@ const TextArea = React.forwardRef(({ label, helperText, errorText, successText,
|
|
|
4213
4230
|
size,
|
|
4214
4231
|
validationState: currentValidationState,
|
|
4215
4232
|
isDisabled,
|
|
4216
|
-
}), className), children: jsx("textarea", { ref: ref, value: textAreaValue, onChange: handleChange, disabled: isDisabled, required: isRequired, rows: rows, className: cn("flex-1 bg-transparent border-none outline-none text-surface-ink-neutral-normal placeholder:text-surface-ink-neutral-muted disabled:cursor-not-allowed disabled:text-surface-ink-neutral-disabled
|
|
4233
|
+
}), className), children: jsx("textarea", { ref: ref, value: textAreaValue, onChange: handleChange, disabled: isDisabled, required: isRequired, rows: rows, className: cn("flex-1 bg-transparent border-none outline-none text-surface-ink-neutral-normal placeholder:text-surface-ink-neutral-muted disabled:cursor-not-allowed disabled:text-surface-ink-neutral-disabled resize-none", size === "small" && "text-xs", size === "medium" && "text-sm", size === "large" && "text-base", textAreaClassName), ...props }) }), jsx(FormFooter, { helperText: displayHelperText, trailingText: maxChar && showCharCount ? `${currentLength}/${maxChar}` : undefined, validationState: currentValidationState === "none"
|
|
4217
4234
|
? "default"
|
|
4218
4235
|
: currentValidationState, size: size, isDisabled: isDisabled, className: "mt-1", trailingTextClassName: cn("transition-colors", isAtLimit
|
|
4219
4236
|
? "text-feedback-ink-negative-subtle"
|