@cashub/ui-elv 1.0.2 → 1.0.3

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 (309) hide show
  1. package/datetimePicker/index.js +2 -37
  2. package/esm/Tab/Tab.js +21 -0
  3. package/esm/Tab/TabList.js +160 -0
  4. package/esm/Tab/TabPanel.js +42 -0
  5. package/esm/Tab/TabTab.js +98 -0
  6. package/esm/Tab/index.js +23 -0
  7. package/esm/Tab/subComponent/TabContext.js +3 -0
  8. package/esm/Tab/subComponent/TabListV2.js +18 -0
  9. package/esm/Tab/subComponent/TabPanelV2.js +45 -0
  10. package/esm/Tab/subComponent/TabTabV2.js +56 -0
  11. package/esm/VerticalTab/TabList.js +20 -0
  12. package/esm/VerticalTab/TabPanel.js +45 -0
  13. package/esm/VerticalTab/TabTab.js +63 -0
  14. package/esm/VerticalTab/VerticalTab.js +34 -0
  15. package/esm/VerticalTab/index.js +9 -0
  16. package/esm/VerticalTab/subComponent/TabContext.js +3 -0
  17. package/esm/alert/Alert.js +22 -0
  18. package/esm/alert/index.js +1 -0
  19. package/esm/animate/Collapse.js +65 -0
  20. package/esm/animate/Loader.js +51 -0
  21. package/esm/animate/NumberCounter.js +45 -0
  22. package/esm/animate/PulseRing.js +26 -0
  23. package/esm/animate/Spinner.js +11 -0
  24. package/esm/animate/index.js +5 -0
  25. package/esm/assets/css/autocomplete.css +16 -0
  26. package/esm/assets/css/font.css +4 -0
  27. package/esm/assets/css/global.css +2 -0
  28. package/esm/assets/font/helvetica/Helvetica.ttf +0 -0
  29. package/esm/assets/font/nanumGothic/NanumGothic-Bold.ttf +0 -0
  30. package/esm/assets/font/nanumGothic/NanumGothic-ExtraBold.ttf +0 -0
  31. package/esm/assets/font/nanumGothic/NanumGothic-Regular.ttf +0 -0
  32. package/esm/assets/icons/app-management.png +0 -0
  33. package/esm/assets/icons/burger-black.png +0 -0
  34. package/esm/assets/icons/burger-white.png +0 -0
  35. package/esm/assets/icons/burger.png +0 -0
  36. package/esm/assets/icons/file.svg +1 -0
  37. package/esm/assets/icons/map_icon1.png +0 -0
  38. package/esm/assets/icons/map_icon4.png +0 -0
  39. package/esm/assets/images/bg-aside.png +0 -0
  40. package/esm/assets/images/bg-chart-circle.png +0 -0
  41. package/esm/assets/images/bg-chart-triangle.png +0 -0
  42. package/esm/assets/images/cashub-logo-only.png +0 -0
  43. package/esm/assets/images/default-user.jpg +0 -0
  44. package/esm/assets/images/logo-cashub.png +0 -0
  45. package/esm/assets/images/map.png +0 -0
  46. package/esm/assets/images/qrcode.png +0 -0
  47. package/esm/backdrop/BaseBackdrop.js +11 -0
  48. package/esm/backdrop/LoadingBackdrop.js +10 -0
  49. package/esm/backdrop/ModalBackdrop.js +8 -0
  50. package/esm/backdrop/index.js +3 -0
  51. package/esm/badge/Badge.js +19 -0
  52. package/esm/badge/BadgeDot.js +11 -0
  53. package/esm/badge/BadgeFill.js +42 -0
  54. package/esm/badge/BadgeFillTriangle.js +138 -0
  55. package/esm/badge/BadgeWithText.js +24 -0
  56. package/esm/badge/index.js +5 -0
  57. package/esm/billing/BarChart.js +45 -0
  58. package/esm/billing/Grid.js +38 -0
  59. package/esm/billing/Header2.js +19 -0
  60. package/esm/billing/Header3.js +31 -0
  61. package/esm/billing/Paragraph.js +27 -0
  62. package/esm/billing/ParagraphGroup.js +16 -0
  63. package/esm/billing/ParagraphText.js +20 -0
  64. package/esm/billing/Section.js +44 -0
  65. package/esm/billing/SectionBody.js +11 -0
  66. package/esm/billing/SectionHeader.js +20 -0
  67. package/esm/billing/__stories__/BarChart.stories.js_bak +46 -0
  68. package/esm/billing/__stories__/Grid.stories.js_bak +57 -0
  69. package/esm/billing/__stories__/Header2.stories.js_bak +62 -0
  70. package/esm/billing/__stories__/Header3.stories.js_bak +69 -0
  71. package/esm/billing/__stories__/Paragraph.stories.js_bak +84 -0
  72. package/esm/billing/__stories__/ParagraphGroup.stories.js_bak +68 -0
  73. package/esm/billing/__stories__/ParagraphText.stories.js_bak +64 -0
  74. package/esm/billing/__stories__/Section.stories.js_bak +115 -0
  75. package/esm/billing/__stories__/SectionBody.stories.js_bak +62 -0
  76. package/esm/billing/__stories__/SectionHeader.stories.js-bak +68 -0
  77. package/esm/breadcrumb/Breadcrumb.js +71 -0
  78. package/esm/breadcrumb/index.js +1 -0
  79. package/esm/button/Button.js +145 -0
  80. package/esm/button/ButtonGroup.js +54 -0
  81. package/esm/button/IconButton.js +64 -0
  82. package/esm/button/ScrollToTopButton.js +47 -0
  83. package/esm/button/index.js +4 -0
  84. package/esm/callout/Callout.js +45 -0
  85. package/esm/callout/index.js +1 -0
  86. package/esm/chart/BarChart.js +147 -0
  87. package/esm/chart/DoughnutChart.js +110 -0
  88. package/esm/chart/LineChart.js +140 -0
  89. package/esm/chart/SingleBarChart.js +35 -0
  90. package/esm/chart/index.js +5 -0
  91. package/esm/chart/utils/centerTextPlugin.js +56 -0
  92. package/esm/chart/utils/customTooltip.js +84 -0
  93. package/esm/chart/utils/customTooltipLifecyclePlugin.js +16 -0
  94. package/esm/chart/utils/htmlLegendPlugin.js +83 -0
  95. package/esm/chart/utils/index.js +3 -0
  96. package/esm/chart/utils/padEmptyChartBar.js +47 -0
  97. package/esm/chart/utils/tooltipElement.js +17 -0
  98. package/esm/chart/utils/xAxisLabelTooltipPlugin.js +101 -0
  99. package/esm/chart/utils/yAxisTopTitlePlugin.js +43 -0
  100. package/esm/container/FlexContainer.js +33 -0
  101. package/esm/container/index.js +1 -0
  102. package/esm/cropper/Cropper.js +47 -0
  103. package/esm/cropper/CropperModalHandler.js +34 -0
  104. package/esm/cropper/index.js +2 -0
  105. package/esm/cropper/subComponent/CropImageModal.js +72 -0
  106. package/{datetimePicker/DatetimePicker.js → esm/datetimePicker/DatetimePickerV3.js} +63 -31
  107. package/esm/datetimePicker/TimeInput.js +49 -0
  108. package/esm/datetimePicker/TimePickerStyle.js +58 -0
  109. package/esm/datetimePicker/TimePickerV2.js +199 -0
  110. package/esm/datetimePicker/accordion/Month.js +245 -0
  111. package/esm/datetimePicker/accordion/Year.js +275 -0
  112. package/esm/datetimePicker/index.js +4 -0
  113. package/esm/datetimePicker/provider/constant.js +38 -0
  114. package/esm/datetimePicker/subComponent/DateTimePickerContext.js +3 -0
  115. package/esm/datetimePicker/utils/GMTDate.js +9 -0
  116. package/esm/datetimePicker/utils/pad.js +7 -0
  117. package/esm/datetimePicker/utils/toUTC0.js +7 -0
  118. package/esm/descriptionList/DescriptionDetail.js +21 -0
  119. package/esm/descriptionList/DescriptionList.js +18 -0
  120. package/esm/descriptionList/DescriptionTerm.js +7 -0
  121. package/esm/descriptionList/index.js +3 -0
  122. package/esm/divider/Divider.js +24 -0
  123. package/esm/divider/index.js +1 -0
  124. package/esm/dropdown/Dropdown.js +48 -0
  125. package/esm/dropdown/DropdownButtonOption.js +36 -0
  126. package/esm/dropdown/DropdownContent.js +83 -0
  127. package/esm/dropdown/DropdownDivOption.js +19 -0
  128. package/esm/dropdown/DropdownItem.js +19 -0
  129. package/esm/dropdown/DropdownLinkOption.js +17 -0
  130. package/esm/dropdown/DropdownToggle.js +31 -0
  131. package/esm/dropdown/index.js +11 -0
  132. package/esm/dropdown/subComponent/DropdownContext.js +3 -0
  133. package/esm/dropzone/FileDropzone.js +472 -0
  134. package/esm/dropzone/ImageDropzone.js +327 -0
  135. package/esm/dropzone/index.js +2 -0
  136. package/esm/dropzone/subComponent/Message.js +19 -0
  137. package/esm/figure/IconFigure.js +35 -0
  138. package/esm/figure/ImageFigure.js +31 -0
  139. package/esm/figure/index.js +2 -0
  140. package/esm/file/HiddenFileInput.js +8 -0
  141. package/esm/file/index.js +1 -0
  142. package/esm/form/Checkbox.js +157 -0
  143. package/esm/form/Fieldset.js +11 -0
  144. package/esm/form/FormItem.js +15 -0
  145. package/esm/form/Input.js +59 -0
  146. package/esm/form/Label.js +54 -0
  147. package/esm/form/MutedText.js +14 -0
  148. package/esm/form/PasswordInput.js +40 -0
  149. package/esm/form/RadioButton.js +94 -0
  150. package/esm/form/SearchSelect.js +174 -0
  151. package/esm/form/Searchbox.js +91 -0
  152. package/esm/form/Slider.js +39 -0
  153. package/esm/form/SwitchButton.js +97 -0
  154. package/esm/form/Textarea.js +34 -0
  155. package/esm/form/TreeView.js +66 -0
  156. package/esm/form/index.js +14 -0
  157. package/esm/grid/Column.js +39 -0
  158. package/esm/grid/Grid.js +28 -0
  159. package/esm/grid/index.js +2 -0
  160. package/esm/heading/Heading1.js +14 -0
  161. package/esm/heading/Heading2.js +21 -0
  162. package/esm/heading/Heading3.js +42 -0
  163. package/esm/heading/index.js +3 -0
  164. package/esm/helmet/Helmet.js +17 -0
  165. package/esm/helmet/index.js +2 -0
  166. package/esm/iconbox/ApplicationIconBox.js +74 -0
  167. package/esm/iconbox/IconBox.js +60 -0
  168. package/esm/iconbox/IconBoxV2.js +63 -0
  169. package/esm/iconbox/index.js +3 -0
  170. package/esm/iconbox/subComponent/IconBoxFigure.js +43 -0
  171. package/esm/iconbox/subComponent/IconBoxImage.js +35 -0
  172. package/esm/image/ImageFluid.js +10 -0
  173. package/esm/image/UploadImage.js +243 -0
  174. package/esm/image/index.js +2 -0
  175. package/esm/index.js +47 -0
  176. package/esm/keyframe/Pulse.js +15 -0
  177. package/esm/keyframe/Spin.js +7 -0
  178. package/esm/layout/Aside.js +39 -0
  179. package/esm/layout/AsideHeader.jsx +27 -0
  180. package/esm/layout/Backdrop.js +16 -0
  181. package/esm/layout/Container.js +30 -0
  182. package/esm/layout/Footer.js +36 -0
  183. package/esm/layout/Header.jsx +55 -0
  184. package/esm/layout/Layout.jsx +84 -0
  185. package/esm/layout/Logo.jsx +17 -0
  186. package/esm/layout/MenuIcon.jsx +27 -0
  187. package/esm/layout/Sidebar.jsx +271 -0
  188. package/esm/layout/index.js +1 -0
  189. package/esm/link/LinkSpan.js +62 -0
  190. package/esm/link/index.js +1 -0
  191. package/esm/map/GoogleMap.js +439 -0
  192. package/esm/map/GoogleReverseGeolocation.js +193 -0
  193. package/esm/map/LeafletMap.js +224 -0
  194. package/esm/map/LeafletReverseGeolocation.js +94 -0
  195. package/esm/map/index.js +4 -0
  196. package/esm/map/subComponent/BasicLeafletMap.js +27 -0
  197. package/esm/map/subComponent/GoogleMapContainer.js +22 -0
  198. package/esm/map/subComponent/GoogleMapPopup.js +103 -0
  199. package/esm/map/subComponent/GoogleMapWrapper.js +34 -0
  200. package/esm/map/subComponent/LeafletDrawControl.js +116 -0
  201. package/esm/map/subComponent/LeafletMapContainer.js +166 -0
  202. package/esm/map/subComponent/MapSearchBoxControl.js +47 -0
  203. package/esm/modal/StateModal.js +169 -0
  204. package/esm/modal/TitleModal.js +241 -0
  205. package/esm/modal/index.js +2 -0
  206. package/esm/page/Disclaimer.js +121 -0
  207. package/esm/page/index.js +1 -0
  208. package/esm/paginate/Paginate.js +129 -0
  209. package/esm/paginate/index.js +1 -0
  210. package/esm/popover/Popover.js +82 -0
  211. package/esm/popover/index.js +1 -0
  212. package/esm/qrcode/QRCode.js +51 -0
  213. package/esm/qrcode/QRCodeContainter.js +27 -0
  214. package/esm/qrcode/index.js +2 -0
  215. package/esm/ribbon/Ribbon.js +35 -0
  216. package/esm/ribbon/index.js +1 -0
  217. package/esm/section/Section.js +126 -0
  218. package/esm/section/SectionBody.js +43 -0
  219. package/esm/section/SectionHeader.js +61 -0
  220. package/esm/section/SectionToolbar.js +11 -0
  221. package/esm/section/SectionToolbarItem.js +10 -0
  222. package/esm/section/index.js +5 -0
  223. package/esm/select/InputSelect.js +263 -0
  224. package/esm/select/Select.js +811 -0
  225. package/esm/select/index.js +2 -0
  226. package/esm/select/subComponent/Checkbox.js +40 -0
  227. package/esm/select/subComponent/Footer.js +6 -0
  228. package/esm/select/subComponent/ListBox.js +23 -0
  229. package/esm/select/subComponent/Option.js +37 -0
  230. package/esm/select/subComponent/OptionGroup.js +16 -0
  231. package/esm/select/subComponent/Options.js +25 -0
  232. package/esm/select/subComponent/SearchBox.js +51 -0
  233. package/esm/select/subComponent/SelectedMultipleCount.js +32 -0
  234. package/esm/select/subComponent/SelectedMultipleTags.js +47 -0
  235. package/esm/select/subComponent/SelectedMultipleText.js +63 -0
  236. package/esm/select/subComponent/SelectedSingle.js +10 -0
  237. package/esm/styles/GlobalStyle.js +328 -0
  238. package/esm/styles/config/breakpoint.style.js +7 -0
  239. package/esm/styles/config/header.style.js +4 -0
  240. package/esm/styles/config/sidebar.style.js +11 -0
  241. package/esm/styles/index.js +2 -0
  242. package/esm/styles/mixin/backgroundColor.js +38 -0
  243. package/esm/styles/mixin/borderColor.js +31 -0
  244. package/esm/styles/mixin/color.js +31 -0
  245. package/esm/styles/mixin/colorOnBackground.js +31 -0
  246. package/esm/styles/mixin/inputPlaceholder.js +24 -0
  247. package/esm/styles/mixin/media.js +15 -0
  248. package/esm/styles/mixin/rounded.js +24 -0
  249. package/esm/styles/mixin/scrollbar.js +26 -0
  250. package/esm/styles/theme/dark.theme.js +91 -0
  251. package/esm/styles/theme/light.theme.js +91 -0
  252. package/esm/styles/theme/white.theme.js +91 -0
  253. package/esm/styles/themes.js +9 -0
  254. package/esm/table/GridTable.js +329 -0
  255. package/esm/table/ImageBox.js +38 -0
  256. package/esm/table/InfiniteGridTable.js +396 -0
  257. package/esm/table/PermissionTable.js +57 -0
  258. package/esm/table/SimpleGridTable.js +136 -0
  259. package/esm/table/Table.js +559 -0
  260. package/esm/table/__mock__/columns.js +64 -0
  261. package/esm/table/__mock__/data.js +530 -0
  262. package/esm/table/hooks/index.js +2 -0
  263. package/esm/table/hooks/useCalculateDataRange.js +22 -0
  264. package/esm/table/hooks/useGenerateSort.js +32 -0
  265. package/esm/table/index.js +6 -0
  266. package/esm/table/subComponent/BaseTableHeadCell.js +54 -0
  267. package/esm/table/subComponent/GridTableFooter.js +17 -0
  268. package/esm/table/subComponent/GridTableHeadCell.js +13 -0
  269. package/esm/table/subComponent/Resizer.js +70 -0
  270. package/esm/table/subComponent/TableFooter.js +24 -0
  271. package/esm/table/subComponent/TableFooterInfo.js +6 -0
  272. package/esm/table/subComponent/TableFooterPager.js +26 -0
  273. package/esm/table/subComponent/TableHeadCell.js +12 -0
  274. package/esm/table/subComponent/TableSort.js +31 -0
  275. package/esm/tagify/TagifyStyle.js +54 -0
  276. package/esm/tagify/Tags.js +49 -0
  277. package/esm/tagify/index.js +3 -0
  278. package/esm/tagify/templates/getCreateButtonTemplate.js +12 -0
  279. package/esm/text/Paragraph.js +79 -0
  280. package/esm/text/index.js +1 -0
  281. package/esm/timeline/Timeline.js +132 -0
  282. package/esm/timeline/index.js +1 -0
  283. package/esm/toast/CustomToastContainer.js +38 -0
  284. package/esm/toast/MessageContainer.js +44 -0
  285. package/esm/toast/index.js +3 -0
  286. package/esm/toast/show.js +29 -0
  287. package/esm/toast/style.css +1 -0
  288. package/esm/tooltip/Tooltip.js +133 -0
  289. package/esm/tooltip/index.js +1 -0
  290. package/esm/treeView/TreeViewV2.js +32 -0
  291. package/esm/treeView/TreeflexStyle.js +43 -0
  292. package/esm/treeView/index.js +2 -0
  293. package/esm/wizard/Wizard.js +244 -0
  294. package/esm/wizard/index.js +1 -0
  295. package/index.js +0 -12
  296. package/layout/Sidebar.jsx +1 -1
  297. package/package.json +5 -4
  298. package/datetimePicker/DatePicker.js +0 -363
  299. package/datetimePicker/DatePickerV2.js +0 -407
  300. package/datetimePicker/DatetimePickerV2.js +0 -395
  301. package/datetimePicker/TimePicker.js +0 -317
  302. package/datetimePicker/hooks/index.js +0 -27
  303. package/datetimePicker/hooks/useChangeNumber.js +0 -42
  304. package/datetimePicker/hooks/useDecrease.js +0 -38
  305. package/datetimePicker/hooks/useIncrease.js +0 -38
  306. package/datetimePicker/subComponent/Accordion.js +0 -373
  307. package/datetimePicker/subComponent/CustomTimeInput.js +0 -47
  308. package/jsoneditor/JsonEditor.js +0 -142
  309. package/jsoneditor/index.js +0 -13
