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

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 +14 -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 +22 -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
@@ -0,0 +1,13 @@
1
+ import type { DataObject } from '../../../utility/interfaces';
2
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces';
3
+ export interface SummaryClassNames {
4
+ root: string;
5
+ item: string;
6
+ label: string;
7
+ value: string;
8
+ }
9
+ export interface SummaryProps extends ClassNameProps<SummaryClassNames> {
10
+ data: (DataObject | null)[];
11
+ }
12
+ declare function Summary({ classNameProps, classNames, data, }: Readonly<SummaryProps>): React.ReactElement | null;
13
+ export default Summary;
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { filterNull } from '@sqrzro/utility';
4
+ import { useClassNames } from '../../../styles/context';
5
+ import tw from '../../../styles/classnames/utility/tw';
6
+ const colMap = {
7
+ 1: 'grid-cols-1',
8
+ 2: 'grid-cols-2',
9
+ 3: 'grid-cols-3',
10
+ 4: 'grid-cols-4',
11
+ 5: 'grid-cols-5',
12
+ 6: 'grid-cols-6',
13
+ };
14
+ function Summary({ classNameProps, classNames, data, }) {
15
+ const componentClassNames = useClassNames('summary', { props: classNameProps }, classNames);
16
+ const filtered = filterNull(data);
17
+ if (!filtered.length) {
18
+ return null;
19
+ }
20
+ return (_jsx("dl", { className: tw(componentClassNames?.root, colMap[Object.keys(filtered).length]), children: filtered.map(({ label, value }, index) => (_jsxs("div", { className: componentClassNames?.item, children: [_jsx("dt", { className: componentClassNames?.label, children: label }), _jsx("dd", { className: componentClassNames?.value, children: value })] }, index))) }));
21
+ }
22
+ export default Summary;
@@ -0,0 +1,19 @@
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces';
2
+ import type { SimpleActionObject } from '../../../utility/interfaces';
3
+ export interface AppErrorClassNames {
4
+ root: string;
5
+ panel: string;
6
+ title: string;
7
+ description: string;
8
+ action: string;
9
+ }
10
+ export interface AppErrorProps extends ClassNameProps<AppErrorClassNames> {
11
+ action?: SimpleActionObject;
12
+ description: React.ReactNode;
13
+ error: Error & {
14
+ digest?: string;
15
+ };
16
+ title: React.ReactNode;
17
+ }
18
+ declare function AppError({ action, classNameProps, classNames, description, error, title, }: Readonly<AppErrorProps>): React.ReactElement;
19
+ export default AppError;
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import ActionButton from '../../../components/buttons/ActionButton';
4
+ import { useClassNames } from '../../../styles/context';
5
+ function AppError({ action, classNameProps, classNames, description, error, title, }) {
6
+ const componentClassNames = useClassNames('appError', { props: classNameProps }, classNames);
7
+ return (_jsx("div", { className: componentClassNames?.root, children: _jsxs("section", { className: componentClassNames?.panel, children: [_jsx("h2", { className: componentClassNames?.title, children: title }), _jsxs("div", { className: componentClassNames?.description, children: [description, error?.digest ? _jsxs("small", { children: ["Error code: ", error.digest] }) : null] }), action ? (_jsx("footer", { className: componentClassNames?.action, children: _jsx(ActionButton, { ...action }) })) : null] }) }));
8
+ }
9
+ export default AppError;
@@ -0,0 +1,7 @@
1
+ import type { AppErrorProps } from '../AppError';
2
+ export interface AppForbiddenErrorProps extends Omit<AppErrorProps, 'action' | 'description' | 'title'> {
3
+ description?: React.ReactNode;
4
+ title?: React.ReactNode;
5
+ }
6
+ declare function AppForbiddenError({ description, title, ...props }: AppForbiddenErrorProps): React.ReactElement;
7
+ export default AppForbiddenError;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import AppError from '../AppError';
3
+ function AppForbiddenError({ description = 'You do not have permission to access this resource. If you think this is a mistake, please contact your site administrator.', title = 'Forbidden', ...props }) {
4
+ return (_jsx(AppError, { ...props, action: { href: '/', label: 'Go to Homepage' }, description: description, title: title }));
5
+ }
6
+ export default AppForbiddenError;
@@ -0,0 +1,7 @@
1
+ import type { AppErrorProps } from '../AppError';
2
+ export interface AppNotFoundErrorProps extends Omit<AppErrorProps, 'action' | 'description' | 'title'> {
3
+ description?: React.ReactNode;
4
+ title?: React.ReactNode;
5
+ }
6
+ declare function AppNotFoundError({ description, title, ...props }: AppNotFoundErrorProps): React.ReactElement;
7
+ export default AppNotFoundError;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import AppError from '../AppError';
3
+ function AppNotFoundError({ description = 'The requested resource could not be found. This might be because it has been moved or deleted. If you think this is a mistake, please contact your site administrator.', title = 'Not Found', ...props }) {
4
+ return (_jsx(AppError, { ...props, action: { href: '/', label: 'Go to Homepage' }, description: description, title: title }));
5
+ }
6
+ export default AppNotFoundError;
@@ -0,0 +1,8 @@
1
+ import type { AppErrorProps } from '../AppError';
2
+ interface AppServerErrorProps extends Omit<AppErrorProps, 'action' | 'description' | 'title'> {
3
+ description?: React.ReactNode;
4
+ reset: () => void;
5
+ title?: React.ReactNode;
6
+ }
7
+ declare function AppServerError({ description, reset, title, ...props }: AppServerErrorProps): React.ReactElement;
8
+ export default AppServerError;
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useState } from 'react';
4
+ import AppError from '../AppError';
5
+ const WAIT_TIME = 500;
6
+ function AppServerError({ description = 'The server encountered an error and could not complete your request. If the problem persists, please contact your site administrator.', reset, title = 'Something Went Wrong', ...props }) {
7
+ const [isResetting, setIsResetting] = useState(false);
8
+ function handleReset() {
9
+ setIsResetting(true);
10
+ setTimeout(() => {
11
+ reset();
12
+ setIsResetting(false);
13
+ }, WAIT_TIME);
14
+ }
15
+ return (_jsx(AppError, { ...props, action: { isDisabled: isResetting, onClick: handleReset, label: 'Try Again' }, description: description, title: title }));
16
+ }
17
+ export default AppServerError;
@@ -1,18 +1,47 @@
1
1
  export * from './collections/interfaces';
