@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,109 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ // custom popup
8
+ // https://developers.google.com/maps/documentation/javascript/examples/overlay-popup
9
+ class GoogleMapPopup {
10
+ constructor(options) {
11
+ // wrap class to prevent cannot reference maps during runtime
12
+ // because google map library will load after render map only
13
+ class MapPopup extends window.google.maps.OverlayView {
14
+ position;
15
+ containerDiv;
16
+ offset = 16;
17
+ justRendered = false;
18
+ constructor() {
19
+ let {
20
+ maxWidth,
21
+ offset
22
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23
+ super();
24
+
25
+ // This zero-height div is positioned at the bottom of the tip.
26
+ this.containerDiv = document.createElement('div');
27
+ this.containerDiv.classList.add('google-popup-content-wrapper');
28
+ if (maxWidth) {
29
+ this.containerDiv.style.maxWidth = `${maxWidth}px`;
30
+ }
31
+ if (offset) {
32
+ this.offset = offset;
33
+ }
34
+
35
+ // Optionally stop clicks, etc., from bubbling up to the map.
36
+ MapPopup.preventMapHitsAndGesturesFrom(this.containerDiv);
37
+ }
38
+ /** Called when the popup is added to the map. */
39
+ onAdd() {
40
+ this.getPanes().floatPane.appendChild(this.containerDiv);
41
+ this.justRendered = true;
42
+ }
43
+ /** Called when the popup is removed from the map. */
44
+ onRemove() {
45
+ if (this.containerDiv.parentElement) {
46
+ this.containerDiv.parentElement.removeChild(this.containerDiv);
47
+ this.justRendered = false;
48
+ }
49
+ }
50
+ /** Called each frame when the popup needs to draw itself. */
51
+ draw() {
52
+ if (this.position) {
53
+ const divPosition = this.getProjection().fromLatLngToDivPixel(this.position);
54
+
55
+ // On the first render, if we go beyond the map, pan the map
56
+ if (this.justRendered) {
57
+ this.fitMap();
58
+ this.justRendered = false;
59
+ }
60
+ this.containerDiv.style.left = `${divPosition.x}px`;
61
+ this.containerDiv.style.top = `${divPosition.y - this.offset}px`;
62
+ }
63
+ }
64
+ setPosition(position) {
65
+ this.position = position;
66
+ }
67
+ setContent(content) {
68
+ if (!content) return;
69
+ if (typeof content === 'object') {
70
+ this.containerDiv.replaceChildren(content);
71
+ } else {
72
+ this.containerDiv.innerHTML = content;
73
+ }
74
+ }
75
+ fitMap() {
76
+ const projection = this.getProjection();
77
+ const {
78
+ offsetWidth,
79
+ offsetHeight
80
+ } = this.containerDiv;
81
+ const halfWidth = offsetWidth / 2;
82
+ const {
83
+ offsetTop,
84
+ offsetLeft
85
+ } = this.containerDiv;
86
+
87
+ // Calculate the coordinates of the four corners of the container
88
+ // because container use transform for position(-50%, -100%), so we need to subtract them
89
+ const topLeft = new window.google.maps.Point(offsetLeft - halfWidth, offsetTop - offsetHeight);
90
+ const topRight = new window.google.maps.Point(offsetLeft + offsetWidth - halfWidth, offsetTop - offsetHeight);
91
+ const bottomLeft = new window.google.maps.Point(offsetLeft - halfWidth, offsetTop + offsetHeight - offsetHeight);
92
+ const bottomRight = new window.google.maps.Point(offsetLeft + offsetWidth - halfWidth, offsetTop + offsetHeight - offsetHeight);
93
+ const northWest = projection.fromDivPixelToLatLng(topLeft);
94
+ const northEast = projection.fromDivPixelToLatLng(topRight);
95
+ const southWest = projection.fromDivPixelToLatLng(bottomLeft);
96
+ const southEast = projection.fromDivPixelToLatLng(bottomRight);
97
+ const popupBound = new window.google.maps.LatLngBounds();
98
+ popupBound.extend(northWest);
99
+ popupBound.extend(northEast);
100
+ popupBound.extend(southWest);
101
+ popupBound.extend(southEast);
102
+ popupBound.extend(this.position);
103
+ this.map.fitBounds(popupBound);
104
+ }
105
+ }
106
+ return new MapPopup(options);
107
+ }
108
+ }
109
+ var _default = exports.default = GoogleMapPopup;
@@ -0,0 +1,40 @@
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 _reactWrapper = require("@googlemaps/react-wrapper");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ const GoogleMapWrapper = _ref => {
11
+ let {
12
+ children,
13
+ apiKey,
14
+ onError,
15
+ ...props
16
+ } = _ref;
17
+ const render = status => {
18
+ switch (status) {
19
+ case _reactWrapper.Status.LOADING:
20
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
21
+ case _reactWrapper.Status.FAILURE:
22
+ onError(status);
23
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
24
+ default:
25
+ break;
26
+ }
27
+ };
28
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactWrapper.Wrapper, {
29
+ apiKey: apiKey,
30
+ render: render,
31
+ style: {
32
+ position: 'relative'
33
+ },
34
+ children: /*#__PURE__*/(0, _react.cloneElement)(children, {
35
+ ...props,
36
+ onError
37
+ })
38
+ });
39
+ };
40
+ var _default = exports.default = GoogleMapWrapper;
@@ -0,0 +1,127 @@
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 _leaflet = _interopRequireWildcard(require("leaflet"));
9
+ var _leafletDraw = _interopRequireDefault(require("leaflet-draw"));
10
+ require("leaflet-draw/dist/leaflet.draw.css");
11
+ var _core = require("@react-leaflet/core");
12
+ var _fastDeepEqual = _interopRequireDefault(require("fast-deep-equal"));
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ 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); }
15
+ 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; }
16
+ // eslint-disable-line
17
+
18
+ const eventHandlers = {
19
+ onEdited: 'draw:edited',
20
+ onDrawStart: 'draw:drawstart',
21
+ onDrawStop: 'draw:drawstop',
22
+ onDrawVertex: 'draw:drawvertex',
23
+ onEditStart: 'draw:editstart',
24
+ onEditMove: 'draw:editmove',
25
+ onEditResize: 'draw:editresize',
26
+ onEditVertex: 'draw:editvertex',
27
+ onEditStop: 'draw:editstop',
28
+ onDeleted: 'draw:deleted',
29
+ onDeleteStart: 'draw:deletestart',
30
+ onDeleteStop: 'draw:deletestop'
31
+ };
32
+ _leaflet.default.drawLocal.edit.handlers.edit.tooltip = {
33
+ text: 'Drag handles or markers to edit features.',
34
+ subtext: null
35
+ };
36
+ const LeafletDrawControl = props => {
37
+ const {
38
+ map,
39
+ layerContainer
40
+ } = (0, _core.useLeafletContext)();
41
+ const drawRef = (0, _react.useRef)();
42
+ const propsRef = (0, _react.useRef)(props);
43
+ const onDrawCreate = (0, _react.useCallback)(event => {
44
+ const container = layerContainer;
45
+ container.addLayer(event.layer);
46
+ }, [layerContainer]);
47
+ const enableEdit = (0, _react.useCallback)(() => {
48
+ // programatically enable edit mode
49
+ // https://github.com/Leaflet/Leaflet.draw/issues/129
50
+ const editHandler = drawRef.current._toolbars.edit.getModeHandlers()[0].handler;
51
+ // this is hacky but needed otherwise enabling the edit mode will fail
52
+ // when the code attempts to fire map events for edit start etc
53
+ editHandler._map = map;
54
+ editHandler.enable();
55
+ }, [map]);
56
+ (0, _react.useEffect)(() => {
57
+ // if rendered and all props no change prevent render again
58
+ if (drawRef.current && props.draw !== undefined && (0, _fastDeepEqual.default)(props.draw, propsRef.current.draw) && (0, _fastDeepEqual.default)(props.edit, propsRef.current.edit) && props.position === propsRef.current.position) {
59
+ return;
60
+ }
61
+
62
+ // add event listener
63
+ for (const key in eventHandlers) {
64
+ map.on(eventHandlers[key], evt => {
65
+ const handlers = Object.keys(eventHandlers).filter(handler => eventHandlers[handler] === evt.type);
66
+ if (handlers.length === 1) {
67
+ const [handler] = handlers;
68
+ props[handler] && props[handler](evt);
69
+ }
70
+ });
71
+ }
72
+
73
+ // add create draw event listener
74
+ map.on(_leaflet.default.Draw.Event.CREATED, onDrawCreate);
75
+
76
+ // create draw element and render on map
77
+ drawRef.current = createDrawElement(props, layerContainer);
78
+ map.addControl(drawRef.current);
79
+ drawRef.current.enableEdit = enableEdit;
80
+ if (props.onMounted) {
81
+ props.onMounted(drawRef.current);
82
+ }
83
+ return () => {
84
+ drawRef.current.remove(map);
85
+ drawRef.current = null;
86
+ map.off(_leaflet.default.Draw.Event.CREATED, onDrawCreate);
87
+ for (const key in eventHandlers) {
88
+ if (props[key]) {
89
+ map.off(eventHandlers[key], props[key]);
90
+ }
91
+ }
92
+ };
93
+ }, [props, map, layerContainer, onDrawCreate, enableEdit]);
94
+ return null;
95
+ };
96
+ const createDrawElement = (props, layerContainer) => {
97
+ const {
98
+ draw,
99
+ edit,
100
+ position
101
+ } = props;
102
+ const options = {
103
+ edit: {
104
+ featureGroup: layerContainer
105
+ }
106
+ };
107
+ if (draw !== undefined) {
108
+ if (typeof draw === 'object') {
109
+ options.draw = {
110
+ ...draw
111
+ };
112
+ } else {
113
+ options.draw = draw;
114
+ }
115
+ }
116
+ if (edit) {
117
+ options.edit = {
118
+ ...options.edit,
119
+ ...edit
120
+ };
121
+ }
122
+ if (position) {
123
+ options.position = position;
124
+ }
125
+ return new _leaflet.Control.Draw(options);
126
+ };
127
+ var _default = exports.default = LeafletDrawControl;
@@ -0,0 +1,173 @@
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 _reactLeaflet = require("react-leaflet");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ const LeafletMapContainer = (0, _styledComponents.default)(_reactLeaflet.MapContainer)`
11
+ width: 100%;
12
+ height: ${_ref => {
13
+ let {
14
+ height
15
+ } = _ref;
16
+ return height;
17
+ }}px;
18
+ border: 1px solid transparent;
19
+ border-radius: var(--border-radius);
20
+ z-index: 1;
21
+
22
+ &:focus {
23
+ border-color: var(--border-color);
24
+ box-shadow: var(--box-shadow);
25
+ }
26
+
27
+ .leaflet-control-container {
28
+ .leaflet-control-zoom {
29
+ box-shadow: var(--box-shadow);
30
+ border-radius: var(--border-radius);
31
+
32
+ a {
33
+ background: transparent;
34
+ border-bottom: 1px solid var(--border-color);
35
+ color: var(--font-on-background);
36
+
37
+ &:last-child {
38
+ border-bottom: none;
39
+ }
40
+
41
+ &.leaflet-disabled {
42
+ opacity: 0.5;
43
+ }
44
+ }
45
+ }
46
+
47
+ .leaflet-draw {
48
+ box-shadow: var(--box-shadow);
49
+ border-radius: var(--border-radius);
50
+
51
+ a {
52
+ background-color: var(--color-background1);
53
+ }
54
+
55
+ .leaflet-draw-draw-polyline {
56
+ background-position: -3px -3px;
57
+ }
58
+
59
+ .leaflet-draw-draw-polygon {
60
+ background-position: -32px -3px;
61
+ }
62
+
63
+ .leaflet-draw-draw-rectangle {
64
+ background-position: -63px -3px;
65
+ }
66
+
67
+ .leaflet-draw-draw-circle {
68
+ background-position: -93px -3px;
69
+ }
70
+
71
+ .leaflet-draw-draw-marker {
72
+ background-position: -123px -3px;
73
+ }
74
+
75
+ .leaflet-draw-draw-circlemarker {
76
+ background-position: -273px -3px;
77
+ }
78
+
79
+ .leaflet-draw-edit-edit {
80
+ background-position: -213px -3px;
81
+ }
82
+
83
+ .leaflet-draw-edit-remove {
84
+ background-position: -243px -3px;
85
+ }
86
+ }
87
+
88
+ .leaflet-left .leaflet-control {
89
+ margin-left: var(--spacing-s);
90
+ }
91
+
92
+ .leaflet-right .leaflet-control {
93
+ margin-right: var(--spacing-s);
94
+ }
95
+
96
+ .leaflet-top .leaflet-control {
97
+ margin-top: var(--spacing-s);
98
+ }
99
+
100
+ .leaflet-control {
101
+ font-weight: bold;
102
+ background: var(--color-background1);
103
+
104
+ &.leaflet-control-attribution {
105
+ background: var(--color-white);
106
+ color: var(--color-dark);
107
+ margin: 0;
108
+ }
109
+ }
110
+ }
111
+
112
+ .leaflet-edit-move {
113
+ border-radius: 50px;
114
+ border-color: var(--border-color);
115
+ }
116
+
117
+ .leaflet-edit-resize {
118
+ border-radius: 50px;
119
+ border-color: var(--border-color);
120
+ }
121
+
122
+ &.leaflet-touch {
123
+ .leaflet-bar {
124
+ border: none;
125
+
126
+ a {
127
+ width: 24px;
128
+ height: 24px;
129
+ line-height: 24px;
130
+ }
131
+ }
132
+
133
+ .leaflet-left .leaflet-control {
134
+ margin-left: var(--spacing-s);
135
+ }
136
+
137
+ .leaflet-right .leaflet-control {
138
+ margin-right: var(--spacing-s);
139
+ }
140
+
141
+ .leaflet-top .leaflet-control {
142
+ margin-top: var(--spacing-s);
143
+ }
144
+ }
145
+
146
+ .marker-cluster {
147
+ background: var(--color-primary) a1;
148
+
149
+ div {
150
+ background: var(--color-primary);
151
+ color: var(--font-on-primary);
152
+ }
153
+ }
154
+
155
+ .leaflet-popup-content-wrapper {
156
+ background: transparent;
157
+ box-shadow: unset;
158
+ }
159
+
160
+ .leaflet-popup-content p {
161
+ margin: 0;
162
+ margin-bottom: var(--spacing-s);
163
+ }
164
+
165
+ .leaflet-popup-tip {
166
+ display: none;
167
+ }
168
+
169
+ .sr-only {
170
+ display: none;
171
+ }
172
+ `;
173
+ var _default = exports.default = LeafletMapContainer;
@@ -0,0 +1,54 @@
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 _leaflet = _interopRequireDefault(require("leaflet"));
9
+ var _reactLeaflet = require("react-leaflet");
10
+ var _Searchbox = _interopRequireDefault(require("../../form/Searchbox"));
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ const MapSearchBoxControl = _ref => {
14
+ let {
15
+ changeLatlng,
16
+ onSearch,
17
+ onError
18
+ } = _ref;
19
+ const map = (0, _reactLeaflet.useMap)();
20
+ const barRef = (0, _react.useRef)(null);
21
+ const handleError = errorCode => {
22
+ if (onError) {
23
+ onError(errorCode);
24
+ }
25
+ };
26
+ const handleSearch = async address => {
27
+ try {
28
+ const latlng = await onSearch(address);
29
+ if (latlng) {
30
+ map.flyTo(latlng, 15);
31
+ changeLatlng(latlng);
32
+ } else {
33
+ handleError('NO_RESULT');
34
+ }
35
+ } catch (error) {
36
+ handleError(error.message);
37
+ }
38
+ };
39
+ (0, _react.useEffect)(() => {
40
+ _leaflet.default.DomEvent.disableClickPropagation(barRef.current);
41
+ }, []);
42
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
43
+ className: "leaflet-top leaflet-right",
44
+ ref: barRef,
45
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
46
+ className: "leaflet-control leaflet-bar",
47
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Searchbox.default, {
48
+ onSearch: handleSearch,
49
+ autoFocus: true
50
+ })
51
+ })
52
+ });
53
+ };
54
+ var _default = exports.default = MapSearchBoxControl;
@@ -0,0 +1,178 @@
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 _reactDom = _interopRequireWildcard(require("react-dom"));
9
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
10
+ var _lodash = _interopRequireDefault(require("lodash.uniqueid"));
11
+ var _bs = require("react-icons/bs");
12
+ var _fa = require("react-icons/fa");
13
+ var _utils = require("@cashub/utils");
14
+ var _ButtonGroup = _interopRequireDefault(require("../button/ButtonGroup"));
15
+ var _Button = _interopRequireDefault(require("../button/Button"));
16
+ var _ModalBackdrop = _interopRequireDefault(require("../backdrop/ModalBackdrop"));
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
+ 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); }
20
+ 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; }
21
+ const StateModal = _ref => {
22
+ let {
23
+ onClose,
24
+ ...props
25
+ } = _ref;
26
+ const rootElement = (0, _utils.appendElementTo)('StateModalContainer');
27
+ const Container = document.createElement('div');
28
+ rootElement.appendChild(Container);
29
+ const handleClose = () => {
30
+ // unmount component and clear event handler and state before remove container
31
+ (0, _reactDom.unmountComponentAtNode)(Container);
32
+ Container.remove();
33
+ if (onClose) onClose();
34
+ };
35
+ _reactDom.default.render(/*#__PURE__*/(0, _jsxRuntime.jsx)(ModalContent, {
36
+ ...props,
37
+ onClose: handleClose
38
+ }), Container);
39
+ };
40
+ const ModalContent = _ref2 => {
41
+ let {
42
+ type,
43
+ title,
44
+ text,
45
+ buttons,
46
+ confirmButtonText,
47
+ cancelButtonText,
48
+ showConfirmButton = true,
49
+ showCancelButton,
50
+ onClose,
51
+ onConfirm,
52
+ onCancel,
53
+ allowDismiss = true,
54
+ cancelButtonType = 'danger',
55
+ confirmButtonType = 'success'
56
+ } = _ref2;
57
+ const refWrapper = (0, _react.useRef)(null);
58
+ const [id] = (0, _react.useState)((0, _lodash.default)('SD-'));
59
+ let Icon = _bs.BsCheckCircle;
60
+ if (type === 'error') Icon = _fa.FaRegTimesCircle;
61
+ if (type === 'danger') Icon = _bs.BsExclamationTriangle;
62
+ if (type === 'warning') Icon = _bs.BsExclamationCircle;
63
+ const getButtonTypeProps = buttonType => ({
64
+ ...(buttonType === 'danger' && {
65
+ danger: true
66
+ }),
67
+ ...(buttonType === 'warning' && {
68
+ warning: true
69
+ }),
70
+ ...(buttonType === 'success' && {
71
+ success: true
72
+ })
73
+ });
74
+ const handleDismiss = event => {
75
+ if (event.target === refWrapper.current && allowDismiss === true) {
76
+ onClose();
77
+ }
78
+ };
79
+ const modalButtons = buttons || [showCancelButton === true && {
80
+ text: cancelButtonText || 'Cancel',
81
+ type: cancelButtonType,
82
+ onClick: onCancel
83
+ }, showConfirmButton === true && {
84
+ text: confirmButtonText || 'Confirm',
85
+ type: confirmButtonType,
86
+ onClick: onConfirm
87
+ }].filter(Boolean);
88
+ const handleButtonClick = button => {
89
+ if (button.onClick) button.onClick();
90
+ if (button.closeOnClick !== false) onClose();
91
+ };
92
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
93
+ ref: refWrapper,
94
+ onClick: handleDismiss,
95
+ role: "dialog",
96
+ "aria-labelledby": `${id}-Title`,
97
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
98
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Body, {
99
+ type: type,
100
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {
101
+ role: "img"
102
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Title, {
103
+ children: title
104
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Message, {
105
+ children: text
106
+ })]
107
+ }), modalButtons.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonGroup.default, {
108
+ alignRight: true,
109
+ children: modalButtons.map((_ref3, index) => {
110
+ let {
111
+ text: buttonText,
112
+ children,
113
+ type: buttonType,
114
+ onClick,
115
+ closeOnClick,
116
+ ...buttonProps
117
+ } = _ref3;
118
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
119
+ ...getButtonTypeProps(buttonType),
120
+ ...buttonProps,
121
+ onClick: () => handleButtonClick({
122
+ onClick,
123
+ closeOnClick
124
+ }),
125
+ children: children || buttonText
126
+ }, `${id}-Button-${index}`);
127
+ })
128
+ })]
129
+ })
130
+ });
131
+ };
132
+ const Wrapper = (0, _styledComponents.default)(_ModalBackdrop.default)`
133
+ z-index: 90;
134
+ `;
135
+ const Container = _styledComponents.default.div`
136
+ width: 500px;
137
+ max-width: 90%;
138
+ background: var(--color-background2);
139
+ box-shadow: var(--box-shadow);
140
+ padding: var(--spacing);
141
+ border-radius: var(--border-radius);
142
+ color: var(--font-on-background);
143
+ border: var(--border-width) solid var(--border-color);
144
+ text-align: center;
145
+ `;
146
+ const Body = _styledComponents.default.div`
147
+ margin-bottom: var(--spacing);
148
+
149
+ > svg {
150
+ font-size: 120px;
151
+ margin-bottom: var(--spacing);
152
+
153
+ ${_ref4 => {
154
+ let {
155
+ type
156
+ } = _ref4;
157
+ switch (type) {
158
+ case 'error':
159
+ case 'danger':
160
+ return 'color: var(--color-danger);';
161
+ case 'warning':
162
+ return 'color: var(--color-warning);';
163
+ default:
164
+ return 'color: var(--color-success);';
165
+ }
166
+ }}
167
+ }
168
+ `;
169
+ const Title = _styledComponents.default.h2`
170
+ font-size: var(--font-body1);
171
+ font-weight: var(--font-bold);
172
+ margin-bottom: var(--spacing-s);
173
+ `;
174
+ const Message = _styledComponents.default.p`
175
+ font-size: var(--font-body1);
176
+ white-space: pre-line;
177
+ `;
178
+ var _default = exports.default = StateModal;