@trackunit/react-form-components 1.11.17 → 1.11.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-components",
3
- "version": "1.11.17",
3
+ "version": "1.11.19",
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.10.14",
18
- "@trackunit/react-components": "1.14.17",
19
- "@trackunit/ui-icons": "1.10.14",
20
- "@trackunit/shared-utils": "1.12.14",
21
- "@trackunit/ui-design-tokens": "1.10.14",
22
- "@trackunit/i18n-library-translation": "1.10.14",
17
+ "@trackunit/css-class-variance-utilities": "1.10.16",
18
+ "@trackunit/react-components": "1.14.19",
19
+ "@trackunit/ui-icons": "1.10.16",
20
+ "@trackunit/shared-utils": "1.12.16",
21
+ "@trackunit/ui-design-tokens": "1.10.16",
22
+ "@trackunit/i18n-library-translation": "1.10.16",
23
23
  "string-ts": "^2.0.0",
24
24
  "@js-temporal/polyfill": "^0.5.1",
25
25
  "es-toolkit": "^1.39.10",
@@ -45,10 +45,54 @@ export interface CheckboxProps extends CommonProps, MappedOmit<InputHTMLAttribut
45
45
  *
46
46
  * Checkboxes are used for multiple choices, not for mutually exclusive choices. Each checkbox works independently from other checkboxes in the list, therefore checking an additional box does not affect any other selections.
47
47
  *
48
- * _**Do use** checkboxes to allow selection in a form, for filtering, terms and conditions to indicate agreement, and bulk actions in lists or tables._
48
+ * ### When to use
49
+ * Use checkboxes to allow selection in a form, for filtering, terms and conditions to indicate agreement, and bulk actions in lists or tables.
49
50
  *
50
- * _**Do not use** checkboxes if the user can only select one option from a list, radio buttons should be used instead of checkboxes._
51
+ * ### When not to use
52
+ * Do not use checkboxes if the user can only select one option from a list. Use RadioGroup instead.
51
53
  *
54
+ * @example Basic checkbox
55
+ * ```tsx
56
+ * import { Checkbox } from "@trackunit/react-form-components";
57
+ * import { useState } from "react";
58
+ *
59
+ * const MyForm = () => {
60
+ * const [accepted, setAccepted] = useState(false);
61
+ *
62
+ * return (
63
+ * <Checkbox
64
+ * label="I accept the terms and conditions"
65
+ * checked={accepted}
66
+ * onChange={(e) => setAccepted(e.target.checked)}
67
+ * />
68
+ * );
69
+ * };
70
+ * ```
71
+ * @example Checkbox group for multiple selections
72
+ * ```tsx
73
+ * import { Checkbox } from "@trackunit/react-form-components";
74
+ * import { useState } from "react";
75
+ *
76
+ * const NotificationSettings = () => {
77
+ * const [notifications, setNotifications] = useState({
78
+ * email: true,
79
+ * sms: false,
80
+ * push: true,
81
+ * });
82
+ *
83
+ * const handleChange = (key: keyof typeof notifications) => (e: React.ChangeEvent<HTMLInputElement>) => {
84
+ * setNotifications((prev) => ({ ...prev, [key]: e.target.checked }));
85
+ * };
86
+ *
87
+ * return (
88
+ * <div className="flex flex-col gap-2">
89
+ * <Checkbox label="Email notifications" checked={notifications.email} onChange={handleChange("email")} />
90
+ * <Checkbox label="SMS notifications" checked={notifications.sms} onChange={handleChange("sms")} />
91
+ * <Checkbox label="Push notifications" checked={notifications.push} onChange={handleChange("push")} />
92
+ * </div>
93
+ * );
94
+ * };
95
+ * ```
52
96
  * @description A reference to the input element is provided as the `ref` prop.
53
97
  * @augments props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
54
98
  * @param {CheckboxProps} props - The props for the Checkbox component
@@ -17,9 +17,41 @@ export interface ColorFieldProps extends FormGroupExposedProps, ColorFieldBaseIn
17
17
  errorMessage?: string;
18
18
  }
