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/index.js CHANGED
@@ -2040,7 +2040,7 @@ const FormHeader = React__namespace.forwardRef(({ label, size = "medium", isOpti
2040
2040
  });
2041
2041
  FormHeader.displayName = "FormHeader";
2042
2042
 
2043
- const datePickerVariants = classVarianceAuthority.cva("relative flex items-center gap-2 border rounded-large transition-all font-display font-size-100 leading-100", {
2043
+ const datePickerVariants = classVarianceAuthority.cva("relative flex items-center gap-2 border rounded-large transition-all font-functional font-size-100 leading-100", {
2044
2044
  variants: {
2045
2045
  size: {
2046
2046
  small: "h-[28px] px-3 text-xs gap-2",
@@ -2579,7 +2579,7 @@ const Modal = React__namespace.forwardRef(({ isOpen, onClose, title, description
2579
2579
  });
2580
2580
  Modal.displayName = "Modal";
2581
2581
 
2582
- const selectVariants = classVarianceAuthority.cva("relative flex items-center gap-2 border rounded-large transition-all font-display font-size-100 leading-100", {
2582
+ const selectVariants = classVarianceAuthority.cva("relative flex items-center gap-2 border rounded-large transition-all font-functional font-size-100 leading-100", {
2583
2583
  variants: {
2584
2584
  size: {
2585
2585
  small: "h-[28px] px-3 text-xs gap-2",
@@ -3222,7 +3222,7 @@ const defaultFilter = (item, query) => {
3222
3222
  return (item.label.toLowerCase().includes(searchQuery) ||
3223
3223
  (item.description?.toLowerCase().includes(searchQuery) ?? false));
3224
3224
  };
3225
- 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, onAddNew, containerClassName, ...textFieldProps }, ref) => {
3225
+ 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, showAddNewIfDoesNotMatch = true, onAddNew, containerClassName, ...textFieldProps }, ref) => {
3226
3226
  const [uncontrolledSearchValue, setUncontrolledSearchValue] = React__namespace.useState(defaultSearchValue);
3227
3227
  const [isOpen, setIsOpen] = React__namespace.useState(false);
3228
3228
  const [focusedIndex, setFocusedIndex] = React__namespace.useState(-1);
@@ -3282,9 +3282,9 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
3282
3282
  return items;
3283
3283
  return items.filter((item) => filterFunction(item, searchValue));
3284
3284
  }, [items, searchValue, filterFunction]);
3285
- // Add "Add New" option if showAddNew is true and no items match
3285
+ // Add "Add New" option based on showAddNew and showAddNewIfDoesNotMatch props
3286
3286
  const itemsWithAddNew = React__namespace.useMemo(() => {
3287
- if (!showAddNew || !searchValue || filteredItems.length > 0) {
3287
+ if (!showAddNew || !searchValue) {
3288
3288
  return filteredItems;
3289
3289
  }
3290
3290
  const addNewItem = {
@@ -3309,9 +3309,21 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
3309
3309
  inputRef.current?.focus();
3310
3310
  },
3311
3311
  };
3312
- return [addNewItem];
3312
+ // If showAddNewIfDoesNotMatch is true, only show "Add New" when no items match
3313
+ // If false, always show "Add New" at the top
3314
+ if (showAddNewIfDoesNotMatch) {
3315
+ if (filteredItems.length > 0) {
3316
+ return filteredItems;
3317
+ }
3318
+ return [addNewItem];
3319
+ }
3320
+ else {
3321
+ // Always show "Add New" at the top
3322
+ return [addNewItem, ...filteredItems];
3323
+ }
3313
3324
  }, [
3314
3325
  showAddNew,
3326
+ showAddNewIfDoesNotMatch,
3315
3327
  searchValue,
3316
3328
  filteredItems,
3317
3329
  onItemSelect,
@@ -3450,7 +3462,7 @@ const Skeleton = React__namespace.forwardRef(({ className, containerClassName, c
3450
3462
  });
3451
3463
  Skeleton.displayName = "Skeleton";
3452
3464
 
3453
- const selectTriggerVariants = classVarianceAuthority.cva("flex items-center gap-1 transition-all font-display font-size-100 leading-100", {
3465
+ const selectTriggerVariants = classVarianceAuthority.cva("flex items-center gap-1 transition-all font-functional font-size-100 leading-100", {
3454
3466
  variants: {
3455
3467
  size: {
3456
3468
  small: "px-2 text-xs",
@@ -3803,6 +3815,7 @@ const tableVariants = classVarianceAuthority.cva("w-full border-collapse", {
3803
3815
  small: "text-body-small-medium",
3804
3816
  medium: "text-body-medium-medium",
3805
3817
  large: "text-body-large-medium",
3818
+ auto: "text-body-medium-medium",
3806
3819
  },
3807
3820
  },
3808
3821
  defaultVariants: {
@@ -3816,6 +3829,7 @@ const tableHeaderVariants = classVarianceAuthority.cva("text-body-medium-regular
3816
3829
  small: "px-3 py-2 h-[32px]",
3817
3830
  medium: "px-4 py-3 h-[40px]",
3818
3831
  large: "px-6 py-4 h-[48px]",
3832
+ auto: "px-4 py-3 h-[56px]",
3819
3833
  },
3820
3834
  },
3821
3835
  defaultVariants: {
@@ -3828,6 +3842,7 @@ const tableCellVariants = classVarianceAuthority.cva("text-body-medium-regular b
3828
3842
  small: "px-3 py-2 h-[40px]",
3829
3843
  medium: "px-4 py-3 h-[72px]",
3830
3844
  large: "px-6 py-4 h-[56px]",
3845
+ auto: "px-4 py-3",
3831
3846
  },
3832
3847
  state: {
3833
3848
  default: "",
@@ -3847,6 +3862,7 @@ function TableHeader({ headerGroups, enableRowSelection, enableSelectAll, showHe
3847
3862
  small: 32,
3848
3863
  medium: 40,
3849
3864
  large: 48,
3865
+ auto: 56,
3850
3866
  }[size] ?? 40;
3851
3867
  return (jsxRuntime.jsx("thead", { className: cn(showHeaderBackground ? "bg-surface-fill-neutral-moderate" : "bg-white", stickyHeader && "sticky top-0 z-10"), children: headerGroups.map((headerGroup, groupIndex) => {
3852
3868
  const stickyTop = stickyHeader ? groupIndex * headerHeight : undefined;
@@ -3948,6 +3964,7 @@ function TableComponent({ className, wrapperClassName, containerClassName, varia
3948
3964
  small: 16,
3949
3965
  medium: 20,
3950
3966
  large: 24,
3967
+ auto: "auto",
3951
3968
  };
3952
3969
  const skeletonCellHeight = normalizeSizeValue(loadingSkeletonHeight ?? skeletonHeightMap[sizeKey]);
3953
3970
  const selectionSkeletonSize = sizeKey === "small" ? 14 : sizeKey === "large" ? 20 : 16;
@@ -3996,7 +4013,7 @@ function TableComponent({ className, wrapperClassName, containerClassName, varia
3996
4013
  return renderDefaultEmptyState({ colSpan: table.getAllColumns().length });
3997
4014
  };
3998
4015
  // ==================== Render ====================
3999
- return (jsxRuntime.jsx("div", { ref: ref, className: cn("w-full", wrapperClassName), ...props, children: jsxRuntime.jsx("div", { className: cn("relative", enableHorizontalScroll ? "overflow-x-auto" : "overflow-x-hidden", maxHeight && "overflow-y-auto", containerClassName), style: containerStyle, children: jsxRuntime.jsxs("table", { className: cn(tableVariants({ variant, size }), className), children: [jsxRuntime.jsx(TableHeader, { headerGroups: headerGroups, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, showHeaderBackground: showHeaderBackground, stickyHeader: stickyHeader, size: size || "medium", headerClassName: headerClassName, onToggleAllRows: (e) => table.getToggleAllRowsSelectedHandler()(e), isAllRowsSelected: table.getIsAllRowsSelected(), isSomeRowsSelected: table.getIsSomeRowsSelected(), getColumnStyle: getColumnStyle }), resolvedLoading ? (jsxRuntime.jsx("tbody", { children: renderLoadingContent() })) : !hasData ? (jsxRuntime.jsx("tbody", { children: renderEmptyState() })) : (jsxRuntime.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 }))] }) }) }));
4016
+ return (jsxRuntime.jsx("div", { ref: ref, className: cn("w-full", wrapperClassName), ...props, children: jsxRuntime.jsx("div", { className: cn("relative", enableHorizontalScroll ? "overflow-x-auto" : "overflow-x-hidden", maxHeight && "overflow-y-auto", containerClassName), style: containerStyle, children: jsxRuntime.jsxs("table", { className: cn(tableVariants({ variant, size }), className), children: [jsxRuntime.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 ? (jsxRuntime.jsx("tbody", { children: renderLoadingContent() })) : !hasData ? (jsxRuntime.jsx("tbody", { children: renderEmptyState() })) : (jsxRuntime.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 }))] }) }) }));
4000
4017
  }
4001
4018
  // ==================== Export ====================
4002
4019
  const Table = React__namespace.forwardRef(TableComponent);
@@ -4153,7 +4170,7 @@ const Tabs = React__namespace.forwardRef(({ tabs, selectedTabId, defaultSelected
4153
4170
  });
4154
4171
  Tabs.displayName = "Tabs";
4155
4172
 
4156
- const textAreaVariants = classVarianceAuthority.cva("relative flex flex-col border rounded-large transition-all font-display font-size-100 leading-100", {
4173
+ const textAreaVariants = classVarianceAuthority.cva("relative flex flex-col border rounded-large transition-all font-functional font-size-100 leading-100", {
4157
4174
  variants: {
4158
4175
  size: {
4159
4176
  small: "p-3 min-h-[56px] text-xs gap-2",
@@ -4234,7 +4251,7 @@ const TextArea = React__namespace.forwardRef(({ label, helperText, errorText, su
4234
4251
  size,
4235
4252
  validationState: currentValidationState,
4236
4253
  isDisabled,
4237
- }), className), children: jsxRuntime.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 font-display resize-none", size === "small" && "text-xs", size === "medium" && "text-sm", size === "large" && "text-base", textAreaClassName), ...props }) }), jsxRuntime.jsx(FormFooter, { helperText: displayHelperText, trailingText: maxChar && showCharCount ? `${currentLength}/${maxChar}` : undefined, validationState: currentValidationState === "none"
4254
+ }), className), children: jsxRuntime.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 }) }), jsxRuntime.jsx(FormFooter, { helperText: displayHelperText, trailingText: maxChar && showCharCount ? `${currentLength}/${maxChar}` : undefined, validationState: currentValidationState === "none"
4238
4255
  ? "default"
4239
4256
  : currentValidationState, size: size, isDisabled: isDisabled, className: "mt-1", trailingTextClassName: cn("transition-colors", isAtLimit
4240
4257
  ? "text-feedback-ink-negative-subtle"