@indico-data/design-system 2.9.0 → 2.11.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.css +119 -8
- package/lib/index.d.ts +52 -8
- package/lib/index.esm.css +119 -8
- package/lib/index.esm.js +35 -19
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +36 -18
- package/lib/index.js.map +1 -1
- package/lib/src/components/forms/checkbox/Checkbox.d.ts +2 -1
- package/lib/src/components/forms/form/Form.d.ts +14 -0
- package/lib/src/components/forms/form/Form.stories.d.ts +8 -0
- package/lib/src/components/forms/input/Input.d.ts +5 -4
- package/lib/src/components/forms/passwordInput/PasswordInput.d.ts +17 -0
- package/lib/src/components/forms/passwordInput/PasswordInput.stories.d.ts +11 -0
- package/lib/src/components/forms/passwordInput/__tests__/PasswordInput.test.d.ts +1 -0
- package/lib/src/components/forms/passwordInput/index.d.ts +1 -0
- package/lib/src/components/forms/radio/Radio.d.ts +2 -1
- package/lib/src/components/forms/subcomponents/DisplayFormError.d.ts +5 -0
- package/lib/src/components/forms/textarea/Textarea.d.ts +4 -3
- package/lib/src/components/forms/toggle/Toggle.d.ts +2 -1
- package/lib/src/components/index.d.ts +2 -0
- package/lib/src/index.d.ts +2 -0
- package/package.json +5 -2
- package/src/components/forms/checkbox/Checkbox.stories.tsx +2 -2
- package/src/components/forms/checkbox/Checkbox.tsx +32 -41
- package/src/components/forms/form/Form.mdx +134 -0
- package/src/components/forms/form/Form.stories.tsx +413 -0
- package/src/components/forms/form/Form.tsx +64 -0
- package/src/components/forms/form/__tests__/Form.test.tsx +35 -0
- package/src/components/forms/form/index.ts +0 -0
- package/src/components/forms/form/styles/Form.scss +3 -0
- package/src/components/forms/input/Input.stories.tsx +0 -5
- package/src/components/forms/input/Input.tsx +67 -64
- package/src/components/forms/input/__tests__/Input.test.tsx +2 -13
- package/src/components/forms/input/styles/Input.scss +2 -8
- package/src/components/forms/passwordInput/PasswordInput.mdx +28 -0
- package/src/components/forms/passwordInput/PasswordInput.stories.tsx +268 -0
- package/src/components/forms/passwordInput/PasswordInput.tsx +86 -0
- package/src/components/forms/passwordInput/__tests__/PasswordInput.test.tsx +129 -0
- package/src/components/forms/passwordInput/index.ts +1 -0
- package/src/components/forms/passwordInput/styles/PasswordInput.scss +120 -0
- package/src/components/forms/radio/Radio.tsx +32 -35
- package/src/components/forms/subcomponents/DisplayFormError.tsx +7 -0
- package/src/components/forms/textarea/Textarea.stories.tsx +15 -21
- package/src/components/forms/textarea/Textarea.tsx +64 -62
- package/src/components/forms/textarea/__tests__/Textarea.test.tsx +1 -1
- package/src/components/forms/textarea/styles/Textarea.scss +1 -1
- package/src/components/forms/toggle/Toggle.tsx +30 -37
- package/src/components/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/styles/index.scss +2 -0
- package/lib/src/components/forms/subcomponents/ErrorList.d.ts +0 -6
- package/src/components/forms/subcomponents/ErrorList.tsx +0 -14
- package/src/components/forms/subcomponents/__tests__/ErrorList.test.tsx +0 -16
- /package/lib/src/components/forms/{subcomponents/__tests__/ErrorList.test.d.ts → form/__tests__/Form.test.d.ts} +0 -0
package/lib/index.js
CHANGED
|
@@ -18661,33 +18661,49 @@ const Label = ({ label, name, isRequired, hasHiddenLabel }) => {
|
|
|
18661
18661
|
return (jsxRuntime.jsx("div", { "data-testid": `${name}-testId`, className: `form-label ${hasHiddenLabel ? 'is-visually-hidden' : ''}`, children: jsxRuntime.jsxs("label", { htmlFor: `${name}`, children: [label, isRequired ? jsxRuntime.jsx("span", { className: "text-error", children: " *" }) : ''] }) }));
|
|
18662
18662
|
};
|
|
18663
18663
|
|
|
18664
|
-
const
|
|
18665
|
-
return
|
|
18664
|
+
const DisplayFormError = ({ message }) => {
|
|
18665
|
+
return jsxRuntime.jsx("p", { className: "form-errors", children: message });
|
|
18666
18666
|
};
|
|
18667
18667
|
|
|
18668
|
-
const Input = (_a) => {
|
|
18669
|
-
var {
|
|
18670
|
-
const hasErrors =
|
|
18668
|
+
const Input = e__namespace.default.forwardRef((_a, ref) => {
|
|
18669
|
+
var { label, name, placeholder, onChange, isRequired, isDisabled, isClearable, errorMessage, helpText, iconName, hasHiddenLabel, className } = _a, rest = __rest$1(_a, ["label", "name", "placeholder", "onChange", "isRequired", "isDisabled", "isClearable", "errorMessage", "helpText", "iconName", "hasHiddenLabel", "className"]);
|
|
18670
|
+
const hasErrors = errorMessage && errorMessage.length > 0;
|
|
18671
18671
|
const handleClear = () => {
|
|
18672
18672
|
onChange({ target: { value: '' } });
|
|
18673
18673
|
};
|
|
18674
|
-
return (jsxRuntime.jsxs("div", { className: "form-control", children: [jsxRuntime.jsx(Label, { label: label, name: name, isRequired: isRequired, hasHiddenLabel: hasHiddenLabel }), jsxRuntime.jsxs("div", { className: "input-wrapper", children: [iconName && (jsxRuntime.jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsxRuntime.jsx("input", Object.assign({ ref: ref, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled,
|
|
18675
|
-
};
|
|
18674
|
+
return (jsxRuntime.jsxs("div", { className: "form-control", children: [jsxRuntime.jsx(Label, { label: label, name: name, isRequired: isRequired, hasHiddenLabel: hasHiddenLabel }), jsxRuntime.jsxs("div", { className: "input-wrapper", children: [iconName && (jsxRuntime.jsx(Icon, { name: iconName, "data-testid": `${name}-embedded-icon`, className: "embedded-icon" })), jsxRuntime.jsx("input", Object.assign({ ref: ref, "data-testid": `form-input-${name}`, name: name, type: "text", disabled: isDisabled, placeholder: placeholder, onChange: onChange, className: `input ${hasErrors ? 'error' : ''} ${iconName ? 'input--has-icon' : ''} ${className}`, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired, "aria-label": label }, rest)), isClearable && (jsxRuntime.jsx(Icon, { name: "x-close", "data-testid": `${name}-clearable-icon`, size: "sm", onClick: handleClear, className: "clearable-icon" }))] }), hasErrors && jsxRuntime.jsx(DisplayFormError, { message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
18675
|
+
});
|
|
18676
18676
|
|
|
18677
|
-
const Radio$2 = (_a) => {
|
|
18678
|
-
var {
|
|
18679
|
-
return (jsxRuntime.jsx("div", { className: "form-control", children: jsxRuntime.jsxs("div", { className: "radio-wrapper", children: [jsxRuntime.jsx("input", Object.assign({ "data-testid": `form-radio-input-${name}
|
|
18680
|
-
};
|
|
18677
|
+
const Radio$2 = e__namespace.default.forwardRef((_a, ref) => {
|
|
18678
|
+
var { id, label, name, value, onChange, isDisabled } = _a, rest = __rest$1(_a, ["id", "label", "name", "value", "onChange", "isDisabled"]);
|
|
18679
|
+
return (jsxRuntime.jsx("div", { className: "form-control", children: jsxRuntime.jsxs("div", { className: "radio-wrapper", children: [jsxRuntime.jsx("input", Object.assign({ "data-testid": `form-radio-input-${name}`, className: "radio-input", type: "radio", id: id, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsxRuntime.jsx("label", { htmlFor: id, className: "radio-input-label", "data-testid": `label-radio-input-${name}`, children: label })] }) }));
|
|
18680
|
+
});
|
|
18681
18681
|
|
|
18682
|
-
const Checkbox = (_a) => {
|
|
18683
|
-
var {
|
|
18684
|
-
return (jsxRuntime.jsx("div", { className: "form-control", children: jsxRuntime.jsxs("div", { className: "checkbox-wrapper", children: [jsxRuntime.jsx("input", Object.assign({ "data-testid": `form-checkbox-input-${name}`, className: "checkbox-input", type: "checkbox", id: id,
|
|
18685
|
-
};
|
|
18682
|
+
const Checkbox = e__namespace.default.forwardRef((_a, ref) => {
|
|
18683
|
+
var { id, label, name, value, onChange, isDisabled, isChecked = false } = _a, rest = __rest$1(_a, ["id", "label", "name", "value", "onChange", "isDisabled", "isChecked"]);
|
|
18684
|
+
return (jsxRuntime.jsx("div", { className: "form-control", children: jsxRuntime.jsxs("div", { className: "checkbox-wrapper", children: [jsxRuntime.jsx("input", Object.assign({ "data-testid": `form-checkbox-input-${name}`, className: "checkbox-input", type: "checkbox", id: id, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsxRuntime.jsx("label", { htmlFor: id, className: "checkbox-input-label", "data-testid": `label-checkbox-input-${name}`, children: label })] }) }));
|
|
18685
|
+
});
|
|
18686
18686
|
|
|
18687
|
-
const Toggle$1 = (_a) => {
|
|
18688
|
-
var {
|
|
18687
|
+
const Toggle$1 = e__namespace.default.forwardRef((_a, ref) => {
|
|
18688
|
+
var { id, label, name, value, onChange, isDisabled, isChecked } = _a, rest = __rest$1(_a, ["id", "label", "name", "value", "onChange", "isDisabled", "isChecked"]);
|
|
18689
18689
|
return (jsxRuntime.jsx("div", { className: "form-control", children: jsxRuntime.jsxs("div", { className: "toggle-wrapper", children: [jsxRuntime.jsx("input", Object.assign({ "data-testid": `form-toggle-input-${name}`, className: "toggle-input", type: "checkbox", id: id, checked: isChecked, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsxRuntime.jsx("label", { htmlFor: id, className: "switch" }), jsxRuntime.jsx("label", { className: 'toggle-label', htmlFor: id, children: label })] }) }));
|
|
18690
|
-
};
|
|
18690
|
+
});
|
|
18691
|
+
|
|
18692
|
+
const Textarea = e__namespace.default.forwardRef((_a, ref) => {
|
|
18693
|
+
var { label, name, placeholder, value, onChange, isRequired, isDisabled, errorMessage, helpText, hasHiddenLabel, rows, cols, readonly, wrap, form, maxLength, autofocus } = _a, rest = __rest$1(_a, ["label", "name", "placeholder", "value", "onChange", "isRequired", "isDisabled", "errorMessage", "helpText", "hasHiddenLabel", "rows", "cols", "readonly", "wrap", "form", "maxLength", "autofocus"]);
|
|
18694
|
+
const hasErrors = errorMessage && errorMessage.length > 0;
|
|
18695
|
+
return (jsxRuntime.jsxs("div", { className: "form-control", children: [jsxRuntime.jsx(Label, { label: label, name: name, isRequired: isRequired, hasHiddenLabel: hasHiddenLabel }), jsxRuntime.jsx("div", { className: "textarea-wrapper", children: jsxRuntime.jsx("textarea", Object.assign({ ref: ref, rows: rows, cols: cols, autoFocus: autofocus, wrap: wrap, form: form, maxLength: maxLength, readOnly: readonly, "data-testid": `form-textarea-${name}`, name: name, disabled: isDisabled, placeholder: placeholder, onChange: onChange, className: `textarea ${hasErrors ? 'error' : ''}`, "aria-invalid": hasErrors ? true : undefined, "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired, "aria-label": label }, rest)) }), hasErrors && jsxRuntime.jsx(DisplayFormError, { message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
18696
|
+
});
|
|
18697
|
+
|
|
18698
|
+
const PasswordInput = e__namespace.default.forwardRef((_a, ref) => {
|
|
18699
|
+
var { label, name, placeholder, onChange, isRequired, isDisabled, errorMessage, helpText, hasHiddenLabel, hasShowPassword = true } = _a, rest = __rest$1(_a, ["label", "name", "placeholder", "onChange", "isRequired", "isDisabled", "errorMessage", "helpText", "hasHiddenLabel", "hasShowPassword"]);
|
|
18700
|
+
const hasErrors = errorMessage && errorMessage.length > 0;
|
|
18701
|
+
const [showPassword, setShowPassword] = e.useState(false);
|
|
18702
|
+
const handleShowPassword = () => {
|
|
18703
|
+
setShowPassword((prevShowPassword) => !prevShowPassword);
|
|
18704
|
+
};
|
|
18705
|
+
return (jsxRuntime.jsxs("div", { className: "form-control", children: [jsxRuntime.jsx(Label, { label: label, name: name, isRequired: isRequired, hasHiddenLabel: hasHiddenLabel }), jsxRuntime.jsxs("div", { className: "password-input-wrapper", children: [jsxRuntime.jsx(Icon, { name: "lock", "data-testid": `${name}-embedded-icon`, className: "embedded-icon" }), jsxRuntime.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: `password-input ${hasErrors ? 'error' : ''} password-input--has-icon`, "aria-invalid": hasErrors ? 'true' : 'false', "aria-describedby": hasErrors || helpText ? `${name}-helper` : undefined, "aria-required": isRequired, "aria-label": label }, rest)), hasShowPassword && (jsxRuntime.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 && jsxRuntime.jsx(DisplayFormError, { message: errorMessage }), helpText && (jsxRuntime.jsx("div", { "data-testid": `${name}-help-text`, className: "help-text", id: `${name}-helper`, children: helpText }))] }));
|
|
18706
|
+
});
|
|
18691
18707
|
|
|
18692
18708
|
const StyledAccordion = styled__default.default.details `
|
|
18693
18709
|
summary {
|
|
@@ -41544,6 +41560,7 @@ exports.NoInputDatePicker = NoInputDatePicker;
|
|
|
41544
41560
|
exports.NumberInput = NumberInput;
|
|
41545
41561
|
exports.PADDINGS = padding;
|
|
41546
41562
|
exports.Pagination = Pagination;
|
|
41563
|
+
exports.PasswordInput = PasswordInput;
|
|
41547
41564
|
exports.PercentageRing = PercentageRing;
|
|
41548
41565
|
exports.Radio = Radio;
|
|
41549
41566
|
exports.RadioGroup = RadioGroup;
|
|
@@ -41564,6 +41581,7 @@ exports.TYPOGRAPHY = typography;
|
|
|
41564
41581
|
exports.Table = Table$1;
|
|
41565
41582
|
exports.TextInput = TextInput;
|
|
41566
41583
|
exports.TextTruncate = TextTruncate;
|
|
41584
|
+
exports.Textarea = Textarea;
|
|
41567
41585
|
exports.Toggle = Toggle;
|
|
41568
41586
|
exports.ToggleInput = Toggle$1;
|
|
41569
41587
|
exports.Tooltip = Tooltip;
|