19
19
  /**
20
- * The ColorField component is used to enter color.
21
- * ColorField validates that user enters a valid color address.
20
+ * The `<ColorField>` component is used to select and enter colors.
21
+ * It provides both a color picker and a text input for hex color codes,
22
+ * with validation ensuring valid hex format (#RRGGBB).
22
23
  *
24
+ * ### When to use
25
+ * - Color selection in theming or customization forms
26
+ * - Brand color configuration
27
+ * - Any input requiring a valid hex color value
28
+ *
29
+ * ### When not to use
30
+ * - When you need a full color palette with named colors
31
+ * - When opacity/alpha channel is required (only supports 6-digit hex)
32
+ *
33
+ * @example Basic usage
34
+ * ```tsx
35
+ * import { ColorField } from "@trackunit/react-form-components";
36
+ *
37
+ * const [color, setColor] = useState("#3B82F6");
38
+ *
39
+ * <ColorField
40
+ * label="Brand Color"
41
+ * value={color}
42
+ * onChange={(e) => setColor(e.target.value)}
43
+ * />
44
+ * ```
45
+ * @example With validation
46
+ * ```tsx
47
+ * import { ColorField } from "@trackunit/react-form-components";
48
+ *
49
+ * <ColorField
50
+ * label="Primary Color"
51
+ * helpText="Enter a valid hex color (e.g., #FF5500)"
52
+ * required
53
+ * />
54
+ * ```
23
55
  */
24
56
  export declare const ColorField: import("react").ForwardRefExoticComponent<Omit<ColorFieldProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
25
57
  export {};
@@ -13,11 +13,52 @@ export interface DateFieldProps extends DateBaseInputProps, FormGroupExposedProp
13
13
  ref?: Ref<HTMLInputElement>;
14
14
  }
15
15
  /**
16
- * The date field component is used for entering date values.
16
+ * The date field component is used for entering date values with a native date picker.
17
17
  *
18
- * _**Do use**_ the DateField for date input.
18
+ * ### When to use
19
+ * Use DateField for selecting calendar dates such as birthdates, deadlines, or scheduling.
19
20
  *
20
- * _**Do not use**_ this fields for non-serialized dates. Use TextField instead.
21
+ * ### When not to use
22
+ * Do not use DateField for non-serialized dates or free-form date text input. Use TextField instead.
23
+ *
24
+ * @example Basic date field
25
+ * ```tsx
26
+ * import { DateField } from "@trackunit/react-form-components";
27
+ * import { useState } from "react";
28
+ *
29
+ * const MyForm = () => {
30
+ * const [date, setDate] = useState("");
31
+ *
32
+ * return (
33
+ * <DateField
34
+ * label="Start Date"
35
+ * value={date}
36
+ * onChange={(e) => setDate(e.target.value)}
37
+ * />
38
+ * );
39
+ * };
40
+ * ```
41
+ * @example Date field with constraints
42
+ * ```tsx
43
+ * import { DateField } from "@trackunit/react-form-components";
44
+ * import { useState } from "react";
45
+ *
46
+ * const BookingForm = () => {
47
+ * const [checkIn, setCheckIn] = useState("");
48
+ * const today = new Date().toISOString().split("T")[0];
49
+ *
50
+ * return (
51
+ * <DateField
52
+ * label="Check-in Date"
53
+ * value={checkIn}
54
+ * onChange={(e) => setCheckIn(e.target.value)}
55
+ * min={today}
56
+ * helpText="Select a date from today onwards"
57
+ * required
58
+ * />
59
+ * );
60
+ * };
61
+ * ```
21
62
  */
