@cashub/ui-elv 1.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 (304) hide show
  1. package/Tab/Tab.js +28 -0
  2. package/Tab/TabList.js +167 -0
  3. package/Tab/TabPanel.js +49 -0
  4. package/Tab/TabTab.js +105 -0
  5. package/Tab/index.js +30 -0
  6. package/Tab/subComponent/TabContext.js +9 -0
  7. package/Tab/subComponent/TabListV2.js +25 -0
  8. package/Tab/subComponent/TabPanelV2.js +52 -0
  9. package/Tab/subComponent/TabTabV2.js +63 -0
  10. package/VerticalTab/TabList.js +27 -0
  11. package/VerticalTab/TabPanel.js +52 -0
  12. package/VerticalTab/TabTab.js +70 -0
  13. package/VerticalTab/VerticalTab.js +41 -0
  14. package/VerticalTab/index.js +16 -0
  15. package/VerticalTab/subComponent/TabContext.js +9 -0
  16. package/alert/Alert.js +29 -0
  17. package/alert/index.js +13 -0
  18. package/animate/Collapse.js +71 -0
  19. package/animate/Loader.js +58 -0
  20. package/animate/NumberCounter.js +51 -0
  21. package/animate/PulseRing.js +35 -0
  22. package/animate/Spinner.js +18 -0
  23. package/animate/index.js +41 -0
  24. package/assets/css/autocomplete.css +16 -0
  25. package/assets/css/font.css +4 -0
  26. package/assets/css/global.css +2 -0
  27. package/assets/font/helvetica/Helvetica.ttf +0 -0
  28. package/assets/font/nanumGothic/NanumGothic-Bold.ttf +0 -0
  29. package/assets/font/nanumGothic/NanumGothic-ExtraBold.ttf +0 -0
  30. package/assets/font/nanumGothic/NanumGothic-Regular.ttf +0 -0
  31. package/assets/icons/app-management.png +0 -0
  32. package/assets/icons/burger-black.png +0 -0
  33. package/assets/icons/burger-white.png +0 -0
  34. package/assets/icons/burger.png +0 -0
  35. package/assets/icons/file.svg +1 -0
  36. package/assets/icons/map_icon1.png +0 -0
  37. package/assets/icons/map_icon4.png +0 -0
  38. package/assets/images/bg-aside.png +0 -0
  39. package/assets/images/bg-chart-circle.png +0 -0
  40. package/assets/images/bg-chart-triangle.png +0 -0
  41. package/assets/images/cashub-logo-only.png +0 -0
  42. package/assets/images/default-user.jpg +0 -0
  43. package/assets/images/logo-cashub.png +0 -0
  44. package/assets/images/map.png +0 -0
  45. package/assets/images/qrcode.png +0 -0
  46. package/backdrop/BaseBackdrop.js +18 -0
  47. package/backdrop/LoadingBackdrop.js +17 -0
  48. package/backdrop/ModalBackdrop.js +15 -0
  49. package/backdrop/index.js +27 -0
  50. package/badge/Badge.js +26 -0
  51. package/badge/BadgeDot.js +18 -0
  52. package/badge/BadgeFill.js +49 -0
  53. package/badge/BadgeFillTriangle.js +147 -0
  54. package/badge/BadgeWithText.js +31 -0
  55. package/badge/index.js +41 -0
  56. package/billing/BarChart.js +51 -0
  57. package/billing/Grid.js +45 -0
  58. package/billing/Header2.js +25 -0
  59. package/billing/Header3.js +37 -0
  60. package/billing/Paragraph.js +33 -0
  61. package/billing/ParagraphGroup.js +22 -0
  62. package/billing/ParagraphText.js +26 -0
  63. package/billing/Section.js +50 -0
  64. package/billing/SectionBody.js +17 -0
  65. package/billing/SectionHeader.js +26 -0
  66. package/billing/__stories__/BarChart.stories.js_bak +46 -0
  67. package/billing/__stories__/Grid.stories.js_bak +57 -0
  68. package/billing/__stories__/Header2.stories.js_bak +62 -0
  69. package/billing/__stories__/Header3.stories.js_bak +69 -0
  70. package/billing/__stories__/Paragraph.stories.js_bak +84 -0
  71. package/billing/__stories__/ParagraphGroup.stories.js_bak +68 -0
  72. package/billing/__stories__/ParagraphText.stories.js_bak +64 -0
  73. package/billing/__stories__/Section.stories.js_bak +115 -0
  74. package/billing/__stories__/SectionBody.stories.js_bak +62 -0
  75. package/billing/__stories__/SectionHeader.stories.js-bak +68 -0
  76. package/breadcrumb/Breadcrumb.js +78 -0
  77. package/breadcrumb/index.js +13 -0
  78. package/button/Button.js +154 -0
  79. package/button/ButtonGroup.js +61 -0
  80. package/button/IconButton.js +72 -0
  81. package/button/ScrollToTopButton.js +54 -0
  82. package/button/index.js +34 -0
  83. package/callout/Callout.js +52 -0
  84. package/callout/index.js +13 -0
  85. package/chart/BarChart.js +148 -0
  86. package/chart/DoughnutChart.js +118 -0
  87. package/chart/LineChart.js +146 -0
  88. package/chart/SingleBarChart.js +42 -0
  89. package/chart/index.js +52 -0
  90. package/chart/utils/centerTextPlugin.js +62 -0
  91. package/chart/utils/customTooltip.js +94 -0
  92. package/chart/utils/htmlLegendPlugin.js +89 -0
  93. package/chart/utils/index.js +27 -0
  94. package/chart/utils/padEmptyChartBar.js +53 -0
  95. package/chart/utils/yAxisTopTitlePlugin.js +49 -0
  96. package/container/FlexContainer.js +40 -0
  97. package/container/index.js +13 -0
  98. package/cropper/Cropper.js +54 -0
  99. package/cropper/CropperModalHandler.js +41 -0
  100. package/cropper/index.js +20 -0
  101. package/cropper/subComponent/CropImageModal.js +79 -0
  102. package/datetimePicker/DatePicker.js +363 -0
  103. package/datetimePicker/DatePickerV2.js +407 -0
  104. package/datetimePicker/DatetimePicker.js +240 -0
  105. package/datetimePicker/DatetimePickerV2.js +395 -0
  106. package/datetimePicker/DatetimePickerV3.js +279 -0
  107. package/datetimePicker/TimeInput.js +56 -0
  108. package/datetimePicker/TimePicker.js +317 -0
  109. package/datetimePicker/TimePickerStyle.js +64 -0
  110. package/datetimePicker/TimePickerV2.js +208 -0
  111. package/datetimePicker/accordion/Month.js +254 -0
  112. package/datetimePicker/accordion/Year.js +284 -0
  113. package/datetimePicker/hooks/index.js +27 -0
  114. package/datetimePicker/hooks/useChangeNumber.js +42 -0
  115. package/datetimePicker/hooks/useDecrease.js +38 -0
  116. package/datetimePicker/hooks/useIncrease.js +38 -0
  117. package/datetimePicker/index.js +69 -0
  118. package/datetimePicker/provider/constant.js +43 -0
  119. package/datetimePicker/subComponent/Accordion.js +373 -0
  120. package/datetimePicker/subComponent/CustomTimeInput.js +47 -0
  121. package/datetimePicker/subComponent/DateTimePickerContext.js +9 -0
  122. package/datetimePicker/utils/GMTDate.js +15 -0
  123. package/datetimePicker/utils/pad.js +13 -0
  124. package/datetimePicker/utils/toUTC0.js +13 -0
  125. package/descriptionList/DescriptionDetail.js +28 -0
  126. package/descriptionList/DescriptionList.js +25 -0
  127. package/descriptionList/DescriptionTerm.js +14 -0
  128. package/descriptionList/index.js +27 -0
  129. package/divider/Divider.js +31 -0
  130. package/divider/index.js +13 -0
  131. package/dropdown/Dropdown.js +55 -0
  132. package/dropdown/DropdownButtonOption.js +43 -0
  133. package/dropdown/DropdownContent.js +90 -0
  134. package/dropdown/DropdownDivOption.js +26 -0
  135. package/dropdown/DropdownItem.js +26 -0
  136. package/dropdown/DropdownLinkOption.js +24 -0
  137. package/dropdown/DropdownToggle.js +38 -0
  138. package/dropdown/index.js +42 -0
  139. package/dropdown/subComponent/DropdownContext.js +9 -0
  140. package/dropzone/FileDropzone.js +479 -0
  141. package/dropzone/ImageDropzone.js +334 -0
  142. package/dropzone/index.js +20 -0
  143. package/dropzone/subComponent/Message.js +26 -0
  144. package/figure/IconFigure.js +42 -0
  145. package/figure/ImageFigure.js +38 -0
  146. package/figure/index.js +20 -0
  147. package/file/HiddenFileInput.js +15 -0
  148. package/file/index.js +13 -0
  149. package/form/Checkbox.js +166 -0
  150. package/form/Fieldset.js +18 -0
  151. package/form/FormItem.js +22 -0
  152. package/form/Input.js +66 -0
  153. package/form/Label.js +61 -0
  154. package/form/MutedText.js +21 -0
  155. package/form/PasswordInput.js +47 -0
  156. package/form/RadioButton.js +103 -0
  157. package/form/SearchSelect.js +181 -0
  158. package/form/Searchbox.js +98 -0
  159. package/form/Slider.js +46 -0
  160. package/form/SwitchButton.js +105 -0
  161. package/form/Textarea.js +41 -0
  162. package/form/TreeView.js +73 -0
  163. package/form/index.js +104 -0
  164. package/grid/Column.js +46 -0
  165. package/grid/Grid.js +35 -0
  166. package/grid/index.js +20 -0
  167. package/heading/Heading1.js +21 -0
  168. package/heading/Heading2.js +28 -0
  169. package/heading/Heading3.js +49 -0
  170. package/heading/index.js +27 -0
  171. package/helmet/Helmet.js +23 -0
  172. package/helmet/index.js +20 -0
  173. package/iconbox/ApplicationIconBox.js +81 -0
  174. package/iconbox/IconBox.js +67 -0
  175. package/iconbox/IconBoxV2.js +72 -0
  176. package/iconbox/index.js +27 -0
  177. package/iconbox/subComponent/IconBoxFigure.js +50 -0
  178. package/iconbox/subComponent/IconBoxImage.js +42 -0
  179. package/image/ImageFluid.js +17 -0
  180. package/image/UploadImage.js +250 -0
  181. package/image/index.js +20 -0
  182. package/index.js +568 -0
  183. package/jsoneditor/JsonEditor.js +142 -0
  184. package/jsoneditor/index.js +13 -0
  185. package/keyframe/Pulse.js +21 -0
  186. package/keyframe/Spin.js +13 -0
  187. package/layout/Aside.js +48 -0
  188. package/layout/AsideHeader.jsx +27 -0
  189. package/layout/Backdrop.js +23 -0
  190. package/layout/Container.js +39 -0
  191. package/layout/Footer.js +45 -0
  192. package/layout/Header.jsx +55 -0
  193. package/layout/Layout.jsx +84 -0
  194. package/layout/Logo.jsx +17 -0
  195. package/layout/MenuIcon.jsx +27 -0
  196. package/layout/Sidebar.jsx +271 -0
  197. package/layout/index.js +13 -0
  198. package/link/LinkSpan.js +69 -0
  199. package/link/index.js +13 -0
  200. package/map/GoogleMap.js +448 -0
  201. package/map/GoogleReverseGeolocation.js +200 -0
  202. package/map/LeafletMap.js +231 -0
  203. package/map/LeafletReverseGeolocation.js +101 -0
  204. package/map/index.js +34 -0
  205. package/map/subComponent/BasicLeafletMap.js +34 -0
  206. package/map/subComponent/GoogleMapContainer.js +29 -0
  207. package/map/subComponent/GoogleMapPopup.js +109 -0
  208. package/map/subComponent/GoogleMapWrapper.js +40 -0
  209. package/map/subComponent/LeafletDrawControl.js +127 -0
  210. package/map/subComponent/LeafletMapContainer.js +173 -0
  211. package/map/subComponent/MapSearchBoxControl.js +54 -0
  212. package/modal/StateModal.js +178 -0
  213. package/modal/TitleModal.js +250 -0
  214. package/modal/index.js +20 -0
  215. package/package.json +54 -0
  216. package/page/Disclaimer.js +128 -0
  217. package/page/index.js +13 -0
  218. package/paginate/Paginate.js +137 -0
  219. package/paginate/index.js +13 -0
  220. package/popover/Popover.js +91 -0
  221. package/popover/index.js +13 -0
  222. package/qrcode/QRCode.js +58 -0
  223. package/qrcode/QRCodeContainter.js +34 -0
  224. package/qrcode/index.js +20 -0
  225. package/ribbon/Ribbon.js +42 -0
  226. package/ribbon/index.js +13 -0
  227. package/section/Section.js +133 -0
  228. package/section/SectionBody.js +52 -0
  229. package/section/SectionHeader.js +70 -0
  230. package/section/SectionToolbar.js +18 -0
  231. package/section/SectionToolbarItem.js +17 -0
  232. package/section/index.js +41 -0
  233. package/select/InputSelect.js +270 -0
  234. package/select/Select.js +818 -0
  235. package/select/index.js +20 -0
  236. package/select/subComponent/Checkbox.js +48 -0
  237. package/select/subComponent/Footer.js +13 -0
  238. package/select/subComponent/ListBox.js +30 -0
  239. package/select/subComponent/Option.js +45 -0
  240. package/select/subComponent/OptionGroup.js +23 -0
  241. package/select/subComponent/Options.js +32 -0
  242. package/select/subComponent/SearchBox.js +58 -0
  243. package/select/subComponent/SelectedMultipleCount.js +39 -0
  244. package/select/subComponent/SelectedMultipleTags.js +54 -0
  245. package/select/subComponent/SelectedMultipleText.js +70 -0
  246. package/select/subComponent/SelectedSingle.js +17 -0
  247. package/styles/GlobalStyle.js +334 -0
  248. package/styles/config/breakpoint.style.js +13 -0
  249. package/styles/config/header.style.js +10 -0
  250. package/styles/config/sidebar.style.js +17 -0
  251. package/styles/index.js +20 -0
  252. package/styles/mixin/backgroundColor.js +44 -0
  253. package/styles/mixin/borderColor.js +37 -0
  254. package/styles/mixin/color.js +37 -0
  255. package/styles/mixin/colorOnBackground.js +37 -0
  256. package/styles/mixin/inputPlaceholder.js +30 -0
  257. package/styles/mixin/media.js +21 -0
  258. package/styles/mixin/rounded.js +30 -0
  259. package/styles/mixin/scrollbar.js +32 -0
  260. package/styles/theme/dark.theme.js +97 -0
  261. package/styles/theme/light.theme.js +97 -0
  262. package/styles/theme/white.theme.js +97 -0
  263. package/styles/themes.js +16 -0
  264. package/table/GridTable.js +336 -0
  265. package/table/ImageBox.js +45 -0
  266. package/table/InfiniteGridTable.js +403 -0
  267. package/table/PermissionTable.js +64 -0
  268. package/table/SimpleGridTable.js +143 -0
  269. package/table/Table.js +568 -0
  270. package/table/__mock__/columns.js +70 -0
  271. package/table/__mock__/data.js +536 -0
  272. package/table/hooks/index.js +20 -0
  273. package/table/hooks/useCalculateDataRange.js +28 -0
  274. package/table/hooks/useGenerateSort.js +39 -0
  275. package/table/index.js +48 -0
  276. package/table/subComponent/BaseTableHeadCell.js +62 -0
  277. package/table/subComponent/GridTableFooter.js +24 -0
  278. package/table/subComponent/GridTableHeadCell.js +20 -0
  279. package/table/subComponent/Resizer.js +77 -0
  280. package/table/subComponent/TableFooter.js +31 -0
  281. package/table/subComponent/TableFooterInfo.js +13 -0
  282. package/table/subComponent/TableFooterPager.js +33 -0
  283. package/table/subComponent/TableHeadCell.js +19 -0
  284. package/table/subComponent/TableSort.js +38 -0
  285. package/tagify/TagifyStyle.js +60 -0
  286. package/tagify/Tags.js +56 -0
  287. package/tagify/index.js +27 -0
  288. package/tagify/templates/getCreateButtonTemplate.js +18 -0
  289. package/text/Paragraph.js +86 -0
  290. package/text/index.js +13 -0
  291. package/timeline/Timeline.js +139 -0
  292. package/timeline/index.js +13 -0
  293. package/toast/CustomToastContainer.js +45 -0
  294. package/toast/MessageContainer.js +51 -0
  295. package/toast/index.js +36 -0
  296. package/toast/show.js +39 -0
  297. package/toast/style.css +1 -0
  298. package/tooltip/Tooltip.js +140 -0
  299. package/tooltip/index.js +13 -0
  300. package/treeView/TreeViewV2.js +38 -0
  301. package/treeView/TreeflexStyle.js +49 -0
  302. package/treeView/index.js +20 -0
  303. package/wizard/Wizard.js +251 -0
  304. package/wizard/index.js +13 -0
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ var _IconBoxFigure = _interopRequireDefault(require("./subComponent/IconBoxFigure"));
9
+ var _IconBoxImage = _interopRequireDefault(require("./subComponent/IconBoxImage"));
10
+ var _bgChartTriangle = _interopRequireDefault(require("../assets/images/bg-chart-triangle.png"));
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ const IconBox = _ref => {
14
+ let {
15
+ icon,
16
+ title,
17
+ children
18
+ } = _ref;
19
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
20
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(IconBoxHead, {
21
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_IconBoxFigure.default, {
22
+ sizeXS: true,
23
+ marginRight: true,
24
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconBoxImage.default, {
25
+ sizeXS: true,
26
+ src: icon,
27
+ alt: `${title}'s icon`
28
+ })
29
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconBoxTitle, {
30
+ children: title
31
+ })]
32
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconBoxBody, {
33
+ children: children
34
+ })]
35
+ });
36
+ };
37
+ const Wrapper = _styledComponents.default.div`
38
+ display: flex;
39
+ flex-direction: column;
40
+ padding: var(--spacing-l);
41
+ margin-bottom: var(--spacing);
42
+ border-radius: var(--border-radius);
43
+ background: var(--color-background2);
44
+ color: var(--font-on-background);
45
+
46
+ background: var(--color-background2);
47
+ background-image: url(${_bgChartTriangle.default});
48
+ background-repeat: no-repeat;
49
+ background-position: right bottom;
50
+ background-size: 30% 70%;
51
+ `;
52
+ const IconBoxHead = _styledComponents.default.div`
53
+ display: flex;
54
+ align-items: center;
55
+ margin-bottom: var(--spacing);
56
+ `;
57
+ const IconBoxTitle = _styledComponents.default.div`
58
+ font-size: var(--font-h2);
59
+ font-weight: bold;
60
+ word-break: break-all;
61
+ `;
62
+ const IconBoxBody = _styledComponents.default.div`
63
+ font-size: var(--font-h1);
64
+ font-weight: bold;
65
+ text-align: center;
66
+ `;
67
+ var _default = exports.default = IconBox;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
+ var _IconBoxFigure = _interopRequireDefault(require("./subComponent/IconBoxFigure"));
9
+ var _IconBoxImage = _interopRequireDefault(require("./subComponent/IconBoxImage"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
+ const IconBoxV2 = _styledComponents.default.div`
14
+ padding: var(--spacing);
15
+ margin-bottom: var(--spacing);
16
+ background: var(--color-background1);
17
+ box-shadow: var(--box-shadow);
18
+ border-radius: var(--border-radius);
19
+ color: var(--font-on-background);
20
+ border: 2px solid transparent;
21
+
22
+ ${_ref => {
23
+ let {
24
+ fullHeight
25
+ } = _ref;
26
+ return fullHeight && 'height: calc(100% - var(--spacing));';
27
+ }}
28
+
29
+ ${_ref2 => {
30
+ let {
31
+ selected
32
+ } = _ref2;
33
+ return selected && (0, _styledComponents.css)`
34
+ border-color: var(--color-primary);
35
+ background: color-mix(
36
+ in srgb,
37
+ var(--color-primary) 10%,
38
+ var(--color-background1)
39
+ );
40
+ `;
41
+ }}
42
+ `;
43
+ const Body = _styledComponents.default.div`
44
+ display: flex;
45
+ `;
46
+ const Description = _styledComponents.default.div`
47
+ flex: 1 1 auto;
48
+ font-size: var(--font-body1);
49
+ `;
50
+ const Info = _styledComponents.default.div`
51
+ word-break: break-all;
52
+
53
+ &:not(:last-child) {
54
+ margin-bottom: var(--spacing-s);
55
+ }
56
+ `;
57
+ const Tool = _styledComponents.default.div`
58
+ flex: 0 0 calc(var(--spacing-s) + 36px);
59
+ padding-left: var(--spacing-s);
60
+
61
+ > *:not(:last-child) {
62
+ margin-bottom: var(--spacing-s);
63
+ }
64
+ `;
65
+ var _default = exports.default = Object.assign(IconBoxV2, {
66
+ Body,
67
+ Description,
68
+ Info,
69
+ Tool,
70
+ Figure: _IconBoxFigure.default,
71
+ Image: _IconBoxImage.default
72
+ });
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ApplicationIconBox", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ApplicationIconBox.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "IconBox", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _IconBox.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "IconBoxV2", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _IconBoxV.default;
22
+ }
23
+ });
24
+ var _ApplicationIconBox = _interopRequireDefault(require("./ApplicationIconBox"));
25
+ var _IconBox = _interopRequireDefault(require("./IconBox"));
26
+ var _IconBoxV = _interopRequireDefault(require("./IconBoxV2"));
27
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ const IconBoxFigure = _styledComponents.default.figure`
10
+ flex: 0 0 120px;
11
+
12
+ ${_ref => {
13
+ let {
14
+ marginRight
15
+ } = _ref;
16
+ return marginRight && 'margin-right: var(--spacing);';
17
+ }}
18
+ ${_ref2 => {
19
+ let {
20
+ paddingRight
21
+ } = _ref2;
22
+ return paddingRight && 'padding-right: var(--spacing);';
23
+ }}
24
+ ${_ref3 => {
25
+ let {
26
+ paddingRightS
27
+ } = _ref3;
28
+ return paddingRightS && 'padding-right: var(--spacing-s);';
29
+ }}
30
+ ${_ref4 => {
31
+ let {
32
+ paddingBottomS
33
+ } = _ref4;
34
+ return paddingBottomS && 'padding-bottom: var(--spacing-s);';
35
+ }}
36
+
37
+ ${_ref5 => {
38
+ let {
39
+ sizeS
40
+ } = _ref5;
41
+ return sizeS && 'flex-basis: 80px;';
42
+ }}
43
+ ${_ref6 => {
44
+ let {
45
+ sizeXS
46
+ } = _ref6;
47
+ return sizeXS && 'flex-basis: 40px;';
48
+ }}
49
+ `;
50
+ var _default = exports.default = IconBoxFigure;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ const IconBoxImage = _styledComponents.default.img.attrs(() => ({
10
+ crossOrigin: 'anonymous'
11
+ }))`
12
+ width: 120px;
13
+ height: 120px;
14
+
15
+ ${_ref => {
16
+ let {
17
+ rounded
18
+ } = _ref;
19
+ return rounded && 'border-radius: var(--border-radius);';
20
+ }}
21
+
22
+ ${_ref2 => {
23
+ let {
24
+ sizeS
25
+ } = _ref2;
26
+ return sizeS && `
27
+ width: 80px;
28
+ height: 80px;
29
+ `;
30
+ }}
31
+
32
+ ${_ref3 => {
33
+ let {
34
+ sizeXS
35
+ } = _ref3;
36
+ return sizeXS && `
37
+ width: 40px;
38
+ height: 40px;
39
+ `;
40
+ }}
41
+ `;
42
+ var _default = exports.default = IconBoxImage;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ var _rounded = _interopRequireDefault(require("../styles/mixin/rounded"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ const ImageFluid = _styledComponents.default.img`
11
+ width: 100%;
12
+ height: 100%;
13
+ object-fit: cover;
14
+
15
+ ${_rounded.default}
16
+ `;
17
+ var _default = exports.default = ImageFluid;
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _reactI18next = require("react-i18next");
9
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
10
+ var _fa = require("react-icons/fa");
11
+ var _md = require("react-icons/md");
12
+ var _utils = require("@cashub/utils");
13
+ var _toast = require("../toast");
14
+ var _HiddenFileInput = _interopRequireDefault(require("../file/HiddenFileInput"));
15
+ var _ImageFigure = _interopRequireDefault(require("../figure/ImageFigure"));
16
+ var _ImageFluid = _interopRequireDefault(require("./ImageFluid"));
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
+ const UploadImage = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
20
+ let {
21
+ id,
22
+ src,
23
+ alt = 'user avatar',
24
+ roundedCircle = false,
25
+ cropperHandler,
26
+ onBlur,
27
+ onClear,
28
+ allowClear = false
29
+ } = _ref;
30
+ const {
31
+ t
32
+ } = (0, _reactI18next.useTranslation)();
33
+ const refWrapper = (0, _react.useRef)();
34
+ const [currentSrc, setCurrentSrc] = (0, _react.useState)(src);
35
+ const [currentFile, setCurrentFile] = (0, _react.useState)(null);
36
+ const [focusCount, setFocusCount] = (0, _react.useState)(0);
37
+ const handleAvatarRemove = () => {
38
+ setCurrentSrc(src);
39
+ ref.current.value = '';
40
+ setCurrentFile(null);
41
+ };
42
+ const restoreFile = (0, _react.useCallback)(() => {
43
+ if (!currentFile) return;
44
+ const dataTransfer = new DataTransfer();
45
+ dataTransfer.items.add(currentFile);
46
+ ref.current.files = dataTransfer.files;
47
+ }, [ref, currentFile]);
48
+ const handleImageFile = (0, _react.useCallback)((file, src) => {
49
+ const dataTransfer = new DataTransfer();
50
+ const changedImageFile = (0, _utils.dataURLtoFile)(src, file.name);
51
+ dataTransfer.items.add(changedImageFile);
52
+ setCurrentSrc(src);
53
+ setCurrentFile(changedImageFile);
54
+ ref.current.files = dataTransfer.files;
55
+ }, [ref]);
56
+ const handleOnChange = files => {
57
+ if (files.length === 0) {
58
+ // close file selector or cancel upload file need to restore to last uploaded file
59
+ restoreFile();
60
+ } else {
61
+ const fileType = files[0].name.slice(files[0].name.lastIndexOf('.')).toLowerCase();
62
+ if (['.jpeg', '.bmp', '.jpg', '.png'].includes(fileType)) {
63
+ if (files[0].size < 2097152) {
64
+ const srcUrl = URL.createObjectURL(files[0]);
65
+ handleCrop(srcUrl, files[0]);
66
+ } else {
67
+ ref.current.value = '';
68
+ restoreFile();
69
+ (0, _toast.showErrorMessage)({
70
+ title: t('error:Upload'),
71
+ message: t('error:UploadSize', {
72
+ size: '2MB'
73
+ })
74
+ });
75
+ }
76
+ } else {
77
+ ref.current.value = '';
78
+ restoreFile();
79
+ (0, _toast.showErrorMessage)({
80
+ title: t('error:Upload'),
81
+ message: t('error:LogoMerchantFileType')
82
+ });
83
+ }
84
+ }
85
+ };
86
+ const handleCrop = (0, _react.useCallback)((src, file) => {
87
+ cropperHandler({
88
+ src,
89
+ file,
90
+ width: 160,
91
+ height: 160,
92
+ onCrop: croppedSrc => {
93
+ handleImageFile(file, croppedSrc);
94
+ },
95
+ onClose: () => {
96
+ (0, _utils.getBase64DataUrlFromFile)(file, dataUrl => {
97
+ handleImageFile(file, dataUrl);
98
+ });
99
+ }
100
+ });
101
+ }, [cropperHandler, handleImageFile]);
102
+ const handleFocus = event => {
103
+ event.preventDefault();
104
+ event.stopPropagation();
105
+ if (event.target.tagName === 'BUTTON') {
106
+ setFocusCount(focusCount + 1);
107
+ }
108
+ };
109
+ const handleBlur = event => {
110
+ event.preventDefault();
111
+ event.stopPropagation();
112
+
113
+ // if click figure,after click button
114
+ if (refWrapper.current.contains(event.relatedTarget)) return;
115
+ if (event.target === refWrapper.current && onBlur) {
116
+ onBlur();
117
+ }
118
+ };
119
+ (0, _react.useEffect)(() => {
120
+ setCurrentSrc(src);
121
+ }, [src, ref]);
122
+
123
+ // if click button icon,can focus figure element
124
+ (0, _react.useEffect)(() => {
125
+ if (focusCount === 2) {
126
+ refWrapper.current.focus();
127
+ setFocusCount(0);
128
+ }
129
+ }, [ref, focusCount]);
130
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
131
+ ref: refWrapper,
132
+ roundedCircle: roundedCircle,
133
+ onBlur: handleBlur,
134
+ onFocus: handleFocus,
135
+ tabIndex: "0",
136
+ children: [currentSrc && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageFluid.default, {
137
+ crossOrigin: "anonymous",
138
+ src: currentSrc,
139
+ alt: alt,
140
+ rounded: true,
141
+ roundedCircle: roundedCircle
142
+ }), ref && /*#__PURE__*/(0, _jsxRuntime.jsxs)(ButtonGroup, {
143
+ roundedCircle: roundedCircle,
144
+ children: [ref.current && ref.current.files && ref.current.files.length !== 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(CropButton, {
145
+ roundedCircle: roundedCircle,
146
+ onClick: () => {
147
+ handleCrop(currentSrc, ref.current.files[0]);
148
+ },
149
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdCrop, {})
150
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ModifyButton, {
151
+ roundedCircle: roundedCircle,
152
+ onClick: () => {
153
+ ref.current.click();
154
+ },
155
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fa.FaPen, {})
156
+ })]
157
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_HiddenFileInput.default, {
158
+ ref: ref && ref,
159
+ id: id,
160
+ accept: ".jpeg, .bmp, .jpg, .png",
161
+ onChange: event => handleOnChange(event.target.files)
162
+ }), ref && ref.current && ref.current.files && ref.current.files.length !== 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(RemoveIcon, {
163
+ onClick: handleAvatarRemove,
164
+ roundedCircle: roundedCircle,
165
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fa.FaTimes, {})
166
+ }), allowClear && src && ref && !ref.current?.files?.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(RemoveIcon, {
167
+ onClick: onClear,
168
+ roundedCircle: roundedCircle,
169
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fa.FaTimes, {})
170
+ })]
171
+ });
172
+ });
173
+ const Wrapper = (0, _styledComponents.default)(_ImageFigure.default)`
174
+ position: relative;
175
+ padding: var(--spacing-xs);
176
+ `;
177
+ const ButtonGroup = _styledComponents.default.div`
178
+ position: absolute;
179
+ top: -16px;
180
+ right: -12px;
181
+
182
+ ${_ref2 => {
183
+ let {
184
+ rounded
185
+ } = _ref2;
186
+ return rounded && `
187
+ top: 0;
188
+ right: 0;
189
+ `;
190
+ }}
191
+ `;
192
+ const ActionButton = _styledComponents.default.button`
193
+ display: inline-flex;
194
+ justify-content: center;
195
+ align-items: center;
196
+ cursor: pointer;
197
+ width: 32px;
198
+ height: 32px;
199
+ border: none;
200
+ `;
201
+ const CropButton = (0, _styledComponents.default)(ActionButton)`
202
+ color: var(--font-on-primary);
203
+ background: var(--color-primary);
204
+ border-radius: var(--border-radius);
205
+
206
+ ${_ref3 => {
207
+ let {
208
+ roundedCircle
209
+ } = _ref3;
210
+ return roundedCircle && `
211
+ position: relative;
212
+ top: -16px;
213
+ `;
214
+ }}
215
+ `;
216
+ const ModifyButton = (0, _styledComponents.default)(ActionButton)`
217
+ color: var(--font-on-primary);
218
+ background: var(--color-primary);
219
+ border-radius: var(--border-radius);
220
+ margin-left: var(--spacing-xs);
221
+
222
+ ${_ref4 => {
223
+ let {
224
+ roundedCircle
225
+ } = _ref4;
226
+ return roundedCircle && `
227
+ position: relative;
228
+ top: 4px;
229
+ `;
230
+ }}
231
+ `;
232
+ const RemoveIcon = (0, _styledComponents.default)(ActionButton)`
233
+ position: absolute;
234
+ color: var(--font-on-danger);
235
+ background: var(--color-danger);
236
+ border-radius: var(--border-radius);
237
+ bottom: -12px;
238
+ right: -12px;
239
+
240
+ ${_ref5 => {
241
+ let {
242
+ roundedCircle
243
+ } = _ref5;
244
+ return roundedCircle && `
245
+ bottom: 0;
246
+ right: 4px;
247
+ `;
248
+ }}
249
+ `;
250
+ var _default = exports.default = UploadImage;
package/image/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ImageFluid", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ImageFluid.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "UploadImage", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _UploadImage.default;
16
+ }
17
+ });
18
+ var _ImageFluid = _interopRequireDefault(require("./ImageFluid"));
19
+ var _UploadImage = _interopRequireDefault(require("./UploadImage"));
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }