@trackunit/react-form-components 1.18.27 → 1.20.6

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
@@ -1494,7 +1494,7 @@ const useMultiMeasure = ({ skip = false, onChange } = {}) => {
1494
1494
  refCallbacksRef.current.set(index, callback);
1495
1495
  return callback;
1496
1496
  }, [skip]);
1497
- return { geometries, getRef };
1497
+ return react.useMemo(() => ({ geometries, getRef }), [geometries, getRef]);
1498
1498
  };
1499
1499
 
1500
1500
  const DEFAULT_STATE = {
@@ -3631,35 +3631,51 @@ RadioGroup.displayName = "RadioGroup";
3631
3631
  * @param {RadioItemProps} props - The props for the RadioItem component
3632
3632
  * @returns {ReactElement} RadioItem component
3633
3633
  */
3634
- const RadioItem = ({ label, value, "data-testid": dataTestId, className, description, suffix, tabIndex, ref, ...rest }) => {
3634
+ const RadioItem = ({ label, value, "data-testid": dataTestId, className, description, suffix, tabIndex, ref, checked = undefined, disabled = false, name, onChange, readOnly = undefined, ...rest }) => {
3635
3635
  const groupCtx = react.useContext(RadioGroupContext);
3636
+ const hasGroupContext = groupCtx !== null;
3636
3637
  const isChecked = groupCtx?.value === value;
3638
+ const isRenderedChecked = hasGroupContext ? isChecked : checked === true;
3639
+ const isDisabled = groupCtx?.disabled ?? disabled;
3640
+ const isStandaloneChecked = !hasGroupContext && checked !== undefined;
3641
+ const shouldRenderReadOnly = readOnly ?? (isStandaloneChecked && onChange === undefined);
3637
3642
  // Empty string is treated as "no selection" to allow tabbing into the group when no radio is checked
3638
3643
  const hasGroupValue = groupCtx?.value !== undefined && groupCtx.value !== "";
3639
3644
  const inputRef = react.useRef(null);
3640
- const wasCheckedRef = react.useRef(isChecked);
3645
+ const wasCheckedRef = react.useRef(isRenderedChecked);
3641
3646
  const { ref: labelRef, isTextTruncated: isLabelTruncated } = reactComponents.useIsTextTruncated();
3642
3647
  const { ref: descriptionRef, isTextTruncated: isDescriptionTruncated } = reactComponents.useIsTextTruncated();
3643
- const descriptionId = description ? `${groupCtx?.id}-${value}-description` : undefined;
3644
- const inputId = `${groupCtx?.id}-${value}`;
3648
+ const descriptionId = description && hasGroupContext ? `${groupCtx.id}-${value}-description` : undefined;
3649
+ const inputId = hasGroupContext ? `${groupCtx.id}-${value}` : undefined;
3645
3650
  const hasLabel = label !== undefined && label !== null && label !== "";
3646
3651
  // Restore focus after React re-render when this radio becomes checked via arrow keys
3647
3652
  react.useEffect(() => {
3648
- if (isChecked && !wasCheckedRef.current) {
3653
+ if (isRenderedChecked && !wasCheckedRef.current) {
3649
3654
  inputRef.current?.focus();
3650
3655
  }
3651
- wasCheckedRef.current = isChecked;
3652
- }, [isChecked]);
3656
+ wasCheckedRef.current = isRenderedChecked;
3657
+ }, [isRenderedChecked]);
3653
3658
  return (jsxRuntime.jsxs("label", { className: hasLabel
3654
3659
  ? cvaBinaryControlWrapper({ className })
3655
- : `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({
3656
- checked: isChecked,
3657
- disabled: groupCtx?.disabled,
3660
+ : `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: isRenderedChecked, className: cvaRadioItem({
3661
+ checked: isRenderedChecked,
3662
+ disabled: isDisabled,
3658
3663
  invalid: groupCtx?.isInvalid,
3659
- }), "data-testid": dataTestId, id: inputId, name: groupCtx?.name, onChange: groupCtx?.onChange, ref: inputRef, tabIndex: tabIndex ?? (groupCtx?.disabled ? -1 : isChecked ? 0 : hasGroupValue ? -1 : 0), type: "radio", value: value, ...rest }), hasLabel ? (jsxRuntime.jsx(reactComponents.Tooltip, { "data-testid": dataTestId ? `${dataTestId}-Label-Tooltip` : undefined, disabled: !isLabelTruncated, label: label, placement: "top", children: jsxRuntime.jsx("span", { className: cvaBinaryControlLabelTooltip(), children: jsxRuntime.jsx("span", { className: cvaLabel({
3664
+ }), "data-testid": dataTestId, disabled: isDisabled, id: inputId, name: groupCtx?.name ?? name, onChange: groupCtx?.onChange ?? onChange, readOnly: shouldRenderReadOnly, ref: inputRef, tabIndex: tabIndex ?? (isDisabled ? -1 : isRenderedChecked ? 0 : hasGroupValue ? -1 : 0), type: "radio", value: value, ...rest }), hasLabel ? (jsxRuntime.jsx(reactComponents.Tooltip, { "data-testid": dataTestId ? `${dataTestId}-Label-Tooltip` : undefined, disabled: !isLabelTruncated, label: label, placement: "top", children: jsxRuntime.jsx("span", { className: cvaBinaryControlLabelTooltip(), children: jsxRuntime.jsx("span", { className: cvaLabel({
3660
3665
  invalid: groupCtx?.isInvalid,
3661
- disabled: groupCtx?.disabled,
3662
- }), "data-testid": dataTestId ? `${dataTestId}-Label` : undefined, ref: labelRef, children: label }) }) }, "tooltip-" + rest.name)) : null, suffix !== undefined && suffix !== null && suffix !== "" ? (jsxRuntime.jsx("div", { className: cvaBinaryControlSuffixContainer(), "data-testid": dataTestId ? `${dataTestId}-suffix-container` : undefined, children: suffix })) : null, description ? (jsxRuntime.jsx(reactComponents.Tooltip, { "data-testid": dataTestId ? `${dataTestId}-Description-Tooltip` : undefined, disabled: !isDescriptionTruncated, label: description, placement: "top", children: jsxRuntime.jsx("span", { className: cvaBinaryControlDescriptionTooltip(), children: jsxRuntime.jsx("span", { className: cvaBinaryControlDescription({ disabled: groupCtx?.disabled }), "data-testid": dataTestId ? `${dataTestId}-Description` : undefined, id: descriptionId, ref: descriptionRef, children: description }) }) }, "description-tooltip-" + rest.name)) : null] }));
3666
+ disabled: isDisabled,
3667
+ }), "data-testid": dataTestId ? `${dataTestId}-Label` : undefined, ref: labelRef, children: label }) }) }, "tooltip-" + (groupCtx?.name ?? name))) : null, suffix !== undefined && suffix !== null && suffix !== "" ? (jsxRuntime.jsx("div", { className: cvaBinaryControlSuffixContainer(), "data-testid": dataTestId ? `${dataTestId}-suffix-container` : undefined, children: suffix })) : null, description ? (jsxRuntime.jsx(reactComponents.Tooltip, { "data-testid": dataTestId ? `${dataTestId}-Description-Tooltip` : undefined, disabled: !isDescriptionTruncated, label: description, placement: "top", children: jsxRuntime.jsx("span", { className: cvaBinaryControlDescriptionTooltip(), children: jsxRuntime.jsx("span", { className: cvaBinaryControlDescription({ disabled: isDisabled }), "data-testid": dataTestId ? `${dataTestId}-Description` : undefined, id: descriptionId, ref: descriptionRef, children: description }) }) }, "description-tooltip-" + (groupCtx?.name ?? name))) : null] }));
3668
+ };
3669
+
3670
+ /**
3671
+ * Returns whether the provided radio value matches the current RadioGroup selection.
3672
+ *
3673
+ * @param {string | number} value - The radio item's value
3674
+ * @returns {boolean} True when the current RadioGroup context is checked for the provided value
3675
+ */
3676
+ const useRadioItemChecked = (value) => {
3677
+ const radioGroupContext = react.useContext(RadioGroupContext);
3678
+ return radioGroupContext?.value === value;
3663
3679
  };
