@trackunit/react-form-components 1.14.19 → 1.14.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -2019,8 +2019,8 @@ const CreatableSelect = (props) => {
2019
2019
  * @param {LabelProps} props - The props for the Label component
2020
2020
  * @returns {ReactElement} Label component
2021
2021
  */
2022
- const Label = ({ id, htmlFor, children, className, "data-testid": dataTestId, disabled, isInvalid, }) => {
2023
- return (jsxRuntime.jsx("label", { className: cvaLabel({ invalid: isInvalid, disabled, className }), "data-testid": dataTestId, htmlFor: htmlFor || "", id: id || "", children: children }));
2022
+ const Label = ({ id, htmlFor, children, className, "data-testid": dataTestId, disabled, isInvalid, ref, }) => {
2023
+ return (jsxRuntime.jsx("label", { className: cvaLabel({ invalid: isInvalid, disabled, className }), "data-testid": dataTestId, htmlFor: htmlFor || "", id: id || "", ref: ref, children: children }));
2024
2024
  };
2025
2025
 
2026
2026
  const cvaFormGroup = cssClassVarianceUtilities.cvaMerge(["component-formGroup-gap", "group", "form-group"]);
@@ -2053,13 +2053,13 @@ const cvaHelpAddon = cssClassVarianceUtilities.cvaMerge(["ml-auto"]);
2053
2053
  * @param {FormGroupProps} props - The props for the FormGroup component
2054
2054
  * @returns {ReactElement} FormGroup component
2055
2055
  */
2056
- const FormGroup = ({ isInvalid = false, isWarning = false, helpText, helpAddon, tip, className, "data-testid": dataTestId, label, htmlFor, children, required = false, }) => {
2056
+ const FormGroup = ({ isInvalid = false, isWarning = false, helpText, helpAddon, tip, className, "data-testid": dataTestId, label, htmlFor, children, required = false, ref, }) => {
2057
2057
  const [t] = useTranslation();
2058
2058
  const validationStateIcon = react.useMemo(() => {
2059
2059
  const color = isInvalid ? "danger" : isWarning ? "warning" : null;
2060
2060
  return color ? jsxRuntime.jsx(reactComponents.Icon, { color: color, name: "ExclamationTriangle", size: "small" }) : null;
2061
2061
  }, [isInvalid, isWarning]);
2062
- return (jsxRuntime.jsxs("div", { className: cvaFormGroup({ className }), "data-testid": dataTestId, children: [label ? (jsxRuntime.jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Label, { className: "component-formGroup-font", "data-testid": dataTestId ? `${dataTestId}-label` : undefined, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), required ? (jsxRuntime.jsx(reactComponents.Tooltip, { asChild: false, "data-testid": "required-asterisk", label: t("field.required.asterisk.tooltip"), children: "*" })) : null] }), tip ? (jsxRuntime.jsx(reactComponents.Tooltip, { asChild: false, className: "ml-1", "data-testid": dataTestId ? `${dataTestId}-tooltip` : undefined, label: tip, placement: "bottom" })) : null] })) : null, children, helpText || helpAddon ? (jsxRuntime.jsxs("div", { className: cvaFormGroupContainerAfter({ invalid: isInvalid, isWarning: isWarning }), children: [helpText ? (jsxRuntime.jsxs("div", { className: "flex gap-1", children: [validationStateIcon, jsxRuntime.jsx("span", { "data-testid": dataTestId ? `${dataTestId}-helpText` : undefined, children: helpText })] })) : undefined, helpAddon ? (jsxRuntime.jsx("span", { className: cvaHelpAddon(), "data-testid": dataTestId ? `${dataTestId}-helpAddon` : null, children: helpAddon })) : null] })) : null] }));
2062
+ return (jsxRuntime.jsxs("div", { className: cvaFormGroup({ className }), "data-testid": dataTestId, ref: ref, children: [label ? (jsxRuntime.jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Label, { className: "component-formGroup-font", "data-testid": dataTestId ? `${dataTestId}-label` : undefined, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), required ? (jsxRuntime.jsx(reactComponents.Tooltip, { asChild: false, "data-testid": "required-asterisk", label: t("field.required.asterisk.tooltip"), children: jsxRuntime.jsx("span", { children: "*" }) })) : null] }), tip ? (jsxRuntime.jsx(reactComponents.Tooltip, { asChild: false, className: "ml-1", "data-testid": dataTestId ? `${dataTestId}-tooltip` : undefined, label: tip, placement: "bottom" })) : null] })) : null, children, helpText || helpAddon ? (jsxRuntime.jsxs("div", { className: cvaFormGroupContainerAfter({ invalid: isInvalid, isWarning: isWarning }), children: [helpText ? (jsxRuntime.jsxs("div", { className: "flex gap-1", children: [validationStateIcon, jsxRuntime.jsx("span", { "data-testid": dataTestId ? `${dataTestId}-helpText` : undefined, children: helpText })] })) : undefined, helpAddon ? (jsxRuntime.jsx("span", { className: cvaHelpAddon(), "data-testid": dataTestId ? `${dataTestId}-helpAddon` : null, children: helpAddon })) : null] })) : null] }));
2063
2063
  };
2064
2064
 
2065
2065
  /**
@@ -2409,7 +2409,7 @@ const DropZoneDefaultLabel = () => (jsxRuntime.jsx(Trans, { components: {
2409
2409
  * @param {DropZoneProps} props - The props for the DropZone component
2410
2410
  * @returns {ReactElement} DropZone component
2411
2411
  */
2412
- const DropZone = ({ className, "data-testid": dataTestId, filesSelected, label = jsxRuntime.jsx(DropZoneDefaultLabel, {}), size = "large", isInvalid = false, disabled = false, accept, multiple = false, ...rest }) => {
2412
+ const DropZone = ({ className, "data-testid": dataTestId, filesSelected, label = jsxRuntime.jsx(DropZoneDefaultLabel, {}), size = "large", isInvalid = false, disabled = false, accept, multiple = false, ref, ...rest }) => {
2413
2413
  const [dragActive, setDragActive] = react.useState(false);
2414
2414
  const [fileDropped, setFileDropped] = react.useState(false);
2415
2415
  const [t] = useTranslation();
@@ -2457,7 +2457,7 @@ const DropZone = ({ className, "data-testid": dataTestId, filesSelected, label =
2457
2457
  e.preventDefault();
2458
2458
  e.stopPropagation();
2459
2459
  }
2460
- }, onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop, ...rest, children: jsxRuntime.jsxs("label", { className: cvaDropZoneLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : null, ref: inputLabelRef, children: [jsxRuntime.jsx("input", { accept: accept, className: "hidden", multiple: multiple, onChange: handleChange, title: t("dropzone.input.title"), type: "file" }), jsxRuntime.jsx("div", { className: cvaDropZoneIconBackground({ invalid: isInvalid }), children: jsxRuntime.jsx(reactComponents.Icon, { className: !isInvalid ? "text-neutral-400" : "", color: isInvalid ? "danger" : "neutral", name: "ArrowUpCircle", type: "solid" }) }), jsxRuntime.jsx("button", { disabled: disabled, onClick: handleButtonClick, children: label })] }) }));
2460
+ }, onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop, ref: ref, ...rest, children: jsxRuntime.jsxs("label", { className: cvaDropZoneLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : null, ref: inputLabelRef, children: [jsxRuntime.jsx("input", { accept: accept, className: "hidden", multiple: multiple, onChange: handleChange, title: t("dropzone.input.title"), type: "file" }), jsxRuntime.jsx("div", { className: cvaDropZoneIconBackground({ invalid: isInvalid }), children: jsxRuntime.jsx(reactComponents.Icon, { className: !isInvalid ? "text-neutral-400" : "", color: isInvalid ? "danger" : "neutral", name: "ArrowUpCircle", type: "solid" }) }), jsxRuntime.jsx("button", { disabled: disabled, onClick: handleButtonClick, children: label })] }) }));
2461
2461
  };
