@indico-data/design-system 2.38.0 → 2.39.0
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/lib/index.d.ts
CHANGED
|
@@ -909,6 +909,7 @@ interface BaseInputProps {
|
|
|
909
909
|
value?: string | undefined;
|
|
910
910
|
placeholder?: string;
|
|
911
911
|
isDisabled?: boolean;
|
|
912
|
+
readonly?: boolean;
|
|
912
913
|
onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
|
|
913
914
|
onBlur?: (e: React$1.FocusEvent<HTMLInputElement>) => void;
|
|
914
915
|
onKeyDown?: (e: React$1.KeyboardEvent<HTMLInputElement>) => void;
|
package/lib/index.esm.js
CHANGED
|
@@ -20970,7 +20970,7 @@ const DisplayFormError = ({ message }) => {
|
|
|
20970
20970
|
};
|
|
20971
20971
|
|
|
20972
20972
|
const Input = React__default.forwardRef((_a, ref) => {
|
|
20973
|
-
var { id, name, placeholder, isRequired, isDisabled, isClearable, errorMessage, helpText, iconName, onChange, onBlur, onKeyDown, className } = _a, rest = __rest(_a, ["id", "name", "placeholder", "isRequired", "isDisabled", "isClearable", "errorMessage", "helpText", "iconName", "onChange", "onBlur", "onKeyDown", "className"]);
|
|
20973
|
+
var { id, name, placeholder, isRequired, isDisabled, readonly, isClearable, errorMessage, helpText, iconName, onChange, onBlur, onKeyDown, className } = _a, rest = __rest(_a, ["id", "name", "placeholder", "isRequired", "isDisabled", "readonly", "isClearable", "errorMessage", "helpText", "iconName", "onChange", "onBlur", "onKeyDown", "className"]);
|
|
20974
20974
|
const hasErrors = errorMessage && errorMessage.length > 0;
|
|
20975
20975
|
const handleClear = () => {
|
|
20976
20976
|
onChange({ target: { value: '' } });
|
|
@@ -20979,7 +20979,7 @@ const Input = React__default.forwardRef((_a, ref) => {
|
|
|
20979
20979
|
error: hasErrors,
|
|
20980
20980
|
'input--has-icon': iconName,
|
|
20981
20981
|
}, className);
|
|
20982
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: "input-wrapper", children: [iconName && (jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsx("input", Object.assign({ ref: ref, id: id, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, placeholder: placeholder, onChange: onChange, onBlur: onBlur, onKeyDown: onKeyDown, className: inputClasses, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), isClearable && !isDisabled && (jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsx(DisplayFormError, { message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
20982
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: "input-wrapper", children: [iconName && (jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsx("input", Object.assign({ ref: ref, id: id, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, placeholder: placeholder, readOnly: readonly, onChange: onChange, onBlur: onBlur, onKeyDown: onKeyDown, className: inputClasses, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), isClearable && !isDisabled && (jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsx(DisplayFormError, { message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
20983
20983
|
});
|
|
20984
20984
|
const LabeledInput = withLabel(Input);
|
|
20985
20985
|
|