22
63
  export declare const DateField: {
23
64
  ({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, "data-testid": dataTestId, ref, ...rest }: DateFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -25,8 +25,63 @@ export interface DropZoneProps extends BaseInputExposedProps, CommonProps {
25
25
  filesSelected: (file: FileList) => void;
26
26
  }
27
27
  /**
28
- * The Drop Zone can be used to drag and drop files or to browse and select files from the file system.
28
+ * The `<DropZone>` component provides a drag-and-drop area for file uploads.
29
+ * Users can either drag files onto the zone or click to browse the file system.
29
30
  *
31
+ * ### When to use
32
+ * - Drag-and-drop file upload experience
33
+ * - Batch file uploads
34
+ * - When visual feedback during drag is important
35
+ *
36
+ * ### When not to use
37
+ * - Simple single file uploads - use `UploadField` instead
38
+ * - When form field styling (label, help text) is needed - use `UploadField`
39
+ *
40
+ * @example Basic usage
41
+ * ```tsx
42
+ * import { DropZone } from "@trackunit/react-form-components";
43
+ *
44
+ * <DropZone
45
+ * filesSelected={(files) => handleFiles(files)}
46
+ * accept="image/*"
47
+ * />
48
+ * ```
49
+ * @example With custom label
50
+ * ```tsx
51
+ * import { DropZone } from "@trackunit/react-form-components";
52
+ *
53
+ * <DropZone
54
+ * filesSelected={(files) => handleFiles(files)}
55
+ * label={
56
+ * <span>
57
+ * <strong>Drop files here</strong> or click to browse
58
+ * </span>
59
+ * }
60
+ * accept=".pdf,.doc,.docx"
61
+ * />
62
+ * ```
63
+ * @example Multiple files with size options
64
+ * ```tsx
65
+ * import { DropZone } from "@trackunit/react-form-components";
66
+ *
67
+ * <DropZone
68
+ * filesSelected={(files) => {
69
+ * Array.from(files).forEach(file => uploadFile(file));
70
+ * }}
71
+ * multiple
72
+ * size="medium"
73
+ * accept="image/png,image/jpeg"
74
+ * />
75
+ * ```
76
+ * @example Disabled state
77
+ * ```tsx
78
+ * import { DropZone } from "@trackunit/react-form-components";
79
+ *
80
+ * <DropZone
81
+ * filesSelected={(files) => handleFiles(files)}
82
+ * disabled={isUploading}
83
+ * />
84
+ * ```
30
85
  * @param {DropZoneProps} props - The props for the DropZone component
31
86
  * @returns {ReactElement} DropZone component
32
87
  */
@@ -8,9 +8,53 @@ export interface EmailFieldProps extends FormGroupExposedProps, BaseInputProps {
8
8
  errorMessage?: string;
9
9
  }
10
10
  /**
11
- * The EmailField component is used to enter email.
12
- * EmailField validates that user enters a valid email address.
11
+ * The `<EmailField>` component is used to enter and validate email addresses.
12
+ * It automatically validates the format on blur and displays appropriate error messages.
13
13
  *
14
+ * ### When to use
15
+ * - Collecting user email addresses in forms
16
+ * - Contact forms that require email validation
17
+ * - Any input that must be a valid email format
18
+ *
19
+ * ### When not to use
20
+ * - For general text input - use `TextField` instead
21
+ * - For URLs - use `UrlField` instead
22
+ * - For phone numbers - use `PhoneField` instead
23
+ *
24
+ * @example Basic usage
25
+ * ```tsx
26
+ * import { EmailField } from "@trackunit/react-form-components";
27
+ *
28
+ * const [email, setEmail] = useState("");
29
+ *
30
+ * <EmailField
31
+ * label="Email Address"
32
+ * value={email}
33
+ * onChange={(e) => setEmail(e.target.value)}
34
+ * required
35
+ * />
36
+ * ```
37
+ * @example With help text
38
+ * ```tsx
39
+ * import { EmailField } from "@trackunit/react-form-components";
40
+ *
41
+ * <EmailField
42
+ * label="Work Email"
43
+ * helpText="We'll use this to send notifications"
44
+ * placeholder="name@company.com"
45
+ * />
46
+ * ```
47
+ * @example With custom error message
48
+ * ```tsx
49
+ * import { EmailField } from "@trackunit/react-form-components";
50
+ *
51
+ * <EmailField
52
+ * label="Email"
53
+ * value={email}
54
+ * onChange={(e) => setEmail(e.target.value)}
55
+ * errorMessage={isEmailTaken ? "This email is already registered" : undefined}
56
+ * />
57
+ * ```
14
58
  */
15
59
  export declare const EmailField: {
16
60
  ({ label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, "data-testid": dataTestId, value, onChange, onBlur, isInvalid, ref, ...rest }: EmailFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -3,9 +3,63 @@ import { GroupBase } from "react-select";
3
3
  import { BaseOptionType } from "../SelectField/FormFieldSelectAdapter";
4
4
  import { MultiSelectFieldProps } from "./FormFieldSelectAdapterMulti";
5
5
  /**
6
- * MultiSelectField is a custom Select component wrapped in the FormGroup component
7
- * that allows you to select multiple options from a list.
6
+ * The `<MultiSelectField>` component allows selecting multiple options from a dropdown list.
7
+ * It wraps the select input with FormGroup for consistent form styling including label,
8
+ * help text, and validation.
8
9
  *
10
+ * ### When to use
11
+ * - Selecting multiple items from a predefined list (tags, categories, permissions)
12
+ * - When users need to see and manage all selected items
13
+ * - Filtering by multiple criteria
14
+ *
15
+ * ### When not to use
16
+ * - Single selection - use `SelectField` instead
17
+ * - Very long lists - consider a searchable/async variant
18
+ * - Binary choices - use `Checkbox` or `ToggleSwitchOption` instead
19
+ *
20
+ * @example Basic usage
21
+ * ```tsx
22
+ * import { MultiSelectField } from "@trackunit/react-form-components";
23
+ *
24
+ * const options = [
25
+ * { value: "read", label: "Read" },
26
+ * { value: "write", label: "Write" },
27
+ * { value: "delete", label: "Delete" },
28
+ * ];
29
+ *
30
+ * <MultiSelectField
31
+ * label="Permissions"
32
+ * options={options}
33
+ * value={selectedPermissions}
34
+ * onChange={(selected) => setSelectedPermissions(selected)}
35
+ * />
36
+ * ```
37
+ * @example With placeholder and help text
38
+ * ```tsx
39
+ * import { MultiSelectField } from "@trackunit/react-form-components";
40
+ *
41
+ * <MultiSelectField
42
+ * label="Categories"
43
+ * options={categoryOptions}
44
+ * value={selectedCategories}
45
+ * onChange={(selected) => setSelectedCategories(selected)}
46
+ * placeholder="Select categories..."
47
+ * helpText="Select all that apply"
48
+ * />
49
+ * ```
50
+ * @example With validation
51
+ * ```tsx
52
+ * import { MultiSelectField } from "@trackunit/react-form-components";
53
+ *
54
+ * <MultiSelectField
55
+ * label="Required Tags"
56
+ * options={tagOptions}
57
+ * value={selectedTags}
58
+ * onChange={(selected) => setSelectedTags(selected)}
59
+ * required
60
+ * errorMessage={selectedTags.length === 0 ? "Select at least one tag" : undefined}
61
+ * />
62
+ * ```
9
63
  * @param {MultiSelectFieldProps} props - The props for the MultiSelectField component
10
64
  * @returns {ReactElement} MultiSelectField component
11
65
  */
@@ -15,9 +15,53 @@ export interface NumberFieldProps extends NumberBaseInputProps, FormGroupExposed
15
15
  /**
16
16
  * The number field component is used for entering numeric values and includes controls for incrementally increasing or decreasing the value.
17
17
  *
18
- * _**Do use**_ the NumberField when the controls to incrementally increase or decrease makes the task easier for the user.
18
+ * ### When to use
19
+ * Use NumberField when the controls to incrementally increase or decrease makes the task easier for the user, such as quantity selectors or numeric settings.
19
20
  *
20
- * _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
21
+ * ### When not to use
22
+ * Do not use NumberField for non-serialized numbers or IDs. Use TextField instead.
23
+ *
24
+ * @example Basic number field
25
+ * ```tsx
26
+ * import { NumberField } from "@trackunit/react-form-components";
27
+ * import { useState } from "react";
28
+ *
29
+ * const MyForm = () => {
30
+ * const [quantity, setQuantity] = useState(1);
31
+ *
32
+ * return (
33
+ * <NumberField
34
+ * label="Quantity"
35
+ * value={quantity}
36
+ * onChange={(e) => setQuantity(Number(e.target.value))}
37
+ * min={1}
38
+ * max={100}
39
+ * />
40
+ * );
41
+ * };
42
+ * ```
43
+ * @example Number field with validation
44
+ * ```tsx
45
+ * import { NumberField } from "@trackunit/react-form-components";
46
+ * import { useState } from "react";
47
+ *
48
+ * const TemperatureInput = () => {
49
+ * const [temp, setTemp] = useState(20);
50
+ *
51
+ * return (
52
+ * <NumberField
53
+ * label="Temperature (°C)"
54
+ * value={temp}
55
+ * onChange={(e) => setTemp(Number(e.target.value))}
56
+ * min={-40}
57
+ * max={60}
58
+ * step={0.5}
59
+ * helpText="Enter a value between -40 and 60"
60
+ * required
61
+ * />
62
+ * );
63
+ * };
64
+ * ```
21
65
  */
22
66
  export declare const NumberField: {
23
67
  ({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, maxLength, className, value, "data-testid": dataTestId, defaultValue, onBlur, onChange, ref, ...rest }: NumberFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -13,11 +13,60 @@ export interface PasswordFieldProps extends Omit<PasswordBaseInputProps, "obfusc
13
13
  ref?: Ref<HTMLInputElement>;
14
14
  }
15
15
  /**
16
- * Password fields enter a password or other confidential information. Characters are masked as they are typed.
16
+ * The `<PasswordField>` component is used to enter passwords or other confidential information.
17
+ * Characters are masked as they are typed, with an option to toggle visibility.
17
18
  *
18
- * _**Do use** when the user has to input a password or something that needs to be obfuscated_
19
+ * ### When to use
20
+ * - Password input for login or registration forms
21
+ * - Entering sensitive data that should be obfuscated (API keys, secrets)
22
+ * - Any confidential text input
19
23
  *
20
- * _**Do not use** to confirm user actions, such as deleting. Use a checkbox for such flows._
24
+ * ### When not to use
25
+ * - Confirming user actions like deletion - use a Checkbox instead
26
+ * - Non-sensitive text input - use `TextField` instead
27
+ * - PIN codes - consider a specialized PIN input
28
+ *
29
+ * @example Basic usage
30
+ * ```tsx
31
+ * import { PasswordField } from "@trackunit/react-form-components";
32
+ *
33
+ * const [password, setPassword] = useState("");
34
+ *
35
+ * <PasswordField
36
+ * label="Password"
37
+ * value={password}
38
+ * onChange={(e) => setPassword(e.target.value)}
39
+ * required
40
+ * />
41
+ * ```
42
+ * @example With validation
43
+ * ```tsx
44
+ * import { PasswordField } from "@trackunit/react-form-components";
45
+ *
46
+ * <PasswordField
47
+ * label="New Password"
48
+ * value={password}
49
+ * onChange={(e) => setPassword(e.target.value)}
50
+ * helpText="Must be at least 8 characters"
51
+ * errorMessage={password.length < 8 ? "Password too short" : undefined}
52
+ * />
53
+ * ```
54
+ * @example Confirm password pattern
55
+ * ```tsx
56
+ * import { PasswordField } from "@trackunit/react-form-components";
57
+ *
58
+ * <PasswordField
59
+ * label="Password"
60
+ * value={password}
61
+ * onChange={(e) => setPassword(e.target.value)}
62
+ * />
63
+ * <PasswordField
64
+ * label="Confirm Password"
65
+ * value={confirmPassword}
66
+ * onChange={(e) => setConfirmPassword(e.target.value)}
67
+ * errorMessage={confirmPassword !== password ? "Passwords do not match" : undefined}
68
+ * />
69
+ * ```
21
70
  */
22
71
  export declare const PasswordField: {
23
72
  ({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, "data-testid": dataTestId, ref, ...rest }: PasswordFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -13,19 +13,52 @@ export interface PhoneFieldProps extends FormGroupExposedProps, PhoneBaseInputPr
13
13
  ref?: Ref<HTMLInputElement>;
14
14
  }
15
15
  /**
16
- * The PhoneField component is used to enter phone number.
17
- * It is a wrapper around the PhoneInput component and the FormGroup component.
18
- * It is used to render a phone number field with a label, a tip, a help text, a help addon and an error message.
16
+ * The `<PhoneField>` component is used to enter and validate phone numbers.
17
+ * It includes built-in validation for phone number format and displays appropriate error messages.
19
18
  *
20
- * @param {string} [label] - The label for the component.
21
- * @param {string} [tip] - The tip for the component.
22
- * @param {string} [helpText] - The help text for the component.
23
- * @param {string} [helpAddon] - The help addon for the component.
24
- * @param {string} [errorMessage] - The error message for the component.
25
- * @param {string} [defaultValue] - The default value for the component.
26
- * @param {boolean} [disabled=false] - Whether the component is disabled or not.
27
- * @param {string} [fieldSize="medium"] - The size of the input field.
28
- * @param {boolean} [disableAction=false] - Whether the action button is disabled or not.
19
+ * ### When to use
20
+ * - Collecting phone numbers in contact forms
21
+ * - User profile phone number fields
22
+ * - Any input requiring phone number validation
23
+ *
24
+ * ### When not to use
25
+ * - General text input - use `TextField` instead
26
+ * - International phone with country selector - consider specialized international phone component
27
+ *
28
+ * @example Basic usage
29
+ * ```tsx
30
+ * import { PhoneField } from "@trackunit/react-form-components";
31
+ *
32
+ * const [phone, setPhone] = useState("");
33
+ *
34
+ * <PhoneField
35
+ * label="Phone Number"
36
+ * value={phone}
37
+ * onChange={(e) => setPhone(e.target.value)}
38
+ * required
39
+ * />
40
+ * ```
41
+ * @example With help text
42
+ * ```tsx
43
+ * import { PhoneField } from "@trackunit/react-form-components";
44
+ *
45
+ * <PhoneField
46
+ * label="Mobile Phone"
47
+ * helpText="Include country code for international numbers"
48
+ * placeholder="+1 555 123 4567"
49
+ * />
50
+ * ```
51
+ * @example With custom error handling
52
+ * ```tsx
53
+ * import { PhoneField } from "@trackunit/react-form-components";
54
+ *
55
+ * <PhoneField
56
+ * label="Contact Phone"
57
+ * value={phone}
58
+ * onChange={(e) => setPhone(e.target.value)}
59
+ * errorMessage={isPhoneDuplicate ? "This phone is already registered" : undefined}
60
+ * />
61
+ * ```
29
62
  */
30
63
  export declare const PhoneField: {
31
64
  ({ label, id, tip, helpText, isInvalid, errorMessage, value, helpAddon, className, defaultValue, "data-testid": dataTestId, name, onBlur, ref, ...rest }: PhoneFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -43,10 +43,57 @@ export interface RadioGroupProps<TValue extends string | number> extends CommonP
43
43
  *
44
44
  * Radio buttons are used for mutually exclusive choices, not for multiple choices. Only one radio button can be selected at a time. When a user chooses a new item, the previous choice is automatically deselected.
45
45
  *
46
- * _**Do use** Radio buttons in forms, settings, or selections in a list._
46
+ * ### When to use
47
+ * Use RadioGroup in forms, settings, or selections in a list where only one option can be selected.
47
48
  *
48
- * _**Do not use** Radio buttons if a user can select many option from a list, use checkboxes instead of radio buttons._
49
+ * ### When not to use
50
+ * Do not use RadioGroup if a user can select many options from a list. Use Checkbox instead.
49
51
  *
52
+ * @example Basic radio group
53
+ * ```tsx
54
+ * import { RadioGroup, RadioItem } from "@trackunit/react-form-components";
55
+ * import { useState, ChangeEvent } from "react";
56
+ *
57
+ * const MyForm = () => {
58
+ * const [size, setSize] = useState("medium");
59
+ *
60
+ * return (
61
+ * <RadioGroup
62
+ * id="size-selection"
63
+ * label="Select size"
64
+ * value={size}
65
+ * onChange={(e: ChangeEvent<HTMLInputElement>) => setSize(e.target.value)}
66
+ * >
67
+ * <RadioItem label="Small" value="small" />
68
+ * <RadioItem label="Medium" value="medium" />
69
+ * <RadioItem label="Large" value="large" />
70
+ * </RadioGroup>
71
+ * );
72
+ * };
73
+ * ```
74
+ * @example Inline radio group with descriptions
75
+ * ```tsx
76
+ * import { RadioGroup, RadioItem } from "@trackunit/react-form-components";
77
+ * import { useState, ChangeEvent } from "react";
78
+ *
79
+ * const PlanSelector = () => {
80
+ * const [plan, setPlan] = useState("basic");
81
+ *
82
+ * return (
83
+ * <RadioGroup
84
+ * id="plan-selection"
85
+ * label="Choose your plan"
86
+ * value={plan}
87
+ * onChange={(e: ChangeEvent<HTMLInputElement>) => setPlan(e.target.value)}
88
+ * inline
89
+ * >
90
+ * <RadioItem label="Basic" value="basic" description="$9/month" />
91
+ * <RadioItem label="Pro" value="pro" description="$29/month" />
92
+ * <RadioItem label="Enterprise" value="enterprise" description="Contact us" />
93
+ * </RadioGroup>
94
+ * );
95
+ * };
96
+ * ```
50
97
  * @param {RadioGroupProps} props - The props for the RadioGroup component
51
98
  * @returns {ReactElement} RadioGroup component
52
99
  */