@sqrzro/admin 2.0.0-beta.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/.turbo/turbo-docs.log +0 -0
  2. package/.turbo/turbo-lint.log +112 -0
  3. package/.turbo/turbo-prettier.log +215 -0
  4. package/.turbo/turbo-test.log +6 -0
  5. package/dist/components/Alert/index.d.ts +4 -26
  6. package/dist/components/Alert/index.js +15 -54
  7. package/dist/components/Allow/index.d.ts +20 -20
  8. package/dist/components/Allow/index.js +29 -29
  9. package/dist/components/AppLayout/AppLayout.stories.d.ts +5 -5
  10. package/dist/components/AppLayout/AppLayout.stories.js +11 -11
  11. package/dist/components/AppLayout/index.d.ts +6 -6
  12. package/dist/components/AppLayout/index.js +18 -11
  13. package/dist/components/AutoSuggest/index.d.ts +74 -74
  14. package/dist/components/AutoSuggest/index.js +143 -143
  15. package/dist/components/Button/Button.stories.d.ts +11 -11
  16. package/dist/components/Button/Button.stories.js +41 -41
  17. package/dist/components/Button/index.d.ts +49 -50
  18. package/dist/components/Button/index.js +50 -50
  19. package/dist/components/CalendarInput/index.d.ts +24 -24
  20. package/dist/components/CalendarInput/index.js +54 -56
  21. package/dist/components/CheckboxList/index.d.ts +17 -17
  22. package/dist/components/CheckboxList/index.js +25 -25
  23. package/dist/components/CodeInput/index.d.ts +9 -9
  24. package/dist/components/CodeInput/index.js +51 -57
  25. package/dist/components/ConnectedDropdown/index.d.ts +14 -14
  26. package/dist/components/ConnectedDropdown/index.js +36 -36
  27. package/dist/components/ConnectedList/index.d.ts +5 -5
  28. package/dist/components/ConnectedList/index.js +7 -7
  29. package/dist/components/ConnectedTable/index.d.ts +5 -5
  30. package/dist/components/ConnectedTable/index.js +7 -7
  31. package/dist/components/ContentBlock/index.d.ts +16 -16
  32. package/dist/components/ContentBlock/index.js +13 -13
  33. package/dist/components/DataPanel/index.d.ts +8 -8
  34. package/dist/components/DataPanel/index.js +8 -8
  35. package/dist/components/DateInput/index.d.ts +18 -18
  36. package/dist/components/DateInput/index.js +81 -81
  37. package/dist/components/Dropdown/index.d.ts +36 -36
  38. package/dist/components/Dropdown/index.js +122 -122
  39. package/dist/components/ErrorMessage/index.d.ts +16 -16
  40. package/dist/components/ErrorMessage/index.js +17 -17
  41. package/dist/components/Fieldset/index.d.ts +18 -18
  42. package/dist/components/Fieldset/index.js +19 -19
  43. package/dist/components/FileInput/index.d.ts +10 -10
  44. package/dist/components/FileInput/index.js +26 -26
  45. package/dist/components/FilterLink/index.d.ts +14 -14
  46. package/dist/components/FilterLink/index.js +15 -15
  47. package/dist/components/Form/index.d.ts +14 -14
  48. package/dist/components/Form/index.js +15 -15
  49. package/dist/components/FormActions/index.d.ts +18 -18
  50. package/dist/components/FormActions/index.js +14 -14
  51. package/dist/components/FormField/index.d.ts +14 -14
  52. package/dist/components/FormField/index.js +40 -40
  53. package/dist/components/FormRepeater/index.d.ts +18 -18
  54. package/dist/components/FormRepeater/index.js +65 -65
  55. package/dist/components/ImageInput/index.d.ts +13 -13
  56. package/dist/components/ImageInput/index.js +45 -45
  57. package/dist/components/InfoPanel/index.d.ts +14 -14
  58. package/dist/components/InfoPanel/index.js +11 -11
  59. package/dist/components/Link/__mocks__/index.d.ts +6 -6
  60. package/dist/components/Link/__mocks__/index.js +12 -12
  61. package/dist/components/Link/index.d.ts +23 -23
  62. package/dist/components/Link/index.js +21 -21
  63. package/dist/components/List/index.d.ts +36 -36
  64. package/dist/components/List/index.js +46 -46
  65. package/dist/components/ListActions/index.d.ts +18 -18
  66. package/dist/components/ListActions/index.js +14 -14
  67. package/dist/components/LoginForm/index.d.ts +3 -3
  68. package/dist/components/LoginForm/index.js +47 -47
  69. package/dist/components/Message/index.d.ts +14 -14
  70. package/dist/components/Message/index.js +14 -14
  71. package/dist/components/Modal/index.d.ts +4 -4
  72. package/dist/components/Modal/index.js +18 -18
  73. package/dist/components/ModalActions/index.d.ts +21 -21
  74. package/dist/components/ModalActions/index.js +18 -18
  75. package/dist/components/MoneyInput/index.d.ts +10 -10
  76. package/dist/components/MoneyInput/index.js +13 -13
  77. package/dist/components/PasswordForm/index.d.ts +35 -35
  78. package/dist/components/PasswordForm/index.js +21 -21
  79. package/dist/components/PasswordInput/index.d.ts +4 -4
  80. package/dist/components/PasswordInput/index.js +12 -12
  81. package/dist/components/RadioList/index.d.ts +9 -9
  82. package/dist/components/RadioList/index.js +7 -7
  83. package/dist/components/RootLayout/index.d.ts +6 -8
  84. package/dist/components/RootLayout/index.js +7 -21
  85. package/dist/components/SummaryList/index.d.ts +18 -18
  86. package/dist/components/SummaryList/index.js +15 -15
  87. package/dist/components/Switch/index.d.ts +21 -21
  88. package/dist/components/Switch/index.js +31 -31
  89. package/dist/components/Table/index.d.ts +28 -28
  90. package/dist/components/Table/index.js +55 -55
  91. package/dist/components/Tag/index.d.ts +15 -15
  92. package/dist/components/Tag/index.js +13 -13
  93. package/dist/components/TextArea/index.d.ts +18 -18
  94. package/dist/components/TextArea/index.js +26 -26
  95. package/dist/components/TextInput/index.d.ts +14 -14
  96. package/dist/components/TextInput/index.js +27 -27
  97. package/dist/components/WebsiteInput/index.d.ts +10 -10
  98. package/dist/components/WebsiteInput/index.js +13 -13
  99. package/dist/components/WeekCalendar/index.d.ts +24 -24
  100. package/dist/components/WeekCalendar/index.js +48 -48
  101. package/dist/core/AlertComponent/index.d.ts +26 -26
  102. package/dist/core/AlertComponent/index.js +35 -45
  103. package/dist/core/AppHeader/index.d.ts +3 -3
  104. package/dist/core/AppHeader/index.js +17 -17
  105. package/dist/core/AppLogo/index.d.ts +12 -12
  106. package/dist/core/AppLogo/index.js +16 -17
  107. package/dist/core/AppLogoImage/index.d.ts +3 -3
  108. package/dist/core/AppLogoImage/index.js +11 -11
  109. package/dist/core/AppLogoPlaceholder/index.d.ts +3 -3
  110. package/dist/core/AppLogoPlaceholder/index.js +10 -10
  111. package/dist/core/Assistive/index.d.ts +12 -12
  112. package/dist/core/Assistive/index.js +9 -9
  113. package/dist/core/AuthForm/index.d.ts +10 -10
  114. package/dist/core/AuthForm/index.js +13 -26
  115. package/dist/core/Banner/index.d.ts +3 -3
  116. package/dist/core/Banner/index.js +14 -14
  117. package/dist/core/Calendar/index.d.ts +21 -21
  118. package/dist/core/Calendar/index.js +69 -69
  119. package/dist/core/CalendarDay/index.d.ts +30 -30
  120. package/dist/core/CalendarDay/index.js +30 -30
  121. package/dist/core/CalendarMonth/index.d.ts +23 -23
  122. package/dist/core/CalendarMonth/index.js +45 -45
  123. package/dist/core/CalendarNavigation/index.d.ts +17 -17
  124. package/dist/core/CalendarNavigation/index.js +24 -24
  125. package/dist/core/CalendarWeek/index.d.ts +28 -28
  126. package/dist/core/CalendarWeek/index.js +46 -46
  127. package/dist/core/ChkRad/index.d.ts +26 -26
  128. package/dist/core/ChkRad/index.js +33 -33
  129. package/dist/core/ChkRadIcon/index.d.ts +14 -14
  130. package/dist/core/ChkRadIcon/index.js +12 -12
  131. package/dist/core/ChkRadList/index.d.ts +32 -32
  132. package/dist/core/ChkRadList/index.js +37 -37
  133. package/dist/core/CloseButton/index.d.ts +17 -17
  134. package/dist/core/CloseButton/index.js +12 -12
  135. package/dist/core/ConfirmModal/index.d.ts +3 -3
  136. package/dist/core/ConfirmModal/index.js +38 -38
  137. package/dist/core/ConnectedRepeater/index.d.ts +50 -50
  138. package/dist/core/ConnectedRepeater/index.js +154 -154
  139. package/dist/core/ConnectedRepeaterComponent/index.d.ts +24 -24
  140. package/dist/core/ConnectedRepeaterComponent/index.js +25 -25
  141. package/dist/core/Container/index.d.ts +14 -14
  142. package/dist/core/Container/index.js +12 -12
  143. package/dist/core/DataPanelItem/index.d.ts +8 -8
  144. package/dist/core/DataPanelItem/index.js +7 -7
  145. package/dist/core/DropdownPanel/index.d.ts +31 -31
  146. package/dist/core/DropdownPanel/index.js +32 -32
  147. package/dist/core/EmptyMessage/index.d.ts +21 -21
  148. package/dist/core/EmptyMessage/index.js +21 -21
  149. package/dist/core/FilterItem/index.d.ts +25 -25
  150. package/dist/core/FilterItem/index.js +82 -84
  151. package/dist/core/Filters/index.d.ts +31 -31
  152. package/dist/core/Filters/index.js +85 -85
  153. package/dist/core/FixedActions/index.d.ts +24 -24
  154. package/dist/core/FixedActions/index.js +22 -22
  155. package/dist/core/FormError/index.d.ts +12 -12
  156. package/dist/core/FormError/index.js +9 -9
  157. package/dist/core/FormLabel/index.d.ts +16 -16
  158. package/dist/core/FormLabel/index.js +13 -13
  159. package/dist/core/FormLegend/index.d.ts +12 -12
  160. package/dist/core/FormLegend/index.js +9 -9
  161. package/dist/core/Header/Header.stories.d.ts +5 -5
  162. package/dist/core/Header/Header.stories.js +11 -11
  163. package/dist/core/Header/index.d.ts +14 -14
  164. package/dist/core/Header/index.js +12 -12
  165. package/dist/core/Icon/index.d.ts +14 -14
  166. package/dist/core/Icon/index.js +32 -32
  167. package/dist/core/IconButton/index.d.ts +22 -22
  168. package/dist/core/IconButton/index.js +20 -20
  169. package/dist/core/InputPanel/index.d.ts +16 -16
  170. package/dist/core/InputPanel/index.js +11 -11
  171. package/dist/core/ListItem/index.d.ts +39 -39
  172. package/dist/core/ListItem/index.js +44 -44
  173. package/dist/core/ListItemAction/index.d.ts +11 -11
  174. package/dist/core/ListItemAction/index.js +13 -13
  175. package/dist/core/ListItemActions/index.d.ts +8 -8
  176. package/dist/core/ListItemActions/index.js +16 -16
  177. package/dist/core/ListItemMetaItem/index.d.ts +19 -19
  178. package/dist/core/ListItemMetaItem/index.js +29 -29
  179. package/dist/core/ListItemTitle/index.d.ts +19 -19
  180. package/dist/core/ListItemTitle/index.js +44 -44
  181. package/dist/core/Loader/index.d.ts +15 -15
  182. package/dist/core/Loader/index.js +16 -16
  183. package/dist/core/MeActions/index.d.ts +3 -3
  184. package/dist/core/MeActions/index.js +48 -48
  185. package/dist/core/MePanel/index.d.ts +19 -19
  186. package/dist/core/MePanel/index.js +29 -29
  187. package/dist/core/ModalComponent/index.d.ts +22 -22
  188. package/dist/core/ModalComponent/index.js +29 -29
  189. package/dist/core/Navigation/index.d.ts +3 -3
  190. package/dist/core/Navigation/index.js +33 -33
  191. package/dist/core/NavigationDivider/index.d.ts +3 -3
  192. package/dist/core/NavigationDivider/index.js +8 -8
  193. package/dist/core/NavigationItem/index.d.ts +16 -16
  194. package/dist/core/NavigationItem/index.js +21 -21
  195. package/dist/core/Pagination/index.d.ts +15 -15
  196. package/dist/core/Pagination/index.js +64 -64
  197. package/dist/core/PaginationItem/index.d.ts +10 -10
  198. package/dist/core/PaginationItem/index.js +17 -17
  199. package/dist/core/Panel/index.d.ts +17 -17
  200. package/dist/core/Panel/index.js +13 -16
  201. package/dist/core/PasswordForgotForm/index.d.ts +7 -7
  202. package/dist/core/PasswordForgotForm/index.js +40 -40
  203. package/dist/core/PasswordResetForm/index.d.ts +7 -7
  204. package/dist/core/PasswordResetForm/index.js +34 -34
  205. package/dist/core/RadialProgress/index.d.ts +16 -16
  206. package/dist/core/RadialProgress/index.js +23 -23
  207. package/dist/core/SettingsForm/index.d.ts +3 -3
  208. package/dist/core/SettingsForm/index.js +14 -14
  209. package/dist/core/StaticTextInput/index.d.ts +29 -29
  210. package/dist/core/StaticTextInput/index.js +39 -39
  211. package/dist/core/Styled/index.d.ts +6 -6
  212. package/dist/core/Styled/index.js +39 -39
  213. package/dist/core/SummaryListItem/index.d.ts +23 -23
  214. package/dist/core/SummaryListItem/index.js +31 -31
  215. package/dist/core/TabItem/index.d.ts +4 -4
  216. package/dist/core/TabItem/index.js +13 -13
  217. package/dist/core/TableActionsCell/index.d.ts +8 -8
  218. package/dist/core/TableActionsCell/index.js +8 -8
  219. package/dist/core/TableCell/index.d.ts +15 -15
  220. package/dist/core/TableCell/index.js +20 -20
  221. package/dist/core/TableHead/index.d.ts +18 -18
  222. package/dist/core/TableHead/index.js +18 -18
  223. package/dist/core/TableRow/index.d.ts +13 -13
  224. package/dist/core/TableRow/index.js +18 -18
  225. package/dist/core/Tabs/index.d.ts +7 -7
  226. package/dist/core/Tabs/index.js +13 -13
  227. package/dist/core/TextInputAncillary/index.d.ts +29 -29
  228. package/dist/core/TextInputAncillary/index.js +31 -31
  229. package/dist/core/Toast/index.d.ts +3 -3
  230. package/dist/core/Toast/index.js +47 -47
  231. package/dist/core/TwoFactor/index.d.ts +13 -13
  232. package/dist/core/TwoFactor/index.js +49 -49
  233. package/dist/core/TwoFactorAuthenticator/index.d.ts +10 -10
  234. package/dist/core/TwoFactorAuthenticator/index.js +9 -9
  235. package/dist/core/TwoFactorMethodList/index.d.ts +10 -10
  236. package/dist/core/TwoFactorMethodList/index.js +22 -22
  237. package/dist/core/TwoFactorSetup/index.d.ts +12 -12
  238. package/dist/core/TwoFactorSetup/index.js +43 -43
  239. package/dist/core/TwoFactorSetupAuthenticator/index.d.ts +20 -20
  240. package/dist/core/TwoFactorSetupAuthenticator/index.js +42 -42
  241. package/dist/core/TwoFactorSetupYubikey/index.d.ts +16 -16
  242. package/dist/core/TwoFactorSetupYubikey/index.js +14 -14
  243. package/dist/core/TwoFactorYubikey/index.d.ts +9 -9
  244. package/dist/core/TwoFactorYubikey/index.js +14 -14
  245. package/dist/core/WeekCalendarDay/index.d.ts +27 -27
  246. package/dist/core/WeekCalendarDay/index.js +35 -35
  247. package/dist/core/YubikeyInput/index.d.ts +4 -4
  248. package/dist/core/YubikeyInput/index.js +14 -39
  249. package/dist/filters/BooleanFilter/index.d.ts +14 -14
  250. package/dist/filters/BooleanFilter/index.js +35 -35
  251. package/dist/filters/DateFilter/index.d.ts +5 -5
  252. package/dist/filters/DateFilter/index.js +24 -24
  253. package/dist/filters/DropdownFilter/index.d.ts +17 -17
  254. package/dist/filters/DropdownFilter/index.js +32 -32
  255. package/dist/filters/QuickDateFilter/index.d.ts +13 -13
  256. package/dist/filters/QuickDateFilter/index.js +40 -40
  257. package/dist/filters/interfaces.d.ts +35 -35
  258. package/dist/filters/interfaces.js +1 -1
  259. package/dist/hooks/useAlert.d.ts +12 -12
  260. package/dist/hooks/useAlert.js +18 -18
  261. package/dist/hooks/useAppConfig.d.ts +3 -0
  262. package/dist/hooks/useAppConfig.js +5 -0
  263. package/dist/hooks/useConnectedList.d.ts +7 -7
  264. package/dist/hooks/useConnectedList.js +6 -6
  265. package/dist/hooks/useConnectedRepeater.d.ts +7 -7
  266. package/dist/hooks/useConnectedRepeater.js +14 -14
  267. package/dist/hooks/useConnectedTable.d.ts +7 -7
  268. package/dist/hooks/useConnectedTable.js +6 -6
  269. package/dist/hooks/useFilters.d.ts +9 -9
  270. package/dist/hooks/useFilters.js +24 -24
  271. package/dist/hooks/useLayout.d.ts +7 -7
  272. package/dist/hooks/useLayout.js +10 -10
  273. package/dist/hooks/useLayout.spec.d.ts +1 -1
  274. package/dist/hooks/useLayout.spec.js +24 -24
  275. package/dist/hooks/useModal.d.ts +12 -12
  276. package/dist/hooks/useModal.js +39 -39
  277. package/dist/hooks/useModalOffset.d.ts +2 -2
  278. package/dist/hooks/useModalOffset.js +16 -16
  279. package/dist/hooks/useModalOffset.spec.d.ts +1 -1
  280. package/dist/hooks/useModalOffset.spec.js +19 -19
  281. package/dist/hooks/useNavigation.d.ts +7 -7
  282. package/dist/hooks/useNavigation.js +113 -113
  283. package/dist/hooks/useRemote.d.ts +7 -7
  284. package/dist/hooks/useRemote.js +29 -29
  285. package/dist/hooks/useVariant.d.ts +9 -9
  286. package/dist/hooks/useVariant.js +14 -14
  287. package/dist/index.d.ts +209 -208
  288. package/dist/index.js +213 -212
  289. package/dist/scenes/Error404Scene.d.ts +3 -3
  290. package/dist/scenes/Error404Scene.js +5 -5
  291. package/dist/services/AppService.d.ts +5 -5
  292. package/dist/services/AppService.js +11 -11
  293. package/dist/services/ConfigService.d.ts +42 -42
  294. package/dist/services/ConfigService.js +52 -55
  295. package/dist/services/ConfirmService.d.ts +12 -12
  296. package/dist/services/ConfirmService.js +10 -10
  297. package/dist/services/DateService.d.ts +26 -26
  298. package/dist/services/DateService.js +132 -132
  299. package/dist/services/DateService.spec.d.ts +1 -1
  300. package/dist/services/DateService.spec.js +83 -83
  301. package/dist/services/DownloadService.d.ts +7 -7
  302. package/dist/services/DownloadService.js +16 -16
  303. package/dist/services/DownloadService.spec.d.ts +1 -1
  304. package/dist/services/DownloadService.spec.js +18 -18
  305. package/dist/services/FilterComponentService.d.ts +25 -25
  306. package/dist/services/FilterComponentService.js +54 -54
  307. package/dist/services/FilterService.d.ts +34 -34
  308. package/dist/services/FilterService.js +58 -58
  309. package/dist/services/FilterService.spec.d.ts +1 -1
  310. package/dist/services/FilterService.spec.js +67 -67
  311. package/dist/services/FormatService.d.ts +11 -11
  312. package/dist/services/FormatService.js +45 -45
  313. package/dist/services/FormatService.spec.d.ts +1 -1
  314. package/dist/services/FormatService.spec.js +66 -66
  315. package/dist/services/ToastService.d.ts +7 -7
  316. package/dist/services/ToastService.js +17 -17
  317. package/dist/services/ToastService.spec.d.ts +1 -1
  318. package/dist/services/ToastService.spec.js +34 -34
  319. package/dist/styles.css +125 -67
  320. package/dist/utility/MockRouter/index.d.ts +2 -2
  321. package/dist/utility/MockRouter/index.js +37 -37
  322. package/dist/utility/StorybookPanel/index.d.ts +14 -14
  323. package/dist/utility/StorybookPanel/index.js +12 -12
  324. package/dist/utility/TestChangeHandler/index.d.ts +15 -15
  325. package/dist/utility/TestChangeHandler/index.js +30 -30
  326. package/dist/utility/icons.d.ts +3 -3
  327. package/dist/utility/icons.js +12 -12
  328. package/dist/utility/interfaces.d.ts +79 -80
  329. package/dist/utility/interfaces.js +18 -18
  330. package/dist/utility/middleware.d.ts +4 -4
  331. package/dist/utility/middleware.js +9 -4
  332. package/dist/utility/prop-types.d.ts +57 -57
  333. package/dist/utility/prop-types.js +77 -77
  334. package/dist/utility/register.d.ts +3 -3
  335. package/dist/utility/register.js +9 -7
  336. package/package.json +5 -5
  337. package/src/components/LoginForm/index.tsx +1 -1
  338. package/src/core/TwoFactor/TwoFactor.spec.tsx +4 -4
  339. package/src/core/TwoFactor/index.tsx +5 -5
  340. package/src/core/TwoFactorAuthenticator/index.tsx +1 -1
  341. package/src/core/TwoFactorSetup/index.tsx +1 -1
  342. package/src/core/TwoFactorYubikey/index.tsx +1 -1
  343. package/dist/hooks/useConfig.d.ts +0 -9
  344. package/dist/hooks/useConfig.js +0 -13
