@trackunit/react-form-components 1.14.25 → 1.14.27

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
@@ -2013,8 +2013,16 @@ const CreatableSelect = (props) => {
2013
2013
  };
2014
2014
 
2015
2015
  /**
2016
- * The Label component is used for labels for input fields.
2017
- * This component is **not used directly**, but is part of the FormGroup and Field components.
2016
+ * Label renders a styled `<label>` element for form input fields.
2017
+ * This component is typically **not used directly** it is rendered internally by `FormGroup` and
2018
+ * all Field components (e.g., `TextField`, `CheckboxField`, `TimeRangeField`). Use it only when
2019
+ * building a custom form group layout that cannot use `FormGroup`.
2020
+ *
2021
+ * ### When to use
2022
+ * Use Label only when constructing a custom form field wrapper that cannot use `FormGroup`.
2023
+ *
2024
+ * ### When not to use
2025
+ * Do not use Label directly for standard form fields — use the appropriate Field component (e.g., `TextField`, `CheckboxField`) which includes Label automatically.
2018
2026
  *
2019
2027
  * @param {LabelProps} props - The props for the Label component
2020
2028
  * @returns {ReactElement} Label component
@@ -2047,9 +2055,27 @@ const cvaFormGroupContainerAfter = cssClassVarianceUtilities.cvaMerge(["flex", "
2047
2055
  const cvaHelpAddon = cssClassVarianceUtilities.cvaMerge(["ml-auto"]);
2048
2056
 
2049
2057
  /**
2050
- * The FormGroup component should be used to wrap any Input element that needs a label.
2051
- * Besides a label the component supplies an optional Tooltip, HelpText and HelpAddon support.
2058
+ * FormGroup wraps an input element with a label, optional tooltip, help text, and validation styling.
2059
+ * It provides consistent form field layout and is used internally by all Field components
2060
+ * (`TextField`, `CheckboxField`, `TimeRangeField`, etc.).
2061
+ *
2062
+ * ### When to use
2063
+ * Use FormGroup when building a custom field component that needs a label, tooltip, or help text.
2052
2064
  *
2065
+ * ### When not to use
2066
+ * Do not use FormGroup directly for standard inputs — use the corresponding Field component
2067
+ * (e.g., `TextField`, `CheckboxField`) which already wraps FormGroup.
2068
+ *
2069
+ * @example Custom field with label, tooltip, and help text
2070
+ * ```tsx
2071
+ * import { FormGroup } from "@trackunit/react-form-components";
2072
+ *
2073
+ * const CustomColorField = () => (
2074
+ * <FormGroup label="Brand color" tip="Used across the dashboard" helpText="Enter a hex color code">
2075
+ * <input type="color" />
2076
+ * </FormGroup>
2077
+ * );
2078
+ * ```
2053
2079
  * @param {FormGroupProps} props - The props for the FormGroup component
2054
2080
  * @returns {ReactElement} FormGroup component
2055
2081
  */
