@sqrzro/ui 4.0.0-alpha.4 → 4.0.0-alpha.41

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 (281) hide show
  1. package/dist/addon/config.d.ts +5 -0
  2. package/dist/addon/config.js +12 -0
  3. package/dist/addon/defaults.d.ts +3 -0
  4. package/dist/addon/defaults.js +6 -0
  5. package/dist/addon/index.d.ts +5 -0
  6. package/dist/addon/index.js +8 -0
  7. package/dist/addon/interfaces.d.ts +8 -0
  8. package/dist/components/buttons/ActionButton/index.d.ts +8 -6
  9. package/dist/components/buttons/ActionButton/index.js +3 -27
  10. package/dist/components/buttons/Button/index.d.ts +5 -5
  11. package/dist/components/buttons/Button/index.js +7 -17
  12. package/dist/components/collections/Collection/index.d.ts +9 -3
  13. package/dist/components/collections/Collection/index.js +8 -7
  14. package/dist/components/collections/DataTable/index.d.ts +14 -0
  15. package/dist/components/collections/DataTable/index.js +14 -0
  16. package/dist/components/collections/EmptyMessage/index.d.ts +1 -1
  17. package/dist/components/collections/EmptyMessage/index.js +6 -4
  18. package/dist/components/collections/EmptyMessageAction/index.d.ts +2 -2
  19. package/dist/components/collections/EmptyMessageAction/index.js +1 -1
  20. package/dist/components/collections/List/index.d.ts +6 -4
  21. package/dist/components/collections/List/index.js +2 -2
  22. package/dist/components/collections/ListClientComponent/index.d.ts +7 -4
  23. package/dist/components/collections/ListClientComponent/index.js +8 -5
  24. package/dist/components/collections/ListItem/index.d.ts +10 -3
  25. package/dist/components/collections/ListItem/index.js +15 -23
  26. package/dist/components/collections/ListItemMenu/index.d.ts +8 -0
  27. package/dist/components/collections/ListItemMenu/index.js +7 -0
  28. package/dist/components/collections/ListItemMeta/index.d.ts +6 -4
  29. package/dist/components/collections/ListItemMeta/index.js +13 -7
  30. package/dist/components/collections/ListItemSecondary/index.d.ts +5 -3
  31. package/dist/components/collections/ListItemSecondary/index.js +5 -5
  32. package/dist/components/collections/Pagination/index.d.ts +1 -1
  33. package/dist/components/collections/Pagination/index.js +6 -7
  34. package/dist/components/collections/PaginationLink/index.d.ts +9 -0
  35. package/dist/components/collections/PaginationLink/index.js +9 -0
  36. package/dist/components/collections/Table/index.d.ts +4 -5
  37. package/dist/components/collections/Table/index.js +2 -8
  38. package/dist/components/collections/TableClientComponent/index.d.ts +7 -6
  39. package/dist/components/collections/TableClientComponent/index.js +11 -26
  40. package/dist/components/collections/TableRow/index.d.ts +13 -0
  41. package/dist/components/collections/TableRow/index.js +15 -0
  42. package/dist/components/collections/interfaces.d.ts +41 -34
  43. package/dist/components/collections/utility/is-right-aligned.d.ts +3 -0
  44. package/dist/components/collections/utility/is-right-aligned.js +11 -0
  45. package/dist/components/collections/utility/normalize-href.d.ts +2 -0
  46. package/dist/components/collections/utility/normalize-href.js +8 -0
  47. package/dist/components/collections/utility/render-cell.d.ts +5 -0
  48. package/dist/components/collections/utility/render-cell.js +33 -0
  49. package/dist/components/elements/Badge/index.d.ts +12 -0
  50. package/dist/components/elements/Badge/index.js +9 -0
  51. package/dist/components/elements/InfoPanel/index.d.ts +11 -0
  52. package/dist/components/elements/InfoPanel/index.js +9 -0
  53. package/dist/components/{utility → elements}/Link/index.d.ts +1 -1
  54. package/dist/components/{utility → elements}/Link/index.js +6 -7
  55. package/dist/components/elements/Menu/index.d.ts +19 -0
  56. package/dist/components/elements/Menu/index.js +17 -0
  57. package/dist/components/elements/MenuItem/index.d.ts +7 -0
  58. package/dist/components/elements/MenuItem/index.js +12 -0
  59. package/dist/components/elements/Page/index.d.ts +19 -0
  60. package/dist/components/elements/Page/index.js +18 -0
  61. package/dist/components/elements/Reference/index.d.ts +9 -0
  62. package/dist/components/elements/Reference/index.js +16 -0
  63. package/dist/components/elements/Summary/index.d.ts +13 -0
  64. package/dist/components/elements/Summary/index.js +22 -0
  65. package/dist/components/errors/AppError/index.d.ts +19 -0
  66. package/dist/components/errors/AppError/index.js +9 -0
  67. package/dist/components/errors/AppForbiddenError/index.d.ts +7 -0
  68. package/dist/components/errors/AppForbiddenError/index.js +6 -0
  69. package/dist/components/errors/AppNotFoundError/index.d.ts +7 -0
  70. package/dist/components/errors/AppNotFoundError/index.js +6 -0
  71. package/dist/components/errors/AppServerError/index.d.ts +8 -0
  72. package/dist/components/errors/AppServerError/index.js +17 -0
  73. package/dist/components/index.d.ts +37 -6
  74. package/dist/components/index.js +18 -3
  75. package/dist/components/mail/Mail/index.d.ts +7 -0
  76. package/dist/components/mail/Mail/index.js +113 -0
  77. package/dist/components/mail/MailBlock/index.d.ts +5 -0
  78. package/dist/components/mail/MailBlock/index.js +5 -0
  79. package/dist/components/mail/MailButton/index.d.ts +7 -0
  80. package/dist/components/mail/MailButton/index.js +38 -0
  81. package/dist/components/mail/MailTable/index.d.ts +9 -0
  82. package/dist/components/mail/MailTable/index.js +7 -0
  83. package/dist/components/modals/ConfirmModal/index.d.ts +5 -3
  84. package/dist/components/modals/ConfirmModal/index.js +3 -3
  85. package/dist/components/modals/Modal/index.d.ts +4 -4
  86. package/dist/components/modals/Modal/index.js +3 -3
  87. package/dist/components/modals/ModalActions/index.d.ts +3 -3
  88. package/dist/components/modals/ModalActions/index.js +4 -3
  89. package/dist/components/utility/Action/index.d.ts +11 -0
  90. package/dist/components/utility/Action/index.js +48 -0
  91. package/dist/components/utility/ActionList/index.d.ts +5 -5
  92. package/dist/components/utility/ActionList/index.js +5 -3
  93. package/dist/components/utility/AppBody/index.d.ts +5 -0
  94. package/dist/components/utility/AppBody/index.js +9 -0
  95. package/dist/components/utility/Calendar/index.d.ts +32 -0
  96. package/dist/components/utility/Calendar/index.js +67 -0
  97. package/dist/components/utility/CalendarDay/index.d.ts +11 -0
  98. package/dist/components/utility/CalendarDay/index.js +23 -0
  99. package/dist/components/utility/Confirmable/index.d.ts +9 -0
  100. package/dist/components/utility/Confirmable/index.js +14 -0
  101. package/dist/components/utility/Container/index.d.ts +1 -1
  102. package/dist/components/utility/Container/index.js +2 -2
  103. package/dist/components/utility/Loader/index.d.ts +1 -1
  104. package/dist/components/utility/Loader/index.js +5 -4
  105. package/dist/components/utility/Popover/index.d.ts +1 -1
  106. package/dist/components/utility/Popover/index.js +5 -5
  107. package/dist/components/utility/Toast/index.d.ts +2 -2
  108. package/dist/components/utility/Toast/index.js +6 -4
  109. package/dist/components/utility/Toaster/index.js +5 -5
  110. package/dist/filters/components/FilterBar/index.d.ts +5 -2
  111. package/dist/filters/components/FilterBarClientComponent/index.d.ts +2 -4
  112. package/dist/filters/components/FilterBarClientComponent/index.js +3 -43
  113. package/dist/filters/components/FilterClearButton/index.d.ts +7 -2
  114. package/dist/filters/components/FilterClearButton/index.js +8 -4
  115. package/dist/filters/components/FilterControl/index.d.ts +1 -1
  116. package/dist/filters/components/FilterControl/index.js +11 -4
  117. package/dist/filters/components/FilterItem/index.d.ts +2 -1
  118. package/dist/filters/components/FilterItem/index.js +3 -7
  119. package/dist/filters/components/FilterPanel/index.d.ts +1 -1
  120. package/dist/filters/{utility/filter.d.ts → filter.d.ts} +1 -1
  121. package/dist/filters/{utility/filter.js → filter.js} +8 -8
  122. package/dist/filters/filters/BooleanFilter/index.js +1 -1
  123. package/dist/filters/filters/CalendarFilter/index.js +3 -2
  124. package/dist/filters/filters/DateFilter/index.d.ts +1 -1
  125. package/dist/filters/filters/DateFilter/index.js +9 -4
  126. package/dist/filters/filters/DropdownFilter/index.js +1 -1
  127. package/dist/filters/filters/Filter/index.d.ts +5 -4
  128. package/dist/filters/filters/Filter/index.js +7 -7
  129. package/dist/filters/filters/SearchFilter/index.d.ts +7 -2
  130. package/dist/filters/filters/SearchFilter/index.js +8 -8
  131. package/dist/filters/filters/interfaces.d.ts +0 -2
  132. package/dist/filters/index.d.ts +2 -1
  133. package/dist/filters/index.js +2 -1
  134. package/dist/filters/interfaces.d.ts +4 -4
  135. package/dist/filters/utility/parse-filters.d.ts +1 -1
  136. package/dist/filters/utility/parse-filters.js +3 -2
  137. package/dist/filters/utility/render-value.js +4 -4
  138. package/dist/filters/utility/transform-boolean.d.ts +1 -1
  139. package/dist/filters/utility/transform-date.d.ts +1 -1
  140. package/dist/filters/utility/transform-multi.d.ts +1 -1
  141. package/dist/forms/components/Autocomplete/index.d.ts +11 -0
  142. package/dist/forms/components/Autocomplete/index.js +37 -0
  143. package/dist/forms/components/CSVInput/index.d.ts +11 -0
  144. package/dist/forms/components/CSVInput/index.js +32 -0
  145. package/dist/forms/components/Dropdown/index.d.ts +1 -1
  146. package/dist/forms/components/Dropdown/index.js +8 -7
  147. package/dist/forms/components/DropdownItem/index.d.ts +9 -0
  148. package/dist/forms/components/DropdownItem/index.js +9 -0
  149. package/dist/forms/components/DropdownList/index.d.ts +1 -1
  150. package/dist/forms/components/DropdownList/index.js +7 -9
  151. package/dist/forms/components/EditableForm/index.d.ts +3 -3
  152. package/dist/forms/components/EditableForm/index.js +9 -9
  153. package/dist/forms/components/EditableFormField/index.d.ts +1 -1
  154. package/dist/forms/components/EditableFormField/index.js +3 -3
  155. package/dist/forms/components/EditableFormFields/index.d.ts +3 -0
  156. package/dist/forms/components/EditableFormFields/index.js +6 -0
  157. package/dist/forms/components/Form/index.d.ts +3 -2
  158. package/dist/forms/components/Form/index.js +5 -5
  159. package/dist/forms/components/FormError/index.d.ts +2 -2
  160. package/dist/forms/components/FormError/index.js +4 -3
  161. package/dist/forms/components/FormField/index.d.ts +4 -4
  162. package/dist/forms/components/FormField/index.js +8 -6
  163. package/dist/forms/components/FormFields/index.d.ts +14 -0
  164. package/dist/forms/components/FormFields/index.js +30 -0
  165. package/dist/forms/components/FormLabel/index.d.ts +1 -1
  166. package/dist/forms/components/FormLabel/index.js +4 -3
  167. package/dist/forms/components/ModalForm/index.js +1 -1
  168. package/dist/forms/components/NumberInput/index.d.ts +7 -0
  169. package/dist/forms/components/NumberInput/index.js +27 -0
  170. package/dist/forms/components/PasswordComplexity/index.d.ts +16 -0
  171. package/dist/forms/components/PasswordComplexity/index.js +14 -0
  172. package/dist/forms/components/PasswordComplexityItem/index.d.ts +8 -0
  173. package/dist/forms/components/PasswordComplexityItem/index.js +10 -0
  174. package/dist/forms/components/PasswordInput/index.d.ts +1 -1
  175. package/dist/forms/components/PasswordInput/index.js +6 -6
  176. package/dist/forms/components/PointsInput/index.d.ts +5 -0
  177. package/dist/forms/components/PointsInput/index.js +22 -0
  178. package/dist/forms/components/RangeCalendarInput/index.d.ts +5 -0
  179. package/dist/forms/components/RangeCalendarInput/index.js +10 -0
  180. package/dist/forms/components/StaticTextInput/index.d.ts +2 -3
  181. package/dist/forms/components/StaticTextInput/index.js +8 -8
  182. package/dist/forms/components/Switch/index.d.ts +1 -1
  183. package/dist/forms/components/Switch/index.js +5 -4
  184. package/dist/forms/components/TextArea/index.d.ts +14 -0
  185. package/dist/forms/components/TextArea/index.js +15 -0
  186. package/dist/forms/components/TextInput/index.d.ts +2 -2
  187. package/dist/forms/components/TextInput/index.js +7 -6
  188. package/dist/forms/hooks/useAutocomplete.d.ts +9 -0
  189. package/dist/forms/hooks/useAutocomplete.js +31 -0
  190. package/dist/forms/hooks/useDropdown.d.ts +2 -2
  191. package/dist/forms/hooks/useForm.d.ts +3 -5
  192. package/dist/forms/hooks/useForm.js +14 -24
  193. package/dist/forms/hooks/useModalForm.d.ts +2 -2
  194. package/dist/forms/index.d.ts +26 -4
  195. package/dist/forms/index.js +11 -3
  196. package/dist/forms/interfaces.d.ts +1 -0
  197. package/dist/forms/utility/format-file-size.d.ts +2 -0
  198. package/dist/forms/utility/format-file-size.js +11 -0
  199. package/dist/hooks/index.d.ts +3 -0
  200. package/dist/hooks/index.js +3 -0
  201. package/dist/hooks/useConfirmable.d.ts +21 -0
  202. package/dist/hooks/useConfirmable.js +58 -0
  203. package/dist/hooks/useDownload.d.ts +2 -0
  204. package/dist/hooks/useDownload.js +18 -0
  205. package/dist/hooks/usePopover.d.ts +12 -0
  206. package/dist/hooks/usePopover.js +24 -0
  207. package/dist/hooks/useSelected.d.ts +12 -0
  208. package/dist/hooks/useSelected.js +35 -0
  209. package/dist/hooks/useServerAction.d.ts +10 -0
  210. package/dist/hooks/useServerAction.js +17 -0
  211. package/dist/hooks/useSuccess.d.ts +10 -0
  212. package/dist/hooks/useSuccess.js +22 -0
  213. package/dist/navigation/components/AppNavigation/index.d.ts +3 -1
  214. package/dist/navigation/components/AppNavigation/index.js +4 -4
  215. package/dist/navigation/components/AppNavigationItem/index.d.ts +5 -3
  216. package/dist/navigation/components/AppNavigationItem/index.js +16 -7
  217. package/dist/navigation/components/Tabs/index.js +1 -4
  218. package/dist/navigation/hooks/useNavigation.d.ts +3 -3
  219. package/dist/navigation/hooks/useNavigation.js +5 -5
  220. package/dist/styles/classnames/config.d.ts +87 -0
  221. package/dist/styles/classnames/config.js +1 -0
  222. package/dist/styles/classnames/interfaces.d.ts +56 -0
  223. package/dist/styles/classnames/interfaces.js +1 -0
  224. package/dist/styles/classnames/utility/apply-sizes.d.ts +3 -0
  225. package/dist/styles/classnames/utility/apply-sizes.js +21 -0
  226. package/dist/styles/classnames/utility/apply-variants.d.ts +3 -0
  227. package/dist/styles/classnames/utility/apply-variants.js +26 -0
  228. package/dist/styles/classnames/utility/is-classname-object.d.ts +3 -0
  229. package/dist/styles/classnames/utility/is-classname-object.js +7 -0
  230. package/dist/styles/classnames/utility/parse-classnames.d.ts +6 -0
  231. package/dist/styles/classnames/utility/parse-classnames.js +33 -0
  232. package/dist/styles/context.d.ts +28 -0
  233. package/dist/styles/context.js +19 -0
  234. package/dist/styles/icons/config.d.ts +20 -0
  235. package/dist/styles/icons/config.js +1 -0
  236. package/dist/styles/icons/interfaces.d.ts +4 -0
  237. package/dist/styles/icons/interfaces.js +1 -0
  238. package/dist/styles/index.d.ts +6 -2
  239. package/dist/styles/index.js +2 -1
  240. package/dist/styles/styles.css +60 -0
  241. package/dist/utility/compare-dates.d.ts +2 -0
  242. package/dist/utility/compare-dates.js +13 -0
  243. package/dist/utility/convert-to-datauri.d.ts +2 -0
  244. package/dist/utility/convert-to-datauri.js +16 -0
  245. package/dist/utility/get-days.d.ts +2 -0
  246. package/dist/utility/get-days.js +5 -0
  247. package/dist/utility/get-weeks.d.ts +2 -0
  248. package/dist/utility/get-weeks.js +31 -0
  249. package/dist/utility/index.d.ts +1 -1
  250. package/dist/utility/interfaces.d.ts +33 -17
  251. package/dist/utility/is-data-object-array.d.ts +3 -0
  252. package/dist/utility/is-data-object-array.js +5 -0
  253. package/dist/utility/is-data-object.d.ts +3 -0
  254. package/dist/utility/is-data-object.js +4 -0
  255. package/dist/utility/is-date-highlighted.d.ts +2 -0
  256. package/dist/utility/is-date-highlighted.js +8 -0
  257. package/dist/utility/is-date-selected.d.ts +2 -0
  258. package/dist/utility/is-date-selected.js +16 -0
  259. package/package.json +28 -16
  260. package/dist/components/buttons/ConfirmableButton/index.d.ts +0 -7
  261. package/dist/components/buttons/ConfirmableButton/index.js +0 -13
  262. package/dist/components/collections/utility/filter-columns.d.ts +0 -3
  263. package/dist/components/collections/utility/filter-columns.js +0 -8
  264. package/dist/components/collections/utility/get-selected-from-search-params.d.ts +0 -2
  265. package/dist/components/collections/utility/get-selected-from-search-params.js +0 -5
  266. package/dist/components/collections/utility/set-selected-to-search-params.d.ts +0 -2
  267. package/dist/components/collections/utility/set-selected-to-search-params.js +0 -4
  268. package/dist/components/utility/ClassNames/index.d.ts +0 -6
  269. package/dist/components/utility/ClassNames/index.js +0 -7
  270. package/dist/components/utility/Page/index.d.ts +0 -18
  271. package/dist/components/utility/Page/index.js +0 -34
  272. package/dist/components/utility/RootLayout/index.d.ts +0 -12
  273. package/dist/components/utility/RootLayout/index.js +0 -14
  274. package/dist/styles/config.d.ts +0 -64
  275. package/dist/styles/config.js +0 -43
  276. package/dist/styles/icons.d.ts +0 -15
  277. package/dist/styles/icons.js +0 -7
  278. package/dist/styles/interfaces.d.ts +0 -41
  279. /package/dist/{styles → addon}/interfaces.js +0 -0
  280. /package/dist/styles/{tw.d.ts → classnames/utility/tw.d.ts} +0 -0
  281. /package/dist/styles/{tw.js → classnames/utility/tw.js} +0 -0
