infinity-ui-elements 1.8.61 → 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/components/TextField/TextField.d.ts +1 -0
- package/dist/components/TextField/TextField.d.ts.map +1 -1
- package/dist/index.esm.js +19 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/dist/lib/icons.d.ts +2 -0
- package/dist/lib/icons.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ declare const textFieldVariants: (props?: ({
|
|
|
3
3
|
size?: "medium" | "large" | "small" | null | undefined;
|
|
4
4
|
validationState?: "none" | "positive" | "negative" | null | undefined;
|
|
5
5
|
isDisabled?: boolean | null | undefined;
|
|
6
|
+
isReadOnly?: boolean | null | undefined;
|
|
6
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
8
|
export interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> {
|
|
8
9
|
label?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,QAAA,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,QAAA,MAAM,iBAAiB;;;;;mFAiDtB,CAAC;AAEF,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CAChE;AAED,QAAA,MAAM,SAAS,yFA0Md,CAAC;AAIF,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC"}
|
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,
|
|
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,8 +2851,6 @@ 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
|
|
2849
2855
|
focus-within:bg-white!
|
|
2850
2856
|
focus-within:ring-2
|
|
@@ -2869,11 +2875,16 @@ const textFieldVariants = cva("relative flex items-center gap-3 border rounded-l
|
|
|
2869
2875
|
cursor-not-allowed`,
|
|
2870
2876
|
false: "",
|
|
2871
2877
|
},
|
|
2878
|
+
isReadOnly: {
|
|
2879
|
+
true: "",
|
|
2880
|
+
false: "hover:border-action-outline-neutral-faded-hover hover:bg-action-fill-neutral-faded-hover",
|
|
2881
|
+
},
|
|
2872
2882
|
},
|
|
2873
2883
|
defaultVariants: {
|
|
2874
2884
|
size: "medium",
|
|
2875
2885
|
validationState: "none",
|
|
2876
2886
|
isDisabled: false,
|
|
2887
|
+
isReadOnly: false,
|
|
2877
2888
|
},
|
|
2878
2889
|
});
|
|
2879
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) => {
|
|
@@ -2923,13 +2934,14 @@ const TextField = React.forwardRef(({ label, helperText, errorText, successText,
|
|
|
2923
2934
|
size,
|
|
2924
2935
|
validationState: currentValidationState,
|
|
2925
2936
|
isDisabled,
|
|
2937
|
+
isReadOnly: props.readOnly,
|
|
2926
2938
|
}), isLoading && "text-field-loading", className), children: [prefix && (jsx("span", { className: cn("shrink-0 flex items-center", isDisabled
|
|
2927
2939
|
? "text-surface-ink-neutral-disabled"
|
|
2928
2940
|
: currentValidationState === "positive"
|
|
2929
2941
|
? "text-feedback-ink-positive-intense"
|
|
2930
2942
|
: currentValidationState === "negative"
|
|
2931
2943
|
? "text-feedback-ink-negative-subtle"
|
|
2932
|
-
: "text-surface-ink-neutral-muted"), children: prefix })), jsx("input", { ref: ref, value: inputValue, onChange: handleChange, disabled: isDisabled, required: isRequired, className: cn("
|
|
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
|
|
2933
2945
|
? "text-surface-ink-neutral-disabled"
|
|
2934
2946
|
: currentValidationState === "positive"
|
|
2935
2947
|
? "text-feedback-ink-positive-intense"
|
|
@@ -3105,7 +3117,7 @@ const Select = React.forwardRef(({ className, options = [], value: controlledVal
|
|
|
3105
3117
|
// Build the suffix: include both the optional suffix and the chevron icon
|
|
3106
3118
|
const chevronIcon = (jsx(Icon, { name: isOpen ? "chevronUp" : "chevronDown", size: 16, className: "shrink-0 transition-colors" }));
|
|
3107
3119
|
const displaySuffix = suffix ? (jsxs(Fragment, { children: [suffix, chevronIcon] })) : (chevronIcon);
|
|
3108
|
-
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"
|
|
3109
3121
|
? "top-full mt-1"
|
|
3110
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 }) }))] }));
|
|
3111
3123
|
});
|
|
@@ -3227,12 +3239,12 @@ const Pagination = React.forwardRef(({ className, currentPage: controlledCurrent
|
|
|
3227
3239
|
return [];
|
|
3228
3240
|
};
|
|
3229
3241
|
const pageNumbers = getPageNumbers();
|
|
3230
|
-
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(
|
|
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 ? (
|
|
3231
3243
|
// Show page dropdown selector
|
|
3232
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] })] })) : (
|
|
3233
3245
|
// Show numbered page buttons
|
|
3234
3246
|
showPageNumber &&
|
|
3235
|
-
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(
|
|
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 }))] })] }));
|
|
3236
3248
|
});
|
|
3237
3249
|
Pagination.displayName = "Pagination";
|
|
3238
3250
|
|