@@ -2063,9 +2089,34 @@ const FormGroup = ({ isInvalid = false, isWarning = false, helpText, helpAddon,
2063
2089
  };
2064
2090
 
2065
2091
  /**
2066
- * The checkbox field component is used for entering boolean values.
2092
+ * CheckboxField is a form-ready checkbox that wraps a `Checkbox` inside a `FormGroup`.
2093
+ * It provides a labeled checkbox with support for tooltips, help text, validation, and form group styling.
2067
2094
  *
2068
- * _**Do use**_ the CheckboxField for boolean input.
2095
+ * ### When to use
2096
+ * Use CheckboxField for boolean inputs inside forms — for example, "I agree to terms" or toggling a feature on/off.
2097
+ *
2098
+ * ### When not to use
2099
+ * Do not use CheckboxField for multi-select lists — use checkbox filters or a select component.
2100
+ * For a standalone checkbox without form group wrapping, use `Checkbox` directly.
2101
+ *
2102
+ * @example Checkbox field in a form
2103
+ * ```tsx
2104
+ * import { CheckboxField } from "@trackunit/react-form-components";
2105
+ * import { useState } from "react";
2106
+ *
2107
+ * const TermsCheckbox = () => {
2108
+ * const [accepted, setAccepted] = useState(false);
2109
+ * return (
2110
+ * <CheckboxField
2111
+ * label="Terms and Conditions"
2112
+ * checkboxLabel="I accept the terms"
2113
+ * checked={accepted}
2114
+ * onChange={() => setAccepted(!accepted)}
2115
+ * />
2116
+ * );
2117
+ * };
2118
+ * ```
2119
+ * @param {CheckboxFieldProps} props - The props for the CheckboxField component
2069
2120
  */
2070
2121
  const CheckboxField = ({ label, id, tip, helpText, helpAddon, isInvalid, className, checked, "data-testid": dataTestId, checkboxLabel, onChange, ref, ...rest }) => {
2071
2122
  const htmlForId = id ? id : "checkboxField-" + sharedUtils.uuidv4();
@@ -3185,8 +3236,33 @@ const PhoneField = ({ label, id, tip, helpText, isInvalid, errorMessage, value,
3185
3236
  PhoneField.displayName = "PhoneField";
3186
3237
 
3187
3238
  /**
3188
- * The PhoneFieldWithController component is a wrapper for the PhoneField component to connect it to react-hook-form.
3239
+ * PhoneFieldWithController wraps `PhoneField` with a `react-hook-form` `Controller`,
3240
+ * connecting the phone number input to form state management. It handles value synchronization,
3241
+ * validation integration, and default value assignment automatically.
3189
3242
  *
3243
+ * ### When to use
3244
+ * Use PhoneFieldWithController when you have a phone number field inside a `react-hook-form` managed form.
3245
+ *
3246
+ * ### When not to use
3247
+ * Do not use PhoneFieldWithController outside of `react-hook-form` — use `PhoneField` directly.
3248
+ *
3249
+ * @example Phone field in a react-hook-form
3250
+ * ```tsx
3251
+ * import { PhoneFieldWithController } from "@trackunit/react-form-components";
3252
+ * import { useForm } from "react-hook-form";
3253
+ *
3254
+ * const ContactForm = () => {
3255
+ * const { control } = useForm();
3256
+ * return (
3257
+ * <PhoneFieldWithController
3258
+ * control={control}
3259
+ * name="phone"
3260
+ * label="Phone number"
3261
+ * />
3262
+ * );
3263
+ * };
3264
+ * ```
3265
+ * @param {PhoneFieldWithControllerProps} props - The props for the PhoneFieldWithController component
3190
3266
  */
3191
3267
  const PhoneFieldWithController = ({ control, controllerProps, name, value, ref, ...rest }) => {
3192
3268
  return (jsxRuntime.jsx(reactHookForm.Controller, { control: control, defaultValue: value, name: name, ...controllerProps, render: ({ field }) => jsxRuntime.jsx(PhoneField, { ...rest, ...field, ref: ref }) }));
@@ -3376,8 +3452,26 @@ const cvaTimeRange = cssClassVarianceUtilities.cvaMerge([
3376
3452
  ]);
3377
3453
 
3378
3454
  /**
3379
- * TimeRange is used to create a time range entry.
3455
+ * TimeRange renders a pair of native `<input type="time">` fields for selecting a start and end time.
3456
+ * It provides a controlled time range with `onChange` callback and supports custom separators, disabled state, and validation styling.
3380
3457
  *
3458
+ * ### When to use
3459
+ * Use TimeRange for bare time range inputs inside custom layouts or composed components (e.g., inside Schedule rows).
3460
+ *
3461
+ * ### When not to use
3462
+ * Do not use TimeRange directly in forms that need a label, help text, or validation — use `TimeRangeField` instead.
3463
+ *
3464
+ * @example Basic time range input
3465
+ * ```tsx
3466
+ * import { TimeRange } from "@trackunit/react-form-components";
3467
+ *
3468
+ * const ShiftPicker = () => (
3469
+ * <TimeRange
3470
+ * range={{ timeFrom: "09:00", timeTo: "17:00" }}
3471
+ * onChange={(range) => console.log(range)}
3472
+ * />
3473
+ * );
3474
+ * ```
3381
3475
  * @param {TimeRangeProps} props - The props for the TimeRange component
3382
3476
  * @returns {ReactElement} TimeRange component
3383
3477
  */
@@ -3407,8 +3501,31 @@ const cvaScheduleItem = cssClassVarianceUtilities.cvaMerge([
3407
3501
  const cvaScheduleItemText = cssClassVarianceUtilities.cvaMerge(["flex", "font-bold", "self-center"]);
3408
3502
 
3409
3503
  /**
3410
- * Schedule is used to create a time range entries.
3504
+ * Schedule renders a weekly time-range editor where each row represents a day with an active toggle,
3505
+ * an optional all-day checkbox, and a start/end time range. It is used for defining recurring schedules
3506
+ * such as operating hours, service windows, or geofence active periods.
3411
3507
  *
3508
+ * ### When to use
3509
+ * Use Schedule when users need to configure per-day time ranges — for example, setting working hours for each day of the week.
3510
+ *
3511
+ * ### When not to use
3512
+ * Do not use Schedule for a single time range — use `TimeRangeField`.
3513
+ * Do not use it for date range selection — use `DayRangePicker`.
3514
+ *
3515
+ * @example Weekly operating hours schedule
3516
+ * ```tsx
3517
+ * import { Schedule, ScheduleItem } from "@trackunit/react-form-components";
3518
+ * import { useState } from "react";
3519
+ *
3520
+ * const OperatingHours = () => {
3521
+ * const [schedule, setSchedule] = useState<Array<ScheduleItem>>([
3522
+ * { key: "mon", label: "Monday", isActive: true, range: { timeFrom: "08:00", timeTo: "17:00" } },
3523
+ * { key: "tue", label: "Tuesday", isActive: true, range: { timeFrom: "08:00", timeTo: "17:00" } },
3524
+ * { key: "wed", label: "Wednesday", isActive: false, range: { timeFrom: "", timeTo: "" } },
3525
+ * ]);
3526
+ * return <Schedule schedule={schedule} onChange={setSchedule} />;
3527
+ * };
3528
+ * ```
3412
3529
  * @param {ScheduleProps} props - The props for the Schedule component
3413
3530
  * @returns {ReactElement} Schedule component
3414
3531
  */
@@ -3598,9 +3715,44 @@ const cvaSearch = cssClassVarianceUtilities.cvaMerge([
3598
3715
  });
3599
3716
 
3600
3717
  /**
3601
- * The Search component is used to render a search input field.
3718
+ * Search renders a styled search input with a magnifying glass icon, an optional loading spinner,
3719
+ * and a clear button that appears when a value is present. It supports visual variants such as
3720
+ * widening on focus and hiding the border when not focused.
3721
+ *
3722
+ * ### When to use
3723
+ * Use Search for filtering or querying data sets — for example, a search box above a table or list to narrow down results.
3724
+ *
3725
+ * ### When not to use
3726
+ * Do not use Search for multi-filter scenarios — use `FilterBar`.
3727
+ * Do not use it as a general text input — use `TextField`.
3728
+ *
3729
+ * @example Basic search input with change handler
3730
+ * ```tsx
3731
+ * import { Search } from "@trackunit/react-form-components";
3732
+ * import { useState, ChangeEvent } from "react";
3733
+ *
3734
+ * const AssetSearch = () => {
3735
+ * const [query, setQuery] = useState("");
3736
+ * return (
3737
+ * <Search
3738
+ * value={query}
3739
+ * onChange={(e: ChangeEvent<HTMLInputElement>) => setQuery(e.target.value)}
3740
+ * onClear={() => setQuery("")}
3741
+ * placeholder="Search assets..."
3742
+ * />
3743
+ * );
3744
+ * };
3745
+ * ```
3746
+ * @example Compact search that widens on focus
3747
+ * ```tsx
3748
+ * import { Search } from "@trackunit/react-form-components";
3602
3749
  *
3750
+ * const CompactSearch = () => (
3751
+ * <Search widenInputOnFocus hideBorderWhenNotInFocus placeholder="Search..." />
3752
+ * );
3753
+ * ```
3603
3754
  * @param {SearchProps} props - The props for the Search component
3755
+ * @returns {ReactElement} Search component
3604
3756
  */
3605
3757
  const Search = ({ className, placeholder, value, widenInputOnFocus = false, hideBorderWhenNotInFocus = false, disabled = false, onKeyUp, onChange, onFocus, onBlur, name, onClear, "data-testid": dataTestId, autoComplete = "on", loading = false, inputClassName, iconName = "MagnifyingGlass", style, ref, fieldSize = "medium", id, ...rest }) => {
3606
3758
  const { t } = useTranslation();
@@ -3923,8 +4075,41 @@ const TextField = ({ id, label, tip, helpText, helpAddon, errorMessage, isInvali
3923
4075
  TextField.displayName = "TextField";
3924
4076
 
3925
4077
  /**
3926
- * TimeRangeField Description. <-- Please add a proper Description this is used in Storybook.
4078
+ * TimeRangeField is a form-ready time range input that wraps a `TimeRange` selector inside a `FormGroup`.
4079
+ * It provides a labeled pair of start/end time inputs with support for tooltips, help text, and validation error messages.
4080
+ *
4081
+ * ### When to use
4082
+ * Use TimeRangeField when you need a labeled time range input inside a form — for example, selecting working hours, shift times, or scheduling windows.
4083
+ *
4084
+ * ### When not to use
4085
+ * Do not use TimeRangeField for date ranges — use `DayRangePicker`.
4086
+ * Do not use it outside a form context where you only need a bare time range input — use `TimeRange` directly instead.
3927
4087
  *
4088
+ * @example Basic time range field with a label
4089
+ * ```tsx
4090
+ * import { TimeRangeField } from "@trackunit/react-form-components";
4091
+ *
4092
+ * const ShiftTimeInput = () => (
4093
+ * <TimeRangeField
4094
+ * label="Shift hours"
4095
+ * range={{ timeFrom: "08:00", timeTo: "16:00" }}
4096
+ * onChange={(range) => console.log(range)}
4097
+ * />
4098
+ * );
4099
+ * ```
4100
+ * @example Time range field with validation error
4101
+ * ```tsx
4102
+ * import { TimeRangeField } from "@trackunit/react-form-components";
4103
+ *
4104
+ * const ValidatedShiftInput = () => (
4105
+ * <TimeRangeField
4106
+ * label="Working hours"
4107
+ * range={{ timeFrom: "18:00", timeTo: "06:00" }}
4108
+ * errorMessage="End time must be after start time."
4109
+ * onChange={(range) => console.log(range)}
4110
+ * />
4111
+ * );
4112
+ * ```
3928
4113
  * @param {TimeRangeFieldProps} props - The props for the TimeRangeField component
3929
4114
  * @returns {ReactElement} TimeRangeField component
3930
4115
  */
@@ -4189,9 +4374,30 @@ const cvaUploadInputField = cssClassVarianceUtilities.cvaMerge([
4189
4374
  ]);
4190
4375
 
4191
4376
  /**
4192
- * A thin wrapper around the `BaseInput` component for upload input fields.
4377
+ * UploadInput renders a file upload input with a styled button label. It wraps `BaseInput` with `type="file"`
4378
+ * and supports restricting file types, enabling multi-file selection, and disabling interaction.
4379
+ *
4380
+ * **Note:** If you need a label, help text, or validation wrapping, use `UploadField` instead.
4193
4381
  *
4194
- * NOTE: If shown with a label, please use the `UploadField` component instead.
4382
+ * ### When to use
4383
+ * Use UploadInput for bare file upload inputs inside custom layouts or composed form components.
4384
+ *
4385
+ * ### When not to use
4386
+ * Do not use UploadInput in standard forms — use `UploadField` which adds `FormGroup` wrapping with label and validation.
4387
+ *
4388
+ * @example File upload with accepted types
4389
+ * ```tsx
4390
+ * import { UploadInput } from "@trackunit/react-form-components";
4391
+ *
4392
+ * const DocumentUpload = () => (
4393
+ * <UploadInput
4394
+ * uploadLabel="Choose file"
4395
+ * acceptedTypes=".pdf,.docx"
4396
+ * onChange={(e) => console.log(e.target.files)}
4397
+ * />
4398
+ * );
4399
+ * ```
4400
+ * @param {UploadInputProps} props - The props for the UploadInput component
4195
4401
  */
4196
4402
  const UploadInput = ({ disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles, ref, ...rest }) => (jsxRuntime.jsx("label", { className: "tu-upload-input", children: jsxRuntime.jsx(BaseInput, { accept: acceptedTypes, addonBefore: uploadLabel, disabled: disabled, inputClassName: cvaUploadInputField(), multiple: multipleFiles, onClick: event => {
4197
4403
  // onClick used to work with nonInteractive option
package/index.esm.js CHANGED
@@ -2012,8 +2012,16 @@ const CreatableSelect = (props) => {
2012
2012
  };
2013
2013
 
2014
2014
  /**
2015
- * The Label component is used for labels for input fields.
2016
- * This component is **not used directly**, but is part of the FormGroup and Field components.
2015
+ * Label renders a styled `<label>` element for form input fields.
2016
+ * This component is typically **not used directly** it is rendered internally by `FormGroup` and
2017
+ * all Field components (e.g., `TextField`, `CheckboxField`, `TimeRangeField`). Use it only when
2018
+ * building a custom form group layout that cannot use `FormGroup`.
2019
+ *
2020
+ * ### When to use
2021
+ * Use Label only when constructing a custom form field wrapper that cannot use `FormGroup`.
2022
+ *
2023
+ * ### When not to use
2024
+ * Do not use Label directly for standard form fields — use the appropriate Field component (e.g., `TextField`, `CheckboxField`) which includes Label automatically.
2017
2025
  *
2018
2026
  * @param {LabelProps} props - The props for the Label component
2019
2027
  * @returns {ReactElement} Label component
@@ -2046,9 +2054,27 @@ const cvaFormGroupContainerAfter = cvaMerge(["flex", "justify-between", "mt-1",
2046
2054
  const cvaHelpAddon = cvaMerge(["ml-auto"]);
2047
2055
 
2048
2056
  /**
2049
- * The FormGroup component should be used to wrap any Input element that needs a label.
2050
- * Besides a label the component supplies an optional Tooltip, HelpText and HelpAddon support.
2057
+ * FormGroup wraps an input element with a label, optional tooltip, help text, and validation styling.
2058
+ * It provides consistent form field layout and is used internally by all Field components
2059
+ * (`TextField`, `CheckboxField`, `TimeRangeField`, etc.).
2060
+ *
2061
+ * ### When to use
2062
+ * Use FormGroup when building a custom field component that needs a label, tooltip, or help text.
2051
2063
  *
2064
+ * ### When not to use
2065
+ * Do not use FormGroup directly for standard inputs — use the corresponding Field component
2066
+ * (e.g., `TextField`, `CheckboxField`) which already wraps FormGroup.
2067
+ *
2068
+ * @example Custom field with label, tooltip, and help text
2069
+ * ```tsx
2070
+ * import { FormGroup } from "@trackunit/react-form-components";
2071
+ *
2072
+ * const CustomColorField = () => (
2073
+ * <FormGroup label="Brand color" tip="Used across the dashboard" helpText="Enter a hex color code">
2074
+ * <input type="color" />
2075
+ * </FormGroup>
2076
+ * );
2077
+ * ```
2052
2078
  * @param {FormGroupProps} props - The props for the FormGroup component
2053
2079
  * @returns {ReactElement} FormGroup component
2054
2080
  */
@@ -2062,9 +2088,34 @@ const FormGroup = ({ isInvalid = false, isWarning = false, helpText, helpAddon,
2062
2088
  };
2063
2089
 
2064
2090
  /**
2065
- * The checkbox field component is used for entering boolean values.
2091
+ * CheckboxField is a form-ready checkbox that wraps a `Checkbox` inside a `FormGroup`.
2092
+ * It provides a labeled checkbox with support for tooltips, help text, validation, and form group styling.
2066
2093
  *
2067
- * _**Do use**_ the CheckboxField for boolean input.
2094
+ * ### When to use
2095
+ * Use CheckboxField for boolean inputs inside forms — for example, "I agree to terms" or toggling a feature on/off.
2096
+ *
2097
+ * ### When not to use
2098
+ * Do not use CheckboxField for multi-select lists — use checkbox filters or a select component.
2099
+ * For a standalone checkbox without form group wrapping, use `Checkbox` directly.
2100
+ *
2101
+ * @example Checkbox field in a form
2102
+ * ```tsx
2103
+ * import { CheckboxField } from "@trackunit/react-form-components";
2104
+ * import { useState } from "react";
2105
+ *
2106
+ * const TermsCheckbox = () => {
2107
+ * const [accepted, setAccepted] = useState(false);
2108
+ * return (
2109
+ * <CheckboxField
2110
+ * label="Terms and Conditions"
2111
+ * checkboxLabel="I accept the terms"
2112
+ * checked={accepted}
2113
+ * onChange={() => setAccepted(!accepted)}
2114
+ * />
2115
+ * );
2116
+ * };
2117
+ * ```
2118
+ * @param {CheckboxFieldProps} props - The props for the CheckboxField component
2068
2119
  */
2069
2120
  const CheckboxField = ({ label, id, tip, helpText, helpAddon, isInvalid, className, checked, "data-testid": dataTestId, checkboxLabel, onChange, ref, ...rest }) => {
2070
2121
  const htmlForId = id ? id : "checkboxField-" + uuidv4();
@@ -3184,8 +3235,33 @@ const PhoneField = ({ label, id, tip, helpText, isInvalid, errorMessage, value,
3184
3235
  PhoneField.displayName = "PhoneField";
3185
3236
 
3186
3237
  /**
3187
- * The PhoneFieldWithController component is a wrapper for the PhoneField component to connect it to react-hook-form.
3238
+ * PhoneFieldWithController wraps `PhoneField` with a `react-hook-form` `Controller`,
3239
+ * connecting the phone number input to form state management. It handles value synchronization,
3240
+ * validation integration, and default value assignment automatically.
3188
3241
  *
3242
+ * ### When to use
3243
+ * Use PhoneFieldWithController when you have a phone number field inside a `react-hook-form` managed form.
3244
+ *
3245
+ * ### When not to use
3246
+ * Do not use PhoneFieldWithController outside of `react-hook-form` — use `PhoneField` directly.
3247
+ *
3248
+ * @example Phone field in a react-hook-form
3249
+ * ```tsx
3250
+ * import { PhoneFieldWithController } from "@trackunit/react-form-components";
3251
+ * import { useForm } from "react-hook-form";
3252
+ *
3253
+ * const ContactForm = () => {
3254
+ * const { control } = useForm();
3255
+ * return (
3256
+ * <PhoneFieldWithController
3257
+ * control={control}
3258
+ * name="phone"
3259
+ * label="Phone number"
3260
+ * />
3261
+ * );
3262
+ * };
3263
+ * ```
3264
+ * @param {PhoneFieldWithControllerProps} props - The props for the PhoneFieldWithController component
3189
3265
  */
3190
3266
  const PhoneFieldWithController = ({ control, controllerProps, name, value, ref, ...rest }) => {
3191
3267
  return (jsx(Controller, { control: control, defaultValue: value, name: name, ...controllerProps, render: ({ field }) => jsx(PhoneField, { ...rest, ...field, ref: ref }) }));
@@ -3375,8 +3451,26 @@ const cvaTimeRange = cvaMerge([
3375
3451
  ]);
3376
3452
 
3377
3453
  /**
3378
- * TimeRange is used to create a time range entry.
3454
+ * TimeRange renders a pair of native `<input type="time">` fields for selecting a start and end time.
3455
+ * It provides a controlled time range with `onChange` callback and supports custom separators, disabled state, and validation styling.
3379
3456
  *
3457
+ * ### When to use
3458
+ * Use TimeRange for bare time range inputs inside custom layouts or composed components (e.g., inside Schedule rows).
3459
+ *
3460
+ * ### When not to use
3461
+ * Do not use TimeRange directly in forms that need a label, help text, or validation — use `TimeRangeField` instead.
3462
+ *
3463
+ * @example Basic time range input
3464
+ * ```tsx
3465
+ * import { TimeRange } from "@trackunit/react-form-components";
3466
+ *
3467
+ * const ShiftPicker = () => (
3468
+ * <TimeRange
3469
+ * range={{ timeFrom: "09:00", timeTo: "17:00" }}
3470
+ * onChange={(range) => console.log(range)}
3471
+ * />
3472
+ * );
3473
+ * ```
3380
3474
  * @param {TimeRangeProps} props - The props for the TimeRange component
3381
3475
  * @returns {ReactElement} TimeRange component
3382
3476
  */
@@ -3406,8 +3500,31 @@ const cvaScheduleItem = cvaMerge([
3406
3500
  const cvaScheduleItemText = cvaMerge(["flex", "font-bold", "self-center"]);
3407
3501
 
3408
3502
  /**
3409
- * Schedule is used to create a time range entries.
3503
+ * Schedule renders a weekly time-range editor where each row represents a day with an active toggle,
3504
+ * an optional all-day checkbox, and a start/end time range. It is used for defining recurring schedules
3505
+ * such as operating hours, service windows, or geofence active periods.
3410
3506
  *
3507
+ * ### When to use
3508
+ * Use Schedule when users need to configure per-day time ranges — for example, setting working hours for each day of the week.
3509
+ *
3510
+ * ### When not to use
3511
+ * Do not use Schedule for a single time range — use `TimeRangeField`.
3512
+ * Do not use it for date range selection — use `DayRangePicker`.
3513
+ *
3514
+ * @example Weekly operating hours schedule
3515
+ * ```tsx
3516
+ * import { Schedule, ScheduleItem } from "@trackunit/react-form-components";
3517
+ * import { useState } from "react";
3518
+ *
3519
+ * const OperatingHours = () => {
3520
+ * const [schedule, setSchedule] = useState<Array<ScheduleItem>>([
3521
+ * { key: "mon", label: "Monday", isActive: true, range: { timeFrom: "08:00", timeTo: "17:00" } },
3522
+ * { key: "tue", label: "Tuesday", isActive: true, range: { timeFrom: "08:00", timeTo: "17:00" } },
3523
+ * { key: "wed", label: "Wednesday", isActive: false, range: { timeFrom: "", timeTo: "" } },
3524
+ * ]);
3525
+ * return <Schedule schedule={schedule} onChange={setSchedule} />;
3526
+ * };
3527
+ * ```
3411
3528
  * @param {ScheduleProps} props - The props for the Schedule component
3412
3529
  * @returns {ReactElement} Schedule component
3413
3530
  */
@@ -3597,9 +3714,44 @@ const cvaSearch = cvaMerge([
3597
3714
  });
3598
3715
 
3599
3716
  /**
3600
- * The Search component is used to render a search input field.
3717
+ * Search renders a styled search input with a magnifying glass icon, an optional loading spinner,
3718
+ * and a clear button that appears when a value is present. It supports visual variants such as
3719
+ * widening on focus and hiding the border when not focused.
3720
+ *
3721
+ * ### When to use
3722
+ * Use Search for filtering or querying data sets — for example, a search box above a table or list to narrow down results.
3723
+ *
3724
+ * ### When not to use
3725
+ * Do not use Search for multi-filter scenarios — use `FilterBar`.
3726
+ * Do not use it as a general text input — use `TextField`.
3727
+ *
3728
+ * @example Basic search input with change handler
3729
+ * ```tsx
3730
+ * import { Search } from "@trackunit/react-form-components";
3731
+ * import { useState, ChangeEvent } from "react";
3732
+ *
3733
+ * const AssetSearch = () => {
3734
+ * const [query, setQuery] = useState("");
3735
+ * return (
3736
+ * <Search
3737
+ * value={query}
3738
+ * onChange={(e: ChangeEvent<HTMLInputElement>) => setQuery(e.target.value)}
3739
+ * onClear={() => setQuery("")}
3740
+ * placeholder="Search assets..."
3741
+ * />
3742
+ * );
3743
+ * };
3744
+ * ```
3745
+ * @example Compact search that widens on focus
3746
+ * ```tsx
3747
+ * import { Search } from "@trackunit/react-form-components";
3601
3748
  *
3749
+ * const CompactSearch = () => (
3750
+ * <Search widenInputOnFocus hideBorderWhenNotInFocus placeholder="Search..." />
3751
+ * );
3752
+ * ```
3602
3753
  * @param {SearchProps} props - The props for the Search component
3754
+ * @returns {ReactElement} Search component
3603
3755
  */
3604
3756
  const Search = ({ className, placeholder, value, widenInputOnFocus = false, hideBorderWhenNotInFocus = false, disabled = false, onKeyUp, onChange, onFocus, onBlur, name, onClear, "data-testid": dataTestId, autoComplete = "on", loading = false, inputClassName, iconName = "MagnifyingGlass", style, ref, fieldSize = "medium", id, ...rest }) => {
3605
3757
  const { t } = useTranslation();
@@ -3922,8 +4074,41 @@ const TextField = ({ id, label, tip, helpText, helpAddon, errorMessage, isInvali
3922
4074
  TextField.displayName = "TextField";
3923
4075
 
3924
4076
  /**
3925
- * TimeRangeField Description. <-- Please add a proper Description this is used in Storybook.
4077
+ * TimeRangeField is a form-ready time range input that wraps a `TimeRange` selector inside a `FormGroup`.
4078
+ * It provides a labeled pair of start/end time inputs with support for tooltips, help text, and validation error messages.
4079
+ *
4080
+ * ### When to use
4081
+ * Use TimeRangeField when you need a labeled time range input inside a form — for example, selecting working hours, shift times, or scheduling windows.
4082
+ *
4083
+ * ### When not to use
4084
+ * Do not use TimeRangeField for date ranges — use `DayRangePicker`.
4085
+ * Do not use it outside a form context where you only need a bare time range input — use `TimeRange` directly instead.
3926
4086
  *
4087
+ * @example Basic time range field with a label
4088
+ * ```tsx
4089
+ * import { TimeRangeField } from "@trackunit/react-form-components";
4090
+ *
4091
+ * const ShiftTimeInput = () => (
4092
+ * <TimeRangeField
4093
+ * label="Shift hours"
4094
+ * range={{ timeFrom: "08:00", timeTo: "16:00" }}
4095
+ * onChange={(range) => console.log(range)}
4096
+ * />
4097
+ * );
4098
+ * ```
4099
+ * @example Time range field with validation error
4100
+ * ```tsx
4101
+ * import { TimeRangeField } from "@trackunit/react-form-components";
4102
+ *
4103
+ * const ValidatedShiftInput = () => (
4104
+ * <TimeRangeField
4105
+ * label="Working hours"
4106
+ * range={{ timeFrom: "18:00", timeTo: "06:00" }}
4107
+ * errorMessage="End time must be after start time."
4108
+ * onChange={(range) => console.log(range)}
4109
+ * />
4110
+ * );
4111
+ * ```
3927
4112
  * @param {TimeRangeFieldProps} props - The props for the TimeRangeField component
3928
4113
  * @returns {ReactElement} TimeRangeField component
3929
4114
  */
@@ -4188,9 +4373,30 @@ const cvaUploadInputField = cvaMerge([
4188
4373
  ]);
4189
4374
 
4190
4375
  /**
4191
- * A thin wrapper around the `BaseInput` component for upload input fields.
4376
+ * UploadInput renders a file upload input with a styled button label. It wraps `BaseInput` with `type="file"`
4377
+ * and supports restricting file types, enabling multi-file selection, and disabling interaction.
4378
+ *
4379
+ * **Note:** If you need a label, help text, or validation wrapping, use `UploadField` instead.
4192
4380
  *
4193
- * NOTE: If shown with a label, please use the `UploadField` component instead.
4381
+ * ### When to use
4382
+ * Use UploadInput for bare file upload inputs inside custom layouts or composed form components.
4383
+ *
4384
+ * ### When not to use
4385
+ * Do not use UploadInput in standard forms — use `UploadField` which adds `FormGroup` wrapping with label and validation.
4386
+ *
4387
+ * @example File upload with accepted types
4388
+ * ```tsx
4389
+ * import { UploadInput } from "@trackunit/react-form-components";
4390
+ *
4391
+ * const DocumentUpload = () => (
4392
+ * <UploadInput
4393
+ * uploadLabel="Choose file"
4394
+ * acceptedTypes=".pdf,.docx"
4395
+ * onChange={(e) => console.log(e.target.files)}
4396
+ * />
4397
+ * );
4398
+ * ```
4399
+ * @param {UploadInputProps} props - The props for the UploadInput component
4194
4400
  */
4195
4401
  const UploadInput = ({ disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles, ref, ...rest }) => (jsx("label", { className: "tu-upload-input", children: jsx(BaseInput, { accept: acceptedTypes, addonBefore: uploadLabel, disabled: disabled, inputClassName: cvaUploadInputField(), multiple: multipleFiles, onClick: event => {
4196
4402
  // onClick used to work with nonInteractive option
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-components",
3
- "version": "1.14.25",
3
+ "version": "1.14.27",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -15,7 +15,7 @@
15
15
  "react-hook-form": "7.62.0",
16
16
  "tailwind-merge": "^2.0.0",
17
17
  "@trackunit/css-class-variance-utilities": "1.11.43",
18
- "@trackunit/react-components": "1.17.22",
18
+ "@trackunit/react-components": "1.17.24",
19
19
  "@trackunit/ui-icons": "1.11.42",
20
20
  "@trackunit/shared-utils": "1.13.43",
21
21
  "@trackunit/ui-design-tokens": "1.11.43",
@@ -3,16 +3,45 @@ import { CheckboxProps } from "../Checkbox/Checkbox";
3
3
  import { FormGroupProps } from "../FormGroup/FormGroup";
4
4
  type FormGroupExposedProps = Pick<FormGroupProps, "tip" | "helpText" | "helpAddon">;
5
5
  export interface CheckboxFieldProps extends CheckboxProps, FormGroupExposedProps {
6
+ /**
7
+ * Text or ReactNode displayed next to the checkbox. This is the clickable label for the checkbox itself
8
+ * (distinct from the `label` prop which labels the overall form group).
9
+ */
6
10
  checkboxLabel?: string | ReactNode;
7
11
  /**
8
- * A ref for the component
12
+ * A ref for the component.
9
13
  */
10
14
  ref?: Ref<HTMLInputElement>;
11
15
  }
12
16
  /**
13
- * The checkbox field component is used for entering boolean values.
17
+ * CheckboxField is a form-ready checkbox that wraps a `Checkbox` inside a `FormGroup`.
18
+ * It provides a labeled checkbox with support for tooltips, help text, validation, and form group styling.
19
+ *
20
+ * ### When to use
21
+ * Use CheckboxField for boolean inputs inside forms — for example, "I agree to terms" or toggling a feature on/off.
22
+ *
23
+ * ### When not to use
24
+ * Do not use CheckboxField for multi-select lists — use checkbox filters or a select component.
25
+ * For a standalone checkbox without form group wrapping, use `Checkbox` directly.
26
+ *
27
+ * @example Checkbox field in a form
28
+ * ```tsx
29
+ * import { CheckboxField } from "@trackunit/react-form-components";
30
+ * import { useState } from "react";
14
31
  *
15
- * _**Do use**_ the CheckboxField for boolean input.
32
+ * const TermsCheckbox = () => {
33
+ * const [accepted, setAccepted] = useState(false);
34
+ * return (
35
+ * <CheckboxField
36
+ * label="Terms and Conditions"
37
+ * checkboxLabel="I accept the terms"
38
+ * checked={accepted}
39
+ * onChange={() => setAccepted(!accepted)}
40
+ * />
41
+ * );
42
+ * };
43
+ * ```
44
+ * @param {CheckboxFieldProps} props - The props for the CheckboxField component
16
45
  */
17
46
  export declare const CheckboxField: {
18
47
  ({ label, id, tip, helpText, helpAddon, isInvalid, className, checked, "data-testid": dataTestId, checkboxLabel, onChange, ref, ...rest }: CheckboxFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -9,6 +9,9 @@ export interface FormGroupProps extends CommonProps, Refable<HTMLDivElement> {
9
9
  * Content to display in the tooltip when hovering the ? icon next to the label.
10
10
  */
11
11
  tip?: string | ReactNode;
12
+ /**
13
+ * The `id` of the input element this form group labels. Used to associate the `<label>` with the input via `for` attribute.
14
+ */
12
15
  htmlFor?: string;
13
16
  /**
14
17
  * A string to display under the input element to help the user understand the input.
@@ -23,7 +26,13 @@ export interface FormGroupProps extends CommonProps, Refable<HTMLDivElement> {
23
26
  * If true the input is rendered in its invalid state.
24
27
  */
25
28
  isInvalid?: boolean;
29
+ /**
30
+ * The input or field element to render inside the form group, below the label and above the help text.
31
+ */
26
32
  children?: ReactNode;
33
+ /**
34
+ * The name of the form field. Passed through to child input components for form submission.
35
+ */
27
36
  name?: string;
28
37
  /**
29
38
  * If true the input is required with an asterisk prepended to the label.
@@ -36,9 +45,27 @@ export interface FormGroupProps extends CommonProps, Refable<HTMLDivElement> {
36
45
  isWarning?: boolean;
37
46
  }
38
47
  /**
39
- * The FormGroup component should be used to wrap any Input element that needs a label.
40
- * Besides a label the component supplies an optional Tooltip, HelpText and HelpAddon support.
48
+ * FormGroup wraps an input element with a label, optional tooltip, help text, and validation styling.
49
+ * It provides consistent form field layout and is used internally by all Field components
50
+ * (`TextField`, `CheckboxField`, `TimeRangeField`, etc.).
51
+ *
52
+ * ### When to use
53
+ * Use FormGroup when building a custom field component that needs a label, tooltip, or help text.
54
+ *
55
+ * ### When not to use
56
+ * Do not use FormGroup directly for standard inputs — use the corresponding Field component
57
+ * (e.g., `TextField`, `CheckboxField`) which already wraps FormGroup.
58
+ *
59
+ * @example Custom field with label, tooltip, and help text
60
+ * ```tsx
61
+ * import { FormGroup } from "@trackunit/react-form-components";
41
62
  *
63
+ * const CustomColorField = () => (
64
+ * <FormGroup label="Brand color" tip="Used across the dashboard" helpText="Enter a hex color code">
65
+ * <input type="color" />
66
+ * </FormGroup>
67
+ * );
68
+ * ```
42
69
  * @param {FormGroupProps} props - The props for the FormGroup component
43
70
  * @returns {ReactElement} FormGroup component
44
71
  */
@@ -24,8 +24,16 @@ export interface LabelProps extends CommonProps, Refable<HTMLLabelElement> {
24
24
  isInvalid?: boolean;
25
25
  }
26
26
  /**
27
- * The Label component is used for labels for input fields.
28
- * This component is **not used directly**, but is part of the FormGroup and Field components.
27
+ * Label renders a styled `<label>` element for form input fields.
28
+ * This component is typically **not used directly** it is rendered internally by `FormGroup` and
29
+ * all Field components (e.g., `TextField`, `CheckboxField`, `TimeRangeField`). Use it only when
30
+ * building a custom form group layout that cannot use `FormGroup`.
31
+ *
32
+ * ### When to use
33
+ * Use Label only when constructing a custom form field wrapper that cannot use `FormGroup`.
34
+ *
35
+ * ### When not to use
36
+ * Do not use Label directly for standard form fields — use the appropriate Field component (e.g., `TextField`, `CheckboxField`) which includes Label automatically.
29
37
  *
30
38
  * @param {LabelProps} props - The props for the Label component
31
39
  * @returns {ReactElement} Label component
@@ -20,8 +20,33 @@ export interface PhoneFieldWithControllerProps extends PhoneFieldProps {
20
20
  ref?: Ref<HTMLInputElement>;
21
21
  }
22
22
  /**
23
- * The PhoneFieldWithController component is a wrapper for the PhoneField component to connect it to react-hook-form.
23
+ * PhoneFieldWithController wraps `PhoneField` with a `react-hook-form` `Controller`,
24
+ * connecting the phone number input to form state management. It handles value synchronization,
25
+ * validation integration, and default value assignment automatically.
24
26
  *
27
+ * ### When to use
28
+ * Use PhoneFieldWithController when you have a phone number field inside a `react-hook-form` managed form.
29
+ *
30
+ * ### When not to use
31
+ * Do not use PhoneFieldWithController outside of `react-hook-form` — use `PhoneField` directly.
32
+ *
33
+ * @example Phone field in a react-hook-form
34
+ * ```tsx
35
+ * import { PhoneFieldWithController } from "@trackunit/react-form-components";
36
+ * import { useForm } from "react-hook-form";
37
+ *
38
+ * const ContactForm = () => {
39
+ * const { control } = useForm();
40
+ * return (
41
+ * <PhoneFieldWithController
42
+ * control={control}
43
+ * name="phone"
44
+ * label="Phone number"
45
+ * />
46
+ * );
47
+ * };
48
+ * ```
49
+ * @param {PhoneFieldWithControllerProps} props - The props for the PhoneFieldWithController component
25
50
  */
26
51
  export declare const PhoneFieldWithController: {
27
52
  ({ control, controllerProps, name, value, ref, ...rest }: PhoneFieldWithControllerProps): import("react/jsx-runtime").JSX.Element;
@@ -44,8 +44,31 @@ export interface ScheduleProps extends CommonProps, Refable<HTMLDivElement> {
44
44
  onChange: (schedules: Array<ScheduleItem>) => void;
45
45
  }
46
46
  /**
47
- * Schedule is used to create a time range entries.
47
+ * Schedule renders a weekly time-range editor where each row represents a day with an active toggle,
48
+ * an optional all-day checkbox, and a start/end time range. It is used for defining recurring schedules
49
+ * such as operating hours, service windows, or geofence active periods.
48
50
  *
51
+ * ### When to use
52
+ * Use Schedule when users need to configure per-day time ranges — for example, setting working hours for each day of the week.
53
+ *
54
+ * ### When not to use
55
+ * Do not use Schedule for a single time range — use `TimeRangeField`.
56
+ * Do not use it for date range selection — use `DayRangePicker`.
57
+ *
58
+ * @example Weekly operating hours schedule
59
+ * ```tsx
60
+ * import { Schedule, ScheduleItem } from "@trackunit/react-form-components";
61
+ * import { useState } from "react";
62
+ *
63
+ * const OperatingHours = () => {
64
+ * const [schedule, setSchedule] = useState<Array<ScheduleItem>>([
65
+ * { key: "mon", label: "Monday", isActive: true, range: { timeFrom: "08:00", timeTo: "17:00" } },
66
+ * { key: "tue", label: "Tuesday", isActive: true, range: { timeFrom: "08:00", timeTo: "17:00" } },
67
+ * { key: "wed", label: "Wednesday", isActive: false, range: { timeFrom: "", timeTo: "" } },
68
+ * ]);
69
+ * return <Schedule schedule={schedule} onChange={setSchedule} />;
70
+ * };
71
+ * ```
49
72
  * @param {ScheduleProps} props - The props for the Schedule component
50
73
  * @returns {ReactElement} Schedule component
51
74
  */
@@ -68,12 +68,50 @@ export interface SearchProps extends CommonProps, TextBaseInputProps {
68
68
  * A custom icon to be displayed in the search box.
69
69
  */
70
70
  iconName?: IconName;
71
+ /**
72
+ * Inline CSS styles applied to the root search container element.
73
+ */
71
74
  style?: CSSProperties;
72
75
  }
73
76
  /**
74
- * The Search component is used to render a search input field.
77
+ * Search renders a styled search input with a magnifying glass icon, an optional loading spinner,
78
+ * and a clear button that appears when a value is present. It supports visual variants such as
79
+ * widening on focus and hiding the border when not focused.
80
+ *
81
+ * ### When to use
82
+ * Use Search for filtering or querying data sets — for example, a search box above a table or list to narrow down results.
83
+ *
84
+ * ### When not to use
85
+ * Do not use Search for multi-filter scenarios — use `FilterBar`.
86
+ * Do not use it as a general text input — use `TextField`.
87
+ *
88
+ * @example Basic search input with change handler
89
+ * ```tsx
90
+ * import { Search } from "@trackunit/react-form-components";
91
+ * import { useState, ChangeEvent } from "react";
92
+ *
93
+ * const AssetSearch = () => {
94
+ * const [query, setQuery] = useState("");
95
+ * return (
96
+ * <Search
97
+ * value={query}
98
+ * onChange={(e: ChangeEvent<HTMLInputElement>) => setQuery(e.target.value)}
99
+ * onClear={() => setQuery("")}
100
+ * placeholder="Search assets..."
101
+ * />
102
+ * );
103
+ * };
104
+ * ```
105
+ * @example Compact search that widens on focus
106
+ * ```tsx
107
+ * import { Search } from "@trackunit/react-form-components";
75
108
  *
109
+ * const CompactSearch = () => (
110
+ * <Search widenInputOnFocus hideBorderWhenNotInFocus placeholder="Search..." />
111
+ * );
112
+ * ```
76
113
  * @param {SearchProps} props - The props for the Search component
114
+ * @returns {ReactElement} Search component
77
115
  */
78
116
  export declare const Search: {
79
117
  ({ className, placeholder, value, widenInputOnFocus, hideBorderWhenNotInFocus, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, "data-testid": dataTestId, autoComplete, loading, inputClassName, iconName, style, ref, fieldSize, id, ...rest }: SearchProps): ReactElement;
@@ -44,8 +44,26 @@ export interface TimeRangeProps extends CommonProps, Refable<HTMLDivElement> {
44
44
  onChange: (range: TimeRangeInput) => void;
45
45
  }
46
46
  /**
47
- * TimeRange is used to create a time range entry.
47
+ * TimeRange renders a pair of native `<input type="time">` fields for selecting a start and end time.
48
+ * It provides a controlled time range with `onChange` callback and supports custom separators, disabled state, and validation styling.
48
49
  *
50
+ * ### When to use
51
+ * Use TimeRange for bare time range inputs inside custom layouts or composed components (e.g., inside Schedule rows).
52
+ *
53
+ * ### When not to use
54
+ * Do not use TimeRange directly in forms that need a label, help text, or validation — use `TimeRangeField` instead.
55
+ *
56
+ * @example Basic time range input
57
+ * ```tsx
58
+ * import { TimeRange } from "@trackunit/react-form-components";
59
+ *
60
+ * const ShiftPicker = () => (
61
+ * <TimeRange
62
+ * range={{ timeFrom: "09:00", timeTo: "17:00" }}
63
+ * onChange={(range) => console.log(range)}
64
+ * />
65
+ * );
66
+ * ```
49
67
  * @param {TimeRangeProps} props - The props for the TimeRange component
50
68
  * @returns {ReactElement} TimeRange component
51
69
  */
@@ -9,8 +9,41 @@ export interface TimeRangeFieldProps extends TimeRangeProps, FormGroupExposedPro
9
9
  errorMessage?: string;
10
10
  }
11
11
  /**
12
- * TimeRangeField Description. <-- Please add a proper Description this is used in Storybook.
12
+ * TimeRangeField is a form-ready time range input that wraps a `TimeRange` selector inside a `FormGroup`.
13
+ * It provides a labeled pair of start/end time inputs with support for tooltips, help text, and validation error messages.
13
14
  *
15
+ * ### When to use
16
+ * Use TimeRangeField when you need a labeled time range input inside a form — for example, selecting working hours, shift times, or scheduling windows.
17
+ *
18
+ * ### When not to use
19
+ * Do not use TimeRangeField for date ranges — use `DayRangePicker`.
20
+ * Do not use it outside a form context where you only need a bare time range input — use `TimeRange` directly instead.
21
+ *
22
+ * @example Basic time range field with a label
23
+ * ```tsx
24
+ * import { TimeRangeField } from "@trackunit/react-form-components";
25
+ *
26
+ * const ShiftTimeInput = () => (
27
+ * <TimeRangeField
28
+ * label="Shift hours"
29
+ * range={{ timeFrom: "08:00", timeTo: "16:00" }}
30
+ * onChange={(range) => console.log(range)}
31
+ * />
32
+ * );
33
+ * ```
34
+ * @example Time range field with validation error
35
+ * ```tsx
36
+ * import { TimeRangeField } from "@trackunit/react-form-components";
37
+ *
38
+ * const ValidatedShiftInput = () => (
39
+ * <TimeRangeField
40
+ * label="Working hours"
41
+ * range={{ timeFrom: "18:00", timeTo: "06:00" }}
42
+ * errorMessage="End time must be after start time."
43
+ * onChange={(range) => console.log(range)}
44
+ * />
45
+ * );
46
+ * ```
14
47
  * @param {TimeRangeFieldProps} props - The props for the TimeRangeField component
15
48
  * @returns {ReactElement} TimeRangeField component
16
49
  */
@@ -24,9 +24,30 @@ export interface UploadInputProps extends BaseInputExposedProps, CommonProps {
24
24
  nonInteractive?: boolean;
25
25
  }
26
26
  /**
27
- * A thin wrapper around the `BaseInput` component for upload input fields.
27
+ * UploadInput renders a file upload input with a styled button label. It wraps `BaseInput` with `type="file"`
28
+ * and supports restricting file types, enabling multi-file selection, and disabling interaction.
28
29
  *
29
- * NOTE: If shown with a label, please use the `UploadField` component instead.
30
+ * **Note:** If you need a label, help text, or validation wrapping, use `UploadField` instead.
31
+ *
32
+ * ### When to use
33
+ * Use UploadInput for bare file upload inputs inside custom layouts or composed form components.
34
+ *
35
+ * ### When not to use
36
+ * Do not use UploadInput in standard forms — use `UploadField` which adds `FormGroup` wrapping with label and validation.
37
+ *
38
+ * @example File upload with accepted types
39
+ * ```tsx
40
+ * import { UploadInput } from "@trackunit/react-form-components";
41
+ *
42
+ * const DocumentUpload = () => (
43
+ * <UploadInput
44
+ * uploadLabel="Choose file"
45
+ * acceptedTypes=".pdf,.docx"
46
+ * onChange={(e) => console.log(e.target.files)}
47
+ * />
48
+ * );
49
+ * ```
50
+ * @param {UploadInputProps} props - The props for the UploadInput component
30
51
  */
31
52
  export declare const UploadInput: {
32
53
  ({ disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles, ref, ...rest }: UploadInputProps): import("react/jsx-runtime").JSX.Element;