@@ -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,49 @@
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';
3
10
  export type { ListProps } from './collections/List';
4
11
  export { default as List } from './collections/List';
5
12
  export type { TableProps } from './collections/Table';
6
13
  export { default as Table } from './collections/Table';
14
+ export type { BadgeProps } from './elements/Badge';
15
+ export { default as Badge } from './elements/Badge';
16
+ export type { InfoPanelProps } from './elements/InfoPanel';
17
+ export { default as InfoPanel } from './elements/InfoPanel';
18
+ export type { LinkProps } from './elements/Link';
19
+ export { default as Link } from './elements/Link';
20
+ export type { MenuProps } from './elements/Menu';
21
+ export { default as Menu } from './elements/Menu';
22
+ export type { PageProps } from './elements/Page';
23
+ export { default as Page } from './elements/Page';
24
+ export type { ReferenceProps } from './elements/Reference';
25
+ export { default as Reference } from './elements/Reference';
26
+ export type { SummaryProps } from './elements/Summary';
27
+ export { default as Summary } from './elements/Summary';
28
+ export type { AppErrorProps } from './errors/AppError';
29
+ export { default as AppError } from './errors/AppError';
30
+ export type { AppForbiddenErrorProps } from './errors/AppForbiddenError';
31
+ export { default as AppForbiddenError } from './errors/AppForbiddenError';
32
+ export type { AppNotFoundErrorProps } from './errors/AppNotFoundError';
33
+ export { default as AppNotFoundError } from './errors/AppNotFoundError';
34
+ export type { MailProps } from './mail/Mail';
35
+ export { default as Mail } from './mail/Mail';
36
+ export type { MailBlockProps } from './mail/MailBlock';
37
+ export { default as MailBlock } from './mail/MailBlock';
38
+ export type { MailButtonProps } from './mail/MailButton';
39
+ export { default as MailButton } from './mail/MailButton';
40
+ export type { MailTableProps } from './mail/MailTable';
41
+ export { default as MailTable } from './mail/MailTable';
42
+ export type { ModalProps } from './modals/Modal';
43
+ export { default as Modal } from './modals/Modal';
7
44
  export type { ModalLauncherProps } from './modals/ModalLauncher';
