infinity-ui-elements 1.8.33 → 1.8.40

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
@@ -2104,18 +2104,49 @@ const formatDateByPattern = (date, format) => {
2104
2104
  const month = date.getMonth() + 1; // getMonth() returns 0-11
2105
2105
  const year = date.getFullYear();
2106
2106
  const monthNames = [
2107
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
2108
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
2107
+ "Jan",
2108
+ "Feb",
2109
+ "Mar",
2110
+ "Apr",
2111
+ "May",
2112
+ "Jun",
2113
+ "Jul",
2114
+ "Aug",
2115
+ "Sep",
2116
+ "Oct",
2117
+ "Nov",
2118
+ "Dec",
2109
2119
  ];
2110
2120
  const monthNamesFull = [
2111
- "January", "February", "March", "April", "May", "June",
2112
- "July", "August", "September", "October", "November", "December"
2121
+ "January",
2122
+ "February",
2123
+ "March",
2124
+ "April",
2125
+ "May",
2126
+ "June",
2127
+ "July",
2128
+ "August",
2129
+ "September",
2130
+ "October",
2131
+ "November",
2132
+ "December",
2113
2133
  ];
2114
2134
  const dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
2115
- const dayNamesFull = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
2135
+ const dayNamesFull = [
2136
+ "Sunday",
2137
+ "Monday",
2138
+ "Tuesday",
2139
+ "Wednesday",
2140
+ "Thursday",
2141
+ "Friday",
2142
+ "Saturday",
2143
+ ];
2116
2144
  // Pad numbers with leading zeros
2117
2145
  const pad = (n, length = 2) => {
2118
- return n.toString().padStart(length, "0");
2146
+ const str = n.toString();
2147
+ if (str.length >= length)
2148
+ return str;
2149
+ return "0".repeat(length - str.length) + str;
2119
2150
  };
2120
2151
  let formatted = format;
2121
2152
  // Replace format patterns
@@ -3871,7 +3902,7 @@ const selectTriggerVariants = classVarianceAuthority.cva("flex items-center gap-
3871
3902
  isDisabled: false,
3872
3903
  },
3873
3904
  });
