@trackunit/react-form-components 0.0.500 → 0.0.502

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.
Files changed (55) hide show
  1. package/index.cjs.js +255 -230
  2. package/index.esm.js +235 -196
  3. package/package.json +6 -5
  4. package/src/components/ActionButton/ActionButton.d.ts +1 -2
  5. package/src/components/BaseInput/DisabledForReasonsTip.d.ts +1 -2
  6. package/src/components/Checkbox/CheckIcon.d.ts +1 -2
  7. package/src/components/Checkbox/IndeterminateIcon.d.ts +1 -2
  8. package/src/components/DateField/DateField.d.ts +0 -1
  9. package/src/components/DateInput/DateInput.d.ts +0 -1
  10. package/src/components/DropZone/DropZone.d.ts +0 -1
  11. package/src/components/DropZone/DropZoneDefaultLabel.d.ts +1 -2
  12. package/src/components/FormGroup/FormGroup.d.ts +1 -1
  13. package/src/components/NumberField/NumberField.d.ts +0 -1
  14. package/src/components/NumberInput/NumberInput.d.ts +0 -1
  15. package/src/components/PasswordField/PasswordField.d.ts +0 -1
  16. package/src/components/PasswordInput/PasswordInput.d.ts +0 -1
  17. package/src/components/PhoneField/PhoneField.d.ts +0 -1
  18. package/src/components/PhoneFieldWithController/PhoneFieldWithController.d.ts +0 -1
  19. package/src/components/PhoneInput/CountryCodeSelect.d.ts +1 -1
  20. package/src/components/Schedule/Schedule.d.ts +1 -2
  21. package/src/components/Select/CreatableSelect.d.ts +1 -2
  22. package/src/components/Select/FieldContainer.d.ts +1 -1
  23. package/src/components/Select/Select.d.ts +1 -2
  24. package/src/components/Select/SelectMenuItem/SelectMenuItem.d.ts +2 -2
  25. package/src/components/Select/TagWithWidth.d.ts +1 -2
  26. package/src/components/Select/TagsContainer.d.ts +1 -2
  27. package/src/components/SelectField/CreatableSelectField.d.ts +6 -7
  28. package/src/components/SelectField/FormFieldSelectAdapter.d.ts +0 -1
  29. package/src/components/SelectField/SelectField.d.ts +6 -7
  30. package/src/components/TextField/TextLenghtIndicator.d.ts +1 -2
  31. package/src/components/TextInput/TextInput.d.ts +0 -1
  32. package/src/components/TimeRange/TimeRange.d.ts +1 -1
  33. package/src/components/TimeRangeField/TimeRangeField.d.ts +1 -2
  34. package/src/components/UploadField/UploadField.d.ts +0 -1
  35. package/src/components/UploadInput/UploadInput.d.ts +0 -1
  36. package/src/components/UrlField/UrlField.d.ts +0 -1
  37. package/src/components/UrlInput/UrlInput.d.ts +0 -1
  38. package/src/translation.d.ts +1 -2
  39. package/translation.cjs.js +1 -1
  40. package/translation.cjs10.js +1 -1
  41. package/translation.cjs11.js +1 -1
  42. package/translation.cjs12.js +1 -1
  43. package/translation.cjs13.js +1 -1
  44. package/translation.cjs14.js +1 -1
  45. package/translation.cjs15.js +1 -1
  46. package/translation.cjs16.js +1 -1
  47. package/translation.cjs17.js +1 -1
  48. package/translation.cjs2.js +1 -1
  49. package/translation.cjs3.js +1 -1
  50. package/translation.cjs4.js +1 -1
  51. package/translation.cjs5.js +1 -1
  52. package/translation.cjs6.js +1 -1
  53. package/translation.cjs7.js +1 -1
  54. package/translation.cjs8.js +1 -1
  55. package/translation.cjs9.js +1 -1
package/index.esm.js CHANGED
@@ -73,7 +73,7 @@ const useTranslation = () => useNamespaceTranslation(namespace);
73
73
  /**
74
74
  * Trans for this specific library.
75
75
  */
76
- const Trans = (props) => (jsx(NamespaceTrans, Object.assign({}, props, { namespace: namespace })));
76
+ const Trans = (props) => (jsx(NamespaceTrans, { ...props, namespace: namespace }));
77
77
  /**
78
78
  * Registers the translations for this library
79
79
  */
@@ -139,48 +139,6 @@ const ActionButton = ({ type, value, dataTestId, iconSize, disabled, className }
139
139
  return (jsx("div", { className: cvaActionContainer({ className }), children: jsx(IconButton, { className: cvaActionButton({ size: iconSize }), dataTestId: dataTestId || "testIconButtonId", disabled: disabled, icon: jsx(Icon, { name: getIconName(), size: "small" }), onClick: ButtonAction, size: "small", variant: "secondary" }) }));
140
140
  };
141
141
 
142
- /******************************************************************************
143
- Copyright (c) Microsoft Corporation.
144
-
145
- Permission to use, copy, modify, and/or distribute this software for any
146
- purpose with or without fee is hereby granted.
147
-
148
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
149
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
150
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
151
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
152
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
153
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
154
- PERFORMANCE OF THIS SOFTWARE.
155
- ***************************************************************************** */
156
-
157
- function __rest(s, e) {
158
- var t = {};
159
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
160
- t[p] = s[p];
161
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
162
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
163
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
164
- t[p[i]] = s[p[i]];
165
- }
166
- return t;
167
- }
168
-
169
- function __awaiter(thisArg, _arguments, P, generator) {
170
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
171
- return new (P || (P = Promise))(function (resolve, reject) {
172
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
173
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
174
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
175
- step((generator = generator.apply(thisArg, _arguments || [])).next());
176
- });
177
- }
178
-
179
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
180
- var e = new Error(message);
181
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
182
- };
183
-
184
142
  /**
185
143
  * Used to compare two React nodes for deep equality.
186
144
  */