8
45
  export { default as ModalLauncher } from './modals/ModalLauncher';
9
46
  export type { ContainerProps } from './utility/Container';
10
47
  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
48
  export type { PopoverProps } from './utility/Popover';
16
49
  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,25 @@
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';
3
6
  export { default as List } from './collections/List';
4
7
  export { default as Table } from './collections/Table';
8
+ export { default as Badge } from './elements/Badge';
9
+ export { default as InfoPanel } from './elements/InfoPanel';
10
+ export { default as Link } from './elements/Link';
11
+ export { default as Menu } from './elements/Menu';
12
+ export { default as Page } from './elements/Page';
13
+ export { default as Reference } from './elements/Reference';
14
+ export { default as Summary } from './elements/Summary';
15
+ export { default as AppError } from './errors/AppError';
16
+ export { default as AppForbiddenError } from './errors/AppForbiddenError';
17
+ export { default as AppNotFoundError } from './errors/AppNotFoundError';
18
+ export { default as Mail } from './mail/Mail';
19
+ export { default as MailBlock } from './mail/MailBlock';
20
+ export { default as MailButton } from './mail/MailButton';
21
+ export { default as MailTable } from './mail/MailTable';
22
+ export { default as Modal } from './modals/Modal';
5
23
  export { default as ModalLauncher } from './modals/ModalLauncher';