3874
- const SelectTextField = React__namespace.forwardRef(({ textValue: controlledTextValue, defaultTextValue, onTextChange, selectOptions = [], selectValue: controlledSelectValue, defaultSelectValue, onSelectChange, selectPlaceholder = "Select", selectTriggerClassName, selectMenuClassName, selectMenuWidth = "auto", selectSectionHeading, selectEmptyTitle = "No options available", selectEmptyDescription = "There are no options to select from.", selectEmptyIcon, label, helperText, errorText, successText, validationState = "none", isDisabled = false, isRequired = false, isOptional = false, size = "medium", containerClassName, labelClassName, inputClassName, className, ...textFieldProps }, ref) => {
3905
+ const SelectTextField = React__namespace.forwardRef(({ textValue: controlledTextValue, defaultTextValue, onTextChange, selectOptions = [], selectValue: controlledSelectValue, defaultSelectValue, onSelectChange, selectPlaceholder = "Select", selectTriggerClassName, selectMenuClassName, selectMenuWidth = "auto", selectSectionHeading, selectEmptyTitle = "No options available", selectEmptyDescription = "There are no options to select from.", selectEmptyIcon, position = "suffix", label, helperText, errorText, successText, validationState = "none", isDisabled = false, isRequired = false, isOptional = false, size = "medium", containerClassName, labelClassName, inputClassName, className, ...textFieldProps }, ref) => {
3875
3906
  const [uncontrolledTextValue, setUncontrolledTextValue] = React__namespace.useState(defaultTextValue || "");
3876
3907
  const [uncontrolledSelectValue, setUncontrolledSelectValue] = React__namespace.useState(defaultSelectValue);
3877
3908
  const [isSelectOpen, setIsSelectOpen] = React__namespace.useState(false);
@@ -4026,12 +4057,14 @@ const SelectTextField = React__namespace.forwardRef(({ textValue: controlledText
4026
4057
  gap: "gap-3",
4027
4058
  },
4028
4059
  };
4029
- // Create the select suffix component
4030
- const selectSuffix = (jsxRuntime.jsxs("div", { className: "relative flex items-center h-full", children: [jsxRuntime.jsxs("div", { ref: selectRef, className: cn(selectTriggerVariants({
4060
+ // Create the select component (prefix or suffix)
4061
+ const selectComponent = (jsxRuntime.jsxs("div", { className: cn("relative flex items-stretch h-full"), children: [jsxRuntime.jsxs("div", { ref: selectRef, className: cn(selectTriggerVariants({
4031
4062
  size,
4032
4063
  validationState: currentValidationState,
4033
4064
  isDisabled,
4034
- }), "border-l border-action-outline-neutral-faded pl-2 ml-2 h-full flex items-center", selectTriggerClassName), onClick: !isDisabled ? toggleSelectOpen : undefined, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isSelectOpen, "aria-disabled": isDisabled, children: [jsxRuntime.jsx("span", { className: cn("text-left truncate max-w-[120px] whitespace-nowrap", !selectedOption && "text-surface-ink-neutral-muted", isDisabled && "text-surface-ink-neutral-disabled"), children: selectedOption?.label || selectPlaceholder }), jsxRuntime.jsx(lucideReact.ChevronDown, { className: cn("shrink-0 transition-transform", size === "small"
4065
+ }), "h-full flex items-center self-stretch", position === "prefix"
4066
+ ? "border-r border-action-outline-neutral-faded"
4067
+ : "border-l border-action-outline-neutral-faded", selectTriggerClassName, position === "prefix" ? "pr-4" : "pl-4"), onClick: !isDisabled ? toggleSelectOpen : undefined, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isSelectOpen, "aria-disabled": isDisabled, children: [jsxRuntime.jsx("span", { className: cn("text-left truncate max-w-[120px] whitespace-nowrap", !selectedOption && "text-surface-ink-neutral-muted", isDisabled && "text-surface-ink-neutral-disabled"), children: selectedOption?.label || selectPlaceholder }), jsxRuntime.jsx(lucideReact.ChevronDown, { className: cn("shrink-0 transition-transform", size === "small"
4035
4068
  ? "w-3 h-3"
4036
4069
  : size === "medium"
4037
4070
  ? "w-3.5 h-3.5"
@@ -4041,10 +4074,12 @@ const SelectTextField = React__namespace.forwardRef(({ textValue: controlledText
4041
4074
  ? "text-feedback-ink-positive-intense"
4042
4075
  : currentValidationState === "negative"
4043
4076
  ? "text-feedback-ink-negative-subtle"
4044
- : "text-surface-ink-neutral-muted", isSelectOpen && "transform rotate-180") })] }), isSelectOpen && !isDisabled && (jsxRuntime.jsx("div", { ref: dropdownContainerRef, className: cn("absolute z-50 right-0", dropdownPlacement === "bottom"
4045
- ? "top-full mt-1"
4077
+ : "text-surface-ink-neutral-muted", isSelectOpen && "transform rotate-180") })] }), isSelectOpen && !isDisabled && (jsxRuntime.jsx("div", { ref: dropdownContainerRef, className: cn("absolute z-50", position === "prefix" ? "left-[-12px]" : "right-[-12px]", dropdownPlacement === "bottom"
4078
+ ? "top-[30px] mt-1"
4046
4079
  : "bottom-full mb-1"), children: jsxRuntime.jsx(DropdownMenu, { items: menuItems, sectionHeading: selectSectionHeading, isEmpty: selectOptions.length === 0, emptyTitle: selectEmptyTitle, emptyDescription: selectEmptyDescription, emptyIcon: selectEmptyIcon, disableFooter: true, onClose: () => handleSelectOpenChange(false), className: selectMenuClassName, width: widthStyle }) }))] }));
4047
- return (jsxRuntime.jsxs("div", { ref: componentRef, className: cn("w-full flex flex-col", sizeConfig[size].gap, containerClassName), children: [label && (jsxRuntime.jsx(FormHeader, { label: label, size: size, isRequired: isRequired, isOptional: isOptional, infoHeading: textFieldProps.infoHeading, infoDescription: textFieldProps.infoDescription, LinkComponent: textFieldProps.LinkComponent, linkText: textFieldProps.linkText, linkHref: textFieldProps.linkHref, onLinkClick: textFieldProps.onLinkClick, htmlFor: textFieldProps.id, className: "mb-2", labelClassName: labelClassName })), jsxRuntime.jsx(TextField, { ref: ref, value: textValue, onChange: handleTextChange, suffix: selectSuffix, size: size, validationState: currentValidationState, isDisabled: isDisabled, isRequired: isRequired, isOptional: isOptional, containerClassName: "gap-0", className: className, inputClassName: inputClassName, ...textFieldProps }), jsxRuntime.jsx(FormFooter, { helperText: displayHelperText, validationState: currentValidationState === "none"
4080
+ return (jsxRuntime.jsxs("div", { ref: componentRef, className: cn("w-full flex flex-col", sizeConfig[size].gap, containerClassName), children: [label && (jsxRuntime.jsx(FormHeader, { label: label, size: size, isRequired: isRequired, isOptional: isOptional, infoHeading: textFieldProps.infoHeading, infoDescription: textFieldProps.infoDescription, LinkComponent: textFieldProps.LinkComponent, linkText: textFieldProps.linkText, linkHref: textFieldProps.linkHref, onLinkClick: textFieldProps.onLinkClick, htmlFor: textFieldProps.id, className: "mb-2", labelClassName: labelClassName })), jsxRuntime.jsx(TextField, { ref: ref, value: textValue, onChange: handleTextChange, ...(position === "prefix"
4081
+ ? { prefix: selectComponent }
4082
+ : { suffix: selectComponent }), size: size, validationState: currentValidationState, isDisabled: isDisabled, isRequired: isRequired, isOptional: isOptional, containerClassName: "gap-0", className: className, inputClassName: inputClassName, ...textFieldProps }), jsxRuntime.jsx(FormFooter, { helperText: displayHelperText, validationState: currentValidationState === "none"
4048
4083
  ? "default"
4049
4084
  : currentValidationState, size: size, isDisabled: isDisabled, className: "mt-1" })] }));
4050
4085
  });