@trackunit/react-form-components 1.3.28 → 1.3.33

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 +112 -109
  2. package/index.esm.js +125 -122
  3. package/package.json +11 -11
  4. package/src/components/ActionButton/ActionButton.d.ts +5 -4
  5. package/src/components/BaseInput/BaseInput.d.ts +9 -2
  6. package/src/components/BaseInput/components/GenericActionsRenderer.d.ts +1 -1
  7. package/src/components/Checkbox/CheckIcon.d.ts +1 -1
  8. package/src/components/Checkbox/Checkbox.d.ts +9 -3
  9. package/src/components/Checkbox/IndeterminateIcon.d.ts +1 -1
  10. package/src/components/CheckboxField/CheckboxField.d.ts +9 -2
  11. package/src/components/ColorField/ColorField.d.ts +1 -2
  12. package/src/components/DateField/DateField.d.ts +9 -1
  13. package/src/components/DateInput/DateInput.d.ts +7 -1
  14. package/src/components/DropZone/DropZone.d.ts +4 -3
  15. package/src/components/EmailField/EmailField.d.ts +4 -2
  16. package/src/components/EmailInput/EmailInput.d.ts +4 -1
  17. package/src/components/FormGroup/FormGroup.d.ts +6 -6
  18. package/src/components/Label/Label.d.ts +4 -4
  19. package/src/components/NumberField/NumberField.d.ts +9 -1
  20. package/src/components/NumberInput/NumberInput.d.ts +4 -1
  21. package/src/components/OptionCard/OptionCard.d.ts +11 -4
  22. package/src/components/PasswordField/PasswordField.d.ts +9 -1
  23. package/src/components/PasswordInput/PasswordInput.d.ts +4 -1
  24. package/src/components/PhoneField/PhoneField.d.ts +9 -2
  25. package/src/components/PhoneFieldWithController/PhoneFieldWithController.d.ts +9 -2
  26. package/src/components/PhoneInput/CountryCodeSelect.d.ts +1 -1
  27. package/src/components/PhoneInput/PhoneInput.d.ts +4 -2
  28. package/src/components/RadioGroup/RadioGroup.d.ts +6 -6
  29. package/src/components/RadioGroup/RadioItem.d.ts +3 -3
  30. package/src/components/Schedule/Schedule.d.ts +1 -1
  31. package/src/components/Search/Search.d.ts +11 -5
  32. package/src/components/Select/CreatableSelect.d.ts +1 -1
  33. package/src/components/Select/Select.d.ts +1 -1
  34. package/src/components/Select/SelectMenuItem/SelectMenuItem.d.ts +5 -5
  35. package/src/components/Select/TagWithWidth.d.ts +1 -1
  36. package/src/components/Select/TagsContainer.d.ts +3 -2
  37. package/src/components/Select/useCustomComponents.d.ts +7 -7
  38. package/src/components/Select/useCustomStyles.d.ts +3 -3
  39. package/src/components/Select/useSelect.d.ts +3 -3
  40. package/src/components/SelectField/CreatableSelectField.d.ts +8 -20
  41. package/src/components/SelectField/FormFieldSelectAdapter.d.ts +14 -3
  42. package/src/components/SelectField/SelectField.d.ts +5 -20
  43. package/src/components/TextArea/TextArea.d.ts +9 -2
  44. package/src/components/TextAreaField/TextAreaField.d.ts +12 -2
  45. package/src/components/TextField/TextField.d.ts +4 -2
  46. package/src/components/TextField/TextLenghtIndicator.d.ts +1 -1
  47. package/src/components/TextInput/TextInput.d.ts +4 -1
  48. package/src/components/TimeRange/TimeRange.d.ts +3 -3
  49. package/src/components/TimeRangeField/TimeRangeField.d.ts +1 -1
  50. package/src/components/UploadField/UploadField.d.ts +4 -1
  51. package/src/components/UploadInput/UploadInput.d.ts +4 -1
  52. package/src/components/UrlField/UrlField.d.ts +4 -1
  53. package/src/components/UrlInput/UrlInput.d.ts +4 -1
  54. package/src/test-utils/test-utils.d.ts +0 -1
  55. package/src/utilities/compareReactNodes.d.ts +1 -1
package/index.cjs.js CHANGED
@@ -149,7 +149,7 @@ const cvaActionContainer = cssClassVarianceUtilities.cvaMerge(["flex", "items-ce
149
149
  * The ActionButton component is a wrapper over IconButton to perform an action when the onClick event is triggered.
150
150
  *
151
151
  * @param {ActionButtonProps} props - The props for the ActionButton component
152
- * @returns {JSX.Element} ActionButton component
152
+ * @returns {ReactElement} ActionButton component
153
153
  */
154
154
  const ActionButton = ({ type, value, dataTestId, size, disabled, className, onClick }) => {
155
155
  const [, copyToClipboard] = usehooksTs.useCopyToClipboard();
@@ -438,7 +438,7 @@ const SuffixRenderer = ({ suffix, isInvalid, isWarning, dataTestId, disabled, })
438
438
  * For specific input types make sure to use the corresponding input component.
439
439
  * This is a base used by our other input components such as TextInput, NumberInput, PasswordInput, etc.
440
440
  */
441
- const BaseInput = React.forwardRef(({ className, isInvalid, dataTestId, prefix, suffix, addonBefore, addonAfter, actions, fieldSize = "medium", nonInteractive = false, inputClassName, placeholder, isWarning, type, genericAction, style, ...rest }, ref) => {
441
+ const BaseInput = ({ className, isInvalid, dataTestId, prefix, suffix, addonBefore, addonAfter, actions, fieldSize = "medium", nonInteractive = false, inputClassName, placeholder, isWarning, type, genericAction, style, ref, ...rest }) => {
442
442
  // Derive final flags
443
443
  const renderAsDisabled = Boolean(rest.disabled);
444
444
  const renderAsReadonly = Boolean(rest.readOnly);
@@ -464,7 +464,7 @@ const BaseInput = React.forwardRef(({ className, isInvalid, dataTestId, prefix,
464
464
  paddingLeft: beforeContainerWidth ? `calc(${beforeContainerWidth}px + ${uiDesignTokens.themeSpacing[2]})` : undefined,
465
465
  paddingRight: afterContainerWidth ? `calc(${afterContainerWidth}px + ${uiDesignTokens.themeSpacing[2]})` : undefined,
466
466
  }, type: type, ...rest, disabled: renderAsDisabled, readOnly: renderAsReadonly || nonInteractive }), jsxRuntime.jsxs("div", { className: cvaAccessoriesContainer({ className: cvaInputItemPlacementManager({ position: "after" }) }), "data-testid": dataTestId ? `${dataTestId}-after-container` : undefined, ref: afterContainerRef, children: [jsxRuntime.jsx(LockReasonRenderer, { dataTestId: dataTestId + "-disabled", lockReason: rest.disabled }), jsxRuntime.jsx(LockReasonRenderer, { dataTestId: dataTestId + "-readonly", lockReason: rest.readOnly && !rest.disabled ? rest.readOnly : undefined }), jsxRuntime.jsx(GenericActionsRenderer, { fieldSize: fieldSize, genericAction: genericAction, innerRef: innerRef }), jsxRuntime.jsx(SuffixRenderer, { dataTestId: dataTestId, disabled: renderAsDisabled, isInvalid: isInvalid, isWarning: isWarning, suffix: suffix }), actions, jsxRuntime.jsx(AddonRenderer, { addon: addonAfter, dataTestId: dataTestId, fieldSize: fieldSize, position: "after" })] })] }));
467
- });
467
+ };
468
468
  BaseInput.displayName = "BaseInput";
469
469
 
470
470
  /**
@@ -532,7 +532,7 @@ const cvaLabel = cssClassVarianceUtilities.cvaMerge([
532
532
  * The CheckIcon component is used by the checkbox to display the checked state.
533
533
  *
534
534
  * @param {CheckIconProps} props - The props for the CheckIcon component
535
- * @returns {JSX.Element} CheckIcon component
535
+ * @returns {ReactElement} CheckIcon component
536
536
  */
