asheeui 0.7.0 → 1.0.0

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 (266) hide show
  1. package/dist/AsheeUIProvider.d.ts.map +1 -1
  2. package/dist/AsheeUIProvider.js +22 -15
  3. package/dist/components/accordion/Accordion.d.ts.map +1 -1
  4. package/dist/components/accordion/Accordion.js +9 -7
  5. package/dist/components/alert/Alert.d.ts +88 -0
  6. package/dist/components/alert/Alert.d.ts.map +1 -0
  7. package/dist/components/alert/Alert.js +61 -0
  8. package/dist/components/alert/alert-config.d.ts +56 -0
  9. package/dist/components/alert/alert-config.d.ts.map +1 -0
  10. package/dist/components/alert/alert-config.js +14 -0
  11. package/dist/components/alert/alert-styles.d.ts +32 -0
  12. package/dist/components/alert/alert-styles.d.ts.map +1 -0
  13. package/dist/components/alert/alert-styles.js +20 -0
  14. package/dist/components/alert/index.d.ts +3 -0
  15. package/dist/components/alert/index.d.ts.map +1 -0
  16. package/dist/components/alert/index.js +3 -0
  17. package/dist/components/autocomplete/Autocomplete.d.ts +6 -6
  18. package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
  19. package/dist/components/autocomplete/Autocomplete.js +94 -58
  20. package/dist/components/autocomplete/autocomplete-config.d.ts +1 -1
  21. package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
  22. package/dist/components/avatar/Avatar.d.ts +87 -0
  23. package/dist/components/avatar/Avatar.d.ts.map +1 -0
  24. package/dist/components/avatar/Avatar.js +43 -0
  25. package/dist/components/avatar/avatar-config.d.ts +48 -0
  26. package/dist/components/avatar/avatar-config.d.ts.map +1 -0
  27. package/dist/components/avatar/avatar-config.js +14 -0
  28. package/dist/components/avatar/avatar-styles.d.ts +21 -0
  29. package/dist/components/avatar/avatar-styles.d.ts.map +1 -0
  30. package/dist/components/avatar/avatar-styles.js +13 -0
  31. package/dist/components/avatar/avatar.helpers.d.ts +19 -0
  32. package/dist/components/avatar/avatar.helpers.d.ts.map +1 -0
  33. package/dist/components/avatar/avatar.helpers.js +11 -0
  34. package/dist/components/avatar/index.d.ts +3 -0
  35. package/dist/components/avatar/index.d.ts.map +1 -0
  36. package/dist/components/avatar/index.js +4 -0
  37. package/dist/components/badge/Badge.d.ts +69 -0
  38. package/dist/components/badge/Badge.d.ts.map +1 -0
  39. package/dist/components/badge/Badge.js +39 -0
  40. package/dist/components/badge/badge-config.d.ts +63 -0
  41. package/dist/components/badge/badge-config.d.ts.map +1 -0
  42. package/dist/components/badge/badge-config.js +15 -0
  43. package/dist/components/badge/badge-styles.d.ts +27 -0
  44. package/dist/components/badge/badge-styles.d.ts.map +1 -0
  45. package/dist/components/badge/badge-styles.js +25 -0
  46. package/dist/components/badge/index.d.ts +3 -0
  47. package/dist/components/badge/index.d.ts.map +1 -0
  48. package/dist/components/badge/index.js +3 -0
  49. package/dist/components/breadcrumb/Breadcrumb.d.ts +106 -0
  50. package/dist/components/breadcrumb/Breadcrumb.d.ts.map +1 -0
  51. package/dist/components/breadcrumb/Breadcrumb.js +52 -0
  52. package/dist/components/breadcrumb/breadcrumb-config.d.ts +41 -0
  53. package/dist/components/breadcrumb/breadcrumb-config.d.ts.map +1 -0
  54. package/dist/components/breadcrumb/breadcrumb-config.js +10 -0
  55. package/dist/components/breadcrumb/breadcrumb-styles.d.ts +28 -0
  56. package/dist/components/breadcrumb/breadcrumb-styles.d.ts.map +1 -0
  57. package/dist/components/breadcrumb/breadcrumb-styles.js +17 -0
  58. package/dist/components/breadcrumb/index.d.ts +3 -0
  59. package/dist/components/breadcrumb/index.d.ts.map +1 -0
  60. package/dist/components/breadcrumb/index.js +3 -0
  61. package/dist/components/button/Button.d.ts.map +1 -1
  62. package/dist/components/button/Button.js +10 -7
  63. package/dist/components/{date-picker/DatePicker.d.ts → calendar/Calendar.d.ts} +21 -21
  64. package/dist/components/calendar/Calendar.d.ts.map +1 -0
  65. package/dist/components/{date-picker/DatePicker.js → calendar/Calendar.js} +11 -11
  66. package/dist/components/{date-picker/Calendar.d.ts → calendar/DateGrid.d.ts} +7 -7
  67. package/dist/components/calendar/DateGrid.d.ts.map +1 -0
  68. package/dist/components/calendar/DateGrid.js +194 -0
  69. package/dist/components/calendar/TimeSpinner.d.ts.map +1 -0
  70. package/dist/components/{date-picker → calendar}/TimeSpinner.js +3 -3
  71. package/dist/components/{date-picker/date-picker-config.d.ts → calendar/calendar-config.d.ts} +17 -17
  72. package/dist/components/calendar/calendar-config.d.ts.map +1 -0
  73. package/dist/components/{date-picker/date-picker-config.js → calendar/calendar-config.js} +3 -3
  74. package/dist/components/{date-picker/date-picker-styles.d.ts → calendar/calendar-styles.d.ts} +1 -1
  75. package/dist/components/calendar/calendar-styles.d.ts.map +1 -0
  76. package/dist/components/{date-picker/date-picker-styles.js → calendar/calendar-styles.js} +1 -1
  77. package/dist/components/{date-picker/date-picker.helpers.d.ts → calendar/calendar.helpers.d.ts} +9 -9
  78. package/dist/components/calendar/calendar.helpers.d.ts.map +1 -0
  79. package/dist/components/{date-picker/date-picker.helpers.js → calendar/calendar.helpers.js} +4 -4
  80. package/dist/components/calendar/index.d.ts +3 -0
  81. package/dist/components/calendar/index.d.ts.map +1 -0
  82. package/dist/components/calendar/index.js +6 -0
  83. package/dist/components/card/Card.d.ts +6 -6
  84. package/dist/components/card/Card.d.ts.map +1 -1
  85. package/dist/components/card/Card.js +8 -8
  86. package/dist/components/carousel/Carousel.d.ts.map +1 -1
  87. package/dist/components/carousel/Carousel.js +85 -83
  88. package/dist/components/carousel/carousel-styles.d.ts +1 -20
  89. package/dist/components/carousel/carousel-styles.d.ts.map +1 -1
  90. package/dist/components/chip/Chip.js +5 -5
  91. package/dist/components/drawer/Drawer.d.ts +8 -4
  92. package/dist/components/drawer/Drawer.d.ts.map +1 -1
  93. package/dist/components/drawer/Drawer.js +54 -38
  94. package/dist/components/{select/Select.d.ts → dropmenu/Dropmenu.d.ts} +21 -21
  95. package/dist/components/{select/Select.d.ts.map → dropmenu/Dropmenu.d.ts.map} +1 -1
  96. package/dist/components/dropmenu/Dropmenu.js +102 -0
  97. package/dist/components/{select/select-config.d.ts → dropmenu/dropmenu-config.d.ts} +8 -8
  98. package/dist/components/dropmenu/dropmenu-config.d.ts.map +1 -0
  99. package/dist/components/{select/select-config.js → dropmenu/dropmenu-config.js} +3 -3
  100. package/dist/components/{select/select-styles.d.ts → dropmenu/dropmenu-styles.d.ts} +1 -1
  101. package/dist/components/dropmenu/dropmenu-styles.d.ts.map +1 -0
  102. package/dist/components/{select/select-styles.js → dropmenu/dropmenu-styles.js} +1 -1
  103. package/dist/components/dropmenu/index.d.ts +3 -0
  104. package/dist/components/dropmenu/index.d.ts.map +1 -0
  105. package/dist/components/dropmenu/index.js +3 -0
  106. package/dist/components/field/FieldShell.d.ts +13 -1
  107. package/dist/components/field/FieldShell.d.ts.map +1 -1
  108. package/dist/components/field/FieldShell.js +16 -15
  109. package/dist/components/form/Form.d.ts +109 -0
  110. package/dist/components/form/Form.d.ts.map +1 -0
  111. package/dist/components/form/Form.js +42 -0
  112. package/dist/components/form/form-config.d.ts +57 -0
  113. package/dist/components/form/form-config.d.ts.map +1 -0
  114. package/dist/components/form/form-config.js +12 -0
  115. package/dist/components/form/form-styles.d.ts +27 -0
  116. package/dist/components/form/form-styles.d.ts.map +1 -0
  117. package/dist/components/form/form-styles.js +5 -0
  118. package/dist/components/form/index.d.ts +3 -0
  119. package/dist/components/form/index.d.ts.map +1 -0
  120. package/dist/components/form/index.js +3 -0
  121. package/dist/components/image/Image.d.ts +4 -5
  122. package/dist/components/image/Image.d.ts.map +1 -1
  123. package/dist/components/image/Image.js +5 -5
  124. package/dist/components/input/Input.js +5 -5
  125. package/dist/components/link/Link.d.ts +12 -10
  126. package/dist/components/link/Link.d.ts.map +1 -1
  127. package/dist/components/link/Link.js +1 -1
  128. package/dist/components/marquee/Marquee.d.ts.map +1 -1
  129. package/dist/components/marquee/Marquee.js +36 -33
  130. package/dist/components/{select-menu/SelectMenu.d.ts → menu/Menu.d.ts} +52 -19
  131. package/dist/components/menu/Menu.d.ts.map +1 -0
  132. package/dist/components/menu/Menu.js +161 -0
  133. package/dist/components/menu/index.d.ts +5 -0
  134. package/dist/components/menu/index.d.ts.map +1 -0
  135. package/dist/components/menu/index.js +4 -0
  136. package/dist/components/{select-menu/select-menu-config.d.ts → menu/menu-config.d.ts} +5 -5
  137. package/dist/components/menu/menu-config.d.ts.map +1 -0
  138. package/dist/components/{select-menu/select-menu-config.js → menu/menu-config.js} +2 -2
  139. package/dist/components/menu/menu-navigation.d.ts +38 -0
  140. package/dist/components/menu/menu-navigation.d.ts.map +1 -0
  141. package/dist/components/menu/menu-navigation.js +20 -0
  142. package/dist/components/{select-menu/use-select-floating.d.ts → menu/use-menu-floating.d.ts} +10 -10
  143. package/dist/components/menu/use-menu-floating.d.ts.map +1 -0
  144. package/dist/components/{select-menu/use-select-floating.js → menu/use-menu-floating.js} +2 -2
  145. package/dist/components/modal/Modal.d.ts +6 -1
  146. package/dist/components/modal/Modal.d.ts.map +1 -1
  147. package/dist/components/modal/Modal.js +62 -45
  148. package/dist/components/multi-select/MultiSelect.d.ts +11 -10
  149. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  150. package/dist/components/multi-select/MultiSelect.js +99 -86
  151. package/dist/components/multi-select/multi-select-config.d.ts +1 -1
  152. package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
  153. package/dist/components/pagination/Pagination.d.ts +91 -0
  154. package/dist/components/pagination/Pagination.d.ts.map +1 -0
  155. package/dist/components/pagination/Pagination.js +66 -0
  156. package/dist/components/pagination/index.d.ts +3 -0
  157. package/dist/components/pagination/index.d.ts.map +1 -0
  158. package/dist/components/pagination/index.js +4 -0
  159. package/dist/components/pagination/pagination-config.d.ts +66 -0
  160. package/dist/components/pagination/pagination-config.d.ts.map +1 -0
  161. package/dist/components/pagination/pagination-config.js +19 -0
  162. package/dist/components/pagination/pagination-styles.d.ts +19 -0
  163. package/dist/components/pagination/pagination-styles.d.ts.map +1 -0
  164. package/dist/components/pagination/pagination-styles.js +5 -0
  165. package/dist/components/pagination/pagination.helpers.d.ts +26 -0
  166. package/dist/components/pagination/pagination.helpers.d.ts.map +1 -0
  167. package/dist/components/pagination/pagination.helpers.js +12 -0
  168. package/dist/components/radio/Radio.d.ts +53 -107
  169. package/dist/components/radio/Radio.d.ts.map +1 -1
  170. package/dist/components/radio/Radio.js +50 -36
  171. package/dist/components/radio/RadioGroup.d.ts +107 -53
  172. package/dist/components/radio/RadioGroup.d.ts.map +1 -1
  173. package/dist/components/radio/RadioGroup.js +43 -49
  174. package/dist/components/radio/index.d.ts +0 -1
  175. package/dist/components/radio/index.d.ts.map +1 -1
  176. package/dist/components/resizable-screen/ResizableScreen.d.ts +4 -4
  177. package/dist/components/scrollbar/index.js +1 -0
  178. package/dist/components/scrollbar/scrollbar-config.js +13 -0
  179. package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
  180. package/dist/components/sidebar/Sidebar.js +92 -90
  181. package/dist/components/skeleton/Skeleton.d.ts +65 -0
  182. package/dist/components/skeleton/Skeleton.d.ts.map +1 -0
  183. package/dist/components/skeleton/Skeleton.js +29 -0
  184. package/dist/components/skeleton/index.d.ts +3 -0
  185. package/dist/components/skeleton/index.d.ts.map +1 -0
  186. package/dist/components/skeleton/index.js +3 -0
  187. package/dist/components/skeleton/skeleton-config.d.ts +40 -0
  188. package/dist/components/skeleton/skeleton-config.d.ts.map +1 -0
  189. package/dist/components/skeleton/skeleton-config.js +13 -0
  190. package/dist/components/skeleton/skeleton-styles.d.ts +19 -0
  191. package/dist/components/skeleton/skeleton-styles.d.ts.map +1 -0
  192. package/dist/components/skeleton/skeleton-styles.js +5 -0
  193. package/dist/components/switch/Switch.d.ts.map +1 -1
  194. package/dist/components/switch/Switch.js +7 -5
  195. package/dist/components/table/Table.js +3 -3
  196. package/dist/components/tabs/Tabs.js +3 -3
  197. package/dist/components/textarea/Textarea.d.ts +10 -10
  198. package/dist/components/textarea/Textarea.js +7 -7
  199. package/dist/components/textarea/textarea-config.d.ts +2 -2
  200. package/dist/components/toast/ToastItem.d.ts.map +1 -1
  201. package/dist/components/toast/ToastItem.js +8 -7
  202. package/dist/components/tooltip/Tooltip.js +5 -5
  203. package/dist/components/typography/Typography.d.ts +60 -0
  204. package/dist/components/typography/Typography.d.ts.map +1 -0
  205. package/dist/components/typography/Typography.js +28 -0
  206. package/dist/components/typography/index.d.ts +3 -0
  207. package/dist/components/typography/index.d.ts.map +1 -0
  208. package/dist/components/typography/index.js +3 -0
  209. package/dist/components/typography/typography-config.d.ts +54 -0
  210. package/dist/components/typography/typography-config.d.ts.map +1 -0
  211. package/dist/components/typography/typography-config.js +12 -0
  212. package/dist/components/typography/typography-styles.d.ts +21 -0
  213. package/dist/components/typography/typography-styles.d.ts.map +1 -0
  214. package/dist/components/typography/typography-styles.js +19 -0
  215. package/dist/config/default-config.d.ts.map +1 -1
  216. package/dist/config/default-config.js +2 -2
  217. package/dist/config/index.js +1 -0
  218. package/dist/config/validate-config.d.ts +34 -0
  219. package/dist/config/validate-config.d.ts.map +1 -0
  220. package/dist/config/validate-config.js +190 -0
  221. package/dist/index.d.ts +15 -17
  222. package/dist/index.d.ts.map +1 -1
  223. package/dist/index.js +61 -47
  224. package/dist/libs/index.js +3 -0
  225. package/dist/libs/use-body-scroll-lock.d.ts +21 -0
  226. package/dist/libs/use-body-scroll-lock.d.ts.map +1 -0
  227. package/dist/libs/use-body-scroll-lock.js +27 -0
  228. package/dist/libs/use-dialog-overlay.d.ts +21 -0
  229. package/dist/libs/use-dialog-overlay.d.ts.map +1 -0
  230. package/dist/libs/use-dialog-overlay.js +21 -0
  231. package/dist/libs/use-prefers-reduced-motion.d.ts +23 -0
  232. package/dist/libs/use-prefers-reduced-motion.d.ts.map +1 -0
  233. package/dist/libs/use-prefers-reduced-motion.js +19 -0
  234. package/dist/scripts/AsheeThemeScript.js +43 -8
  235. package/dist/shared/index.d.ts +1 -0
  236. package/dist/shared/index.d.ts.map +1 -1
  237. package/dist/shared/typography.d.ts +81 -0
  238. package/dist/shared/typography.d.ts.map +1 -0
  239. package/dist/shared/typography.js +137 -0
  240. package/dist/utils/stacking.d.ts +2 -2
  241. package/dist/utils/stacking.d.ts.map +1 -1
  242. package/package.json +13 -6
  243. package/dist/components/date-picker/Calendar.d.ts.map +0 -1
  244. package/dist/components/date-picker/Calendar.js +0 -143
  245. package/dist/components/date-picker/DatePicker.d.ts.map +0 -1
  246. package/dist/components/date-picker/TimeSpinner.d.ts.map +0 -1
  247. package/dist/components/date-picker/date-picker-config.d.ts.map +0 -1
  248. package/dist/components/date-picker/date-picker-styles.d.ts.map +0 -1
  249. package/dist/components/date-picker/date-picker.helpers.d.ts.map +0 -1
  250. package/dist/components/date-picker/index.d.ts +0 -3
  251. package/dist/components/date-picker/index.d.ts.map +0 -1
  252. package/dist/components/date-picker/index.js +0 -6
  253. package/dist/components/select/Select.js +0 -98
  254. package/dist/components/select/index.d.ts +0 -3
  255. package/dist/components/select/index.d.ts.map +0 -1
  256. package/dist/components/select/index.js +0 -3
  257. package/dist/components/select/select-config.d.ts.map +0 -1
  258. package/dist/components/select/select-styles.d.ts.map +0 -1
  259. package/dist/components/select-menu/SelectMenu.d.ts.map +0 -1
  260. package/dist/components/select-menu/SelectMenu.js +0 -104
  261. package/dist/components/select-menu/index.d.ts +0 -4
  262. package/dist/components/select-menu/index.d.ts.map +0 -1
  263. package/dist/components/select-menu/index.js +0 -3
  264. package/dist/components/select-menu/select-menu-config.d.ts.map +0 -1
  265. package/dist/components/select-menu/use-select-floating.d.ts.map +0 -1
  266. /package/dist/components/{date-picker → calendar}/TimeSpinner.d.ts +0 -0
