@arkyn/components 3.0.1-beta.143 → 3.0.1-beta.145

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/components/alert/alertContainer/index.d.ts +27 -43
  3. package/dist/components/alert/alertContainer/index.d.ts.map +1 -1
  4. package/dist/components/alert/alertContainer/index.js +20 -40
  5. package/dist/components/alert/alertContent/index.d.ts +11 -36
  6. package/dist/components/alert/alertContent/index.d.ts.map +1 -1
  7. package/dist/components/alert/alertContent/index.js +11 -31
  8. package/dist/components/alert/alertDescription/index.d.ts +10 -38
  9. package/dist/components/alert/alertDescription/index.d.ts.map +1 -1
  10. package/dist/components/alert/alertDescription/index.js +10 -33
  11. package/dist/components/alert/alertIcon/index.d.ts +14 -38
  12. package/dist/components/alert/alertIcon/index.d.ts.map +1 -1
  13. package/dist/components/alert/alertIcon/index.js +14 -32
  14. package/dist/components/alert/alertTitle/index.d.ts +12 -35
  15. package/dist/components/alert/alertTitle/index.d.ts.map +1 -1
  16. package/dist/components/alert/alertTitle/index.js +12 -27
  17. package/dist/components/audioPlayer/index.d.ts +24 -32
  18. package/dist/components/audioPlayer/index.d.ts.map +1 -1
  19. package/dist/components/audioPlayer/index.js +15 -18
  20. package/dist/components/audioUpload/index.d.ts +37 -48
  21. package/dist/components/audioUpload/index.d.ts.map +1 -1
  22. package/dist/components/audioUpload/index.js +23 -48
  23. package/dist/components/badge/index.d.ts +31 -22
  24. package/dist/components/badge/index.d.ts.map +1 -1
  25. package/dist/components/badge/index.js +14 -22
  26. package/dist/components/button/index.d.ts +38 -28
  27. package/dist/components/button/index.d.ts.map +1 -1
  28. package/dist/components/button/index.js +18 -28
  29. package/dist/components/cardTab/cardTabButton/index.d.ts +14 -52
  30. package/dist/components/cardTab/cardTabButton/index.d.ts.map +1 -1
  31. package/dist/components/cardTab/cardTabButton/index.js +12 -52
  32. package/dist/components/cardTab/cardTabContainer/index.d.ts +16 -58
  33. package/dist/components/cardTab/cardTabContainer/index.d.ts.map +1 -1
  34. package/dist/components/cardTab/cardTabContainer/index.js +12 -58
  35. package/dist/components/checkbox/index.d.ts +38 -37
  36. package/dist/components/checkbox/index.d.ts.map +1 -1
  37. package/dist/components/checkbox/index.js +21 -37
  38. package/dist/components/clientOnly.d.ts +13 -66
  39. package/dist/components/clientOnly.d.ts.map +1 -1
  40. package/dist/components/clientOnly.js +11 -66
  41. package/dist/components/currencyInput/index.d.ts +67 -50
  42. package/dist/components/currencyInput/index.d.ts.map +1 -1
  43. package/dist/components/currencyInput/index.js +28 -50
  44. package/dist/components/divider/index.d.ts +12 -25
  45. package/dist/components/divider/index.d.ts.map +1 -1
  46. package/dist/components/divider/index.js +8 -25
  47. package/dist/components/drawer/drawerContainer/index.d.ts +16 -50
  48. package/dist/components/drawer/drawerContainer/index.d.ts.map +1 -1
  49. package/dist/components/drawer/drawerContainer/index.js +13 -50
  50. package/dist/components/drawer/drawerHeader/index.d.ts +9 -33
  51. package/dist/components/drawer/drawerHeader/index.d.ts.map +1 -1
  52. package/dist/components/drawer/drawerHeader/index.js +8 -33
  53. package/dist/components/facebookPixel/index.d.ts +47 -0
  54. package/dist/components/facebookPixel/index.d.ts.map +1 -1
  55. package/dist/components/facebookPixel/index.js +35 -0
  56. package/dist/components/fieldError/index.d.ts +4 -11
  57. package/dist/components/fieldError/index.d.ts.map +1 -1
  58. package/dist/components/fieldError/index.js +4 -11
  59. package/dist/components/fieldLabel/index.d.ts +6 -21
  60. package/dist/components/fieldLabel/index.d.ts.map +1 -1
  61. package/dist/components/fieldLabel/index.js +5 -21
  62. package/dist/components/fieldWrapper/index.d.ts +12 -22
  63. package/dist/components/fieldWrapper/index.d.ts.map +1 -1
  64. package/dist/components/fieldWrapper/index.js +7 -22
  65. package/dist/components/fileUpload/index.d.ts +36 -61
  66. package/dist/components/fileUpload/index.d.ts.map +1 -1
  67. package/dist/components/fileUpload/index.js +23 -61
  68. package/dist/components/googleAnalytics/index.d.ts +11 -7
  69. package/dist/components/googleAnalytics/index.d.ts.map +1 -1
  70. package/dist/components/googleAnalytics/index.js +9 -7
  71. package/dist/components/googleTagManager/index.d.ts +27 -21
  72. package/dist/components/googleTagManager/index.d.ts.map +1 -1
  73. package/dist/components/googleTagManager/index.js +20 -21
  74. package/dist/components/iconButton/index.d.ts +31 -15
  75. package/dist/components/iconButton/index.d.ts.map +1 -1
  76. package/dist/components/iconButton/index.js +12 -15
  77. package/dist/components/imageUpload/index.d.ts +47 -75
  78. package/dist/components/imageUpload/index.d.ts.map +1 -1
  79. package/dist/components/imageUpload/index.js +27 -75
  80. package/dist/components/input/index.d.ts +51 -44
  81. package/dist/components/input/index.d.ts.map +1 -1
  82. package/dist/components/input/index.js +24 -44
  83. package/dist/components/mapView/index.d.ts +44 -0
  84. package/dist/components/mapView/index.d.ts.map +1 -1
  85. package/dist/components/mapView/index.js +35 -0
  86. package/dist/components/maskedInput/index.d.ts +66 -51
  87. package/dist/components/maskedInput/index.d.ts.map +1 -1
  88. package/dist/components/maskedInput/index.js +28 -51
  89. package/dist/components/modal/modalContainer/index.d.ts +17 -57
  90. package/dist/components/modal/modalContainer/index.d.ts.map +1 -1
  91. package/dist/components/modal/modalContainer/index.js +15 -57
  92. package/dist/components/modal/modalFooter/index.d.ts +17 -50
  93. package/dist/components/modal/modalFooter/index.d.ts.map +1 -1
  94. package/dist/components/modal/modalFooter/index.js +10 -50
  95. package/dist/components/modal/modalHeader/index.d.ts +13 -47
  96. package/dist/components/modal/modalHeader/index.d.ts.map +1 -1
  97. package/dist/components/modal/modalHeader/index.js +12 -47
  98. package/dist/components/multiSelect/index.d.ts +67 -62
  99. package/dist/components/multiSelect/index.d.ts.map +1 -1
  100. package/dist/components/multiSelect/index.js +28 -62
  101. package/dist/components/pagination/index.d.ts +18 -9
  102. package/dist/components/pagination/index.d.ts.map +1 -1
  103. package/dist/components/pagination/index.js +18 -9
  104. package/dist/components/phoneInput/index.d.ts +65 -30
  105. package/dist/components/phoneInput/index.d.ts.map +1 -1
  106. package/dist/components/phoneInput/index.js +36 -31
  107. package/dist/components/popover/index.d.ts +34 -114
  108. package/dist/components/popover/index.d.ts.map +1 -1
  109. package/dist/components/popover/index.js +25 -114
  110. package/dist/components/radio/radioBox/index.d.ts +17 -65
  111. package/dist/components/radio/radioBox/index.d.ts.map +1 -1
  112. package/dist/components/radio/radioBox/index.js +14 -65
  113. package/dist/components/radio/radioGroup/index.d.ts +36 -67
  114. package/dist/components/radio/radioGroup/index.d.ts.map +1 -1
  115. package/dist/components/radio/radioGroup/index.js +25 -67
  116. package/dist/components/richText/index.d.ts +33 -47
  117. package/dist/components/richText/index.d.ts.map +1 -1
  118. package/dist/components/richText/index.js +30 -44
  119. package/dist/components/searchPlaces.d.ts +52 -50
  120. package/dist/components/searchPlaces.d.ts.map +1 -1
  121. package/dist/components/searchPlaces.js +23 -30
  122. package/dist/components/select/index.d.ts +68 -63
  123. package/dist/components/select/index.d.ts.map +1 -1
  124. package/dist/components/select/index.js +29 -63
  125. package/dist/components/slider/index.d.ts +20 -34
  126. package/dist/components/slider/index.d.ts.map +1 -1
  127. package/dist/components/slider/index.js +15 -33
  128. package/dist/components/switch/index.d.ts +42 -58
  129. package/dist/components/switch/index.d.ts.map +1 -1
  130. package/dist/components/switch/index.js +24 -58
  131. package/dist/components/tab/tabButton/index.d.ts +14 -52
  132. package/dist/components/tab/tabButton/index.d.ts.map +1 -1
  133. package/dist/components/tab/tabButton/index.js +12 -52
  134. package/dist/components/tab/tabContainer/index.d.ts +16 -58
  135. package/dist/components/tab/tabContainer/index.d.ts.map +1 -1
  136. package/dist/components/tab/tabContainer/index.js +12 -58
  137. package/dist/components/table/tableBody/index.d.ts +13 -47
  138. package/dist/components/table/tableBody/index.d.ts.map +1 -1
  139. package/dist/components/table/tableBody/index.js +12 -47
  140. package/dist/components/table/tableCaption/index.d.ts +6 -46
  141. package/dist/components/table/tableCaption/index.d.ts.map +1 -1
  142. package/dist/components/table/tableCaption/index.js +6 -46
  143. package/dist/components/table/tableContainer/index.d.ts +12 -41
  144. package/dist/components/table/tableContainer/index.d.ts.map +1 -1
  145. package/dist/components/table/tableContainer/index.js +12 -41
  146. package/dist/components/table/tableFooter/index.d.ts +5 -29
  147. package/dist/components/table/tableFooter/index.d.ts.map +1 -1
  148. package/dist/components/table/tableFooter/index.js +5 -29
  149. package/dist/components/table/tableHeader/index.d.ts +4 -25
  150. package/dist/components/table/tableHeader/index.d.ts.map +1 -1
  151. package/dist/components/table/tableHeader/index.js +4 -25
  152. package/dist/components/textarea/index.d.ts +32 -64
  153. package/dist/components/textarea/index.d.ts.map +1 -1
  154. package/dist/components/textarea/index.js +16 -64
  155. package/dist/components/tooltip/index.d.ts +27 -55
  156. package/dist/components/tooltip/index.d.ts.map +1 -1
  157. package/dist/components/tooltip/index.js +16 -55
  158. package/dist/hooks/useAutomation.d.ts +18 -26
  159. package/dist/hooks/useAutomation.d.ts.map +1 -1
  160. package/dist/hooks/useAutomation.js +18 -26
  161. package/dist/hooks/useDrawer.d.ts +19 -64
  162. package/dist/hooks/useDrawer.d.ts.map +1 -1
  163. package/dist/hooks/useForm.d.ts +12 -29
  164. package/dist/hooks/useForm.d.ts.map +1 -1
  165. package/dist/hooks/useForm.js +12 -29
  166. package/dist/hooks/useHydrated.d.ts +8 -63
  167. package/dist/hooks/useHydrated.d.ts.map +1 -1
  168. package/dist/hooks/useHydrated.js +8 -63
  169. package/dist/hooks/useModal.d.ts +19 -59
  170. package/dist/hooks/useModal.d.ts.map +1 -1
  171. package/dist/hooks/useScopedParams.d.ts +17 -69
  172. package/dist/hooks/useScopedParams.d.ts.map +1 -1
  173. package/dist/hooks/useScopedParams.js +17 -69
  174. package/dist/hooks/useScrollLock.d.ts +11 -27
  175. package/dist/hooks/useScrollLock.d.ts.map +1 -1
  176. package/dist/hooks/useScrollLock.js +11 -33
  177. package/dist/hooks/useSearchAutomation.d.ts +16 -34
  178. package/dist/hooks/useSearchAutomation.d.ts.map +1 -1
  179. package/dist/hooks/useSearchAutomation.js +16 -34
  180. package/dist/hooks/useSlider.d.ts +5 -19
  181. package/dist/hooks/useSlider.d.ts.map +1 -1
  182. package/dist/hooks/useSlider.js +5 -19
  183. package/dist/hooks/useToast.d.ts +8 -52
  184. package/dist/hooks/useToast.d.ts.map +1 -1
  185. package/dist/hooks/useToast.js +8 -52
  186. package/dist/providers/drawerProvider.d.ts +15 -81
  187. package/dist/providers/drawerProvider.d.ts.map +1 -1
  188. package/dist/providers/drawerProvider.js +15 -81
  189. package/dist/providers/formProvider.d.ts +17 -53
  190. package/dist/providers/formProvider.d.ts.map +1 -1
  191. package/dist/providers/formProvider.js +17 -53
  192. package/dist/providers/modalProvider.d.ts +16 -77
  193. package/dist/providers/modalProvider.d.ts.map +1 -1
  194. package/dist/providers/modalProvider.js +16 -77
  195. package/dist/providers/placesProvider.d.ts +16 -11
  196. package/dist/providers/placesProvider.d.ts.map +1 -1
  197. package/dist/providers/placesProvider.js +16 -11
  198. package/dist/providers/toastProvider.d.ts +10 -21
  199. package/dist/providers/toastProvider.d.ts.map +1 -1
  200. package/dist/providers/toastProvider.js +10 -21
  201. package/dist/services/toHtml.d.ts +11 -10
  202. package/dist/services/toHtml.d.ts.map +1 -1
  203. package/dist/services/toHtml.js +11 -10
  204. package/dist/services/toRichTextValue.d.ts +11 -17
  205. package/dist/services/toRichTextValue.d.ts.map +1 -1
  206. package/dist/services/toRichTextValue.js +11 -17
  207. package/package.json +1 -1