@@ -0,0 +1,327 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
2
+ import styled from 'styled-components';
3
+ import { FiX, FiUpload } from 'react-icons/fi/index.esm';
4
+ import { MdCrop } from 'react-icons/md/index.esm';
5
+ import { dataURLtoFile } from '@cashub/utils';
6
+ import HiddenFileInput from '../file/HiddenFileInput';
7
+ import Message from './subComponent/Message';
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ const ImageDropzone = _ref => {
10
+ let {
11
+ width = 180,
12
+ height = 320,
13
+ fixedSize = true,
14
+ maxFiles,
15
+ message,
16
+ accept,
17
+ disabled,
18
+ onAddedFile,
19
+ onRemovedFile,
20
+ setDropzoneFunc,
21
+ cropper,
22
+ onBlur
23
+ } = _ref;
24
+ const inputRef = useRef(null);
25
+ const [files, setFiles] = useState([]);
26
+ const [dragging, setDragging] = useState(false);
27
+ const [addedFiles, setAddedFiles] = useState([]);
28
+ const [focus, setFocus] = useState(false);
29
+ const handleClick = () => {
30
+ if (disabled || files.length >= maxFiles) return;
31
+ setFocus(false);
32
+ inputRef.current.click();
33
+ };
34
+ const handleDragEnter = event => {
35
+ event.preventDefault();
36
+ event.stopPropagation();
37
+ if (!disabled && files.length < maxFiles) setDragging(true);
38
+ };
39
+ const handleDragOver = event => {
40
+ event.preventDefault();
41
+ event.stopPropagation();
42
+ if (!disabled && files.length < maxFiles) setDragging(true);
43
+ };
44
+ const handleDragLeave = event => {
45
+ event.preventDefault();
46
+ event.stopPropagation();
47
+ setDragging(false);
48
+ };
49
+ const handleDrop = event => {
50
+ event.preventDefault();
51
+ event.stopPropagation();
52
+ if (!disabled && files.length < maxFiles) {
53
+ setDragging(false);
54
+ const {
55
+ dataTransfer
56
+ } = event;
57
+ const {
58
+ files: [...newFiles]
59
+ } = dataTransfer;
60
+ if (files.length + newFiles.length > maxFiles) {
61
+ newFiles.splice(maxFiles - files.length);
62
+ }
63
+ for (let index = 0; index < newFiles.length; index += 1) {
64
+ newFiles[index].url = URL.createObjectURL(newFiles[index]);
65
+ }
66
+ setFiles([...files, ...newFiles]);
67
+ setAddedFiles(newFiles);
68
+ }
69
+ };
70
+ const handleAddFiles = useCallback(newFiles => {
71
+ setFiles(previous => {
72
+ if (previous.length + newFiles.length > maxFiles) {
73
+ newFiles.splice(maxFiles - previous.length);
74
+ }
75
+ return [...previous, ...newFiles];
76
+ });
77
+ for (let index = 0; index < newFiles.length; index += 1) {
78
+ newFiles[index].url = URL.createObjectURL(newFiles[index]);
79
+ }
80
+ setAddedFiles(newFiles);
81
+ }, [maxFiles]);
82
+ const handleRemoveFile = useCallback((event, index) => {
83
+ if (event) {
84
+ event.stopPropagation();
85
+ }
86
+ setFiles(previous => {
87
+ const newFiles = [...previous];
88
+ newFiles.splice(index, 1);
89
+ return newFiles;
90
+ });
91
+ if (onRemovedFile) onRemovedFile(index);
92
+ }, [onRemovedFile]);
93
+ const handleChangeFile = useCallback(event => {
94
+ const {
95
+ files
96
+ } = event.target;
97
+ const newFiles = [];
98
+ for (let index = 0; index < files.length; index += 1) {
99
+ newFiles.push(files[index]);
100
+ }
101
+ handleAddFiles(newFiles);
102
+ inputRef.current.value = '';
103
+ }, [handleAddFiles]);
104
+ const handleCrop = useCallback((event, index, file) => {
105
+ event.stopPropagation();
106
+ setFocus(false);
107
+ cropper.handler({
108
+ file,
109
+ src: file.url,
110
+ width,
111
+ height,
112
+ cropBoxResizable: cropper.cropBoxResizable ? cropper.cropBoxResizable : false,
113
+ onCrop: croppedSrc => {
114
+ const croppedImageFile = dataURLtoFile(croppedSrc, file.name);
115
+ croppedImageFile.url = croppedSrc;
116
+ cropper.onCrop(index, croppedImageFile);
117
+ setFiles(previousFiles => {
118
+ const newFiles = [...previousFiles];
119
+ newFiles[index] = croppedImageFile;
120
+ return newFiles;
121
+ });
122
+ }
123
+ });
124
+ }, [width, height, cropper]);
125
+ const previewItem = () => {
126
+ return files.map((file, index) => {
127
+ return /*#__PURE__*/_jsxs(Image, {
128
+ width: width,
129
+ height: height,
130
+ fixedSize: fixedSize,
131
+ onClick: event => {
132
+ event.stopPropagation();
133
+ },
134
+ children: [!disabled && /*#__PURE__*/_jsxs(ButtonGroup, {
135
+ children: [cropper && /*#__PURE__*/_jsx(Button, {
136
+ title: "Crop",
137
+ onClick: event => handleCrop(event, index, file),
138
+ children: /*#__PURE__*/_jsx(MdCrop, {})
139
+ }), /*#__PURE__*/_jsx(Button, {
140
+ danger: true,
141
+ title: "Remove",
142
+ onClick: event => handleRemoveFile(event, index),
143
+ children: /*#__PURE__*/_jsx(FiX, {})
144
+ })]
145
+ }), /*#__PURE__*/_jsx("img", {
146
+ crossOrigin: "anonymous",
147
+ src: file.url,
148
+ alt: file.name
149
+ })]
150
+ }, index);
151
+ });
152
+ };
153
+ const addFiles = useCallback(files => {
154
+ handleAddFiles(files);
155
+ }, [handleAddFiles]);
156
+ const remove = useCallback(index => {
157
+ handleRemoveFile(null, index);
158
+ }, [handleRemoveFile]);
159
+ const handleBlur = () => {
160
+ if (focus) {
161
+ if (onBlur) {
162
+ onBlur();
163
+ }
164
+ setFocus(false);
165
+ }
166
+ };
167
+ useEffect(() => {
168
+ if (addedFiles.length > 0 && onAddedFile) {
169
+ const startIndex = files.length - addedFiles.length;
170
+ addedFiles.forEach((file, index) => {
171
+ onAddedFile(file, startIndex + index);
172
+ });
173
+ setAddedFiles([]);
174
+ }
175
+ }, [addedFiles, onAddedFile, files]);
176
+ useEffect(() => {
177
+ setDropzoneFunc({
178
+ addFiles,
179
+ remove
180
+ });
181
+ }, [setDropzoneFunc, addFiles, remove]);
182
+ const messageItem = /*#__PURE__*/_jsxs(Message, {
183
+ dragging: dragging,
184
+ children: [/*#__PURE__*/_jsx(FiUpload, {
185
+ role: "img",
186
+ "aria-hidden": "true",
187
+ "data-icon": "upload"
188
+ }), /*#__PURE__*/_jsx("p", {
189
+ children: message
190
+ })]
191
+ });
192
+ return /*#__PURE__*/_jsxs(Wrapper, {
193
+ tabIndex: "-1",
194
+ disabled: disabled,
195
+ dragging: dragging,
196
+ onClick: handleClick,
197
+ onDragEnter: handleDragEnter,
198
+ onDragLeave: handleDragLeave,
199
+ onDragOver: handleDragOver,
200
+ onDrop: handleDrop,
201
+ reachedLimit: files.length >= maxFiles,
202
+ onBlur: handleBlur,
203
+ onFocus: () => {
204
+ setFocus(true);
205
+ },
206
+ children: [/*#__PURE__*/_jsx(HiddenFileInput, {
207
+ disabled: disabled,
208
+ multiple: true,
209
+ ref: inputRef,
210
+ accept: accept,
211
+ onChange: handleChangeFile
212
+ }), files.length === 0 ? messageItem : previewItem()]
213
+ });
214
+ };
215
+ const Wrapper = styled.div`
216
+ min-height: 200px;
217
+ border: 4px dashed var(--border-color);
218
+ border-radius: var(--border-radius-l);
219
+ color: var(--font-on-background);
220
+ display: flex;
221
+ flex-wrap: wrap;
222
+ justify-content: center;
223
+ align-items: center;
224
+ padding: var(--spacing-xs);
225
+ cursor: pointer;
226
+
227
+ ${_ref2 => {
228
+ let {
229
+ reachedLimit
230
+ } = _ref2;
231
+ return reachedLimit && 'cursor:default;';
232
+ }};
233
+
234
+ ${_ref3 => {
235
+ let {
236
+ disabled
237
+ } = _ref3;
238
+ return disabled && 'cursor:not-allowed; opacity: 0.5;';
239
+ }};
240
+
241
+ ${_ref4 => {
242
+ let {
243
+ dragging
244
+ } = _ref4;
245
+ return dragging && 'border-color: var(--color-primary);';
246
+ }};
247
+
248
+ &:focus {
249
+ border-color: var(--color-primary);
250
+ }
251
+ `;
252
+ const Image = styled.figure`
253
+ position: relative;
254
+ margin: var(--spacing-xs);
255
+
256
+ ${_ref5 => {
257
+ let {
258
+ width,
259
+ height,
260
+ fixedSize
261
+ } = _ref5;
262
+ if (fixedSize) {
263
+ return `
264
+ width: ${width}px;
265
+ height: ${height}px;
266
+ `;
267
+ }
268
+ if (width < height) {
269
+ return `
270
+ width: ${width}px;
271
+ max-width: ${width}px;
272
+ max-height: ${height}px;
273
+ `;
274
+ }
275
+ if (height < width) {
276
+ return `
277
+ height: ${height}px;
278
+ max-width: ${width}px;
279
+ max-height: ${height}px;
280
+ `;
281
+ }
282
+ }}
283
+
284
+ > img {
285
+ width: 100%;
286
+ height: 100%;
287
+ border-radius: var(--border-radius);
288
+ }
289
+ `;
290
+ const ButtonGroup = styled.div`
291
+ position: absolute;
292
+ right: calc(var(--spacing-xs) * -1);
293
+ top: calc(var(--spacing-xs) * -1);
294
+ `;
295
+ const Button = styled.div.attrs(() => ({
296
+ role: 'button'
297
+ }))`
298
+ display: inline-block;
299
+ width: 32px;
300
+ height: 32px;
301
+ color: var(--color-white);
302
+ background: var(--color-primary);
303
+ border-radius: var(--border-radius-round);
304
+ cursor: pointer;
305
+
306
+ > svg {
307
+ color: var(--color-white);
308
+ margin: 0 auto;
309
+ position: relative;
310
+ top: 50%;
311
+ transform: translateY(-50%);
312
+ margin: 0 auto;
313
+ display: block;
314
+ }
315
+
316
+ &:not(:first-child) {
317
+ margin-left: var(--spacing-xs);
318
+ }
319
+
320
+ ${_ref6 => {
321
+ let {
322
+ danger
323
+ } = _ref6;
324
+ return danger && 'background: var(--color-danger);';
325
+ }}
326
+ `;
327
+ export default ImageDropzone;
@@ -0,0 +1,2 @@
1
+ export { default as FileDropzone } from './FileDropzone';
2
+ export { default as ImageDropzone } from './ImageDropzone';
@@ -0,0 +1,19 @@
1
+ import styled from 'styled-components';
2
+ const Message = styled.div.attrs(() => ({
3
+ 'data-testid': 'message-container'
4
+ }))`
5
+ text-align: center;
6
+
7
+ > svg {
8
+ margin-bottom: var(--spacing-s);
9
+ font-size: var(--font-h2);
10
+ }
11
+
12
+ ${_ref => {
13
+ let {
14
+ dragging
15
+ } = _ref;
16
+ return dragging ? 'opacity: 0.5' : '';
17
+ }};
18
+ `;
19
+ export default Message;
@@ -0,0 +1,35 @@
1
+ import styled from 'styled-components';
2
+ const IconFigure = styled.figure.attrs(_ref => {
3
+ let {
4
+ size
5
+ } = _ref;
6
+ return {
7
+ size: size || 'medium'
8
+ };
9
+ })`
10
+ ${_ref2 => {
11
+ let {
12
+ size
13
+ } = _ref2;
14
+ switch (size) {
15
+ case 'small':
16
+ return `
17
+ width: 16px;
18
+ height: 16px;
19
+ `;
20
+ case 'medium':
21
+ return `
22
+ width: 24px;
23
+ height: 24px;
24
+ `;
25
+ case 'large':
26
+ return `
27
+ width: 32px;
28
+ height: 32px;
29
+ `;
30
+ default:
31
+ break;
32
+ }
33
+ }}
34
+ `;
35
+ export default IconFigure;
@@ -0,0 +1,31 @@
1
+ import styled from 'styled-components';
2
+ import rounded from '../styles/mixin/rounded';
3
+ const ImageFigure = styled.figure.attrs(() => ({
4
+ rounded: true
5
+ }))`
6
+ width: 160px;
7
+ height: 160px;
8
+ border: 4px dashed var(--border-color);
9
+ padding: var(--spacing-xs);
10
+ margin-left: var(--spacing);
11
+
12
+ ${_ref => {
13
+ let {
14
+ small
15
+ } = _ref;
16
+ return small && `
17
+ width: 40px;
18
+ height: 40px;
19
+ `;
20
+ }}
21
+
22
+ ${rounded}
23
+
24
+ ${_ref2 => {
25
+ let {
26
+ noBorder
27
+ } = _ref2;
28
+ return noBorder && 'border: none;';
29
+ }}
30
+ `;
31
+ export default ImageFigure;
@@ -0,0 +1,2 @@
1
+ export { default as IconFigure } from './IconFigure';
2
+ export { default as ImageFigure } from './ImageFigure';
@@ -0,0 +1,8 @@
1
+ import styled from 'styled-components';
2
+ const HiddenFileInput = styled.input.attrs(() => ({
3
+ 'data-testid': 'hiddenFileInput',
4
+ type: 'file'
5
+ }))`
6
+ display: none;
7
+ `;
8
+ export default HiddenFileInput;
@@ -0,0 +1 @@
1
+ export { default as HiddenFileInput } from './HiddenFileInput';
@@ -0,0 +1,157 @@
1
+ import { forwardRef, useRef } from 'react';
2
+ import styled, { css } from 'styled-components';
3
+ import Input from './Input';
4
+ import Label from './Label';
5
+ import { MdDone, MdRemove } from 'react-icons/md/index.esm';
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ const Checkbox = /*#__PURE__*/forwardRef((_ref, ref) => {
8
+ let {
9
+ htmlFor,
10
+ text,
11
+ disabled,
12
+ checked,
13
+ indeterminate,
14
+ onChange,
15
+ noMargin,
16
+ fontSizeBig,
17
+ marginRight,
18
+ variant = 'square'
19
+ } = _ref;
20
+ const inputRef = useRef(null);
21
+ return /*#__PURE__*/_jsxs(StyledLabel, {
22
+ htmlFor: htmlFor,
23
+ disabled: disabled,
24
+ ref: ref,
25
+ noMargin: noMargin,
26
+ fontSizeBig: fontSizeBig,
27
+ marginRight: marginRight,
28
+ variant: variant,
29
+ children: [/*#__PURE__*/_jsx(StyledCheckbox, {
30
+ ref: inputRef,
31
+ checked: checked,
32
+ "aria-checked": indeterminate ? 'mixed' : checked,
33
+ type: "checkbox",
34
+ id: htmlFor,
35
+ disabled: disabled,
36
+ onChange: onChange,
37
+ fontSizeBig: fontSizeBig
38
+ }), /*#__PURE__*/_jsxs("span", {
39
+ children: [/*#__PURE__*/_jsx(Unchecked, {
40
+ variant: variant
41
+ }), /*#__PURE__*/_jsx(Checked, {
42
+ variant: variant,
43
+ children: indeterminate ? /*#__PURE__*/_jsx(MdRemove, {}) : /*#__PURE__*/_jsx(MdDone, {})
44
+ }), /*#__PURE__*/_jsx(Text, {
45
+ children: text
46
+ })]
47
+ })]
48
+ });
49
+ });
50
+ const StyledCheckbox = styled(Input)`
51
+ display: none;
52
+
53
+ &:checked + span {
54
+ > div:last-of-type {
55
+ display: block;
56
+ color: var(--color-primary);
57
+ }
58
+
59
+ > div:first-of-type {
60
+ display: none;
61
+ }
62
+ }
63
+ `;
64
+ const StyledLabel = styled(Label)`
65
+ display: inline-block;
66
+ cursor: pointer;
67
+ vertical-align: middle;
68
+
69
+ ${_ref2 => {
70
+ let {
71
+ marginRight
72
+ } = _ref2;
73
+ return marginRight && css`
74
+ margin-right: var(--spacing-l);
75
+ `;
76
+ }}
77
+
78
+ > span {
79
+ ${_ref3 => {
80
+ let {
81
+ disabled
82
+ } = _ref3;
83
+ return disabled && css`
84
+ opacity: 0.5;
85
+ cursor: not-allowed;
86
+ `;
87
+ }}
88
+
89
+ display: flex;
90
+ align-items: center;
91
+
92
+ > div {
93
+ margin-right: var(--spacing-xs);
94
+ width: 24px;
95
+ height: 24px;
96
+ border-radius: ${_ref4 => {
97
+ let {
98
+ variant
99
+ } = _ref4;
100
+ return variant === 'circle' ? '50%' : '4px';
101
+ }};
102
+ }
103
+
104
+ > div:last-of-type {
105
+ display: none;
106
+ }
107
+ }
108
+
109
+ ${_ref5 => {
110
+ let {
111
+ fontSizeBig
112
+ } = _ref5;
113
+ return fontSizeBig && 'font-size: var(--font-h3);';
114
+ }}
115
+
116
+ ${_ref6 => {
117
+ let {
118
+ noMargin
119
+ } = _ref6;
120
+ return noMargin && 'margin: 0;';
121
+ }}
122
+ `;
123
+ const Unchecked = styled.div`
124
+ flex: 0 0 auto;
125
+ border: var(--border-width) solid var(--border-color);
126
+ border-radius: ${_ref7 => {
127
+ let {
128
+ variant
129
+ } = _ref7;
130
+ return variant === 'circle' ? '50%' : '4px';
131
+ }};
132
+ `;
133
+ const Checked = styled.div`
134
+ flex: 0 0 auto;
135
+ border: var(--border-width) solid var(--color-primary);
136
+ background: var(--color-primary);
137
+ position: relative;
138
+ border-radius: ${_ref8 => {
139
+ let {
140
+ variant
141
+ } = _ref8;
142
+ return variant === 'circle' ? '50%' : '4px';
143
+ }};
144
+
145
+ > svg {
146
+ position: absolute;
147
+ color: var(--font-on-primary);
148
+ font-size: var(--font-h3);
149
+ top: 50%;
150
+ left: 50%;
151
+ transform: translate(-50%, -50%);
152
+ }
153
+ `;
154
+ const Text = styled.p`
155
+ word-break: break-all;
156
+ `;
157
+ export default Checkbox;
@@ -0,0 +1,11 @@
1
+ import styled from 'styled-components';
2
+ const Fieldset = styled.fieldset`
3
+ border: var(--border-width) solid var(--border-color);
4
+ border-radius: var(--border-radius-s);
5
+ padding: var(--spacing-s);
6
+
7
+ &[disabled] {
8
+ border-color: var(--border-color-transparent);
9
+ }
10
+ `;
11
+ export default Fieldset;
@@ -0,0 +1,15 @@
1
+ import styled from 'styled-components';
2
+ const FormItem = styled.div`
3
+ margin-bottom: var(--spacing);
4
+
5
+ ${_ref => {
6
+ let {
7
+ alignCenter
8
+ } = _ref;
9
+ return alignCenter && `
10
+ display: flex;
11
+ align-items: center;
12
+ `;
13
+ }}
14
+ `;
15
+ export default FormItem;
@@ -0,0 +1,59 @@
1
+ import styled from 'styled-components';
2
+ import inputPlaceholder from '../styles/mixin/inputPlaceholder';
3
+ const Input = styled.input`
4
+ display: block;
5
+ width: 100%;
6
+ height: 36px;
7
+ border: var(--border-width) solid var(--border-color);
8
+ padding: 10px var(--spacing-s);
9
+ border-radius: var(--border-radius-l);
10
+ background: transparent;
11
+ color: var(--font-on-background);
12
+ transition: 0.3s;
13
+ overflow: hidden;
14
+ white-space: nowrap;
15
+ text-overflow: ellipsis;
16
+
17
+ &:focus {
18
+ border: var(--border-width) solid var(--color-primary);
19
+ outline: none;
20
+ }
21
+
22
+ &:disabled {
23
+ cursor: not-allowed;
24
+ opacity: 0.5;
25
+ }
26
+
27
+ ${inputPlaceholder`
28
+ color: var(--font-on-mute);
29
+ `}
30
+
31
+ ${_ref => {
32
+ let {
33
+ hidden
34
+ } = _ref;
35
+ return hidden && 'display: none;';
36
+ }}
37
+
38
+ ${_ref2 => {
39
+ let {
40
+ borderRadiusS
41
+ } = _ref2;
42
+ return borderRadiusS && 'border-radius: var(--border-radius-s);';
43
+ }}
44
+
45
+ ${_ref3 => {
46
+ let {
47
+ alignCenter
48
+ } = _ref3;
49
+ return alignCenter && 'text-align: center;';
50
+ }}
51
+
52
+ ${_ref4 => {
53
+ let {
54
+ autoWidth
55
+ } = _ref4;
56
+ return autoWidth && 'width: auto;';
57
+ }};
58
+ `;
59
+ export default Input;