@sqrzro/ui 4.0.0-alpha.6 → 4.0.0-alpha.60

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 (295) hide show
  1. package/dist/components/buttons/ActionButton/index.d.ts +8 -6
  2. package/dist/components/buttons/ActionButton/index.js +3 -27
  3. package/dist/components/buttons/Button/index.d.ts +7 -6
  4. package/dist/components/buttons/Button/index.js +9 -19
  5. package/dist/components/collections/Collection/index.d.ts +7 -3
  6. package/dist/components/collections/Collection/index.js +9 -7
  7. package/dist/components/collections/DataTable/index.d.ts +14 -0
  8. package/dist/components/collections/DataTable/index.js +14 -0
  9. package/dist/components/collections/DefinitionList/index.d.ts +13 -0
  10. package/dist/components/collections/DefinitionList/index.js +13 -0
  11. package/dist/components/collections/EmptyMessage/index.d.ts +1 -1
  12. package/dist/components/collections/EmptyMessage/index.js +6 -4
  13. package/dist/components/collections/EmptyMessageAction/index.d.ts +2 -2
  14. package/dist/components/collections/EmptyMessageAction/index.js +1 -1
  15. package/dist/components/collections/List/index.d.ts +6 -3
  16. package/dist/components/collections/List/index.js +2 -2
  17. package/dist/components/collections/ListClientComponent/index.d.ts +7 -4
  18. package/dist/components/collections/ListClientComponent/index.js +8 -5
  19. package/dist/components/collections/ListItem/index.d.ts +10 -3
  20. package/dist/components/collections/ListItem/index.js +15 -23
  21. package/dist/components/collections/ListItemMenu/index.d.ts +8 -0
  22. package/dist/components/collections/ListItemMenu/index.js +7 -0
  23. package/dist/components/collections/ListItemMeta/index.d.ts +6 -4
  24. package/dist/components/collections/ListItemMeta/index.js +13 -17
  25. package/dist/components/collections/ListItemSecondary/index.d.ts +5 -3
  26. package/dist/components/collections/ListItemSecondary/index.js +12 -8
  27. package/dist/components/collections/Pagination/index.d.ts +1 -1
  28. package/dist/components/collections/Pagination/index.js +6 -7
  29. package/dist/components/collections/PaginationLink/index.d.ts +9 -0
  30. package/dist/components/collections/PaginationLink/index.js +9 -0
  31. package/dist/components/collections/Table/index.d.ts +3 -4
  32. package/dist/components/collections/Table/index.js +2 -8
  33. package/dist/components/collections/TableClientComponent/index.d.ts +7 -6
  34. package/dist/components/collections/TableClientComponent/index.js +11 -26
  35. package/dist/components/collections/TableRow/index.d.ts +13 -0
  36. package/dist/components/collections/TableRow/index.js +15 -0
  37. package/dist/components/collections/interfaces.d.ts +41 -34
  38. package/dist/components/collections/lang.js +1 -1
  39. package/dist/components/collections/utility/is-paginated.d.ts +1 -1
  40. package/dist/components/collections/utility/is-right-aligned.d.ts +3 -0
  41. package/dist/components/collections/utility/is-right-aligned.js +11 -0
  42. package/dist/components/collections/utility/normalize-href.d.ts +2 -0
  43. package/dist/components/collections/utility/normalize-href.js +8 -0
  44. package/dist/components/collections/utility/render-cell.d.ts +5 -0
  45. package/dist/components/collections/utility/render-cell.js +33 -0
  46. package/dist/components/elements/Badge/index.d.ts +12 -0
  47. package/dist/components/elements/Badge/index.js +9 -0
  48. package/dist/components/elements/ContentLink/index.d.ts +4 -0
  49. package/dist/components/elements/ContentLink/index.js +7 -0
  50. package/dist/components/elements/InfoPanel/index.d.ts +11 -0
  51. package/dist/components/elements/InfoPanel/index.js +9 -0
  52. package/dist/components/{utility → elements}/Link/index.d.ts +3 -2
  53. package/dist/components/{utility → elements}/Link/index.js +10 -9
  54. package/dist/components/elements/Menu/index.d.ts +19 -0
  55. package/dist/components/elements/Menu/index.js +17 -0
  56. package/dist/components/elements/MenuItem/index.d.ts +9 -0
  57. package/dist/components/elements/MenuItem/index.js +12 -0
  58. package/dist/components/elements/Page/index.d.ts +19 -0
  59. package/dist/components/elements/Page/index.js +18 -0
  60. package/dist/components/elements/Reference/index.d.ts +9 -0
  61. package/dist/components/elements/Reference/index.js +16 -0
  62. package/dist/components/elements/Summary/index.d.ts +13 -0
  63. package/dist/components/elements/Summary/index.js +22 -0
  64. package/dist/components/errors/AppError/index.d.ts +19 -0
  65. package/dist/components/errors/AppError/index.js +9 -0
  66. package/dist/components/errors/AppForbiddenError/index.d.ts +7 -0
  67. package/dist/components/errors/AppForbiddenError/index.js +6 -0
  68. package/dist/components/errors/AppNotFoundError/index.d.ts +7 -0
  69. package/dist/components/errors/AppNotFoundError/index.js +6 -0
  70. package/dist/components/errors/AppServerError/index.d.ts +8 -0
  71. package/dist/components/errors/AppServerError/index.js +17 -0
  72. package/dist/components/index.d.ts +35 -6
  73. package/dist/components/index.js +17 -3
  74. package/dist/components/modals/ConfirmModal/index.d.ts +5 -3
  75. package/dist/components/modals/ConfirmModal/index.js +3 -3
  76. package/dist/components/modals/Modal/index.d.ts +4 -4
  77. package/dist/components/modals/Modal/index.js +3 -3
  78. package/dist/components/modals/ModalActions/index.d.ts +3 -3
  79. package/dist/components/modals/ModalActions/index.js +4 -3
  80. package/dist/components/utility/Action/index.d.ts +11 -0
  81. package/dist/components/utility/Action/index.js +48 -0
  82. package/dist/components/utility/ActionList/index.d.ts +5 -5
  83. package/dist/components/utility/ActionList/index.js +5 -3
  84. package/dist/components/utility/AppBody/index.d.ts +5 -0
  85. package/dist/components/utility/AppBody/index.js +9 -0
  86. package/dist/components/utility/Calendar/index.d.ts +32 -0
  87. package/dist/components/utility/Calendar/index.js +66 -0
  88. package/dist/components/utility/CalendarDay/index.d.ts +11 -0
  89. package/dist/components/utility/CalendarDay/index.js +22 -0
  90. package/dist/components/utility/Confirmable/index.d.ts +9 -0
  91. package/dist/components/utility/Confirmable/index.js +14 -0
  92. package/dist/components/utility/Container/index.d.ts +1 -1
  93. package/dist/components/utility/Container/index.js +2 -2
  94. package/dist/components/utility/Loader/index.d.ts +1 -1
  95. package/dist/components/utility/Loader/index.js +5 -4
  96. package/dist/components/utility/Popover/index.d.ts +1 -1
  97. package/dist/components/utility/Popover/index.js +5 -5
  98. package/dist/components/utility/Toast/index.d.ts +2 -2
  99. package/dist/components/utility/Toast/index.js +6 -4
  100. package/dist/components/utility/Toaster/index.js +5 -5
  101. package/dist/filters/components/FilterBar/index.d.ts +5 -2
  102. package/dist/filters/components/FilterBarClientComponent/index.d.ts +2 -4
  103. package/dist/filters/components/FilterBarClientComponent/index.js +3 -43
  104. package/dist/filters/components/FilterClearButton/index.d.ts +7 -2
  105. package/dist/filters/components/FilterClearButton/index.js +8 -4
  106. package/dist/filters/components/FilterControl/index.d.ts +1 -1
  107. package/dist/filters/components/FilterControl/index.js +11 -4
  108. package/dist/filters/components/FilterItem/index.d.ts +2 -1
  109. package/dist/filters/components/FilterItem/index.js +3 -7
  110. package/dist/filters/components/FilterPanel/index.d.ts +1 -1
  111. package/dist/filters/{utility/filter.d.ts → filter.d.ts} +1 -1
  112. package/dist/filters/{utility/filter.js → filter.js} +8 -8
  113. package/dist/filters/filters/BooleanFilter/index.js +1 -1
  114. package/dist/filters/filters/CalendarFilter/index.js +3 -2
  115. package/dist/filters/filters/DateFilter/index.d.ts +1 -1
  116. package/dist/filters/filters/DateFilter/index.js +9 -4
  117. package/dist/filters/filters/DropdownFilter/index.js +1 -1
  118. package/dist/filters/filters/Filter/index.d.ts +5 -4
  119. package/dist/filters/filters/Filter/index.js +7 -7
  120. package/dist/filters/filters/SearchFilter/index.d.ts +7 -2
  121. package/dist/filters/filters/SearchFilter/index.js +8 -8
  122. package/dist/filters/filters/interfaces.d.ts +0 -2
  123. package/dist/filters/index.d.ts +2 -1
  124. package/dist/filters/index.js +2 -1
  125. package/dist/filters/interfaces.d.ts +2 -2
  126. package/dist/filters/utility/render-value.js +5 -5
  127. package/dist/forms/components/Autocomplete/index.d.ts +2 -2
  128. package/dist/forms/components/Autocomplete/index.js +3 -3
  129. package/dist/forms/components/AutocompleteList/index.d.ts +7 -0
  130. package/dist/forms/components/AutocompleteList/index.js +15 -0
  131. package/dist/forms/components/BaseCalendarInput/index.d.ts +11 -0
  132. package/dist/forms/components/BaseCalendarInput/index.js +22 -0
  133. package/dist/forms/components/CSVInput/index.d.ts +11 -0
  134. package/dist/forms/components/CSVInput/index.js +32 -0
  135. package/dist/forms/components/CalendarInput/index.d.ts +6 -0
  136. package/dist/forms/components/CalendarInput/index.js +14 -0
  137. package/dist/forms/components/ColorInput/index.d.ts +16 -0
  138. package/dist/forms/components/ColorInput/index.js +13 -0
  139. package/dist/forms/components/Dropdown/index.d.ts +1 -1
  140. package/dist/forms/components/Dropdown/index.js +9 -8
  141. package/dist/forms/components/DropdownItem/index.d.ts +9 -0
  142. package/dist/forms/components/DropdownItem/index.js +9 -0
  143. package/dist/forms/components/DropdownList/index.d.ts +1 -1
  144. package/dist/forms/components/DropdownList/index.js +7 -11
  145. package/dist/forms/components/EditableForm/index.d.ts +3 -3
  146. package/dist/forms/components/EditableForm/index.js +9 -9
  147. package/dist/forms/components/EditableFormField/index.d.ts +1 -1
  148. package/dist/forms/components/EditableFormField/index.js +3 -3
  149. package/dist/forms/components/EditableFormFields/index.d.ts +6 -0
  150. package/dist/forms/components/EditableFormFields/index.js +22 -1
  151. package/dist/forms/components/Form/index.d.ts +4 -2
  152. package/dist/forms/components/Form/index.js +7 -6
  153. package/dist/forms/components/FormError/index.d.ts +2 -2
  154. package/dist/forms/components/FormError/index.js +7 -5
  155. package/dist/forms/components/FormField/index.d.ts +7 -5
  156. package/dist/forms/components/FormField/index.js +15 -7
  157. package/dist/forms/components/FormFields/index.d.ts +19 -2
  158. package/dist/forms/components/FormFields/index.js +38 -2
  159. package/dist/forms/components/FormLabel/index.d.ts +1 -1
  160. package/dist/forms/components/FormLabel/index.js +4 -3
  161. package/dist/forms/components/ModalForm/index.d.ts +3 -2
  162. package/dist/forms/components/ModalForm/index.js +4 -3
  163. package/dist/forms/components/NumberInput/index.d.ts +1 -1
  164. package/dist/forms/components/PasswordComplexity/index.d.ts +16 -0
  165. package/dist/forms/components/PasswordComplexity/index.js +14 -0
  166. package/dist/forms/components/PasswordComplexityItem/index.d.ts +8 -0
  167. package/dist/forms/components/PasswordComplexityItem/index.js +10 -0
  168. package/dist/forms/components/PasswordInput/index.d.ts +1 -1
  169. package/dist/forms/components/PasswordInput/index.js +6 -6
  170. package/dist/forms/components/PointsInput/index.d.ts +5 -0
  171. package/dist/forms/components/{MoneyInput → PointsInput}/index.js +3 -3
  172. package/dist/forms/components/RangeCalendarInput/index.d.ts +6 -0
  173. package/dist/forms/components/RangeCalendarInput/index.js +14 -0
  174. package/dist/forms/components/StaticTextInput/index.d.ts +2 -2
  175. package/dist/forms/components/StaticTextInput/index.js +6 -7
  176. package/dist/forms/components/Switch/index.d.ts +9 -3
  177. package/dist/forms/components/Switch/index.js +7 -5
  178. package/dist/forms/components/TextArea/index.d.ts +14 -0
  179. package/dist/forms/components/TextArea/index.js +15 -0
  180. package/dist/forms/components/TextInput/index.d.ts +1 -1
  181. package/dist/forms/components/TextInput/index.js +5 -4
  182. package/dist/forms/hooks/useAutocomplete.d.ts +8 -6
  183. package/dist/forms/hooks/useAutocomplete.js +4 -4
  184. package/dist/forms/hooks/useDropdown.d.ts +5 -7
  185. package/dist/forms/hooks/useDropdown.js +5 -5
  186. package/dist/forms/hooks/useEditableDropdown.d.ts +4 -0
  187. package/dist/forms/hooks/useEditableDropdown.js +6 -0
  188. package/dist/forms/hooks/useEditableForm.js +8 -1
  189. package/dist/forms/hooks/useForm.d.ts +6 -7
  190. package/dist/forms/hooks/useForm.js +25 -27
  191. package/dist/forms/hooks/useModalForm.d.ts +2 -2
  192. package/dist/forms/hooks/useModalForm.js +8 -1
  193. package/dist/forms/index.d.ts +22 -6
  194. package/dist/forms/index.js +9 -4
  195. package/dist/forms/interfaces.d.ts +1 -1
  196. package/dist/forms/utility/extract-input-props.js +1 -0
  197. package/dist/forms/utility/format-date-value.d.ts +2 -0
  198. package/dist/forms/utility/format-date-value.js +13 -0
  199. package/dist/forms/utility/format-file-size.d.ts +2 -0
  200. package/dist/forms/utility/format-file-size.js +11 -0
  201. package/dist/hooks/index.d.ts +3 -0
  202. package/dist/hooks/index.js +3 -0
  203. package/dist/hooks/useConfirmable.d.ts +21 -0
  204. package/dist/hooks/useConfirmable.js +58 -0
  205. package/dist/hooks/useDownload.d.ts +2 -0
  206. package/dist/hooks/useDownload.js +18 -0
  207. package/dist/hooks/usePopover.d.ts +12 -0
  208. package/dist/hooks/usePopover.js +24 -0
  209. package/dist/hooks/useSelected.d.ts +12 -0
  210. package/dist/hooks/useSelected.js +35 -0
  211. package/dist/hooks/useServerAction.d.ts +10 -0
  212. package/dist/hooks/useServerAction.js +17 -0
  213. package/dist/hooks/useSuccess.d.ts +10 -0
  214. package/dist/hooks/useSuccess.js +22 -0
  215. package/dist/mail/Mail/index.d.ts +8 -0
  216. package/dist/mail/Mail/index.js +106 -0
  217. package/dist/mail/MailBlock/index.d.ts +5 -0
  218. package/dist/mail/MailBlock/index.js +5 -0
  219. package/dist/mail/MailButton/index.d.ts +8 -0
  220. package/dist/mail/MailButton/index.js +28 -0
  221. package/dist/mail/MailTable/index.d.ts +9 -0
  222. package/dist/mail/MailTable/index.js +7 -0
  223. package/dist/mail/index.d.ts +8 -0
  224. package/dist/mail/index.js +4 -0
  225. package/dist/mail/utility/convert-to-datauri.d.ts +2 -0
  226. package/dist/mail/utility/convert-to-datauri.js +16 -0
  227. package/dist/mail/utility/get-mail-config.d.ts +4 -0
  228. package/dist/mail/utility/get-mail-config.js +34 -0
  229. package/dist/mail/utility/interfaces.d.ts +23 -0
  230. package/dist/navigation/components/AppNavigation/index.d.ts +3 -1
  231. package/dist/navigation/components/AppNavigation/index.js +4 -4
  232. package/dist/navigation/components/AppNavigationItem/index.d.ts +5 -3
  233. package/dist/navigation/components/AppNavigationItem/index.js +16 -7
  234. package/dist/navigation/components/Tabs/index.js +1 -4
  235. package/dist/navigation/hooks/useNavigation.d.ts +3 -3
  236. package/dist/navigation/hooks/useNavigation.js +5 -5
  237. package/dist/styles/classnames/config.d.ts +91 -0
  238. package/dist/styles/classnames/config.js +1 -0
  239. package/dist/styles/classnames/interfaces.d.ts +56 -0
  240. package/dist/styles/classnames/interfaces.js +1 -0
  241. package/dist/styles/classnames/utility/apply-sizes.d.ts +3 -0
  242. package/dist/styles/classnames/utility/apply-sizes.js +21 -0
  243. package/dist/styles/classnames/utility/apply-variants.d.ts +3 -0
  244. package/dist/styles/classnames/utility/apply-variants.js +26 -0
  245. package/dist/styles/classnames/utility/is-classname-object.d.ts +3 -0
  246. package/dist/styles/classnames/utility/is-classname-object.js +7 -0
  247. package/dist/styles/classnames/utility/parse-classnames.d.ts +6 -0
  248. package/dist/styles/classnames/utility/parse-classnames.js +33 -0
  249. package/dist/styles/context.d.ts +28 -0
  250. package/dist/styles/context.js +19 -0
  251. package/dist/styles/icons/config.d.ts +21 -0
  252. package/dist/styles/icons/config.js +1 -0
  253. package/dist/styles/icons/interfaces.d.ts +4 -0
  254. package/dist/styles/icons/interfaces.js +1 -0
  255. package/dist/styles/index.d.ts +6 -2
  256. package/dist/styles/index.js +2 -1
  257. package/dist/styles/styles.css +60 -0
  258. package/dist/utility/compare-dates.d.ts +2 -0
  259. package/dist/utility/compare-dates.js +13 -0
  260. package/dist/utility/get-date-state.d.ts +8 -0
  261. package/dist/utility/get-date-state.js +63 -0
  262. package/dist/utility/get-days.d.ts +2 -0
  263. package/dist/utility/get-days.js +5 -0
  264. package/dist/utility/get-weeks.d.ts +2 -0
  265. package/dist/utility/get-weeks.js +31 -0
  266. package/dist/utility/index.d.ts +1 -1
  267. package/dist/utility/interfaces.d.ts +33 -17
  268. package/dist/utility/is-data-object-array.d.ts +3 -0
  269. package/dist/utility/is-data-object-array.js +5 -0
  270. package/dist/utility/is-data-object.d.ts +3 -0
  271. package/dist/utility/is-data-object.js +4 -0
  272. package/package.json +31 -19
  273. package/dist/components/buttons/ConfirmableButton/index.d.ts +0 -7
  274. package/dist/components/buttons/ConfirmableButton/index.js +0 -13
  275. package/dist/components/collections/utility/filter-columns.d.ts +0 -3
  276. package/dist/components/collections/utility/filter-columns.js +0 -8
  277. package/dist/components/collections/utility/get-selected-from-search-params.d.ts +0 -2
  278. package/dist/components/collections/utility/get-selected-from-search-params.js +0 -5
  279. package/dist/components/collections/utility/set-selected-to-search-params.d.ts +0 -2
  280. package/dist/components/collections/utility/set-selected-to-search-params.js +0 -4
  281. package/dist/components/utility/ClassNames/index.d.ts +0 -6
  282. package/dist/components/utility/ClassNames/index.js +0 -7
  283. package/dist/components/utility/Page/index.d.ts +0 -18
  284. package/dist/components/utility/Page/index.js +0 -34
  285. package/dist/components/utility/RootLayout/index.d.ts +0 -12
  286. package/dist/components/utility/RootLayout/index.js +0 -14
  287. package/dist/forms/components/MoneyInput/index.d.ts +0 -5
  288. package/dist/styles/config.d.ts +0 -64
  289. package/dist/styles/config.js +0 -43
  290. package/dist/styles/icons.d.ts +0 -15
  291. package/dist/styles/icons.js +0 -7
  292. package/dist/styles/interfaces.d.ts +0 -41
  293. /package/dist/{styles → mail/utility}/interfaces.js +0 -0
  294. /package/dist/styles/{tw.d.ts → classnames/utility/tw.d.ts} +0 -0
  295. /package/dist/styles/{tw.js → classnames/utility/tw.js} +0 -0
@@ -1,19 +1,36 @@
1
1
  import type { FormFieldComponentProps } from '../../interfaces';
2
2
  import type { AutocompleteComponentProps } from '../Autocomplete';
3
+ import type { ColorInputComponentProps } from '../ColorInput';
4
+ import type { CalendarInputComponentProps } from '../CalendarInput';
3
5
  import type { DropdownComponentProps } from '../Dropdown';
4
- import type { MoneyInputComponentProps } from '../MoneyInput';
6
+ import type { PointsInputComponentProps } from '../PointsInput';
5
7
  import type { NumberInputComponentProps } from '../NumberInput';
6
8
  import type { PasswordInputComponentProps } from '../PasswordInput';
9
+ import type { RangeCalendarInputComponentProps } from '../RangeCalendarInput';
10
+ import type { SwitchComponentProps } from '../Switch';
11
+ import type { TextAreaComponentProps } from '../TextArea';
7
12
  import type { TextInputComponentProps } from '../TextInput';
8
13
  export type AutocompleteFormFieldProps<T> = FormFieldComponentProps<T | null> & AutocompleteComponentProps<T>;
9
14
  export declare function AutocompleteFormField<T>(props: Readonly<AutocompleteFormFieldProps<T>>): React.ReactElement;
15
+ export type CalendarFormFieldProps = FormFieldComponentProps<Date | null> & CalendarInputComponentProps;
16
+ export declare function CalendarFormField(props: Readonly<CalendarFormFieldProps>): React.ReactElement;
17
+ export type ColorFormFieldProps = FormFieldComponentProps<string> & ColorInputComponentProps;
18
+ export declare function ColorFormField(props: Readonly<ColorFormFieldProps>): React.ReactElement;
19
+ export type CSVFormFieldProps = FormFieldComponentProps<string>;
20
+ export declare function CSVFormField(props: Readonly<CSVFormFieldProps>): React.ReactElement;
10
21
  export type DropdownFormFieldProps<T> = FormFieldComponentProps<T | null> & DropdownComponentProps<T>;