@@ -1,46 +1,46 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import CalendarDay from '../CalendarDay';
4
- const isDisabled = (item, disabledDates) => {
5
- if (typeof item === 'number' || !disabledDates) {
6
- return false;
7
- }
8
- if (typeof disabledDates === 'function') {
9
- return disabledDates(item.date);
10
- }
11
- return disabledDates.includes(item.date);
12
- };
13
- const isSelected = (item, pendingValue, value) => {
14
- if (typeof item === 'number') {
15
- return false;
16
- }
17
- return (pendingValue || value || '').split(',').includes(item.date);
18
- };
19
- const isHighlighted = (item, pendingValue, value) => {
20
- if (typeof item === 'number') {
21
- return false;
22
- }
23
- const [lower, upper] = (pendingValue || value || '').split(',');
24
- return item.date > lower && item.date < upper;
25
- };
26
- function CalendarWeek({ data, disabledDates, name, onClick, pendingValue, value, }) {
27
- return (React.createElement("tr", null, data.map((item, index) => (React.createElement(CalendarDay, { key: typeof item === 'number' ? index : item.date, data: item, isDisabled: isDisabled(item, disabledDates), isHighlighted: isHighlighted(item, pendingValue, value), isSelected: isSelected(item, pendingValue, value), name: name, onClick: onClick })))));
28
- }
29
- CalendarWeek.propTypes = {
30
- data: PropTypes.arrayOf(PropTypes.oneOfType([
31
- PropTypes.number.isRequired,
32
- PropTypes.shape({
33
- date: PropTypes.string.isRequired,
34
- label: PropTypes.number.isRequired,
35
- }).isRequired,
36
- ]).isRequired).isRequired,
37
- name: PropTypes.string.isRequired,
38
- pendingValue: PropTypes.string.isRequired,
39
- disabledDates: PropTypes.oneOfType([
40
- PropTypes.arrayOf(PropTypes.string.isRequired),
41
- PropTypes.func,
42
- ]),
43
- value: PropTypes.string,
44
- onClick: PropTypes.func,
45
- };
46
- export default CalendarWeek;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import CalendarDay from '../../core/CalendarDay';
4
+ const isDisabled = (item, disabledDates) => {
5
+ if (typeof item === 'number' || !disabledDates) {
6
+ return false;
7
+ }
8
+ if (typeof disabledDates === 'function') {
9
+ return disabledDates(item.date);
10
+ }
11
+ return disabledDates.includes(item.date);
12
+ };
13
+ const isSelected = (item, pendingValue, value) => {
14
+ if (typeof item === 'number') {
15
+ return false;
16
+ }
17
+ return (pendingValue || value || '').split(',').includes(item.date);
18
+ };
19
+ const isHighlighted = (item, pendingValue, value) => {
20
+ if (typeof item === 'number') {
21
+ return false;
22
+ }
23
+ const [lower, upper] = (pendingValue || value || '').split(',');
24
+ return item.date > lower && item.date < upper;
25
+ };
26
+ function CalendarWeek({ data, disabledDates, name, onClick, pendingValue, value, }) {
27
+ return (React.createElement("tr", null, data.map((item, index) => (React.createElement(CalendarDay, { key: typeof item === 'number' ? index : item.date, data: item, isDisabled: isDisabled(item, disabledDates), isHighlighted: isHighlighted(item, pendingValue, value), isSelected: isSelected(item, pendingValue, value), name: name, onClick: onClick })))));
28
+ }
29
+ CalendarWeek.propTypes = {
30
+ data: PropTypes.arrayOf(PropTypes.oneOfType([
31
+ PropTypes.number.isRequired,
32
+ PropTypes.shape({
33
+ date: PropTypes.string.isRequired,
34
+ label: PropTypes.number.isRequired,
35
+ }).isRequired,
36
+ ]).isRequired).isRequired,
37
+ name: PropTypes.string.isRequired,
38
+ pendingValue: PropTypes.string.isRequired,
39
+ disabledDates: PropTypes.oneOfType([
40
+ PropTypes.arrayOf(PropTypes.string.isRequired),
41
+ PropTypes.func,
42
+ ]),
43
+ value: PropTypes.string,
44
+ onClick: PropTypes.func,
45
+ };
46
+ export default CalendarWeek;
@@ -1,26 +1,26 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import type { InputProps } from '../../utility/interfaces';
4
- interface ChkRadProps extends InputProps<string> {
5
- isChecked?: boolean;
6
- label: React.ReactElement | string;
7
- type?: 'checkbox' | 'radio';
8
- }
9
- /**
10
- * Either a checkbox or a radio button. The onChange event will return a string of the value of
11
- * the checked item.
12
- */
13
- declare function ChkRad({ id, isDisabled, name, label, isChecked, onChange, type, value, }: ChkRadProps): React.ReactElement;
14
- declare namespace ChkRad {
15
- var propTypes: {
16
- label: PropTypes.Validator<NonNullable<NonNullable<string | PropTypes.ReactElementLike | null | undefined>>>;
17
- name: PropTypes.Validator<string>;
18
- id: PropTypes.Requireable<string>;
19
- isChecked: PropTypes.Requireable<boolean>;
20
- isDisabled: PropTypes.Requireable<boolean>;
21
- type: PropTypes.Requireable<string>;
22
- value: PropTypes.Requireable<string>;
23
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
24
- };
25
- }
26
- export default ChkRad;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import type { InputProps } from '../../utility/interfaces';
4
+ interface ChkRadProps extends InputProps<string> {
5
+ isChecked?: boolean;
6
+ label: React.ReactElement | string;
7
+ type?: 'checkbox' | 'radio';
8
+ }
9
+ /**
10
+ * Either a checkbox or a radio button. The onChange event will return a string of the value of
11
+ * the checked item.
12
+ */
13
+ declare function ChkRad({ id, isDisabled, name, label, isChecked, onChange, type, value, }: ChkRadProps): React.ReactElement;
14
+ declare namespace ChkRad {
15
+ var propTypes: {
16
+ label: PropTypes.Validator<NonNullable<NonNullable<string | PropTypes.ReactElementLike | null | undefined>>>;
17
+ name: PropTypes.Validator<string>;
18
+ id: PropTypes.Requireable<string>;
19
+ isChecked: PropTypes.Requireable<boolean>;
20
+ isDisabled: PropTypes.Requireable<boolean>;
21
+ type: PropTypes.Requireable<string>;
22
+ value: PropTypes.Requireable<string>;
23
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
24
+ };
25
+ }
26
+ export default ChkRad;
@@ -1,33 +1,33 @@
1
- 'use client';
2
- import React, { useRef } from 'react';
3
- import PropTypes from 'prop-types';
4
- import ChkRadIcon from '../ChkRadIcon';
5
- /**
6
- * Either a checkbox or a radio button. The onChange event will return a string of the value of
7
- * the checked item.
8
- */
9
- function ChkRad({ id, isDisabled, name, label, isChecked, onChange, type, value, }) {
10
- const ref = useRef(null);
11
- const handleChange = (event) => {
12
- if (onChange) {
13
- const item = { id: event.target.value, name: String(label) };
14
- const target = { name, value: event.target.value };
15
- onChange({ item, target });
16
- }
17
- };
18
- return (React.createElement("label", { className: "/*clsx(styles.root, isDisabled && styles.rootIsDisabled)*/", "data-testid": "chkrad-root" },
19
- React.createElement("input", { checked: Boolean(isChecked), className: "/*styles.input*/", disabled: isDisabled, id: id || name, name: name, onChange: handleChange, type: type || 'checkbox', value: value }),
20
- React.createElement(ChkRadIcon, { type: type }),
21
- React.createElement("div", { ref: ref, className: "/*styles.label*/" }, label)));
22
- }
23
- ChkRad.propTypes = {
24
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
25
- name: PropTypes.string.isRequired,
26
- id: PropTypes.string,
27
- isChecked: PropTypes.bool,
28
- isDisabled: PropTypes.bool,
29
- type: PropTypes.oneOf(['checkbox', 'radio']),
30
- value: PropTypes.string,
31
- onChange: PropTypes.func,
32
- };
33
- export default ChkRad;
1
+ 'use client';
2
+ import React, { useRef } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import ChkRadIcon from '../../core/ChkRadIcon';
5
+ /**
6
+ * Either a checkbox or a radio button. The onChange event will return a string of the value of
7
+ * the checked item.
8
+ */
9
+ function ChkRad({ id, isDisabled, name, label, isChecked, onChange, type, value, }) {
10
+ const ref = useRef(null);
11
+ const handleChange = (event) => {
12
+ if (onChange) {
13
+ const item = { id: event.target.value, name: String(label) };
14
+ const target = { name, value: event.target.value };
15
+ onChange({ item, target });
16
+ }
17
+ };
18
+ return (React.createElement("label", { className: "/*clsx(styles.root, isDisabled && styles.rootIsDisabled)*/", "data-testid": "chkrad-root" },
19
+ React.createElement("input", { checked: Boolean(isChecked), className: "/*styles.input*/", disabled: isDisabled, id: id || name, name: name, onChange: handleChange, type: type || 'checkbox', value: value }),
20
+ React.createElement(ChkRadIcon, { type: type }),
21
+ React.createElement("div", { ref: ref, className: "/*styles.label*/" }, label)));
22
+ }
23
+ ChkRad.propTypes = {
24
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
25
+ name: PropTypes.string.isRequired,
26
+ id: PropTypes.string,
27
+ isChecked: PropTypes.bool,
28
+ isDisabled: PropTypes.bool,
29
+ type: PropTypes.oneOf(['checkbox', 'radio']),
30
+ value: PropTypes.string,
31
+ onChange: PropTypes.func,
32
+ };
33
+ export default ChkRad;
@@ -1,14 +1,14 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- interface ChkRadIconProps {
4
- isChecked?: boolean;
5
- type?: 'checkbox' | 'radio';
6
- }
7
- declare function ChkRadIcon({ isChecked, type }: ChkRadIconProps): React.ReactElement;
8
- declare namespace ChkRadIcon {
9
- var propTypes: {
10
- isChecked: PropTypes.Requireable<boolean>;
11
- type: PropTypes.Requireable<string>;
12
- };
13
- }
14
- export default ChkRadIcon;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ interface ChkRadIconProps {
4
+ isChecked?: boolean;
5
+ type?: 'checkbox' | 'radio';
6
+ }
7
+ declare function ChkRadIcon({ isChecked, type }: ChkRadIconProps): React.ReactElement;
8
+ declare namespace ChkRadIcon {
9
+ var propTypes: {
10
+ isChecked: PropTypes.Requireable<boolean>;
11
+ type: PropTypes.Requireable<string>;
12
+ };
13
+ }
14
+ export default ChkRadIcon;
@@ -1,12 +1,12 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import Icon from '../Icon';
4
- function ChkRadIcon({ isChecked, type = 'checkbox' }) {
5
- return (React.createElement("i", { className: "clsx(styles.root,styles[`root${ucwords(type)}`],isChecked && styles.rootIsChecked)" },
6
- React.createElement(Icon, { icon: "check" })));
7
- }
8
- ChkRadIcon.propTypes = {
9
- isChecked: PropTypes.bool,
10
- type: PropTypes.oneOf(['checkbox', 'radio']),
11
- };
12
- export default ChkRadIcon;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Icon from '../../core/Icon';
4
+ function ChkRadIcon({ isChecked, type = 'checkbox' }) {
5
+ return (React.createElement("i", { className: "clsx(styles.root,styles[`root${ucwords(type)}`],isChecked && styles.rootIsChecked)" },
6
+ React.createElement(Icon, { icon: "check" })));
7
+ }
8
+ ChkRadIcon.propTypes = {
9
+ isChecked: PropTypes.bool,
10
+ type: PropTypes.oneOf(['checkbox', 'radio']),
11
+ };
12
+ export default ChkRadIcon;
@@ -1,32 +1,32 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import type { InputProps } from '../../utility/interfaces';
4
- export interface ChkRadDataItem {
5
- isDisabled?: boolean;
6
- label: string;
7
- value: string;
8
- }
9
- interface ChkRadListProps extends InputProps<string[] | string, string> {
10
- columns?: number;
11
- data: ChkRadDataItem[];
12
- type?: 'checkbox' | 'radio';
13
- }
14
- /**
15
- * A list of either checkboxes or radio buttons. The onChange event will return a string - the
16
- * value of the last item that was checked/unchecked.
17
- */
18
- declare function ChkRadList({ columns, data, isDisabled, name, onChange, type, value, }: ChkRadListProps): React.ReactElement;
19
- declare namespace ChkRadList {
20
- var propTypes: {
21
- data: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
22
- label: PropTypes.Validator<string>;
23
- value: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
24
- }>>[]>;
25
- name: PropTypes.Validator<string>;
26
- isDisabled: PropTypes.Requireable<boolean>;
27
- type: PropTypes.Requireable<string>;
28
- value: PropTypes.Requireable<NonNullable<string | number | NonNullable<NonNullable<string | number | null | undefined>>[] | null | undefined>>;
29
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
30
- };
31
- }
32
- export default ChkRadList;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import type { InputProps } from '../../utility/interfaces';
4
+ export interface ChkRadDataItem {
5
+ isDisabled?: boolean;
6
+ label: string;
7
+ value: string;
8
+ }
9
+ interface ChkRadListProps extends InputProps<string[] | string, string> {
10
+ columns?: number;
11
+ data: ChkRadDataItem[];
12
+ type?: 'checkbox' | 'radio';
13
+ }
14
+ /**
15
+ * A list of either checkboxes or radio buttons. The onChange event will return a string - the
16
+ * value of the last item that was checked/unchecked.
17
+ */
18
+ declare function ChkRadList({ columns, data, isDisabled, name, onChange, type, value, }: ChkRadListProps): React.ReactElement;
19
+ declare namespace ChkRadList {
20
+ var propTypes: {
21
+ data: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
22
+ label: PropTypes.Validator<string>;
23
+ value: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
24
+ }>>[]>;
25
+ name: PropTypes.Validator<string>;
26
+ isDisabled: PropTypes.Requireable<boolean>;
27
+ type: PropTypes.Requireable<string>;
28
+ value: PropTypes.Requireable<NonNullable<string | number | NonNullable<NonNullable<string | number | null | undefined>>[] | null | undefined>>;
29
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
30
+ };
31
+ }
32
+ export default ChkRadList;
@@ -1,37 +1,37 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import ChkRad from '../ChkRad';
4
- const DEFAULT_COLUMNS = 4;
5
- const getIsChecked = (itemValue, fieldValue) => {
6
- if (!fieldValue) {
7
- return false;
8
- }
9
- if (Array.isArray(fieldValue)) {
10
- return fieldValue.includes(itemValue);
11
- }
12
- return fieldValue === itemValue;
13
- };
14
- /**
15
- * A list of either checkboxes or radio buttons. The onChange event will return a string - the
16
- * value of the last item that was checked/unchecked.
17
- */
18
- function ChkRadList({ columns = DEFAULT_COLUMNS, data, isDisabled, name, onChange, type, value, }) {
19
- return (React.createElement("ul", { className: "/*clsx(styles.root, styles[`root${columns.toString()`])*/" }, data.map((item) => (React.createElement("li", { key: item.value },
20
- React.createElement(ChkRad, { id: `${name}_${item.value}`, isChecked: getIsChecked(item.value, value), isDisabled: item.isDisabled || isDisabled, label: item.label, name: name, onChange: onChange, type: type, value: item.value }))))));
21
- }
22
- ChkRadList.propTypes = {
23
- data: PropTypes.arrayOf(PropTypes.shape({
24
- label: PropTypes.string.isRequired,
25
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
26
- }).isRequired).isRequired,
27
- name: PropTypes.string.isRequired,
28
- isDisabled: PropTypes.bool,
29
- type: PropTypes.oneOf(['checkbox', 'radio']),
30
- value: PropTypes.oneOfType([
31
- PropTypes.string,
32
- PropTypes.number,
33
- PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired),
34
- ]),
35
- onChange: PropTypes.func,
36
- };
37
- export default ChkRadList;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import ChkRad from '../../core/ChkRad';
4
+ const DEFAULT_COLUMNS = 4;
5
+ const getIsChecked = (itemValue, fieldValue) => {
6
+ if (!fieldValue) {
7
+ return false;
8
+ }
9
+ if (Array.isArray(fieldValue)) {
10
+ return fieldValue.includes(itemValue);
11
+ }
12
+ return fieldValue === itemValue;
13
+ };
14
+ /**
15
+ * A list of either checkboxes or radio buttons. The onChange event will return a string - the
16
+ * value of the last item that was checked/unchecked.
17
+ */
18
+ function ChkRadList({ columns = DEFAULT_COLUMNS, data, isDisabled, name, onChange, type, value, }) {
19
+ return (React.createElement("ul", { className: "/*clsx(styles.root, styles[`root${columns.toString()`])*/" }, data.map((item) => (React.createElement("li", { key: item.value },
20
+ React.createElement(ChkRad, { id: `${name}_${item.value}`, isChecked: getIsChecked(item.value, value), isDisabled: item.isDisabled || isDisabled, label: item.label, name: name, onChange: onChange, type: type, value: item.value }))))));
21
+ }
22
+ ChkRadList.propTypes = {
23
+ data: PropTypes.arrayOf(PropTypes.shape({
24
+ label: PropTypes.string.isRequired,
25
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
26
+ }).isRequired).isRequired,
27
+ name: PropTypes.string.isRequired,
28
+ isDisabled: PropTypes.bool,
29
+ type: PropTypes.oneOf(['checkbox', 'radio']),
30
+ value: PropTypes.oneOfType([
31
+ PropTypes.string,
32
+ PropTypes.number,
33
+ PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired),
34
+ ]),
35
+ onChange: PropTypes.func,
36
+ };
37
+ export default ChkRadList;
@@ -1,17 +1,17 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- interface CloseButtonProps {
4
- label?: string;
5
- onClick?: React.MouseEventHandler<HTMLButtonElement>;
6
- size?: 'sm' | 'md' | 'lg';
7
- type?: 'button' | 'submit';
8
- }
9
- declare function CloseButton({ label, onClick, size, type, }: CloseButtonProps): React.ReactElement;
10
- declare namespace CloseButton {
11
- var propTypes: {
12
- size: PropTypes.Requireable<string>;
13
- type: PropTypes.Requireable<string>;
14
- onClick: PropTypes.Requireable<(...args: any[]) => any>;
15
- };
16
- }
17
- export default CloseButton;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ interface CloseButtonProps {
4
+ label?: string;
5
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
6
+ size?: 'sm' | 'md' | 'lg';
7
+ type?: 'button' | 'submit';
8
+ }
9
+ declare function CloseButton({ label, onClick, size, type, }: CloseButtonProps): React.ReactElement;
10
+ declare namespace CloseButton {
11
+ var propTypes: {
12
+ size: PropTypes.Requireable<string>;
13
+ type: PropTypes.Requireable<string>;
14
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
15
+ };
16
+ }
17
+ export default CloseButton;
@@ -1,12 +1,12 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import IconButton from '../IconButton';
4
- function CloseButton({ label = 'Close', onClick, size, type, }) {
5
- return (React.createElement(IconButton, { icon: "x", onClick: onClick, size: size, type: type }, label));
6
- }
7
- CloseButton.propTypes = {
8
- size: PropTypes.oneOf(['sm', 'md', 'lg']),
9
- type: PropTypes.oneOf(['button', 'submit']),
10
- onClick: PropTypes.func,
11
- };
12
- export default CloseButton;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import IconButton from '../../core/IconButton';
4
+ function CloseButton({ label = 'Close', onClick, size, type, }) {
5
+ return (React.createElement(IconButton, { icon: "x", onClick: onClick, size: size, type: type }, label));
6
+ }
7
+ CloseButton.propTypes = {
8
+ size: PropTypes.oneOf(['sm', 'md', 'lg']),
9
+ type: PropTypes.oneOf(['button', 'submit']),
10
+ onClick: PropTypes.func,
11
+ };
12
+ export default CloseButton;
@@ -1,3 +1,3 @@
1
- import React from 'react';
2
- declare function ConfirmModal(): React.ReactElement;
3
- export default ConfirmModal;
1
+ import React from 'react';
2
+ declare function ConfirmModal(): React.ReactElement;
3
+ export default ConfirmModal;
@@ -1,38 +1,38 @@
1
- 'use client';
2
- import React, { useEffect, useState } from 'react';
3
- import { EventService } from '@sqrzro/utility';
4
- import ContentBlock from '../../components/ContentBlock';
5
- import ModalActions from '../../components/ModalActions';
6
- import ModalComponent from '../ModalComponent';
7
- import useModal from '../../hooks/useModal';
8
- function ConfirmModal() {
9
- const [data, setData] = useState(null);
10
- const { closeModal, modalProps, openModal } = useModal();
11
- const handleConfirm = () => {
12
- /*
13
- * `data` can be null, so the optional check (?.) is required for typescript.
14
- * However, the modal can't be open without data, so this can be ignored by test coverage.
15
- */
16
- /* istanbul ignore next */
17
- if (data?.onConfirm) {
18
- data.onConfirm();
19
- }
20
- closeModal();
21
- };
22
- const handleData = (_key, responseData) => {
23
- setData(responseData);
24
- if (responseData) {
25
- openModal();
26
- }
27
- };
28
- useEffect(() => {
29
- const sub = EventService.subscribe('@confirm/send', handleData);
30
- return () => {
31
- EventService.unsubscribe(sub);
32
- };
33
- }, []);
34
- return (React.createElement(ModalComponent, { ...modalProps, title: "Are You Sure?", variant: "danger" },
35
- data?.description ? React.createElement(ContentBlock, null, data.description) : null,
36
- React.createElement(ModalActions, { label: data?.label || 'Confirm', onClick: handleConfirm, variant: "danger" })));
37
- }
38
- export default ConfirmModal;
1
+ 'use client';
2
+ import React, { useEffect, useState } from 'react';
3
+ import { EventService } from '@sqrzro/utility';
4
+ import ContentBlock from '../../components/ContentBlock';
5
+ import ModalActions from '../../components/ModalActions';
6
+ import ModalComponent from '../../core/ModalComponent';
7
+ import useModal from '../../hooks/useModal';
8
+ function ConfirmModal() {
9
+ const [data, setData] = useState(null);
10
+ const { closeModal, modalProps, openModal } = useModal();
11
+ const handleConfirm = () => {
12
+ /*
13
+ * `data` can be null, so the optional check (?.) is required for typescript.
14
+ * However, the modal can't be open without data, so this can be ignored by test coverage.
15
+ */
16
+ /* istanbul ignore next */
17
+ if (data?.onConfirm) {
18
+ data.onConfirm();
19
+ }
20
+ closeModal();
21
+ };
22
+ const handleData = (_key, responseData) => {
23
+ setData(responseData);
24
+ if (responseData) {
25
+ openModal();
26
+ }
27
+ };
28
+ useEffect(() => {
29
+ const sub = EventService.subscribe('@confirm/send', handleData);
30
+ return () => {
31
+ EventService.unsubscribe(sub);
32
+ };
33
+ }, []);
34
+ return (React.createElement(ModalComponent, { ...modalProps, title: "Are You Sure?", variant: "danger" },
35
+ data?.description ? React.createElement(ContentBlock, null, data.description) : null,
36
+ React.createElement(ModalActions, { label: data?.label || 'Confirm', onClick: handleConfirm, variant: "danger" })));
37
+ }
38
+ export default ConfirmModal;