3664
3680
 
3665
3681
  const cvaTimeRange = cssClassVarianceUtilities.cvaMerge([
@@ -4834,7 +4850,7 @@ const useGetPhoneValidationRules = () => {
4834
4850
  }
4835
4851
  : defaultRules;
4836
4852
  }, [t]);
4837
- return { getPhoneNumberValidationRules };
4853
+ return react.useMemo(() => ({ getPhoneNumberValidationRules }), [getPhoneNumberValidationRules]);
4838
4854
  };
4839
4855
 
4840
4856
  /**
@@ -4843,15 +4859,13 @@ const useGetPhoneValidationRules = () => {
4843
4859
  * @property {Function} getPhoneNumber - A function for get formatted phone number with country code and plus sign
4844
4860
  */
4845
4861
  const usePhoneInput = () => {
4846
- const getPhoneNumber = ({ country, phone }) => {
4862
+ const getPhoneNumber = react.useCallback(({ country, phone }) => {
4847
4863
  if (country) {
4848
4864
  return getPhoneNumberWithPlus(`${country}${phone || ""}`);
4849
4865
  }
4850
4866
  return phone || "";
4851
- };
4852
- return {
4853
- getPhoneNumber,
4854
- };
4867
+ }, []);
4868
+ return react.useMemo(() => ({ getPhoneNumber }), [getPhoneNumber]);
4855
4869
  };