2
+ export type { ActionButtonProps } from './buttons/ActionButton';
2
3
  export { default as ActionButton } from './buttons/ActionButton';
4
+ export type { AppBodyProps } from './utility/AppBody';
5
+ export { default as AppBody } from './utility/AppBody';
6
+ export type { ButtonProps } from './buttons/Button';
7
+ export { default as Button } from './buttons/Button';
8
+ export type { DataTableProps } from './collections/DataTable';
9
+ export { default as DataTable } from './collections/DataTable';
10
+ export type { DefinitionListProps } from './collections/DefinitionList';
11
+ export { default as DefinitionList } from './collections/DefinitionList';
12
+ export type { EmptyMessageProps } from './collections/EmptyMessage';
13
+ export { default as EmptyMessage } from './collections/EmptyMessage';
3
14
  export type { ListProps } from './collections/List';
4
15
  export { default as List } from './collections/List';
5
16
  export type { TableProps } from './collections/Table';
6
17
  export { default as Table } from './collections/Table';
18
+ export type { ContentLinkProps } from './elements/ContentLink';
19
+ export { default as ContentLink } from './elements/ContentLink';
20
+ export type { BadgeProps } from './elements/Badge';
21
+ export { default as Badge } from './elements/Badge';
22
+ export type { InfoPanelProps } from './elements/InfoPanel';
23
+ export { default as InfoPanel } from './elements/InfoPanel';
24
+ export type { LinkProps } from './elements/Link';
25
+ export { default as Link } from './elements/Link';
26
+ export type { MenuProps } from './elements/Menu';
27
+ export { default as Menu } from './elements/Menu';
28
+ export type { PageProps } from './elements/Page';
29
+ export { default as Page } from './elements/Page';
30
+ export type { ReferenceProps } from './elements/Reference';
31
+ export { default as Reference } from './elements/Reference';
32
+ export type { SummaryProps } from './elements/Summary';
33
+ export { default as Summary } from './elements/Summary';
34
+ export type { AppErrorProps } from './errors/AppError';
35
+ export { default as AppError } from './errors/AppError';
36
+ export type { AppForbiddenErrorProps } from './errors/AppForbiddenError';
37
+ export { default as AppForbiddenError } from './errors/AppForbiddenError';
38
+ export type { AppNotFoundErrorProps } from './errors/AppNotFoundError';
39
+ export { default as AppNotFoundError } from './errors/AppNotFoundError';
40
+ export type { ModalProps } from './modals/Modal';
41
+ export { default as Modal } from './modals/Modal';
7
42
  export type { ModalLauncherProps } from './modals/ModalLauncher';