11
22
  export declare function DropdownFormField<T>(props: Readonly<DropdownFormFieldProps<T>>): React.ReactElement;
12
- export type MoneyFormFieldProps = FormFieldComponentProps<number> & MoneyInputComponentProps;
23
+ export type MoneyFormFieldProps = FormFieldComponentProps<number> & PointsInputComponentProps;
13
24
  export declare function MoneyFormField(props: Readonly<MoneyFormFieldProps>): React.ReactElement;
14
25
  export type NumberFormFieldProps = FormFieldComponentProps<number> & NumberInputComponentProps;
15
26
  export declare function NumberFormField(props: Readonly<NumberFormFieldProps>): React.ReactElement;
16
27
  export type PasswordFormFieldProps = FormFieldComponentProps<string> & PasswordInputComponentProps;
17
28
  export declare function PasswordFormField(props: Readonly<PasswordFormFieldProps>): React.ReactElement;
29
+ export type RangeCalendarFormFieldProps = FormFieldComponentProps<[Date, Date] | null> & RangeCalendarInputComponentProps;
30
+ export declare function RangeCalendarFormField(props: Readonly<RangeCalendarFormFieldProps>): React.ReactElement;
31
+ export type SwitchFormFieldProps = FormFieldComponentProps<boolean> & SwitchComponentProps;
32
+ export declare function SwitchFormField(props: SwitchFormFieldProps): React.ReactElement;
18
33
  export type TextFormFieldProps = FormFieldComponentProps<string> & TextInputComponentProps;