4856
4870
 
4857
4871
  /**
@@ -5010,6 +5024,7 @@ exports.useCreatableSelect = useCreatableSelect;
5010
5024
  exports.useCustomComponents = useCustomComponents;
5011
5025
  exports.useGetPhoneValidationRules = useGetPhoneValidationRules;
5012
5026
  exports.usePhoneInput = usePhoneInput;
5027
+ exports.useRadioItemChecked = useRadioItemChecked;
5013
5028
  exports.useSelect = useSelect;
5014
5029
  exports.useZodValidators = useZodValidators;
5015
5030
  exports.validateEmailAddress = validateEmailAddress;
package/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { registerTranslations, useNamespaceTranslation, NamespaceTrans } from '@trackunit/i18n-library-translation';
3
3
  import { Temporal, toDateUtil, startOfDayUtil } from '@trackunit/date-and-time-utils';
4
4
  import { IconButton, Icon, Tooltip, Popover, PopoverTrigger, PopoverContent, Button, cvaMenu, cvaMenuList, Tag, useIsTextTruncated, ZStack, MenuItem, useMeasure, useDebounce, useMergeRefs, Spinner, useScrollBlock, Text, Heading, useIsFirstRender } from '@trackunit/react-components';
5
- import { useRef, useEffect, useImperativeHandle, useState, useCallback, cloneElement, isValidElement, useLayoutEffect, useReducer, useMemo, createContext, useContext, useId } from 'react';
5
+ import { useRef, useEffect, useImperativeHandle, useState, useCallback, cloneElement, isValidElement, useLayoutEffect, useMemo, useReducer, createContext, useContext, useId } from 'react';
6
6
  import ReactCalendar from 'react-calendar';
7
7
  import { twMerge } from 'tailwind-merge';
8
8
  import { themeSpacing } from '@trackunit/ui-design-tokens';
@@ -1493,7 +1493,7 @@ const useMultiMeasure = ({ skip = false, onChange } = {}) => {
1493
1493
  refCallbacksRef.current.set(index, callback);
1494
1494
  return callback;
1495
1495
  }, [skip]);
1496
- return { geometries, getRef };
1496
+ return useMemo(() => ({ geometries, getRef }), [geometries, getRef]);
1497
1497
  };
1498
1498
 
1499
1499
  const DEFAULT_STATE = {
@@ -3630,35 +3630,51 @@ RadioGroup.displayName = "RadioGroup";
3630
3630
  * @param {RadioItemProps} props - The props for the RadioItem component
3631
3631
  * @returns {ReactElement} RadioItem component
3632
3632
  */