@@ -1,55 +1,41 @@
1
1
  import { HTMLAttributes } from "react";
2
2
  import "./styles.css";
3
3
  type SliderProps = Omit<HTMLAttributes<HTMLDivElement>, "onChange"> & {
4
+ /** Current slider position as a percentage (0–100). Required. */
4
5
  value: number;
6
+ /** Callback fired whenever the value changes. Required. */
5
7
  onChange: (value: number) => void;
8
+ /** Disables all drag and click interactions. @default false */
6
9
  disabled?: boolean;
7
- onDragging?: (value: boolean) => void;
10
+ /** Callback fired when the dragging state changes (`true` = drag started, `false` = drag ended). */
11
+ onDragging?: (isDragging: boolean) => void;
8
12
  };
9
13
  /**
10
- * Slider component - interactive range input for selecting numeric values
14
+ * Slider interactive track for selecting a numeric value between 0 and 100.
11
15
  *
12
- * @param props - Slider component properties
13
- * @param props.value - Current slider value (0-100)
14
- * @param props.onChange - Callback function called when value changes
15
- * @param props.disabled - Disables slider interaction. Default: false
16
- * @param props.onDragging - Callback function called when dragging state changes
16
+ * Pair with `useSlider` for managed state.
17
17
  *
18
- * **...Other valid HTML properties for div element**
18
+ * @param props.value - Current position as a percentage (0–100). Required.
19
+ * @param props.onChange - Callback fired on value change. Required.
20
+ * @param props.disabled - Disables interactions. Default: false
21
+ * @param props.onDragging - Callback fired when dragging starts or stops.
19
22
  *
20
- * @returns Slider JSX element
23
+ * **...Other valid HTML properties for `<div>`**
24
+ *
25
+ * @returns Slider JSX element.
21
26
  *
22
27
  * @example
23
28
  * ```tsx
24
- * // Basic slider
29
+ * // Controlled slider
25
30
  * const [value, setValue] = useState(50);
26
31
  * <Slider value={value} onChange={setValue} />
27
32
  *
28
- * // Disabled slider
29
- * <Slider value={75} onChange={() => {}} disabled />
30
- *
31
- * // Slider with dragging callback
32
- * const [isDragging, setIsDragging] = useState(false);
33
- * <Slider
34
- * value={value}
35
- * onChange={setValue}
36
- * onDragging={setIsDragging}
37
- * />
33
+ * // With useSlider hook
34
+ * const [value, setValue] = useSlider(25);
35
+ * <Slider value={value} onChange={setValue} onDragging={setIsDragging} />
38
36
  *
39
- * // Complete example with useSlider hook
40
- * function SliderExample() {
41
- * const [sliderValue, setSliderValue] = useSlider(25);
42
- * const [isDragging, setIsDragging] = useState(false);
43
- *
44
- * return (
45
- * <Slider
46
- * value={sliderValue}
47
- * onChange={setSliderValue}
48
- * onDragging={setIsDragging}
49
- * className="custom-slider"
50
- * />
51
- * );
52
- * }
37
+ * // Disabled
38
+ * <Slider value={75} onChange={() => {}} disabled />
53
39
  * ```
54
40
  */
