@indico-data/design-system 2.11.0 → 2.12.1

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.js CHANGED
@@ -18705,6 +18705,39 @@ const PasswordInput = e__namespace.default.forwardRef((_a, ref) => {
18705
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
18706
  });
18707
18707
 
18708
+ const OptionComponent = (_a) => {
18709
+ var _b, _c, _d;
18710
+ var props = __rest$1(_a, []);
18711
+ return (jsxRuntime.jsx(ReactSelect.components.Option, Object.assign({}, props, { children: jsxRuntime.jsxs("div", { className: "select__items", children: [jsxRuntime.jsx("div", { className: "select__item-value", children: (_b = props === null || props === void 0 ? void 0 : props.data) === null || _b === void 0 ? void 0 : _b.label }), ((_c = props === null || props === void 0 ? void 0 : props.data) === null || _c === void 0 ? void 0 : _c.detail) && jsxRuntime.jsx("div", { className: "select__item-detail", children: (_d = props === null || props === void 0 ? void 0 : props.data) === null || _d === void 0 ? void 0 : _d.detail })] }) })));
18712
+ };
18713
+ const Select$1 = (_a) => {
18714
+ var { classNamePrefix = 'select', className, components: customComponents } = _a, props = __rest$1(_a, ["classNamePrefix", "className", "components"]);
18715
+ const defaultComponents = {
18716
+ Option: OptionComponent,
18717
+ };
18718
+ const mergedComponents = Object.assign(Object.assign({}, defaultComponents), customComponents);
18719
+ return (jsxRuntime.jsx(ReactSelect__default.default, Object.assign({ classNamePrefix: classNamePrefix, className: y$1('select-wrapper', className), components: mergedComponents }, props)));
18720
+ };
18721
+
18722
+ const Form = (_a) => {
18723
+ var { children, onSubmit, action, method, target, autocomplete, noValidate, enctype, rel } = _a, rest = __rest$1(_a, ["children", "onSubmit", "action", "method", "target", "autocomplete", "noValidate", "enctype", "rel"]);
18724
+ const handleSubmit = (e) => {
18725
+ e.preventDefault(); // Prevent the default form submission
18726
+ // Create a FormData object, passing in the form (e.currentTarget)
18727
+ const formData = new FormData(e.currentTarget);
18728
+ // Convert FormData into a plain object
18729
+ const formObject = Array.from(formData.entries()).reduce((obj, [key, value]) => {
18730
+ obj[key] = value.toString();
18731
+ return obj;
18732
+ }, {});
18733
+ // Call the onSubmit prop, if provided, passing the form object instead of the event
18734
+ if (onSubmit) {
18735
+ onSubmit(formObject); // Modified to pass formObject instead of e
18736
+ }
18737
+ };
18738
+ return (jsxRuntime.jsx("form", Object.assign({ onSubmit: handleSubmit, action: action, method: method, target: target, autoComplete: autocomplete, noValidate: noValidate, encType: enctype, rel: rel }, rest, { children: children })));
18739
+ };
18740
+
18708
18741
  const StyledAccordion = styled__default.default.details `
18709
18742
  summary {
18710
18743
  display: inherit;
@@ -41543,6 +41576,7 @@ exports.ConfirmModal = ConfirmModal;
41543
41576
  exports.Container = Container;
41544
41577
  exports.DatePicker = DatePicker;
41545
41578
  exports.EditableInput = EditableInput;
41579
+ exports.Form = Form;
41546
41580
  exports.GlobalStyles = GlobalStyles;
41547
41581
  exports.Icon = Icon;
41548
41582
  exports.IconButton = IconButton;
@@ -41575,6 +41609,7 @@ exports.SectionBody = SectionBody;
41575
41609
  exports.SectionHeader = SectionHeader;
41576
41610
  exports.SectionTable = SectionTable;
41577
41611
  exports.Select = Select;
41612
+ exports.SelectInput = Select$1;
41578
41613
  exports.Shrug = Shrug;
41579
41614
  exports.SingleCombobox = SingleCombobox;
41580
41615
  exports.TYPOGRAPHY = typography;