3633
- const RadioItem = ({ label, value, "data-testid": dataTestId, className, description, suffix, tabIndex, ref, ...rest }) => {
3633
+ const RadioItem = ({ label, value, "data-testid": dataTestId, className, description, suffix, tabIndex, ref, checked = undefined, disabled = false, name, onChange, readOnly = undefined, ...rest }) => {
3634
3634
  const groupCtx = useContext(RadioGroupContext);
3635
+ const hasGroupContext = groupCtx !== null;
3635
3636
  const isChecked = groupCtx?.value === value;
3637
+ const isRenderedChecked = hasGroupContext ? isChecked : checked === true;
3638
+ const isDisabled = groupCtx?.disabled ?? disabled;
3639
+ const isStandaloneChecked = !hasGroupContext && checked !== undefined;
3640
+ const shouldRenderReadOnly = readOnly ?? (isStandaloneChecked && onChange === undefined);
3636
3641
  // Empty string is treated as "no selection" to allow tabbing into the group when no radio is checked
3637
3642
  const hasGroupValue = groupCtx?.value !== undefined && groupCtx.value !== "";
3638
3643
  const inputRef = useRef(null);
3639
- const wasCheckedRef = useRef(isChecked);
3644
+ const wasCheckedRef = useRef(isRenderedChecked);
3640
3645
  const { ref: labelRef, isTextTruncated: isLabelTruncated } = useIsTextTruncated();
3641
3646
  const { ref: descriptionRef, isTextTruncated: isDescriptionTruncated } = useIsTextTruncated();
3642
- const descriptionId = description ? `${groupCtx?.id}-${value}-description` : undefined;
3643
- const inputId = `${groupCtx?.id}-${value}`;
3647
+ const descriptionId = description && hasGroupContext ? `${groupCtx.id}-${value}-description` : undefined;
3648
+ const inputId = hasGroupContext ? `${groupCtx.id}-${value}` : undefined;
3644
3649
  const hasLabel = label !== undefined && label !== null && label !== "";
3645
3650
  // Restore focus after React re-render when this radio becomes checked via arrow keys
3646
3651
  useEffect(() => {
3647
- if (isChecked && !wasCheckedRef.current) {
3652
+ if (isRenderedChecked && !wasCheckedRef.current) {
3648
3653
  inputRef.current?.focus();
3649
3654
  }
3650
- wasCheckedRef.current = isChecked;
3651
- }, [isChecked]);
3655
+ wasCheckedRef.current = isRenderedChecked;
3656
+ }, [isRenderedChecked]);
3652
3657
  return (jsxs("label", { className: hasLabel
3653
3658
  ? cvaBinaryControlWrapper({ className })
3654
- : `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({
3655
- checked: isChecked,
3656
- disabled: groupCtx?.disabled,
3659
+ : `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: isRenderedChecked, className: cvaRadioItem({
3660
+ checked: isRenderedChecked,
3661
+ disabled: isDisabled,
3657
3662
  invalid: groupCtx?.isInvalid,
3658
- }), "data-testid": dataTestId, id: inputId, name: groupCtx?.name, onChange: groupCtx?.onChange, ref: inputRef, tabIndex: tabIndex ?? (groupCtx?.disabled ? -1 : isChecked ? 0 : hasGroupValue ? -1 : 0), type: "radio", value: value, ...rest }), hasLabel ? (jsx(Tooltip, { "data-testid": dataTestId ? `${dataTestId}-Label-Tooltip` : undefined, disabled: !isLabelTruncated, label: label, placement: "top", children: jsx("span", { className: cvaBinaryControlLabelTooltip(), children: jsx("span", { className: cvaLabel({
3663
+ }), "data-testid": dataTestId, disabled: isDisabled, id: inputId, name: groupCtx?.name ?? name, onChange: groupCtx?.onChange ?? onChange, readOnly: shouldRenderReadOnly, ref: inputRef, tabIndex: tabIndex ?? (isDisabled ? -1 : isRenderedChecked ? 0 : hasGroupValue ? -1 : 0), type: "radio", value: value, ...rest }), hasLabel ? (jsx(Tooltip, { "data-testid": dataTestId ? `${dataTestId}-Label-Tooltip` : undefined, disabled: !isLabelTruncated, label: label, placement: "top", children: jsx("span", { className: cvaBinaryControlLabelTooltip(), children: jsx("span", { className: cvaLabel({
3659
3664
  invalid: groupCtx?.isInvalid,
3660
- disabled: groupCtx?.disabled,
3661
- }), "data-testid": dataTestId ? `${dataTestId}-Label` : undefined, ref: labelRef, children: label }) }) }, "tooltip-" + rest.name)) : null, suffix !== undefined && suffix !== null && suffix !== "" ? (jsx("div", { className: cvaBinaryControlSuffixContainer(), "data-testid": dataTestId ? `${dataTestId}-suffix-container` : undefined, children: suffix })) : null, description ? (jsx(Tooltip, { "data-testid": dataTestId ? `${dataTestId}-Description-Tooltip` : undefined, disabled: !isDescriptionTruncated, label: description, placement: "top", children: jsx("span", { className: cvaBinaryControlDescriptionTooltip(), children: jsx("span", { className: cvaBinaryControlDescription({ disabled: groupCtx?.disabled }), "data-testid": dataTestId ? `${dataTestId}-Description` : undefined, id: descriptionId, ref: descriptionRef, children: description }) }) }, "description-tooltip-" + rest.name)) : null] }));
3665
+ disabled: isDisabled,
3666
+ }), "data-testid": dataTestId ? `${dataTestId}-Label` : undefined, ref: labelRef, children: label }) }) }, "tooltip-" + (groupCtx?.name ?? name))) : null, suffix !== undefined && suffix !== null && suffix !== "" ? (jsx("div", { className: cvaBinaryControlSuffixContainer(), "data-testid": dataTestId ? `${dataTestId}-suffix-container` : undefined, children: suffix })) : null, description ? (jsx(Tooltip, { "data-testid": dataTestId ? `${dataTestId}-Description-Tooltip` : undefined, disabled: !isDescriptionTruncated, label: description, placement: "top", children: jsx("span", { className: cvaBinaryControlDescriptionTooltip(), children: jsx("span", { className: cvaBinaryControlDescription({ disabled: isDisabled }), "data-testid": dataTestId ? `${dataTestId}-Description` : undefined, id: descriptionId, ref: descriptionRef, children: description }) }) }, "description-tooltip-" + (groupCtx?.name ?? name))) : null] }));
3667
+ };
3668
+
3669
+ /**
3670
+ * Returns whether the provided radio value matches the current RadioGroup selection.
3671
+ *
3672
+ * @param {string | number} value - The radio item's value
3673
+ * @returns {boolean} True when the current RadioGroup context is checked for the provided value
3674
+ */
3675
+ const useRadioItemChecked = (value) => {
3676
+ const radioGroupContext = useContext(RadioGroupContext);
3677
+ return radioGroupContext?.value === value;
3662
3678
  };