@@ -379,9 +337,8 @@ const DisabledForReasonsTip = ({ reasons, kind }) => {
379
337
  * For specific input types make sure to use the corresponding input component.
380
338
  * This is a base used by our other input components such as TextInput, NumberInput, PasswordInput, etc.
381
339
  */
382
- const BaseInput = React.forwardRef((_a, ref) => {
383
- var _b;
384
- var { className, isInvalid, dataTestId, prefix, suffix, addonBefore, addonAfter, actions, fieldSize = "medium", nonInteractive = false, showDefaultActions = false, inputClassName, placeholder, addonBeforeClassName } = _a, rest = __rest(_a, ["className", "isInvalid", "dataTestId", "prefix", "suffix", "addonBefore", "addonAfter", "actions", "fieldSize", "nonInteractive", "showDefaultActions", "inputClassName", "placeholder", "addonBeforeClassName"]);
340
+ const BaseInput = React.forwardRef(({ className, isInvalid, dataTestId, prefix, suffix, addonBefore, addonAfter, actions, fieldSize = "medium", nonInteractive = false, showDefaultActions = false, inputClassName, placeholder, addonBeforeClassName, ...rest }, ref) => {
341
+ var _a;
385
342
  const renderAsDisabled = Boolean(rest.disabled) || rest.readOnly;
386
343
  const innerRef = React.useRef(null);
387
344
  // eslint-disable-next-line local-rules/no-typescript-assertion
@@ -394,22 +351,22 @@ const BaseInput = React.forwardRef((_a, ref) => {
394
351
  }), "data-testid": dataTestId ? `${dataTestId}-container` : null, children: [addonBefore ? (jsx("div", { className: cvaInputAddonBefore({ className: addonBeforeClassName }), "data-testid": dataTestId ? `${dataTestId}-addonBefore` : null, children: addonBefore })) : null, prefix && !compareReactNodes(addonBefore, prefix) ? (jsx("div", { className: cvaInputPrefix({
395
352
  disabled: renderAsDisabled,
396
353
  addonBefore: addonBefore !== undefined,
397
- }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, children: prefix })) : null, jsx("input", Object.assign({ "aria-required": rest.required, className: cvaInputField({
354
+ }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, children: prefix })) : null, jsx("input", { "aria-required": rest.required, className: cvaInputField({
398
355
  autoFocus: rest.autoFocus,
399
356
  size: fieldSize,
400
357
  disabled: renderAsDisabled,
401
358
  className: inputClassName,
402
359
  addonBefore: addonBefore !== undefined,
403
360
  prefix: !compareReactNodes(addonBefore, prefix),
404
- }), "data-testid": dataTestId, placeholder: renderAsDisabled ? undefined : placeholder, ref: innerRef }, rest, { disabled: renderAsDisabled, readOnly: rest.readOnly || nonInteractive })), typeof rest.disabled === "object" ? (jsx("div", { className: cvaInputSuffix({
361
+ }), "data-testid": dataTestId, placeholder: renderAsDisabled ? undefined : placeholder, ref: innerRef, ...rest, disabled: renderAsDisabled, readOnly: rest.readOnly || nonInteractive }), typeof rest.disabled === "object" ? (jsx("div", { className: cvaInputSuffix({
405
362
  disabled: false,
406
- }), "data-testid": dataTestId ? `${dataTestId}-locked` : undefined, children: jsx(DisabledForReasonsTip, Object.assign({}, rest.disabled)) })) : null, suffix && addonBefore !== suffix ? (jsx("div", { className: cvaInputSuffix({
363
+ }), "data-testid": dataTestId ? `${dataTestId}-locked` : undefined, children: jsx(DisabledForReasonsTip, { ...rest.disabled }) })) : null, suffix && addonBefore !== suffix ? (jsx("div", { className: cvaInputSuffix({
407
364
  disabled: renderAsDisabled,
408
365
  addonAfter: addonAfter !== undefined && !compareReactNodes(addonBefore, addonAfter),
409
366
  actions: (actions && !compareReactNodes(addonBefore, actions)) || false,
410
367
  }), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix })) : null, rest.readOnly === true &&
411
368
  showDefaultActions &&
412
- ((_b = innerRef.current) === null || _b === void 0 ? void 0 : _b.value.length) &&
369
+ ((_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.value.length) &&
413
370
  innerRef.current.value.length > 0 ? (jsx(ActionButton, { type: "COPY", value: innerRef }, "default-copy-action")) : null, actions && !compareReactNodes(addonBefore, actions) ? (jsx("div", { className: cvaInputAction({
414
371
  addonAfter: addonAfter !== undefined && !compareReactNodes(addonBefore, addonAfter),
415
372
  suffix: !compareReactNodes(addonBefore, suffix),
@@ -577,8 +534,7 @@ const IndeterminateIcon = ({ className }) => (jsx("svg", { className: className,
577
534
  * @param {CheckboxProps} props - The props for the Checkbox component
578
535
  * @returns {JSX.Element} Checkbox component
579
536
  */
580
- const Checkbox = React.forwardRef((_a, ref) => {
581
- var { className, dataTestId = "checkbox", onChange, checked = false, disabled = false, isInvalid = false, readOnly, indeterminate = false, suffix, label, tabIndex = 0, onLabelRefChange, stopPropagation } = _a, rest = __rest(_a, ["className", "dataTestId", "onChange", "checked", "disabled", "isInvalid", "readOnly", "indeterminate", "suffix", "label", "tabIndex", "onLabelRefChange", "stopPropagation"]);
537
+ const Checkbox = React.forwardRef(({ className, dataTestId = "checkbox", onChange, checked = false, disabled = false, isInvalid = false, readOnly, indeterminate = false, suffix, label, tabIndex = 0, onLabelRefChange, stopPropagation, ...rest }, ref) => {
582
538
  const icon = indeterminate ? (jsx(IndeterminateIcon, { className: cvaCheckboxIcon() })) : (checked && jsx(CheckIcon, { className: cvaCheckboxIcon() }));
583
539
  const internalRef = React.useRef(null);
584
540
  const isReadonly = disabled || readOnly;
@@ -597,7 +553,7 @@ const Checkbox = React.forwardRef((_a, ref) => {
597
553
  onLabelRefChange && labelRef && onLabelRefChange(labelRef);
598
554
  }, [labelRef, onLabelRefChange]);
599
555
  const uuid = rest.id;
600
- return (jsxs("label", { className: cvaCheckboxContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-container` : null, htmlFor: uuid, onClick: e => stopPropagation && e.stopPropagation(), onKeyDown: onKeyPress, ref: internalRef, children: [jsx("input", Object.assign({ "aria-checked": !indeterminate && checked, checked: !indeterminate && checked, className: cvaCheckboxInput(), "data-testid": dataTestId, disabled: disabled, id: uuid, onChange: onChange, readOnly: readOnly, type: "checkbox" }, rest, { ref: ref })), jsx("span", { className: cvaCheckbox({
556
+ return (jsxs("label", { className: cvaCheckboxContainer({ className }), "data-testid": dataTestId ? `${dataTestId}-container` : null, htmlFor: uuid, onClick: e => stopPropagation && e.stopPropagation(), onKeyDown: onKeyPress, ref: internalRef, children: [jsx("input", { "aria-checked": !indeterminate && checked, checked: !indeterminate && checked, className: cvaCheckboxInput(), "data-testid": dataTestId, disabled: disabled, id: uuid, onChange: onChange, readOnly: readOnly, type: "checkbox", ...rest, ref: ref }), jsx("span", { className: cvaCheckbox({
601
557
  disabled: isReadonly,
602
558
  invalid: isReadonly ? false : isInvalid,
603
559
  state: indeterminate ? "indeterminate" : checked ? "selected" : "deselected",
@@ -649,10 +605,9 @@ const FormGroup = ({ isInvalid, helpText, helpAddon, tip, className, dataTestId,
649
605
  *
650
606
  * _**Do use**_ the CheckboxField for boolean input.
651
607
  */
652
- const CheckboxField = forwardRef((_a, ref) => {
653
- var { label, id, tip, helpText, helpAddon, isInvalid, className, checked, dataTestId, checkboxLabel, onChange } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "helpAddon", "isInvalid", "className", "checked", "dataTestId", "checkboxLabel", "onChange"]);
608
+ const CheckboxField = forwardRef(({ label, id, tip, helpText, helpAddon, isInvalid, className, checked, dataTestId, checkboxLabel, onChange, ...rest }, ref) => {
654
609
  const htmlForId = id ? id : "checkboxField-" + v4();
655
- return (jsx(FormGroup, { className: "flex flex-col gap-1", dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: helpText, htmlFor: htmlForId, label: label, required: rest.required, tip: tip, children: jsx(Checkbox, Object.assign({ checked: checked, className: className, dataTestId: dataTestId, id: htmlForId, label: checkboxLabel, onChange: onChange, ref: ref }, rest)) }));
610
+ return (jsx(FormGroup, { className: "flex flex-col gap-1", dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: helpText, htmlFor: htmlForId, label: label, required: rest.required, tip: tip, children: jsx(Checkbox, { checked: checked, className: className, dataTestId: dataTestId, id: htmlForId, label: checkboxLabel, onChange: onChange, ref: ref, ...rest }) }));
656
611
  });
657
612
  CheckboxField.displayName = "CheckboxField";
658
613
 
@@ -671,8 +626,7 @@ const isValidHEXColor = (value) => {
671
626
  * ColorField validates that user enters a valid color address.
672
627
  *
673
628
  */
674
- const ColorField = forwardRef((_a, ref) => {
675
- var { label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId, value: propValue, onChange, isInvalid = false } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "helpAddon", "className", "defaultValue", "dataTestId", "value", "onChange", "isInvalid"]);
629
+ const ColorField = forwardRef(({ label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId, value: propValue, onChange, isInvalid = false, ...rest }, ref) => {
676
630
  const htmlForId = id ? id : "colorField-" + v4();
677
631
  const innerRef = React__default.useRef(null);
678
632
  // eslint-disable-next-line local-rules/no-typescript-assertion
@@ -704,12 +658,11 @@ ColorField.displayName = "ColorField";
704
658
  *
705
659
  * NOTE: If shown with a label, please use the `DateField` component instead.
706
660
  */
707
- const DateInput = forwardRef((_a, ref) => {
708
- var { min, max, defaultValue, value } = _a, rest = __rest(_a, ["min", "max", "defaultValue", "value"]);
661
+ const DateInput = forwardRef(({ min, max, defaultValue, value, ...rest }, ref) => {
709
662
  const formatDateToInputString = (date) => date instanceof Date ? format(date, "yyyy-MM-dd") : date;
710
663
  // Chrome and Firefox need their default icon to have datepicker functionality.
711
664
  const showIcon = !/Chrome/.test(navigator.userAgent) && !/Firefox/.test(navigator.userAgent);
712
- return (jsx(BaseInput, Object.assign({ defaultValue: formatDateToInputString(defaultValue), max: formatDateToInputString(max), min: formatDateToInputString(min), ref: ref, suffix: showIcon ? jsx(Icon, { dataTestId: "calendar", name: "Calendar", size: "medium", type: "solid" }) : null, type: "date", value: formatDateToInputString(value) }, rest)));
665
+ return (jsx(BaseInput, { defaultValue: formatDateToInputString(defaultValue), max: formatDateToInputString(max), min: formatDateToInputString(min), ref: ref, suffix: showIcon ? jsx(Icon, { dataTestId: "calendar", name: "Calendar", size: "medium", type: "solid" }) : null, type: "date", value: formatDateToInputString(value), ...rest }));
713
666
  });
714
667
  DateInput.displayName = "DateInput";
715
668
 
@@ -720,11 +673,10 @@ DateInput.displayName = "DateInput";
720
673
  *
721
674
  * _**Do not use**_ this fields for non-serialized dates. Use TextField instead.
722
675
  */
723
- const DateField = forwardRef((_a, ref) => {
724
- var { label, id, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "className", "defaultValue", "dataTestId"]);
676
+ const DateField = forwardRef(({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, dataTestId, ...rest }, ref) => {
725
677
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
726
678
  const htmlForId = id ? id : "dateField-" + v4();
727
- return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(DateInput, Object.assign({ "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, ref: ref }, rest, { className: className, dataTestId: dataTestId })) }));
679
+ return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(DateInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, dataTestId: dataTestId }) }));
728
680
  });
729
681
  DateField.displayName = "DateField";
730
682
 
@@ -786,8 +738,7 @@ const DropZoneDefaultLabel = () => (jsx(Trans, { components: {
786
738
  * @param {DropZoneProps} props - The props for the DropZone component
787
739
  * @returns {JSX.Element} DropZone component
788
740
  */
789
- const DropZone = (_a) => {
790
- var { className, dataTestId, filesSelected, label = jsx(DropZoneDefaultLabel, {}), size = "large", isInvalid = false, disabled = false, accept } = _a, rest = __rest(_a, ["className", "dataTestId", "filesSelected", "label", "size", "isInvalid", "disabled", "accept"]);
741
+ const DropZone = ({ className, dataTestId, filesSelected, label = jsx(DropZoneDefaultLabel, {}), size = "large", isInvalid = false, disabled = false, accept, ...rest }) => {
791
742
  const [dragActive, setDragActive] = useState(false);
792
743
  const [fileDropped, setFileDropped] = useState(false);
793
744
  const [t] = useTranslation();
@@ -831,12 +782,12 @@ const DropZone = (_a) => {
831
782
  }
832
783
  (_a = inputLabelRef.current) === null || _a === void 0 ? void 0 : _a.click();
833
784
  };
834
- return (jsxs("div", Object.assign({ className: cvaDropZone({ size, dropComplete: fileDropped, dragActive, disabled, invalid: isInvalid, className }), "data-testid": dataTestId, onClick: e => {
785
+ return (jsxs("div", { className: cvaDropZone({ size, dropComplete: fileDropped, dragActive, disabled, invalid: isInvalid, className }), "data-testid": dataTestId, onClick: e => {
835
786
  if (disabled) {
836
787
  e.preventDefault();
837
788
  e.stopPropagation();
838
789
  }
839
- }, onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop }, rest, { children: [jsx("input", { accept: accept, className: "hidden", id: "input-file-upload", onChange: handleChange, title: t("dropzone.input.title"), type: "file" }), jsxs("label", { className: cvaDropZoneLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : null, htmlFor: "input-file-upload", ref: inputLabelRef, children: [jsx("div", { className: cvaDropZoneIconBackground({ invalid: isInvalid }), children: jsx(Icon, { className: !isInvalid ? "text-gray-400" : "", color: isInvalid ? "danger" : "neutral", name: "ArrowUpCircle", type: "solid" }) }), jsx("button", { disabled: disabled, onClick: handleButtonClick, children: label })] })] })));
790
+ }, onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop, ...rest, children: [jsx("input", { accept: accept, className: "hidden", id: "input-file-upload", onChange: handleChange, title: t("dropzone.input.title"), type: "file" }), jsxs("label", { className: cvaDropZoneLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : null, htmlFor: "input-file-upload", ref: inputLabelRef, children: [jsx("div", { className: cvaDropZoneIconBackground({ invalid: isInvalid }), children: jsx(Icon, { className: !isInvalid ? "text-gray-400" : "", color: isInvalid ? "danger" : "neutral", name: "ArrowUpCircle", type: "solid" }) }), jsx("button", { disabled: disabled, onClick: handleButtonClick, children: label })] })] }));
840
791
  };
841
792
 
842
793
  // Doing the same check as we do on the backend
@@ -865,8 +816,7 @@ const validateEmailAddress = (email) => {
865
816
  * A reference to the input element is provided as the `ref` prop.
866
817
  * For specific input types make sure to use the corresponding input component.
867
818
  */
868
- const EmailInput = React.forwardRef((_a, ref) => {
869
- var { fieldSize = "medium", disabled = false, dataTestId, isInvalid = false, onChange, disableAction = false } = _a, rest = __rest(_a, ["fieldSize", "disabled", "dataTestId", "isInvalid", "onChange", "disableAction"]);
819
+ const EmailInput = React.forwardRef(({ fieldSize = "medium", disabled = false, dataTestId, isInvalid = false, onChange, disableAction = false, ...rest }, ref) => {
870
820
  const [email, setEmail] = React.useState("");
871
821
  const sendEmail = () => {
872
822
  return window.open(`mailto:${email}`);
@@ -877,7 +827,7 @@ const EmailInput = React.forwardRef((_a, ref) => {
877
827
  setEmail(newValue);
878
828
  }, [onChange]);
879
829
  const renderAsInvalid = (email && !validateEmailAddress(email)) || isInvalid;
880
- return (jsx(BaseInput, Object.assign({ actions: email && email.length > 0 ? (jsx(ActionButton, { dataTestId: dataTestId ? `${dataTestId}-emailIcon` : undefined, disabled: disableAction || isInvalid, iconSize: fieldSize, onClick: sendEmail, type: "EMAIL", value: email })) : null, dataTestId: dataTestId, disabled: disabled, isInvalid: renderAsInvalid, onChange: handleChange, placeholder: rest.placeholder || "mail@example.com", ref: ref, type: "email" }, rest)));
830
+ return (jsx(BaseInput, { actions: email && email.length > 0 ? (jsx(ActionButton, { dataTestId: dataTestId ? `${dataTestId}-emailIcon` : undefined, disabled: disableAction || isInvalid, iconSize: fieldSize, onClick: sendEmail, type: "EMAIL", value: email })) : null, dataTestId: dataTestId, disabled: disabled, isInvalid: renderAsInvalid, onChange: handleChange, placeholder: rest.placeholder || "mail@example.com", ref: ref, type: "email", ...rest }));
881
831
  });
882
832
  EmailInput.displayName = "EmailInput";
883
833
 
@@ -886,8 +836,7 @@ EmailInput.displayName = "EmailInput";
886
836
  * EmailField validates that user enters a valid email address.
887
837
  *
888
838
  */
889
- const EmailField = forwardRef((_a, ref) => {
890
- var { label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId, value, disabled, onChange, isInvalid = false } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "helpAddon", "className", "defaultValue", "dataTestId", "value", "disabled", "onChange", "isInvalid"]);
839
+ const EmailField = forwardRef(({ label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId, value, disabled, onChange, isInvalid = false, ...rest }, ref) => {
891
840
  const htmlForId = id ? id : "emailField-" + v4();
892
841
  // Type guard to check if value is a string
893
842
  function isString(inputValue) {
@@ -899,7 +848,7 @@ const EmailField = forwardRef((_a, ref) => {
899
848
  onChange(event);
900
849
  }
901
850
  }, [onChange]);
902
- return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(EmailInput, Object.assign({ "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, disabled: disabled, id: htmlForId, isInvalid: renderAsInvalid, onChange: handleChange, ref: ref, value: value }, rest, { className: className, dataTestId: dataTestId })) }));
851
+ return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(EmailInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, disabled: disabled, id: htmlForId, isInvalid: renderAsInvalid, onChange: handleChange, ref: ref, value: value, ...rest, className: className, dataTestId: dataTestId }) }));
903
852
  });
904
853
  EmailField.displayName = "EmailField";
905
854
 
@@ -909,7 +858,7 @@ EmailField.displayName = "EmailField";
909
858
  * NOTE: If shown with a label, please use the `NumberField` component instead.
910
859
  */
911
860
  const NumberInput = forwardRef((props, ref) => {
912
- return jsx(BaseInput, Object.assign({ ref: ref, type: "number" }, props, { value: props.value }));
861
+ return jsx(BaseInput, { ref: ref, type: "number", ...props, value: props.value });
913
862
  });
914
863
  NumberInput.displayName = "NumberInput";
915
864
 
@@ -920,11 +869,10 @@ NumberInput.displayName = "NumberInput";
920
869
  *
921
870
  * _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
922
871
  */
923
- const NumberField = forwardRef((_a, ref) => {
924
- var { label, id, tip, helpText, errorMessage, helpAddon, isInvalid, maxLength, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "maxLength", "className", "value", "dataTestId"]);
872
+ const NumberField = forwardRef(({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, maxLength, className, value, dataTestId, ...rest }, ref) => {
925
873
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
926
874
  const htmlForId = id ? id : "numberField-" + v4();
927
- return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(NumberInput, Object.assign({ "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value }, rest, { className: className, dataTestId: dataTestId })) }));
875
+ return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(NumberInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value, ...rest, className: className, dataTestId: dataTestId }) }));
928
876
  });
929
877
  NumberField.displayName = "NumberField";
930
878
 
@@ -957,10 +905,9 @@ const cvaOptionCardContainer = cvaMerge(["contents"]);
957
905
  /**
958
906
  * A card version of a radio button that includes an icon, headings and a description.
959
907
  */
960
- const OptionCard = forwardRef((_a, ref) => {
961
- var { icon, heading, subheading, description, disabled, id, value, className, contentClassName, dataTestId, customImage } = _a, rest = __rest(_a, ["icon", "heading", "subheading", "description", "disabled", "id", "value", "className", "contentClassName", "dataTestId", "customImage"]);
908
+ const OptionCard = forwardRef(({ icon, heading, subheading, description, disabled, id, value, className, contentClassName, dataTestId, customImage, ...rest }, ref) => {
962
909
  const htmlForId = id !== null && id !== void 0 ? id : "option-card-" + v4();
963
- return (jsxs("div", { className: cvaOptionCardContainer(), "data-testid": dataTestId, children: [jsx("input", Object.assign({ className: "peer absolute h-0 w-0 opacity-0", "data-testid": `${dataTestId}-option-card`, id: htmlForId, ref: ref, type: "radio", value: value }, rest)), jsxs("label", { className: cvaOptionCardLabel({ className, disabled }), "data-testid": `${dataTestId}-option-card-label`, htmlFor: htmlForId, children: [disabled && icon && !customImage
910
+ return (jsxs("div", { className: cvaOptionCardContainer(), "data-testid": dataTestId, children: [jsx("input", { className: "peer absolute h-0 w-0 opacity-0", "data-testid": `${dataTestId}-option-card`, id: htmlForId, ref: ref, type: "radio", value: value, ...rest }), jsxs("label", { className: cvaOptionCardLabel({ className, disabled }), "data-testid": `${dataTestId}-option-card-label`, htmlFor: htmlForId, children: [disabled && icon && !customImage
964
911
  ? cloneElement(icon, { className: `${icon.props.className} text-secondary-400` })
965
912
  : null, disabled && customImage ? jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, !disabled && !customImage && icon, !disabled && customImage ? jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, heading ? (jsx(Heading, { subtle: disabled, variant: "secondary", children: heading })) : null, subheading || description ? (jsxs("div", { className: cvaOptionCardContent({ className: contentClassName }), children: [subheading ? (jsx(Text, { align: "center", subtle: disabled, type: "span", weight: "thick", children: subheading })) : null, description ? (jsx(Text, { align: "center", subtle: true, type: "span", children: description })) : null] })) : null] })] }));
966
913
  });
@@ -973,7 +920,7 @@ OptionCard.displayName = "OptionCard";
973
920
  */
974
921
  const PasswordInput = forwardRef((props, ref) => {
975
922
  const [showPassword, setShowPassword] = useState(false);
976
- return (jsx(BaseInput, Object.assign({ ref: ref }, props, { actions: jsx("div", { className: cvaActionContainer(), children: jsx(IconButton, { className: cvaActionButton({ size: props.fieldSize }), icon: jsx(Icon, { name: showPassword ? "EyeSlash" : "Eye", size: "small" }), onClick: () => setShowPassword(prevState => !prevState), size: "small", variant: "secondary" }) }), type: showPassword ? "text" : "password" })));
923
+ return (jsx(BaseInput, { ref: ref, ...props, actions: jsx("div", { className: cvaActionContainer(), children: jsx(IconButton, { className: cvaActionButton({ size: props.fieldSize }), icon: jsx(Icon, { name: showPassword ? "EyeSlash" : "Eye", size: "small" }), onClick: () => setShowPassword(prevState => !prevState), size: "small", variant: "secondary" }) }), type: showPassword ? "text" : "password" }));
977
924
  });
978
925
  PasswordInput.displayName = "PasswordInput";
979
926
 
@@ -984,14 +931,13 @@ PasswordInput.displayName = "PasswordInput";
984
931
  *
985
932
  * _**Do not use** to confirm user actions, such as deleting. Use a checkbox for such flows._
986
933
  */
987
- const PasswordField = forwardRef((_a, ref) => {
988
- var { id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["id", "label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
934
+ const PasswordField = forwardRef(({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId, ...rest }, ref) => {
989
935
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
990
936
  const htmlFor = id ? id : "passwordField-" + v4();
991
937
  const handleChange = useCallback((event) => {
992
938
  onChange === null || onChange === void 0 ? void 0 : onChange(event);
993
939
  }, [onChange]);
994
- return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(PasswordInput, Object.assign({}, rest, { "aria-labelledby": htmlFor + "-label", className: className, dataTestId: dataTestId, disabled: rest.readOnly, id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, onChange: handleChange, ref: ref, value: value })) }));
940
+ return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(PasswordInput, { ...rest, "aria-labelledby": htmlFor + "-label", className: className, dataTestId: dataTestId, disabled: rest.readOnly, id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, onChange: handleChange, ref: ref, value: value }) }));
995
941
  });
996
942
  PasswordField.displayName = "PasswordField";
997
943
 
@@ -1059,8 +1005,7 @@ const DEFAULT_COUNTRY_CODE = undefined;
1059
1005
  * @param {boolean} [disableAction=false] - Whether the action button is disabled or not.
1060
1006
  * @returns {JSX.Element} - The PhoneInput component.
1061
1007
  */
1062
- const PhoneInput = forwardRef((_a, ref) => {
1063
- var { dataTestId, isInvalid, disabled = false, value, defaultValue, fieldSize = "medium", disableAction = false, onChange, readOnly, onFocus, onBlur, name } = _a, rest = __rest(_a, ["dataTestId", "isInvalid", "disabled", "value", "defaultValue", "fieldSize", "disableAction", "onChange", "readOnly", "onFocus", "onBlur", "name"]);
1008
+ const PhoneInput = forwardRef(({ dataTestId, isInvalid, disabled = false, value, defaultValue, fieldSize = "medium", disableAction = false, onChange, readOnly, onFocus, onBlur, name, ...rest }, ref) => {
1064
1009
  const [innerValue, setInnerValue] = useState(() => {
1065
1010
  var _a;
1066
1011
  return (_a = ((value === null || value === void 0 ? void 0 : value.toString()) || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString()))) !== null && _a !== void 0 ? _a : "";
@@ -1104,7 +1049,7 @@ const PhoneInput = forwardRef((_a, ref) => {
1104
1049
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
1105
1050
  fieldIsFocused.current = true;
1106
1051
  }, [onFocus]);
1107
- return (jsx("div", { className: "grid grid-cols-1 gap-2", "data-testid": dataTestId ? `${dataTestId}-container` : null, children: jsx(BaseInput, Object.assign({ actions: !disableAction && innerValue && innerValue.length > 0 ? (jsx(ActionButton, { dataTestId: dataTestId ? `${dataTestId}-phoneIcon` : undefined, disabled: isInvalid, iconSize: fieldSize, type: "PHONE_NUMBER", value: (value === null || value === void 0 ? void 0 : value.toString()) || "" })) : null, dataTestId: dataTestId ? `${dataTestId}-phoneNumberInput` : undefined, disabled: disabled, fieldSize: fieldSize, id: "phoneInput-number", isInvalid: isInvalid, name: name, onBlur: handleBlur, onChange: handleChange, onFocus: handleFocus, prefix: (countryCode && countryCodeToFlagEmoji(countryCode)) || undefined, readOnly: readOnly, ref: ref, type: "tel", value: innerValue }, rest)) }));
1052
+ return (jsx("div", { className: "grid grid-cols-1 gap-2", "data-testid": dataTestId ? `${dataTestId}-container` : null, children: jsx(BaseInput, { actions: !disableAction && innerValue && innerValue.length > 0 ? (jsx(ActionButton, { dataTestId: dataTestId ? `${dataTestId}-phoneIcon` : undefined, disabled: isInvalid, iconSize: fieldSize, type: "PHONE_NUMBER", value: (value === null || value === void 0 ? void 0 : value.toString()) || "" })) : null, dataTestId: dataTestId ? `${dataTestId}-phoneNumberInput` : undefined, disabled: disabled, fieldSize: fieldSize, id: "phoneInput-number", isInvalid: isInvalid, name: name, onBlur: handleBlur, onChange: handleChange, onFocus: handleFocus, prefix: (countryCode && countryCodeToFlagEmoji(countryCode)) || undefined, readOnly: readOnly, ref: ref, type: "tel", value: innerValue, ...rest }) }));
1108
1053
  });
1109
1054
  PhoneInput.displayName = "PhoneInput";
1110
1055
 
@@ -1124,11 +1069,10 @@ PhoneInput.displayName = "PhoneInput";
1124
1069
  * @param {boolean} [disableAction=false] - Whether the action button is disabled or not.
1125
1070
  * @returns {JSX.Element} - The PhoneField component.
1126
1071
  */
1127
- const PhoneField = forwardRef((_a, ref) => {
1128
- var { label, id, tip, helpText, isInvalid, errorMessage, value, helpAddon, className, defaultValue, dataTestId, name, onChange, onBlur } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "isInvalid", "errorMessage", "value", "helpAddon", "className", "defaultValue", "dataTestId", "name", "onChange", "onBlur"]);
1072
+ const PhoneField = forwardRef(({ label, id, tip, helpText, isInvalid, errorMessage, value, helpAddon, className, defaultValue, dataTestId, name, onChange, onBlur, ...rest }, ref) => {
1129
1073
  const htmlForId = id ? id : "phoneField-" + v4();
1130
1074
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
1131
- return (jsx(FormGroup, { className: className, dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(PhoneInput, Object.assign({ "aria-labelledby": htmlForId + "-label", dataTestId: dataTestId, defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, name: name, onBlur: onBlur, onChange: onChange, ref: ref, value: value }, rest)) }));
1075
+ return (jsx(FormGroup, { className: className, dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(PhoneInput, { "aria-labelledby": htmlForId + "-label", dataTestId: dataTestId, defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, name: name, onBlur: onBlur, onChange: onChange, ref: ref, value: value, ...rest }) }));
1132
1076
  });
1133
1077
  PhoneField.displayName = "PhoneField";
1134
1078
 
@@ -1137,9 +1081,8 @@ PhoneField.displayName = "PhoneField";
1137
1081
  *
1138
1082
  * @returns {JSX.Element} - The PhoneFieldWithController component.
1139
1083
  */
1140
- const PhoneFieldWithController = forwardRef((_a, ref) => {
1141
- var { control, controllerProps, name, value } = _a, rest = __rest(_a, ["control", "controllerProps", "name", "value"]);
1142
- return (jsx(Controller, Object.assign({ control: control, defaultValue: value, name: name }, controllerProps, { render: ({ field }) => jsx(PhoneField, Object.assign({}, rest, field, { ref: ref })) })));
1084
+ const PhoneFieldWithController = forwardRef(({ control, controllerProps, name, value, ...rest }, ref) => {
1085
+ return (jsx(Controller, { control: control, defaultValue: value, name: name, ...controllerProps, render: ({ field }) => jsx(PhoneField, { ...rest, ...field, ref: ref }) }));
1143
1086
  });
1144
1087
  PhoneFieldWithController.displayName = "PhoneFieldWithController";
1145
1088
 
@@ -1318,10 +1261,10 @@ const TimeRange = ({ id, className, dataTestId, children, range, onChange, disab
1318
1261
  timeTo: "",
1319
1262
  });
1320
1263
  const onChangeFrom = (timeFrom) => {
1321
- setTimeRange(prev => (Object.assign(Object.assign({}, prev), { timeFrom })));
1264
+ setTimeRange(prev => ({ ...prev, timeFrom }));
1322
1265
  };
1323
1266
  const onChangeTo = (timeTo) => {
1324
- setTimeRange(prev => (Object.assign(Object.assign({}, prev), { timeTo })));
1267
+ setTimeRange(prev => ({ ...prev, timeTo }));
1325
1268
  };
1326
1269
  const onRangeChange = () => onChange(timeRange);
1327
1270
  return (jsxs("div", { className: cvaTimeRange({ className }), "data-testid": dataTestId, id: id, children: [jsx(BaseInput, { dataTestId: `${dataTestId}-from`, disabled: disabled, isInvalid: isInvalid, onBlur: onRangeChange, onChange: (time) => onChangeFrom(time.currentTarget.value), type: "time", value: timeRange.timeFrom }), children !== null && children !== void 0 ? children : jsx("div", { "data-testid": `${dataTestId}-separator`, children: "-" }), jsx(BaseInput, { dataTestId: `${dataTestId}-to`, disabled: disabled, isInvalid: isInvalid, onBlur: onRangeChange, onChange: (time) => onChangeTo(time.currentTarget.value), type: "time", value: timeRange.timeTo })] }));
@@ -1338,16 +1281,21 @@ const cvaScheduleItemText = cvaMerge(["flex", "font-bold", "self-center"]);
1338
1281
  */
1339
1282
  const Schedule = ({ className, dataTestId, schedule, onChange, invalidKeys = [] }) => {
1340
1283
  const onRangeChange = (range, index) => {
1341
- const newSchedule = schedule.map((day, dayIndex) => (index === dayIndex ? Object.assign(Object.assign({}, day), { range: Object.assign({}, range) }) : day));
1284
+ const newSchedule = schedule.map((day, dayIndex) => (index === dayIndex ? { ...day, range: { ...range } } : day));
1342
1285
  onChange(newSchedule);
1343
1286
  };
1344
1287
  const onActiveChange = (isActive, index) => {
1345
- const newSchedule = schedule.map((day, dayIndex) => index === dayIndex ? Object.assign(Object.assign({}, day), { range: { timeFrom: "", timeTo: "" }, isActive }) : day);
1288
+ const newSchedule = schedule.map((day, dayIndex) => index === dayIndex ? { ...day, range: { timeFrom: "", timeTo: "" }, isActive } : day);
1346
1289
  onChange(newSchedule);
1347
1290
  };
1348
1291
  const onAllDayChange = (isAllDayChecked, index) => {
1349
1292
  const newSchedule = schedule.map((day, dayIndex) => index === dayIndex
1350
- ? Object.assign(Object.assign({}, day), { range: { timeFrom: "", timeTo: "" }, isAllDayActive: isAllDayChecked }) : day);
1293
+ ? {
1294
+ ...day,
1295
+ range: { timeFrom: "", timeTo: "" },
1296
+ isAllDayActive: isAllDayChecked,
1297
+ }
1298
+ : day);
1351
1299
  onChange(newSchedule);
1352
1300
  };
1353
1301
  return (jsx("div", { className: className, "data-testid": dataTestId, children: schedule.map(({ label, range, isActive, key, checkboxLabel, isAllDayActive }, index) => {
@@ -1477,7 +1425,7 @@ const hasConsecutiveDays = (schedule) => {
1477
1425
  *
1478
1426
  * NOTE: If shown with a label, please use the `TextField` component instead.
1479
1427
  */
1480
- const TextInput = forwardRef((props, ref) => (jsx(BaseInput, Object.assign({ ref: ref, type: "text" }, props))));
1428
+ const TextInput = forwardRef((props, ref) => (jsx(BaseInput, { ref: ref, type: "text", ...props })));
1481
1429
  TextInput.displayName = "TextInput";
1482
1430
 
1483
1431
  const cvaSearch = cvaMerge([
@@ -1504,11 +1452,10 @@ const cvaSearch = cvaMerge([
1504
1452
  * @param {SearchProps} props - The props for the Search component
1505
1453
  * @returns {JSX.Element} Search component
1506
1454
  */
1507
- const Search = forwardRef((_a, ref) => {
1508
- var { className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on" } = _a, rest = __rest(_a, ["className", "placeholder", "value", "widenInputOnFocus", "hideBorderWhenNotInFocus", "disabled", "onKeyUp", "onChange", "onFocus", "onBlur", "name", "onClear", "dataTestId", "autoComplete"]);
1509
- return (jsx(TextInput, Object.assign({}, rest, { autoComplete: autoComplete, className: cvaSearch({ className, border: hideBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), dataTestId: dataTestId, disabled: disabled, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyUp: onKeyUp, placeholder: placeholder, prefix: jsx(Icon, { name: "MagnifyingGlass", size: "medium" }), ref: ref, suffix: onClear ? (jsx("button", { className: "flex", "data-testid": dataTestId ? `${dataTestId}_suffix_component` : null, onClick: () => {
1455
+ const Search = forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", ...rest }, ref) => {
1456
+ return (jsx(TextInput, { ...rest, autoComplete: autoComplete, className: cvaSearch({ className, border: hideBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), dataTestId: dataTestId, disabled: disabled, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyUp: onKeyUp, placeholder: placeholder, prefix: jsx(Icon, { name: "MagnifyingGlass", size: "medium" }), ref: ref, suffix: onClear ? (jsx("button", { className: "flex", "data-testid": dataTestId ? `${dataTestId}_suffix_component` : null, onClick: () => {
1510
1457
  onClear();
1511
- }, type: "button", children: jsx(Icon, { name: "XMark", size: "small" }) })) : undefined, value: value })));
1458
+ }, type: "button", children: jsx(Icon, { name: "XMark", size: "small" }) })) : undefined, value: value }));
1512
1459
  });
1513
1460
  Search.displayName = "Search";
1514
1461
 
@@ -1626,7 +1573,7 @@ const isSelectedOption = (option, selected) => {
1626
1573
  };
1627
1574
  const removeSelectedFromGroups = (group, selected) => {
1628
1575
  if (isGroupBase(group)) {
1629
- return Object.assign(Object.assign({}, group), { options: group.options.filter(option => !isSelectedOption(option, selected)) });
1576
+ return { ...group, options: group.options.filter(option => !isSelectedOption(option, selected)) };
1630
1577
  }
1631
1578
  return group;
1632
1579
  };
@@ -1683,14 +1630,13 @@ const MultiSelectMenuItem = ({ label, onClick, selected, dataTestId, focused, di
1683
1630
  * @param {TagProps} props - The props for the tag component
1684
1631
  * @returns {JSX.Element} TagWithWidth component
1685
1632
  */
1686
- const TagWithWidth = (_a) => {
1687
- var { onWidthKnown, children } = _a, rest = __rest(_a, ["onWidthKnown", "children"]);
1633
+ const TagWithWidth = ({ onWidthKnown, children, ...rest }) => {
1688
1634
  const ref = React__default.useRef(null);
1689
1635
  React__default.useLayoutEffect(() => {
1690
1636
  var _a;
1691
1637
  onWidthKnown && onWidthKnown({ width: ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0 });
1692
1638
  }, [ref, onWidthKnown]);
1693
- return (jsx(Tag, Object.assign({ ref: ref }, rest, { children: children })));
1639
+ return (jsx(Tag, { ref: ref, ...rest, children: children }));
1694
1640
  };
1695
1641
 
1696
1642
  /**
@@ -1775,7 +1721,8 @@ const useCustomComponents = ({ componentsProps, disabled, readOnly, refMenuIsEna
1775
1721
  const [t] = useTranslation();
1776
1722
  // perhaps it should not be wrap in memo (causing some issues with opening and closing on mobiles)
1777
1723
  const customComponents = React.useMemo(() => {
1778
- return Object.assign({ ValueContainer: props => {
1724
+ return {
1725
+ ValueContainer: props => {
1779
1726
  var _a;
1780
1727
  if (props.isMulti && Array.isArray(props.children) && props.children.length > 0) {
1781
1728
  const PLACEHOLDER_KEY = "placeholder";
@@ -1786,7 +1733,7 @@ const useCustomComponents = ({ componentsProps, disabled, readOnly, refMenuIsEna
1786
1733
  const tags = key === PLACEHOLDER_KEY ? [] : values;
1787
1734
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1788
1735
  const searchInput = props && props.children && props.children[1];
1789
- return (jsx(components.ValueContainer, Object.assign({}, props, { isDisabled: props.selectProps.isDisabled, children: maxSelectedDisplayCount === undefined ? (jsx(TagsContainer, { disabled: disabled, items: tags
1736
+ return (jsx(components.ValueContainer, { ...props, isDisabled: props.selectProps.isDisabled, children: maxSelectedDisplayCount === undefined ? (jsx(TagsContainer, { disabled: disabled, items: tags
1790
1737
  ? tags.map(({ props: tagProps }) => {
1791
1738
  return {
1792
1739
  text: tagProps.children,
@@ -1808,47 +1755,66 @@ const useCustomComponents = ({ componentsProps, disabled, readOnly, refMenuIsEna
1808
1755
  tagProps.removeProps.onClick && tagProps.removeProps.onClick(e);
1809
1756
  }, children: tagProps.children }, (_a = tagProps.children) === null || _a === void 0 ? void 0 : _a.toString()));
1810
1757
  })
1811
- : null, tags && tags.length > maxSelectedDisplayCount ? (jsxs(Tag, { color: "neutral", dataTestId: "counter-tag", children: ["+", tags.length - maxSelectedDisplayCount] })) : null, searchInput] })) })));
1758
+ : null, tags && tags.length > maxSelectedDisplayCount ? (jsxs(Tag, { color: "neutral", dataTestId: "counter-tag", children: ["+", tags.length - maxSelectedDisplayCount] })) : null, searchInput] })) }));
1812
1759
  }
1813
- return (jsx(components.ValueContainer, Object.assign({}, props, { isDisabled: props.selectProps.isDisabled, children: props.children })));
1814
- }, LoadingIndicator: () => {
1760
+ return (jsx(components.ValueContainer, { ...props, isDisabled: props.selectProps.isDisabled, children: props.children }));
1761
+ },
1762
+ LoadingIndicator: () => {
1815
1763
  return jsx(Spinner, { centering: "vertically", className: "mr-2", size: "small" });
1816
- }, DropdownIndicator: props => {
1764
+ },
1765
+ DropdownIndicator: props => {
1817
1766
  const icon = props.selectProps.menuIsOpen ? (jsx(Icon, { name: "ChevronUp", size: "medium" })) : (jsx(Icon, { name: "ChevronDown", size: "medium" }));
1818
- return props.selectProps.isLoading || props.selectProps.isDisabled || readOnly ? null : (jsx(components.DropdownIndicator, Object.assign({}, props, { children: jsx("div", { className: cvaSelectIcon(), children: dropdownIcon !== null && dropdownIcon !== void 0 ? dropdownIcon : icon }) })));
1819
- }, IndicatorSeparator: () => null, ClearIndicator: props => {
1767
+ return props.selectProps.isLoading || props.selectProps.isDisabled || readOnly ? null : (jsx(components.DropdownIndicator, { ...props, children: jsx("div", { className: cvaSelectIcon(), children: dropdownIcon !== null && dropdownIcon !== void 0 ? dropdownIcon : icon }) }));
1768
+ },
1769
+ IndicatorSeparator: () => null,
1770
+ ClearIndicator: props => {
1820
1771
  if (disabled) {
1821
1772
  return null;
1822
1773
  }
1823
- return (jsx(components.ClearIndicator, Object.assign({}, props, { children: jsx("div", { className: cvaSelectXIcon(), "data-testid": dataTestId ? `${dataTestId}-XMarkIcon` : null, onClick: props.clearValue, children: jsx(Icon, { ariaLabel: t("clearIndicator.icon.tooltip.clearAll"), name: "XCircle", size: "medium" }) }) })));
1824
- }, Control: props => {
1825
- return (jsx(components.Control, Object.assign({}, props, { className: cvaSelectControl({
1774
+ return (jsx(components.ClearIndicator, { ...props, children: jsx("div", { className: cvaSelectXIcon(), "data-testid": dataTestId ? `${dataTestId}-XMarkIcon` : null, onClick: props.clearValue, children: jsx(Icon, { ariaLabel: t("clearIndicator.icon.tooltip.clearAll"), name: "XCircle", size: "medium" }) }) }));
1775
+ },
1776
+ Control: props => {
1777
+ return (jsx(components.Control, { ...props, className: cvaSelectControl({
1826
1778
  isDisabled: props.isDisabled,
1827
1779
  prefix: prefix ? true : false,
1828
1780
  invalid: hasError,
1829
- }) })));
1830
- }, SingleValue: props => {
1831
- return (jsx(components.SingleValue, Object.assign({}, props, { className: props.isDisabled ? "text-slate-700" : "", children: jsx("div", { "data-testid": dataTestId + "-singleValue", children: props.children }) })));
1832
- }, Menu: props => {
1833
- return (jsx(components.Menu, Object.assign({}, props, { className: cvaSelectMenuList({ menuIsOpen: props.selectProps.menuIsOpen }) })));
1834
- }, Placeholder: props => {
1835
- return (jsx(components.Placeholder, Object.assign({}, props, { className: "!text-slate-400", children: props.children })));
1836
- }, MenuList: props => {
1837
- return (jsx(components.MenuList, Object.assign({}, props, { innerProps: Object.assign(Object.assign({}, props.innerProps), { onScroll: e => {
1781
+ }) }));
1782
+ },
1783
+ SingleValue: props => {
1784
+ return (jsx(components.SingleValue, { ...props, className: props.isDisabled ? "text-slate-700" : "", children: jsx("div", { "data-testid": dataTestId + "-singleValue", children: props.children }) }));
1785
+ },
1786
+ Menu: props => {
1787
+ return (jsx(components.Menu, { ...props, className: cvaSelectMenuList({ menuIsOpen: props.selectProps.menuIsOpen }) }));
1788
+ },
1789
+ Placeholder: props => {
1790
+ return (jsx(components.Placeholder, { ...props, className: "!text-slate-400", children: props.children }));
1791
+ },
1792
+ MenuList: props => {
1793
+ return (jsx(components.MenuList, { ...props, innerProps: {
1794
+ ...props.innerProps,
1795
+ onScroll: e => {
1838
1796
  const listEl = e.currentTarget;
1839
1797
  if (listEl.scrollTop + listEl.clientHeight >= listEl.scrollHeight) {
1840
1798
  props.selectProps.onMenuScrollToBottom && props.selectProps.onMenuScrollToBottom(new TouchEvent(""));
1841
1799
  }
1842
- } }), children: props.children })));
1843
- }, Option: props => {
1800
+ },
1801
+ }, children: props.children }));
1802
+ },
1803
+ Option: props => {
1844
1804
  const componentProps = {
1845
1805
  label: props.label,
1846
1806
  focused: props.isFocused,
1847
1807
  selected: props.isSelected,
1848
1808
  onClick: props.innerProps.onClick,
1849
1809
  };
1850
- return (jsx(components.Option, Object.assign({}, props, { innerProps: Object.assign(Object.assign({}, props.innerProps), { role: "option", onClick: () => { } }), children: props.isMulti ? (jsx(MultiSelectMenuItem, Object.assign({}, componentProps, { dataTestId: typeof props.label === "string" ? props.label : undefined, disabled: disabled }))) : (jsx(SingleSelectMenuItem, Object.assign({}, componentProps, { dataTestId: typeof props.label === "string" ? props.label : undefined, disabled: disabled || props.isDisabled }))) })));
1851
- } }, componentsProps);
1810
+ return (jsx(components.Option, { ...props, innerProps: {
1811
+ ...props.innerProps,
1812
+ role: "option",
1813
+ onClick: () => { },
1814
+ }, children: props.isMulti ? (jsx(MultiSelectMenuItem, { ...componentProps, dataTestId: typeof props.label === "string" ? props.label : undefined, disabled: disabled })) : (jsx(SingleSelectMenuItem, { ...componentProps, dataTestId: typeof props.label === "string" ? props.label : undefined, disabled: disabled || props.isDisabled })) }));
1815
+ },
1816
+ ...componentsProps,
1817
+ };
1852
1818
  // eslint-disable-next-line react-hooks/exhaustive-deps
1853
1819
  }, [componentsProps, disabled, maxSelectedDisplayCount]); // do not add dropdownIcon (it will cause issue with opening/closing list for selects with custom icon)
1854
1820
  return customComponents;
@@ -1865,19 +1831,92 @@ const useCustomComponents = ({ componentsProps, disabled, readOnly, refMenuIsEna
1865
1831
  */
1866
1832
  const useCustomStyles = ({ refContainer, refPrefix, maxSelectedDisplayCount, styles, disabled, }) => {
1867
1833
  const customStyles = React.useMemo(() => {
1868
- return Object.assign({ control: base => {
1869
- return Object.assign(Object.assign({}, base), { borderRadius: "var(--border-radius-lg)", backgroundColor: "" });
1870
- }, singleValue: base => (Object.assign({}, base)), multiValue: base => (Object.assign({}, base)), multiValueLabel: base => (Object.assign({}, base)), indicatorsContainer: base => (Object.assign(Object.assign({}, base), (disabled && { display: "none" }))), indicatorSeparator: () => ({
1834
+ return {
1835
+ control: base => {
1836
+ return {
1837
+ ...base,
1838
+ borderRadius: "var(--border-radius-lg)",
1839
+ backgroundColor: "",
1840
+ };
1841
+ },
1842
+ singleValue: base => ({
1843
+ ...base,
1844
+ }),
1845
+ multiValue: base => ({
1846
+ ...base,
1847
+ }),
1848
+ multiValueLabel: base => ({
1849
+ ...base,
1850
+ }),
1851
+ indicatorsContainer: base => ({
1852
+ ...base,
1853
+ ...(disabled && { display: "none" }),
1854
+ }),
1855
+ indicatorSeparator: () => ({
1871
1856
  width: "0px",
1872
- }), menu: base => {
1873
- return Object.assign(Object.assign({}, base), { width: "100%", marginTop: "4px", marginBottom: "18px", transition: "all 1s ease-in-out" });
1874
- }, input: base => (Object.assign(Object.assign({}, base), { marginLeft: "0px" })), placeholder: base => (Object.assign({}, base)), option: () => ({}), menuPortal: base => (Object.assign(Object.assign({}, base), { width: refContainer.current ? `${refContainer.current.clientWidth}px` : base.width, backgroundColor: "#ffffff", borderRadius: "var(--border-radius-lg)", zIndex: 20, borderColor: "rgb(var(--color-slate-300))", boxShadow: "var(--tw-ring-inset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)" })), menuList: base => {
1875
- return Object.assign(Object.assign({}, base), { position: "relative", padding: "var(--spacing-1)", display: "grid", gap: "var(--spacing-1)", width: "100%", borderRadius: "0px", boxShadow: "none", paddingTop: "0px" });
1876
- }, valueContainer: base => {
1877
- return Object.assign(Object.assign({}, base), { flexWrap: maxSelectedDisplayCount !== undefined ? "wrap" : "nowrap", gap: "0.25rem" });
1878
- }, container: base => (Object.assign(Object.assign({}, base), { width: "100%" })), dropdownIndicator: base => (Object.assign(Object.assign({}, base), { padding: "0px" })), clearIndicator: base => {
1879
- return Object.assign(Object.assign({}, base), { padding: "0px" });
1880
- } }, styles);
1857
+ }),
1858
+ menu: base => {
1859
+ return {
1860
+ ...base,
1861
+ width: "100%",
1862
+ marginTop: "4px",
1863
+ marginBottom: "18px",
1864
+ transition: "all 1s ease-in-out",
1865
+ };
1866
+ },
1867
+ input: base => ({
1868
+ ...base,
1869
+ marginLeft: "0px",
1870
+ }),
1871
+ placeholder: base => ({
1872
+ ...base,
1873
+ }),
1874
+ option: () => ({}),
1875
+ menuPortal: base => ({
1876
+ ...base,
1877
+ width: refContainer.current ? `${refContainer.current.clientWidth}px` : base.width,
1878
+ backgroundColor: "#ffffff",
1879
+ borderRadius: "var(--border-radius-lg)",
1880
+ zIndex: 20,
1881
+ borderColor: "rgb(var(--color-slate-300))",
1882
+ boxShadow: "var(--tw-ring-inset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)",
1883
+ }),
1884
+ menuList: base => {
1885
+ return {
1886
+ ...base,
1887
+ position: "relative",
1888
+ padding: "var(--spacing-1)",
1889
+ display: "grid",
1890
+ gap: "var(--spacing-1)",
1891
+ width: "100%",
1892
+ borderRadius: "0px",
1893
+ boxShadow: "none",
1894
+ paddingTop: "0px",
1895
+ };
1896
+ },
1897
+ valueContainer: base => {
1898
+ return {
1899
+ ...base,
1900
+ flexWrap: maxSelectedDisplayCount !== undefined ? "wrap" : "nowrap",
1901
+ gap: "0.25rem",
1902
+ };
1903
+ },
1904
+ container: base => ({
1905
+ ...base,
1906
+ width: "100%",
1907
+ }),
1908
+ dropdownIndicator: base => ({
1909
+ ...base,
1910
+ padding: "0px",
1911
+ }),
1912
+ clearIndicator: base => {
1913
+ return {
1914
+ ...base,
1915
+ padding: "0px",
1916
+ };
1917
+ },
1918
+ ...styles,
1919
+ };
1881
1920
  // eslint-disable-next-line react-hooks/exhaustive-deps
1882
1921
  }, [refContainer, refPrefix]);
1883
1922
  return { customStyles };
@@ -1889,9 +1928,8 @@ const useCustomStyles = ({ refContainer, refPrefix, maxSelectedDisplayCount, sty
1889
1928
  * @param {SelectProps} props - The props for the Select component
1890
1929
  * @returns {UseSelectProps} Select component
1891
1930
  */
1892
- const useSelect = (_a) => {
1893
- var _b;
1894
- var { id, className, dataTestId = "select", prefix, async, dropdownIcon, maxMenuHeight = 200, label, hasError, disabled, isMulti, components, value, options, onChange, isLoading, classNamePrefix = "", onMenuOpen, onMenuClose, maxSelectedDisplayCount = undefined, isClearable = false, isSearchable = true, onMenuScrollToBottom, styles, filterOption, onInputChange } = _a, props = __rest(_a, ["id", "className", "dataTestId", "prefix", "async", "dropdownIcon", "maxMenuHeight", "label", "hasError", "disabled", "isMulti", "components", "value", "options", "onChange", "isLoading", "classNamePrefix", "onMenuOpen", "onMenuClose", "maxSelectedDisplayCount", "isClearable", "isSearchable", "onMenuScrollToBottom", "styles", "filterOption", "onInputChange"]);
1931
+ const useSelect = ({ id, className, dataTestId = "select", prefix, async, dropdownIcon, maxMenuHeight = 200, label, hasError, disabled, isMulti, components, value, options, onChange, isLoading, classNamePrefix = "", onMenuOpen, onMenuClose, maxSelectedDisplayCount = undefined, isClearable = false, isSearchable = true, onMenuScrollToBottom, styles, filterOption, onInputChange, ...props }) => {
1932
+ var _a;
1895
1933
  const refContainer = React__default.useRef(null);
1896
1934
  const refPrefix = React__default.useRef(null);
1897
1935
  const { customStyles } = useCustomStyles({
@@ -1901,7 +1939,7 @@ const useSelect = (_a) => {
1901
1939
  styles,
1902
1940
  disabled: Boolean(disabled),
1903
1941
  });
1904
- const [menuIsOpen, setMenuIsOpen] = React__default.useState((_b = props.menuIsOpen) !== null && _b !== void 0 ? _b : false);
1942
+ const [menuIsOpen, setMenuIsOpen] = React__default.useState((_a = props.menuIsOpen) !== null && _a !== void 0 ? _a : false);
1905
1943
  const refMenuIsEnabled = React__default.useRef(true);
1906
1944
  const customComponents = useCustomComponents({
1907
1945
  componentsProps: components,
@@ -1915,7 +1953,7 @@ const useSelect = (_a) => {
1915
1953
  hasError,
1916
1954
  });
1917
1955
  const menuPlacement = "auto";
1918
- const openMenuHandler = () => __awaiter(void 0, void 0, void 0, function* () {
1956
+ const openMenuHandler = async () => {
1919
1957
  onMenuOpen === null || onMenuOpen === void 0 ? void 0 : onMenuOpen();
1920
1958
  if (refMenuIsEnabled.current) {
1921
1959
  setMenuIsOpen(true);
@@ -1923,7 +1961,7 @@ const useSelect = (_a) => {
1923
1961
  else {
1924
1962
  refMenuIsEnabled.current = true;
1925
1963
  }
1926
- });
1964
+ };
1927
1965
  const closeMenuHandler = () => {
1928
1966
  setMenuIsOpen(false);
1929
1967
  onMenuClose && onMenuClose();
@@ -1931,7 +1969,10 @@ const useSelect = (_a) => {
1931
1969
  const orderedOptions = React__default.useMemo(() => {
1932
1970
  return disabled
1933
1971
  ? getOrderedOptions(options, value).map(option => {
1934
- return Object.assign(Object.assign({}, option), { disabled: true });
1972
+ return {
1973
+ ...option,
1974
+ disabled: true,
1975
+ };
1935
1976
  })
1936
1977
  : getOrderedOptions(options, value);
1937
1978
  }, [options, value, disabled]);
@@ -2013,7 +2054,7 @@ const CreatableSelect = (props) => {
2013
2054
  value,
2014
2055
  ]);
2015
2056
  const renderAsDisabled = Boolean(props.disabled) || props.readOnly;
2016
- return (jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: renderAsDisabled, className: props.className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined ? (jsx("div", { className: cvaSelectPrefixSuffix({ kind: "prefix" }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, ref: refPrefix, children: prefix })) : null, async ? (jsx(ReactAsyncCreatableSelect, Object.assign({}, props, reactCreatableSelectProps, async, { onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : props.placeholder }))) : (jsx(ReactCreatableSelect, Object.assign({}, props, reactCreatableSelectProps, { hideSelectedOptions: false, isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : props.placeholder }))), typeof props.disabled === "object" ? (jsx("div", { className: cvaSelectPrefixSuffix({ kind: "suffix" }), "data-testid": dataTestId ? `${dataTestId}-locked` : null, children: jsx(DisabledForReasonsTip, Object.assign({}, props.disabled)) })) : null] }));
2057
+ return (jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: renderAsDisabled, className: props.className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined ? (jsx("div", { className: cvaSelectPrefixSuffix({ kind: "prefix" }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, ref: refPrefix, children: prefix })) : null, async ? (jsx(ReactAsyncCreatableSelect, { ...props, ...reactCreatableSelectProps, ...async, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : props.placeholder })) : (jsx(ReactCreatableSelect, { ...props, ...reactCreatableSelectProps, hideSelectedOptions: false, isMulti: isMulti, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : props.placeholder })), typeof props.disabled === "object" ? (jsx("div", { className: cvaSelectPrefixSuffix({ kind: "suffix" }), "data-testid": dataTestId ? `${dataTestId}-locked` : null, children: jsx(DisabledForReasonsTip, { ...props.disabled }) })) : null] }));
2017
2058
  };
2018
2059
  CreatableSelect.displayName = "CreatableSelect";
2019
2060
 
@@ -2080,12 +2121,11 @@ const Select = (props) => {
2080
2121
  value,
2081
2122
  ]);
2082
2123
  const renderAsDisabled = Boolean(props.disabled) || props.readOnly;
2083
- return (jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: renderAsDisabled, className: props.className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined ? (jsx("div", { className: cvaSelectPrefixSuffix({ kind: "prefix" }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, ref: refPrefix, children: prefix })) : null, async ? (jsx(ReactAsyncSelect, Object.assign({}, props, reactSelectProps, async, { menuPosition: menuPosition, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : props.placeholder }))) : (jsx(ReactSelect, Object.assign({}, props, reactSelectProps, { isMulti: isMulti, menuPosition: menuPosition, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : props.placeholder }))), typeof props.disabled === "object" ? (jsx("div", { className: cvaSelectPrefixSuffix({ kind: "suffix" }), "data-testid": dataTestId ? `${dataTestId}-locked` : null, children: jsx(DisabledForReasonsTip, Object.assign({}, props.disabled)) })) : null] }));
2124
+ return (jsxs("div", { className: cvaSelect({ invalid: hasError, disabled: renderAsDisabled, className: props.className }), "data-testid": dataTestId, ref: refContainer, children: [prefix !== undefined ? (jsx("div", { className: cvaSelectPrefixSuffix({ kind: "prefix" }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, ref: refPrefix, children: prefix })) : null, async ? (jsx(ReactAsyncSelect, { ...props, ...reactSelectProps, ...async, menuPosition: menuPosition, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, placeholder: renderAsDisabled ? null : props.placeholder })) : (jsx(ReactSelect, { ...props, ...reactSelectProps, isMulti: isMulti, menuPosition: menuPosition, onMenuClose: closeMenuHandler, onMenuOpen: openMenuHandler, options: filterOption ? orderedOptions : options, placeholder: renderAsDisabled ? null : props.placeholder })), typeof props.disabled === "object" ? (jsx("div", { className: cvaSelectPrefixSuffix({ kind: "suffix" }), "data-testid": dataTestId ? `${dataTestId}-locked` : null, children: jsx(DisabledForReasonsTip, { ...props.disabled }) })) : null] }));
2084
2125
  };
2085
2126
  Select.displayName = "Select";
2086
2127
 
2087
- const FormFieldSelectAdapter = forwardRef((_a, ref) => {
2088
- var { className, dataTestId, helpText, helpAddon, tip, label, disabled, isInvalid, errorMessage, name, onBlur, options, value, defaultValue, id, onChange, children } = _a, rest = __rest(_a, ["className", "dataTestId", "helpText", "helpAddon", "tip", "label", "disabled", "isInvalid", "errorMessage", "name", "onBlur", "options", "value", "defaultValue", "id", "onChange", "children"]);
2128
+ const FormFieldSelectAdapter = forwardRef(({ className, dataTestId, helpText, helpAddon, tip, label, disabled, isInvalid, errorMessage, name, onBlur, options, value, defaultValue, id, onChange, children, ...rest }, ref) => {
2089
2129
  const isFirstRender = useIsFirstRender();
2090
2130
  const [innerValue, setInnerValue] = useState(value || defaultValue);
2091
2131
  useEffect(() => {
@@ -2125,14 +2165,21 @@ const FormFieldSelectAdapter = forwardRef((_a, ref) => {
2125
2165
  tip,
2126
2166
  label, children: [jsx("select", { onChange, ref: innerRef, name, value: innerValue, hidden: true, children: optionsWithCurrentSelectionBackupOption.map(option => {
2127
2167
  return (jsx("option", { value: option.value, children: option.label }, option.value));
2128
- }) }), children(Object.assign(Object.assign({}, rest), { id,
2168
+ }) }), children({
2169
+ ...rest,
2170
+ id,
2129
2171
  disabled,
2130
- onBlur, options: optionsWithCurrentSelectionBackupOption, onChange: e => {
2172
+ onBlur,
2173
+ options: optionsWithCurrentSelectionBackupOption,
2174
+ onChange: e => {
2131
2175
  // If theres no value, set the inner value to an empty string
2132
2176
  // A native select can not have a null value
2133
2177
  // So even if react-select sends a null value, we need to convert it to an empty string
2134
2178
  setInnerValue(!e ? "" : e.value);
2135
- }, value: selectedOption, defaultValue: selectedOption }))] }));
2179
+ },
2180
+ value: selectedOption,
2181
+ defaultValue: selectedOption,
2182
+ })] }));
2136
2183
  });
2137
2184
  FormFieldSelectAdapter.displayName = "FormFieldSelectAdapter";
2138
2185
 
@@ -2146,10 +2193,9 @@ FormFieldSelectAdapter.displayName = "FormFieldSelectAdapter";
2146
2193
  * @param {SelectFieldProps & CreatableSelectProps} props - The props for the CreatableSelectField component
2147
2194
  * @returns {JSX.Element} CreatableSelectField component
2148
2195
  */
2149
- const CreatableSelectField = forwardRef((_a, ref) => {
2150
- var { allowCreateWhileLoading, onCreateOption } = _a, props = __rest(_a, ["allowCreateWhileLoading", "onCreateOption"]);
2196
+ const CreatableSelectField = forwardRef(({ allowCreateWhileLoading, onCreateOption, ...props }, ref) => {
2151
2197
  const creatableSelectOnlyProps = { allowCreateWhileLoading, onCreateOption };
2152
- return (jsx(FormFieldSelectAdapter, Object.assign({}, props, { ref: ref, children: convertedProps => jsx(CreatableSelect, Object.assign({}, convertedProps, creatableSelectOnlyProps)) })));
2198
+ return (jsx(FormFieldSelectAdapter, { ...props, ref: ref, children: convertedProps => jsx(CreatableSelect, { ...convertedProps, ...creatableSelectOnlyProps }) }));
2153
2199
  });
2154
2200
  CreatableSelectField.displayName = "CreatableSelectField";
2155
2201
 
@@ -2163,9 +2209,8 @@ CreatableSelectField.displayName = "CreatableSelectField";
2163
2209
  * @param {SelectFieldProps} props - The props for the SelectField component
2164
2210
  * @returns {JSX.Element} SelectField component
2165
2211
  */
2166
- const SelectField = forwardRef((_a, ref) => {
2167
- var props = __rest(_a, []);
2168
- return (jsx(FormFieldSelectAdapter, Object.assign({}, props, { ref: ref, children: convertedProps => jsx(Select, Object.assign({}, convertedProps)) })));
2212
+ const SelectField = forwardRef(({ ...props }, ref) => {
2213
+ return (jsx(FormFieldSelectAdapter, { ...props, ref: ref, children: convertedProps => jsx(Select, { ...convertedProps }) }));
2169
2214
  });
2170
2215
  SelectField.displayName = "SelectField";
2171
2216
 
@@ -2205,9 +2250,8 @@ const cvaTextArea = cvaMerge([
2205
2250
  * The TextArea is a base component, and should not be used very often.
2206
2251
  * For most cases the TextAreaField is the correct component.
2207
2252
  */
2208
- const TextArea = React.forwardRef((_a, ref) => {
2209
- var { id, name, value, rows, disabled, placeholder, readOnly, tabIndex, onChange, onFocus, onBlur, maxLength, resize = "vertical", defaultValue, required, dataTestId, isInvalid, className } = _a, rest = __rest(_a, ["id", "name", "value", "rows", "disabled", "placeholder", "readOnly", "tabIndex", "onChange", "onFocus", "onBlur", "maxLength", "resize", "defaultValue", "required", "dataTestId", "isInvalid", "className"]);
2210
- return (jsx("textarea", Object.assign({ className: cvaTextArea({ className, resize, invalid: isInvalid, disabled }), defaultValue: defaultValue, disabled: disabled, id: id, maxLength: maxLength, name: name, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, readOnly: readOnly, ref: ref, required: required, rows: rows, tabIndex: tabIndex, value: value }, rest, { "data-testid": dataTestId, onChange: onChange })));
2253
+ const TextArea = React.forwardRef(({ id, name, value, rows, disabled, placeholder, readOnly, tabIndex, onChange, onFocus, onBlur, maxLength, resize = "vertical", defaultValue, required, dataTestId, isInvalid, className, ...rest }, ref) => {
2254
+ return (jsx("textarea", { className: cvaTextArea({ className, resize, invalid: isInvalid, disabled }), defaultValue: defaultValue, disabled: disabled, id: id, maxLength: maxLength, name: name, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, readOnly: readOnly, ref: ref, required: required, rows: rows, tabIndex: tabIndex, value: value, ...rest, "data-testid": dataTestId, onChange: onChange }));
2211
2255
  });
2212
2256
  TextArea.displayName = "TextArea";
2213
2257
 
@@ -2222,8 +2266,7 @@ const TextLengthIndicator = ({ length, maxLength }) => {
2222
2266
  return (jsxs("span", { className: "font-mono", children: [length, "/", maxLength] }));
2223
2267
  };
2224
2268
 
2225
- const TextAreaField = React.forwardRef((_a, ref) => {
2226
- var { id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["id", "label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
2269
+ const TextAreaField = React.forwardRef(({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId, ...rest }, ref) => {
2227
2270
  const [valueLength, setValueLength] = React.useState(value ? `${value}`.length : 0);
2228
2271
  const renderAsInvalid = isInvalid || Boolean(errorMessage);
2229
2272
  const htmlForId = id ? id : "textAreaField-" + v4();
@@ -2234,7 +2277,7 @@ const TextAreaField = React.forwardRef((_a, ref) => {
2234
2277
  }
2235
2278
  }, [onChange]);
2236
2279
  return (jsx(FormGroup, { className: twMerge(className, "grid", "grid-rows-[auto_1fr_auto]"), dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon ||
2237
- (typeof maxLength === "number" && jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(TextArea, Object.assign({ "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value }, rest, { className: "h-auto", dataTestId: dataTestId, onChange: handleChange })) }));
2280
+ (typeof maxLength === "number" && jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(TextArea, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value, ...rest, className: "h-auto", dataTestId: dataTestId, onChange: handleChange }) }));
2238
2281
  });
2239
2282
  TextAreaField.displayName = "TextAreaField";
2240
2283
 
@@ -2245,8 +2288,7 @@ TextAreaField.displayName = "TextAreaField";
2245
2288
  *
2246
2289
  * _**Do not use** to confirm user actions, such as deleting. Use a checkbox for such flows._
2247
2290
  */
2248
- const TextField = React.forwardRef((_a, ref) => {
2249
- var { id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["id", "label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
2291
+ const TextField = React.forwardRef(({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId, ...rest }, ref) => {
2250
2292
  const [valueLength, setValueLength] = React.useState(value ? `${value}`.length : 0);
2251
2293
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
2252
2294
  const htmlFor = id ? id : "textField-" + v4();
@@ -2257,7 +2299,7 @@ const TextField = React.forwardRef((_a, ref) => {
2257
2299
  }
2258
2300
  }, [onChange]);
2259
2301
  return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon ||
2260
- (typeof maxLength === "number" && jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(TextInput, Object.assign({ "aria-labelledby": htmlFor + "-label", id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value }, rest, { className: className, dataTestId: dataTestId, onChange: handleChange })) }));
2302
+ (typeof maxLength === "number" && jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(TextInput, { "aria-labelledby": htmlFor + "-label", id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value, ...rest, className: className, dataTestId: dataTestId, onChange: handleChange }) }));
2261
2303
  });
2262
2304
  TextField.displayName = "TextField";
2263
2305
 
@@ -2267,11 +2309,10 @@ TextField.displayName = "TextField";
2267
2309
  * @param {TimeRangeFieldProps} props - The props for the TimeRangeField component
2268
2310
  * @returns {JSX.Element} TimeRangeField component
2269
2311
  */
2270
- const TimeRangeField = (_a) => {
2271
- var { className, dataTestId, onChange, isInvalid, errorMessage, label, tip, children, helpText, id } = _a, rest = __rest(_a, ["className", "dataTestId", "onChange", "isInvalid", "errorMessage", "label", "tip", "children", "helpText", "id"]);
2312
+ const TimeRangeField = ({ className, dataTestId, onChange, isInvalid, errorMessage, label, tip, children, helpText, id, ...rest }) => {
2272
2313
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
2273
2314
  const htmlFor = id ? id : "timeRangeField-" + v4();
2274
- return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, tip: tip, children: jsx(TimeRange, Object.assign({ className: className, dataTestId: dataTestId, isInvalid: renderAsInvalid, onChange: onChange }, rest, { children: children })) }));
2315
+ return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, tip: tip, children: jsx(TimeRange, { className: className, dataTestId: dataTestId, isInvalid: renderAsInvalid, onChange: onChange, ...rest, children: children }) }));
2275
2316
  };
2276
2317
 
2277
2318
  const cvaToggleWrapper = cvaMerge(["flex", "gap-2", "items-center"]);
@@ -2361,26 +2402,22 @@ const cvaUploadInputAddonBefore = cvaMerge(["block", "truncate", "w-28", "pt-2"]
2361
2402
  *
2362
2403
  * NOTE: If shown with a label, please use the `UploadField` component instead.
2363
2404
  */
2364
- const UploadInput = forwardRef((_a, ref) => {
2365
- var { disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles } = _a, rest = __rest(_a, ["disabled", "acceptedTypes", "nonInteractive", "uploadLabel", "multipleFiles"]);
2366
- return (jsx("label", { className: "tu-upload-input", children: jsx(BaseInput, Object.assign({ accept: acceptedTypes, addonBefore: uploadLabel, addonBeforeClassName: cvaUploadInputAddonBefore(), disabled: disabled, inputClassName: cvaUploadInputField(), multiple: multipleFiles, nonInteractive: nonInteractive, onClick: event => {
2367
- // onClick used to work with nonInteractive option
2368
- if (nonInteractive) {
2369
- event.preventDefault();
2370
- event.stopPropagation();
2371
- }
2372
- }, ref: ref, type: "file" }, rest)) }));
2373
- });
2405
+ const UploadInput = forwardRef(({ disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles, ...rest }, ref) => (jsx("label", { className: "tu-upload-input", children: jsx(BaseInput, { accept: acceptedTypes, addonBefore: uploadLabel, addonBeforeClassName: cvaUploadInputAddonBefore(), disabled: disabled, inputClassName: cvaUploadInputField(), multiple: multipleFiles, nonInteractive: nonInteractive, onClick: event => {
2406
+ // onClick used to work with nonInteractive option
2407
+ if (nonInteractive) {
2408
+ event.preventDefault();
2409
+ event.stopPropagation();
2410
+ }
2411
+ }, ref: ref, type: "file", ...rest }) })));
2374
2412
  UploadInput.displayName = "UploadInput";
2375
2413
 
2376
2414
  /**
2377
2415
  * Upload fields enable the user to upload Files.
2378
2416
  */
2379
- const UploadField = forwardRef((_a, ref) => {
2380
- var { label, id, tip, helpText, errorMessage, isInvalid, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "isInvalid", "className", "value", "dataTestId"]);
2417
+ const UploadField = forwardRef(({ label, id, tip, helpText, errorMessage, isInvalid, className, value, dataTestId, ...rest }, ref) => {
2381
2418
  const renderAsInvalid = isInvalid || Boolean(errorMessage);
2382
2419
  const htmlForId = id ? id : "uploadField-" + v4();
2383
- return (jsx(FormGroup, { dataTestId: `${dataTestId}-FormGroup`, helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(UploadInput, Object.assign({ "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, ref: ref }, rest, { className: className, dataTestId: dataTestId })) }));
2420
+ return (jsx(FormGroup, { dataTestId: `${dataTestId}-FormGroup`, helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(UploadInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, dataTestId: dataTestId }) }));
2384
2421
  });
2385
2422
  UploadField.displayName = "UploadField";
2386
2423
 
@@ -2404,11 +2441,10 @@ const validateUrlAddress = (url) => {
2404
2441
  *
2405
2442
  * NOTE: If shown with a label, please use the `UrlField` component instead.
2406
2443
  */
2407
- const UrlInput = forwardRef((_a, ref) => {
2408
- var { dataTestId, isInvalid, disabled = false, fieldSize = "medium", disableAction = false, value, defaultValue } = _a, rest = __rest(_a, ["dataTestId", "isInvalid", "disabled", "fieldSize", "disableAction", "value", "defaultValue"]);
2444
+ const UrlInput = forwardRef(({ dataTestId, isInvalid, disabled = false, fieldSize = "medium", disableAction = false, value, defaultValue, ...rest }, ref) => {
2409
2445
  const [url, setUrl] = useState((value === null || value === void 0 ? void 0 : value.toString()) || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString()));
2410
2446
  const renderAsInvalid = (url && typeof url === "string" && !validateUrlAddress(url)) || isInvalid;
2411
- return (jsx(BaseInput, Object.assign({ dataTestId: dataTestId ? `${dataTestId}-url-input` : undefined, disabled: disabled, id: "url-input", isInvalid: renderAsInvalid, onChange: e => setUrl(e.target.value), placeholder: rest.placeholder || "https://www.example.com", ref: ref, type: "url", value: url }, rest, { actions: !disableAction && (jsx(ActionButton, { dataTestId: (dataTestId && `${dataTestId}-url-input-Icon`) || "url-input-action-icon", disabled: renderAsInvalid || disableAction, iconSize: fieldSize, type: "WEB_ADDRESS", value: url })) })));
2447
+ return (jsx(BaseInput, { dataTestId: dataTestId ? `${dataTestId}-url-input` : undefined, disabled: disabled, id: "url-input", isInvalid: renderAsInvalid, onChange: e => setUrl(e.target.value), placeholder: rest.placeholder || "https://www.example.com", ref: ref, type: "url", value: url, ...rest, actions: !disableAction && (jsx(ActionButton, { dataTestId: (dataTestId && `${dataTestId}-url-input-Icon`) || "url-input-action-icon", disabled: renderAsInvalid || disableAction, iconSize: fieldSize, type: "WEB_ADDRESS", value: url })) }));
2412
2448
  });
2413
2449
  UrlInput.displayName = "UrlField";
2414
2450
 
@@ -2417,15 +2453,14 @@ UrlInput.displayName = "UrlField";
2417
2453
  * UrlField validates that user enters a valid web address.
2418
2454
  *
2419
2455
  */
2420
- const UrlField = forwardRef((_a, ref) => {
2421
- var { label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId, isInvalid = false, value } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "helpAddon", "className", "defaultValue", "dataTestId", "isInvalid", "value"]);
2456
+ const UrlField = forwardRef(({ label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId, isInvalid = false, value, ...rest }, ref) => {
2422
2457
  const htmlForId = id ? id : "urlField-" + v4();
2423
2458
  // Type guard to check if value is a string
2424
2459
  function isString(inputValue) {
2425
2460
  return typeof inputValue === "string";
2426
2461
  }
2427
2462
  const renderAsInvalid = !!errorMessage || (value && isString(value) && !validateUrlAddress(value)) || isInvalid;
2428
- return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: renderAsInvalid ? errorMessage : helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(UrlInput, Object.assign({ "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, ref: ref, value: value || defaultValue }, rest, { className: className, dataTestId: dataTestId })) }));
2463
+ return (jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: renderAsInvalid ? errorMessage : helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required, tip: tip, children: jsx(UrlInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, ref: ref, value: value || defaultValue, ...rest, className: className, dataTestId: dataTestId }) }));
2429
2464
  });
2430
2465
  UrlField.displayName = "UrlField";
2431
2466
 
@@ -2448,7 +2483,11 @@ const useGetPhoneValidationRules = () => {
2448
2483
  },
2449
2484
  };
2450
2485
  return !skipValidation
2451
- ? Object.assign(Object.assign({}, pattern), defaultRules) : defaultRules;
2486
+ ? {
2487
+ ...pattern,
2488
+ ...defaultRules,
2489
+ }
2490
+ : defaultRules;
2452
2491
  }, [t]);
2453
2492
  return { getPhoneNumberValidationRules };
2454
2493
  };