8
43
  export { default as ModalLauncher } from './modals/ModalLauncher';
9
44
  export type { ContainerProps } from './utility/Container';
10
45
  export { default as Container } from './utility/Container';
11
- export type { LinkProps } from './utility/Link';
12
- export { default as Link } from './utility/Link';
13
- export type { PageProps } from './utility/Page';
14
- export { default as Page } from './utility/Page';
15
46
  export type { PopoverProps } from './utility/Popover';
16
47
  export { default as Popover } from './utility/Popover';
17
- export type { RootLayoutProps } from './utility/RootLayout';
18
- export { default as RootLayout } from './utility/RootLayout';
@@ -1,10 +1,24 @@
1
1
  export * from './collections/interfaces';
2
2
  export { default as ActionButton } from './buttons/ActionButton';
3
+ export { default as AppBody } from './utility/AppBody';
4
+ export { default as Button } from './buttons/Button';
5
+ export { default as DataTable } from './collections/DataTable';
6
+ export { default as DefinitionList } from './collections/DefinitionList';
7
+ export { default as EmptyMessage } from './collections/EmptyMessage';
3
8
  export { default as List } from './collections/List';
4
9
  export { default as Table } from './collections/Table';
10
+ export { default as ContentLink } from './elements/ContentLink';
11
+ export { default as Badge } from './elements/Badge';
12
+ export { default as InfoPanel } from './elements/InfoPanel';
13
+ export { default as Link } from './elements/Link';
14
+ export { default as Menu } from './elements/Menu';
15
+ export { default as Page } from './elements/Page';
16
+ export { default as Reference } from './elements/Reference';
17
+ export { default as Summary } from './elements/Summary';
18
+ export { default as AppError } from './errors/AppError';
19
+ export { default as AppForbiddenError } from './errors/AppForbiddenError';
20
+ export { default as AppNotFoundError } from './errors/AppNotFoundError';
21
+ export { default as Modal } from './modals/Modal';
5
22
  export { default as ModalLauncher } from './modals/ModalLauncher';
6
23
  export { default as Container } from './utility/Container';
7
- export { default as Link } from './utility/Link';
8
- export { default as Page } from './utility/Page';
9
24
  export { default as Popover } from './utility/Popover';
10
- export { default as RootLayout } from './utility/RootLayout';
@@ -1,7 +1,9 @@
1
1
  import { ConfirmableObject } from '../../../utility/interfaces';
2
2
  import type { ModalProps } from '../Modal';
3
- export type ConfirmModalProps = Omit<ModalProps, 'children' | 'icon' | 'title'> & {
4
- confirmable: ConfirmableObject;
3
+ export type ConfirmModalProps<Data, Response> = Omit<ModalProps, 'children' | 'icon' | 'title'> & {
4
+ confirmable: ConfirmableObject<Data, Response>;
5
+ onCancel: () => void;
6
+ onConfirm: () => void;
5
7
  };
6
- declare function ConfirmModal({ confirmable, ...modalProps }: Readonly<ConfirmModalProps>): React.ReactElement;
8
+ declare function ConfirmModal<Data, Response>({ confirmable, onCancel, onConfirm, ...modalProps }: Readonly<ConfirmModalProps<Data, Response>>): React.ReactElement;
7
9
  export default ConfirmModal;
@@ -3,19 +3,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Fragment, useState } from 'react';
4
4
  import TextInput from '../../../forms/components/TextInput';