3663
3679
 
3664
3680
  const cvaTimeRange = cvaMerge([
@@ -4833,7 +4849,7 @@ const useGetPhoneValidationRules = () => {
4833
4849
  }
4834
4850
  : defaultRules;
4835
4851
  }, [t]);
4836
- return { getPhoneNumberValidationRules };
4852
+ return useMemo(() => ({ getPhoneNumberValidationRules }), [getPhoneNumberValidationRules]);
4837
4853
  };
4838
4854
 
4839
4855
  /**
@@ -4842,15 +4858,13 @@ const useGetPhoneValidationRules = () => {
4842
4858
  * @property {Function} getPhoneNumber - A function for get formatted phone number with country code and plus sign
4843
4859
  */
4844
4860
  const usePhoneInput = () => {
4845
- const getPhoneNumber = ({ country, phone }) => {
4861
+ const getPhoneNumber = useCallback(({ country, phone }) => {
4846
4862
  if (country) {
4847
4863
  return getPhoneNumberWithPlus(`${country}${phone || ""}`);
4848
4864
  }
4849
4865
  return phone || "";
4850
- };
4851
- return {
4852
- getPhoneNumber,
4853
- };
4866
+ }, []);
4867
+ return useMemo(() => ({ getPhoneNumber }), [getPhoneNumber]);
4854
4868
  };