537
537
  const CheckIcon = ({ className, dataTestId }) => {
538
538
  return (jsxRuntime.jsx("svg", { className: className, "data-testid": dataTestId, fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 10 10", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "m2 5.5 2 2L8.5 3", strokeLinecap: "round", strokeLinejoin: "round" }) }));
@@ -642,7 +642,7 @@ const cvaCheckboxIcon = cssClassVarianceUtilities.cvaMerge(["w-2.5", "h-2.5", "t
642
642
  * The IndeterminateIcon component is used by the checkbox to display the Indeterminate state.
643
643
  *
644
644
  * @param {IndeterminateIconProps} props - The props for the IndeterminateIcon component
645
- * @returns {JSX.Element} IndeterminateIcon component
645
+ * @returns {ReactElement} IndeterminateIcon component
646
646
  */
647
647
  const IndeterminateIcon = ({ className }) => (jsxRuntime.jsx("svg", { className: className, fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 10 10", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M3 5h4", strokeLinecap: "round", strokeLinejoin: "round" }) }));
648
648
 
@@ -658,9 +658,8 @@ const IndeterminateIcon = ({ className }) => (jsxRuntime.jsx("svg", { className:
658
658
  * @description A reference to the input element is provided as the `ref` prop.
659
659
  * @augments props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
660
660
  * @param {CheckboxProps} props - The props for the Checkbox component
661
- * @returns {JSX.Element} Checkbox component
662
661
  */
663
- const Checkbox = React.forwardRef(({ className, dataTestId = "checkbox", onChange, checked = false, disabled = false, isInvalid = false, readOnly, indeterminate = false, suffix, label, tabIndex = 0, stopPropagation, ...rest }, ref) => {
662
+ const Checkbox = ({ className, dataTestId = "checkbox", onChange, checked = false, disabled = false, isInvalid = false, readOnly, indeterminate = false, suffix, label, tabIndex = 0, stopPropagation, ref, ...rest }) => {
664
663
  const icon = indeterminate ? (jsxRuntime.jsx(IndeterminateIcon, { className: cvaCheckboxIcon() })) : (checked && jsxRuntime.jsx(CheckIcon, { className: cvaCheckboxIcon() }));
665
664
  const internalRef = React.useRef(null);
666
665
  const { isTextTruncated: isLabelCutOff, ref: labelRef } = reactComponents.useIsTextTruncated();
@@ -683,7 +682,7 @@ const Checkbox = React.forwardRef(({ className, dataTestId = "checkbox", onChang
683
682
  invalid: isReadonly ? false : isInvalid,
684
683
  disabled: isReadonly,
685
684
  }), id: `checkbox-label-${label}`, ref: labelRef, children: label }) }, "tooltip-" + rest.name)) : null, suffix ? (jsxRuntime.jsx("div", { className: cvaBinaryControlSuffixContainer(), "data-testid": dataTestId ? `${dataTestId}-suffix-container` : undefined, children: suffix })) : null] }));
686
- });
685
+ };
687
686
  Checkbox.displayName = "Checkbox";
688
687
 
689
688
  /**
@@ -691,7 +690,7 @@ Checkbox.displayName = "Checkbox";
691
690
  * This component is **not used directly**, but is part of the FormGroup and Field components.
692
691
  *
693
692
  * @param {LabelProps} props - The props for the Label component
694
- * @returns {JSX.Element} Label component
693
+ * @returns {ReactElement} Label component
695
694
  */
696
695
  const Label = ({ id, htmlFor, children, className, dataTestId, disabled, isInvalid, }) => {
697
696
  return (jsxRuntime.jsx("label", { className: cvaLabel({ invalid: isInvalid, disabled, className }), "data-testid": dataTestId, htmlFor: htmlFor || "", id: id || "", children: children }));
@@ -725,11 +724,11 @@ const cvaHelpAddon = cssClassVarianceUtilities.cvaMerge(["ml-auto"]);
725
724
  * Besides a label the component supplies an optional Tooltip, HelpText and HelpAddon support.
726
725
  *
727
726
  * @param {FormGroupProps} props - The props for the FormGroup component
728
- * @returns {JSX.Element} FormGroup component
727
+ * @returns {ReactElement} FormGroup component
729
728
  */
730
729
  const FormGroup = ({ isInvalid, isWarning, helpText, helpAddon, tip, className, dataTestId, label, htmlFor, children, required = false, }) => {
731
730
  const [t] = useTranslation();
732
- const validationStateIcon = React__namespace.useMemo(() => {
731
+ const validationStateIcon = React.useMemo(() => {
733
732
  const color = isInvalid ? "danger" : isWarning ? "warning" : null;
734
733
  return color ? jsxRuntime.jsx(reactComponents.Icon, { color: color, name: "ExclamationTriangle", size: "small" }) : null;
735
734
  }, [isInvalid, isWarning]);
@@ -741,10 +740,10 @@ const FormGroup = ({ isInvalid, isWarning, helpText, helpAddon, tip, className,
741
740
  *
742
741
  * _**Do use**_ the CheckboxField for boolean input.
743
742
  */
744
- const CheckboxField = React.forwardRef(({ label, id, tip, helpText, helpAddon, isInvalid, className, checked, dataTestId, checkboxLabel, onChange, ...rest }, ref) => {
743
+ const CheckboxField = ({ label, id, tip, helpText, helpAddon, isInvalid, className, checked, dataTestId, checkboxLabel, onChange, ref, ...rest }) => {
745
744
  const htmlForId = id ? id : "checkboxField-" + sharedUtils.uuidv4();
746
745
  return (jsxRuntime.jsx(FormGroup, { className: "flex flex-col gap-1", dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: helpText, htmlFor: htmlForId, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(Checkbox, { checked: checked, className: className, dataTestId: dataTestId, id: htmlForId, label: checkboxLabel, onChange: onChange, ref: ref, ...rest }) }));
747
- });
746
+ };
748
747
  CheckboxField.displayName = "CheckboxField";
749
748
 
750
749
  /**
@@ -833,29 +832,29 @@ const ColorField = React.forwardRef(({ label, id, tip, helpText, errorMessage, h
833
832
  const [renderAsInvalid, setRenderAsInvalid] = React.useState(!!errorMessage || (innerValue && typeof innerValue === "string" && !isValidHEXColor(innerValue)) || isInvalid);
834
833
  const errorType = React.useMemo(() => validateColorCode(innerValue, rest.required), [rest.required, innerValue]);
835
834
  const error = React.useMemo(() => (errorType ? t(`colorField.error.${errorType}`) : errorMessage), [errorType, errorMessage, t]);
836
- const handleBlur = React.useCallback(event => {
837
- const newValue = event.target.value;
838
- setInnerValue(newValue);
839
- setRenderAsInvalid(!!errorType);
840
- onBlur?.(event);
841
- }, [errorType, onBlur]);
842
- const handleChange = React.useCallback((event) => {
835
+ const handleInputChange = React.useCallback((event) => {
843
836
  const newValue = event.target.value;
844
837
  setInnerValue(newValue);
845
838
  if (onChange) {
846
839
  onChange(event);
847
840
  }
848
841
  }, [onChange]);
842
+ const handleBlur = React.useCallback(event => {
843
+ const newValue = event.target.value;
844
+ setInnerValue(newValue);
845
+ setRenderAsInvalid(!!errorType);
846
+ onBlur?.(event);
847
+ }, [errorType, onBlur]);
849
848
  return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(renderAsDisabled || renderAsReadonly) : false, tip: tip, children: jsxRuntime.jsxs("div", { className: cvaInput({
850
849
  size: fieldSize,
851
850
  disabled: renderAsDisabled,
852
851
  invalid: renderAsInvalid,
853
852
  className,
854
- }), "data-testid": dataTestId ? `${dataTestId}-container` : undefined, children: [jsxRuntime.jsx("input", { "aria-labelledby": htmlForId + "-label", className: cvaInputColorField({ readOnly: renderAsReadonly }), "data-testid": dataTestId, defaultValue: defaultValue, disabled: renderAsDisabled, id: htmlForId, onBlur: handleBlur, onChange: handleChange, readOnly: renderAsReadonly, ref: innerRef, type: "color", value: innerValue }), jsxRuntime.jsx("input", { "aria-labelledby": htmlForId + "-label-text", className: cvaInputField({
853
+ }), "data-testid": dataTestId ? `${dataTestId}-container` : undefined, children: [jsxRuntime.jsx("input", { "aria-labelledby": htmlForId + "-label", className: cvaInputColorField({ readOnly: renderAsReadonly }), "data-testid": dataTestId, defaultValue: defaultValue, disabled: renderAsDisabled, id: htmlForId, onBlur: handleBlur, onChange: handleInputChange, readOnly: renderAsReadonly, ref: innerRef, type: "color", value: innerValue }), jsxRuntime.jsx("input", { "aria-labelledby": htmlForId + "-label-text", className: cvaInputField({
855
854
  readOnly: renderAsReadonly,
856
855
  disabled: renderAsDisabled,
857
856
  className: "px-1 focus-visible:outline-none",
858
- }), "data-testid": dataTestId ? `${dataTestId}-textField` : undefined, disabled: renderAsDisabled, onBlur: handleBlur, onChange: handleChange, readOnly: renderAsReadonly, type: "text", value: innerValue }), jsxRuntime.jsx(GenericActionsRenderer, { disabled: renderAsDisabled || renderAsReadonly, fieldSize: fieldSize, genericAction: "edit", innerRef: innerRef, tooltipLabel: t("colorField.tooltip") })] }) }));
857
+ }), "data-testid": dataTestId ? `${dataTestId}-textField` : undefined, disabled: renderAsDisabled, onBlur: handleBlur, onChange: handleInputChange, readOnly: renderAsReadonly, type: "text", value: innerValue }), jsxRuntime.jsx(GenericActionsRenderer, { disabled: renderAsDisabled || renderAsReadonly, fieldSize: fieldSize, genericAction: "edit", innerRef: innerRef, tooltipLabel: t("colorField.tooltip") })] }) }));
859
858
  });
860
859
  ColorField.displayName = "ColorField";
861
860
 
@@ -864,18 +863,23 @@ ColorField.displayName = "ColorField";
864
863
  *
865
864
  * NOTE: If shown with a label, please use the `DateField` component instead.
866
865
  */
867
- const DateInput = React.forwardRef(({ min, max, defaultValue, value, ...rest }, ref) => {
866
+ /**
867
+ *
868
+ */
869
+ const DateInput = ({ min, max, defaultValue, value, ref, ...rest }) => {
868
870
  const formatDateToInputString = (date) => date instanceof Date
869
871
  ? polyfill.Temporal.PlainDateTime.from({
870
872
  year: date.getFullYear(),
871
873
  month: date.getMonth() + 1,
872
874
  day: date.getDate(),
873
- }).toPlainDate().toString()
875
+ })
876
+ .toPlainDate()
877
+ .toString()
874
878
  : date;
875
879
  // Chrome and Firefox need their default icon to have datepicker functionality.
876
880
  const showIcon = !/Chrome/.test(navigator.userAgent) && !/Firefox/.test(navigator.userAgent);
877
881
  return (jsxRuntime.jsx(BaseInput, { defaultValue: formatDateToInputString(defaultValue), max: formatDateToInputString(max), min: formatDateToInputString(min), ref: ref, suffix: showIcon ? jsxRuntime.jsx(reactComponents.Icon, { dataTestId: "calendar", name: "Calendar", size: "medium", type: "solid" }) : null, type: "date", value: formatDateToInputString(value), ...rest }));
878
- });
882
+ };
879
883
  DateInput.displayName = "DateInput";
880
884
 
881
885
  /**
@@ -885,11 +889,11 @@ DateInput.displayName = "DateInput";
885
889
  *
886
890
  * _**Do not use**_ this fields for non-serialized dates. Use TextField instead.
887
891
  */
888
- const DateField = React.forwardRef(({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, dataTestId, ...rest }, ref) => {
892
+ const DateField = ({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, dataTestId, ref, ...rest }) => {
889
893
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
890
894
  const htmlForId = id ? id : "dateField-" + sharedUtils.uuidv4();
891
895
  return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(DateInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, dataTestId: dataTestId }) }));
892
- });
896
+ };
893
897
  DateField.displayName = "DateField";