55
41
  declare function Slider(props: SliderProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/slider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA+B,MAAM,OAAO,CAAC;AAEpE,OAAO,cAAc,CAAC;AAEtB,KAAK,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAAG;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CAuEjC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/slider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA+B,MAAM,OAAO,CAAC;AAEpE,OAAO,cAAc,CAAC;AAEtB,KAAK,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAAG;IACpE,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oGAAoG;IACpG,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CAuEjC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -2,49 +2,31 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from "react";
3
3
  import "./styles.css";
4
4
  /**
5
- * Slider component - interactive range input for selecting numeric values
5
+ * Slider interactive track for selecting a numeric value between 0 and 100.
6
6
  *
7
- * @param props - Slider component properties
8
- * @param props.value - Current slider value (0-100)
9
- * @param props.onChange - Callback function called when value changes
10
- * @param props.disabled - Disables slider interaction. Default: false
11
- * @param props.onDragging - Callback function called when dragging state changes
7
+ * Pair with `useSlider` for managed state.
12
8
  *
13
- * **...Other valid HTML properties for div element**
9
+ * @param props.value - Current position as a percentage (0–100). Required.
10
+ * @param props.onChange - Callback fired on value change. Required.
11
+ * @param props.disabled - Disables interactions. Default: false
12
+ * @param props.onDragging - Callback fired when dragging starts or stops.
14
13
  *
15
- * @returns Slider JSX element
14
+ * **...Other valid HTML properties for `<div>`**
15
+ *
16
+ * @returns Slider JSX element.
16
17
  *
17
18
  * @example
18
19
  * ```tsx
19
- * // Basic slider
20
+ * // Controlled slider
20
21
  * const [value, setValue] = useState(50);
21
22
  * <Slider value={value} onChange={setValue} />
22
23
  *
23
- * // Disabled slider
24
- * <Slider value={75} onChange={() => {}} disabled />
25
- *
26
- * // Slider with dragging callback
27
- * const [isDragging, setIsDragging] = useState(false);
28
- * <Slider
29
- * value={value}
30
- * onChange={setValue}
31
- * onDragging={setIsDragging}
32
- * />
24
+ * // With useSlider hook
25
+ * const [value, setValue] = useSlider(25);
26
+ * <Slider value={value} onChange={setValue} onDragging={setIsDragging} />
33
27
  *
34
- * // Complete example with useSlider hook
35
- * function SliderExample() {
36
- * const [sliderValue, setSliderValue] = useSlider(25);
37
- * const [isDragging, setIsDragging] = useState(false);
38
- *
39
- * return (
40
- * <Slider
41
- * value={sliderValue}
42
- * onChange={setSliderValue}
43
- * onDragging={setIsDragging}
44
- * className="custom-slider"
45
- * />
46
- * );
47
- * }
28
+ * // Disabled
29
+ * <Slider value={75} onChange={() => {}} disabled />
48
30
  * ```
49
31
  */
50
32
  function Slider(props) {
@@ -1,98 +1,82 @@
1
1
  import type { ButtonHTMLAttributes } from "react";
2
2
  import "./styles.css";
3
3
  type SwitchProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "onChange" | "defaultValue" | "onCheck" | "value"> & {
4
+ /** Optional label text displayed beside the switch. */
4
5
  label?: string;
6
+ /**
7
+ * Switch size.
8
+ * @default "lg"
9
+ */
5
10
  size?: "sm" | "md" | "lg";
11
+ /** Uncontrolled initial checked state. @default false */
6
12
  defaultChecked?: boolean;
13
+ /** Controlled checked state. */
7
14
  checked?: boolean;
15
+ /** Value emitted when the switch is on. @default "checked" */
8
16
  value?: string;
17
+ /** Value emitted when the switch is off. @default "" */
9
18
  unCheckedValue?: string;
19
+ /** Field name for form submission. Required. */
10
20
  name: string;
21
+ /** Callback fired on toggle — receives the current value string. */
11
22
  onCheck?: (value: string) => void;
23
+ /**
24
+ * Layout direction forwarded to `FieldTemplate`.
25
+ * @default "horizontalReverse"
26
+ */
12
27
  orientation?: "vertical" | "horizontal" | "horizontalReverse";
28
+ /** When true, skips `FieldTemplate` wrapper (label and error text). @default false */
13
29
  unShowFieldTemplate?: boolean;
30
+ /** Displays an asterisk on the label to signal a required field. */
14
31
  showAsterisk?: boolean;
32
+ /** Validation error message displayed below the switch. */
15
33
  errorMessage?: string;
16
34
  };
17
35
  /**
18
- * Switch component - used for creating toggle switches with on/off states
36
+ * Switch toggle input for binary on/off states.
19
37
  *
20
- * @param props - Switch component properties
21
- * @param props.name - Required field name for form handling and input identification
22
- * @param props.label - Optional label text to display next to the switch
23
- * @param props.size - Size variant of the switch. Default: "lg"
24
- * @param props.defaultChecked - Default checked state for uncontrolled usage. Default: false
25
- * @param props.checked - Controlled checked state of the switch
26
- * @param props.value - Value to be used when switch is checked. Default: "checked"
27
- * @param props.unCheckedValue - Value to be used when switch is unchecked. Default: ""
28
- * @param props.onCheck - Callback function called when switch state changes, receives the current value
29
- * @param props.unShowFieldTemplate - When true, skips `FieldTemplate` structure (wrapper, label and error text) and renders only the checkbox button content.
30
- * @param props.orientation - Layout direction forwarded to `FieldTemplate`/`FieldWrapper` (`horizontal`, `vertical`, `horizontalReverse`). Default: "horizontalReverse"
38
+ * Stores value in a hidden `<input>` for native form submission.
39
+ * Integrates with `useForm` to display validation errors by field name.
31
40
  *
32
- * **...Other valid HTML properties for button element (except children, onChange, defaultValue, onCheck, value)**
41
+ * @param props.name - Field name for form submission. Required.
42
+ * @param props.label - Label text displayed beside the switch.
43
+ * @param props.size - Switch size (`sm` | `md` | `lg`). Default: "lg"
44
+ * @param props.defaultChecked - Uncontrolled initial checked state. Default: false
45
+ * @param props.checked - Controlled checked state.
46
+ * @param props.value - Value emitted when on. Default: "checked"
47
+ * @param props.unCheckedValue - Value emitted when off. Default: ""
48
+ * @param props.onCheck - Callback fired on toggle — receives the current value string.
49
+ * @param props.orientation - Layout direction (`horizontal` | `vertical` | `horizontalReverse`). Default: "horizontalReverse"
50
+ * @param props.unShowFieldTemplate - Skips wrapper, label, and error rendering. Default: false
51
+ * @param props.showAsterisk - Appends `*` to the label.
52
+ * @param props.errorMessage - Validation error message.
33
53
  *
34
- * @returns Switch JSX element wrapped in FieldWrapper with optional label
54
+ * **...Other valid HTML properties for `<button>` (except `children`, `onChange`, `defaultValue`)**
55
+ *
56
+ * @returns Switch JSX element wrapped in `FieldTemplate`.
35
57
  *
36
58
  * @example
37
59
  * ```tsx
38
- * // Basic switch
60
+ * // Basic
39
61
  * <Switch name="notifications" label="Enable notifications" />
40
62
  *
41
- * // Switch with custom values
63
+ * // Custom on/off values
42
64
  * <Switch
43
65
  * name="theme"
44
66
  * label="Dark mode"
45
67
  * value="dark"
46
68
  * unCheckedValue="light"
47
- * onCheck={(value) => console.log('Theme:', value)}
69
+ * onCheck={(v) => setTheme(v)}
48
70
  * />
49
71
  *
50
- * // Controlled switch with callback
72
+ * // Controlled
51
73
  * <Switch
52
74
  * name="autoSave"
53
- * label="Auto-save documents"
75
+ * label="Auto-save"
54
76
  * checked={isAutoSaveEnabled}
55
- * onCheck={(value) => setIsAutoSaveEnabled(!!value)}
77
+ * onCheck={(v) => setAutoSave(!!v)}
56
78
  * size="md"
57
79
  * />
58
- *
59
- * // Small switch with default checked state
60
- * <Switch
61
- * name="marketing"
62
- * label="Marketing emails"
63
- * size="sm"
64
- * defaultChecked={true}
65
- * value="subscribed"
66
- * unCheckedValue="unsubscribed"
67
- * />
68
- *
69
- * // Switch with custom styling and disabled state
70
- * <Switch
71
- * name="premium"
72
- * label="Premium features"
73
- * className="premium-switch"
74
- * disabled={!isPremiumUser}
75
- * onCheck={(value) => handlePremiumToggle(value)}
76
- * />
77
- *
78
- * // Large switch for accessibility
79
- * <Switch
80
- * name="accessibility"
81
- * label="High contrast mode"
82
- * size="lg"
83
- * checked={isHighContrast}
84
- * onCheck={(value) => setIsHighContrast(!!value)}
85
- * value="enabled"
86
- * unCheckedValue="disabled"
87
- * />
88
- *
89
- * // Switch without label for inline usage
90
- * <Switch
91
- * name="inline_toggle"
92
- * value="on"
93
- * unCheckedValue="off"
94
- * onCheck={(value) => console.log('Toggle state:', value)}
95
- * />
96
80
  * ```
97
81
  */
98
82
  declare function Switch(props: SwitchProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/switch/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAIlD,OAAO,cAAc,CAAC;AAEtB,KAAK,WAAW,GAAG,IAAI,CACrB,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,GAAG,OAAO,CAC/D,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,mBAAmB,CAAC;IAC9D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AAEH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CA+DjC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/switch/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAIlD,OAAO,cAAc,CAAC;AAEtB,KAAK,WAAW,GAAG,IAAI,CACrB,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,GAAG,OAAO,CAC/D,GAAG;IACF,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,yDAAyD;IACzD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,mBAAmB,CAAC;IAC9D,sFAAsF;IACtF,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,oEAAoE;IACpE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CA+DjC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -3,84 +3,50 @@ import { useId, useRef, useState } from "react";
3
3
  import { FieldTemplate } from "../../services/fieldTemplate";
4
4
  import "./styles.css";
5
5
  /**
6
- * Switch component - used for creating toggle switches with on/off states
6
+ * Switch toggle input for binary on/off states.
7
7
  *
8
- * @param props - Switch component properties
9
- * @param props.name - Required field name for form handling and input identification
10
- * @param props.label - Optional label text to display next to the switch
11
- * @param props.size - Size variant of the switch. Default: "lg"
12
- * @param props.defaultChecked - Default checked state for uncontrolled usage. Default: false
13
- * @param props.checked - Controlled checked state of the switch
14
- * @param props.value - Value to be used when switch is checked. Default: "checked"
15
- * @param props.unCheckedValue - Value to be used when switch is unchecked. Default: ""
16
- * @param props.onCheck - Callback function called when switch state changes, receives the current value
17
- * @param props.unShowFieldTemplate - When true, skips `FieldTemplate` structure (wrapper, label and error text) and renders only the checkbox button content.
18
- * @param props.orientation - Layout direction forwarded to `FieldTemplate`/`FieldWrapper` (`horizontal`, `vertical`, `horizontalReverse`). Default: "horizontalReverse"
8
+ * Stores value in a hidden `<input>` for native form submission.
9
+ * Integrates with `useForm` to display validation errors by field name.
19
10
  *
20
- * **...Other valid HTML properties for button element (except children, onChange, defaultValue, onCheck, value)**
11
+ * @param props.name - Field name for form submission. Required.
12
+ * @param props.label - Label text displayed beside the switch.
13
+ * @param props.size - Switch size (`sm` | `md` | `lg`). Default: "lg"
14
+ * @param props.defaultChecked - Uncontrolled initial checked state. Default: false
15
+ * @param props.checked - Controlled checked state.
16
+ * @param props.value - Value emitted when on. Default: "checked"
17
+ * @param props.unCheckedValue - Value emitted when off. Default: ""
18
+ * @param props.onCheck - Callback fired on toggle — receives the current value string.
19
+ * @param props.orientation - Layout direction (`horizontal` | `vertical` | `horizontalReverse`). Default: "horizontalReverse"
20
+ * @param props.unShowFieldTemplate - Skips wrapper, label, and error rendering. Default: false
21
+ * @param props.showAsterisk - Appends `*` to the label.
22
+ * @param props.errorMessage - Validation error message.
21
23
  *
22
- * @returns Switch JSX element wrapped in FieldWrapper with optional label
24
+ * **...Other valid HTML properties for `<button>` (except `children`, `onChange`, `defaultValue`)**
25
+ *
26
+ * @returns Switch JSX element wrapped in `FieldTemplate`.
23
27
  *
24
28
  * @example
25
29
  * ```tsx
26
- * // Basic switch
30
+ * // Basic
27
31
  * <Switch name="notifications" label="Enable notifications" />
28
32
  *
29
- * // Switch with custom values
33
+ * // Custom on/off values
30
34
  * <Switch
31
35
  * name="theme"
32
36
  * label="Dark mode"
33
37
  * value="dark"
34
38
  * unCheckedValue="light"
35
- * onCheck={(value) => console.log('Theme:', value)}
39
+ * onCheck={(v) => setTheme(v)}
36
40
  * />
37
41
  *
38
- * // Controlled switch with callback
42
+ * // Controlled
39
43
  * <Switch
40
44
  * name="autoSave"
41
- * label="Auto-save documents"
45
+ * label="Auto-save"
42
46
  * checked={isAutoSaveEnabled}
43
- * onCheck={(value) => setIsAutoSaveEnabled(!!value)}
47
+ * onCheck={(v) => setAutoSave(!!v)}
44
48
  * size="md"
45
49
  * />
46
- *
47
- * // Small switch with default checked state
48
- * <Switch
49
- * name="marketing"
50
- * label="Marketing emails"
51
- * size="sm"
52
- * defaultChecked={true}
53
- * value="subscribed"
54
- * unCheckedValue="unsubscribed"
55
- * />
56
- *
57
- * // Switch with custom styling and disabled state
58
- * <Switch
59
- * name="premium"
60
- * label="Premium features"
61
- * className="premium-switch"
62
- * disabled={!isPremiumUser}
63
- * onCheck={(value) => handlePremiumToggle(value)}
64
- * />
65
- *
66
- * // Large switch for accessibility
67
- * <Switch
68
- * name="accessibility"
69
- * label="High contrast mode"
70
- * size="lg"
71
- * checked={isHighContrast}
72
- * onCheck={(value) => setIsHighContrast(!!value)}
73
- * value="enabled"
74
- * unCheckedValue="disabled"
75
- * />
76
- *
77
- * // Switch without label for inline usage
78
- * <Switch
79
- * name="inline_toggle"
80
- * value="on"
81
- * unCheckedValue="off"
82
- * onCheck={(value) => console.log('Toggle state:', value)}
83
- * />
84
50
  * ```
85
51
  */
86
52
  function Switch(props) {
@@ -1,69 +1,31 @@
1
1
  import { ButtonHTMLAttributes, ReactNode } from "react";
2
2
  import "./styles.css";
3
3
  type TabButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "value" | "type"> & {
4
+ /** Content displayed inside the tab button. */
4
5
  children: ReactNode;
6
+ /** Unique identifier for this tab; matched against the container's active value. */
5
7
  value: string;
6
8
  };
7
9
  /**
8
- * TabButton component - used as interactive buttons within a TabContainer for tab navigation
10
+ * TabButton individual tab button inside a `TabContainer`.
9
11
  *
10
- * @param props - TabButton component properties
11
- * @param props.children - Content to display inside the tab button (required)
12
- * @param props.value - Unique identifier for the tab button (required)
13
- * @param props.disabled - Whether the button is disabled. Can be overridden by TabContainer's disabled state
12
+ * Reads active state and disabled state from `TabContainer` context.
13
+ * The button's own `disabled` prop is ORed with the container's `disabled`.
14
14
  *
15
- * **...Other valid HTML button properties except children, value, and type**
15
+ * @param props.children - Tab label content. Required.
16
+ * @param props.value - Tab identifier. Required.
17
+ * @param props.disabled - Disables this tab individually (container can also disable all tabs).
16
18
  *
17
- * @returns TabButton JSX element
19
+ * **...Other valid HTML `<button>` properties except `type`**
18
20
  *
19
- * @example
20
- * ```tsx
21
- * // Basic tab buttons within TabContainer
22
- * <TabContainer>
23
- * <TabButton value="home">Home</TabButton>
24
- * <TabButton value="about">About</TabButton>
25
- * <TabButton value="contact">Contact</TabButton>
26
- * </TabContainer>
27
- * ```
28
- *
29
- * @example
30
- * ```tsx
31
- * // Tab button with click handler
32
- * <TabContainer onChange={(value) => console.log('Tab changed:', value)}>
33
- * <TabButton
34
- * value="profile"
35
- * onClick={() => console.log('Profile tab clicked')}
36
- * >
37
- * Profile
38
- * </TabButton>
39
- * <TabButton value="settings">Settings</TabButton>
40
- * </TabContainer>
41
- * ```
42
- *
43
- * @example
44
- * ```tsx
45
- * // Disabled tab button
46
- * <TabContainer>
47
- * <TabButton value="available">Available</TabButton>
48
- * <TabButton value="coming-soon" disabled>
49
- * Coming Soon
50
- * </TabButton>
51
- * </TabContainer>
52
- * ```
21
+ * @returns TabButton JSX element.
53
22
  *
54
23
  * @example
55
24
  * ```tsx
56
- * // Tab buttons with custom styling and default value
57
- * <TabContainer defaultValue="dashboard">
58
- * <TabButton
59
- * value="dashboard"
60
- * className="custom-tab"
61
- * aria-label="Dashboard tab"
62
- * >
63
- * Dashboard
64
- * </TabButton>
65
- * <TabButton value="analytics">Analytics</TabButton>
66
- * <TabButton value="reports">Reports</TabButton>
25
+ * <TabContainer defaultValue="overview" onChange={setTab}>
26
+ * <TabButton value="overview">Overview</TabButton>
27
+ * <TabButton value="activity">Activity</TabButton>
28
+ * <TabButton value="settings" disabled>Settings</TabButton>
67
29
  * </TabContainer>
68
30
  * ```
69
31
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tab/tabButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,cAAc,CAAC;AAEtB,KAAK,cAAc,GAAG,IAAI,CACxB,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,MAAM,CAC9B,GAAG;IACF,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH,iBAAS,SAAS,CAAC,KAAK,EAAE,cAAc,2CAkCvC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/tab/tabButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAc,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,cAAc,CAAC;AAEtB,KAAK,cAAc,GAAG,IAAI,CACxB,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,MAAM,CAC9B,GAAG;IACF,+CAA+C;IAC/C,QAAQ,EAAE,SAAS,CAAC;IACpB,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,iBAAS,SAAS,CAAC,KAAK,EAAE,cAAc,2CAkCvC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -2,65 +2,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useTab } from "../tabContext";
3
3
  import "./styles.css";
4
4
  /**
5
- * TabButton component - used as interactive buttons within a TabContainer for tab navigation
5
+ * TabButton individual tab button inside a `TabContainer`.
6
6
  *
7
- * @param props - TabButton component properties
8
- * @param props.children - Content to display inside the tab button (required)
9
- * @param props.value - Unique identifier for the tab button (required)
10
- * @param props.disabled - Whether the button is disabled. Can be overridden by TabContainer's disabled state
7
+ * Reads active state and disabled state from `TabContainer` context.
8
+ * The button's own `disabled` prop is ORed with the container's `disabled`.
11
9
  *
12
- * **...Other valid HTML button properties except children, value, and type**
10
+ * @param props.children - Tab label content. Required.
11
+ * @param props.value - Tab identifier. Required.
12
+ * @param props.disabled - Disables this tab individually (container can also disable all tabs).
13
13
  *
14
- * @returns TabButton JSX element
14
+ * **...Other valid HTML `<button>` properties except `type`**
15
15
  *
16
- * @example
17
- * ```tsx
18
- * // Basic tab buttons within TabContainer
19
- * <TabContainer>
20
- * <TabButton value="home">Home</TabButton>
21
- * <TabButton value="about">About</TabButton>
22
- * <TabButton value="contact">Contact</TabButton>
23
- * </TabContainer>
24
- * ```
25
- *
26
- * @example
27
- * ```tsx
28
- * // Tab button with click handler
29
- * <TabContainer onChange={(value) => console.log('Tab changed:', value)}>
30
- * <TabButton
31
- * value="profile"
32
- * onClick={() => console.log('Profile tab clicked')}
33
- * >
34
- * Profile
35
- * </TabButton>
36
- * <TabButton value="settings">Settings</TabButton>
37
- * </TabContainer>
38
- * ```
39
- *
40
- * @example
41
- * ```tsx
42
- * // Disabled tab button
43
- * <TabContainer>
44
- * <TabButton value="available">Available</TabButton>
45
- * <TabButton value="coming-soon" disabled>
46
- * Coming Soon
47
- * </TabButton>
48
- * </TabContainer>
49
- * ```
16
+ * @returns TabButton JSX element.
50
17
  *
51
18
  * @example
52
19
  * ```tsx
53
- * // Tab buttons with custom styling and default value
54
- * <TabContainer defaultValue="dashboard">
55
- * <TabButton
56
- * value="dashboard"
57
- * className="custom-tab"
58
- * aria-label="Dashboard tab"
59
- * >
60
- * Dashboard
61
- * </TabButton>
62
- * <TabButton value="analytics">Analytics</TabButton>
63
- * <TabButton value="reports">Reports</TabButton>
20
+ * <TabContainer defaultValue="overview" onChange={setTab}>
21
+ * <TabButton value="overview">Overview</TabButton>
22
+ * <TabButton value="activity">Activity</TabButton>
23
+ * <TabButton value="settings" disabled>Settings</TabButton>
64
24
  * </TabContainer>
65
25
  * ```
66
26
  */