4855
4869
 
4856
4870
  /**
@@ -4916,4 +4930,4 @@ const useZodValidators = () => {
4916
4930
  */
4917
4931
  setupLibraryTranslations();
4918
4932
 
4919
- export { ActionButton, BaseInput, BaseSelect, Checkbox, CheckboxField, ColorField, CreatableSelect, CreatableSelectField, DEFAULT_TIME, DateBaseInput, DateField, DropZone, DropZoneDefaultLabel, EMAIL_REGEX, EmailField, FormFieldSelectAdapter, FormGroup, Label, MultiSelectField, NumberBaseInput, NumberField, OptionCard, PasswordBaseInput, PasswordField, PhoneBaseInput, PhoneField, PhoneFieldWithController, RadioGroup, RadioItem, Schedule, ScheduleVariant, Search, SelectField, TextAreaBaseInput, TextAreaField, TextBaseInput, TextField, TimeRange, TimeRangeField, ToggleSwitch, ToggleSwitchOption, UploadField, UploadInput, UrlField, checkIfPhoneNumberHasPlus, countryCodeToFlagEmoji, cvaAccessoriesContainer, cvaActionButton, cvaActionContainer, cvaInput$1 as cvaInput, cvaInputAddon, cvaInputBase, cvaInputBaseDisabled, cvaInputBaseInvalid, cvaInputBaseReadOnly, cvaInputBaseSize, cvaInputElement, cvaInputGroup, cvaInputItemPlacementManager, cvaInputPrefix, cvaInputSuffix, cvaLabel, cvaRadioItem, cvaSelectClearIndicator, cvaSelectContainer, cvaSelectControl, cvaSelectDropdownIconContainer, cvaSelectDropdownIndicator, cvaSelectIndicatorsContainer, cvaSelectLoadingMessage, cvaSelectMenu, cvaSelectMenuList, cvaSelectMultiValue, cvaSelectNoOptionsMessage, cvaSelectPlaceholder, cvaSelectPrefixSuffix, cvaSelectSingleValue, cvaSelectValueContainer, dateToISODateUTC, getCountryAbbreviation, getPhoneNumberWithPlus, isInvalidCountryCode, isInvalidPhoneNumber, isValidHEXColor, parseDateFieldValue, parseSchedule, phoneErrorMessage, serializeSchedule, toISODateStringUTC, useCreatableSelect, useCustomComponents, useGetPhoneValidationRules, usePhoneInput, useSelect, useZodValidators, validateEmailAddress, validatePhoneNumber, weekDay };
4933
+ export { ActionButton, BaseInput, BaseSelect, Checkbox, CheckboxField, ColorField, CreatableSelect, CreatableSelectField, DEFAULT_TIME, DateBaseInput, DateField, DropZone, DropZoneDefaultLabel, EMAIL_REGEX, EmailField, FormFieldSelectAdapter, FormGroup, Label, MultiSelectField, NumberBaseInput, NumberField, OptionCard, PasswordBaseInput, PasswordField, PhoneBaseInput, PhoneField, PhoneFieldWithController, RadioGroup, RadioItem, Schedule, ScheduleVariant, Search, SelectField, TextAreaBaseInput, TextAreaField, TextBaseInput, TextField, TimeRange, TimeRangeField, ToggleSwitch, ToggleSwitchOption, UploadField, UploadInput, UrlField, checkIfPhoneNumberHasPlus, countryCodeToFlagEmoji, cvaAccessoriesContainer, cvaActionButton, cvaActionContainer, cvaInput$1 as cvaInput, cvaInputAddon, cvaInputBase, cvaInputBaseDisabled, cvaInputBaseInvalid, cvaInputBaseReadOnly, cvaInputBaseSize, cvaInputElement, cvaInputGroup, cvaInputItemPlacementManager, cvaInputPrefix, cvaInputSuffix, cvaLabel, cvaRadioItem, cvaSelectClearIndicator, cvaSelectContainer, cvaSelectControl, cvaSelectDropdownIconContainer, cvaSelectDropdownIndicator, cvaSelectIndicatorsContainer, cvaSelectLoadingMessage, cvaSelectMenu, cvaSelectMenuList, cvaSelectMultiValue, cvaSelectNoOptionsMessage, cvaSelectPlaceholder, cvaSelectPrefixSuffix, cvaSelectSingleValue, cvaSelectValueContainer, dateToISODateUTC, getCountryAbbreviation, getPhoneNumberWithPlus, isInvalidCountryCode, isInvalidPhoneNumber, isValidHEXColor, parseDateFieldValue, parseSchedule, phoneErrorMessage, serializeSchedule, toISODateStringUTC, useCreatableSelect, useCustomComponents, useGetPhoneValidationRules, usePhoneInput, useRadioItemChecked, useSelect, useZodValidators, validateEmailAddress, validatePhoneNumber, weekDay };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-components",
3
- "version": "1.18.27",
3
+ "version": "1.20.6",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,17 +9,17 @@
9
9
  "dependencies": {
10
10
  "react-calendar": "^6.0.0",
11
11
  "react-select": "^5.10.2",
12
- "@trackunit/date-and-time-utils": "1.11.91",
12
+ "@trackunit/date-and-time-utils": "1.11.93",
13
13
  "usehooks-ts": "^3.1.0",
14
14
  "libphonenumber-js": "^1.12.22",
15
15
  "zod": "^3.23.8",
16
16
  "tailwind-merge": "^2.0.0",
17
- "@trackunit/css-class-variance-utilities": "1.11.89",
18
- "@trackunit/react-components": "1.20.20",
19
- "@trackunit/ui-icons": "1.11.85",
20
- "@trackunit/shared-utils": "1.13.89",
21
- "@trackunit/ui-design-tokens": "1.11.86",
22
- "@trackunit/i18n-library-translation": "1.15.20",
17
+ "@trackunit/css-class-variance-utilities": "1.11.91",
18
+ "@trackunit/react-components": "1.21.4",
19
+ "@trackunit/ui-icons": "1.11.87",
20
+ "@trackunit/shared-utils": "1.13.91",
21
+ "@trackunit/ui-design-tokens": "1.11.88",
22
+ "@trackunit/i18n-library-translation": "1.17.4",
23
23
  "string-ts": "^2.0.0",
24
24
  "es-toolkit": "^1.39.10"
25
25
  },