2462
2462
 
2463
2463
  // Doing the same check as we do on the backend
@@ -3316,8 +3316,8 @@ const RadioGroupContext = react.createContext(null);
3316
3316
  * @param {RadioGroupProps} props - The props for the RadioGroup component
3317
3317
  * @returns {ReactElement} RadioGroup component
3318
3318
  */
3319
- const RadioGroup = ({ children, id, name, value, disabled, onChange, label, inline = false, className, "data-testid": dataTestId, isInvalid, }) => {
3320
- return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, label: label, children: jsxRuntime.jsx("div", { className: cvaInputGroup({ layout: inline ? "inline" : null, className }), "data-testid": dataTestId, role: "radiogroup", children: jsxRuntime.jsx(RadioGroupContext.Provider, { value: {
3319
+ const RadioGroup = ({ children, id, name, value, disabled, onChange, label, inline = false, className, "data-testid": dataTestId, isInvalid, ref, }) => {
3320
+ return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, label: label, children: jsxRuntime.jsx("div", { className: cvaInputGroup({ layout: inline ? "inline" : null, className }), "data-testid": dataTestId, ref: ref, role: "radiogroup", children: jsxRuntime.jsx(RadioGroupContext.Provider, { value: {
3321
3321
  id,
3322
3322
  value,
3323
3323
  name: name || id,
@@ -3334,7 +3334,7 @@ RadioGroup.displayName = "RadioGroup";
3334
3334
  * @param {RadioItemProps} props - The props for the RadioItem component
3335
3335
  * @returns {ReactElement} RadioItem component
3336
3336
  */
3337
- const RadioItem = ({ label, value, "data-testid": dataTestId, className, description, suffix, tabIndex, ...rest }) => {
3337
+ const RadioItem = ({ label, value, "data-testid": dataTestId, className, description, suffix, tabIndex, ref, ...rest }) => {
3338
3338
  const groupCtx = react.useContext(RadioGroupContext);
3339
3339
  const isChecked = groupCtx?.value === value;
3340
3340
  // Empty string is treated as "no selection" to allow tabbing into the group when no radio is checked
@@ -3355,7 +3355,7 @@ const RadioItem = ({ label, value, "data-testid": dataTestId, className, descrip
3355
3355
  }, [isChecked]);
3356
3356
  return (jsxRuntime.jsxs("label", { className: hasLabel
3357
3357
  ? cvaBinaryControlWrapper({ className })
3358
- : `inline-flex w-fit items-center gap-2 ${className || ""}`.trim(), "data-testid": dataTestId ? `${dataTestId}-Wrapper` : undefined, children: [jsxRuntime.jsx("input", { "aria-describedby": descriptionId, checked: isChecked, className: cvaRadioItem({
3358
+ : `inline-flex w-fit items-center gap-2 ${className || ""}`.trim(), "data-testid": dataTestId ? `${dataTestId}-Wrapper` : undefined, ref: ref, children: [jsxRuntime.jsx("input", { "aria-describedby": descriptionId, checked: isChecked, className: cvaRadioItem({
3359
3359
  checked: isChecked,
3360
3360
  disabled: groupCtx?.disabled,
3361
3361
  invalid: groupCtx?.isInvalid,
@@ -3381,7 +3381,7 @@ const cvaTimeRange = cssClassVarianceUtilities.cvaMerge([
3381
3381
  * @param {TimeRangeProps} props - The props for the TimeRange component
3382
3382
  * @returns {ReactElement} TimeRange component
3383
3383
  */
3384
- const TimeRange = ({ id, className, "data-testid": dataTestId, children, range, onChange, disabled, isInvalid, }) => {
3384
+ const TimeRange = ({ id, className, "data-testid": dataTestId, children, range, onChange, disabled, isInvalid, ref, }) => {
3385
3385
  const [timeRange, setTimeRange] = react.useState(range ?? {
3386
3386
  timeFrom: DEFAULT_TIME,
3387
3387
  timeTo: DEFAULT_TIME,
@@ -3393,7 +3393,7 @@ const TimeRange = ({ id, className, "data-testid": dataTestId, children, range,
3393
3393
  setTimeRange(prev => ({ ...prev, timeTo }));
3394
3394
  };
3395
3395
  const onRangeChange = () => onChange(timeRange);
3396
- return (jsxRuntime.jsxs("div", { className: cvaTimeRange({ className }), "data-testid": dataTestId, id: id, children: [jsxRuntime.jsx(BaseInput, { "data-testid": `${dataTestId}-from`, disabled: disabled, isInvalid: isInvalid, onBlur: onRangeChange, onChange: (time) => onChangeFrom(time.currentTarget.value), type: "time", value: timeRange.timeFrom === "" ? DEFAULT_TIME : timeRange.timeFrom }), children ?? jsxRuntime.jsx("div", { "data-testid": `${dataTestId}-separator`, children: "-" }), jsxRuntime.jsx(BaseInput, { "data-testid": `${dataTestId}-to`, disabled: disabled, isInvalid: isInvalid, onBlur: onRangeChange, onChange: (time) => onChangeTo(time.currentTarget.value), type: "time", value: timeRange.timeTo === "" ? DEFAULT_TIME : timeRange.timeTo })] }));
3396
+ return (jsxRuntime.jsxs("div", { className: cvaTimeRange({ className }), "data-testid": dataTestId, id: id, ref: ref, children: [jsxRuntime.jsx(BaseInput, { "data-testid": `${dataTestId}-from`, disabled: disabled, isInvalid: isInvalid, onBlur: onRangeChange, onChange: (time) => onChangeFrom(time.currentTarget.value), type: "time", value: timeRange.timeFrom === "" ? DEFAULT_TIME : timeRange.timeFrom }), children ?? jsxRuntime.jsx("div", { "data-testid": `${dataTestId}-separator`, children: "-" }), jsxRuntime.jsx(BaseInput, { "data-testid": `${dataTestId}-to`, disabled: disabled, isInvalid: isInvalid, onBlur: onRangeChange, onChange: (time) => onChangeTo(time.currentTarget.value), type: "time", value: timeRange.timeTo === "" ? DEFAULT_TIME : timeRange.timeTo })] }));
3397
3397
  };
3398
3398
  const DEFAULT_TIME = "12:00";
3399
3399
 
@@ -3412,7 +3412,7 @@ const cvaScheduleItemText = cssClassVarianceUtilities.cvaMerge(["flex", "font-bo
3412
3412
  * @param {ScheduleProps} props - The props for the Schedule component
3413
3413
  * @returns {ReactElement} Schedule component
3414
3414
  */
3415
- const Schedule = ({ className, "data-testid": dataTestId, schedule, onChange, invalidKeys = [], }) => {
3415
+ const Schedule = ({ className, "data-testid": dataTestId, schedule, onChange, invalidKeys = [], ref, }) => {
3416
3416
  const [t] = useTranslation();
3417
3417
  const onRangeChange = (range, index) => {
3418
3418
  const newSchedule = schedule.map((day, dayIndex) => (index === dayIndex ? { ...day, range: { ...range } } : day));
@@ -3444,7 +3444,7 @@ const Schedule = ({ className, "data-testid": dataTestId, schedule, onChange, in
3444
3444
  : day);
3445
3445
  onChange(newSchedule);
3446
3446
  };
3447
- return (jsxRuntime.jsx("div", { className: className, "data-testid": dataTestId, children: schedule.map(({ label, range, isActive, key, checkboxLabel, isAllDay }, index) => {
3447
+ return (jsxRuntime.jsx("div", { className: className, "data-testid": dataTestId, ref: ref, children: schedule.map(({ label, range, isActive, key, checkboxLabel, isAllDay }, index) => {
3448
3448
  return (jsxRuntime.jsxs("div", { className: cvaScheduleItem(), children: [jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4 sm:hidden", children: [jsxRuntime.jsx(reactComponents.Text, { className: "font-medium text-neutral-500", children: t("schedule.label.day") }), jsxRuntime.jsx(reactComponents.Text, { className: cvaScheduleItemText(), size: "medium", subtle: !isActive, children: label }), jsxRuntime.jsx(reactComponents.Text, { className: "font-medium text-neutral-500", children: t("schedule.label.active") }), jsxRuntime.jsx(Checkbox, { checked: isActive, label: checkboxLabel, onChange: (event) => onActiveChange(Boolean(event.currentTarget.checked), index) }), jsxRuntime.jsx(reactComponents.Text, { className: "font-medium text-neutral-500", children: t("schedule.label.allDay") }), jsxRuntime.jsx(Checkbox, { checked: isAllDay ? isActive : undefined, disabled: !isActive, onChange: (event) => onAllDayChange(Boolean(event.currentTarget.checked), index) }), jsxRuntime.jsx(TimeRange, { disabled: !isActive || isAllDay, isInvalid: !!invalidKeys.find((invalidKey) => invalidKey === key), onChange: (newRange) => onRangeChange(newRange, index), range: range })] }), jsxRuntime.jsxs("div", { className: "max-sm:hidden sm:grid sm:grid-cols-[100px_200px_60px_250px_250px] sm:gap-2", children: [jsxRuntime.jsx(Checkbox, { checked: isActive, "data-testid": `${dataTestId}-${key}-checkbox`, label: checkboxLabel, onChange: (event) => onActiveChange(Boolean(event.currentTarget.checked), index) }), jsxRuntime.jsx(reactComponents.Text, { className: cvaScheduleItemText(), size: "medium", subtle: !isActive, children: label }), jsxRuntime.jsx(Checkbox, { checked: isAllDay ? isActive : undefined, "data-testid": `${dataTestId}-${key}-allday-checkbox`, disabled: !isActive, onChange: (event) => onAllDayChange(Boolean(event.currentTarget.checked), index) }), jsxRuntime.jsx(TimeRange, { "data-testid": `${dataTestId}-${key}-range`, disabled: !isActive || isAllDay, isInvalid: !!invalidKeys.find((invalidKey) => invalidKey === key), onChange: (newRange) => onRangeChange(newRange, index), range: isAllDay ? undefined : range })] })] }, key + label));
3449
3449
  }) }));
3450
3450
  };
@@ -3928,10 +3928,10 @@ TextField.displayName = "TextField";
3928
3928
  * @param {TimeRangeFieldProps} props - The props for the TimeRangeField component
3929
3929
  * @returns {ReactElement} TimeRangeField component
3930
3930
  */
3931
- const TimeRangeField = ({ className, "data-testid": dataTestId, onChange, isInvalid, errorMessage, label, tip, children, helpText, id, ...rest }) => {
3931
+ const TimeRangeField = ({ className, "data-testid": dataTestId, onChange, isInvalid, errorMessage, label, tip, children, helpText, id, ref, ...rest }) => {
3932
3932
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
3933
3933
  const htmlFor = id ? id : "timeRangeField-" + sharedUtils.uuidv4();
3934
- return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, tip: tip, children: jsxRuntime.jsx(TimeRange, { className: className, "data-testid": dataTestId, isInvalid: renderAsInvalid, onChange: onChange, ...rest, children: children }) }));
3934
+ return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, ref: ref, tip: tip, children: jsxRuntime.jsx(TimeRange, { className: className, "data-testid": dataTestId, isInvalid: renderAsInvalid, onChange: onChange, ...rest, children: children }) }));
3935
3935
  };
3936
3936
 
3937
3937
  const cvaToggleSwitchWrapper = cssClassVarianceUtilities.cvaMerge(["grid", "grid-cols-[auto]", "items-center"]);
@@ -4167,10 +4167,10 @@ ToggleSwitch.displayName = "ToggleSwitch";
4167
4167
  * @param {ToggleSwitchOptionProps} props - The props for the ToggleSwitchOption component
4168
4168
  * @returns {ReactElement} ToggleSwitchOption component
4169
4169
  */
4170
- const ToggleSwitchOption = ({ label, className, description, suffix, id, "data-testid": dataTestId = "toggle-switch-option", ...rest }) => {
4170
+ const ToggleSwitchOption = ({ label, className, description, suffix, id, "data-testid": dataTestId = "toggle-switch-option", ref, ...rest }) => {
4171
4171
  const { ref: labelRef, isTextTruncated: isLabelTruncated } = reactComponents.useIsTextTruncated();
4172
4172
  const { ref: descriptionRef, isTextTruncated: isDescriptionTruncated } = reactComponents.useIsTextTruncated();
4173
- return (jsxRuntime.jsxs("label", { className: cvaBinaryControlWrapper({ className }), "data-testid": dataTestId, htmlFor: `${id}-toggle-switch`, tabIndex: -1, children: [jsxRuntime.jsx(ToggleSwitch, { "data-testid": `${dataTestId}-switcher`, id: `${id}-toggle-switch`, ...rest }), jsxRuntime.jsx(reactComponents.Tooltip, { asChild: false, className: cvaBinaryControlLabelTooltip(), "data-testid": `${dataTestId}-label-tooltip`, disabled: !isLabelTruncated, label: label, placement: "top", children: jsxRuntime.jsx("span", { className: cvaLabel({
4173
+ return (jsxRuntime.jsxs("label", { className: cvaBinaryControlWrapper({ className }), "data-testid": dataTestId, htmlFor: `${id}-toggle-switch`, ref: ref, tabIndex: -1, children: [jsxRuntime.jsx(ToggleSwitch, { "data-testid": `${dataTestId}-switcher`, id: `${id}-toggle-switch`, ...rest }), jsxRuntime.jsx(reactComponents.Tooltip, { asChild: false, className: cvaBinaryControlLabelTooltip(), "data-testid": `${dataTestId}-label-tooltip`, disabled: !isLabelTruncated, label: label, placement: "top", children: jsxRuntime.jsx("span", { className: cvaLabel({
4174
4174
  disabled: rest.disabled || rest.readOnly,
4175
4175
  className: "select-none",
4176
4176
  }), "data-testid": `${dataTestId}-label`, ref: labelRef, children: label }) }, `${id}-label-tooltip`), suffix ? (jsxRuntime.jsx("div", { className: cvaBinaryControlSuffixContainer(), "data-testid": `${dataTestId}-suffix-container`, children: suffix })) : null, description ? (jsxRuntime.jsx(reactComponents.Tooltip, { asChild: false, className: cvaBinaryControlDescriptionTooltip(), "data-testid": `${dataTestId}-description-tooltip`, disabled: !isDescriptionTruncated, label: description, placement: "top", children: jsxRuntime.jsx("span", { className: cvaBinaryControlDescription({ disabled: rest.disabled || rest.readOnly }), "data-testid": `${dataTestId}-description`, id: `${id}-description`, ref: descriptionRef, children: description }) }, `${id}-description-tooltip`)) : null] }));
package/index.esm.js CHANGED
@@ -2018,8 +2018,8 @@ const CreatableSelect = (props) => {
2018
2018
  * @param {LabelProps} props - The props for the Label component
2019
2019
  * @returns {ReactElement} Label component
2020
2020
  */
2021
- const Label = ({ id, htmlFor, children, className, "data-testid": dataTestId, disabled, isInvalid, }) => {
2022
- return (jsx("label", { className: cvaLabel({ invalid: isInvalid, disabled, className }), "data-testid": dataTestId, htmlFor: htmlFor || "", id: id || "", children: children }));
2021
+ const Label = ({ id, htmlFor, children, className, "data-testid": dataTestId, disabled, isInvalid, ref, }) => {
2022
+ return (jsx("label", { className: cvaLabel({ invalid: isInvalid, disabled, className }), "data-testid": dataTestId, htmlFor: htmlFor || "", id: id || "", ref: ref, children: children }));
2023
2023
  };
2024
2024
 
2025
2025
  const cvaFormGroup = cvaMerge(["component-formGroup-gap", "group", "form-group"]);
@@ -2052,13 +2052,13 @@ const cvaHelpAddon = cvaMerge(["ml-auto"]);
2052
2052
  * @param {FormGroupProps} props - The props for the FormGroup component
2053
2053
  * @returns {ReactElement} FormGroup component
2054
2054
  */
2055
- const FormGroup = ({ isInvalid = false, isWarning = false, helpText, helpAddon, tip, className, "data-testid": dataTestId, label, htmlFor, children, required = false, }) => {
2055
+ const FormGroup = ({ isInvalid = false, isWarning = false, helpText, helpAddon, tip, className, "data-testid": dataTestId, label, htmlFor, children, required = false, ref, }) => {
2056
2056
  const [t] = useTranslation();
2057
2057
  const validationStateIcon = useMemo(() => {
2058
2058
  const color = isInvalid ? "danger" : isWarning ? "warning" : null;
2059
2059
  return color ? jsx(Icon, { color: color, name: "ExclamationTriangle", size: "small" }) : null;
2060
2060
  }, [isInvalid, isWarning]);
2061
- return (jsxs("div", { className: cvaFormGroup({ className }), "data-testid": dataTestId, children: [label ? (jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsxs(Fragment, { children: [jsx(Label, { className: "component-formGroup-font", "data-testid": dataTestId ? `${dataTestId}-label` : undefined, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), required ? (jsx(Tooltip, { asChild: false, "data-testid": "required-asterisk", label: t("field.required.asterisk.tooltip"), children: "*" })) : null] }), tip ? (jsx(Tooltip, { asChild: false, className: "ml-1", "data-testid": dataTestId ? `${dataTestId}-tooltip` : undefined, label: tip, placement: "bottom" })) : null] })) : null, children, helpText || helpAddon ? (jsxs("div", { className: cvaFormGroupContainerAfter({ invalid: isInvalid, isWarning: isWarning }), children: [helpText ? (jsxs("div", { className: "flex gap-1", children: [validationStateIcon, jsx("span", { "data-testid": dataTestId ? `${dataTestId}-helpText` : undefined, children: helpText })] })) : undefined, helpAddon ? (jsx("span", { className: cvaHelpAddon(), "data-testid": dataTestId ? `${dataTestId}-helpAddon` : null, children: helpAddon })) : null] })) : null] }));
2061
+ return (jsxs("div", { className: cvaFormGroup({ className }), "data-testid": dataTestId, ref: ref, children: [label ? (jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsxs(Fragment, { children: [jsx(Label, { className: "component-formGroup-font", "data-testid": dataTestId ? `${dataTestId}-label` : undefined, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), required ? (jsx(Tooltip, { asChild: false, "data-testid": "required-asterisk", label: t("field.required.asterisk.tooltip"), children: jsx("span", { children: "*" }) })) : null] }), tip ? (jsx(Tooltip, { asChild: false, className: "ml-1", "data-testid": dataTestId ? `${dataTestId}-tooltip` : undefined, label: tip, placement: "bottom" })) : null] })) : null, children, helpText || helpAddon ? (jsxs("div", { className: cvaFormGroupContainerAfter({ invalid: isInvalid, isWarning: isWarning }), children: [helpText ? (jsxs("div", { className: "flex gap-1", children: [validationStateIcon, jsx("span", { "data-testid": dataTestId ? `${dataTestId}-helpText` : undefined, children: helpText })] })) : undefined, helpAddon ? (jsx("span", { className: cvaHelpAddon(), "data-testid": dataTestId ? `${dataTestId}-helpAddon` : null, children: helpAddon })) : null] })) : null] }));
2062
2062
  };
2063
2063
 
2064
2064
  /**
@@ -2408,7 +2408,7 @@ const DropZoneDefaultLabel = () => (jsx(Trans, { components: {
2408
2408
  * @param {DropZoneProps} props - The props for the DropZone component
2409
2409
  * @returns {ReactElement} DropZone component
2410
2410
  */
2411
- const DropZone = ({ className, "data-testid": dataTestId, filesSelected, label = jsx(DropZoneDefaultLabel, {}), size = "large", isInvalid = false, disabled = false, accept, multiple = false, ...rest }) => {
2411
+ const DropZone = ({ className, "data-testid": dataTestId, filesSelected, label = jsx(DropZoneDefaultLabel, {}), size = "large", isInvalid = false, disabled = false, accept, multiple = false, ref, ...rest }) => {
2412
2412
  const [dragActive, setDragActive] = useState(false);
2413
2413
  const [fileDropped, setFileDropped] = useState(false);
2414
2414
  const [t] = useTranslation();
@@ -2456,7 +2456,7 @@ const DropZone = ({ className, "data-testid": dataTestId, filesSelected, label =
2456
2456
  e.preventDefault();
2457
2457
  e.stopPropagation();
2458
2458
  }
2459
- }, onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop, ...rest, children: jsxs("label", { className: cvaDropZoneLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : null, ref: inputLabelRef, children: [jsx("input", { accept: accept, className: "hidden", multiple: multiple, onChange: handleChange, title: t("dropzone.input.title"), type: "file" }), jsx("div", { className: cvaDropZoneIconBackground({ invalid: isInvalid }), children: jsx(Icon, { className: !isInvalid ? "text-neutral-400" : "", color: isInvalid ? "danger" : "neutral", name: "ArrowUpCircle", type: "solid" }) }), jsx("button", { disabled: disabled, onClick: handleButtonClick, children: label })] }) }));
2459
+ }, onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop, ref: ref, ...rest, children: jsxs("label", { className: cvaDropZoneLabel(), "data-testid": dataTestId ? `${dataTestId}-label` : null, ref: inputLabelRef, children: [jsx("input", { accept: accept, className: "hidden", multiple: multiple, onChange: handleChange, title: t("dropzone.input.title"), type: "file" }), jsx("div", { className: cvaDropZoneIconBackground({ invalid: isInvalid }), children: jsx(Icon, { className: !isInvalid ? "text-neutral-400" : "", color: isInvalid ? "danger" : "neutral", name: "ArrowUpCircle", type: "solid" }) }), jsx("button", { disabled: disabled, onClick: handleButtonClick, children: label })] }) }));
2460
2460
  };
2461
2461
 
2462
2462
  // Doing the same check as we do on the backend
@@ -3315,8 +3315,8 @@ const RadioGroupContext = createContext(null);
3315
3315
  * @param {RadioGroupProps} props - The props for the RadioGroup component
3316
3316
  * @returns {ReactElement} RadioGroup component
3317
3317
  */
3318
- const RadioGroup = ({ children, id, name, value, disabled, onChange, label, inline = false, className, "data-testid": dataTestId, isInvalid, }) => {
3319
- return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, label: label, children: jsx("div", { className: cvaInputGroup({ layout: inline ? "inline" : null, className }), "data-testid": dataTestId, role: "radiogroup", children: jsx(RadioGroupContext.Provider, { value: {
3318
+ const RadioGroup = ({ children, id, name, value, disabled, onChange, label, inline = false, className, "data-testid": dataTestId, isInvalid, ref, }) => {
3319
+ return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, label: label, children: jsx("div", { className: cvaInputGroup({ layout: inline ? "inline" : null, className }), "data-testid": dataTestId, ref: ref, role: "radiogroup", children: jsx(RadioGroupContext.Provider, { value: {
3320
3320
  id,
3321
3321
  value,
3322
3322
  name: name || id,
@@ -3333,7 +3333,7 @@ RadioGroup.displayName = "RadioGroup";
3333
3333
  * @param {RadioItemProps} props - The props for the RadioItem component
3334
3334
  * @returns {ReactElement} RadioItem component
3335
3335
  */
3336
- const RadioItem = ({ label, value, "data-testid": dataTestId, className, description, suffix, tabIndex, ...rest }) => {
3336
+ const RadioItem = ({ label, value, "data-testid": dataTestId, className, description, suffix, tabIndex, ref, ...rest }) => {
3337
3337
  const groupCtx = useContext(RadioGroupContext);
3338
3338
  const isChecked = groupCtx?.value === value;
3339
3339
  // Empty string is treated as "no selection" to allow tabbing into the group when no radio is checked
@@ -3354,7 +3354,7 @@ const RadioItem = ({ label, value, "data-testid": dataTestId, className, descrip
3354
3354
  }, [isChecked]);
3355
3355
  return (jsxs("label", { className: hasLabel
3356
3356
  ? cvaBinaryControlWrapper({ className })
3357
- : `inline-flex w-fit items-center gap-2 ${className || ""}`.trim(), "data-testid": dataTestId ? `${dataTestId}-Wrapper` : undefined, children: [jsx("input", { "aria-describedby": descriptionId, checked: isChecked, className: cvaRadioItem({
3357
+ : `inline-flex w-fit items-center gap-2 ${className || ""}`.trim(), "data-testid": dataTestId ? `${dataTestId}-Wrapper` : undefined, ref: ref, children: [jsx("input", { "aria-describedby": descriptionId, checked: isChecked, className: cvaRadioItem({
3358
3358
  checked: isChecked,
3359
3359
  disabled: groupCtx?.disabled,
3360
3360
  invalid: groupCtx?.isInvalid,
@@ -3380,7 +3380,7 @@ const cvaTimeRange = cvaMerge([
3380
3380
  * @param {TimeRangeProps} props - The props for the TimeRange component
3381
3381
  * @returns {ReactElement} TimeRange component
3382
3382
  */
3383
- const TimeRange = ({ id, className, "data-testid": dataTestId, children, range, onChange, disabled, isInvalid, }) => {
3383
+ const TimeRange = ({ id, className, "data-testid": dataTestId, children, range, onChange, disabled, isInvalid, ref, }) => {
3384
3384
  const [timeRange, setTimeRange] = useState(range ?? {
3385
3385
  timeFrom: DEFAULT_TIME,
3386
3386
  timeTo: DEFAULT_TIME,
@@ -3392,7 +3392,7 @@ const TimeRange = ({ id, className, "data-testid": dataTestId, children, range,
3392
3392
  setTimeRange(prev => ({ ...prev, timeTo }));
3393
3393
  };
3394
3394
  const onRangeChange = () => onChange(timeRange);
3395
- return (jsxs("div", { className: cvaTimeRange({ className }), "data-testid": dataTestId, id: id, children: [jsx(BaseInput, { "data-testid": `${dataTestId}-from`, disabled: disabled, isInvalid: isInvalid, onBlur: onRangeChange, onChange: (time) => onChangeFrom(time.currentTarget.value), type: "time", value: timeRange.timeFrom === "" ? DEFAULT_TIME : timeRange.timeFrom }), children ?? jsx("div", { "data-testid": `${dataTestId}-separator`, children: "-" }), jsx(BaseInput, { "data-testid": `${dataTestId}-to`, disabled: disabled, isInvalid: isInvalid, onBlur: onRangeChange, onChange: (time) => onChangeTo(time.currentTarget.value), type: "time", value: timeRange.timeTo === "" ? DEFAULT_TIME : timeRange.timeTo })] }));
3395
+ return (jsxs("div", { className: cvaTimeRange({ className }), "data-testid": dataTestId, id: id, ref: ref, children: [jsx(BaseInput, { "data-testid": `${dataTestId}-from`, disabled: disabled, isInvalid: isInvalid, onBlur: onRangeChange, onChange: (time) => onChangeFrom(time.currentTarget.value), type: "time", value: timeRange.timeFrom === "" ? DEFAULT_TIME : timeRange.timeFrom }), children ?? jsx("div", { "data-testid": `${dataTestId}-separator`, children: "-" }), jsx(BaseInput, { "data-testid": `${dataTestId}-to`, disabled: disabled, isInvalid: isInvalid, onBlur: onRangeChange, onChange: (time) => onChangeTo(time.currentTarget.value), type: "time", value: timeRange.timeTo === "" ? DEFAULT_TIME : timeRange.timeTo })] }));
3396
3396
  };
3397
3397
  const DEFAULT_TIME = "12:00";
3398
3398
 
@@ -3411,7 +3411,7 @@ const cvaScheduleItemText = cvaMerge(["flex", "font-bold", "self-center"]);
3411
3411
  * @param {ScheduleProps} props - The props for the Schedule component
3412
3412
  * @returns {ReactElement} Schedule component
3413
3413
  */
3414
- const Schedule = ({ className, "data-testid": dataTestId, schedule, onChange, invalidKeys = [], }) => {
3414
+ const Schedule = ({ className, "data-testid": dataTestId, schedule, onChange, invalidKeys = [], ref, }) => {
3415
3415
  const [t] = useTranslation();
3416
3416
  const onRangeChange = (range, index) => {
3417
3417
  const newSchedule = schedule.map((day, dayIndex) => (index === dayIndex ? { ...day, range: { ...range } } : day));
@@ -3443,7 +3443,7 @@ const Schedule = ({ className, "data-testid": dataTestId, schedule, onChange, in
3443
3443
  : day);
3444
3444
  onChange(newSchedule);
3445
3445
  };
3446
- return (jsx("div", { className: className, "data-testid": dataTestId, children: schedule.map(({ label, range, isActive, key, checkboxLabel, isAllDay }, index) => {
3446
+ return (jsx("div", { className: className, "data-testid": dataTestId, ref: ref, children: schedule.map(({ label, range, isActive, key, checkboxLabel, isAllDay }, index) => {
3447
3447
  return (jsxs("div", { className: cvaScheduleItem(), children: [jsxs("div", { className: "grid grid-cols-2 gap-4 sm:hidden", children: [jsx(Text, { className: "font-medium text-neutral-500", children: t("schedule.label.day") }), jsx(Text, { className: cvaScheduleItemText(), size: "medium", subtle: !isActive, children: label }), jsx(Text, { className: "font-medium text-neutral-500", children: t("schedule.label.active") }), jsx(Checkbox, { checked: isActive, label: checkboxLabel, onChange: (event) => onActiveChange(Boolean(event.currentTarget.checked), index) }), jsx(Text, { className: "font-medium text-neutral-500", children: t("schedule.label.allDay") }), jsx(Checkbox, { checked: isAllDay ? isActive : undefined, disabled: !isActive, onChange: (event) => onAllDayChange(Boolean(event.currentTarget.checked), index) }), jsx(TimeRange, { disabled: !isActive || isAllDay, isInvalid: !!invalidKeys.find((invalidKey) => invalidKey === key), onChange: (newRange) => onRangeChange(newRange, index), range: range })] }), jsxs("div", { className: "max-sm:hidden sm:grid sm:grid-cols-[100px_200px_60px_250px_250px] sm:gap-2", children: [jsx(Checkbox, { checked: isActive, "data-testid": `${dataTestId}-${key}-checkbox`, label: checkboxLabel, onChange: (event) => onActiveChange(Boolean(event.currentTarget.checked), index) }), jsx(Text, { className: cvaScheduleItemText(), size: "medium", subtle: !isActive, children: label }), jsx(Checkbox, { checked: isAllDay ? isActive : undefined, "data-testid": `${dataTestId}-${key}-allday-checkbox`, disabled: !isActive, onChange: (event) => onAllDayChange(Boolean(event.currentTarget.checked), index) }), jsx(TimeRange, { "data-testid": `${dataTestId}-${key}-range`, disabled: !isActive || isAllDay, isInvalid: !!invalidKeys.find((invalidKey) => invalidKey === key), onChange: (newRange) => onRangeChange(newRange, index), range: isAllDay ? undefined : range })] })] }, key + label));
3448
3448
  }) }));
3449
3449
  };
@@ -3927,10 +3927,10 @@ TextField.displayName = "TextField";
3927
3927
  * @param {TimeRangeFieldProps} props - The props for the TimeRangeField component
3928
3928
  * @returns {ReactElement} TimeRangeField component
3929
3929
  */
3930
- const TimeRangeField = ({ className, "data-testid": dataTestId, onChange, isInvalid, errorMessage, label, tip, children, helpText, id, ...rest }) => {
3930
+ const TimeRangeField = ({ className, "data-testid": dataTestId, onChange, isInvalid, errorMessage, label, tip, children, helpText, id, ref, ...rest }) => {
3931
3931
  const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
3932
3932
  const htmlFor = id ? id : "timeRangeField-" + uuidv4();
3933
- return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, tip: tip, children: jsx(TimeRange, { className: className, "data-testid": dataTestId, isInvalid: renderAsInvalid, onChange: onChange, ...rest, children: children }) }));
3933
+ return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, ref: ref, tip: tip, children: jsx(TimeRange, { className: className, "data-testid": dataTestId, isInvalid: renderAsInvalid, onChange: onChange, ...rest, children: children }) }));
3934
3934
  };
3935
3935
 
3936
3936
  const cvaToggleSwitchWrapper = cvaMerge(["grid", "grid-cols-[auto]", "items-center"]);
@@ -4166,10 +4166,10 @@ ToggleSwitch.displayName = "ToggleSwitch";
4166
4166
  * @param {ToggleSwitchOptionProps} props - The props for the ToggleSwitchOption component
4167
4167
  * @returns {ReactElement} ToggleSwitchOption component
4168
4168
  */
4169
- const ToggleSwitchOption = ({ label, className, description, suffix, id, "data-testid": dataTestId = "toggle-switch-option", ...rest }) => {
4169
+ const ToggleSwitchOption = ({ label, className, description, suffix, id, "data-testid": dataTestId = "toggle-switch-option", ref, ...rest }) => {
4170
4170
  const { ref: labelRef, isTextTruncated: isLabelTruncated } = useIsTextTruncated();
4171
4171
  const { ref: descriptionRef, isTextTruncated: isDescriptionTruncated } = useIsTextTruncated();
4172
- return (jsxs("label", { className: cvaBinaryControlWrapper({ className }), "data-testid": dataTestId, htmlFor: `${id}-toggle-switch`, tabIndex: -1, children: [jsx(ToggleSwitch, { "data-testid": `${dataTestId}-switcher`, id: `${id}-toggle-switch`, ...rest }), jsx(Tooltip, { asChild: false, className: cvaBinaryControlLabelTooltip(), "data-testid": `${dataTestId}-label-tooltip`, disabled: !isLabelTruncated, label: label, placement: "top", children: jsx("span", { className: cvaLabel({
4172
+ return (jsxs("label", { className: cvaBinaryControlWrapper({ className }), "data-testid": dataTestId, htmlFor: `${id}-toggle-switch`, ref: ref, tabIndex: -1, children: [jsx(ToggleSwitch, { "data-testid": `${dataTestId}-switcher`, id: `${id}-toggle-switch`, ...rest }), jsx(Tooltip, { asChild: false, className: cvaBinaryControlLabelTooltip(), "data-testid": `${dataTestId}-label-tooltip`, disabled: !isLabelTruncated, label: label, placement: "top", children: jsx("span", { className: cvaLabel({
4173
4173
  disabled: rest.disabled || rest.readOnly,
4174
4174
  className: "select-none",
4175
4175
  }), "data-testid": `${dataTestId}-label`, ref: labelRef, children: label }) }, `${id}-label-tooltip`), suffix ? (jsx("div", { className: cvaBinaryControlSuffixContainer(), "data-testid": `${dataTestId}-suffix-container`, children: suffix })) : null, description ? (jsx(Tooltip, { asChild: false, className: cvaBinaryControlDescriptionTooltip(), "data-testid": `${dataTestId}-description-tooltip`, disabled: !isDescriptionTruncated, label: description, placement: "top", children: jsx("span", { className: cvaBinaryControlDescription({ disabled: rest.disabled || rest.readOnly }), "data-testid": `${dataTestId}-description`, id: `${id}-description`, ref: descriptionRef, children: description }) }, `${id}-description-tooltip`)) : null] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-components",
3
- "version": "1.14.19",
3
+ "version": "1.14.23",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -14,12 +14,12 @@
14
14
  "zod": "^3.23.8",
15
15
  "react-hook-form": "7.62.0",
16
16
  "tailwind-merge": "^2.0.0",
17
- "@trackunit/css-class-variance-utilities": "1.11.42",
18
- "@trackunit/react-components": "1.17.17",
19
- "@trackunit/ui-icons": "1.11.41",
20
- "@trackunit/shared-utils": "1.13.42",
21
- "@trackunit/ui-design-tokens": "1.11.42",
22
- "@trackunit/i18n-library-translation": "1.12.26",
17
+ "@trackunit/css-class-variance-utilities": "1.11.43",
18
+ "@trackunit/react-components": "1.17.21",
19
+ "@trackunit/ui-icons": "1.11.42",
20
+ "@trackunit/shared-utils": "1.13.43",
21
+ "@trackunit/ui-design-tokens": "1.11.43",
22
+ "@trackunit/i18n-library-translation": "1.12.27",
23
23
  "string-ts": "^2.0.0",
24
24
  "@js-temporal/polyfill": "^0.5.1",
25
25
  "es-toolkit": "^1.39.10"
@@ -1,8 +1,8 @@
1
- import { CommonProps, Size } from "@trackunit/react-components";
1
+ import { CommonProps, Refable, Size } from "@trackunit/react-components";
2
2
  import { ReactElement, ReactNode } from "react";
3
3
  import { BaseInputProps } from "../BaseInput/BaseInput";
4
4
  type BaseInputExposedProps = Omit<BaseInputProps, "type" | "suffix" | "prefix" | "addonAfter" | "addonBefore" | "actions" | "placeholder" | "fieldSize" | "size">;
5
- export interface DropZoneProps extends BaseInputExposedProps, CommonProps {
5
+ export interface DropZoneProps extends Omit<BaseInputExposedProps, "ref">, CommonProps, Refable<HTMLDivElement> {
6
6
  /**
7
7
  * A JSX element or a string to set a focusable label in Drop Zone. If not provided, the default label will be used.
8
8
  */
@@ -85,5 +85,5 @@ export interface DropZoneProps extends BaseInputExposedProps, CommonProps {
85
85
  * @param {DropZoneProps} props - The props for the DropZone component
86
86
  * @returns {ReactElement} DropZone component
87
87
  */
88
- export declare const DropZone: ({ className, "data-testid": dataTestId, filesSelected, label, size, isInvalid, disabled, accept, multiple, ...rest }: DropZoneProps) => ReactElement;
88
+ export declare const DropZone: ({ className, "data-testid": dataTestId, filesSelected, label, size, isInvalid, disabled, accept, multiple, ref, ...rest }: DropZoneProps) => ReactElement;
89
89
  export {};
@@ -1,6 +1,6 @@
1
- import { CommonProps } from "@trackunit/react-components";
1
+ import { CommonProps, Refable } from "@trackunit/react-components";
2
2
  import { ReactElement, ReactNode } from "react";
3
- export interface FormGroupProps extends CommonProps {
3
+ export interface FormGroupProps extends CommonProps, Refable<HTMLDivElement> {
4
4
  /**
5
5
  * The label for the form group.
6
6
  */
@@ -42,4 +42,4 @@ export interface FormGroupProps extends CommonProps {
42
42
  * @param {FormGroupProps} props - The props for the FormGroup component
43
43
  * @returns {ReactElement} FormGroup component
44
44
  */
45
- export declare const FormGroup: ({ isInvalid, isWarning, helpText, helpAddon, tip, className, "data-testid": dataTestId, label, htmlFor, children, required, }: FormGroupProps) => ReactElement;
45
+ export declare const FormGroup: ({ isInvalid, isWarning, helpText, helpAddon, tip, className, "data-testid": dataTestId, label, htmlFor, children, required, ref, }: FormGroupProps) => ReactElement;
@@ -1,6 +1,6 @@
1
- import { CommonProps } from "@trackunit/react-components";
1
+ import { CommonProps, Refable } from "@trackunit/react-components";
2
2
  import { ReactElement, ReactNode } from "react";
3
- export interface LabelProps extends CommonProps {
3
+ export interface LabelProps extends CommonProps, Refable<HTMLLabelElement> {
4
4
  /**
5
5
  * ID of the label.
6
6
  */
@@ -30,4 +30,4 @@ export interface LabelProps extends CommonProps {
30
30
  * @param {LabelProps} props - The props for the Label component
31
31
  * @returns {ReactElement} Label component
32
32
  */
33
- export declare const Label: ({ id, htmlFor, children, className, "data-testid": dataTestId, disabled, isInvalid, }: LabelProps) => ReactElement;
33
+ export declare const Label: ({ id, htmlFor, children, className, "data-testid": dataTestId, disabled, isInvalid, ref, }: LabelProps) => ReactElement;
@@ -1,6 +1,6 @@
1
- import { CommonProps } from "@trackunit/react-components";
1
+ import { CommonProps, Refable } from "@trackunit/react-components";
2
2
  import { ChangeEvent, InputHTMLAttributes, ReactElement, ReactNode } from "react";
3
- export interface RadioGroupProps<TValue extends string | number> extends CommonProps, InputHTMLAttributes<HTMLInputElement> {
3
+ export interface RadioGroupProps<TValue extends string | number> extends CommonProps, Refable<HTMLDivElement>, InputHTMLAttributes<HTMLInputElement> {
4
4
  /**
5
5
  */
6
6
  children: ReactNode;
@@ -98,6 +98,6 @@ export interface RadioGroupProps<TValue extends string | number> extends CommonP
98
98
  * @returns {ReactElement} RadioGroup component
99
99
  */
100
100
  export declare const RadioGroup: {
101
- <TValue extends string | number = string>({ children, id, name, value, disabled, onChange, label, inline, className, "data-testid": dataTestId, isInvalid, }: RadioGroupProps<TValue>): ReactElement;
101
+ <TValue extends string | number = string>({ children, id, name, value, disabled, onChange, label, inline, className, "data-testid": dataTestId, isInvalid, ref, }: RadioGroupProps<TValue>): ReactElement;
102
102
  displayName: string;
103
103
  };
@@ -1,7 +1,7 @@
1
- import { CommonProps } from "@trackunit/react-components";
1
+ import { CommonProps, Refable } from "@trackunit/react-components";
2
2
  import { MappedOmit } from "@trackunit/shared-utils";
3
3
  import { InputHTMLAttributes, ReactElement, ReactNode } from "react";
4
- export interface RadioItemProps<TValue extends string | number = string> extends CommonProps, MappedOmit<InputHTMLAttributes<HTMLInputElement>, "prefix"> {
4
+ export interface RadioItemProps<TValue extends string | number = string> extends CommonProps, Refable<HTMLLabelElement>, MappedOmit<InputHTMLAttributes<HTMLInputElement>, "prefix"> {
5
5
  /**
6
6
  * The label of the radio item.
7
7
  */
@@ -25,4 +25,4 @@ export interface RadioItemProps<TValue extends string | number = string> extends
25
25
  * @param {RadioItemProps} props - The props for the RadioItem component
26
26
  * @returns {ReactElement} RadioItem component
27
27
  */
28
- export declare const RadioItem: <TValue extends string | number>({ label, value, "data-testid": dataTestId, className, description, suffix, tabIndex, ...rest }: RadioItemProps<TValue>) => ReactElement;
28
+ export declare const RadioItem: <TValue extends string | number>({ label, value, "data-testid": dataTestId, className, description, suffix, tabIndex, ref, ...rest }: RadioItemProps<TValue>) => ReactElement;
@@ -1,4 +1,4 @@
1
- import { CommonProps } from "@trackunit/react-components";
1
+ import { CommonProps, Refable } from "@trackunit/react-components";
2
2
  import { TimeRangeInput } from "../TimeRange/TimeRange";
3
3
  export interface ScheduleItem {
4
4
  /**
@@ -26,7 +26,7 @@ export interface ScheduleItem {
26
26
  */
27
27
  checkboxLabel?: string;
28
28
  }
29
- export interface ScheduleProps extends CommonProps {
29
+ export interface ScheduleProps extends CommonProps, Refable<HTMLDivElement> {
30
30
  /**
31
31
  * List of schedule rows.
32
32
  */
@@ -49,4 +49,4 @@ export interface ScheduleProps extends CommonProps {
49
49
  * @param {ScheduleProps} props - The props for the Schedule component
50
50
  * @returns {ReactElement} Schedule component
51
51
  */
52
- export declare const Schedule: ({ className, "data-testid": dataTestId, schedule, onChange, invalidKeys, }: ScheduleProps) => import("react/jsx-runtime").JSX.Element;
52
+ export declare const Schedule: ({ className, "data-testid": dataTestId, schedule, onChange, invalidKeys, ref, }: ScheduleProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { CommonProps } from "@trackunit/react-components";
1
+ import { CommonProps, Refable } from "@trackunit/react-components";
2
2
  import { ReactNode } from "react";
3
3
  export interface TimeRangeInput {
4
4
  /**
@@ -10,7 +10,7 @@ export interface TimeRangeInput {
10
10
  */
11
11
  timeTo: string;
12
12
  }
13
- export interface TimeRangeProps extends CommonProps {
13
+ export interface TimeRangeProps extends CommonProps, Refable<HTMLDivElement> {
14
14
  /**
15
15
  * Unique element identifier.
16
16
  */
@@ -49,5 +49,5 @@ export interface TimeRangeProps extends CommonProps {
49
49
  * @param {TimeRangeProps} props - The props for the TimeRange component
50
50
  * @returns {ReactElement} TimeRange component
51
51
  */
52
- export declare const TimeRange: ({ id, className, "data-testid": dataTestId, children, range, onChange, disabled, isInvalid, }: TimeRangeProps) => import("react/jsx-runtime").JSX.Element;
52
+ export declare const TimeRange: ({ id, className, "data-testid": dataTestId, children, range, onChange, disabled, isInvalid, ref, }: TimeRangeProps) => import("react/jsx-runtime").JSX.Element;
53
53
  export declare const DEFAULT_TIME = "12:00";
@@ -1,7 +1,8 @@
1
+ import { Refable } from "@trackunit/react-components";
1
2
  import { FormGroupProps } from "../FormGroup/FormGroup";
2
3
  import { TimeRangeProps } from "../TimeRange/TimeRange";
3
4
  type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
4
- export interface TimeRangeFieldProps extends TimeRangeProps, FormGroupExposedProps {
5
+ export interface TimeRangeFieldProps extends TimeRangeProps, FormGroupExposedProps, Refable<HTMLDivElement> {
5
6
  /**
6
7
  * If a value is set, the field is rendered in its invalid state.
7
8
  */
@@ -13,5 +14,5 @@ export interface TimeRangeFieldProps extends TimeRangeProps, FormGroupExposedPro
13
14
  * @param {TimeRangeFieldProps} props - The props for the TimeRangeField component
14
15
  * @returns {ReactElement} TimeRangeField component
15
16
  */
16
- export declare const TimeRangeField: ({ className, "data-testid": dataTestId, onChange, isInvalid, errorMessage, label, tip, children, helpText, id, ...rest }: TimeRangeFieldProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const TimeRangeField: ({ className, "data-testid": dataTestId, onChange, isInvalid, errorMessage, label, tip, children, helpText, id, ref, ...rest }: TimeRangeFieldProps) => import("react/jsx-runtime").JSX.Element;
17
18
  export {};
@@ -1,6 +1,7 @@
1
+ import { Refable } from "@trackunit/react-components";
1
2
  import { ReactElement } from "react";
2
3
  import { ToggleSwitchProps } from "../ToggleSwitch/ToggleSwitch";
3
- export interface ToggleSwitchOptionProps extends ToggleSwitchProps {
4
+ export interface ToggleSwitchOptionProps extends ToggleSwitchProps, Refable<HTMLLabelElement> {
4
5
  /**
5
6
  * The label of the toggle.
6
7
  */
@@ -78,6 +79,6 @@ export interface ToggleSwitchOptionProps extends ToggleSwitchProps {
78
79
  * @returns {ReactElement} ToggleSwitchOption component
79
80
  */
80
81
  export declare const ToggleSwitchOption: {
81
- ({ label, className, description, suffix, id, "data-testid": dataTestId, ...rest }: ToggleSwitchOptionProps): ReactElement;
82
+ ({ label, className, description, suffix, id, "data-testid": dataTestId, ref, ...rest }: ToggleSwitchOptionProps): ReactElement;
82
83
  displayName: string;
83
84
  };