894
898
 
895
899
  const cvaDropZone = cssClassVarianceUtilities.cvaMerge([
@@ -948,7 +952,7 @@ const DropZoneDefaultLabel = () => (jsxRuntime.jsx(Trans, { components: {
948
952
  * The Drop Zone can be used to drag and drop files or to browse and select files from the file system.
949
953
  *
950
954
  * @param {DropZoneProps} props - The props for the DropZone component
951
- * @returns {JSX.Element} DropZone component
955
+ * @returns {ReactElement} DropZone component
952
956
  */
953
957
  const DropZone = ({ className, dataTestId, filesSelected, label = jsxRuntime.jsx(DropZoneDefaultLabel, {}), size = "large", isInvalid = false, disabled = false, accept, multiple = false, ...rest }) => {
954
958
  const [dragActive, setDragActive] = React.useState(false);
@@ -1043,7 +1047,7 @@ const validateEmailId = (emailId, required) => {
1043
1047
  * A reference to the input element is provided as the `ref` prop.
1044
1048
  * For specific input types make sure to use the corresponding input component.
1045
1049
  */
1046
- const EmailInput = React.forwardRef(({ fieldSize = "medium", disabled = false, dataTestId, isInvalid = false, onChange, disableAction = false, ...rest }, ref) => {
1050
+ const EmailInput = ({ fieldSize = "medium", disabled = false, dataTestId, isInvalid = false, onChange, disableAction = false, ref, ...rest }) => {
1047
1051
  const [email, setEmail] = React.useState("");
1048
1052
  const sendEmail = () => {
1049
1053
  return window.open(`mailto:${email}`);
@@ -1055,7 +1059,7 @@ const EmailInput = React.forwardRef(({ fieldSize = "medium", disabled = false, d
1055
1059
  }, [onChange]);
1056
1060
  const renderAsInvalid = (email && !validateEmailAddress(email)) || isInvalid;
1057
1061
  return (jsxRuntime.jsx(BaseInput, { actions: email && email.length > 0 ? (jsxRuntime.jsx(ActionButton, { dataTestId: dataTestId ? `${dataTestId}-emailIcon` : undefined, disabled: disableAction || isInvalid, onClick: sendEmail, size: fieldSize ?? undefined, type: "EMAIL", value: email })) : null, dataTestId: dataTestId, disabled: disabled, isInvalid: renderAsInvalid, onChange: handleChange, placeholder: rest.placeholder || "mail@example.com", ref: ref, type: "email", ...rest }));
1058
- });
1062
+ };
1059
1063
  EmailInput.displayName = "EmailInput";
1060
1064
 
1061
1065
  /**
@@ -1063,7 +1067,7 @@ EmailInput.displayName = "EmailInput";
1063
1067
  * EmailField validates that user enters a valid email address.
1064
1068
  *
1065
1069
  */
1066
- const EmailField = React.forwardRef(({ label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId, value, onChange, onBlur, isInvalid = false, ...rest }, ref) => {
1070
+ const EmailField = ({ label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId, value, onChange, onBlur, isInvalid = false, ref, ...rest }) => {
1067
1071
  const htmlForId = id ? id : "emailField-" + sharedUtils.uuidv4();
1068
1072
  const [t] = useTranslation();
1069
1073
  const [innerValue, setInnerValue] = React.useState(() => {
@@ -1085,7 +1089,7 @@ const EmailField = React.forwardRef(({ label, id, tip, helpText, errorMessage, h
1085
1089
  }
1086
1090
  }, [onChange]);
1087
1091
  return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(EmailInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, onBlur: handleBlur, onChange: handleChange, ref: ref, value: value, ...rest, className: className, dataTestId: dataTestId }) }));
1088
- });
1092
+ };
1089
1093
  EmailField.displayName = "EmailField";
1090
1094
 
1091
1095
  const isNumberValid = (number) => {
@@ -1143,9 +1147,9 @@ const validateNumber = (number, required = false, min, max) => {
1143
1147
  *
1144
1148
  * NOTE: If shown with a label, please use the `NumberField` component instead.
1145
1149
  */
1146
- const NumberInput = React.forwardRef((props, ref) => {
1147
- return jsxRuntime.jsx(BaseInput, { ref: ref, type: "number", ...props, value: props.value });
1148
- });
1150
+ const NumberInput = ({ ref, ...rest }) => {
1151
+ return jsxRuntime.jsx(BaseInput, { ref: ref, type: "number", ...rest, value: rest.value });
1152
+ };
1149
1153
  NumberInput.displayName = "NumberInput";
1150
1154
 
1151
1155
  /**
@@ -1155,7 +1159,7 @@ NumberInput.displayName = "NumberInput";
1155
1159
  *
1156
1160
  * _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
1157
1161
  */
1158
- const NumberField = React.forwardRef(({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, maxLength, className, value, dataTestId, defaultValue, onBlur, onChange, ...rest }, ref) => {
1162
+ const NumberField = ({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, maxLength, className, value, dataTestId, defaultValue, onBlur, onChange, ref, ...rest }) => {
1159
1163
  const htmlForId = id ? id : "numberField-" + sharedUtils.uuidv4();
1160
1164
  const [t] = useTranslation();
1161
1165
  const [innerValue, setInnerValue] = React.useState(() => {
@@ -1194,7 +1198,7 @@ const NumberField = React.forwardRef(({ label, id, tip, helpText, errorMessage,
1194
1198
  }
1195
1199
  }, [onChange]);
1196
1200
  return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(NumberInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, onBlur: handleBlur, onChange: handleChange, ref: ref, value: value, ...rest, className: className, dataTestId: dataTestId }) }));
1197
- });
1201
+ };
1198
1202
  NumberField.displayName = "NumberField";
1199
1203
 
1200
1204
  const cvaOptionCardLabel = cssClassVarianceUtilities.cvaMerge([
@@ -1226,12 +1230,12 @@ const cvaOptionCardContainer = cssClassVarianceUtilities.cvaMerge(["contents"]);
1226
1230
  /**
1227
1231
  * A card version of a radio button that includes an icon, headings and a description.
1228
1232
  */
1229
- const OptionCard = React.forwardRef(({ icon, heading, subheading, description, disabled, id, value, className, contentClassName, dataTestId, customImage, ...rest }, ref) => {
1233
+ const OptionCard = ({ icon, heading, subheading, description, disabled, id, value, className, contentClassName, dataTestId, customImage, ref, ...rest }) => {
1230
1234
  const htmlForId = id ?? "option-card-" + sharedUtils.uuidv4();
1231
1235
  return (jsxRuntime.jsxs("div", { className: cvaOptionCardContainer(), "data-testid": dataTestId, children: [jsxRuntime.jsx("input", { className: "peer absolute h-0 w-0 opacity-0", "data-testid": `${dataTestId}-option-card`, disabled: disabled, id: htmlForId, ref: ref, type: "radio", value: value, ...rest }), jsxRuntime.jsxs("label", { className: cvaOptionCardLabel({ className, disabled }), "data-testid": `${dataTestId}-option-card-label`, htmlFor: htmlForId, children: [disabled && icon && !customImage
1232
1236
  ? React.cloneElement(icon, { className: `${icon.props.className} text-secondary-400` })
1233
1237
  : null, disabled && customImage ? jsxRuntime.jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, !disabled && !customImage && icon, !disabled && customImage ? jsxRuntime.jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, heading ? (jsxRuntime.jsx(reactComponents.Heading, { subtle: disabled, variant: "secondary", children: heading })) : null, subheading || description ? (jsxRuntime.jsxs("div", { className: cvaOptionCardContent({ className: contentClassName }), children: [subheading ? (jsxRuntime.jsx(reactComponents.Text, { align: "center", subtle: disabled, type: "span", weight: "thick", children: subheading })) : null, description ? (jsxRuntime.jsx(reactComponents.Text, { align: "center", subtle: true, type: "span", children: description })) : null] })) : null] })] }));
1234
- });
1238
+ };
1235
1239
  OptionCard.displayName = "OptionCard";
1236
1240
 
1237
1241
  /**
@@ -1239,10 +1243,10 @@ OptionCard.displayName = "OptionCard";
1239
1243
  *
1240
1244
  * NOTE: If shown with a label, please use the `PasswordField` component instead.
1241
1245
  */
1242
- const PasswordInput = React.forwardRef((props, ref) => {
1246
+ const PasswordInput = ({ ref, fieldSize, ...rest }) => {
1243
1247
  const [showPassword, setShowPassword] = React.useState(false);
1244
- return (jsxRuntime.jsx(BaseInput, { ref: ref, ...props, actions: jsxRuntime.jsx("div", { className: cvaActionContainer({ size: props.fieldSize }), children: jsxRuntime.jsx(reactComponents.IconButton, { className: cvaActionButton({ size: props.fieldSize }), icon: jsxRuntime.jsx(reactComponents.Icon, { name: showPassword ? "EyeSlash" : "Eye", size: "small" }), onClick: () => setShowPassword(prevState => !prevState), size: "small", variant: "secondary" }) }), type: showPassword ? "text" : "password" }));
1245
- });
1248
+ return (jsxRuntime.jsx(BaseInput, { ref: ref, ...rest, actions: jsxRuntime.jsx("div", { className: cvaActionContainer({ size: fieldSize }), children: jsxRuntime.jsx(reactComponents.IconButton, { className: cvaActionButton({ size: fieldSize }), icon: jsxRuntime.jsx(reactComponents.Icon, { name: showPassword ? "EyeSlash" : "Eye", size: "small" }), onClick: () => setShowPassword(prevState => !prevState), size: "small", variant: "secondary" }) }), type: showPassword ? "text" : "password" }));
1249
+ };
1246
1250
  PasswordInput.displayName = "PasswordInput";
1247
1251
 
1248
1252
  /**
@@ -1252,14 +1256,14 @@ PasswordInput.displayName = "PasswordInput";
1252
1256
  *
1253
1257
  * _**Do not use** to confirm user actions, such as deleting. Use a checkbox for such flows._
1254
1258
  */
1255
- const PasswordField = React.forwardRef(({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId, ...rest }, ref) => {
1259
+ const PasswordField = ({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId, ref, ...rest }) => {
1256
1260
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
1257
1261
  const htmlFor = id ? id : "passwordField-" + sharedUtils.uuidv4();
1258
1262
  const handleChange = React.useCallback((event) => {
1259
1263
  onChange?.(event);
1260
1264
  }, [onChange]);
1261
1265
  return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.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 }) }));
1262
- });
1266
+ };
1263
1267
  PasswordField.displayName = "PasswordField";
1264
1268
 
1265
1269
  /**
@@ -1324,9 +1328,8 @@ const DEFAULT_COUNTRY_CODE = undefined;
1324
1328
  * @param {boolean} [disabled=false] - Whether the component is disabled or not.
1325
1329
  * @param {string} [fieldSize="medium"] - The size of the input field.
1326
1330
  * @param {boolean} [disableAction=false] - Whether the action button is disabled or not.
1327
- * @returns {JSX.Element} - The PhoneInput component.
1328
1331
  */
1329
- const PhoneInput = React.forwardRef(({ dataTestId, isInvalid, disabled = false, value, defaultValue, fieldSize = "medium", disableAction = false, onChange, readOnly, onFocus, onBlur, name, ...rest }, ref) => {
1332
+ const PhoneInput = ({ dataTestId, isInvalid, disabled = false, value, defaultValue, fieldSize = "medium", disableAction = false, onChange, readOnly, onFocus, onBlur, name, ref, ...rest }) => {
1330
1333
  const [innerValue, setInnerValue] = React.useState(() => {
1331
1334
  return (value?.toString() || defaultValue?.toString()) ?? "";
1332
1335
  });
@@ -1339,8 +1342,7 @@ const PhoneInput = React.forwardRef(({ dataTestId, isInvalid, disabled = false,
1339
1342
  }, []);
1340
1343
  const handleChange = React.useCallback(event => {
1341
1344
  const newValue = event.target.value;
1342
- const noneFormattedValue = parsePhoneNumberFromString.parseIncompletePhoneNumber(newValue);
1343
- event.target.value = noneFormattedValue;
1345
+ event.target.value = parsePhoneNumberFromString.parseIncompletePhoneNumber(newValue);
1344
1346
  onChange?.(event);
1345
1347
  setInnerValue(newValue);
1346
1348
  determineCountry(newValue);
@@ -1370,7 +1372,7 @@ const PhoneInput = React.forwardRef(({ dataTestId, isInvalid, disabled = false,
1370
1372
  fieldIsFocused.current = true;
1371
1373
  }, [onFocus]);
1372
1374
  return (jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-2", "data-testid": dataTestId ? `${dataTestId}-container` : null, children: jsxRuntime.jsx(BaseInput, { actions: !disableAction && innerValue && innerValue.length > 0 ? (jsxRuntime.jsx(ActionButton, { dataTestId: dataTestId ? `${dataTestId}-phoneIcon` : undefined, disabled: isInvalid, size: fieldSize ?? undefined, type: "PHONE_NUMBER", value: 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 }) }));
1373
- });
1375
+ };
1374
1376
  PhoneInput.displayName = "PhoneInput";
1375
1377
 
1376
1378
  /**
@@ -1437,9 +1439,8 @@ const phoneErrorMessage = (phoneNumber, required) => {
1437
1439
  * @param {boolean} [disabled=false] - Whether the component is disabled or not.
1438
1440
  * @param {string} [fieldSize="medium"] - The size of the input field.
1439
1441
  * @param {boolean} [disableAction=false] - Whether the action button is disabled or not.
1440
- * @returns {JSX.Element} - The PhoneField component.
1441
1442
  */
1442
- const PhoneField = React.forwardRef(({ label, id, tip, helpText, isInvalid, errorMessage, value, helpAddon, className, defaultValue, dataTestId, name, onBlur, ...rest }, ref) => {
1443
+ const PhoneField = ({ label, id, tip, helpText, isInvalid, errorMessage, value, helpAddon, className, defaultValue, dataTestId, name, onBlur, ref, ...rest }) => {
1443
1444
  const htmlForId = id ? id : "phoneField-" + sharedUtils.uuidv4();
1444
1445
  const [t] = useTranslation();
1445
1446
  const [innerValue, setInnerValue] = React.useState(() => {
@@ -1472,17 +1473,16 @@ const PhoneField = React.forwardRef(({ label, id, tip, helpText, isInvalid, erro
1472
1473
  onBlur?.(event);
1473
1474
  }, [errorMessage, onBlur, rest.required]);
1474
1475
  return (jsxRuntime.jsx(FormGroup, { className: className, dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(PhoneInput, { "aria-labelledby": htmlForId + "-label", dataTestId: dataTestId, defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, name: name, onBlur: handleBlur, ref: ref, value: value, ...rest }) }));
1475
- });
1476
+ };
1476
1477
  PhoneField.displayName = "PhoneField";
1477
1478
 
1478
1479
  /**
1479
1480
  * The PhoneFieldWithController component is a wrapper for the PhoneField component to connect it to react-hook-form.
1480
1481
  *
1481
- * @returns {JSX.Element} - The PhoneFieldWithController component.
1482
1482
  */
1483
- const PhoneFieldWithController = React.forwardRef(({ control, controllerProps, name, value, ...rest }, ref) => {
1483
+ const PhoneFieldWithController = ({ control, controllerProps, name, value, ref, ...rest }) => {
1484
1484
  return (jsxRuntime.jsx(reactHookForm.Controller, { control: control, defaultValue: value, name: name, ...controllerProps, render: ({ field }) => jsxRuntime.jsx(PhoneField, { ...rest, ...field, ref: ref }) }));
1485
- });
1485
+ };
1486
1486
  PhoneFieldWithController.displayName = "PhoneFieldWithController";
1487
1487
 
1488
1488
  const cvaRadioGroup = cssClassVarianceUtilities.cvaMerge(["flex", "gap-2", "flex-col", "items-start"], {
@@ -1568,7 +1568,7 @@ const RadioGroupContext = React__namespace.createContext(null);
1568
1568
  * _**Do not use** Radio buttons if a user can select many option from a list, use checkboxes instead of radio buttons._
1569
1569
  *
1570
1570
  * @param {RadioGroupProps} props - The props for the RadioGroup component
1571
- * @returns {JSX.Element} RadioGroup component
1571
+ * @returns {ReactElement} RadioGroup component
1572
1572
  */
1573
1573
  const RadioGroup = ({ children, id, name, value, disabled, onChange, label, inline, className, dataTestId, isInvalid, }) => {
1574
1574
  return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, label: label, children: jsxRuntime.jsx("div", { className: cvaRadioGroup({ layout: inline ? "inline" : null, className }), "data-testid": dataTestId, children: jsxRuntime.jsx(RadioGroupContext.Provider, { value: {
@@ -1586,7 +1586,7 @@ RadioGroup.displayName = "RadioGroup";
1586
1586
  * The RadioItem component.
1587
1587
  *
1588
1588
  * @param {RadioItemProps} props - The props for the RadioItem component
1589
- * @returns {JSX.Element} RadioItem component
1589
+ * @returns {ReactElement} RadioItem component
1590
1590
  */
1591
1591
  const RadioItem = ({ label, value, dataTestId, className, description, suffix, ...rest }) => {
1592
1592
  const groupCtx = React.useContext(RadioGroupContext);
@@ -1619,7 +1619,7 @@ const cvaTimeRange = cssClassVarianceUtilities.cvaMerge([
1619
1619
  * TimeRange is used to create a time range entry.
1620
1620
  *
1621
1621
  * @param {TimeRangeProps} props - The props for the TimeRange component
1622
- * @returns {JSX.Element} TimeRange component
1622
+ * @returns {ReactElement} TimeRange component
1623
1623
  */
1624
1624
  const TimeRange = ({ id, className, dataTestId, children, range, onChange, disabled, isInvalid, }) => {
1625
1625
  const [timeRange, setTimeRange] = React.useState(range ?? {
@@ -1649,7 +1649,7 @@ const cvaScheduleItemText = cssClassVarianceUtilities.cvaMerge(["flex", "font-bo
1649
1649
  * Schedule is used to create a time range entries.
1650
1650
  *
1651
1651
  * @param {ScheduleProps} props - The props for the Schedule component
1652
- * @returns {JSX.Element} Schedule component
1652
+ * @returns {ReactElement} Schedule component
1653
1653
  */
1654
1654
  const Schedule = ({ className, dataTestId, schedule, onChange, invalidKeys = [] }) => {
1655
1655
  const [t] = useTranslation();
@@ -1805,7 +1805,7 @@ const hasConsecutiveDays = (schedule) => {
1805
1805
  *
1806
1806
  * NOTE: If shown with a label, please use the `TextField` component instead.
1807
1807
  */
1808
- const TextInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BaseInput, { ref: ref, type: "text", ...props })));
1808
+ const TextInput = ({ ref, ...rest }) => jsxRuntime.jsx(BaseInput, { ref: ref, type: "text", ...rest });
1809
1809
  TextInput.displayName = "TextInput";
1810
1810
 
1811
1811
  const cvaSearch = cssClassVarianceUtilities.cvaMerge([
@@ -1836,15 +1836,14 @@ const cvaSearch = cssClassVarianceUtilities.cvaMerge([
1836
1836
  * The Search component is used to render a search input field.
1837
1837
  *
1838
1838
  * @param {SearchProps} props - The props for the Search component
1839
- * @returns {JSX.Element} Search component
1840
1839
  */
1841
- const Search = React.forwardRef(({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", loading, inputClassName, iconName = "MagnifyingGlass", xMarkRef, ...rest }, ref) => {
1840
+ const Search = ({ className, placeholder = "Search", value, widenInputOnFocus, hideBorderWhenNotInFocus = false, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete = "on", loading, inputClassName, iconName = "MagnifyingGlass", style, xMarkRef, ref, ...rest }) => {
1842
1841
  return (jsxRuntime.jsx(TextInput, { ...rest, autoComplete: autoComplete, className: cvaSearch({ className, border: hideBorderWhenNotInFocus, widenOnFocus: widenInputOnFocus }), dataTestId: dataTestId, disabled: disabled, inputClassName: inputClassName, name: name, onBlur: onBlur, onChange: onChange, onFocus: onFocus, onKeyUp: onKeyUp, placeholder: placeholder, prefix: loading ? (jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered", size: rest.fieldSize ?? undefined })) : (jsxRuntime.jsx(reactComponents.Icon, { name: iconName, size: rest.fieldSize ?? undefined })), ref: ref, suffix:
1843
1842
  //only show the clear button if there is a value and the onClear function is provided
1844
1843
  onClear && value ? (jsxRuntime.jsx("button", { className: "flex", "data-testid": dataTestId ? `${dataTestId}_suffix_component` : null, onClick: () => {
1845
1844
  onClear();
1846
1845
  }, ref: xMarkRef, type: "button", children: jsxRuntime.jsx(reactComponents.Icon, { name: "XMark", size: "small" }) })) : undefined, value: value }));
1847
- });
1846
+ };
1848
1847
  Search.displayName = "Search";
1849
1848
 
1850
1849
  const cvaSelect = cssClassVarianceUtilities.cvaMerge([
@@ -1948,7 +1947,7 @@ const cvaSelectMenu = cssClassVarianceUtilities.cvaMerge(["relative", "p-1", "gr
1948
1947
  * A single select menu item is a basic wrapper around Menu item designed to be used as a single value render in Select list
1949
1948
  *
1950
1949
  * @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
1951
- * @returns {JSX.Element} SingleSelectMenuItem
1950
+ * @returns {ReactElement} SingleSelectMenuItem
1952
1951
  */
1953
1952
  const SingleSelectMenuItem = ({ label, icon, onClick, selected, dataTestId, disabled, optionLabelDescription, fieldSize, }) => {
1954
1953
  return (jsxRuntime.jsx(reactComponents.MenuItem, { dataTestId: dataTestId, disabled: disabled, fieldSize: fieldSize, label: label, onClick: onClick, optionLabelDescription: optionLabelDescription, prefix: icon, selected: selected, suffix: selected ? jsxRuntime.jsx(reactComponents.Icon, { className: "block text-blue-600", name: "Check", size: "medium" }) : undefined }));
@@ -1957,7 +1956,7 @@ const SingleSelectMenuItem = ({ label, icon, onClick, selected, dataTestId, disa
1957
1956
  * A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
1958
1957
  *
1959
1958
  * @param {SelectMenuItemProps} props - The props for the MultiSelectMenuItem
1960
- * @returns {JSX.Element} multi select menu item
1959
+ * @returns {ReactElement} multi select menu item
1961
1960
  */
1962
1961
  const MultiSelectMenuItem = ({ label, onClick, selected, dataTestId, disabled, optionLabelDescription, fieldSize, }) => {
1963
1962
  return (jsxRuntime.jsx(reactComponents.MenuItem, { dataTestId: dataTestId, disabled: disabled, fieldSize: fieldSize, label: label, onClick: e => {
@@ -1973,7 +1972,7 @@ const MultiSelectMenuItem = ({ label, onClick, selected, dataTestId, disabled, o
1973
1972
  * Used in the select component.
1974
1973
  *
1975
1974
  * @param {TagProps} props - The props for the tag component
1976
- * @returns {JSX.Element} TagWithWidth component
1975
+ * @returns {ReactElement} TagWithWidth component
1977
1976
  */
1978
1977
  const TagWithWidth = ({ onWidthKnown, children, ...rest }) => {
1979
1978
  const ref = React.useRef(null);
@@ -1987,13 +1986,13 @@ const TagWithWidth = ({ onWidthKnown, children, ...rest }) => {
1987
1986
  * TagsContainer component to display tags in limited space when children can't fit space it displays counter
1988
1987
  *
1989
1988
  * @param {TagsContainerProps} props - The props for the TagContainer
1990
- * @returns {JSX.Element} TagsContainer
1989
+ * @returns {ReactElement} TagsContainer
1991
1990
  */
1992
1991
  const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled }) => {
1993
1992
  const [isReady, setIsReady] = React.useState(false);
1994
1993
  const [counterWidth, setCounterWidth] = React.useState(0);
1995
1994
  const containerRef = React.useRef(null);
1996
- const availableWidth = React.useRef();
1995
+ const availableWidth = React.useRef(undefined);
1997
1996
  const childrenWidth = React.useRef([]);
1998
1997
  const itemsCount = items.length;
1999
1998
  React.useLayoutEffect(() => {
@@ -2052,12 +2051,12 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
2052
2051
  * @param {Partial<SelectComponents<Option, IsMulti, Group>> | undefined} componentsProps a custom component prop that you can to override defaults
2053
2052
  * @param {boolean} disabled decide to override disabled variant
2054
2053
  * @param {boolean} menuIsOpen menu is open state
2055
- * @param {MutableRefObject<boolean>} refMenuIsEnabled a flag to block menu from open
2054
+ * @param {RefObject<boolean>} refMenuIsEnabled a flag to block menu from open
2056
2055
  * @param {string} dataTestId a test id
2057
2056
  * @param {number} maxSelectedDisplayCount a number of max display count
2058
- * @param {JSX.Element} dropdownIcon an custom dropdown icon
2057
+ * @param {ReactElement} dropdownIcon an custom dropdown icon
2059
2058
  * @param {boolean} hasError decide to override hasError variant
2060
- * @param {JSX.Element} prefix a prefix element
2059
+ * @param {ReactElement} prefix a prefix element
2061
2060
  * @returns {Partial<SelectComponents<Option, boolean, GroupBase<Option>>> | undefined} components object to override react-select default components
2062
2061
  */
2063
2062
  const useCustomComponents = ({ componentsProps, disabled, readOnly, refMenuIsEnabled, dataTestId, maxSelectedDisplayCount, dropdownIcon, prefix, hasError, fieldSize, getOptionLabelDescription, }) => {
@@ -2098,7 +2097,7 @@ const useCustomComponents = ({ componentsProps, disabled, readOnly, refMenuIsEna
2098
2097
  })
2099
2098
  : null, tags && tags.length > maxSelectedDisplayCount ? (jsxRuntime.jsxs(reactComponents.Tag, { color: "neutral", dataTestId: "counter-tag", children: ["+", tags.length - maxSelectedDisplayCount] })) : null, searchInput] })) }));
2100
2099
  }
2101
- return (jsxRuntime.jsx(ReactSelect.components.ValueContainer, { ...props, isDisabled: props.selectProps.isDisabled, children: props.children }));
2100
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(ReactSelect.components.ValueContainer, { ...props, isDisabled: props.selectProps.isDisabled, children: props.children }) }));
2102
2101
  },
2103
2102
  LoadingIndicator: () => {
2104
2103
  return jsxRuntime.jsx(reactComponents.Spinner, { centering: "vertically", className: "mr-2", size: "small" });
@@ -2280,8 +2279,8 @@ const useCustomStyles = ({ refContainer, refPrefix, maxSelectedDisplayCount, sty
2280
2279
  * @returns {UseSelectProps} Select component
2281
2280
  */
2282
2281
  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, getOptionLabelDescription, fieldSize = "medium", ...props }) => {
2283
- const refContainer = React.useRef(null);
2284
- const refPrefix = React.useRef(null);
2282
+ const refContainer = React.useRef(document.createElement("div"));
2283
+ const refPrefix = React.useRef(document.createElement("div"));
2285
2284
  const { customStyles } = useCustomStyles({
2286
2285
  refContainer,
2287
2286
  refPrefix,
@@ -2335,7 +2334,7 @@ const useSelect = ({ id, className, dataTestId = "select", prefix, async, dropdo
2335
2334
  * CreatableSelects are input components used to choose a value from a set.
2336
2335
  *
2337
2336
  * @param {CreatableSelectProps} props - The props for the CreatableSelect component
2338
- * @returns {JSX.Element} CreatableSelect component
2337
+ * @returns {ReactElement} CreatableSelect component
2339
2338
  */
2340
2339
  const CreatableSelect = (props) => {
2341
2340
  const { id, dataTestId = "creatableSelect", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, value, options, onChange, isLoading, classNamePrefix = "creatableSelect", onMenuScrollToBottom, onInputChange, isSearchable, isClearable = false, readOnly, openMenuOnClick = !disabled, openMenuOnFocus = !disabled, allowCreateWhileLoading, onCreateOption, } = props;
@@ -2407,7 +2406,7 @@ const ReactSyncSelect = ReactSelect.default || ReactSelect;
2407
2406
  * Selects are input components used to choose a value from a set.
2408
2407
  *
2409
2408
  * @param {SelectProps} props - The props for the Select component
2410
- * @returns {JSX.Element} Select component
2409
+ * @returns {ReactElement} Select component
2411
2410
  */
2412
2411
  const Select = (props) => {
2413
2412
  const { id, dataTestId = "select", prefix, async, maxMenuHeight = 200, label, hasError, disabled, isMulti, menuPosition = "absolute", value, options, onChange, isLoading, classNamePrefix = "select", onMenuScrollToBottom, onInputChange, isSearchable, isClearable = false, readOnly, fieldSize = "medium", openMenuOnClick = !disabled, openMenuOnFocus = !disabled, hideSelectedOptions = false, } = props;
@@ -2478,7 +2477,10 @@ const Select = (props) => {
2478
2477
  };
2479
2478
  Select.displayName = "Select";
2480
2479
 
2481
- const FormFieldSelectAdapter = React.forwardRef(({ className, dataTestId, helpText, helpAddon, tip, label, isInvalid, errorMessage, name, onBlur, options, value, defaultValue, id, onChange, children, ...rest }, ref) => {
2480
+ /**
2481
+ *
2482
+ */
2483
+ const FormFieldSelectAdapter = ({ className, dataTestId, helpText, helpAddon, tip, label, isInvalid, errorMessage, name, onBlur, options, value, defaultValue, id, onChange, children, ref, ...rest }) => {
2482
2484
  const isFirstRender = reactComponents.useIsFirstRender();
2483
2485
  const [innerValue, setInnerValue] = React.useState(value || defaultValue);
2484
2486
  React.useEffect(() => {
@@ -2532,7 +2534,7 @@ const FormFieldSelectAdapter = React.forwardRef(({ className, dataTestId, helpTe
2532
2534
  value: selectedOption,
2533
2535
  defaultValue: selectedOption,
2534
2536
  })] }));
2535
- });
2537
+ };
2536
2538
  FormFieldSelectAdapter.displayName = "FormFieldSelectAdapter";
2537
2539
 
2538
2540
  /**
@@ -2543,12 +2545,11 @@ FormFieldSelectAdapter.displayName = "FormFieldSelectAdapter";
2543
2545
  * This is done to make the field compatible with the React-hook-form library.
2544
2546
  *
2545
2547
  * @param {SelectFieldProps & CreatableSelectProps} props - The props for the CreatableSelectField component
2546
- * @returns {JSX.Element} CreatableSelectField component
2547
2548
  */
2548
- const CreatableSelectField = React.forwardRef(({ allowCreateWhileLoading, onCreateOption, ...props }, ref) => {
2549
+ const CreatableSelectField = ({ allowCreateWhileLoading, onCreateOption, ref, ...props }) => {
2549
2550
  const creatableSelectOnlyProps = { allowCreateWhileLoading, onCreateOption };
2550
2551
  return (jsxRuntime.jsx(FormFieldSelectAdapter, { ...props, ref: ref, children: convertedProps => jsxRuntime.jsx(CreatableSelect, { ...convertedProps, ...creatableSelectOnlyProps }) }));
2551
- });
2552
+ };
2552
2553
  CreatableSelectField.displayName = "CreatableSelectField";
2553
2554
 
2554
2555
  /**
@@ -2559,11 +2560,10 @@ CreatableSelectField.displayName = "CreatableSelectField";
2559
2560
  * This is done to make the field compatible with the React-hook-form library.
2560
2561
  *
2561
2562
  * @param {SelectFieldProps} props - The props for the SelectField component
2562
- * @returns {JSX.Element} SelectField component
2563
2563
  */
2564
- const SelectField = React.forwardRef(({ ...props }, ref) => {
2564
+ const SelectField = ({ ref, ...props }) => {
2565
2565
  return (jsxRuntime.jsx(FormFieldSelectAdapter, { ...props, ref: ref, children: convertedProps => jsxRuntime.jsx(Select, { ...convertedProps }) }));
2566
- });
2566
+ };
2567
2567
  SelectField.displayName = "SelectField";
2568
2568
 
2569
2569
  const cvaTextArea = cssClassVarianceUtilities.cvaMerge([
@@ -2602,9 +2602,9 @@ const cvaTextArea = cssClassVarianceUtilities.cvaMerge([
2602
2602
  * The TextArea is a base component, and should not be used very often.
2603
2603
  * For most cases the TextAreaField is the correct component.
2604
2604
  */
2605
- const TextArea = React__namespace.forwardRef(({ id, name, value, rows, disabled, placeholder, readOnly, tabIndex, onChange, onFocus, onBlur, maxLength, resize = "vertical", defaultValue, required, dataTestId, isInvalid, className, ...rest }, ref) => {
2605
+ const TextArea = ({ id, name, value, rows, disabled, placeholder, readOnly, tabIndex, onChange, onFocus, onBlur, maxLength, resize = "vertical", defaultValue, required, dataTestId, isInvalid, className, ref, ...rest }) => {
2606
2606
  return (jsxRuntime.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 }));
2607
- });
2607
+ };
2608
2608
  TextArea.displayName = "TextArea";
2609
2609
 
2610
2610
  /**
@@ -2612,17 +2612,20 @@ TextArea.displayName = "TextArea";
2612
2612
  * Used for TextFields to communicate a maximum allowed input length.
2613
2613
  *
2614
2614
  * @param {TextLengthIndicatorProps} props - The props for the TextLengthIndicator component
2615
- * @returns {JSX.Element} TextLengthIndicator component
2615
+ * @returns {ReactElement} TextLengthIndicator component
2616
2616
  */
2617
2617
  const TextLengthIndicator = ({ length, maxLength }) => {
2618
2618
  return (jsxRuntime.jsxs("span", { className: "font-mono", children: [length, "/", maxLength] }));
2619
2619
  };
2620
2620
 
2621
- const TextAreaField = React__namespace.forwardRef(({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId, ...rest }, ref) => {
2622
- const [valueLength, setValueLength] = React__namespace.useState(value ? `${value}`.length : 0);
2621
+ /**
2622
+ *
2623
+ */
2624
+ const TextAreaField = ({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId, ref, ...rest }) => {
2625
+ const [valueLength, setValueLength] = React.useState(value ? `${value}`.length : 0);
2623
2626
  const renderAsInvalid = isInvalid || Boolean(errorMessage);
2624
2627
  const htmlForId = id ? id : "textAreaField-" + sharedUtils.uuidv4();
2625
- const handleChange = React__namespace.useCallback((event) => {
2628
+ const handleChange = React.useCallback((event) => {
2626
2629
  setValueLength(event.target.value.length);
2627
2630
  if (onChange) {
2628
2631
  onChange(event);
@@ -2630,17 +2633,17 @@ const TextAreaField = React__namespace.forwardRef(({ id, label, tip, helpText, h
2630
2633
  }, [onChange]);
2631
2634
  return (jsxRuntime.jsx(FormGroup, { className: tailwindMerge.twMerge(className, "grid", "grid-rows-[auto_1fr_auto]"), dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon ||
2632
2635
  (typeof maxLength === "number" && jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(TextArea, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value, ...rest, className: "h-auto", dataTestId: dataTestId, onChange: handleChange }) }));
2633
- });
2636
+ };
2634
2637
  TextAreaField.displayName = "TextAreaField";
2635
2638
 
2636
2639
  /**
2637
2640
  * Text fields enable the user to interact with and input content and data. This component can be used for long and short form entries. Allow the size of the text input box to reflect the length of the content you expect the user to enter.
2638
2641
  */
2639
- const TextField = React__namespace.forwardRef(({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId, isWarning, ...rest }, ref) => {
2640
- const [valueLength, setValueLength] = React__namespace.useState(value ? `${value}`.length : 0);
2642
+ const TextField = ({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId, isWarning, ref, ...rest }) => {
2643
+ const [valueLength, setValueLength] = React.useState(value ? `${value}`.length : 0);
2641
2644
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
2642
2645
  const htmlFor = id ? id : "textField-" + sharedUtils.uuidv4();
2643
- const handleChange = React__namespace.useCallback((event) => {
2646
+ const handleChange = React.useCallback((event) => {
2644
2647
  setValueLength(event.target.value.length);
2645
2648
  if (onChange) {
2646
2649
  onChange(event);
@@ -2648,14 +2651,14 @@ const TextField = React__namespace.forwardRef(({ id, label, tip, helpText, helpA
2648
2651
  }, [onChange]);
2649
2652
  return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon ||
2650
2653
  (typeof maxLength === "number" && jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, isWarning: isWarning, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(TextInput, { "aria-labelledby": htmlFor + "-label", id: htmlFor, isInvalid: renderAsInvalid, isWarning: isWarning, maxLength: maxLength, ref: ref, value: value, ...rest, className: className, dataTestId: dataTestId, onChange: handleChange }) }));
2651
- });
2654
+ };
2652
2655
  TextField.displayName = "TextField";
2653
2656
 
2654
2657
  /**
2655
2658
  * TimeRangeField Description. <-- Please add a proper Description this is used in Storybook.
2656
2659
  *
2657
2660
  * @param {TimeRangeFieldProps} props - The props for the TimeRangeField component
2658
- * @returns {JSX.Element} TimeRangeField component
2661
+ * @returns {ReactElement} TimeRangeField component
2659
2662
  */
2660
2663
  const TimeRangeField = ({ className, dataTestId, onChange, isInvalid, errorMessage, label, tip, children, helpText, id, ...rest }) => {
2661
2664
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
@@ -2816,23 +2819,23 @@ const cvaUploadInputField = cssClassVarianceUtilities.cvaMerge([
2816
2819
  *
2817
2820
  * NOTE: If shown with a label, please use the `UploadField` component instead.
2818
2821
  */
2819
- const UploadInput = React.forwardRef(({ disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles, ...rest }, ref) => (jsxRuntime.jsx(BaseInput, { accept: acceptedTypes, addonBefore: uploadLabel, disabled: disabled, inputClassName: cvaUploadInputField(), multiple: multipleFiles, nonInteractive: nonInteractive, onClick: event => {
2820
- // onClick used to work with nonInteractive option
2821
- if (nonInteractive) {
2822
- event.preventDefault();
2823
- event.stopPropagation();
2824
- }
2825
- }, ref: ref, type: "file", ...rest })));
2822
+ const UploadInput = ({ disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles, ref, ...rest }) => (jsxRuntime.jsx("label", { className: "tu-upload-input", children: jsxRuntime.jsx(BaseInput, { accept: acceptedTypes, addonBefore: uploadLabel, disabled: disabled, inputClassName: cvaUploadInputField(), multiple: multipleFiles, nonInteractive: nonInteractive, onClick: event => {
2823
+ // onClick used to work with nonInteractive option
2824
+ if (nonInteractive) {
2825
+ event.preventDefault();
2826
+ event.stopPropagation();
2827
+ }
2828
+ }, ref: ref, type: "file", ...rest }) }));
2826
2829
  UploadInput.displayName = "UploadInput";
2827
2830
 
2828
2831
  /**
2829
2832
  * Upload fields enable the user to upload Files.
2830
2833
  */
2831
- const UploadField = React.forwardRef(({ label, id, tip, helpText, errorMessage, isInvalid, className, value, dataTestId, ...rest }, ref) => {
2834
+ const UploadField = ({ label, id, tip, helpText, errorMessage, isInvalid, className, value, dataTestId, ref, ...rest }) => {
2832
2835
  const renderAsInvalid = isInvalid || Boolean(errorMessage);
2833
2836
  const htmlForId = id ? id : "uploadField-" + sharedUtils.uuidv4();
2834
2837
  return (jsxRuntime.jsx(FormGroup, { dataTestId: `${dataTestId}-FormGroup`, helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(UploadInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, dataTestId: dataTestId }) }));
2835
- });
2838
+ };
2836
2839
  UploadField.displayName = "UploadField";
2837
2840
 
2838
2841
  /**
@@ -2871,11 +2874,11 @@ const validateUrl = (url, required) => {
2871
2874
  *
2872
2875
  * NOTE: If shown with a label, please use the `UrlField` component instead.
2873
2876
  */
2874
- const UrlInput = React.forwardRef(({ dataTestId, isInvalid, disabled = false, fieldSize = "medium", disableAction = false, value, defaultValue, ...rest }, ref) => {
2877
+ const UrlInput = ({ dataTestId, isInvalid, disabled = false, fieldSize = "medium", disableAction = false, value, defaultValue, ref, ...rest }) => {
2875
2878
  const [url, setUrl] = React.useState(value?.toString() || defaultValue?.toString());
2876
2879
  const renderAsInvalid = (url && typeof url === "string" && !validateUrlAddress(url)) || isInvalid;
2877
2880
  return (jsxRuntime.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 && (jsxRuntime.jsx(ActionButton, { dataTestId: (dataTestId && `${dataTestId}-url-input-Icon`) || "url-input-action-icon", disabled: renderAsInvalid || Boolean(disabled) || disableAction, size: fieldSize ?? undefined, type: "WEB_ADDRESS", value: url })) }));
2878
- });
2881
+ };
2879
2882
  UrlInput.displayName = "UrlField";
2880
2883
 
2881
2884
  /**
@@ -2883,7 +2886,7 @@ UrlInput.displayName = "UrlField";
2883
2886
  * UrlField validates that user enters a valid web address.
2884
2887
  *
2885
2888
  */
2886
- const UrlField = React.forwardRef(({ label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId, isInvalid = false, value, onBlur, ...rest }, ref) => {
2889
+ const UrlField = ({ label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId, isInvalid = false, value, onBlur, ref, ...rest }) => {
2887
2890
  const htmlForId = id ? id : "urlField-" + sharedUtils.uuidv4();
2888
2891
  const [t] = useTranslation();
2889
2892
  const [innerValue, setInnerValue] = React.useState(() => {
@@ -2899,7 +2902,7 @@ const UrlField = React.forwardRef(({ label, id, tip, helpText, errorMessage, hel
2899
2902
  onBlur?.(event);
2900
2903
  }, [onBlur, rest.required]);
2901
2904
  return (jsxRuntime.jsx(FormGroup, { dataTestId: dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: renderAsInvalid ? error : helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(UrlInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, onBlur: handleBlur, ref: ref, value: value || defaultValue, ...rest, className: className, dataTestId: dataTestId }) }));
2902
- });
2905
+ };
2903
2906
  UrlField.displayName = "UrlField";
2904
2907
 
2905
2908
  /**