infinity-ui-elements 1.8.15 → 1.8.16

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",
@@ -4153,7 +4165,7 @@ const Tabs = React__namespace.forwardRef(({ tabs, selectedTabId, defaultSelected
4153
4165
  });
4154
4166
  Tabs.displayName = "Tabs";
4155
4167
 
4156
- const textAreaVariants = classVarianceAuthority.cva("relative flex flex-col border rounded-large transition-all font-display font-size-100 leading-100", {
4168
+ const textAreaVariants = classVarianceAuthority.cva("relative flex flex-col border rounded-large transition-all font-functional font-size-100 leading-100", {
4157
4169
  variants: {
4158
4170
  size: {
4159
4171
  small: "p-3 min-h-[56px] text-xs gap-2",
@@ -4234,7 +4246,7 @@ const TextArea = React__namespace.forwardRef(({ label, helperText, errorText, su
4234
4246
  size,
4235
4247
  validationState: currentValidationState,
4236
4248
  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"
4249
+ }), 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
4250
  ? "default"
4239
4251
  : currentValidationState, size: size, isDisabled: isDisabled, className: "mt-1", trailingTextClassName: cn("transition-colors", isAtLimit
4240
4252
  ? "text-feedback-ink-negative-subtle"