19
34
  export declare function TextFormField(props: Readonly<TextFormFieldProps>): React.ReactElement;
35
+ export type TextAreaFormFieldProps = FormFieldComponentProps<string> & TextAreaComponentProps;
36
+ export declare function TextAreaFormField(props: Readonly<TextAreaFormFieldProps>): React.ReactElement;
@@ -2,17 +2,38 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback } from 'react';
3
3
  import extractInputProps from '../../utility/extract-input-props';
4
4
  import Autocomplete from '../Autocomplete';
5
+ import ColorInput from '../ColorInput';
6
+ import CSVInput from '../CSVInput';
7
+ import CalendarInput from '../CalendarInput';
5
8
  import Dropdown from '../Dropdown';
6
9
  import FormField from '../FormField';
7
- import MoneyInput from '../MoneyInput';
10
+ import PointsInput from '../PointsInput';
8
11
  import NumberInput from '../NumberInput';
9
12
  import PasswordInput from '../PasswordInput';
13
+ import RangeCalendarInput from '../RangeCalendarInput';
14
+ import Switch from '../Switch';
15
+ import TextArea from '../TextArea';
10
16
  import TextInput from '../TextInput';
11
17
  export function AutocompleteFormField(props) {
12
18
  const { fieldProps, inputProps } = extractInputProps(props);
13
19
  const renderInput = useCallback((renderProps) => (_jsx(Autocomplete, { ...renderProps, ...inputProps })), [inputProps]);
14
20
  return _jsx(FormField, { ...fieldProps, render: renderInput });
15
21
  }
