@indico-data/design-system 2.34.3 → 2.34.4

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
@@ -940,8 +940,10 @@ interface LabelProps {
940
940
  interface BaseInputProps {
941
941
  value?: string | undefined;
942
942
  placeholder?: string;
943
- onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
944
943
  isDisabled?: boolean;
944
+ onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
945
+ onBlur?: (e: React$1.FocusEvent<HTMLInputElement>) => void;
946
+ onKeyDown?: (e: React$1.KeyboardEvent<HTMLInputElement>) => void;
945
947
  errorMessage?: string | undefined;
946
948
  helpText?: string;
947
949
  iconName?: IconName$1;
@@ -1015,6 +1017,8 @@ interface PasswordInputProps extends LabelProps {
1015
1017
  value?: string | undefined;
1016
1018
  placeholder?: string;
1017
1019
  onChange: (e: React$1.ChangeEvent<HTMLInputElement>) => void;
1020
+ onBlur?: (e: React$1.FocusEvent<HTMLInputElement>) => void;
1021
+ onKeyDown?: (e: React$1.KeyboardEvent<HTMLInputElement>) => void;
1018
1022
  isDisabled?: boolean;
1019
1023
  errorMessage?: string | undefined;
1020
1024
  helpText?: string;
package/lib/index.esm.js CHANGED
@@ -20964,7 +20964,7 @@ const DisplayFormError = ({ message }) => {
20964
20964
  };
20965
20965
 
20966
20966
  const Input = React__default.forwardRef((_a, ref) => {
20967
- var { name, placeholder, onChange, isRequired, isDisabled, isClearable, errorMessage, helpText, iconName, className } = _a, rest = __rest$1(_a, ["name", "placeholder", "onChange", "isRequired", "isDisabled", "isClearable", "errorMessage", "helpText", "iconName", "className"]);
20967
+ var { name, placeholder, isRequired, isDisabled, isClearable, errorMessage, helpText, iconName, onChange, onBlur, onKeyDown, className } = _a, rest = __rest$1(_a, ["name", "placeholder", "isRequired", "isDisabled", "isClearable", "errorMessage", "helpText", "iconName", "onChange", "onBlur", "onKeyDown", "className"]);
20968
20968
  const hasErrors = errorMessage && errorMessage.length > 0;
20969
20969
  const handleClear = () => {
20970
20970
  onChange({ target: { value: '' } });
@@ -20973,7 +20973,7 @@ const Input = React__default.forwardRef((_a, ref) => {
20973
20973
  error: hasErrors,
20974
20974
  'input--has-icon': iconName,
20975
20975
  }, className);
20976
- 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, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, placeholder: placeholder, onChange: onChange, 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 }))] }));
20976
+ 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, "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 }))] }));
20977
20977
  });
20978
20978
  const LabeledInput = withLabel(Input);
20979
20979
 
@@ -21001,7 +21001,7 @@ const Textarea = React__default.forwardRef((_a, ref) => {
21001
21001
  const LabeledTextarea = withLabel(Textarea);
21002
21002
 
21003
21003
  const PasswordInput = React__default.forwardRef((_a, ref) => {
21004
- var { name, placeholder, onChange, isRequired, isDisabled, errorMessage, helpText, hasShowPassword = true } = _a, rest = __rest$1(_a, ["name", "placeholder", "onChange", "isRequired", "isDisabled", "errorMessage", "helpText", "hasShowPassword"]);
21004
+ var { name, placeholder, onChange, onBlur, onKeyDown, isRequired, isDisabled, errorMessage, helpText, hasShowPassword = true } = _a, rest = __rest$1(_a, ["name", "placeholder", "onChange", "onBlur", "onKeyDown", "isRequired", "isDisabled", "errorMessage", "helpText", "hasShowPassword"]);
21005
21005
  const hasErrors = errorMessage && errorMessage.length > 0;
21006
21006
  const [showPassword, setShowPassword] = useState(false);
21007
21007
  const handleShowPassword = () => {
@@ -21010,7 +21010,7 @@ const PasswordInput = React__default.forwardRef((_a, ref) => {
21010
21010
  const inputClasses = classNames('password-input', {
21011
21011
  error: hasErrors,
21012
21012
  }, 'password-input--has-icon');
21013
- return (jsxs(Fragment, { children: [jsxs("div", { className: "password-input-wrapper", children: [jsx(Icon, { name: "lock", "data-testid": `${name}-embedded-icon`, className: "embedded-icon" }), jsx("input", Object.assign({ ref: ref, "data-testid": `form-password-input-${name}`, name: name, type: showPassword ? 'text' : 'password', disabled: isDisabled, placeholder: placeholder, onChange: onChange, className: inputClasses, "aria-invalid": hasErrors ? 'true' : 'false', "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), hasShowPassword && (jsx(Icon, { name: showPassword ? 'fa-eye-slash' : 'eye', "data-testid": `${name}-${showPassword ? 'hide' : 'show'}-password-icon`, size: "md", onClick: handleShowPassword, className: "toggle-show-password-icon" }))] }), hasErrors && jsx(DisplayFormError, { message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
21013
+ return (jsxs(Fragment, { children: [jsxs("div", { className: "password-input-wrapper", children: [jsx(Icon, { name: "lock", "data-testid": `${name}-embedded-icon`, className: "embedded-icon" }), jsx("input", Object.assign({ ref: ref, "data-testid": `form-password-input-${name}`, name: name, type: showPassword ? 'text' : 'password', disabled: isDisabled, placeholder: placeholder, onChange: onChange, onBlur: onBlur, onKeyDown: onKeyDown, className: inputClasses, "aria-invalid": hasErrors ? 'true' : 'false', "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired }, rest)), hasShowPassword && (jsx(Icon, { name: showPassword ? 'fa-eye-slash' : 'eye', "data-testid": `${name}-${showPassword ? 'hide' : 'show'}-password-icon`, size: "md", onClick: handleShowPassword, className: "toggle-show-password-icon" }))] }), hasErrors && jsx(DisplayFormError, { message: errorMessage }), helpText && (jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
21014
21014
  });
21015
21015
  const LabeledPasswordInput = withLabel(PasswordInput);
21016
21016