infinity-ui-elements 1.8.33 → 1.8.42
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/DatePicker/DatePicker.d.ts +5 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/SelectTextField/SelectTextField.d.ts +5 -0
- package/dist/components/SelectTextField/SelectTextField.d.ts.map +1 -1
- package/dist/components/SelectTextField/SelectTextField.stories.d.ts +3 -0
- package/dist/components/SelectTextField/SelectTextField.stories.d.ts.map +1 -1
- package/dist/components/Table/Table.d.ts +1 -2
- package/dist/components/Table/Table.d.ts.map +1 -1
- package/dist/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +50 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +50 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2083,18 +2083,49 @@ const formatDateByPattern = (date, format) => {
|
|
|
2083
2083
|
const month = date.getMonth() + 1; // getMonth() returns 0-11
|
|
2084
2084
|
const year = date.getFullYear();
|
|
2085
2085
|
const monthNames = [
|
|
2086
|
-
"Jan",
|
|
2087
|
-
"
|
|
2086
|
+
"Jan",
|
|
2087
|
+
"Feb",
|
|
2088
|
+
"Mar",
|
|
2089
|
+
"Apr",
|
|
2090
|
+
"May",
|
|
2091
|
+
"Jun",
|
|
2092
|
+
"Jul",
|
|
2093
|
+
"Aug",
|
|
2094
|
+
"Sep",
|
|
2095
|
+
"Oct",
|
|
2096
|
+
"Nov",
|
|
2097
|
+
"Dec",
|
|
2088
2098
|
];
|
|
2089
2099
|
const monthNamesFull = [
|
|
2090
|
-
"January",
|
|
2091
|
-
"
|
|
2100
|
+
"January",
|
|
2101
|
+
"February",
|
|
2102
|
+
"March",
|
|
2103
|
+
"April",
|
|
2104
|
+
"May",
|
|
2105
|
+
"June",
|
|
2106
|
+
"July",
|
|
2107
|
+
"August",
|
|
2108
|
+
"September",
|
|
2109
|
+
"October",
|
|
2110
|
+
"November",
|
|
2111
|
+
"December",
|
|
2092
2112
|
];
|
|
2093
2113
|
const dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
2094
|
-
const dayNamesFull = [
|
|
2114
|
+
const dayNamesFull = [
|
|
2115
|
+
"Sunday",
|
|
2116
|
+
"Monday",
|
|
2117
|
+
"Tuesday",
|
|
2118
|
+
"Wednesday",
|
|
2119
|
+
"Thursday",
|
|
2120
|
+
"Friday",
|
|
2121
|
+
"Saturday",
|
|
2122
|
+
];
|
|
2095
2123
|
// Pad numbers with leading zeros
|
|
2096
2124
|
const pad = (n, length = 2) => {
|
|
2097
|
-
|
|
2125
|
+
const str = n.toString();
|
|
2126
|
+
if (str.length >= length)
|
|
2127
|
+
return str;
|
|
2128
|
+
return "0".repeat(length - str.length) + str;
|
|
2098
2129
|
};
|
|
2099
2130
|
let formatted = format;
|
|
2100
2131
|
// Replace format patterns
|
|
@@ -3850,7 +3881,7 @@ const selectTriggerVariants = cva("flex items-center gap-1 transition-all font-f
|
|
|
3850
3881
|
isDisabled: false,
|
|
3851
3882
|
},
|
|
3852
3883
|
});
|
|
3853
|
-
const SelectTextField = React.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) => {
|
|
3884
|
+
const SelectTextField = React.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) => {
|
|
3854
3885
|
const [uncontrolledTextValue, setUncontrolledTextValue] = React.useState(defaultTextValue || "");
|
|
3855
3886
|
const [uncontrolledSelectValue, setUncontrolledSelectValue] = React.useState(defaultSelectValue);
|
|
3856
3887
|
const [isSelectOpen, setIsSelectOpen] = React.useState(false);
|
|
@@ -4005,12 +4036,14 @@ const SelectTextField = React.forwardRef(({ textValue: controlledTextValue, defa
|
|
|
4005
4036
|
gap: "gap-3",
|
|
4006
4037
|
},
|
|
4007
4038
|
};
|
|
4008
|
-
// Create the select suffix
|
|
4009
|
-
const
|
|
4039
|
+
// Create the select component (prefix or suffix)
|
|
4040
|
+
const selectComponent = (jsxs("div", { className: cn("relative flex items-stretch h-full"), children: [jsxs("div", { ref: selectRef, className: cn(selectTriggerVariants({
|
|
4010
4041
|
size,
|
|
4011
4042
|
validationState: currentValidationState,
|
|
4012
4043
|
isDisabled,
|
|
4013
|
-
}), "
|
|
4044
|
+
}), "h-full flex items-center self-stretch", position === "prefix"
|
|
4045
|
+
? "border-r border-action-outline-neutral-faded"
|
|
4046
|
+
: "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: [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 }), jsx(ChevronDown, { className: cn("shrink-0 transition-transform", size === "small"
|
|
4014
4047
|
? "w-3 h-3"
|
|
4015
4048
|
: size === "medium"
|
|
4016
4049
|
? "w-3.5 h-3.5"
|
|
@@ -4020,10 +4053,12 @@ const SelectTextField = React.forwardRef(({ textValue: controlledTextValue, defa
|
|
|
4020
4053
|
? "text-feedback-ink-positive-intense"
|
|
4021
4054
|
: currentValidationState === "negative"
|
|
4022
4055
|
? "text-feedback-ink-negative-subtle"
|
|
4023
|
-
: "text-surface-ink-neutral-muted", isSelectOpen && "transform rotate-180") })] }), isSelectOpen && !isDisabled && (jsx("div", { ref: dropdownContainerRef, className: cn("absolute z-50 right-
|
|
4024
|
-
? "top-
|
|
4056
|
+
: "text-surface-ink-neutral-muted", isSelectOpen && "transform rotate-180") })] }), isSelectOpen && !isDisabled && (jsx("div", { ref: dropdownContainerRef, className: cn("absolute z-50", position === "prefix" ? "left-[-12px]" : "right-[-12px]", dropdownPlacement === "bottom"
|
|
4057
|
+
? "top-[30px] mt-1"
|
|
4025
4058
|
: "bottom-full mb-1"), children: 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 }) }))] }));
|
|
4026
|
-
return (jsxs("div", { ref: componentRef, className: cn("w-full flex flex-col", sizeConfig[size].gap, containerClassName), children: [label && (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 })), jsx(TextField, { ref: ref, value: textValue, onChange: handleTextChange,
|
|
4059
|
+
return (jsxs("div", { ref: componentRef, className: cn("w-full flex flex-col", sizeConfig[size].gap, containerClassName), children: [label && (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 })), jsx(TextField, { ref: ref, value: textValue, onChange: handleTextChange, ...(position === "prefix"
|
|
4060
|
+
? { prefix: selectComponent }
|
|
4061
|
+
: { suffix: selectComponent }), size: size, validationState: currentValidationState, isDisabled: isDisabled, isRequired: isRequired, isOptional: isOptional, containerClassName: "gap-0", className: className, inputClassName: inputClassName, ...textFieldProps }), jsx(FormFooter, { helperText: displayHelperText, validationState: currentValidationState === "none"
|
|
4027
4062
|
? "default"
|
|
4028
4063
|
: currentValidationState, size: size, isDisabled: isDisabled, className: "mt-1" })] }));
|
|
4029
4064
|
});
|
|
@@ -4296,7 +4331,7 @@ function renderDefaultEmptyState({ colSpan }) {
|
|
|
4296
4331
|
}
|
|
4297
4332
|
|
|
4298
4333
|
// ==================== Component ====================
|
|
4299
|
-
function TableComponent({ className, wrapperClassName, containerClassName, variant, size = "medium", table, enableRowSelection = false, enableSelectAll = false, isLoading = false, loading, loadingComponent, emptyComponent, enableHorizontalScroll = false, stickyHeader = false,
|
|
4334
|
+
function TableComponent({ className, wrapperClassName, containerClassName, variant, size = "medium", table, enableRowSelection = false, enableSelectAll = false, isLoading = false, loading, loadingComponent, emptyComponent, enableHorizontalScroll = false, stickyHeader = false, showRowHover = true, onRowClick, rowClassName, headerClassName, cellClassName, showHeaderBackground = true, loadingSkeletonRows, loadingSkeletonHeight, columnWidths, columnMinWidths, columnMaxWidths, ...props }, ref) {
|
|
4300
4335
|
// ==================== Computed Values ====================
|
|
4301
4336
|
const hasData = table.getRowModel().rows?.length > 0;
|
|
4302
4337
|
const headerGroups = table.getHeaderGroups();
|
|
@@ -4315,13 +4350,6 @@ function TableComponent({ className, wrapperClassName, containerClassName, varia
|
|
|
4315
4350
|
maxWidth: normalizeSizeValue(maxWidth),
|
|
4316
4351
|
};
|
|
4317
4352
|
}, [columnWidths, columnMinWidths, columnMaxWidths]);
|
|
4318
|
-
const containerStyle = React.useMemo(() => {
|
|
4319
|
-
if (!maxHeight)
|
|
4320
|
-
return undefined;
|
|
4321
|
-
return {
|
|
4322
|
-
maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight,
|
|
4323
|
-
};
|
|
4324
|
-
}, [maxHeight]);
|
|
4325
4353
|
// Resolve loading state: prefer 'loading' prop, fallback to 'isLoading' for backward compatibility
|
|
4326
4354
|
const resolvedLoading = typeof loading === "boolean" ? loading : Boolean(isLoading);
|
|
4327
4355
|
const skeletonRowCount = loadingSkeletonRows ?? 5;
|
|
@@ -4380,7 +4408,7 @@ function TableComponent({ className, wrapperClassName, containerClassName, varia
|
|
|
4380
4408
|
return renderDefaultEmptyState({ colSpan: table.getAllColumns().length });
|
|
4381
4409
|
};
|
|
4382
4410
|
// ==================== Render ====================
|
|
4383
|
-
return (jsx("div", { ref: ref, className: cn("w-full", wrapperClassName), ...props, children: jsx("div", { className: cn("relative", enableHorizontalScroll ? "overflow-x-auto" : "overflow-x-hidden",
|
|
4411
|
+
return (jsx("div", { ref: ref, className: cn("w-full", wrapperClassName), ...props, children: jsx("div", { className: cn("relative", enableHorizontalScroll ? "overflow-x-auto" : "overflow-x-hidden", containerClassName), 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 }))] }) }) }));
|
|
4384
4412
|
}
|
|
4385
4413
|
// ==================== Export ====================
|
|
4386
4414
|
const Table = React.forwardRef(TableComponent);
|