nurseitaly-components 0.0.1

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 (332) hide show
  1. package/README.md +93 -0
  2. package/dist/basic/Avatar/Avatar.d.ts +12 -0
  3. package/dist/basic/Avatar/Avatar.js +24 -0
  4. package/dist/basic/Avatar/avatar.png +0 -0
  5. package/dist/basic/Avatar/index.d.ts +2 -0
  6. package/dist/basic/Avatar/index.js +2 -0
  7. package/dist/basic/Avatar/styles.scss +80 -0
  8. package/dist/basic/Badge/Badge.d.ts +13 -0
  9. package/dist/basic/Badge/Badge.js +17 -0
  10. package/dist/basic/Badge/index.d.ts +2 -0
  11. package/dist/basic/Badge/index.js +2 -0
  12. package/dist/basic/Badge/styles.scss +68 -0
  13. package/dist/basic/Button/Button.d.ts +25 -0
  14. package/dist/basic/Button/Button.js +42 -0
  15. package/dist/basic/Button/index.d.ts +2 -0
  16. package/dist/basic/Button/index.js +2 -0
  17. package/dist/basic/Button/logo-ud.png +0 -0
  18. package/dist/basic/Button/styles.scss +248 -0
  19. package/dist/basic/CheckboxField/CheckboxField.d.ts +10 -0
  20. package/dist/basic/CheckboxField/CheckboxField.js +9 -0
  21. package/dist/basic/CheckboxField/index.d.ts +2 -0
  22. package/dist/basic/CheckboxField/index.js +2 -0
  23. package/dist/basic/CheckboxField/style.scss +4 -0
  24. package/dist/basic/DatePickerField/DatePickerField.d.ts +26 -0
  25. package/dist/basic/DatePickerField/DatePickerField.js +90 -0
  26. package/dist/basic/DatePickerField/DatePickerTheme.d.ts +2 -0
  27. package/dist/basic/DatePickerField/DatePickerTheme.js +59 -0
  28. package/dist/basic/DatePickerField/index.d.ts +1 -0
  29. package/dist/basic/DatePickerField/index.js +1 -0
  30. package/dist/basic/DatePickerField/styles.scss +26 -0
  31. package/dist/basic/DropdownButton/DropdownButton.d.ts +18 -0
  32. package/dist/basic/DropdownButton/DropdownButton.js +44 -0
  33. package/dist/basic/DropdownButton/index.d.ts +2 -0
  34. package/dist/basic/DropdownButton/index.js +2 -0
  35. package/dist/basic/DropdownButton/styles.scss +172 -0
  36. package/dist/basic/DropdownList/DropdownItemList.d.ts +16 -0
  37. package/dist/basic/DropdownList/DropdownItemList.js +17 -0
  38. package/dist/basic/DropdownList/DropdownList.d.ts +9 -0
  39. package/dist/basic/DropdownList/DropdownList.js +10 -0
  40. package/dist/basic/DropdownList/index.d.ts +2 -0
  41. package/dist/basic/DropdownList/index.js +2 -0
  42. package/dist/basic/DropdownList/styles.scss +56 -0
  43. package/dist/basic/DropdownMenu/DropdownMenu.d.ts +13 -0
  44. package/dist/basic/DropdownMenu/DropdownMenu.js +12 -0
  45. package/dist/basic/DropdownMenu/index.d.ts +2 -0
  46. package/dist/basic/DropdownMenu/index.js +2 -0
  47. package/dist/basic/DropdownMenu/styles.scss +54 -0
  48. package/dist/basic/Dummy/Dummy.d.ts +9 -0
  49. package/dist/basic/Dummy/Dummy.js +8 -0
  50. package/dist/basic/Dummy/index.d.ts +2 -0
  51. package/dist/basic/Dummy/index.js +2 -0
  52. package/dist/basic/Dummy/styles.scss +4 -0
  53. package/dist/basic/FilterDropdown/FilterDropdown.d.ts +16 -0
  54. package/dist/basic/FilterDropdown/FilterDropdown.js +56 -0
  55. package/dist/basic/FilterDropdown/index.d.ts +2 -0
  56. package/dist/basic/FilterDropdown/index.js +2 -0
  57. package/dist/basic/FilterDropdown/styles.scss +97 -0
  58. package/dist/basic/Icon/Icon.d.ts +15 -0
  59. package/dist/basic/Icon/Icon.js +20 -0
  60. package/dist/basic/Icon/IconSizes.d.ts +10 -0
  61. package/dist/basic/Icon/IconSizes.js +11 -0
  62. package/dist/basic/Icon/index.d.ts +2 -0
  63. package/dist/basic/Icon/index.js +2 -0
  64. package/dist/basic/Icon/styles.scss +249 -0
  65. package/dist/basic/IconButton/IconButton.d.ts +24 -0
  66. package/dist/basic/IconButton/IconButton.js +42 -0
  67. package/dist/basic/IconButton/index.d.ts +2 -0
  68. package/dist/basic/IconButton/index.js +2 -0
  69. package/dist/basic/IconButton/styles.scss +192 -0
  70. package/dist/basic/Pill/Pill.d.ts +17 -0
  71. package/dist/basic/Pill/Pill.js +22 -0
  72. package/dist/basic/Pill/index.d.ts +2 -0
  73. package/dist/basic/Pill/index.js +2 -0
  74. package/dist/basic/Pill/styles.scss +70 -0
  75. package/dist/basic/SelectField/AsyncSelectField.d.ts +21 -0
  76. package/dist/basic/SelectField/AsyncSelectField.js +131 -0
  77. package/dist/basic/SelectField/SelectAutocompleteTheme.d.ts +2 -0
  78. package/dist/basic/SelectField/SelectAutocompleteTheme.js +78 -0
  79. package/dist/basic/SelectField/SelectField.d.ts +27 -0
  80. package/dist/basic/SelectField/SelectField.js +81 -0
  81. package/dist/basic/SelectField/SelectFieldTheme.d.ts +7 -0
  82. package/dist/basic/SelectField/SelectFieldTheme.js +57 -0
  83. package/dist/basic/SelectField/SelectMultipleField.d.ts +28 -0
  84. package/dist/basic/SelectField/SelectMultipleField.js +98 -0
  85. package/dist/basic/SelectField/index.d.ts +2 -0
  86. package/dist/basic/SelectField/index.js +2 -0
  87. package/dist/basic/SelectField/styles.scss +38 -0
  88. package/dist/basic/Spinner/Spinner.d.ts +14 -0
  89. package/dist/basic/Spinner/Spinner.js +37 -0
  90. package/dist/basic/Spinner/index.d.ts +2 -0
  91. package/dist/basic/Spinner/index.js +2 -0
  92. package/dist/basic/Spinner/styles.scss +37 -0
  93. package/dist/basic/SwitchField/SwitchField.d.ts +11 -0
  94. package/dist/basic/SwitchField/SwitchField.js +13 -0
  95. package/dist/basic/SwitchField/index.d.ts +2 -0
  96. package/dist/basic/SwitchField/index.js +2 -0
  97. package/dist/basic/SwitchField/style.scss +4 -0
  98. package/dist/basic/Tabs/Tabs.d.ts +17 -0
  99. package/dist/basic/Tabs/Tabs.js +9 -0
  100. package/dist/basic/Tabs/index.d.ts +2 -0
  101. package/dist/basic/Tabs/index.js +2 -0
  102. package/dist/basic/Tabs/styles.scss +51 -0
  103. package/dist/basic/Tag/Tag.d.ts +18 -0
  104. package/dist/basic/Tag/Tag.js +30 -0
  105. package/dist/basic/Tag/index.d.ts +2 -0
  106. package/dist/basic/Tag/index.js +2 -0
  107. package/dist/basic/Tag/styles.scss +101 -0
  108. package/dist/basic/TextField/TextField.d.ts +34 -0
  109. package/dist/basic/TextField/TextField.js +164 -0
  110. package/dist/basic/TextField/TextFieldTheme.d.ts +6 -0
  111. package/dist/basic/TextField/TextFieldTheme.js +70 -0
  112. package/dist/basic/TextField/index.d.ts +2 -0
  113. package/dist/basic/TextField/index.js +2 -0
  114. package/dist/basic/TextField/inputRefManager.d.ts +4 -0
  115. package/dist/basic/TextField/inputRefManager.js +18 -0
  116. package/dist/basic/TextField/styles.scss +44 -0
  117. package/dist/basic/Tooltip/Tooltip.d.ts +26 -0
  118. package/dist/basic/Tooltip/Tooltip.js +37 -0
  119. package/dist/basic/Tooltip/index.d.ts +2 -0
  120. package/dist/basic/Tooltip/index.js +2 -0
  121. package/dist/basic/Tooltip/styles.scss +73 -0
  122. package/dist/basic/VerticalButton/VerticalButton.d.ts +6 -0
  123. package/dist/basic/VerticalButton/VerticalButton.js +8 -0
  124. package/dist/basic/VerticalButton/index.d.ts +2 -0
  125. package/dist/basic/VerticalButton/index.js +2 -0
  126. package/dist/basic/VerticalButton/styles.scss +24 -0
  127. package/dist/basic/fonts/material-symbols-outlined.woff2 +0 -0
  128. package/dist/basic/fonts/work-sans-latin-ext.woff2 +0 -0
  129. package/dist/basic/fonts/work-sans-latin.woff2 +0 -0
  130. package/dist/basic/fonts/work-sans-vietnamese.woff2 +0 -0
  131. package/dist/basic/fonts.d.ts +1 -0
  132. package/dist/basic/fonts.js +111 -0
  133. package/dist/basic/index.d.ts +33 -0
  134. package/dist/basic/index.js +29 -0
  135. package/dist/common/AppAnalytics/AppAnalytics.d.ts +1 -0
  136. package/dist/common/AppAnalytics/AppAnalytics.js +25 -0
  137. package/dist/common/AppAnalytics/index.d.ts +2 -0
  138. package/dist/common/AppAnalytics/index.js +2 -0
  139. package/dist/common/AppCard/AppCard.d.ts +13 -0
  140. package/dist/common/AppCard/AppCard.js +7 -0
  141. package/dist/common/AppCard/index.d.ts +2 -0
  142. package/dist/common/AppCard/index.js +2 -0
  143. package/dist/common/AppCard/style.scss +33 -0
  144. package/dist/common/AppClipboard/AppClipboard.d.ts +7 -0
  145. package/dist/common/AppClipboard/AppClipboard.js +23 -0
  146. package/dist/common/AppClipboard/index.d.ts +2 -0
  147. package/dist/common/AppClipboard/index.js +2 -0
  148. package/dist/common/AppColorpicker/AppColorpicker.d.ts +9 -0
  149. package/dist/common/AppColorpicker/AppColorpicker.js +22 -0
  150. package/dist/common/AppColorpicker/index.d.ts +2 -0
  151. package/dist/common/AppColorpicker/index.js +2 -0
  152. package/dist/common/AppColorpicker/style.scss +26 -0
  153. package/dist/common/AppCopyText/AppCopyText.d.ts +11 -0
  154. package/dist/common/AppCopyText/AppCopyText.js +35 -0
  155. package/dist/common/AppCopyText/index.d.ts +2 -0
  156. package/dist/common/AppCopyText/index.js +2 -0
  157. package/dist/common/AppCopyText/styles.scss +55 -0
  158. package/dist/common/AppDropzone/AppDropzone.d.ts +19 -0
  159. package/dist/common/AppDropzone/AppDropzone.js +13 -0
  160. package/dist/common/AppDropzone/AppDropzoneBody.d.ts +22 -0
  161. package/dist/common/AppDropzone/AppDropzoneBody.js +74 -0
  162. package/dist/common/AppDropzone/UploadService.d.ts +6 -0
  163. package/dist/common/AppDropzone/UploadService.js +18 -0
  164. package/dist/common/AppDropzone/UploadedFile.d.ts +14 -0
  165. package/dist/common/AppDropzone/UploadedFile.js +1 -0
  166. package/dist/common/AppDropzone/index.d.ts +4 -0
  167. package/dist/common/AppDropzone/index.js +4 -0
  168. package/dist/common/AppDropzone/style.scss +42 -0
  169. package/dist/common/AppDropzoneLocal/AppDropzoneBodyLocal.d.ts +15 -0
  170. package/dist/common/AppDropzoneLocal/AppDropzoneBodyLocal.js +55 -0
  171. package/dist/common/AppDropzoneLocal/AppDropzoneLocal.d.ts +15 -0
  172. package/dist/common/AppDropzoneLocal/AppDropzoneLocal.js +13 -0
  173. package/dist/common/AppDropzoneLocal/UploadedFileLocal.d.ts +5 -0
  174. package/dist/common/AppDropzoneLocal/UploadedFileLocal.js +1 -0
  175. package/dist/common/AppDropzoneLocal/index.d.ts +5 -0
  176. package/dist/common/AppDropzoneLocal/index.js +4 -0
  177. package/dist/common/AppDropzoneLocal/style.scss +75 -0
  178. package/dist/common/AppForm/AppForm.d.ts +16 -0
  179. package/dist/common/AppForm/AppForm.js +67 -0
  180. package/dist/common/AppForm/AppFormField.d.ts +37 -0
  181. package/dist/common/AppForm/AppFormField.js +10 -0
  182. package/dist/common/AppForm/AppFormInfo.d.ts +9 -0
  183. package/dist/common/AppForm/AppFormInfo.js +45 -0
  184. package/dist/common/AppForm/FormColorField.d.ts +12 -0
  185. package/dist/common/AppForm/FormColorField.js +23 -0
  186. package/dist/common/AppForm/index.d.ts +2 -0
  187. package/dist/common/AppForm/index.js +2 -0
  188. package/dist/common/AppForm/style.scss +60 -0
  189. package/dist/common/AppLoading/AppLoading.d.ts +7 -0
  190. package/dist/common/AppLoading/AppLoading.js +8 -0
  191. package/dist/common/AppLoading/index.d.ts +2 -0
  192. package/dist/common/AppLoading/index.js +2 -0
  193. package/dist/common/AppLoading/style.scss +5 -0
  194. package/dist/common/AppModal/AppModal.d.ts +27 -0
  195. package/dist/common/AppModal/AppModal.js +42 -0
  196. package/dist/common/AppModal/AppModalConfirm.d.ts +15 -0
  197. package/dist/common/AppModal/AppModalConfirm.js +37 -0
  198. package/dist/common/AppModal/AppModalRemove.d.ts +22 -0
  199. package/dist/common/AppModal/AppModalRemove.js +35 -0
  200. package/dist/common/AppModal/AppModalUtils.d.ts +2 -0
  201. package/dist/common/AppModal/AppModalUtils.js +17 -0
  202. package/dist/common/AppModal/index.d.ts +2 -0
  203. package/dist/common/AppModal/index.js +2 -0
  204. package/dist/common/AppModal/style.scss +100 -0
  205. package/dist/common/AppPagination/AppPagination.d.ts +12 -0
  206. package/dist/common/AppPagination/AppPagination.js +212 -0
  207. package/dist/common/AppPagination/index.d.ts +2 -0
  208. package/dist/common/AppPagination/index.js +2 -0
  209. package/dist/common/AppPagination/styles.scss +230 -0
  210. package/dist/common/AppPicture/AppPicture.d.ts +10 -0
  211. package/dist/common/AppPicture/AppPicture.js +18 -0
  212. package/dist/common/AppPicture/index.d.ts +2 -0
  213. package/dist/common/AppPicture/index.js +2 -0
  214. package/dist/common/AppPicture/style.scss +0 -0
  215. package/dist/common/AppPlaceholder/AppPlaceholder.d.ts +12 -0
  216. package/dist/common/AppPlaceholder/AppPlaceholder.js +7 -0
  217. package/dist/common/AppPlaceholder/index.d.ts +2 -0
  218. package/dist/common/AppPlaceholder/index.js +2 -0
  219. package/dist/common/AppPlaceholder/style.scss +25 -0
  220. package/dist/common/AppSwitchGroup/AppSwitchGroup.d.ts +12 -0
  221. package/dist/common/AppSwitchGroup/AppSwitchGroup.js +8 -0
  222. package/dist/common/AppSwitchGroup/index.d.ts +2 -0
  223. package/dist/common/AppSwitchGroup/index.js +2 -0
  224. package/dist/common/AppSwitchGroup/style.scss +18 -0
  225. package/dist/common/AppTable/AppTable.d.ts +19 -0
  226. package/dist/common/AppTable/AppTable.js +62 -0
  227. package/dist/common/AppTable/AppTableList.d.ts +14 -0
  228. package/dist/common/AppTable/AppTableList.js +48 -0
  229. package/dist/common/AppTable/AppTableTheme.d.ts +1 -0
  230. package/dist/common/AppTable/AppTableTheme.js +45 -0
  231. package/dist/common/AppTable/AppTableUtils.d.ts +8 -0
  232. package/dist/common/AppTable/AppTableUtils.js +24 -0
  233. package/dist/common/AppTable/index.d.ts +2 -0
  234. package/dist/common/AppTable/index.js +2 -0
  235. package/dist/common/AppTable/styles.scss +65 -0
  236. package/dist/common/AppTable/types/AppPage.d.ts +29 -0
  237. package/dist/common/AppTable/types/AppPage.js +18 -0
  238. package/dist/common/AppTable/types/AppPageable.d.ts +15 -0
  239. package/dist/common/AppTable/types/AppPageable.js +19 -0
  240. package/dist/common/AppTextArea/AppTextArea.d.ts +11 -0
  241. package/dist/common/AppTextArea/AppTextArea.js +29 -0
  242. package/dist/common/AppTextArea/index.d.ts +1 -0
  243. package/dist/common/AppTextArea/index.js +1 -0
  244. package/dist/common/AppTextArea/style.scss +47 -0
  245. package/dist/common/AppToast/AppToast.d.ts +2 -0
  246. package/dist/common/AppToast/AppToast.js +81 -0
  247. package/dist/common/AppToast/ToastMessage.d.ts +8 -0
  248. package/dist/common/AppToast/ToastMessage.js +4 -0
  249. package/dist/common/AppToast/index.d.ts +2 -0
  250. package/dist/common/AppToast/index.js +2 -0
  251. package/dist/common/AppToast/style.scss +0 -0
  252. package/dist/common/index.d.ts +27 -0
  253. package/dist/common/index.js +23 -0
  254. package/dist/configs/CommonContext.d.ts +10 -0
  255. package/dist/configs/CommonContext.js +9 -0
  256. package/dist/configs/CookieStorage.d.ts +15 -0
  257. package/dist/configs/CookieStorage.js +45 -0
  258. package/dist/configs/Localization.d.ts +28 -0
  259. package/dist/configs/Localization.js +63 -0
  260. package/dist/configs/Storage.d.ts +9 -0
  261. package/dist/configs/Storage.js +16 -0
  262. package/dist/configs/api.d.ts +10 -0
  263. package/dist/configs/api.js +52 -0
  264. package/dist/configs/index.d.ts +8 -0
  265. package/dist/configs/index.js +7 -0
  266. package/dist/configs/localization/BaseTexts.d.ts +44 -0
  267. package/dist/configs/localization/BaseTexts.js +44 -0
  268. package/dist/configs/localization/CommentsTexts.d.ts +95 -0
  269. package/dist/configs/localization/CommentsTexts.js +95 -0
  270. package/dist/configs/localization/CommonTexts.d.ts +239 -0
  271. package/dist/configs/localization/CommonTexts.js +239 -0
  272. package/dist/configs/localization/ConsentTexts.d.ts +116 -0
  273. package/dist/configs/localization/ConsentTexts.js +203 -0
  274. package/dist/configs/localization/HeaderAppTexts.d.ts +106 -0
  275. package/dist/configs/localization/HeaderAppTexts.js +106 -0
  276. package/dist/configs/localization/HeaderTexts.d.ts +68 -0
  277. package/dist/configs/localization/HeaderTexts.js +68 -0
  278. package/dist/configs/localization/HelpTexts.d.ts +38 -0
  279. package/dist/configs/localization/HelpTexts.js +38 -0
  280. package/dist/configs/localization/HistoryTexts.d.ts +428 -0
  281. package/dist/configs/localization/HistoryTexts.js +428 -0
  282. package/dist/configs/localization/ParametersTexts.d.ts +137 -0
  283. package/dist/configs/localization/ParametersTexts.js +137 -0
  284. package/dist/configs/localization/SentenceTexts.d.ts +56 -0
  285. package/dist/configs/localization/SentenceTexts.js +56 -0
  286. package/dist/configs/localization/TreeTexts.d.ts +46 -0
  287. package/dist/configs/localization/TreeTexts.js +46 -0
  288. package/dist/configs/localization/UploadTexts.d.ts +23 -0
  289. package/dist/configs/localization/UploadTexts.js +23 -0
  290. package/dist/configs/services/ProfileService.d.ts +5 -0
  291. package/dist/configs/services/ProfileService.js +8 -0
  292. package/dist/configs/sessionTypes.d.ts +42 -0
  293. package/dist/configs/sessionTypes.js +63 -0
  294. package/dist/configs/useLoggedUtils.d.ts +7 -0
  295. package/dist/configs/useLoggedUtils.js +24 -0
  296. package/dist/configs/useMessageUtils.d.ts +22 -0
  297. package/dist/configs/useMessageUtils.js +71 -0
  298. package/dist/fonts/material-symbols-outlined.woff2 +0 -0
  299. package/dist/fonts/work-sans-latin-ext.woff2 +0 -0
  300. package/dist/fonts/work-sans-latin.woff2 +0 -0
  301. package/dist/fonts/work-sans-vietnamese.woff2 +0 -0
  302. package/dist/functions/DateUtils.d.ts +15 -0
  303. package/dist/functions/DateUtils.js +52 -0
  304. package/dist/functions/FilterUtils.d.ts +13 -0
  305. package/dist/functions/FilterUtils.js +56 -0
  306. package/dist/functions/FormUtils.d.ts +13 -0
  307. package/dist/functions/FormUtils.js +58 -0
  308. package/dist/functions/ImageUtils.d.ts +5 -0
  309. package/dist/functions/ImageUtils.js +13 -0
  310. package/dist/functions/SecurityUtils.d.ts +6 -0
  311. package/dist/functions/SecurityUtils.js +28 -0
  312. package/dist/functions/UsabilityUtils.d.ts +10 -0
  313. package/dist/functions/UsabilityUtils.js +47 -0
  314. package/dist/functions/index.d.ts +6 -0
  315. package/dist/functions/index.js +6 -0
  316. package/dist/functions/logo-ud.png +0 -0
  317. package/dist/functions/placeholder-image.png +0 -0
  318. package/dist/functions/placeholder-person.png +0 -0
  319. package/dist/index.d.ts +5 -0
  320. package/dist/index.js +5 -0
  321. package/dist/styles/base/_borders.scss +30 -0
  322. package/dist/styles/base/_colors.scss +100 -0
  323. package/dist/styles/base/_displays.scss +207 -0
  324. package/dist/styles/base/_margins.css +174 -0
  325. package/dist/styles/base/_spacing.scss +26 -0
  326. package/dist/styles/base/_tokens.scss +330 -0
  327. package/dist/styles/base/_typographs.scss +376 -0
  328. package/dist/styles/font-googleapis.scss +222 -0
  329. package/dist/styles/main.scss +112 -0
  330. package/dist/vendor/index.d.ts +5 -0
  331. package/dist/vendor/index.js +4 -0
  332. package/package.json +118 -0
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
3
+ import Dropzone from 'react-dropzone';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { Button } from '../../basic';
6
+ import './style.scss';
7
+ function AppDropzoneBodyLocalInner({ onSuccess, onError, accept, onDrop, showConfirmButton = true, }, ref) {
8
+ const { t } = useTranslation('upload');
9
+ const [files, setFiles] = useState([]);
10
+ const [isUploading, setIsUploading] = useState(false);
11
+ const filesRef = useRef([]);
12
+ filesRef.current = files;
13
+ const upload = async () => {
14
+ const currentFiles = filesRef.current;
15
+ if (currentFiles.length === 0 || isUploading)
16
+ return;
17
+ setIsUploading(true);
18
+ try {
19
+ const results = await Promise.all(currentFiles.map(async (file) => ({
20
+ name: file.name,
21
+ content: await file.text(),
22
+ })));
23
+ onSuccess(results);
24
+ }
25
+ catch (err) {
26
+ onError?.(err);
27
+ }
28
+ finally {
29
+ setIsUploading(false);
30
+ }
31
+ };
32
+ useImperativeHandle(ref, () => ({
33
+ upload,
34
+ }));
35
+ const handleDrop = (acceptedFiles) => {
36
+ if (acceptedFiles.length === 0)
37
+ return;
38
+ setFiles((prev) => [...prev, ...acceptedFiles]);
39
+ onDrop?.();
40
+ };
41
+ const clearFiles = () => setFiles([]);
42
+ const removeAt = (index) => {
43
+ setFiles((prev) => prev.filter((_, i) => i !== index));
44
+ };
45
+ return (_jsxs("div", { className: "dropzone-container-local", children: [files.length === 0 && (_jsx(Dropzone, { onDrop: handleDrop, accept: accept, multiple: true, children: ({ getRootProps, getInputProps }) => (_jsxs("div", { ...getRootProps(), className: "dropzone-local", children: [_jsx("input", { ...getInputProps() }), _jsx("span", { children: t('label.dropzone') })] })) })), files.length > 0 && (_jsxs("div", { className: "uploaded-message-local", children: [_jsx("b", { children: t('label.uploaded.file') }), _jsx("ul", { className: "uploaded-file-list-local", children: files.map((file, index) => (_jsxs("li", { children: [_jsx("span", { children: file.name }), _jsx("button", { type: "button", className: "uploaded-file-remove-local", onClick: (e) => {
46
+ e.stopPropagation();
47
+ removeAt(index);
48
+ }, "aria-label": t('common:button.remove', {
49
+ defaultValue: 'Remove',
50
+ }), children: "\u00D7" })] }, `${file.name}-${file.size}-${index}`))) }), _jsx("button", { type: "button", className: "uploaded-clear-all-local", onClick: clearFiles, children: t('label.clear.all', { defaultValue: 'Clear all' }) }), _jsx("b", { children: t('label.confirm') })] })), files.length > 0 && showConfirmButton && (_jsx(Button, { onClick: () => {
51
+ void upload();
52
+ }, text: t('common:button.confirm') }))] }));
53
+ }
54
+ const AppDropzoneBodyLocal = forwardRef(AppDropzoneBodyLocalInner);
55
+ export default AppDropzoneBodyLocal;
@@ -0,0 +1,15 @@
1
+ import type { UploadedFileLocal } from './UploadedFileLocal';
2
+ type AppDropzoneLocalProps = {
3
+ onClose: () => void;
4
+ onSuccess: (files: UploadedFileLocal[]) => void;
5
+ onError?: (err: unknown) => void;
6
+ accept: Record<string, string[]>;
7
+ onDrop?: () => void;
8
+ title?: string;
9
+ alternativeButton?: {
10
+ title: string;
11
+ action: () => void;
12
+ };
13
+ };
14
+ export default function AppDropzoneLocal({ onClose, onSuccess, onError, accept, onDrop, title, alternativeButton, }: AppDropzoneLocalProps): import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useRef } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import AppModal from '../AppModal';
5
+ import AppDropzoneBodyLocal from './AppDropzoneBodyLocal';
6
+ export default function AppDropzoneLocal({ onClose, onSuccess, onError, accept, onDrop, title, alternativeButton, }) {
7
+ const { t } = useTranslation('upload');
8
+ const bodyRef = useRef(null);
9
+ const handleConfirm = () => {
10
+ void bodyRef.current?.upload();
11
+ };
12
+ return (_jsx(AppModal, { title: title || t('modal.title'), className: "modal-upload-local", close: onClose, confirm: handleConfirm, alternativeButton: alternativeButton, children: _jsx(AppDropzoneBodyLocal, { ref: bodyRef, onSuccess: onSuccess, onError: onError, accept: accept, onDrop: onDrop, showConfirmButton: false }) }));
13
+ }
@@ -0,0 +1,5 @@
1
+ /** One text file selected in the dropzone, with UTF-8 content read client-side. */
2
+ export interface UploadedFileLocal {
3
+ name: string;
4
+ content: string;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import AppDropzoneLocal from './AppDropzoneLocal';
2
+ import AppDropzoneBodyLocal, { type AppDropzoneBodyLocalProps, type AppDropzoneBodyLocalRef } from './AppDropzoneBodyLocal';
3
+ import type { UploadedFileLocal } from './UploadedFileLocal';
4
+ export default AppDropzoneLocal;
5
+ export { AppDropzoneBodyLocal, type AppDropzoneBodyLocalProps, type AppDropzoneBodyLocalRef, type UploadedFileLocal, };
@@ -0,0 +1,4 @@
1
+ import AppDropzoneLocal from './AppDropzoneLocal';
2
+ import AppDropzoneBodyLocal from './AppDropzoneBodyLocal';
3
+ export default AppDropzoneLocal;
4
+ export { AppDropzoneBodyLocal, };
@@ -0,0 +1,75 @@
1
+ .dropzone-container-local {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+
6
+ .dropzone-local {
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ text-align: center;
11
+ width: 100%;
12
+ padding: var(--spacing-700);
13
+ border-radius: var(--radius-100);
14
+ border: 2px dashed var(--border-subtle-3);
15
+ background-color: var(--layer-layer-2);
16
+ cursor: pointer;
17
+ }
18
+
19
+ .preview-local {
20
+ margin: 0 auto;
21
+ width: 400px;
22
+ height: 400px;
23
+ }
24
+
25
+ .uploaded-message-local {
26
+ display: flex;
27
+ flex-direction: column;
28
+ width: 100%;
29
+ gap: 16px;
30
+ text-align: center;
31
+ border: 1px solid var(--border-subtle-3);
32
+ border-radius: var(--radius-100);
33
+ padding: 16px;
34
+ margin-top: var(--spacing-400);
35
+ }
36
+
37
+ .uploaded-file-list-local {
38
+ list-style: none;
39
+ margin: 0;
40
+ padding: 0;
41
+ text-align: left;
42
+ border: var(--border-default);
43
+ padding: 8px;
44
+ border-radius: var(--radius-100);
45
+
46
+ li {
47
+ display: flex;
48
+ align-items: center;
49
+ justify-content: space-between;
50
+ gap: 8px;
51
+ padding: 4px 0;
52
+ }
53
+ }
54
+
55
+ .uploaded-file-remove-local {
56
+ flex-shrink: 0;
57
+ border: none;
58
+ background: transparent;
59
+ cursor: pointer;
60
+ font-size: 1.25rem;
61
+ line-height: 1;
62
+ padding: 0 4px;
63
+ color: var(--text-secondary, inherit);
64
+ }
65
+
66
+ .uploaded-clear-all-local {
67
+ align-self: center;
68
+ border: none;
69
+ background: transparent;
70
+ cursor: pointer;
71
+ text-decoration: underline;
72
+ font: inherit;
73
+ color: var(--text-link, inherit);
74
+ }
75
+ }
@@ -0,0 +1,16 @@
1
+ import { FieldValues, UseFormReturn } from 'react-hook-form';
2
+ import { SelectItem } from '../../basic';
3
+ import { AppFormField } from './AppFormField';
4
+ import './style.scss';
5
+ type Props<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues> = {
6
+ fields: AppFormField[];
7
+ form: UseFormReturn<TFieldValues, TContext, TTransformedValues>;
8
+ prefix?: string;
9
+ onChangeFunctions?: Record<string, (v: string | number | boolean) => void>;
10
+ onBlurFunctions?: Record<string, () => void>;
11
+ runtimeOptions?: Record<string, any[]>;
12
+ runtimeLoadOptions?: Record<string, (query: string) => Promise<SelectItem[]>>;
13
+ twoColumns?: boolean;
14
+ };
15
+ export default function AppForm<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>({ fields, form, prefix, onChangeFunctions, onBlurFunctions, runtimeOptions, runtimeLoadOptions, twoColumns, }: Props<TFieldValues, TContext, TTransformedValues>): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { AsyncSelectField, CheckboxField, DatePickerField, SelectField, SelectMultipleField, SwitchField, TextField, } from '../../basic';
3
+ import FormColorField from './FormColorField';
4
+ import './style.scss';
5
+ const convertList = (values, labelAttr, valueAttr) => {
6
+ if (!values)
7
+ return [];
8
+ let fields = [];
9
+ values.map((value) => {
10
+ fields = [...fields, { label: value[labelAttr], value: value[valueAttr] }];
11
+ });
12
+ return fields;
13
+ };
14
+ export default function AppForm({ fields, form, prefix, onChangeFunctions = {}, onBlurFunctions = {}, runtimeOptions = {}, runtimeLoadOptions = {}, twoColumns = false, }) {
15
+ const getOnChangeFn = (attr) => onChangeFunctions[attr];
16
+ const getOnBlurFn = (attr) => onBlurFunctions[attr];
17
+ const getOptions = (attr) => {
18
+ if (!runtimeOptions[attr])
19
+ return undefined;
20
+ return convertList(runtimeOptions[attr], 'name', 'uid');
21
+ };
22
+ return (_jsx("div", { className: `app-form-container ${twoColumns ? 'two-columns' : ''}`, children: fields.map((field) => {
23
+ const name = prefix ? `${prefix}.${field.attr}` : field.attr;
24
+ const handleChange = getOnChangeFn(field.attr);
25
+ if (field.type === 'autocomplete') {
26
+ const loadOptions = runtimeLoadOptions[field.attr];
27
+ if (!loadOptions)
28
+ return null;
29
+ return (_jsx(AsyncSelectField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, required: field.required, multiple: field.multiple, freeSolo: field.freeSolo, minQueryLength: field.minQueryLength, loadOptions: loadOptions, placeholder: field.title, noOptionsText: field.translation, onChange: (_attr, value) => handleChange?.(value) }, name));
30
+ }
31
+ if (field.type === 'select') {
32
+ const selectOptions = getOptions(field.attr) || field.options || [];
33
+ const selectProps = {
34
+ attr: name,
35
+ label: field.name,
36
+ createdForm: form,
37
+ options: selectOptions,
38
+ disabled: field.disabled,
39
+ required: field.required,
40
+ onChange: (value) => handleChange?.(value),
41
+ showEndAdornment: false,
42
+ };
43
+ if (field.multiple) {
44
+ return _jsx(SelectMultipleField, { ...selectProps }, name);
45
+ }
46
+ return _jsx(SelectField, { ...selectProps }, name);
47
+ }
48
+ if (field.type === 'check') {
49
+ return (_jsx(CheckboxField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled }, name));
50
+ }
51
+ if (field.type === 'switch') {
52
+ return (_jsx(SwitchField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, onChange: (value) => handleChange?.(value) }, name));
53
+ }
54
+ if (field.type === 'datepicker') {
55
+ const handleBlur = getOnBlurFn(field.attr);
56
+ return (_jsx(DatePickerField, { attr: name, label: field.size === 'small' ? undefined : field.name, createdForm: form, disabled: field.disabled, required: field.required, onChange: (_attr, value) => handleChange?.(value), onBlur: handleBlur, height: field.size === 'small' ? '32px' : undefined }, name));
57
+ }
58
+ if (field.type === 'textarea') {
59
+ return (_jsx(TextField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, required: field.required, onChange: (value) => handleChange?.(value), multiline: true, rows: field.rows, height: "100%", infoText: field.infoText, defaultEndAdornments: field.infoText ? ['info'] : ['close'] }, name));
60
+ }
61
+ if (field.type === 'color') {
62
+ return (_jsx(FormColorField, { attr: name, label: field.name, form: form, disabled: field.disabled, tooltipText: field.tooltipText, onChange: (value) => handleChange?.(value) }, name));
63
+ }
64
+ const handleBlur = getOnBlurFn(field.attr);
65
+ return (_jsx(TextField, { attr: name, label: field.size === 'small' ? undefined : field.name, placeholder: field.size === 'small' ? field.name : undefined, createdForm: form, mask: field.mask, blurMask: field.blurMask, disabled: field.disabled, required: field.required, onChange: (value) => handleChange?.(value), height: field.size === 'small' ? '32px' : undefined, onBlur: handleBlur, infoText: field.infoText, defaultEndAdornments: field.infoText ? ['info'] : ['close'] }, name));
66
+ }) }));
67
+ }
@@ -0,0 +1,37 @@
1
+ import { SelectItem } from '../../basic';
2
+ export type SwitchFieldLabels = {
3
+ trueLabel: string;
4
+ falseLabel: string;
5
+ notAvailable: string;
6
+ };
7
+ /** Renders switch (boolean) values for read-only display — no ternary chains. */
8
+ export declare function formatSwitchFieldValue(value: unknown, labels: SwitchFieldLabels): string;
9
+ export type DisplayFunction = (value: any) => string;
10
+ export type MaskFunction = (value: string, isBlur?: boolean) => string;
11
+ export type AppFormField = {
12
+ attr: string;
13
+ name: string;
14
+ title?: string;
15
+ type: string;
16
+ required?: boolean;
17
+ disabled?: boolean;
18
+ options?: SelectItem[];
19
+ tooltip?: boolean;
20
+ tooltipText?: string;
21
+ infoText?: string;
22
+ multiple?: boolean;
23
+ freeSolo?: boolean;
24
+ minQueryLength?: number;
25
+ default?: string | boolean | number;
26
+ role?: string;
27
+ fn?: (value: any) => string | number;
28
+ translation?: string;
29
+ mask?: MaskFunction;
30
+ blurMask?: MaskFunction;
31
+ pattern?: string;
32
+ rows?: number;
33
+ size?: 'medium' | 'small';
34
+ display?: DisplayFunction;
35
+ copyToClipboard?: boolean;
36
+ truncate?: number;
37
+ };
@@ -0,0 +1,10 @@
1
+ /** Renders switch (boolean) values for read-only display — no ternary chains. */
2
+ export function formatSwitchFieldValue(value, labels) {
3
+ if (value === true) {
4
+ return labels.trueLabel;
5
+ }
6
+ if (value === false) {
7
+ return labels.falseLabel;
8
+ }
9
+ return labels.notAvailable;
10
+ }
@@ -0,0 +1,9 @@
1
+ import { AppFormField } from './AppFormField';
2
+ import './style.scss';
3
+ type Props = {
4
+ fields: AppFormField[];
5
+ data: Record<string, any>;
6
+ prefix?: string;
7
+ };
8
+ export default function AppFormInfo({ fields, data }: Props): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,45 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTranslation } from 'react-i18next';
3
+ import { formatSwitchFieldValue } from './AppFormField';
4
+ import './style.scss';
5
+ import { Icon } from '../../basic';
6
+ import UsabilityUtils from '../../functions/UsabilityUtils';
7
+ function truncateValue(value, truncate, t) {
8
+ if (!value) {
9
+ return t('label.notavailable');
10
+ }
11
+ if (value.length <= truncate) {
12
+ return value;
13
+ }
14
+ return `${value.slice(0, truncate)}…`;
15
+ }
16
+ function getFieldDisplayContent(field, raw, t) {
17
+ if (field.truncate) {
18
+ return truncateValue(raw, field.truncate, t);
19
+ }
20
+ if (field.display) {
21
+ return field.display(raw);
22
+ }
23
+ if (field.fn) {
24
+ return field.fn(raw);
25
+ }
26
+ if (field.type === 'switch') {
27
+ return formatSwitchFieldValue(raw, {
28
+ trueLabel: t('generic.boolean.true'),
29
+ falseLabel: t('generic.boolean.false'),
30
+ notAvailable: t('label.notavailable'),
31
+ });
32
+ }
33
+ if (raw) {
34
+ return raw;
35
+ }
36
+ return t('label.notavailable');
37
+ }
38
+ export default function AppFormInfo({ fields, data }) {
39
+ const { t } = useTranslation('common');
40
+ return (_jsx("div", { className: "app-form-info-container", children: fields.map((field, idx) => {
41
+ return (_jsxs("div", { className: "item", ...(field.title && { title: field.title }), children: [_jsxs("span", { className: "label", children: [field.name, ":"] }), _jsx("span", { className: "value", children: getFieldDisplayContent(field, data[field.attr], t) }), field.copyToClipboard && (_jsx(Icon, { name: "content_copy", size: "small", className: "ds-copy-icon", filled: true, onClick: () => {
42
+ UsabilityUtils.copy(data[field.attr]);
43
+ } }))] }, idx));
44
+ }) }));
45
+ }
@@ -0,0 +1,12 @@
1
+ import { FieldValues, UseFormReturn } from 'react-hook-form';
2
+ import '../AppColorpicker/style.scss';
3
+ type Props<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues> = {
4
+ attr: string;
5
+ label: string;
6
+ form: UseFormReturn<TFieldValues, TContext, TTransformedValues>;
7
+ disabled?: boolean;
8
+ tooltipText?: string;
9
+ onChange?: (value: string) => void;
10
+ };
11
+ export default function FormColorField<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>({ attr, label, form, disabled, tooltipText, onChange, }: Props<TFieldValues, TContext, TTransformedValues>): import("react").JSX.Element;
12
+ export {};
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { HexColorPicker } from 'react-colorful';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { Button, Icon, Tooltip } from '../../basic';
6
+ import '../AppColorpicker/style.scss';
7
+ const defaultColor = '#FFFFFF';
8
+ export default function FormColorField({ attr, label, form, disabled, tooltipText, onChange, }) {
9
+ const fieldName = attr;
10
+ const { t } = useTranslation('common');
11
+ const formValue = form.watch(fieldName);
12
+ const [openColor, setOpenColor] = useState(false);
13
+ const [color, setColor] = useState(defaultColor);
14
+ useEffect(() => {
15
+ setColor(formValue || defaultColor);
16
+ }, [formValue]);
17
+ const handleConfirm = () => {
18
+ form.setValue(fieldName, color, { shouldDirty: true });
19
+ onChange?.(color);
20
+ setOpenColor(false);
21
+ };
22
+ return (_jsxs("div", { className: "form-color-field", children: [_jsxs("div", { className: "form-color-field-label", children: [_jsx("span", { children: label }), tooltipText && (_jsx(Tooltip, { title: tooltipText, children: _jsx("span", { children: _jsx(Icon, { name: "help", className: "info", size: "x-small" }) }) }))] }), _jsxs("div", { className: "color-picker-container", children: [_jsx("div", { className: "swatch", style: { backgroundColor: color }, onClick: () => !disabled && setOpenColor(!openColor), onKeyDown: () => !disabled && setOpenColor(!openColor), role: "link", "aria-label": "open color picker", tabIndex: disabled ? -1 : 0 }), openColor && !disabled && (_jsxs(_Fragment, { children: [_jsx(HexColorPicker, { color: color, onChange: setColor }), _jsxs("div", { className: "buttons", children: [_jsx(Button, { text: t('button.confirm'), onClick: handleConfirm, size: "x-small" }), _jsx(Button, { text: t('button.cancel'), onClick: () => setOpenColor(false), color: "danger", size: "x-small" })] })] }))] })] }));
23
+ }
@@ -0,0 +1,2 @@
1
+ import AppFormInfo from './AppFormInfo';
2
+ export default AppFormInfo;
@@ -0,0 +1,2 @@
1
+ import AppFormInfo from './AppFormInfo';
2
+ export default AppFormInfo;
@@ -0,0 +1,60 @@
1
+ .app-form-info-container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 16px;
5
+
6
+ .item {
7
+ display: flex;
8
+ align-items: center;
9
+ gap: 4px;
10
+
11
+ &.full-width {
12
+ grid-column: 1 / -1;
13
+ }
14
+
15
+ .label {
16
+ @include label-medium-2;
17
+ color: var(--text-primary);
18
+ }
19
+
20
+ .value {
21
+ @include body-medium-1;
22
+ color: var(--text-secondary);
23
+ }
24
+
25
+ > .ds-copy-icon {
26
+ color: var(--icon-primary);
27
+ cursor: pointer;
28
+ }
29
+ }
30
+ }
31
+
32
+ .app-form-container {
33
+ display: flex;
34
+ flex-direction: column;
35
+ gap: 16px;
36
+
37
+ &.two-columns {
38
+ display: grid;
39
+ grid-template-columns: repeat(2, 1fr);
40
+ gap: 16px;
41
+ }
42
+ }
43
+
44
+ .form-color-field {
45
+ display: flex;
46
+ flex-direction: column;
47
+ gap: var(--spacing-100);
48
+
49
+ .form-color-field-label {
50
+ display: flex;
51
+ align-items: center;
52
+ gap: var(--spacing-50);
53
+ @include label-medium-2;
54
+ color: var(--text-primary);
55
+
56
+ .info {
57
+ color: var(--icon-primary);
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,7 @@
1
+ import './style.scss';
2
+ type Props = {
3
+ className?: string;
4
+ pageLoading?: boolean;
5
+ };
6
+ export default function AppLoading({ className, pageLoading, }: Props): import("react").JSX.Element;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import cx from 'classnames';
3
+ import ReactLoading from 'react-loading';
4
+ import './style.scss';
5
+ export default function AppLoading({ className = '', pageLoading = false, }) {
6
+ const containerClassName = cx('loading-container', { 'page-loading': pageLoading }, className);
7
+ return (_jsx("div", { className: containerClassName, children: _jsx(ReactLoading, { type: "spinningBubbles", color: "blue", height: 50, width: 50 }) }));
8
+ }
@@ -0,0 +1,2 @@
1
+ import AppLoading from './AppLoading';
2
+ export default AppLoading;
@@ -0,0 +1,2 @@
1
+ import AppLoading from './AppLoading';
2
+ export default AppLoading;
@@ -0,0 +1,5 @@
1
+ .loading-container {
2
+ &.page-loading {
3
+ margin: 10% auto 0;
4
+ }
5
+ }
@@ -0,0 +1,27 @@
1
+ import './style.scss';
2
+ type Props = {
3
+ children: React.ReactNode;
4
+ title: string;
5
+ close: () => void;
6
+ confirm?: () => void;
7
+ cancel?: () => void;
8
+ subtitle?: string;
9
+ className?: string;
10
+ disableConfirm?: boolean;
11
+ hideFooter?: boolean;
12
+ disableCancel?: boolean;
13
+ disableClose?: boolean;
14
+ disableEscapeClose?: boolean;
15
+ confirmLabel?: string;
16
+ closeLabel?: string;
17
+ onEntered?: () => void;
18
+ alternativeButton?: {
19
+ title: string;
20
+ action: () => void;
21
+ };
22
+ alternativeOptions?: React.ReactNode;
23
+ hideBackdrop?: boolean;
24
+ disableBackdropClose?: boolean;
25
+ };
26
+ export default function AppModal({ children, title, subtitle, className, close, confirm, disableConfirm, hideFooter, disableClose, disableEscapeClose, disableCancel, confirmLabel, closeLabel, cancel, onEntered, alternativeButton, hideBackdrop, alternativeOptions, disableBackdropClose, }: Props): import("react").JSX.Element;
27
+ export {};
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Fade, Modal } from '@mui/material';
3
+ import cx from 'classnames';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { Button, Icon } from '../../basic';
6
+ import './style.scss';
7
+ import { useEffect } from 'react';
8
+ import { attachCloseToEscape, stopEventPropagation } from './AppModalUtils';
9
+ export default function AppModal({ children, title, subtitle, className, close, confirm, disableConfirm, hideFooter, disableClose, disableEscapeClose, disableCancel, confirmLabel, closeLabel, cancel, onEntered, alternativeButton, hideBackdrop, alternativeOptions, disableBackdropClose, }) {
10
+ const { t } = useTranslation('common');
11
+ const getClassNames = cx('modal-container', className);
12
+ useEffect(() => {
13
+ if (disableEscapeClose)
14
+ return;
15
+ return attachCloseToEscape(close);
16
+ }, [close, disableEscapeClose]);
17
+ return (_jsx(Modal, { open: true, disableEnforceFocus: true, disableAutoFocus: true, disableRestoreFocus: true, hideBackdrop: hideBackdrop, disableEscapeKeyDown: !!disableEscapeClose, onClose: (event, reason) => {
18
+ stopEventPropagation(event);
19
+ if (disableBackdropClose && reason === 'backdropClick')
20
+ return;
21
+ if (disableClose)
22
+ return;
23
+ close();
24
+ }, children: _jsx(Fade, { in: true, onEntered: () => onEntered && onEntered(), children: _jsxs(Box, { className: getClassNames, sx: style, children: [_jsxs("div", { className: "header", children: [_jsxs("div", { className: "titles", children: [_jsx("span", { className: "title", children: title }), subtitle && _jsx("span", { className: "subtitle", children: subtitle })] }), !disableClose && (_jsx(Icon, { name: "close", onClick: (e) => {
25
+ stopEventPropagation(e);
26
+ close();
27
+ }, className: "pointer" }))] }), _jsx("div", { className: "body", children: children }), !hideFooter ? (_jsxs("div", { className: "footer", children: [alternativeOptions && alternativeOptions, alternativeButton && (_jsx(Button, { className: "alternative", color: "white", onClick: alternativeButton.action, text: alternativeButton.title })), !disableCancel && (_jsx(Button, { onClick: (e) => {
28
+ stopEventPropagation(e);
29
+ (cancel || close)();
30
+ }, text: closeLabel || t('button.cancel'), mode: "tonal" })), confirm && (_jsx(Button, { onClick: confirm, disabled: disableConfirm, text: confirmLabel || t('button.confirm') }))] })) : null] }) }) }));
31
+ }
32
+ const style = {
33
+ position: 'absolute',
34
+ top: '40%',
35
+ left: '50%',
36
+ transform: 'translate(-50%, -50%)',
37
+ width: '50%',
38
+ maxWidth: '1080px',
39
+ borderRadius: 'var(--radius-200)',
40
+ boxShadow: 24,
41
+ bgcolor: 'var(--background-default)',
42
+ };
@@ -0,0 +1,15 @@
1
+ import './style.scss';
2
+ type Props = {
3
+ title: string;
4
+ subtitle: string | React.ReactNode;
5
+ onClose?: () => void;
6
+ onConfirm: () => void;
7
+ closeLabel?: string;
8
+ confirmLabel?: string;
9
+ disableClose?: boolean;
10
+ disableEscapeClose?: boolean;
11
+ disableBackdropClose?: boolean;
12
+ confirmDisabled?: boolean;
13
+ };
14
+ export default function AppModalConfirm({ title, subtitle, onClose, onConfirm, closeLabel, confirmLabel, confirmDisabled, disableClose, disableEscapeClose, disableBackdropClose, }: Props): import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Modal } from '@mui/material';
3
+ import { useEffect } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { Button, Icon } from '../../basic';
6
+ import './style.scss';
7
+ import { attachCloseToEscape, stopEventPropagation } from './AppModalUtils';
8
+ export default function AppModalConfirm({ title, subtitle, onClose, onConfirm, closeLabel, confirmLabel, confirmDisabled, disableClose, disableEscapeClose, disableBackdropClose, }) {
9
+ const { t } = useTranslation('common');
10
+ useEffect(() => {
11
+ if (!onClose || disableEscapeClose)
12
+ return;
13
+ return attachCloseToEscape(onClose);
14
+ }, [onClose, disableEscapeClose]);
15
+ return (_jsx(Modal, { open: true, disableEscapeKeyDown: !onClose || !!disableEscapeClose, onClose: (event, reason) => {
16
+ stopEventPropagation(event);
17
+ if (!onClose || disableClose)
18
+ return;
19
+ if (disableBackdropClose && reason === 'backdropClick')
20
+ return;
21
+ onClose();
22
+ }, children: _jsxs(Box, { className: "modal-container modal-confirm", sx: style, children: [_jsxs("div", { className: "body", children: [_jsx(Icon, { name: "warning", size: "large", filled: true }), _jsxs("div", { className: "texts", children: [_jsx("span", { className: "title", children: title }), _jsx("span", { className: "subtitle", children: subtitle })] })] }), _jsxs("div", { className: "footer", children: [onClose && (_jsx(Button, { onClick: (e) => {
23
+ stopEventPropagation(e);
24
+ onClose();
25
+ }, text: closeLabel || t('button.cancel'), mode: "tonal" })), _jsx(Button, { onClick: onConfirm, text: confirmLabel || t('button.confirm'), disabled: confirmDisabled })] })] }) }));
26
+ }
27
+ const style = {
28
+ position: 'absolute',
29
+ top: '40%',
30
+ left: '50%',
31
+ transform: 'translate(-50%, -50%)',
32
+ width: '30%',
33
+ maxWidth: '580px',
34
+ borderRadius: 'var(--radius-200)',
35
+ boxShadow: 24,
36
+ bgcolor: 'var(--background-default)',
37
+ };