6
24
  export { default as Container } from './utility/Container';
7
- export { default as Link } from './utility/Link';
8
- export { default as Page } from './utility/Page';
9
25
  export { default as Popover } from './utility/Popover';
10
- export { default as RootLayout } from './utility/RootLayout';
@@ -0,0 +1,7 @@
1
+ import type { AppConfig } from '@sqrzro/config';
2
+ export type MailProps = AppConfig['mail'] & {
3
+ children: React.ReactNode;
4
+ title: string;
5
+ };
6
+ declare function Mail({ children, logo, styles, title, }: Readonly<MailProps>): Promise<React.ReactElement>;
7
+ export default Mail;
@@ -0,0 +1,113 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /* eslint-disable max-lines-per-function, react/jsx-max-depth, react/no-danger */
3
+ import { Fragment } from 'react';
4
+ import { deepMerge } from '@sqrzro/utility';
5
+ import { getConfig } from '../../../addon/config';
6
+ const DEFAULT_STYLES = {
7
+ styles: {
8
+ root: {
9
+ backgroundColor: '#f5f5f5',
10
+ },
11
+ panel: {
12
+ backgroundColor: '#ffffff',
13
+ padding: 40,
14
+ },
15
+ title: {
16
+ color: '#62748e',
17
+ fontSize: 20,
18
+ fontWeight: 'bold',
19
+ },
20
+ },
21
+ };
22
+ const HALF = 2;
23
+ async function Mail({ children, logo, styles, title, }) {
24
+ const styleConfig = deepMerge(DEFAULT_STYLES?.styles || {}, getConfig().app.mail?.styles || {}, styles || {});
25
+ const logoData = await (await import('../../../utility/convert-to-datauri')).default(logo ?? getConfig().app.mail?.logo ?? '');
26
+ return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charSet: "utf-8" }), _jsx("style", { dangerouslySetInnerHTML: {
27
+ __html: `
28
+ body {
29
+ color: #0f172b !important;
30
+ font-family: -apple-system, 'SF Pro Display', 'SF Pro Text', 'Helvetica', sans-serif;
31
+ font-size: 16px;
32
+ font-weight:400;
33
+ line-height: 24px;
34
+ margin: 0;
35
+ padding: 0;
36
+ }
37
+ @media print {
38
+ body {
39
+ font-size: 14px !important;
40
+ line-height: 21px !important;
41
+ }
42
+ .container {
43
+ width: 100% !important;
44
+ }
45
+ .padding {
46
+ height: auto !important;
47
+ width: auto !important;
48
+ }
49
+ }
50
+ `,
51
+ } })] }), _jsx("body", { children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: "100%", children: _jsxs("tbody", { children: [_jsx("tr", { children: _jsx("td", { className: "padding", colSpan: 3, height: "20", style: { backgroundColor: styleConfig.root.backgroundColor } }) }), _jsxs("tr", { children: [_jsx("td", { className: "padding", style: { backgroundColor: styleConfig.root.backgroundColor }, width: "20" }), _jsx("td", { align: "center", style: { backgroundColor: styleConfig.root.backgroundColor }, children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, className: "container", width: "650", children: _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { className: "padding", height: "20", style: {
52
+ backgroundColor: styleConfig.panel.backgroundColor,
53
+ }, width: "20", children: _jsx("div", { className: "padding", style: {
54
+ backgroundColor: styleConfig.root.backgroundColor,
55
+ height: styleConfig.panel.padding,
56
+ width: styleConfig.panel.padding,
57
+ }, children: _jsx("div", { className: "padding", style: {
58
+ backgroundColor: styleConfig.panel.backgroundColor,
59
+ borderTopLeftRadius: styleConfig.panel.padding / HALF,
60
+ height: styleConfig.panel.padding,
61
+ width: styleConfig.panel.padding,
62
+ } }) }) }), _jsx("td", { className: "container", style: {
63
+ backgroundColor: styleConfig.panel.backgroundColor,
64
+ }, width: "610" }), _jsx("td", { className: "padding", height: styleConfig.panel.padding, style: {
65
+ backgroundColor: styleConfig.panel.backgroundColor,
66
+ }, width: styleConfig.panel.padding, children: _jsx("div", { className: "padding", style: {
67
+ backgroundColor: styleConfig.root.backgroundColor,
68
+ height: styleConfig.panel.padding,
69
+ width: styleConfig.panel.padding,
70
+ }, children: _jsx("div", { className: "padding", style: {
71
+ backgroundColor: styleConfig.panel.backgroundColor,
72
+ borderTopRightRadius: styleConfig.panel.padding / HALF,
73
+ height: styleConfig.panel.padding,
74
+ width: styleConfig.panel.padding,
75
+ } }) }) })] }), _jsxs("tr", { children: [_jsx("td", { className: "padding", style: {
76
+ backgroundColor: styleConfig.panel.backgroundColor,
77
+ }, width: styleConfig.panel.padding }), _jsx("td", { style: {
78
+ backgroundColor: styleConfig.panel.backgroundColor,
79
+ }, children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: "100%", children: _jsxs("tbody", { children: [logoData ? (_jsxs(Fragment, { children: [_jsx("tr", { children: _jsx("td", { children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: 240, children: _jsx("tbody", { children: _jsx("tr", { children: _jsx("td", { children: _jsx("img", { alt: "Logo", src: logoData, width: 240 }) }) }) }) }) }) }), _jsx("tr", { children: _jsx("td", { height: styleConfig.panel
80
+ .padding }) })] })) : null, _jsx("tr", { children: _jsx("td", { style: {
81
+ color: styleConfig.title.color,
82
+ fontSize: styleConfig.title.fontSize,
83
+ fontWeight: styleConfig.title
84
+ .fontWeight,
85
+ }, children: title }) }), _jsx("tr", { children: _jsx("td", { height: styleConfig.panel.padding }) }), _jsx("tr", { children: _jsx("td", { children: children }) })] }) }) }), _jsx("td", { className: "padding", style: {
86
+ backgroundColor: styleConfig.panel.backgroundColor,
87
+ }, width: styleConfig.panel.padding })] }), _jsxs("tr", { children: [_jsx("td", { className: "padding", height: styleConfig.panel.padding, style: {
88
+ backgroundColor: styleConfig.panel.backgroundColor,
89
+ }, width: styleConfig.panel.padding, children: _jsx("div", { className: "padding", style: {
90
+ backgroundColor: styleConfig.root.backgroundColor,
91
+ height: styleConfig.panel.padding,
92
+ width: styleConfig.panel.padding,
93
+ }, children: _jsx("div", { className: "padding", style: {
94
+ backgroundColor: styleConfig.panel.backgroundColor,
95
+ borderBottomLeftRadius: styleConfig.panel.padding / HALF,
96
+ height: styleConfig.panel.padding,
97
+ width: styleConfig.panel.padding,
98
+ } }) }) }), _jsx("td", { className: "container", style: {
99
+ backgroundColor: styleConfig.panel.backgroundColor,
100
+ }, width: "610" }), _jsx("td", { className: "padding", height: styleConfig.panel.padding, style: {
101
+ backgroundColor: styleConfig.panel.backgroundColor,
102
+ }, width: styleConfig.panel.padding, children: _jsx("div", { className: "padding", style: {
103
+ backgroundColor: styleConfig.root.backgroundColor,
104
+ height: styleConfig.panel.padding,
105
+ width: styleConfig.panel.padding,
106
+ }, children: _jsx("div", { className: "padding", style: {
107
+ backgroundColor: styleConfig.panel.backgroundColor,
108
+ borderBottomRightRadius: styleConfig.panel.padding / HALF,
109
+ height: styleConfig.panel.padding,
110
+ width: styleConfig.panel.padding,
111
+ } }) }) })] })] }) }) }), _jsx("td", { className: "padding", style: { backgroundColor: styleConfig.root.backgroundColor }, width: "20" })] }), _jsx("tr", { children: _jsx("td", { className: "padding", colSpan: 3, height: "20", style: { backgroundColor: styleConfig.root.backgroundColor } }) })] }) }) })] }));
112
+ }
113
+ export default Mail;
@@ -0,0 +1,5 @@
1
+ export interface MailBlockProps {
2
+ children: React.ReactNode;
3
+ }
4
+ declare function MailBlock({ children }: Readonly<MailBlockProps>): React.ReactElement;
5
+ export default MailBlock;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ function MailBlock({ children }) {
3
+ return _jsx("div", { style: { marginBottom: 30 }, children: children });
4
+ }
5
+ export default MailBlock;
@@ -0,0 +1,7 @@
1
+ import type { AppConfig } from '@sqrzro/config';
2
+ export type MailButtonProps = AppConfig['mail'] & {
3
+ children: string;
4
+ href: string;
5
+ };
6
+ declare function MailButton({ children, href, styles }: Readonly<MailButtonProps>): React.ReactElement;
7
+ export default MailButton;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { deepMerge } from '@sqrzro/utility';
3
+ import { getConfig } from '../../../addon/config';
4
+ const DEFAULT_STYLES = {
5
+ styles: {
6
+ button: {
7
+ backgroundColor: '#f26c25',
8
+ borderRadius: 20,
9
+ color: '#ffffff',
10
+ height: 40,
11
+ },
12
+ },
13
+ };
14
+ function calculateWidth(text) {
15
+ const characterWidth = 8;
16
+ const padding = 50;
17
+ return text.length * characterWidth + padding;
18
+ }
19
+ function MailButton({ children, href, styles }) {
20
+ const styleConfig = deepMerge(DEFAULT_STYLES?.styles || {}, getConfig().app.mail?.styles || {}, styles || {});
21
+ const calculatedWidth = calculateWidth(children);
22
+ return (_jsx("div", { dangerouslySetInnerHTML: {
23
+ __html: `
24
+ <!--[if mso]>
25
+ <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${href}" style="height:${styleConfig.button.height}px;v-text-anchor:middle;width:${calculatedWidth}px;" arcsize="50%" stroke="f" fillcolor="${styleConfig.button.backgroundColor}">
26
+ <w:anchorlock/>
27
+ <center>
28
+ <![endif]-->
29
+ <a href="${href}"
30
+ style="background-color:${styleConfig.button.backgroundColor};border-radius:${styleConfig.button.borderRadius}px;color:${styleConfig.button.color};display:inline-block;font-weight:bold;line-height:${styleConfig.button.height}px;text-align:center;text-decoration:none;width:${calculatedWidth}px;-webkit-text-size-adjust:none;">${children}</a>
31
+ <!--[if mso]>
32
+ </center>
33
+ </v:roundrect>
34
+ <![endif]-->
35
+ `,
36
+ } }));
37
+ }
38
+ export default MailButton;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export interface MailTableProps {
3
+ data: {
4
+ title: React.ReactNode;
5
+ value: React.ReactNode;
6
+ }[];
7
+ }
8
+ declare function MailTable({ data }: Readonly<MailTableProps>): React.ReactElement;
9
+ export default MailTable;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
3
+ const EVEN_NUMBER = 2;
4
+ function MailTable({ data }) {
5
+ return (_jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, style: { marginBottom: 30 }, width: "100%", children: _jsxs("tbody", { children: [data.map(({ title, value }, index) => (_jsxs(Fragment, { children: [_jsx("tr", { children: _jsx("td", { colSpan: 5, height: 1, style: { backgroundColor: '#cccccc' } }) }), _jsx("tr", { children: _jsx("td", { colSpan: 5, height: 10, style: { backgroundColor: index % EVEN_NUMBER ? '' : '#f7f7f7' } }) }), _jsxs("tr", { children: [_jsx("td", { style: { backgroundColor: index % EVEN_NUMBER ? '' : '#f7f7f7' }, width: 10 }), _jsx("td", { style: { backgroundColor: index % EVEN_NUMBER ? '' : '#f7f7f7' }, children: title }), _jsx("td", { style: { backgroundColor: index % EVEN_NUMBER ? '' : '#f7f7f7' }, width: 20 }), _jsx("td", { align: "right", style: { backgroundColor: index % EVEN_NUMBER ? '' : '#f7f7f7' }, children: value }), _jsx("td", { style: { backgroundColor: index % EVEN_NUMBER ? '' : '#f7f7f7' }, width: 10 })] }), _jsx("tr", { children: _jsx("td", { colSpan: 5, height: 10, style: { backgroundColor: index % EVEN_NUMBER ? '' : '#f7f7f7' } }) })] }, index))), _jsx("tr", { children: _jsx("td", { colSpan: 5, height: 1, style: { backgroundColor: '#cccccc' } }) })] }) }));
6
+ }
7
+ export default MailTable;
@@ -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;