@@ -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, ref, ...rest }: RadioItemProps<TValue>) => ReactElement;
28
+ export declare const RadioItem: <TValue extends string | number>({ label, value, "data-testid": dataTestId, className, description, suffix, tabIndex, ref, checked, disabled, name, onChange, readOnly, ...rest }: RadioItemProps<TValue>) => ReactElement;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns whether the provided radio value matches the current RadioGroup selection.
3
+ *
4
+ * @param {string | number} value - The radio item's value
5
+ * @returns {boolean} True when the current RadioGroup context is checked for the provided value
6
+ */
7
+ export declare const useRadioItemChecked: (value: string | number) => boolean;
package/src/index.d.ts CHANGED
@@ -36,6 +36,7 @@ export * from "./components/PhoneFieldWithController/PhoneFieldWithController";
36
36
  export * from "./components/RadioGroup/RadioGroup";
37
37
  export * from "./components/RadioGroup/RadioGroup.variants";
38
38
  export * from "./components/RadioGroup/RadioItem";
39
+ export * from "./components/RadioGroup/useRadioItemChecked";
39
40
  export * from "./components/Schedule/Schedule";
40
41
  export * from "./components/Schedule/ScheduleParser";
41
42
  export * from "./components/Search/Search";
@@ -7,7 +7,7 @@ var translation = {
7
7
  "colorField.error.REQUIRED": "Это поле является обязательным",
8
8
  "colorField.tooltip": "Select color",
9
9
  "dateField.actions.apply": "Применить",
10
- "dateField.actions.cancel": "Cancel",
10
+ "dateField.actions.cancel": "Отмена",
11
11
  "dateField.actions.clear": "Очистить",
12
12
  "dateField.placeholder": "yyyy-mm-dd",
13
13
  "dropzone.input.title": "Перетаскивание ввода файла",
@@ -6,7 +6,7 @@ var translation = {
6
6
  "colorField.error.INVALID_HEX_CODE": "Please enter a valid color before continuing.",
7
7
  "colorField.error.REQUIRED": "This field is required",
8
8
  "colorField.tooltip": "Select color",
9
- "dateField.actions.apply": "Apply",
9
+ "dateField.actions.apply": "นำไปใช้",
10
10
  "dateField.actions.cancel": "ยกเลิก",
11
11
  "dateField.actions.clear": "ล้าง",
12
12
  "dateField.placeholder": "yyyy-mm-dd",
@@ -7,7 +7,7 @@ var translation = {
7
7
  "colorField.error.REQUIRED": "Toto pole je povinné",
8
8
  "colorField.tooltip": "Select color",
9
9
  "dateField.actions.apply": "Použít",
10
- "dateField.actions.cancel": "Cancel",
10
+ "dateField.actions.cancel": "Zrušit",
11
11
  "dateField.actions.clear": "Vymazat",
12
12
  "dateField.placeholder": "yyyy-mm-dd",
13
13
  "dropzone.input.title": "Přetažení vstupu do souboru",
@@ -7,7 +7,7 @@ var translation = {
7
7
  "colorField.error.REQUIRED": "Tämä kenttä on pakollinen",
8
8
  "colorField.tooltip": "Select color",
9
9
  "dateField.actions.apply": "Käytä",
10
- "dateField.actions.cancel": "Cancel",
10
+ "dateField.actions.cancel": "Peruuta",
11
11
  "dateField.actions.clear": "Tyhjennä",
12
12
  "dateField.placeholder": "yyyy-mm-dd",
13
13
  "dropzone.input.title": "Vedä ja pudota tiedostosyöte",
@@ -5,7 +5,7 @@ var translation = {
5
5
  "colorField.error.REQUIRED": "Это поле является обязательным",
6
6
  "colorField.tooltip": "Select color",
7
7
  "dateField.actions.apply": "Применить",
8
- "dateField.actions.cancel": "Cancel",
8
+ "dateField.actions.cancel": "Отмена",
9
9
  "dateField.actions.clear": "Очистить",
10
10
  "dateField.placeholder": "yyyy-mm-dd",
11
11
  "dropzone.input.title": "Перетаскивание ввода файла",
@@ -4,7 +4,7 @@ var translation = {
4
4
  "colorField.error.INVALID_HEX_CODE": "Please enter a valid color before continuing.",
5
5
  "colorField.error.REQUIRED": "This field is required",
6
6
  "colorField.tooltip": "Select color",
7
- "dateField.actions.apply": "Apply",
7
+ "dateField.actions.apply": "นำไปใช้",
8
8
  "dateField.actions.cancel": "ยกเลิก",
9
9
  "dateField.actions.clear": "ล้าง",
10
10
  "dateField.placeholder": "yyyy-mm-dd",
@@ -5,7 +5,7 @@ var translation = {
5
5
  "colorField.error.REQUIRED": "Toto pole je povinné",
6
6
  "colorField.tooltip": "Select color",
7
7
  "dateField.actions.apply": "Použít",
8
- "dateField.actions.cancel": "Cancel",
8
+ "dateField.actions.cancel": "Zrušit",
9
9
  "dateField.actions.clear": "Vymazat",
10
10
  "dateField.placeholder": "yyyy-mm-dd",
11
11
  "dropzone.input.title": "Přetažení vstupu do souboru",
@@ -5,7 +5,7 @@ var translation = {
5
5
  "colorField.error.REQUIRED": "Tämä kenttä on pakollinen",
6
6
  "colorField.tooltip": "Select color",
7
7
  "dateField.actions.apply": "Käytä",
8
- "dateField.actions.cancel": "Cancel",
8
+ "dateField.actions.cancel": "Peruuta",
9
9
  "dateField.actions.clear": "Tyhjennä",
10
10
  "dateField.placeholder": "yyyy-mm-dd",
11
11
  "dropzone.input.title": "Vedä ja pudota tiedostosyöte",