infinity-ui-elements 1.8.60 → 1.8.62

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.esm.js CHANGED
@@ -5,7 +5,7 @@ import { Slot } from '@radix-ui/react-slot';
5
5
  import { PulseLoader, ClipLoader } from 'react-spinners';
6
6
  import { clsx } from 'clsx';
7
7
  import { twMerge } from 'tailwind-merge';
8
- import { ExternalLink, Calendar, X, Loader2, Search, ChevronLeft, ChevronRight, ChevronDown } from 'lucide-react';
8
+ import { ExternalLink, Calendar, X, Loader2, Search, ChevronDown } from 'lucide-react';
9
9
  import { createPortal } from 'react-dom';
10
10
  import Calendar$1 from 'react-calendar';
11
11
  import 'react-calendar/dist/Calendar.css';
@@ -77,6 +77,14 @@ const iconRegistry = {
77
77
  chevronUp: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
78
78
  <path d="M12 11.2727L6.55555 17L5 15.3637L12 8L19 15.3637L17.4445 17L12 11.2727Z" fill="#081416"/>
79
79
  </svg>
80
+ `,
81
+ chevronLeft: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
82
+ <path d="M11.2727 12L17 17.4445L15.3637 19L8 12L15.3637 5L17 6.55555L11.2727 12Z" fill="#081416"/>
83
+ </svg>
84
+ `,
85
+ chevronRight: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
86
+ <path d="M13.7272 12L8 6.55555L9.63635 5L17 12L9.63635 19L8 17.4445L13.7272 12Z" fill="#081416"/>
87
+ </svg>
80
88
  `,
81
89
  };
82
90
  const Icon = ({ name, size = 24, className = "", style = {}, ...props }) => {
@@ -2843,9 +2851,8 @@ const textFieldVariants = cva("relative flex items-center gap-3 border rounded-l
2843
2851
  validationState: {
2844
2852
  none: `
2845
2853
  border-action-outline-neutral-faded
2846
- hover:border-action-outline-neutral-faded-hover
2847
- hover:bg-action-fill-neutral-faded-hover
2848
2854
  focus-within:border-action-outline-primary-default
2855
+ focus-within:bg-white!
2849
2856
  focus-within:ring-2
2850
2857
  ring-surface-outline-primary-muted`,
2851
2858
  positive: `
@@ -2868,11 +2875,16 @@ const textFieldVariants = cva("relative flex items-center gap-3 border rounded-l
2868
2875
  cursor-not-allowed`,
2869
2876
  false: "",
2870
2877
  },
2878
+ isReadOnly: {
2879
+ true: "",
2880
+ false: "hover:border-action-outline-neutral-faded-hover hover:bg-action-fill-neutral-faded-hover",
2881
+ },
2871
2882
  },
2872
2883
  defaultVariants: {
2873
2884
  size: "medium",
2874
2885
  validationState: "none",
2875
2886
  isDisabled: false,
2887
+ isReadOnly: false,
2876
2888
  },
2877
2889
  });
2878
2890
  const TextField = React.forwardRef(({ label, helperText, errorText, successText, size = "medium", validationState = "none", isDisabled = false, isLoading = false, isRequired = false, isOptional = false, prefix, suffix, showClearButton = false, infoDescription, infoHeading, LinkComponent, linkText, linkHref, onLinkClick, onClear, containerClassName, labelClassName, inputClassName, className, value, onChange, ...props }, ref) => {
@@ -2922,13 +2934,14 @@ const TextField = React.forwardRef(({ label, helperText, errorText, successText,
2922
2934
  size,
2923
2935
  validationState: currentValidationState,
2924
2936
  isDisabled,
2937
+ isReadOnly: props.readOnly,
2925
2938
  }), isLoading && "text-field-loading", className), children: [prefix && (jsx("span", { className: cn("shrink-0 flex items-center", isDisabled
2926
2939
  ? "text-surface-ink-neutral-disabled"
2927
2940
  : currentValidationState === "positive"
2928
2941
  ? "text-feedback-ink-positive-intense"
2929
2942
  : currentValidationState === "negative"
2930
2943
  ? "text-feedback-ink-negative-subtle"
2931
- : "text-surface-ink-neutral-muted"), children: prefix })), jsx("input", { ref: ref, value: inputValue, onChange: handleChange, disabled: isDisabled, required: isRequired, 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", inputClassName), ...props }), showClearButton && hasValue && !isDisabled && (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: jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }) })), suffix && (jsx("span", { className: cn("shrink-0 flex items-center", isDisabled
2944
+ : "text-surface-ink-neutral-muted"), children: prefix })), jsx("input", { ref: ref, value: inputValue, onChange: handleChange, disabled: isDisabled, required: isRequired, className: cn("w-full 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", inputClassName), ...props }), showClearButton && hasValue && !isDisabled && (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: jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }) })), suffix && (jsx("span", { className: cn("shrink-0 flex items-center", isDisabled
2932
2945
  ? "text-surface-ink-neutral-disabled"
2933
2946
  : currentValidationState === "positive"
2934
2947
  ? "text-feedback-ink-positive-intense"
@@ -3104,7 +3117,7 @@ const Select = React.forwardRef(({ className, options = [], value: controlledVal
3104
3117
  // Build the suffix: include both the optional suffix and the chevron icon
3105
3118
  const chevronIcon = (jsx(Icon, { name: isOpen ? "chevronUp" : "chevronDown", size: 16, className: "shrink-0 transition-colors" }));
3106
3119
  const displaySuffix = suffix ? (jsxs(Fragment, { children: [suffix, chevronIcon] })) : (chevronIcon);
3107
- return (jsxs("div", { ref: containerRef, className: "relative", children: [jsx(TextField, { ref: inputRef, label: label, helperText: helperText, errorText: errorText, successText: successText, validationState: validationState, isDisabled: isDisabled, isRequired: isRequired, isOptional: isOptional, isLoading: isLoading, size: size, prefix: displayPrefix, suffix: displaySuffix, showClearButton: showClearButton && hasValue && !isLoading, onClear: handleClear, placeholder: placeholder, value: displayValue, readOnly: true, containerClassName: containerClassName, labelClassName: labelClassName, className: cn("cursor-pointer", triggerClassName, className), inputClassName: "cursor-pointer", infoHeading: infoHeading, infoDescription: infoDescription, LinkComponent: LinkComponent, linkText: linkText, linkHref: linkHref, onLinkClick: onLinkClick, onClick: toggleOpen, onKeyDown: handleKeyDown, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isOpen, ...props }), isOpen && !isDisabled && !isLoading && (jsx("div", { ref: dropdownContainerRef, className: cn("absolute z-50 left-0 right-0", dropdownPlacement === "bottom"
3120
+ return (jsxs("div", { ref: containerRef, className: "relative w-full", children: [jsx(TextField, { ref: inputRef, label: label, helperText: helperText, errorText: errorText, successText: successText, validationState: validationState, isDisabled: isDisabled, isRequired: isRequired, isOptional: isOptional, isLoading: isLoading, size: size, prefix: displayPrefix, suffix: displaySuffix, showClearButton: showClearButton && hasValue && !isLoading, onClear: handleClear, placeholder: placeholder, value: displayValue, readOnly: true, containerClassName: cn("w-full", containerClassName), labelClassName: labelClassName, className: cn("cursor-pointer", triggerClassName, className), inputClassName: "cursor-pointer", infoHeading: infoHeading, infoDescription: infoDescription, LinkComponent: LinkComponent, linkText: linkText, linkHref: linkHref, onLinkClick: onLinkClick, onClick: toggleOpen, onKeyDown: handleKeyDown, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isOpen, ...props }), isOpen && !isDisabled && !isLoading && (jsx("div", { ref: dropdownContainerRef, className: cn("absolute z-50 left-0 right-0", dropdownPlacement === "bottom"
3108
3121
  ? "top-full mt-1"
3109
3122
  : "bottom-full mb-1"), children: jsx(DropdownMenu, { items: menuItems, sectionHeading: sectionHeading, isEmpty: options.length === 0, emptyTitle: emptyTitle, emptyDescription: emptyDescription, emptyIcon: emptyIcon, disableFooter: true, onClose: () => handleOpenChange(false), className: menuClassName, width: widthStyle }) }))] }));
3110
3123
  });
@@ -3226,12 +3239,12 @@ const Pagination = React.forwardRef(({ className, currentPage: controlledCurrent
3226
3239
  return [];
3227
3240
  };
3228
3241
  const pageNumbers = getPageNumbers();
3229
- return (jsxs("div", { ref: ref, className: cn(paginationVariants({ size }), className), ...props, children: [showRowsPerPage && (jsxs("div", { className: "flex items-center gap-3", children: [jsx("span", { className: "text-surface-ink-neutral-muted whitespace-nowrap", children: rowsPerPageLabel }), jsx("div", { className: "w-[80px]", children: jsx(Select, { value: rowsPerPage.toString(), options: rowsPerPageSelectOptions, onChange: handleRowsPerPageChange, size: selectSize, isDisabled: isDisabled, menuWidth: "auto" }) })] })), jsxs("div", { className: "flex items-center gap-3 ml-auto", children: [showPrevNext && (jsx(Button, { variant: "tertiary", color: "neutral", size: buttonSize, onClick: handlePrevPage, isDisabled: isPrevDisabled, leadingIcon: jsx(ChevronLeft, { className: "w-4 h-4" }), "aria-label": "Previous page", children: prevLabel })), showPageJumper ? (
3242
+ return (jsxs("div", { ref: ref, className: cn(paginationVariants({ size }), className), ...props, children: [showRowsPerPage && (jsxs("div", { className: "flex items-center gap-3", children: [jsx("span", { className: "text-surface-ink-neutral-muted whitespace-nowrap", children: rowsPerPageLabel }), jsx("div", { className: "w-[80px]", children: jsx(Select, { value: rowsPerPage.toString(), options: rowsPerPageSelectOptions, onChange: handleRowsPerPageChange, size: selectSize, isDisabled: isDisabled, menuWidth: "auto" }) })] })), jsxs("div", { className: "flex items-center gap-3 ml-auto", children: [showPrevNext && (jsx(Button, { variant: "tertiary", color: "neutral", size: buttonSize, onClick: handlePrevPage, isDisabled: isPrevDisabled, leadingIcon: jsx(Icon, { name: "chevronLeft", size: 16 }), "aria-label": "Previous page", children: prevLabel })), showPageJumper ? (
3230
3243
  // Show page dropdown selector
3231
3244
  jsxs("div", { className: "flex items-center gap-3", children: [jsx("div", { className: "w-[80px]", children: jsx(Select, { value: currentPage.toString(), options: pageOptions, onChange: (value) => handlePageChange(typeof value === "string" ? parseInt(value) : value), size: selectSize, isDisabled: isDisabled, menuWidth: "auto" }) }), jsxs("span", { className: "text-surface-ink-neutral-muted whitespace-nowrap", children: [ofLabel, " ", totalPages] })] })) : (
3232
3245
  // Show numbered page buttons
3233
3246
  showPageNumber &&
3234
- pageNumbers.length > 0 && (jsx(ButtonGroup, { variant: "separated", size: buttonSize, isDisabled: isDisabled, value: currentPage, onChange: (value) => handlePageChange(value), children: pageNumbers.map((pageNum) => (jsx(Button, { value: pageNum, variant: "tertiary", color: "primary", "aria-label": `Page ${pageNum}`, "aria-current": pageNum === currentPage ? "page" : undefined, children: pageNum }, pageNum))) }))), showPrevNext && (jsx(Button, { variant: "tertiary", color: "neutral", size: buttonSize, onClick: handleNextPage, isDisabled: isNextDisabled, trailingIcon: jsx(ChevronRight, { className: "w-4 h-4" }), "aria-label": "Next page", children: nextLabel }))] })] }));
3247
+ pageNumbers.length > 0 && (jsx(ButtonGroup, { variant: "separated", size: buttonSize, isDisabled: isDisabled, value: currentPage, onChange: (value) => handlePageChange(value), children: pageNumbers.map((pageNum) => (jsx(Button, { value: pageNum, variant: "tertiary", color: "primary", "aria-label": `Page ${pageNum}`, "aria-current": pageNum === currentPage ? "page" : undefined, children: pageNum }, pageNum))) }))), showPrevNext && (jsx(Button, { variant: "tertiary", color: "neutral", size: buttonSize, onClick: handleNextPage, isDisabled: isNextDisabled, trailingIcon: jsx(Icon, { name: "chevronRight", size: 16 }), "aria-label": "Next page", children: nextLabel }))] })] }));
3235
3248
  });
3236
3249
  Pagination.displayName = "Pagination";
3237
3250
 
@@ -4675,10 +4688,12 @@ const textAreaVariants = cva("relative flex flex-col border rounded-large transi
4675
4688
  validationState: {
4676
4689
  none: `
4677
4690
  border-action-outline-neutral-faded
4678
- hover:border-action-outline-primary-hover
4679
- focus-within:border-action-outline-primary-hover
4691
+ hover:border-action-outline-neutral-faded-hover
4692
+ hover:bg-action-fill-neutral-faded-hover
4693
+ focus-within:border-action-outline-primary-default
4694
+ focus-within:bg-white!
4680
4695
  focus-within:ring-2
4681
- ring-action-outline-primary-faded-hover`,
4696
+ ring-surface-outline-primary-muted`,
4682
4697
  positive: `
4683
4698
  border-action-outline-positive-default
4684
4699
  focus-within:border-action-outline-positive-hover
@@ -4691,11 +4706,13 @@ const textAreaVariants = cva("relative flex flex-col border rounded-large transi
4691
4706
  },
4692
4707
  isDisabled: {
4693
4708
  true: `
4694
- border-[var(--border-width-thinner)]
4695
- hover:border-action-outline-neutral-disabled
4709
+ border
4696
4710
  border-action-outline-neutral-disabled
4697
- bg-surface-fill-neutral-intense cursor-not-allowed opacity-60`,
4698
- false: "bg-surface-fill-neutral-intense",
4711
+ hover:border-action-outline-neutral-disabled
4712
+ bg-surface-fill-neutral-intense
4713
+ hover:bg-surface-fill-neutral-intense
4714
+ cursor-not-allowed`,
4715
+ false: "",
4699
4716
  },
4700
4717
  },
4701
4718
  defaultVariants: {