5
5
  import Modal from '../Modal';
6
- function ConfirmModal({ confirmable, ...modalProps }) {
6
+ function ConfirmModal({ confirmable, onCancel, onConfirm, ...modalProps }) {
7
7
  const [confirmText, setConfirmText] = useState('');
8
8
  function handleChange(event) {
9
9
  setConfirmText(event.target.value?.toUpperCase() || '');
10
10
  }
11
11
  return (_jsxs(Modal, { ...modalProps, actions: [
12
- { label: 'Cancel', variant: 'link' },
12
+ { label: 'Cancel', onClick: onCancel },
13
13
  ...(confirmable.actions || []),
14
14
  {
15
15
  isDisabled: Boolean(confirmable.confirmText &&
16
16
  confirmText !== confirmable.confirmText.toUpperCase()),
17
17
  label: confirmable.submitLabel || 'Confirm',
18
- onClick: confirmable.onConfirm,
18
+ onClick: onConfirm,
19
19
  variant: 'primary',
20
20
  },
21
21
  ], title: confirmable.title || 'Are you sure?', children: [confirmable.description || 'This action cannot be undone.', confirmable.confirmText ? (_jsxs(Fragment, { children: [_jsxs("p", { children: ["Please type ", _jsx("strong", { children: confirmable.confirmText.toUpperCase() }), " to confirm"] }), _jsx(TextInput, { name: "confirm", onChange: handleChange, value: confirmText })] })) : null] }));
@@ -1,5 +1,5 @@
1
- import type { ClassNameProps } from '../../../styles/interfaces';
2
- import { Action } from '../../../utility/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces';
2
+ import { SimpleActionObject } from '../../../utility/interfaces';
3
3
  export interface ModalClassNames {
4
4
  actions: string;
5
5
  content: string;
@@ -9,11 +9,11 @@ export interface ModalClassNames {
9
9
  title: string;
10
10
  }
11
11
  export interface ModalProps extends ClassNameProps<ModalClassNames> {
12
- actions?: Action[];
12
+ actions?: SimpleActionObject[];
13
13
  children: React.ReactNode;
14
14
  icon?: React.ReactNode;
15
15
  isLoading?: boolean;
16
- title?: string;
16
+ title?: React.ReactNode;
17
17
  }
18
18
  declare function Modal({ actions, children, classNames, classNameProps, icon, isLoading, title, }: Readonly<ModalProps>): React.ReactElement | null;
19
19
  export default Modal;
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useRef } from 'react';
4
- import { getClassNames } from '../../../styles/config';
5
- import tw from '../../../styles/tw';
4
+ import { useClassNames } from '../../../styles/context';
5
+ import tw from '../../../styles/classnames/utility/tw';
6
6
  import ModalActions from '../ModalActions';
7
7
  function Modal({ actions, children, classNames, classNameProps, icon, isLoading, title, }) {
8
- const componentClassNames = classNames || getClassNames('modal')?.(classNameProps);
8
+ const componentClassNames = useClassNames('modal', { props: classNameProps }, classNames);
9
9
  const ref = useRef(null);
10
10
  useEffect(() => {
11
11
  if (ref.current) {
@@ -1,8 +1,8 @@
1
- import type { ClassNameProps } from '../../../styles/interfaces';
2
- import { Action } from '../../../utility/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces';
2
+ import { SimpleActionObject } from '../../../utility/interfaces';
3
3
  import type { ModalClassNames } from '../Modal';
4
4
  export interface ModalActionsProps extends ClassNameProps<ModalClassNames> {
5
- actions: (Action | null)[];
5
+ actions: (SimpleActionObject | null)[];
6
6
  isLoading?: boolean;
7
7
  }
8
8
  declare function ModalActions({ actions, classNameProps, classNames, isLoading, }: Readonly<ModalActionsProps>): React.ReactElement;
@@ -1,8 +1,9 @@
1
+ 'use client';
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import ActionList from '../../../components/utility/ActionList';
3
- import { getClassNames } from '../../../styles/config';
4
+ import { useClassNames } from '../../../styles/context';
4
5
  function ModalActions({ actions, classNameProps, classNames, isLoading, }) {
5
- const componentClassNames = classNames || getClassNames('modal')?.(classNameProps);
6
- return (_jsx("footer", { className: componentClassNames?.actions, children: _jsx(ActionList, { actions: actions, classNameProps: { ...(classNameProps || {}), isModal: true }, isLoading: isLoading }) }));
6
+ const componentClassNames = useClassNames('modal', { props: classNameProps }, classNames);
7
+ return (_jsx("footer", { className: componentClassNames?.actions, children: _jsx(ActionList, { actions: actions, classNameProps: { ...classNameProps, isModal: true }, isLoading: isLoading }) }));
7
8
  }
8
9
  export default ModalActions;
@@ -0,0 +1,11 @@
1
+ import type { ActionObject } from '../../../utility/interfaces';
2
+ export interface ActionProps<Data, Response> extends Omit<ActionObject<Data, Response>, 'details' | 'label'> {
3
+ readonly children?: React.ReactNode;
4
+ readonly label?: React.ReactNode;
5
+ readonly render: (props: ActionComponentProps<Data, Response>) => React.ReactElement;
6
+ }
7
+ export interface ActionComponentProps<Data, Response> extends Pick<ActionProps<Data, Response>, 'action' | 'confirmable' | 'data' | 'href' | 'icon' | 'isDisabled' | 'isLoading' | 'isSubmittable' | 'onClick' | 'onSuccess' | 'searchParams' | 'variant'> {
8
+ children: React.ReactNode;
9
+ }
10
+ declare function Action<Data, Response>(props: ActionProps<Data, Response>): React.ReactElement;
11
+ export default Action;
@@ -0,0 +1,48 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Suspense } from 'react';
4
+ import useSearchParamsHref from '../../../hooks/useSearchParamsHref';
5
+ import useServerAction from '../../../hooks/useServerAction';
6
+ import Confirmable from '../Confirmable';
7
+ function ActionComponent({ action, children, confirmable, data, href, icon, isDisabled, isLoading, isSubmittable, label, onClick, onSuccess, refreshOnSuccess, redirectOnSuccess, searchParams, render, variant, }) {
8
+ const { setSearchParamsHref } = useSearchParamsHref();
9
+ async function handleAction() {
10
+ return action?.(data);
11
+ }
12
+ const serverActionOptions = {
13
+ onSuccess,
14
+ refreshOnSuccess,
15
+ redirectOnSuccess,
16
+ };
17
+ const { handleClick: handleActionClick, isLoading: isActionLoading } = useServerAction(handleAction, serverActionOptions);
18
+ function handleClick() {
19
+ if (action) {
20
+ handleActionClick();
21
+ }
22
+ else {
23
+ onClick?.();
24
+ }
25
+ if (searchParams) {
26
+ setSearchParamsHref(searchParams);
27
+ }
28
+ }
29
+ const componentProps = {
30
+ children: children ?? label,
31
+ href,
32
+ icon,
33
+ isDisabled: Boolean(isDisabled || isLoading || isActionLoading),
34
+ isLoading: isLoading || isActionLoading,
35
+ isSubmittable: Boolean(isSubmittable),
36
+ onClick: handleClick,
37
+ onSuccess,
38
+ variant,
39
+ };
40
+ if (confirmable) {
41
+ return (_jsx(Confirmable, { confirmable: confirmable, renderProps: componentProps, render: render }));
42
+ }
43
+ return render(componentProps);
44
+ }
45
+ function Action(props) {
46
+ return (_jsx(Suspense, { children: _jsx(ActionComponent, { ...props }) }));
47
+ }
48
+ export default Action;
@@ -1,12 +1,12 @@
1
- import type { ClassNameProps } from '../../../styles/interfaces';
2
- import { Action } from '../../../utility/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces';
2
+ import { ActionObject } from '../../../utility/interfaces';
3
3
  export interface ActionListClassNames {
4
4
  root: string;
5
5
  item: string;
6
6
  }
7
- export interface ActionListProps extends ClassNameProps<ActionListClassNames> {
8
- actions: (Action | null)[];
7
+ export interface ActionListProps<Data, Response> extends ClassNameProps<ActionListClassNames> {
8
+ actions: (ActionObject<Data, Response> | null)[];
9
9
  isLoading?: boolean;
10
10
  }
11
- declare function ActionList({ actions, classNameProps, classNames, isLoading, }: Readonly<ActionListProps>): React.ReactElement;
11
+ declare function ActionList<Data, Response>({ actions, classNameProps, classNames, isLoading, }: Readonly<ActionListProps<Data, Response>>): React.ReactElement;
12
12
  export default ActionList;
@@ -1,9 +1,11 @@
1
+ 'use client';
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import { filterNull } from '@sqrzro/utility';
3
4
  import ActionButton from '../../../components/buttons/ActionButton';
4
- import { getClassNames } from '../../../styles/config';
5
+ import { useClassNames } from '../../../styles/context';
5
6
  function ActionList({ actions, classNameProps, classNames, isLoading, }) {
6
- const componentClassNames = classNames || getClassNames('actionList')?.(classNameProps);
7
- return (_jsx("ul", { className: componentClassNames?.root, children: filterNull(actions).map((action, index) => (_jsx("li", { className: componentClassNames?.item, children: _jsx(ActionButton, { ...action, isLoading: Boolean(isLoading || action.isDisabled) }) }, index))) }));
7
+ const componentClassNames = useClassNames('actionList', { props: classNameProps }, classNames);
8
+ const filteredActions = filterNull(actions);
9
+ return (_jsx("ul", { className: componentClassNames?.root, children: filteredActions.map((action, index) => (_jsx("li", { className: componentClassNames?.item, children: _jsx(ActionButton, { ...action, isLoading: Boolean(isLoading || action.isLoading) }) }, index))) }));
8
10
  }
9
11
  export default ActionList;
@@ -0,0 +1,5 @@
1
+ export interface AppBodyProps {
2
+ readonly children: React.ReactNode;
3
+ }
4
+ declare function AppBody({ children }: AppBodyProps): React.ReactElement;
5
+ export default AppBody;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
3
+ import Toaster from '../../../components/utility/Toaster';
4
+ function AppBody({ children }) {
5
+ return (_jsxs(Fragment, { children: [_jsx("script", { dangerouslySetInnerHTML: {
6
+ __html: "(function(d){var v=d.createElement('div'),t=d.createElement('style'),s=v.style;s.overflowY='scroll';s.width='50';s.height='50';d.body.append(v);t.innerHTML='body:has([data-modal][open]){padding-right:'+(v.offsetWidth-v.clientWidth)+'px}';d.body.append(t);v.remove()}(document))",
7
+ } }), _jsxs("div", { className: "flex min-h-screen flex-col", children: [children, _jsx(Toaster, {})] })] }));
8
+ }
9
+ export default AppBody;
@@ -0,0 +1,32 @@
1
+ import { ClassNameProps } from '../../../styles/classnames/interfaces';
2
+ export interface CalendarClassNames {
3
+ root: string;
4
+ header: string;
5
+ title: string;
6
+ navigation: string;
7
+ month: string;
8
+ control: string;
9
+ head: string;
10
+ day: string;
11
+ }
12
+ interface BaseCalendarProps extends ClassNameProps<CalendarClassNames> {
13
+ disabledDates?: Date[] | ((date: Date) => boolean);
14
+ }
15
+ interface CalendarPropsWithoutRange extends BaseCalendarProps {
16
+ isRange?: false;
17
+ onChange?: (date: Date | null) => void;
18
+ value?: Date | null;
19
+ }
20
+ interface CalendarPropsWithRange extends BaseCalendarProps {
21
+ isRange: true;
22
+ onChange?: (date: [Date, Date] | null) => void;
23
+ value?: [Date, Date] | null;
24
+ }
25
+ export interface CalendarProps extends BaseCalendarProps {
26
+ isRange?: boolean;
27
+ onChange?: ((date: Date | null) => void) | ((date: [Date, Date] | null) => void);
28
+ value?: Date | [Date, Date] | null;
29
+ }
30
+ declare function Calendar(props: CalendarPropsWithRange): React.ReactElement;
31
+ declare function Calendar(props: CalendarPropsWithoutRange): React.ReactElement;
32
+ export default Calendar;
@@ -0,0 +1,66 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Fragment, useState } from 'react';
4
+ import tw from '../../../styles/classnames/utility/tw';
5
+ import getDays from '../../../utility/get-days';
6
+ import getDateState from '../../../utility/get-date-state';
7
+ import getWeeks from '../../../utility/get-weeks';
8
+ import CalendarDay from '../CalendarDay';
9
+ import { useClassNames, useIcon } from '../../../styles/context';
10
+ function sortDates(dates) {
11
+ return dates[0] > dates[1] ? [dates[1], dates[0]] : [dates[0], dates[1]];
12
+ }
13
+ function makeValidDate(date) {
14
+ if (date.toString() === 'Invalid Date') {
15
+ return new Date();
16
+ }
17
+ return new Date(date);
18
+ }
19
+ function getActiveDate(value) {
20
+ if (!value || (Array.isArray(value) && !value.length)) {
21
+ return new Date();
22
+ }
23
+ return makeValidDate(Array.isArray(value) ? value[0] : value);
24
+ }
25
+ function Calendar({ classNameProps, classNames, isRange, onChange, value, }) {
26
+ const componentClassNames = useClassNames('calendar', { props: classNameProps }, classNames);
27
+ const NextIcon = useIcon('calendar.next');
28
+ const PreviousIcon = useIcon('calendar.previous');
29
+ const [date, setDate] = useState(getActiveDate(value));
30
+ /*
31
+ * `pendingValue` is used when the BaseCalendar takes a date range, to select the first date in
32
+ * the range without affecting the onChange handlers or anything higher up the chain. Only when
33
+ * the second date has been selected will the handlers fire.
34
+ */
35
+ const [pendingValue, setPendingValue] = useState(null);
36
+ function handleMonth(offset) {
37
+ const newDate = new Date(date);
38
+ newDate.setDate(1);
39
+ newDate.setMonth(date.getMonth() + offset);
40
+ setDate(newDate);
41
+ }
42
+ function handlePrevious() {
43
+ handleMonth(-1);
44
+ }
45
+ function handleNext() {
46
+ handleMonth(1);
47
+ }
48
+ function handleChange(date) {
49
+ if (!onChange) {
50
+ return;
51
+ }
52
+ if (!isRange) {
53
+ onChange(date);
54
+ return;
55
+ }
56
+ if (pendingValue) {
57
+ onChange(sortDates([pendingValue, date]));
58
+ setPendingValue(null);
59
+ return;
60
+ }
61
+ onChange(null);
62
+ setPendingValue(date);
63
+ }
64
+ return (_jsxs("div", { className: componentClassNames?.root, children: [_jsxs("div", { className: componentClassNames?.header, children: [_jsx("p", { className: componentClassNames?.title, children: new Intl.DateTimeFormat('en-GB', { month: 'long', year: 'numeric' }).format(date) }), _jsx("button", { className: componentClassNames?.navigation, onClick: handlePrevious, type: "button", children: PreviousIcon ? (_jsxs(Fragment, { children: [_jsx(PreviousIcon, {}), _jsx("span", { className: "sr-only", children: "Previous" })] })) : ('Previous') }), _jsx("button", { className: componentClassNames?.navigation, onClick: handleNext, type: "button", children: NextIcon ? (_jsxs(Fragment, { children: [_jsx(NextIcon, {}), _jsx("span", { className: "sr-only", children: "Next" })] })) : ('Next') })] }), _jsxs("table", { className: tw('w-full', componentClassNames?.month), children: [_jsx("thead", { children: _jsx("tr", { children: getDays().map((item) => (_jsx("th", { className: componentClassNames?.head, children: item }, item))) }) }), _jsx("tbody", { children: getWeeks(date).map((days) => (_jsx("tr", { children: days.map((day, index) => (_jsx(CalendarDay, { date: day, state: getDateState(day, pendingValue, value), onClick: handleChange }, day ? day.toString() : index))) }, days.map((d) => d?.toString()).join('-')))) })] })] }));
65
+ }
66
+ export default Calendar;
@@ -0,0 +1,11 @@
1
+ import { ClassNameProps } from '../../../styles/classnames/interfaces';
2
+ import type { DateState } from '../../../utility/get-date-state';
3
+ import type { CalendarClassNames } from '../Calendar';
4
+ interface CalendarDayProps extends ClassNameProps<CalendarClassNames> {
5
+ date: Date | null;
6
+ onClick?: (date: Date) => void;
7
+ isDisabled?: boolean;
8
+ state: DateState;
9
+ }
10
+ declare function CalendarDay({ classNames, classNameProps, date, isDisabled, onClick, state, }: Readonly<CalendarDayProps>): React.ReactElement;
11
+ export default CalendarDay;
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useClassNames } from '../../../styles/context';
4
+ function CalendarDay({ classNames, classNameProps, date, isDisabled, onClick, state, }) {
5
+ const componentClassNames = useClassNames('calendar', {
6
+ props: {
7
+ ...classNameProps,
8
+ ...state,
9
+ },
10
+ }, classNames);
11
+ if (date === null) {
12
+ return _jsx("td", { className: componentClassNames?.day });
13
+ }
14
+ function handleClick() {
15
+ if (onClick && date instanceof Date) {
16
+ onClick(date);
17
+ }
18
+ }
19
+ const day = new Intl.DateTimeFormat('en-GB', { day: 'numeric' }).format(date);
20
+ return (_jsx("td", { className: componentClassNames?.day, children: _jsx("button", { className: componentClassNames?.control, disabled: isDisabled, onClick: handleClick, type: "button", children: _jsx("span", { children: day }) }) }));
21
+ }
22
+ export default CalendarDay;
@@ -0,0 +1,9 @@
1
+ import { ButtonProps } from '../../../components/buttons/Button';
2
+ import type { ConfirmableObject } from '../../../utility/interfaces';
3
+ export interface ConfirmableProps<Data, Response> {
4
+ confirmable: ConfirmableObject<Data, Response>;
5
+ renderProps: ButtonProps;
6
+ render: (props: ButtonProps) => React.ReactElement;
7
+ }
8
+ declare function Confirmable<Data, Response>({ confirmable, renderProps, render, }: Readonly<ConfirmableProps<Data, Response>>): React.ReactElement;
9
+ export default Confirmable;
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Fragment } from 'react';
4
+ import useConfirmable from '../../../hooks/useConfirmable';
5
+ import ConfirmModal from '../../modals/ConfirmModal';
6
+ function Confirmable({ confirmable, renderProps, render, }) {
7
+ const { handle, isOpen, modalProps } = useConfirmable({
8
+ isLoading: renderProps.isLoading,
9
+ onConfirm: (event) => renderProps.onClick?.(event),
10
+ refreshOnSuccess: true,
11
+ });
12
+ return (_jsxs(Fragment, { children: [render({ ...renderProps, isLoading: renderProps.isLoading, onClick: handle }), isOpen ? _jsx(ConfirmModal, { confirmable: confirmable, ...modalProps }) : null] }));
13
+ }
14
+ export default Confirmable;
@@ -1,4 +1,4 @@
1
- import type { ClassNameProps } from '../../../styles/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces';
2
2
  export interface ContainerClassNames {
3
3
  root: string;
4
4
  }
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { getClassNames } from '../../../styles/config';
3
+ import { useClassNames } from '../../../styles/context';
4
4
  function Container({ children, classNameProps, classNames, }) {
5
- const componentClassNames = classNames || getClassNames('container')?.(classNameProps);
5
+ const componentClassNames = useClassNames('container', { props: classNameProps }, classNames);
6
6
  return _jsx("div", { className: componentClassNames?.root, children: children });
7
7
  }
8
8
  export default Container;
@@ -1,4 +1,4 @@
1
- import type { ClassNameProps, SizableClassName } from '../../../styles/interfaces';
1
+ import type { ClassNameProps, SizableClassName } from '../../../styles/classnames/interfaces';
2
2
  export interface LoaderClassNames {
3
3
  root?: SizableClassName;
4
4
  inner?: SizableClassName;