@@ -1,144 +1,90 @@
1
- import { ReactNode } from 'react';
2
- import { Color } from '../../shared';
3
- import { FieldSizeKey, FieldStatus, LabelAlign } from '../field/field-config';
4
- import { RadioVariant } from './radio-config';
1
+ import { ChangeEvent, InputHTMLAttributes, ReactNode } from 'react';
2
+ import { RadioConfig } from './radio-config';
3
+ type BaseRadioProps = RadioConfig & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange" | "children" | "color">;
5
4
  /**
6
- * Configuration options for the RadioGroup component.
5
+ * Configuration options for the Radio component.
7
6
  */
8
- export interface RadioGroupProps {
7
+ export interface RadioProps extends BaseRadioProps {
9
8
  /**
10
- * Radio components to render inside the group.
9
+ * The value of the radio button.
10
+ * Used to identify which radio is selected in a group.
11
11
  */
12
- children: ReactNode;
12
+ value: string;
13
13
  /**
14
- * Name attribute for all radio inputs in the group.
15
- * Auto-generated if not provided.
14
+ * Label text for the radio.
15
+ * Displayed next to the radio button.
16
16
  */
17
- name?: string;
18
- /**
19
- * Controlled selected value.
20
- */
21
- value?: string;
22
- /**
23
- * Uncontrolled initial selected value.
24
- */
25
- defaultValue?: string;
26
- /**
27
- * Callback fired when the selection changes.
28
- * Receives the new selected value.
29
- */
30
- onChange?: (value: string) => void;
31
- /**
32
- * Size scale for all radios in the group.
33
- * @default "md"
34
- */
35
- size?: FieldSizeKey;
36
- /**
37
- * Theme accent color for all radios in the group.
38
- * @default "primary"
39
- */
40
- color?: Color;
41
- /**
42
- * Visual style variant for all radios in the group.
43
- * @default "default"
44
- */
45
- variant?: RadioVariant;
46
- /**
47
- * Layout orientation of the radio group.
48
- * - `horizontal`: Radios are laid out in a row.
49
- * - `vertical`: Radios are laid out in a column.
50
- * @default "vertical"
51
- */
52
- orientation?: "horizontal" | "vertical";
53
- /**
54
- * Validation status for the group.
55
- * @default "default"
56
- */
57
- status?: FieldStatus;
58
- /**
59
- * Label text for the group.
60
- */
61
- label?: string;
62
- /**
63
- * Alignment of the label relative to the group.
64
- * @default "left"
65
- */
66
- labelAlign?: LabelAlign;
17
+ label?: ReactNode;
67
18
  /**
68
19
  * Description text shown below the label.
20
+ * Provides additional context for the option.
69
21
  */
70
- description?: string;
71
- /**
72
- * Validation message shown below the group.
73
- */
74
- message?: string;
22
+ description?: ReactNode;
75
23
  /**
76
- * Whether the field is required.
77
- * @default false
24
+ * Whether the radio is checked.
25
+ * For controlled usage.
78
26
  */
79
- required?: boolean;
27
+ checked?: boolean;
80
28
  /**
81
- * Whether all radios in the group are disabled.
29
+ * Whether the radio is initially checked.
30
+ * For uncontrolled usage.
82
31
  * @default false
83
32
  */
84
- disabled?: boolean;
33
+ defaultChecked?: boolean;
85
34
  /**
86
- * Extra CSS classes for the group container.
35
+ * Callback fired when the radio state changes.
36
+ * Receives the checked state, value, and the change event.
87
37
  */
88
- className?: string;
38
+ onChange?: (checked: boolean, value: string, event: ChangeEvent<HTMLInputElement>) => void;
89
39
  }
90
40
  /**
91
- * A group of radio buttons that manages shared state and layout.
41
+ * A single radio button with label and description.
42
+ *
43
+ * Radio renders a circular radio button with an optional label and
44
+ * description. It supports controlled and uncontrolled usage, validation
45
+ * states, and the standard AsheeUI cascade for visual tokens. When used
46
+ * within a RadioGroup, it inherits shared props from the group context.
92
47
  *
93
- * RadioGroup wraps multiple Radio components and provides a consistent
94
- * context for shared props like name, value, size, color, and disabled
95
- * state. It also handles labeling, validation, and layout through the
96
- * FieldShell component.
48
+ * The component automatically handles accessibility attributes including
49
+ * proper role, aria-checked, and focus management.
97
50
  *
98
- * @param props - RadioGroup configuration options.
99
- * @param props.children - Radio components to render.
100
- * @param props.name - Name attribute for all radios.
101
- * @param props.value - Controlled selected value.
102
- * @param props.defaultValue - Uncontrolled initial selected value.
103
- * @param props.onChange - Callback fired when selection changes.
104
- * @param props.size - Size scale for all radios. Defaults to "md".
51
+ * @param props - Radio configuration options.
52
+ * @param props.value - The value of the radio button.
53
+ * @param props.label - Label text for the radio.
54
+ * @param props.description - Description text shown below the label.
55
+ * @param props.checked - Whether the radio is checked (controlled).
56
+ * @param props.defaultChecked - Whether the radio is initially checked (uncontrolled).
57
+ * @param props.onChange - Callback fired when the radio state changes.
58
+ * @param props.size - Size scale. Defaults to "md".
105
59
  * @param props.color - Theme accent color. Defaults to "primary".
106
60
  * @param props.variant - Visual style variant. Defaults to "default".
107
- * @param props.orientation - Layout orientation. Defaults to "vertical".
108
- * @param props.status - Validation status. Defaults to "default".
109
- * @param props.label - Label text for the group.
110
- * @param props.labelAlign - Alignment of the label. Defaults to "left".
111
- * @param props.description - Description text.
112
- * @param props.message - Validation message.
113
- * @param props.required - Whether the field is required.
114
- * @param props.disabled - Whether all radios are disabled.
115
- * @param props.className - Extra CSS classes.
61
+ * @param props.radius - Corner rounding. Defaults to "full".
62
+ * @param props.status - Validation status.
63
+ * @param props.disabled - Whether the radio is disabled.
116
64
  *
117
65
  * @example
118
66
  * ```tsx
119
- * import { Radio, RadioGroup } from "asheeui";
67
+ * import { Radio } from "asheeui";
120
68
  * import { useState } from "react";
121
69
  *
122
70
  * export function Example() {
123
- * const [value, setValue] = useState("option-1");
71
+ * const [checked, setChecked] = useState(false);
124
72
  *
125
73
  * return (
126
- * <RadioGroup
127
- * label="Choose an option"
128
- * value={value}
129
- * onChange={setValue}
130
- * orientation="horizontal"
131
- * >
132
- * <Radio value="option-1" label="Option 1" />
133
- * <Radio value="option-2" label="Option 2" />
134
- * <Radio value="option-3" label="Option 3" disabled />
135
- * </RadioGroup>
74
+ * <Radio
75
+ * value="option-1"
76
+ * label="Option 1"
77
+ * description="This is the first option"
78
+ * checked={checked}
79
+ * onChange={(checked) => setChecked(checked)}
80
+ * />
136
81
  * );
137
82
  * }
138
83
  * ```
139
84
  *
140
- * @see Radio - The individual radio component.
85
+ * @see RadioGroup - The parent component that manages radio groups.
141
86
  * @see RadioConfig - The configuration type for component defaults.
142
87
  */
143
- export declare const RadioGroup: import('react').ForwardRefExoticComponent<RadioGroupProps & import('react').RefAttributes<HTMLDivElement>>;
88
+ export declare const Radio: import('react').ForwardRefExoticComponent<RadioProps & import('react').RefAttributes<HTMLInputElement>>;
89
+ export {};
144
90
  //# sourceMappingURL=Radio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/radio/Radio.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAc,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AAE1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,UAAU,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAKxB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IAEpB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IAExC;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,eAAO,MAAM,UAAU,4GAyEtB,CAAC"}
1
+ {"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/radio/Radio.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAWf,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAC;AAaxB,KAAK,cAAc,GAAG,WAAW,GAC/B,IAAI,CACF,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAC3C,CAAC;AAEJ;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CACT,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KACjC,IAAI,CAAC;CACX;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,KAAK,yGAoNjB,CAAC"}
@@ -1,44 +1,58 @@
1
1
  "use client";
2
2
  "use client";
3
3
  import { cn as e } from "../../utils/cn.js";
4
- import { useAsheeConfig as t } from "../../libs/context.js";
5
- import { resolveCascade as n } from "../../utils/resolve-token.js";
6
- import { FieldShell as r } from "../field/FieldShell.js";
7
- import { FALLBACK_RADIO_CONFIG as i } from "./radio-config.js";
8
- import { RadioContext as a } from "./radio-context.js";
9
- import { forwardRef as o, useId as s } from "react";
10
- import { jsx as c } from "react/jsx-runtime";
4
+ import { RADIUS_CLASS as t } from "../../shared/radius.js";
5
+ import { useAsheeConfig as n } from "../../libs/context.js";
6
+ import { resolveCascade as r, resolveClassKey as i, resolveRadiusKey as ee } from "../../utils/resolve-token.js";
7
+ import { FALLBACK_RADIO_CONFIG as a } from "./radio-config.js";
8
+ import { useRadioGroupContext as o } from "./radio-context.js";
9
+ import { RADIO_COLOR_CLASS as s, RADIO_FONT_SIZE_CLASS as c, RADIO_GAP_CLASS as l, RADIO_INNER_SIZE_CLASS as te, RADIO_OUTER_SIZE_CLASS as ne, RADIO_STATUS_BORDER_CLASS as u } from "./radio-styles.js";
10
+ import { forwardRef as d, useCallback as f, useId as p, useState as m } from "react";
11
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
11
12
  //#region src/components/radio/Radio.tsx
12
- var l = o(({ children: o, name: l, value: u, onChange: d, size: f, color: p, variant: m, orientation: h = "vertical", status: g, label: _, labelAlign: v, description: y, message: b, required: x, disabled: S, className: C }, w) => {
13
- let T = t().components?.radio, E = s(), D = l ?? E, O = g ?? i.status, k = n(v, T?.labelAlign, void 0, i.labelAlign);
14
- return /* @__PURE__ */ c(r, {
15
- id: E,
16
- label: _,
17
- labelAlign: k,
18
- description: y,
19
- message: b,
20
- status: O,
21
- required: x,
22
- children: /* @__PURE__ */ c(a.Provider, {
23
- value: {
24
- name: D,
25
- value: u,
26
- onChange: d,
27
- size: f,
28
- color: p,
29
- variant: m,
30
- disabled: S,
31
- status: O
32
- },
33
- children: /* @__PURE__ */ c("div", {
34
- ref: w,
35
- role: "radiogroup",
36
- className: e("flex", h === "vertical" ? "flex-col gap-2" : "flex-row flex-wrap gap-4", C),
37
- children: o
13
+ var _ = d(({ value: d, size: _, color: v, radius: y, variant: b, status: re, label: x, description: S, id: C, name: w, className: T, style: E, disabled: D, checked: O, defaultChecked: k = !1, onChange: A, ...j }, M) => {
14
+ let N = n(), P = o(), F = N.components?.radio, I = p(), L = C ?? I, R = w ?? P?.name, z = D ?? P?.disabled ?? !1, [B, V] = m(k), H = P ? P.value === d : O ?? B, U = r(_ ?? P?.size, F?.size, void 0, a.size), W = r(b ?? P?.variant, F?.variant, void 0, a.variant), G = r(v ?? P?.color, F?.color, N.defaultColor, a.color), K = re ?? P?.status ?? a.status, q = W === "card", J = ee(y, F?.radius, void 0, a.radius), Y = q && J === "full" ? "xl" : J, X = i(U, ne, a.size), ie = i(U, te, a.size), ae = i(U, c, a.size), oe = i(U, l, a.size), Z = i(J, t, a.radius), se = i(Y, t, "xl"), Q = s[G] ?? s.primary, $ = u[K] ?? u.default, ce = f((e) => {
15
+ z || (P ? P.onChange?.(d) : O === void 0 && V(!0), A?.(e.target.checked, d, e));
16
+ }, [
17
+ O,
18
+ P,
19
+ z,
20
+ A,
21
+ d
22
+ ]);
23
+ return /* @__PURE__ */ g("label", {
24
+ className: e("relative inline-flex items-start select-none cursor-pointer transition-all duration-150 shrink-0", oe, q ? e("p-3 border bg-background", se) : "", q && (H ? `${Q.border} ${Q.cardBg}` : $), z && "opacity-50 pointer-events-none cursor-not-allowed", T),
25
+ style: E,
26
+ children: [
27
+ /* @__PURE__ */ h("input", {
28
+ ref: M,
29
+ id: L,
30
+ type: "radio",
31
+ name: R,
32
+ value: d,
33
+ checked: H,
34
+ disabled: z,
35
+ onChange: ce,
36
+ className: "sr-only peer",
37
+ ...j
38
+ }),
39
+ /* @__PURE__ */ h("div", {
40
+ className: e("shrink-0 flex items-center justify-center border-2 transition-all duration-150 mt-0.5", "peer-focus-visible:ring-2 peer-focus-visible:ring-primary peer-focus-visible:ring-offset-2", X, Z, H ? Q.border : $),
41
+ children: /* @__PURE__ */ h("span", { className: e(ie, Z, Q.bg, "transition-all duration-200 ease-in-out transform-gpu", H ? "scale-100 opacity-100" : "scale-0 opacity-0") })
42
+ }),
43
+ (x || S) && /* @__PURE__ */ g("div", {
44
+ className: "flex flex-col min-w-0",
45
+ children: [x && /* @__PURE__ */ h("span", {
46
+ className: e("font-medium text-foreground leading-snug", ae),
47
+ children: x
48
+ }), S && /* @__PURE__ */ h("span", {
49
+ className: "text-xs sm:text-sm text-foreground/70 leading-snug mt-0.5",
50
+ children: S
51
+ })]
38
52
  })
39
- })
53
+ ]
40
54
  });
41
55
  });
42
- l.displayName = "RadioGroup";
56
+ _.displayName = "Radio";
43
57
  //#endregion
44
- export { l as RadioGroup };
58
+ export { _ as Radio };
@@ -1,90 +1,144 @@
1
- import { ChangeEvent, InputHTMLAttributes, ReactNode } from 'react';
2
- import { RadioConfig } from './radio-config';
3
- type BaseRadioProps = RadioConfig & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange" | "children" | "color">;
1
+ import { ReactNode } from 'react';
2
+ import { Color } from '../../shared';
3
+ import { FieldSizeKey, FieldStatus, LabelAlign } from '../field/field-config';
4
+ import { RadioVariant } from './radio-config';
4
5
  /**
5
- * Configuration options for the Radio component.
6
+ * Configuration options for the RadioGroup component.
6
7
  */
7
- export interface RadioProps extends BaseRadioProps {
8
+ export interface RadioGroupProps {
8
9
  /**
9
- * The value of the radio button.
10
- * Used to identify which radio is selected in a group.
10
+ * Radio components to render inside the group.
11
11
  */
12
- value: string;
12
+ children: ReactNode;
13
13
  /**
14
- * Label text for the radio.
15
- * Displayed next to the radio button.
14
+ * Name attribute for all radio inputs in the group.
15
+ * Auto-generated if not provided.
16
16
  */
17
- label?: ReactNode;
17
+ name?: string;
18
+ /**
19
+ * Controlled selected value.
20
+ */
21
+ value?: string;
22
+ /**
23
+ * Uncontrolled initial selected value.
24
+ */
25
+ defaultValue?: string;
26
+ /**
27
+ * Callback fired when the selection changes.
28
+ * Receives the new selected value.
29
+ */
30
+ onChange?: (value: string) => void;
31
+ /**
32
+ * Size scale for all radios in the group.
33
+ * @default "md"
34
+ */
35
+ size?: FieldSizeKey;
36
+ /**
37
+ * Theme accent color for all radios in the group.
38
+ * @default "primary"
39
+ */
40
+ color?: Color;
41
+ /**
42
+ * Visual style variant for all radios in the group.
43
+ * @default "default"
44
+ */
45
+ variant?: RadioVariant;
46
+ /**
47
+ * Layout orientation of the radio group.
48
+ * - `horizontal`: Radios are laid out in a row.
49
+ * - `vertical`: Radios are laid out in a column.
50
+ * @default "vertical"
51
+ */
52
+ orientation?: "horizontal" | "vertical";
53
+ /**
54
+ * Validation status for the group.
55
+ * @default "default"
56
+ */
57
+ status?: FieldStatus;
58
+ /**
59
+ * Label text for the group.
60
+ */
61
+ label?: string;
62
+ /**
63
+ * Alignment of the label relative to the group.
64
+ * @default "left"
65
+ */
66
+ labelAlign?: LabelAlign;
18
67
  /**
19
68
  * Description text shown below the label.
20
- * Provides additional context for the option.
21
69
  */
22
- description?: ReactNode;
70
+ description?: string;
71
+ /**
72
+ * Validation message shown below the group.
73
+ */
74
+ message?: string;
23
75
  /**
24
- * Whether the radio is checked.
25
- * For controlled usage.
76
+ * Whether the field is required.
77
+ * @default false
26
78
  */
27
- checked?: boolean;
79
+ required?: boolean;
28
80
  /**
29
- * Whether the radio is initially checked.
30
- * For uncontrolled usage.
81
+ * Whether all radios in the group are disabled.
31
82
  * @default false
32
83
  */
33
- defaultChecked?: boolean;
84
+ disabled?: boolean;
34
85
  /**
35
- * Callback fired when the radio state changes.
36
- * Receives the checked state, value, and the change event.
86
+ * Extra CSS classes for the group container.
37
87
  */
38
- onChange?: (checked: boolean, value: string, event: ChangeEvent<HTMLInputElement>) => void;
88
+ className?: string;
39
89
  }
40
90
  /**
41
- * A single radio button with label and description.
42
- *
43
- * Radio renders a circular radio button with an optional label and
44
- * description. It supports controlled and uncontrolled usage, validation
45
- * states, and the standard AsheeUI cascade for visual tokens. When used
46
- * within a RadioGroup, it inherits shared props from the group context.
91
+ * A group of radio buttons that manages shared state and layout.
47
92
  *
48
- * The component automatically handles accessibility attributes including
49
- * proper role, aria-checked, and focus management.
93
+ * RadioGroup wraps multiple Radio components and provides a consistent
94
+ * context for shared props like name, value, size, color, and disabled
95
+ * state. It also handles labeling, validation, and layout through the
96
+ * FieldShell component.
50
97
  *
51
- * @param props - Radio configuration options.
52
- * @param props.value - The value of the radio button.
53
- * @param props.label - Label text for the radio.
54
- * @param props.description - Description text shown below the label.
55
- * @param props.checked - Whether the radio is checked (controlled).
56
- * @param props.defaultChecked - Whether the radio is initially checked (uncontrolled).
57
- * @param props.onChange - Callback fired when the radio state changes.
58
- * @param props.size - Size scale. Defaults to "md".
98
+ * @param props - RadioGroup configuration options.
99
+ * @param props.children - Radio components to render.
100
+ * @param props.name - Name attribute for all radios.
101
+ * @param props.value - Controlled selected value.
102
+ * @param props.defaultValue - Uncontrolled initial selected value.
103
+ * @param props.onChange - Callback fired when selection changes.
104
+ * @param props.size - Size scale for all radios. Defaults to "md".
59
105
  * @param props.color - Theme accent color. Defaults to "primary".
60
106
  * @param props.variant - Visual style variant. Defaults to "default".
61
- * @param props.radius - Corner rounding. Defaults to "full".
62
- * @param props.status - Validation status.
63
- * @param props.disabled - Whether the radio is disabled.
107
+ * @param props.orientation - Layout orientation. Defaults to "vertical".
108
+ * @param props.status - Validation status. Defaults to "default".
109
+ * @param props.label - Label text for the group.
110
+ * @param props.labelAlign - Alignment of the label. Defaults to "left".
111
+ * @param props.description - Description text.
112
+ * @param props.message - Validation message.
113
+ * @param props.required - Whether the field is required.
114
+ * @param props.disabled - Whether all radios are disabled.
115
+ * @param props.className - Extra CSS classes.
64
116
  *
65
117
  * @example
66
118
  * ```tsx
67
- * import { Radio } from "asheeui";
119
+ * import { Radio, RadioGroup } from "asheeui";
68
120
  * import { useState } from "react";
69
121
  *
70
122
  * export function Example() {
71
- * const [checked, setChecked] = useState(false);
123
+ * const [value, setValue] = useState("option-1");
72
124
  *
73
125
  * return (
74
- * <Radio
75
- * value="option-1"
76
- * label="Option 1"
77
- * description="This is the first option"
78
- * checked={checked}
79
- * onChange={(checked) => setChecked(checked)}
80
- * />
126
+ * <RadioGroup
127
+ * label="Choose an option"
128
+ * value={value}
129
+ * onChange={setValue}
130
+ * orientation="horizontal"
131
+ * >
132
+ * <Radio value="option-1" label="Option 1" />
133
+ * <Radio value="option-2" label="Option 2" />
134
+ * <Radio value="option-3" label="Option 3" disabled />
135
+ * </RadioGroup>
81
136
  * );
82
137
  * }
83
138
  * ```
84
139
  *
85
- * @see RadioGroup - The parent component that manages radio groups.
140
+ * @see Radio - The individual radio component.
86
141
  * @see RadioConfig - The configuration type for component defaults.
87
142
  */
88
- export declare const Radio: import('react').ForwardRefExoticComponent<RadioProps & import('react').RefAttributes<HTMLInputElement>>;
89
- export {};
143
+ export declare const RadioGroup: import('react').ForwardRefExoticComponent<RadioGroupProps & import('react').RefAttributes<HTMLDivElement>>;
90
144
  //# sourceMappingURL=RadioGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../src/components/radio/RadioGroup.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAWf,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAC;AAaxB,KAAK,cAAc,GAAG,WAAW,GAC/B,IAAI,CACF,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAC3C,CAAC;AAEJ;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CACT,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KACjC,IAAI,CAAC;CACX;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,KAAK,yGAoNjB,CAAC"}
1
+ {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../src/components/radio/RadioGroup.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAc,KAAK,SAAS,EAAgC,MAAM,OAAO,CAAC;AAEjF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,UAAU,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAKxB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IAEpB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IAExC;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,eAAO,MAAM,UAAU,4GAuGtB,CAAC"}
@@ -2,57 +2,51 @@
2
2
  "use client";
3
3
  import { cn as e } from "../../utils/cn.js";
4
4
  import { useAsheeConfig as t } from "../../libs/context.js";
5
- import { RADIUS_CLASS as n } from "../../shared/radius.js";
6
- import { resolveCascade as r, resolveClassKey as i, resolveRadiusKey as a } from "../../utils/resolve-token.js";
7
- import { FALLBACK_RADIO_CONFIG as o } from "./radio-config.js";
8
- import { useRadioGroupContext as ee } from "./radio-context.js";
9
- import { RADIO_COLOR_CLASS as s, RADIO_FONT_SIZE_CLASS as c, RADIO_GAP_CLASS as te, RADIO_INNER_SIZE_CLASS as l, RADIO_OUTER_SIZE_CLASS as ne, RADIO_STATUS_BORDER_CLASS as u } from "./radio-styles.js";
10
- import { forwardRef as d, useCallback as f, useId as p, useState as m } from "react";
11
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
5
+ import { resolveCascade as n } from "../../utils/resolve-token.js";
6
+ import { FieldShell as r } from "../field/FieldShell.js";
7
+ import { FALLBACK_RADIO_CONFIG as i } from "./radio-config.js";
8
+ import { RadioContext as a } from "./radio-context.js";
9
+ import { forwardRef as o, useCallback as s, useId as c, useState as l } from "react";
10
+ import { jsx as u } from "react/jsx-runtime";
12
11
  //#region src/components/radio/RadioGroup.tsx
13
- var _ = d(({ value: d, size: _, color: v, radius: y, variant: b, status: x, label: S, description: C, id: re, name: w, className: T, style: E, disabled: D, checked: O, defaultChecked: k = !1, onChange: A, ...j }, M) => {
14
- let N = t(), P = ee(), F = N.components?.radio, I = p(), L = re ?? I, R = w ?? P?.name, z = D ?? P?.disabled ?? !1, [B, V] = m(k), H = P ? P.value === d : O ?? B, U = r(_ ?? P?.size, F?.size, void 0, o.size), W = r(b ?? P?.variant, F?.variant, void 0, o.variant), G = r(v ?? P?.color, F?.color, N.defaultColor, o.color), K = x ?? P?.status ?? o.status, q = W === "card", J = a(y, F?.radius, void 0, o.radius), Y = q && J === "full" ? "xl" : J, X = i(U, ne, o.size), ie = i(U, l, o.size), ae = i(U, c, o.size), oe = i(U, te, o.size), Z = i(J, n, o.radius), se = i(Y, n, "xl"), Q = s[G] ?? s.primary, $ = u[K] ?? u.default, ce = f((e) => {
15
- z || (P ? P.onChange?.(d) : O === void 0 && V(!0), A?.(e.target.checked, d, e));
16
- }, [
17
- O,
18
- P,
19
- z,
20
- A,
21
- d
22
- ]);
23
- return /* @__PURE__ */ g("label", {
24
- className: e("relative inline-flex items-start select-none cursor-pointer transition-all duration-150 shrink-0", oe, q ? e("p-3 border bg-background", se) : "", q && (H ? `${Q.border} ${Q.cardBg}` : $), z && "opacity-50 pointer-events-none cursor-not-allowed", T),
25
- style: E,
26
- children: [
27
- /* @__PURE__ */ h("input", {
28
- ref: M,
29
- id: L,
30
- type: "radio",
31
- name: R,
32
- value: d,
33
- checked: H,
34
- disabled: z,
35
- onChange: ce,
36
- className: "sr-only peer",
37
- ...j
38
- }),
39
- /* @__PURE__ */ h("div", {
40
- className: e("shrink-0 flex items-center justify-center border-2 transition-all duration-150 mt-0.5", "peer-focus-visible:ring-2 peer-focus-visible:ring-primary peer-focus-visible:ring-offset-2", X, Z, H ? Q.border : $),
41
- children: /* @__PURE__ */ h("span", { className: e(ie, Z, Q.bg, "transition-all duration-200 ease-in-out transform-gpu", H ? "scale-100 opacity-100" : "scale-0 opacity-0") })
42
- }),
43
- (S || C) && /* @__PURE__ */ g("div", {
44
- className: "flex flex-col min-w-0",
45
- children: [S && /* @__PURE__ */ h("span", {
46
- className: e("font-medium text-foreground leading-snug", ae),
47
- children: S
48
- }), C && /* @__PURE__ */ h("span", {
49
- className: "text-xs sm:text-sm text-foreground/70 leading-snug mt-0.5",
50
- children: C
51
- })]
12
+ var d = o(({ children: o, name: d, value: f, defaultValue: p, onChange: m, size: h, color: g, variant: _, orientation: v = "vertical", status: y, label: b, labelAlign: x, description: S, message: C, required: w, disabled: T, className: E }, D) => {
13
+ let O = t().components?.radio, k = c(), A = d ?? k, [j, M] = l(p), N = f !== void 0, P = N ? f : j, F = s((e) => {
14
+ N || M(e), m?.(e);
15
+ }, [N, m]), I = b ? `${k}-label` : void 0, L = S ? `${k}-description` : void 0, R = C ? `${k}-message` : void 0, z = [L, R].filter(Boolean).join(" ") || void 0, B = y ?? i.status, V = n(x, O?.labelAlign, void 0, i.labelAlign);
16
+ return /* @__PURE__ */ u(r, {
17
+ id: k,
18
+ htmlFor: null,
19
+ labelId: I,
20
+ label: b,
21
+ labelAlign: V,
22
+ description: S,
23
+ descriptionId: L,
24
+ message: C,
25
+ messageId: R,
26
+ status: B,
27
+ required: w,
28
+ children: /* @__PURE__ */ u(a.Provider, {
29
+ value: {
30
+ name: A,
31
+ value: P,
32
+ onChange: F,
33
+ size: h,
34
+ color: g,
35
+ variant: _,
36
+ disabled: T,
37
+ status: B
38
+ },
39
+ children: /* @__PURE__ */ u("div", {
40
+ ref: D,
41
+ role: "radiogroup",
42
+ "aria-labelledby": I,
43
+ "aria-describedby": z,
44
+ className: e("flex", v === "vertical" ? "flex-col gap-2" : "flex-row flex-wrap gap-4", E),
45
+ children: o
52
46
  })
53
- ]
47
+ })
54
48
  });
55
49
  });
56
- _.displayName = "Radio";
50
+ d.displayName = "RadioGroup";
57
51
  //#endregion
58
- export { _ as Radio };
52
+ export { d as RadioGroup };
@@ -1,5 +1,4 @@
1
1
  export * from './Radio';
2
2
  export * from './RadioGroup';
3
3
  export * from './radio-config';
4
- export * from './radio-context';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/radio/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/radio/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}