22
+ export function CalendarFormField(props) {
23
+ const { fieldProps, inputProps } = extractInputProps(props);
24
+ const renderInput = useCallback((renderProps) => (_jsx(CalendarInput, { ...renderProps, ...inputProps })), [inputProps]);
25
+ return _jsx(FormField, { ...fieldProps, render: renderInput });
26
+ }
27
+ export function ColorFormField(props) {
28
+ const { fieldProps, inputProps } = extractInputProps(props);
29
+ const renderInput = useCallback((renderProps) => (_jsx(ColorInput, { ...renderProps, ...inputProps })), [inputProps]);
30
+ return _jsx(FormField, { ...fieldProps, render: renderInput });
31
+ }
32
+ export function CSVFormField(props) {
33
+ const { fieldProps, inputProps } = extractInputProps(props);
34
+ const renderInput = useCallback((renderProps) => (_jsx(CSVInput, { ...renderProps, ...inputProps })), [inputProps]);
35
+ return _jsx(FormField, { ...fieldProps, render: renderInput });
36
+ }
16
37
  export function DropdownFormField(props) {
17
38
  const { fieldProps, inputProps } = extractInputProps(props);
18
39
  const renderInput = useCallback((renderProps) => (_jsx(Dropdown, { ...renderProps, ...inputProps })), [inputProps]);
@@ -20,7 +41,7 @@ export function DropdownFormField(props) {
20
41
  }
21
42
  export function MoneyFormField(props) {
22
43
  const { fieldProps, inputProps } = extractInputProps(props);
23
- const renderInput = useCallback((renderProps) => (_jsx(MoneyInput, { ...renderProps, ...inputProps })), [inputProps]);
44
+ const renderInput = useCallback((renderProps) => (_jsx(PointsInput, { ...renderProps, ...inputProps })), [inputProps]);
24
45
  return _jsx(FormField, { ...fieldProps, render: renderInput });
25
46
  }
26
47
  export function NumberFormField(props) {
@@ -33,8 +54,23 @@ export function PasswordFormField(props) {
33
54
  const renderInput = useCallback((renderProps) => (_jsx(PasswordInput, { ...renderProps, ...inputProps })), [inputProps]);
34
55
  return _jsx(FormField, { ...fieldProps, render: renderInput });
35
56
  }
57
+ export function RangeCalendarFormField(props) {
58
+ const { fieldProps, inputProps } = extractInputProps(props);
59
+ const renderInput = useCallback((renderProps) => (_jsx(RangeCalendarInput, { ...renderProps, ...inputProps })), [inputProps]);
60
+ return _jsx(FormField, { ...fieldProps, render: renderInput });
61
+ }
62
+ export function SwitchFormField(props) {
63
+ const { fieldProps, inputProps } = extractInputProps(props);
64
+ const renderInput = useCallback((renderProps) => (_jsx(Switch, { ...renderProps, ...inputProps })), [inputProps]);
65
+ return _jsx(FormField, { ...fieldProps, hasAssistiveLabel: true, hasAssistiveDetails: true, render: renderInput });
66
+ }
36
67
  export function TextFormField(props) {
37
68
  const { fieldProps, inputProps } = extractInputProps(props);
38
69
  const renderInput = useCallback((renderProps) => (_jsx(TextInput, { ...renderProps, ...inputProps })), [inputProps]);
39
70
  return _jsx(FormField, { ...fieldProps, render: renderInput });
40
71
  }
72
+ export function TextAreaFormField(props) {
73
+ const { fieldProps, inputProps } = extractInputProps(props);
74
+ const renderInput = useCallback((renderProps) => (_jsx(TextArea, { ...renderProps, ...inputProps })), [inputProps]);
75
+ return _jsx(FormField, { ...fieldProps, render: renderInput });
76
+ }
@@ -1,4 +1,4 @@
1
- import type { ClassNameProps } from '../../../styles/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces';
2
2
  import type { FormFieldClassNames } from '../FormField';
3
3
  interface FormLabelProps extends ClassNameProps<FormFieldClassNames> {
4
4
  children: React.ReactNode;
@@ -1,8 +1,9 @@
1
+ 'use client';
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getClassNames } from '../../../styles/config';
3
- import tw from '../../../styles/tw';
3
+ import { useClassNames } from '../../../styles/context';
4
+ import tw from '../../../styles/classnames/utility/tw';
4
5
  function FormLabel({ children, classNames, classNameProps, htmlFor, isAssistive, isOptional, }) {
5
- const componentClassNames = classNames || getClassNames('formField')?.(classNameProps);
6
+ const componentClassNames = useClassNames('formField', { props: classNameProps }, classNames);
6
7
  return (_jsxs("label", { className: tw(componentClassNames?.label, isAssistive ? 'sr-only' : null), htmlFor: htmlFor, children: [children, isOptional ? _jsx("small", { className: componentClassNames?.optional, children: "Optional" }) : null] }));
7
8
  }
8
9
  export default FormLabel;
@@ -3,11 +3,12 @@ import type { FormProps } from '../Form';
3
3
  export interface ModalFormProps {
4
4
  children: React.ReactNode;
5
5
  formProps: Omit<FormProps, 'children'>;
6
- hasServerError?: boolean;
7
6
  hasSubmit?: boolean;
8
7
  isDisabled?: boolean;
9
8
  modalProps: Omit<ModalProps, 'children'>;
9
+ serverError?: string | null;
10
10
  submitLabel?: string;
11
+ validationErrors?: string[];
11
12
  }
12
- declare function ModalForm({ children, formProps, hasServerError, hasSubmit, isDisabled, modalProps, submitLabel, }: Readonly<ModalFormProps>): React.ReactElement;
13
+ declare function ModalForm({ children, formProps, hasSubmit, isDisabled, modalProps, serverError, submitLabel, validationErrors, }: Readonly<ModalFormProps>): React.ReactElement;
13
14
  export default ModalForm;
@@ -4,13 +4,14 @@ import Modal from '../../../components/modals/Modal';
4
4
  import ModalActions from '../../../components/modals/ModalActions';
5
5
  import useSearchParamsHref from '../../../hooks/useSearchParamsHref';
6
6
  import Form from '../Form';
7
- function ModalForm({ children, formProps, hasServerError, hasSubmit = true, isDisabled, modalProps, submitLabel, }) {
7
+ import { InfoPanel } from '../../../components';
8
+ function ModalForm({ children, formProps, hasSubmit = true, isDisabled, modalProps, serverError, submitLabel, validationErrors, }) {
8
9
  const { setSearchParamsHref } = useSearchParamsHref();
9
10
  function handleCancel() {
10
11
  setSearchParamsHref('action', null);
11
12
  }
12
- return (_jsx(Modal, { ...modalProps, children: _jsxs(Form, { ...formProps, children: [children, hasServerError ? _jsx("div", { children: "SERVER ERROR" }) : null, _jsx(ModalActions, { actions: [
13
- { label: 'Cancel', onClick: handleCancel, variant: 'link' },
13
+ return (_jsx(Modal, { ...modalProps, children: _jsxs(Form, { ...formProps, children: [serverError ? _jsx(InfoPanel, { variant: "error", children: serverError }) : null, validationErrors?.length ? (_jsx(InfoPanel, { variant: "error", children: JSON.stringify(validationErrors) })) : null, children, _jsx(ModalActions, { actions: [
14
+ { label: 'Cancel', onClick: handleCancel },
14
15
  ...(modalProps.actions || []),
15
16
  hasSubmit
16
17
  ? {
@@ -1,4 +1,4 @@
1
- import { ClassNameProps } from '../../../styles/interfaces';
1
+ import { ClassNameProps } from '../../../styles/classnames/interfaces';
2
2
  import type { InputProps } from '../../interfaces';
3
3
  import type { TextInputClassNames, TextInputComponentProps } from '../TextInput';
4
4
  export type NumberInputComponentProps = TextInputComponentProps;
@@ -0,0 +1,16 @@
1
+ import { ClassNameProps } from '../../../styles';
2
+ export interface PasswordComplexityClassNames {
3
+ root: string;
4
+ list: string;
5
+ item: string;
6
+ icon: string;
7
+ }
8
+ export interface PasswordComplexityProps extends ClassNameProps<PasswordComplexityClassNames> {
9
+ data: {
10
+ status: boolean;
11
+ value: string;
12
+ }[];
13
+ onComplexity?: (isValid: boolean) => void;
14
+ }
15
+ declare function PasswordComplexity({ classNameProps, classNames, data, onComplexity, }: PasswordComplexityProps): React.ReactElement;
16
+ export default PasswordComplexity;
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useClassNames } from '../../../styles';
4
+ import useDeepCompareEffect from 'use-deep-compare-effect';
5
+ import PasswordComplexityItem from '../PasswordComplexityItem';
6
+ function PasswordComplexity({ classNameProps, classNames, data, onComplexity, }) {
7
+ useDeepCompareEffect(() => {
8
+ onComplexity?.(data.every((item) => item.status));
9
+ }, [data]);
10
+ const isValid = data.every((item) => item.status);
11
+ const componentClassNames = useClassNames('passwordComplexity', { props: { ...classNameProps, isValid } }, classNames);
12
+ return (_jsx("aside", { className: componentClassNames?.root, children: _jsx("ul", { className: componentClassNames?.list, children: data.map((item) => (_jsx(PasswordComplexityItem, { classNameProps: classNameProps, classNames: classNames, isValid: item.status, value: item.value }, item.value))) }) }));
13
+ }
14
+ export default PasswordComplexity;
@@ -0,0 +1,8 @@
1
+ import { ClassNameProps } from '../../../styles';
2
+ import type { PasswordComplexityClassNames } from '../PasswordComplexity';
3
+ interface PasswordComplexityItemProps extends ClassNameProps<PasswordComplexityClassNames> {
4
+ isValid: boolean;
5
+ value: string;
6
+ }
7
+ declare function PasswordComplexityItem({ classNameProps, classNames, isValid, value, }: PasswordComplexityItemProps): React.ReactElement;
8
+ export default PasswordComplexityItem;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useClassNames, useIcon } from '../../../styles';
3
+ function PasswordComplexityItem({ classNameProps, classNames, isValid, value, }) {
4
+ const componentClassNames = useClassNames('passwordComplexity', { props: { ...classNameProps, isValid } }, classNames);
5
+ const InvalidIcon = useIcon('passwordComplexity.invalid');
6
+ const ValidIcon = useIcon('passwordComplexity.valid');
7
+ const Icon = isValid ? ValidIcon : InvalidIcon;
8
+ return (_jsxs("li", { className: componentClassNames?.item, children: [Icon ? (_jsx("div", { className: componentClassNames?.icon, children: _jsx(Icon, {}) })) : null, value] }));
9
+ }
10
+ export default PasswordComplexityItem;
@@ -1,5 +1,5 @@
1
1
  import { InputProps } from '../../../forms/interfaces';
2
- import type { ClassNameProps, SelectableClassName } from '../../../styles/interfaces';
2
+ import type { ClassNameProps, SelectableClassName } from '../../../styles/classnames/interfaces';
3
3
  import type { TextInputComponentProps } from '../TextInput';
4
4
  export interface PasswordInputClassNames {
5
5
  action: string;
@@ -1,17 +1,17 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
- import { getClassNames } from '../../../styles/config';
5
- import { getIcon } from '../../../styles/icons';
6
- import tw from '../../../styles/tw';
4
+ import { useClassNames, useIcon } from '../../../styles/context';
7
5
  import TextInput from '../TextInput';
8
6
  function PasswordInput({ classNameProps, classNames, ...props }) {
9
- const componentClassNames = classNames || getClassNames('passwordInput')?.(classNameProps);
10
- const Icon = getIcon('password');
11
7
  const [isVisible, setIsVisible] = useState(false);
8
+ const componentClassNames = useClassNames('passwordInput', { props: classNameProps, states: { isSelected: isVisible } }, classNames);
9
+ const HiddenIcon = useIcon('passwordInput.hidden');
10
+ const VisibleIcon = useIcon('passwordInput.visible');
11
+ const Icon = isVisible ? VisibleIcon : HiddenIcon;
12
12
  function toggleVisible() {
13
13
  setIsVisible(!isVisible);
14
14
  }
15
- return (_jsxs("div", { className: "relative", children: [_jsx(TextInput, { type: isVisible ? 'text' : 'password', ...props }), _jsx("div", { className: componentClassNames?.action, children: _jsxs("button", { className: tw(componentClassNames?.icon?.default, isVisible ? componentClassNames?.icon?.selected : null), onClick: toggleVisible, type: "button", children: [Icon ? _jsx(Icon, {}) : null, isVisible ? 'Hide' : 'Show'] }) })] }));
15
+ return (_jsxs("div", { className: "relative", children: [_jsx(TextInput, { type: isVisible ? 'text' : 'password', ...props }), _jsx("div", { className: componentClassNames?.action, children: _jsxs("button", { className: componentClassNames?.icon, onClick: toggleVisible, type: "button", children: [Icon ? _jsx(Icon, {}) : null, isVisible ? 'Hide' : 'Show'] }) })] }));
16
16
  }
17
17
  export default PasswordInput;
@@ -0,0 +1,5 @@
1
+ import type { NumberInputComponentProps, NumberInputProps } from '../NumberInput';
2
+ export type PointsInputComponentProps = NumberInputComponentProps;
3
+ export type PointsInputProps = NumberInputProps;
4
+ declare function PointsInput({ name, onChange, value, ...props }: Readonly<PointsInputProps>): React.ReactElement;
5
+ export default PointsInput;
@@ -13,10 +13,10 @@ function getValue(value) {
13
13
  }
14
14
  return value / FACTOR;
15
15
  }
16
- function MoneyInput({ name, onChange, prefix = '£', value, ...props }) {
16
+ function PointsInput({ name, onChange, value, ...props }) {
17
17
  function handleChange(event) {
18
18
  onChange?.({ target: { name, value: setValue(event.target.value) } });
19
19
  }
20
- return (_jsx(NumberInput, { prefix: prefix, ...props, name: name, onChange: handleChange, value: getValue(value) }));
20
+ return _jsx(NumberInput, { ...props, name: name, onChange: handleChange, value: getValue(value) });
21
21
  }
22
- export default MoneyInput;
22
+ export default PointsInput;
@@ -0,0 +1,6 @@
1
+ import { InputProps } from '../../interfaces';
2
+ import { BaseCalendarInputComponentProps } from '../BaseCalendarInput';
3
+ export type RangeCalendarInputComponentProps = BaseCalendarInputComponentProps;
4
+ export type RangeCalendarInputProps = InputProps<[Date, Date] | null> & RangeCalendarInputComponentProps;
5
+ declare function RangeCalendarInput({ name, onChange, value, ...baseProps }: RangeCalendarInputProps): React.ReactElement;
6
+ export default RangeCalendarInput;
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import Calendar from '../../../components/utility/Calendar';
4
+ import BaseCalendarInput from '../BaseCalendarInput';
5
+ function RangeCalendarInput({ name, onChange, value, ...baseProps }) {
6
+ function handleChange(eventValue) {
7
+ onChange?.({ target: { name, value: eventValue } });
8
+ }
9
+ function handleClear() {
10
+ onChange?.({ target: { name, value: null } });
11
+ }
12
+ return (_jsx(BaseCalendarInput, { ...baseProps, name: name, onClear: handleClear, value: value, children: _jsx(Calendar, { isRange: true, onChange: handleChange, value: value }) }));
13
+ }
14
+ export default RangeCalendarInput;
@@ -1,5 +1,5 @@
1
1
  import type { InputProps } from '../../../forms/interfaces';
2
- import type { ClassNameProps, ErrorableClassName } from '../../../styles/interfaces';
2
+ import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces';
3
3
  export interface StaticTextInputClassNames {
4
4
  root: ErrorableClassName;
5
5
  placeholder: string;
@@ -10,7 +10,7 @@ export interface StaticTextInputClassNames {
10
10
  }
11
11
  export interface StaticTextInputProps extends ClassNameProps<StaticTextInputClassNames>, Omit<InputProps<string[] | string, string[] | string>, 'onChange'> {
12
12
  details?: string | null;
13
- label: string;
13
+ label: React.ReactNode;
14
14
  icon?: React.ReactNode;
15
15
  isOptional?: boolean;
16
16
  onClear?: () => void;
@@ -1,8 +1,9 @@
1
+ 'use client';
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { Fragment } from 'react';
3
4
  import Assistive from '../../../components/utility/Assistive';
4
- import { getClassNames } from '../../../styles/config';
5
- import tw from '../../../styles/tw';
5
+ import { useClassNames, useIcon } from '../../../styles/context';
6
+ import tw from '../../../styles/classnames/utility/tw';
6
7
  function hasValue(value) {
7
8
  if (Array.isArray(value)) {
8
9
  return Boolean(value.filter((item) => Boolean(item)).length);
@@ -10,13 +11,11 @@ function hasValue(value) {
10
11
  return Boolean(value);
11
12
  }
12
13
  function StaticTextInput({ classNames, classNameProps, details, hasError, icon, isDisabled, isOptional, label, name, onClear, onClick, onKeyDown, placeholder = 'Select...', value, }) {
13
- const componentClassNames = {
14
- ...getClassNames('staticTextInput')?.(classNameProps),
15
- ...classNames,
16
- };
14
+ const componentClassNames = useClassNames('staticTextInput', { props: classNameProps, states: { isError: hasError ?? false } }, classNames);
15
+ const ClearIcon = useIcon('staticTextInput.clear');
17
16
  function handleClear() {
18
17
  onClear?.();
19
18
  }
20
- return (_jsxs("div", { className: tw('relative', isDisabled ? 'pointer-events-none opacity-30' : null, componentClassNames.root?.default, hasError ? componentClassNames.root?.error : null), children: [_jsx("input", { name: name, type: "hidden", value: value ? value.toString() : '' }), label ? (_jsxs(Fragment, { children: [_jsx("span", { className: tw(componentClassNames.label), children: label }), details ? (_jsx("small", { className: tw(componentClassNames.details), children: details })) : null] })) : (_jsx("span", { className: tw(componentClassNames.placeholder), children: placeholder })), onClick ? (_jsx("button", { className: "absolute -bottom-px -left-px -right-px -top-px", disabled: isDisabled, onClick: onClick, onKeyDown: onKeyDown, tabIndex: 0, type: "button", children: _jsx(Assistive, { children: "Toggle" }) })) : null, _jsxs("div", { className: "absolute bottom-0 right-0 top-0 flex w-0 items-center justify-end", children: [isOptional && hasValue(value) ? (_jsx("button", { className: tw('flex-none', componentClassNames.clear), onClick: handleClear, type: "button", children: _jsx(Assistive, { children: "Clear" }) })) : null, icon && !isDisabled ? (_jsx("i", { className: tw('pointer-events-none flex-none', componentClassNames.icon) })) : null] })] }));
19
+ return (_jsxs("div", { className: tw('relative', componentClassNames?.root, isDisabled ? 'pointer-events-none opacity-30' : null), children: [_jsx("input", { name: name, type: "hidden", value: value ? value.toString() : '' }), label ? (_jsxs(Fragment, { children: [_jsx("span", { className: componentClassNames?.label, children: label }), details ? (_jsx("small", { className: componentClassNames?.details, children: details })) : null] })) : (_jsx("span", { className: componentClassNames?.placeholder, children: placeholder })), onClick ? (_jsx("button", { className: "absolute -bottom-px -left-px -right-px -top-px", disabled: isDisabled, onClick: onClick, onKeyDown: onKeyDown, tabIndex: 0, type: "button", children: _jsx(Assistive, { children: "Toggle" }) })) : null, _jsxs("div", { className: "absolute bottom-0 right-1 top-0 flex w-0 items-center justify-end", children: [isOptional && hasValue(value) ? (_jsxs("button", { className: tw('flex-none', componentClassNames?.clear), onClick: handleClear, type: "button", children: [ClearIcon ? _jsx(ClearIcon, {}) : null, _jsx(Assistive, { children: "Clear" })] })) : null, icon && !isDisabled ? (_jsx("div", { className: tw('pointer-events-none flex-none', componentClassNames?.icon), children: icon })) : null] })] }));
21
20
  }
22
21
  export default StaticTextInput;
@@ -1,11 +1,17 @@
1
1
  import type { InputProps } from '../../../forms/interfaces';
2
- import { CheckableClassName, ClassNameProps } from '../../../styles/interfaces';
2
+ import { CheckableClassName, ClassNameProps } from '../../../styles/classnames/interfaces';
3
3
  export interface SwitchClassNames {
4
4
  root: string;
5
5
  control: string;
6
6
  input: CheckableClassName;
7
7
  icon: CheckableClassName;
8
+ label: string;
9
+ details: string;
8
10
  }
9
- export type SwitchProps = ClassNameProps<SwitchClassNames> & InputProps<boolean>;
10
- declare function Switch({ classNameProps, classNames, id, isDisabled, name, onChange, value, }: Readonly<SwitchProps>): React.ReactElement;
11
+ export type SwitchComponentProps = {
12
+ details?: React.ReactNode;
13
+ label?: React.ReactNode;
14
+ };
15
+ export type SwitchProps = ClassNameProps<SwitchClassNames> & InputProps<boolean> & SwitchComponentProps;
16
+ declare function Switch({ classNameProps, classNames, details, id, isDisabled, label, name, onChange, value, }: Readonly<SwitchProps>): React.ReactElement;
11
17
  export default Switch;
@@ -1,9 +1,11 @@
1
+ 'use client';
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { Fragment } from 'react';
3
- import { getClassNames } from '../../../styles/config';
4
- import tw from '../../../styles/tw';
5
- function Switch({ classNameProps, classNames, id, isDisabled, name, onChange, value, }) {
6
- const componentClassNames = classNames || getClassNames('switch')?.(classNameProps);
4
+ import Assistive from '../../../components/utility/Assistive';
5
+ import { useClassNames } from '../../../styles/context';
6
+ import tw from '../../../styles/classnames/utility/tw';
7
+ function Switch({ classNameProps, classNames, details, id, isDisabled, label, name, onChange, value, }) {
8
+ const componentClassNames = useClassNames('switch', { props: classNameProps, states: { isChecked: Boolean(value) } }, classNames);
7
9
  function handleChange(event) {
8
10
  if (onChange) {
9
11
  const inputEvent = {
@@ -12,6 +14,6 @@ function Switch({ classNameProps, classNames, id, isDisabled, name, onChange, va
12
14
  onChange(inputEvent);
13
15
  }
14
16
  }
15
- return (_jsxs(Fragment, { children: [_jsx("input", { name: name, type: "hidden", value: "false" }), _jsx("div", { className: tw('block', componentClassNames?.root), children: _jsxs("div", { className: tw('relative', componentClassNames?.control), children: [_jsx("input", { "aria-checked": Boolean(value), checked: Boolean(value), className: tw('appearance-none', componentClassNames?.input?.default, value ? componentClassNames?.input?.checked : null), disabled: isDisabled, id: id || name, name: name, onChange: handleChange, type: "checkbox", value: "true" }), _jsx("i", { className: tw(componentClassNames?.icon?.default, value ? componentClassNames?.icon?.checked : null) })] }) })] }));
17
+ return (_jsxs(Fragment, { children: [_jsx("input", { name: name, type: "hidden", value: "false" }), _jsxs("div", { className: tw('block', componentClassNames?.root), children: [_jsxs("div", { className: tw('relative', componentClassNames?.control), children: [_jsx("input", { "aria-checked": Boolean(value), checked: Boolean(value), className: tw('appearance-none', componentClassNames?.input), disabled: isDisabled, id: id || name, name: name, onChange: handleChange, type: "checkbox", value: "true" }), _jsx("i", { className: componentClassNames?.icon })] }), label ? (_jsxs("label", { htmlFor: id || name, children: [_jsx("span", { className: tw('', componentClassNames?.label), children: label }), details ? (_jsx("small", { className: tw('', componentClassNames?.details), children: details })) : null] })) : (_jsx(Assistive, { children: "Yes?" }))] })] }));
16
18
  }
17
19
  export default Switch;
@@ -0,0 +1,14 @@
1
+ import type { InputProps } from '../../../forms/interfaces';
2
+ import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces';
3
+ export interface TextAreaClassNames {
4
+ root: ErrorableClassName;
5
+ }
6
+ export interface TextAreaComponentProps {
7
+ onBlur?: React.EventHandler<React.FocusEvent>;
8
+ onFocus?: React.EventHandler<React.FocusEvent>;
9
+ placeholder?: string;
10
+ rows?: number;
11
+ }
12
+ export type TextAreaProps = ClassNameProps<TextAreaClassNames> & InputProps<string> & TextAreaComponentProps;
13
+ declare function TextArea({ classNames, classNameProps, hasError, id, isDisabled, name, onBlur, onChange, onFocus, onKeyDown, placeholder, rows, value, }: Readonly<TextAreaProps>): React.ReactElement;
14
+ export default TextArea;
@@ -0,0 +1,15 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useClassNames } from '../../../styles/context';
4
+ import tw from '../../../styles/classnames/utility/tw';
5
+ function TextArea({ classNames, classNameProps, hasError, id, isDisabled, name, onBlur, onChange, onFocus, onKeyDown, placeholder, rows = 4, value, }) {
6
+ const componentClassNames = useClassNames('textArea', { props: classNameProps, states: { isError: hasError ?? false } }, classNames);
7
+ function handleChange(event) {
8
+ if (onChange) {
9
+ const target = { name, value: event.target.value };
10
+ onChange({ target });
11
+ }
12
+ }
13
+ return (_jsx("textarea", { "aria-invalid": hasError, "aria-labelledby": hasError ? `${id || name}_err` : undefined /* eslint-disable-line no-undefined */, className: tw('w-full focus-visible:outline-0', isDisabled ? 'pointer-events-none opacity-30' : null, componentClassNames?.root), disabled: isDisabled, id: id || name, name: name, onBlur: onBlur, onChange: handleChange, onFocus: onFocus, onKeyDown: onKeyDown, placeholder: placeholder, rows: rows, value: value || '' }));
14
+ }
15
+ export default TextArea;
@@ -1,5 +1,5 @@
1
1
  import type { InputProps } from '../../../forms/interfaces';
2
- import type { ClassNameProps, ErrorableClassName } from '../../../styles/interfaces';
2
+ import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces';
3
3
  export interface TextInputClassNames {
4
4
  loading: string;
5
5
  prefix: ErrorableClassName;
@@ -1,6 +1,7 @@
1
+ 'use client';
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getClassNames } from '../../../styles/config';
3
- import tw from '../../../styles/tw';
3
+ import { useClassNames } from '../../../styles/context';
4
+ import tw from '../../../styles/classnames/utility/tw';
4
5
  /**
5
6
  *
6
7
  * ## ClassNames
@@ -14,7 +15,7 @@ import tw from '../../../styles/tw';
14
15
  * button itself is handled by the `renderClear` prop. | `string` |
15
16
  */
16
17
  function TextInput({ classNames, classNameProps, hasError, id, isAutocomplete, isDisabled, name, onBlur, onChange, onFocus, onKeyDown, placeholder, prefix, ref, suffix, type, value, }) {
17
- const componentClassNames = classNames || getClassNames('textInput')?.(classNameProps);
18
+ const componentClassNames = useClassNames('textInput', { props: classNameProps, states: { isError: hasError ?? false } }, classNames);
18
19
  function handleChange(event) {
19
20
  if (onChange) {
20
21
  const target = { name, value: event.target.value };
@@ -25,6 +26,6 @@ function TextInput({ classNames, classNameProps, hasError, id, isAutocomplete, i
25
26
  ? `${id || name}_err`
26
27
  : undefined /* eslint-disable-line no-undefined */, autoComplete: isAutocomplete === false
27
28
  ? 'one-time-code'
28
- : undefined /* eslint-disable-line no-undefined */, className: tw('peer w-full focus-visible:outline-0', prefix ? 'border-l-0' : null, (!prefix && suffix) || value ? 'border-r-0' : null, componentClassNames?.root?.default, hasError ? componentClassNames?.root?.error : null), disabled: isDisabled, formNoValidate: true, id: id || name, name: name, onBlur: onBlur, onChange: handleChange, onFocus: onFocus, onKeyDown: onKeyDown, placeholder: placeholder, type: type, value: value || '' }), suffix ? _jsx("div", { children: suffix }) : null] }));
29
+ : undefined /* eslint-disable-line no-undefined */, className: tw('peer w-full focus-visible:outline-0', prefix ? 'border-l-0' : null, (!prefix && suffix) || value ? 'border-r-0' : null, componentClassNames?.root), disabled: isDisabled, formNoValidate: true, id: id || name, name: name, onBlur: onBlur, onChange: handleChange, onFocus: onFocus, onKeyDown: onKeyDown, placeholder: placeholder, type: type, value: value || '' }), suffix ? _jsx("div", { children: suffix }) : null] }));
29
30
  }
30
31
  export default TextInput;
@@ -1,8 +1,10 @@
1
- import { DropdownObject } from '../interfaces';
2
- import { AutocompleteFormFieldProps } from '../components/FormFields';
3
- interface UseAutocompleteArgs<T extends string> {
4
- searchFn: (search: string) => Promise<DropdownObject<T>[]>;
5
- selectFn: (id: T) => Promise<DropdownObject<T> | null>;
1
+ import type { AutocompleteFormFieldProps } from '../components/FormFields';
2
+ import type { DropdownObject } from '../interfaces';
3
+ export interface UseAutocompleteArgs<T extends string, U extends unknown[] = unknown[]> {
4
+ deps?: [...U];
5
+ searchFn: (search: string, ...deps: U) => Promise<DropdownObject<T>[]>;
6
+ selectFn: (id: T, ...deps: U) => Promise<DropdownObject<T> | null>;
6
7
  }
7
- declare function useAutocomplete<T extends string>(props: AutocompleteFormFieldProps<T>, { searchFn, selectFn }: UseAutocompleteArgs<T>): AutocompleteFormFieldProps<T>;
8
+ export type UseAutocompleteReturn<T extends string> = AutocompleteFormFieldProps<T>;
9
+ declare function useAutocomplete<T extends string, U extends unknown[] = unknown[]>(props: AutocompleteFormFieldProps<T>, { searchFn, selectFn, deps }: UseAutocompleteArgs<T, U>): UseAutocompleteReturn<T>;
8
10
  export default useAutocomplete;
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { useEffect, useState } from 'react';
3
- function useAutocomplete(props, { searchFn, selectFn }) {
3
+ function useAutocomplete(props, { searchFn, selectFn, deps }) {
4
4
  const [isLoading, setIsLoading] = useState(false);
5
5
  const [options, setOptions] = useState([]);
6
6
  const [selected, setSelected] = useState(null);
@@ -9,7 +9,7 @@ function useAutocomplete(props, { searchFn, selectFn }) {
9
9
  setSelected(null);
10
10
  return;
11
11
  }
12
- const response = await selectFn(value);
12
+ const response = await selectFn(value, ...(deps ?? []));
13
13
  setOptions([]);
14
14
  setSelected(response);
15
15
  }
@@ -19,13 +19,13 @@ function useAutocomplete(props, { searchFn, selectFn }) {
19
19
  return;
20
20
  }
21
21
  setIsLoading(true);
22
- const response = await searchFn(search);
22
+ const response = await searchFn(search, ...(deps ?? []));
23
23
  setOptions(response);
24
24
  setIsLoading(false);
25
25
  }
26
26
  useEffect(() => {
27
27
  void handleSelect(props.value);
28
- }, [props.value]);
28
+ }, [props.value, ...(deps ?? [])]);
29
29
  return { ...props, isLoading, onSearch: handleSearch, options, selected };
30
30
  }
31
31
  export default useAutocomplete;
@@ -1,10 +1,8 @@
1
1
  import { DropdownObject } from '../interfaces';
2
- interface UseDropdownArgs<T extends string> {
3
- deps?: unknown[];
4
- fn: (...args: unknown[]) => Promise<DropdownObject<T>[]>;
2
+ import { DropdownFormFieldProps } from '../components/FormFields';
3
+ export interface UseDropdownArgs<T extends string, U extends unknown[] = unknown[]> {
4
+ deps?: [...U];
5
+ fn: (...deps: U) => Promise<DropdownObject<T>[]>;
5
6
  }
6
- interface UseDropdownReturn<T extends string> {
7
- data: DropdownObject<T>[];
8
- }
9
- declare function useDropdown<T extends string>({ deps, fn }: UseDropdownArgs<T>): UseDropdownReturn<T>;
7
+ declare function useDropdown<T extends string, U extends unknown[] = unknown[], TProps = DropdownFormFieldProps<T>>(props: TProps, { deps, fn }: UseDropdownArgs<T, U>): TProps;
10
8
  export default useDropdown;
@@ -1,14 +1,14 @@
1
1
  'use client';
2
2
  import { useEffect, useState } from 'react';
3
- function useDropdown({ deps, fn }) {
4
- const [data, setData] = useState([]);
3
+ function useDropdown(props, { deps, fn }) {
4
+ const [options, setOptions] = useState([]);
5
5
  async function getData() {
6
- const response = await (deps ? fn(...deps) : fn());
7
- setData(response);
6
+ const response = await fn(...(deps ?? []));
7
+ setOptions(response);
8
8
  }
9
9
  useEffect(() => {
10
10
  void getData();
11
11
  }, deps || []);
12
- return { data };
12
+ return { ...props, options };
13
13
  }
14
14
  export default useDropdown;
@@ -0,0 +1,4 @@
1
+ import { EditableDropdownFormFieldProps } from '../components/EditableFormFields';
2
+ import { UseDropdownArgs } from './useDropdown';
3
+ declare function useEditableDropdown<T extends string, U extends unknown[] = unknown[]>(props: EditableDropdownFormFieldProps<T>, args: UseDropdownArgs<T, U>): EditableDropdownFormFieldProps<T>;
4
+ export default useEditableDropdown;
@@ -0,0 +1,6 @@
1
+ 'use client';
2
+ import useDropdown from './useDropdown';
3
+ function useEditableDropdown(props, args) {
4
+ return useDropdown(props, args);
5
+ }
6
+ export default useEditableDropdown;
@@ -26,7 +26,14 @@ function useEditableForm({ defaultStatus, onCancel, onEdit, onSuccess, title, ..
26
26
  ...useFormReturn,
27
27
  actionProps: { status, setStatus },
28
28
  fieldProps: editableFieldProps,
29
- formProps: { formProps: useFormReturn.formProps, onCancel, onEdit, status, setStatus, title },
29
+ formProps: {
30
+ formProps: useFormReturn.formProps,
31
+ onCancel,
32
+ onEdit,
33
+ status,
34
+ setStatus,
35
+ title,
36
+ },
30
37
  status,
31
38
  setStatus,
32
39
  };