@cashub/ui-elv 1.0.1 → 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 (316) hide show
  1. package/chart/BarChart.js +8 -2
  2. package/chart/DoughnutChart.js +2 -1
  3. package/chart/LineChart.js +2 -1
  4. package/chart/utils/customTooltip.js +3 -7
  5. package/chart/utils/customTooltipLifecyclePlugin.js +21 -0
  6. package/chart/utils/tooltipElement.js +25 -0
  7. package/chart/utils/xAxisLabelTooltipPlugin.js +107 -0
  8. package/datetimePicker/index.js +2 -37
  9. package/esm/Tab/Tab.js +21 -0
  10. package/esm/Tab/TabList.js +160 -0
  11. package/esm/Tab/TabPanel.js +42 -0
  12. package/esm/Tab/TabTab.js +98 -0
  13. package/esm/Tab/index.js +23 -0
  14. package/esm/Tab/subComponent/TabContext.js +3 -0
  15. package/esm/Tab/subComponent/TabListV2.js +18 -0
  16. package/esm/Tab/subComponent/TabPanelV2.js +45 -0
  17. package/esm/Tab/subComponent/TabTabV2.js +56 -0
  18. package/esm/VerticalTab/TabList.js +20 -0
  19. package/esm/VerticalTab/TabPanel.js +45 -0
  20. package/esm/VerticalTab/TabTab.js +63 -0
  21. package/esm/VerticalTab/VerticalTab.js +34 -0
  22. package/esm/VerticalTab/index.js +9 -0
  23. package/esm/VerticalTab/subComponent/TabContext.js +3 -0
  24. package/esm/alert/Alert.js +22 -0
  25. package/esm/alert/index.js +1 -0
  26. package/esm/animate/Collapse.js +65 -0
  27. package/esm/animate/Loader.js +51 -0
  28. package/esm/animate/NumberCounter.js +45 -0
  29. package/esm/animate/PulseRing.js +26 -0
  30. package/esm/animate/Spinner.js +11 -0
  31. package/esm/animate/index.js +5 -0
  32. package/esm/assets/css/autocomplete.css +16 -0
  33. package/esm/assets/css/font.css +4 -0
  34. package/esm/assets/css/global.css +2 -0
  35. package/esm/assets/font/helvetica/Helvetica.ttf +0 -0
  36. package/esm/assets/font/nanumGothic/NanumGothic-Bold.ttf +0 -0
  37. package/esm/assets/font/nanumGothic/NanumGothic-ExtraBold.ttf +0 -0
  38. package/esm/assets/font/nanumGothic/NanumGothic-Regular.ttf +0 -0
  39. package/esm/assets/icons/app-management.png +0 -0
  40. package/esm/assets/icons/burger-black.png +0 -0
  41. package/esm/assets/icons/burger-white.png +0 -0
  42. package/esm/assets/icons/burger.png +0 -0
  43. package/esm/assets/icons/file.svg +1 -0
  44. package/esm/assets/icons/map_icon1.png +0 -0
  45. package/esm/assets/icons/map_icon4.png +0 -0
  46. package/esm/assets/images/bg-aside.png +0 -0
  47. package/esm/assets/images/bg-chart-circle.png +0 -0
  48. package/esm/assets/images/bg-chart-triangle.png +0 -0
  49. package/esm/assets/images/cashub-logo-only.png +0 -0
  50. package/esm/assets/images/default-user.jpg +0 -0
  51. package/esm/assets/images/logo-cashub.png +0 -0
  52. package/esm/assets/images/map.png +0 -0
  53. package/esm/assets/images/qrcode.png +0 -0
  54. package/esm/backdrop/BaseBackdrop.js +11 -0
  55. package/esm/backdrop/LoadingBackdrop.js +10 -0
  56. package/esm/backdrop/ModalBackdrop.js +8 -0
  57. package/esm/backdrop/index.js +3 -0
  58. package/esm/badge/Badge.js +19 -0
  59. package/esm/badge/BadgeDot.js +11 -0
  60. package/esm/badge/BadgeFill.js +42 -0
  61. package/esm/badge/BadgeFillTriangle.js +138 -0
  62. package/esm/badge/BadgeWithText.js +24 -0
  63. package/esm/badge/index.js +5 -0
  64. package/esm/billing/BarChart.js +45 -0
  65. package/esm/billing/Grid.js +38 -0
  66. package/esm/billing/Header2.js +19 -0
  67. package/esm/billing/Header3.js +31 -0
  68. package/esm/billing/Paragraph.js +27 -0
  69. package/esm/billing/ParagraphGroup.js +16 -0
  70. package/esm/billing/ParagraphText.js +20 -0
  71. package/esm/billing/Section.js +44 -0
  72. package/esm/billing/SectionBody.js +11 -0
  73. package/esm/billing/SectionHeader.js +20 -0
  74. package/esm/billing/__stories__/BarChart.stories.js_bak +46 -0
  75. package/esm/billing/__stories__/Grid.stories.js_bak +57 -0
  76. package/esm/billing/__stories__/Header2.stories.js_bak +62 -0
  77. package/esm/billing/__stories__/Header3.stories.js_bak +69 -0
  78. package/esm/billing/__stories__/Paragraph.stories.js_bak +84 -0
  79. package/esm/billing/__stories__/ParagraphGroup.stories.js_bak +68 -0
  80. package/esm/billing/__stories__/ParagraphText.stories.js_bak +64 -0
  81. package/esm/billing/__stories__/Section.stories.js_bak +115 -0
  82. package/esm/billing/__stories__/SectionBody.stories.js_bak +62 -0
  83. package/esm/billing/__stories__/SectionHeader.stories.js-bak +68 -0
  84. package/esm/breadcrumb/Breadcrumb.js +71 -0
  85. package/esm/breadcrumb/index.js +1 -0
  86. package/esm/button/Button.js +145 -0
  87. package/esm/button/ButtonGroup.js +54 -0
  88. package/esm/button/IconButton.js +64 -0
  89. package/esm/button/ScrollToTopButton.js +47 -0
  90. package/esm/button/index.js +4 -0
  91. package/esm/callout/Callout.js +45 -0
  92. package/esm/callout/index.js +1 -0
  93. package/esm/chart/BarChart.js +147 -0
  94. package/esm/chart/DoughnutChart.js +110 -0
  95. package/esm/chart/LineChart.js +140 -0
  96. package/esm/chart/SingleBarChart.js +35 -0
  97. package/esm/chart/index.js +5 -0
  98. package/esm/chart/utils/centerTextPlugin.js +56 -0
  99. package/esm/chart/utils/customTooltip.js +84 -0
  100. package/esm/chart/utils/customTooltipLifecyclePlugin.js +16 -0
  101. package/esm/chart/utils/htmlLegendPlugin.js +83 -0
  102. package/esm/chart/utils/index.js +3 -0
  103. package/esm/chart/utils/padEmptyChartBar.js +47 -0
  104. package/esm/chart/utils/tooltipElement.js +17 -0
  105. package/esm/chart/utils/xAxisLabelTooltipPlugin.js +101 -0
  106. package/esm/chart/utils/yAxisTopTitlePlugin.js +43 -0
  107. package/esm/container/FlexContainer.js +33 -0
  108. package/esm/container/index.js +1 -0
  109. package/esm/cropper/Cropper.js +47 -0
  110. package/esm/cropper/CropperModalHandler.js +34 -0
  111. package/esm/cropper/index.js +2 -0
  112. package/esm/cropper/subComponent/CropImageModal.js +72 -0
  113. package/{datetimePicker/DatetimePicker.js → esm/datetimePicker/DatetimePickerV3.js} +63 -31
  114. package/esm/datetimePicker/TimeInput.js +49 -0
  115. package/esm/datetimePicker/TimePickerStyle.js +58 -0
  116. package/esm/datetimePicker/TimePickerV2.js +199 -0
  117. package/esm/datetimePicker/accordion/Month.js +245 -0
  118. package/esm/datetimePicker/accordion/Year.js +275 -0
  119. package/esm/datetimePicker/index.js +4 -0
  120. package/esm/datetimePicker/provider/constant.js +38 -0
  121. package/esm/datetimePicker/subComponent/DateTimePickerContext.js +3 -0
  122. package/esm/datetimePicker/utils/GMTDate.js +9 -0
  123. package/esm/datetimePicker/utils/pad.js +7 -0
  124. package/esm/datetimePicker/utils/toUTC0.js +7 -0
  125. package/esm/descriptionList/DescriptionDetail.js +21 -0
  126. package/esm/descriptionList/DescriptionList.js +18 -0
  127. package/esm/descriptionList/DescriptionTerm.js +7 -0
  128. package/esm/descriptionList/index.js +3 -0
  129. package/esm/divider/Divider.js +24 -0
  130. package/esm/divider/index.js +1 -0
  131. package/esm/dropdown/Dropdown.js +48 -0
  132. package/esm/dropdown/DropdownButtonOption.js +36 -0
  133. package/esm/dropdown/DropdownContent.js +83 -0
  134. package/esm/dropdown/DropdownDivOption.js +19 -0
  135. package/esm/dropdown/DropdownItem.js +19 -0
  136. package/esm/dropdown/DropdownLinkOption.js +17 -0
  137. package/esm/dropdown/DropdownToggle.js +31 -0
  138. package/esm/dropdown/index.js +11 -0
  139. package/esm/dropdown/subComponent/DropdownContext.js +3 -0
  140. package/esm/dropzone/FileDropzone.js +472 -0
  141. package/esm/dropzone/ImageDropzone.js +327 -0
  142. package/esm/dropzone/index.js +2 -0
  143. package/esm/dropzone/subComponent/Message.js +19 -0
  144. package/esm/figure/IconFigure.js +35 -0
  145. package/esm/figure/ImageFigure.js +31 -0
  146. package/esm/figure/index.js +2 -0
  147. package/esm/file/HiddenFileInput.js +8 -0
  148. package/esm/file/index.js +1 -0
  149. package/esm/form/Checkbox.js +157 -0
  150. package/esm/form/Fieldset.js +11 -0
  151. package/esm/form/FormItem.js +15 -0
  152. package/esm/form/Input.js +59 -0
  153. package/esm/form/Label.js +54 -0
  154. package/esm/form/MutedText.js +14 -0
  155. package/esm/form/PasswordInput.js +40 -0
  156. package/esm/form/RadioButton.js +94 -0
  157. package/esm/form/SearchSelect.js +174 -0
  158. package/esm/form/Searchbox.js +91 -0
  159. package/esm/form/Slider.js +39 -0
  160. package/esm/form/SwitchButton.js +97 -0
  161. package/esm/form/Textarea.js +34 -0
  162. package/esm/form/TreeView.js +66 -0
  163. package/esm/form/index.js +14 -0
  164. package/esm/grid/Column.js +39 -0
  165. package/esm/grid/Grid.js +28 -0
  166. package/esm/grid/index.js +2 -0
  167. package/esm/heading/Heading1.js +14 -0
  168. package/esm/heading/Heading2.js +21 -0
  169. package/esm/heading/Heading3.js +42 -0
  170. package/esm/heading/index.js +3 -0
  171. package/esm/helmet/Helmet.js +17 -0
  172. package/esm/helmet/index.js +2 -0
  173. package/esm/iconbox/ApplicationIconBox.js +74 -0
  174. package/esm/iconbox/IconBox.js +60 -0
  175. package/esm/iconbox/IconBoxV2.js +63 -0
  176. package/esm/iconbox/index.js +3 -0
  177. package/esm/iconbox/subComponent/IconBoxFigure.js +43 -0
  178. package/esm/iconbox/subComponent/IconBoxImage.js +35 -0
  179. package/esm/image/ImageFluid.js +10 -0
  180. package/esm/image/UploadImage.js +243 -0
  181. package/esm/image/index.js +2 -0
  182. package/esm/index.js +47 -0
  183. package/esm/keyframe/Pulse.js +15 -0
  184. package/esm/keyframe/Spin.js +7 -0
  185. package/esm/layout/Aside.js +39 -0
  186. package/esm/layout/AsideHeader.jsx +27 -0
  187. package/esm/layout/Backdrop.js +16 -0
  188. package/esm/layout/Container.js +30 -0
  189. package/esm/layout/Footer.js +36 -0
  190. package/esm/layout/Header.jsx +55 -0
  191. package/esm/layout/Layout.jsx +84 -0
  192. package/esm/layout/Logo.jsx +17 -0
  193. package/esm/layout/MenuIcon.jsx +27 -0
  194. package/esm/layout/Sidebar.jsx +271 -0
  195. package/esm/layout/index.js +1 -0
  196. package/esm/link/LinkSpan.js +62 -0
  197. package/esm/link/index.js +1 -0
  198. package/esm/map/GoogleMap.js +439 -0
  199. package/esm/map/GoogleReverseGeolocation.js +193 -0
  200. package/esm/map/LeafletMap.js +224 -0
  201. package/esm/map/LeafletReverseGeolocation.js +94 -0
  202. package/esm/map/index.js +4 -0
  203. package/esm/map/subComponent/BasicLeafletMap.js +27 -0
  204. package/esm/map/subComponent/GoogleMapContainer.js +22 -0
  205. package/esm/map/subComponent/GoogleMapPopup.js +103 -0
  206. package/esm/map/subComponent/GoogleMapWrapper.js +34 -0
  207. package/esm/map/subComponent/LeafletDrawControl.js +116 -0
  208. package/esm/map/subComponent/LeafletMapContainer.js +166 -0
  209. package/esm/map/subComponent/MapSearchBoxControl.js +47 -0
  210. package/esm/modal/StateModal.js +169 -0
  211. package/esm/modal/TitleModal.js +241 -0
  212. package/esm/modal/index.js +2 -0
  213. package/esm/page/Disclaimer.js +121 -0
  214. package/esm/page/index.js +1 -0
  215. package/esm/paginate/Paginate.js +129 -0
  216. package/esm/paginate/index.js +1 -0
  217. package/esm/popover/Popover.js +82 -0
  218. package/esm/popover/index.js +1 -0
  219. package/esm/qrcode/QRCode.js +51 -0
  220. package/esm/qrcode/QRCodeContainter.js +27 -0
  221. package/esm/qrcode/index.js +2 -0
  222. package/esm/ribbon/Ribbon.js +35 -0
  223. package/esm/ribbon/index.js +1 -0
  224. package/esm/section/Section.js +126 -0
  225. package/esm/section/SectionBody.js +43 -0
  226. package/esm/section/SectionHeader.js +61 -0
  227. package/esm/section/SectionToolbar.js +11 -0
  228. package/esm/section/SectionToolbarItem.js +10 -0
  229. package/esm/section/index.js +5 -0
  230. package/esm/select/InputSelect.js +263 -0
  231. package/esm/select/Select.js +811 -0
  232. package/esm/select/index.js +2 -0
  233. package/esm/select/subComponent/Checkbox.js +40 -0
  234. package/esm/select/subComponent/Footer.js +6 -0
  235. package/esm/select/subComponent/ListBox.js +23 -0
  236. package/esm/select/subComponent/Option.js +37 -0
  237. package/esm/select/subComponent/OptionGroup.js +16 -0
  238. package/esm/select/subComponent/Options.js +25 -0
  239. package/esm/select/subComponent/SearchBox.js +51 -0
  240. package/esm/select/subComponent/SelectedMultipleCount.js +32 -0
  241. package/esm/select/subComponent/SelectedMultipleTags.js +47 -0
  242. package/esm/select/subComponent/SelectedMultipleText.js +63 -0
  243. package/esm/select/subComponent/SelectedSingle.js +10 -0
  244. package/esm/styles/GlobalStyle.js +328 -0
  245. package/esm/styles/config/breakpoint.style.js +7 -0
  246. package/esm/styles/config/header.style.js +4 -0
  247. package/esm/styles/config/sidebar.style.js +11 -0
  248. package/esm/styles/index.js +2 -0
  249. package/esm/styles/mixin/backgroundColor.js +38 -0
  250. package/esm/styles/mixin/borderColor.js +31 -0
  251. package/esm/styles/mixin/color.js +31 -0
  252. package/esm/styles/mixin/colorOnBackground.js +31 -0
  253. package/esm/styles/mixin/inputPlaceholder.js +24 -0
  254. package/esm/styles/mixin/media.js +15 -0
  255. package/esm/styles/mixin/rounded.js +24 -0
  256. package/esm/styles/mixin/scrollbar.js +26 -0
  257. package/esm/styles/theme/dark.theme.js +91 -0
  258. package/esm/styles/theme/light.theme.js +91 -0
  259. package/esm/styles/theme/white.theme.js +91 -0
  260. package/esm/styles/themes.js +9 -0
  261. package/esm/table/GridTable.js +329 -0
  262. package/esm/table/ImageBox.js +38 -0
  263. package/esm/table/InfiniteGridTable.js +396 -0
  264. package/esm/table/PermissionTable.js +57 -0
  265. package/esm/table/SimpleGridTable.js +136 -0
  266. package/esm/table/Table.js +559 -0
  267. package/esm/table/__mock__/columns.js +64 -0
  268. package/esm/table/__mock__/data.js +530 -0
  269. package/esm/table/hooks/index.js +2 -0
  270. package/esm/table/hooks/useCalculateDataRange.js +22 -0
  271. package/esm/table/hooks/useGenerateSort.js +32 -0
  272. package/esm/table/index.js +6 -0
  273. package/esm/table/subComponent/BaseTableHeadCell.js +54 -0
  274. package/esm/table/subComponent/GridTableFooter.js +17 -0
  275. package/esm/table/subComponent/GridTableHeadCell.js +13 -0
  276. package/esm/table/subComponent/Resizer.js +70 -0
  277. package/esm/table/subComponent/TableFooter.js +24 -0
  278. package/esm/table/subComponent/TableFooterInfo.js +6 -0
  279. package/esm/table/subComponent/TableFooterPager.js +26 -0
  280. package/esm/table/subComponent/TableHeadCell.js +12 -0
  281. package/esm/table/subComponent/TableSort.js +31 -0
  282. package/esm/tagify/TagifyStyle.js +54 -0
  283. package/esm/tagify/Tags.js +49 -0
  284. package/esm/tagify/index.js +3 -0
  285. package/esm/tagify/templates/getCreateButtonTemplate.js +12 -0
  286. package/esm/text/Paragraph.js +79 -0
  287. package/esm/text/index.js +1 -0
  288. package/esm/timeline/Timeline.js +132 -0
  289. package/esm/timeline/index.js +1 -0
  290. package/esm/toast/CustomToastContainer.js +38 -0
  291. package/esm/toast/MessageContainer.js +44 -0
  292. package/esm/toast/index.js +3 -0
  293. package/esm/toast/show.js +29 -0
  294. package/esm/toast/style.css +1 -0
  295. package/esm/tooltip/Tooltip.js +133 -0
  296. package/esm/tooltip/index.js +1 -0
  297. package/esm/treeView/TreeViewV2.js +32 -0
  298. package/esm/treeView/TreeflexStyle.js +43 -0
  299. package/esm/treeView/index.js +2 -0
  300. package/esm/wizard/Wizard.js +244 -0
  301. package/esm/wizard/index.js +1 -0
  302. package/index.js +0 -12
  303. package/layout/Sidebar.jsx +1 -1
  304. package/package.json +5 -4
  305. package/datetimePicker/DatePicker.js +0 -363
  306. package/datetimePicker/DatePickerV2.js +0 -407
  307. package/datetimePicker/DatetimePickerV2.js +0 -395
  308. package/datetimePicker/TimePicker.js +0 -317
  309. package/datetimePicker/hooks/index.js +0 -27
  310. package/datetimePicker/hooks/useChangeNumber.js +0 -42
  311. package/datetimePicker/hooks/useDecrease.js +0 -38
  312. package/datetimePicker/hooks/useIncrease.js +0 -38
  313. package/datetimePicker/subComponent/Accordion.js +0 -373
  314. package/datetimePicker/subComponent/CustomTimeInput.js +0 -47
  315. package/jsoneditor/JsonEditor.js +0 -142
  316. package/jsoneditor/index.js +0 -13
@@ -0,0 +1,145 @@
1
+ import styled, { css } from 'styled-components';
2
+ import backgroundColor from '../styles/mixin/backgroundColor';
3
+ import colorOnBackground from '../styles/mixin/colorOnBackground';
4
+ const Button = styled.button.attrs(() => ({
5
+ primary: true
6
+ }))`
7
+ display: flex;
8
+ align-items: center;
9
+ border: none;
10
+ font-size: var(--font-button);
11
+ line-height: var(--font-body1);
12
+ cursor: ${_ref => {
13
+ let {
14
+ disabled
15
+ } = _ref;
16
+ return disabled ? 'no-drop' : 'pointer';
17
+ }};
18
+ border-radius: var(--border-radius-l);
19
+ padding: 10px var(--spacing-s);
20
+ text-transform: uppercase;
21
+
22
+ > svg {
23
+ margin-right: calc(var(--spacing-s) - 0.25rem);
24
+ font-size: var(--font-body1);
25
+ }
26
+
27
+ &:hover {
28
+ ${_ref2 => {
29
+ let {
30
+ disabled
31
+ } = _ref2;
32
+ return !disabled && css`
33
+ transition: 0.3s;
34
+ box-shadow: var(--box-shadow);
35
+ opacity: 0.9;
36
+ `;
37
+ }}
38
+ }
39
+
40
+ ${backgroundColor}
41
+ ${colorOnBackground}
42
+
43
+ ${_ref3 => {
44
+ let {
45
+ secondary
46
+ } = _ref3;
47
+ return secondary && css`
48
+ background: var(--color-background2);
49
+ color: var(--font-on-background);
50
+ `;
51
+ }}
52
+
53
+ ${_ref4 => {
54
+ let {
55
+ reverse
56
+ } = _ref4;
57
+ return reverse && css`
58
+ background: var(--color-background1);
59
+ color: var(--font-on-background);
60
+ `;
61
+ }}
62
+
63
+ ${_ref5 => {
64
+ let {
65
+ disabled
66
+ } = _ref5;
67
+ return disabled && css`
68
+ opacity: 0.5;
69
+ `;
70
+ }}
71
+
72
+ ${_ref6 => {
73
+ let {
74
+ iconOnly
75
+ } = _ref6;
76
+ return iconOnly && css`
77
+ padding: 10px;
78
+
79
+ > svg {
80
+ margin-right: 0;
81
+ }
82
+ `;
83
+ }}
84
+
85
+ ${_ref7 => {
86
+ let {
87
+ fullWidth
88
+ } = _ref7;
89
+ return fullWidth && 'width: 100%;';
90
+ }}
91
+
92
+ ${_ref8 => {
93
+ let {
94
+ alignCenter
95
+ } = _ref8;
96
+ return alignCenter && 'justify-content: center;';
97
+ }}
98
+
99
+ ${_ref9 => {
100
+ let {
101
+ filterFocus
102
+ } = _ref9;
103
+ return filterFocus && css`
104
+ border: 2px solid var(--color-danger);
105
+ `;
106
+ }}
107
+
108
+ ${_ref10 => {
109
+ let {
110
+ variant,
111
+ selected
112
+ } = _ref10;
113
+ return variant === 'outline' && css`
114
+ background: ${selected ? 'var(--color-primary)' : 'transparent'};
115
+ color: ${selected ? 'var(--font-on-primary)' : 'var(--color-primary)'};
116
+ border: 1px solid var(--color-primary);
117
+ padding: 4px var(--spacing-s);
118
+ text-transform: none;
119
+
120
+ &:hover {
121
+ box-shadow: none;
122
+ }
123
+ `;
124
+ }}
125
+
126
+ ${_ref11 => {
127
+ let {
128
+ variant
129
+ } = _ref11;
130
+ return variant === 'link' && css`
131
+ font-size: var(--font-body1);
132
+ background: transparent;
133
+ color: var(--color-primary);
134
+ border: none;
135
+ padding: 0;
136
+ text-decoration: underline;
137
+ text-transform: none;
138
+ &:hover {
139
+ opacity: 0.8;
140
+ box-shadow: none;
141
+ }
142
+ `;
143
+ }}
144
+ `;
145
+ export default Button;
@@ -0,0 +1,54 @@
1
+ import styled from 'styled-components';
2
+ const ButtonGroup = styled.div`
3
+ display: flex;
4
+ align-items: center;
5
+
6
+ > button:not(:first-child),
7
+ *:not(:first-child) {
8
+ margin-left: var(--spacing-s);
9
+ }
10
+
11
+ ${_ref => {
12
+ let {
13
+ alignCenter
14
+ } = _ref;
15
+ return alignCenter && 'justify-content: center;';
16
+ }}
17
+
18
+ ${_ref2 => {
19
+ let {
20
+ alignRight
21
+ } = _ref2;
22
+ return alignRight && 'justify-content: flex-end;';
23
+ }}
24
+
25
+ ${_ref3 => {
26
+ let {
27
+ marginBottom
28
+ } = _ref3;
29
+ return marginBottom && 'margin-bottom: var(--spacing);';
30
+ }}
31
+
32
+ ${_ref4 => {
33
+ let {
34
+ vertical
35
+ } = _ref4;
36
+ return vertical && `
37
+ flex-direction: column;
38
+
39
+ > button,
40
+ > * {
41
+ margin-left: 0 !important;
42
+ margin-bottom: var(--spacing-s);
43
+ }
44
+ `;
45
+ }}
46
+
47
+ ${_ref5 => {
48
+ let {
49
+ height100
50
+ } = _ref5;
51
+ return height100 && 'height: 100%;';
52
+ }}
53
+ `;
54
+ export default ButtonGroup;
@@ -0,0 +1,64 @@
1
+ import styled, { css } from 'styled-components';
2
+ const IconButton = styled.div.attrs(() => ({
3
+ role: 'button'
4
+ }))`
5
+ display: flex;
6
+ justify-content: center;
7
+ align-items: center;
8
+ width: 40px;
9
+ height: 40px;
10
+ transition: 0.3s;
11
+ position: relative;
12
+ border-radius: var(--border-radius-l);
13
+ color: ${_ref => {
14
+ let {
15
+ disabled
16
+ } = _ref;
17
+ return disabled ? 'var(--color-grey)' : 'var(--font-on-background)';
18
+ }};
19
+ cursor: ${_ref2 => {
20
+ let {
21
+ disabled
22
+ } = _ref2;
23
+ return disabled ? 'no-drop' : 'pointer';
24
+ }};
25
+ margin: auto;
26
+
27
+ ${_ref3 => {
28
+ let {
29
+ size
30
+ } = _ref3;
31
+ return size === 'small' && css`
32
+ width: 32px;
33
+ height: 32px;
34
+ `;
35
+ }}
36
+
37
+ &:hover {
38
+ ${_ref4 => {
39
+ let {
40
+ disabled
41
+ } = _ref4;
42
+ return !disabled && 'background: var(--color-hover)';
43
+ }}
44
+ }
45
+
46
+ > svg {
47
+ font-size: 1.5rem;
48
+
49
+ ${_ref5 => {
50
+ let {
51
+ size
52
+ } = _ref5;
53
+ return size === 'small' && 'font-size: 1rem;';
54
+ }}
55
+
56
+ ${_ref6 => {
57
+ let {
58
+ size
59
+ } = _ref6;
60
+ return size === 'large' && 'font-size: 2rem;';
61
+ }}
62
+ }
63
+ `;
64
+ export default IconButton;
@@ -0,0 +1,47 @@
1
+ import { useEffect, useState } from 'react';
2
+ import styled from 'styled-components';
3
+ import { MdOutlineArrowBackIosNew } from 'react-icons/md/index.esm';
4
+ import Button from './Button';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const ScrollToTopButton = () => {
7
+ const [$display, setDisplay] = useState(false);
8
+ const toggleVisible = () => {
9
+ const scrolled = window.pageYOffset;
10
+ scrolled === 0 ? setDisplay(false) : setDisplay(true);
11
+ };
12
+ const scrollToTop = () => {
13
+ window.scrollTo({
14
+ top: 0,
15
+ behavior: 'smooth'
16
+ });
17
+ };
18
+ useEffect(() => {
19
+ window.addEventListener('scroll', toggleVisible);
20
+ return () => {
21
+ window.removeEventListener('scroll', toggleVisible);
22
+ };
23
+ }, []);
24
+ return /*#__PURE__*/_jsx(StyledScrollToTopButton, {
25
+ onClick: scrollToTop,
26
+ $display: $display,
27
+ iconOnly: true,
28
+ children: /*#__PURE__*/_jsx(MdOutlineArrowBackIosNew, {})
29
+ });
30
+ };
31
+ const StyledScrollToTopButton = styled(Button)`
32
+ position: fixed;
33
+ bottom: var(--spacing);
34
+ right: var(--spacing);
35
+ display: ${_ref => {
36
+ let {
37
+ $display
38
+ } = _ref;
39
+ return $display ? 'flex' : 'none';
40
+ }};
41
+ z-index: 30;
42
+
43
+ > svg {
44
+ transform: rotate(90deg);
45
+ }
46
+ `;
47
+ export default ScrollToTopButton;
@@ -0,0 +1,4 @@
1
+ export { default as Button } from './Button';
2
+ export { default as ButtonGroup } from './ButtonGroup';
3
+ export { default as IconButton } from './IconButton';
4
+ export { default as ScrollToTopButton } from './ScrollToTopButton';
@@ -0,0 +1,45 @@
1
+ import styled from 'styled-components';
2
+ const Callout = styled.div`
3
+ padding: var(--spacing);
4
+ border-radius: var(--border-radius);
5
+ background: var(--color-background3);
6
+ margin-bottom: var(--spacing);
7
+ `;
8
+ const Body = styled.div`
9
+ display: flex;
10
+ align-items: center;
11
+ `;
12
+ const Content = styled.div`
13
+ flex: 2;
14
+ `;
15
+ const Title = styled.h3`
16
+ font-size: var(--font-h3);
17
+ font-weight: 500;
18
+ color: var(--font-on-background);
19
+ margin-bottom: var(--border-radius);
20
+ `;
21
+ const Description = styled.p`
22
+ font-size: var(--font-body1);
23
+ line-height: 1.5;
24
+ color: var(--font-on-mute);
25
+ padding-right: var(--spacing);
26
+ font-weight: 400;
27
+
28
+ &:last-child {
29
+ margin-bottom: 0;
30
+ }
31
+ `;
32
+ const Action = styled.div`
33
+ flex: 1;
34
+ display: flex;
35
+ flex-direction: column;
36
+ align-items: flex-end;
37
+ justify-content: center;
38
+ `;
39
+ export default Object.assign(Callout, {
40
+ Body,
41
+ Content,
42
+ Title,
43
+ Description,
44
+ Action
45
+ });
@@ -0,0 +1 @@
1
+ export { default as Callout } from './Callout';
@@ -0,0 +1,147 @@
1
+ import { useContext, useMemo } from 'react';
2
+ import { ThemeContext } from 'styled-components';
3
+ import { Bar, defaults } from 'react-chartjs-2';
4
+ import customTooltip from './utils/customTooltip';
5
+ import customTooltipLifecyclePlugin from './utils/customTooltipLifecyclePlugin';
6
+ import padEmptyChartBar from './utils/padEmptyChartBar';
7
+ import yAxisTopTitlePlugin from './utils/yAxisTopTitlePlugin';
8
+ import xAxisLabelTooltipPlugin from './utils/xAxisLabelTooltipPlugin';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const BarChart = _ref => {
11
+ let {
12
+ height = 300,
13
+ data,
14
+ options = {},
15
+ ...props
16
+ } = _ref;
17
+ const theme = useContext(ThemeContext);
18
+
19
+ // fix: read value from theme
20
+ defaults.font.family = theme.fontFamily;
21
+ defaults.font.size = 16;
22
+ defaults.color = theme.fontOnBg;
23
+ defaults.plugins.tooltip.external = customTooltip(theme);
24
+ const customOptions = useMemo(() => {
25
+ const {
26
+ yAxisTopTitle,
27
+ tooltips = {}
28
+ } = options;
29
+ return {
30
+ onlyFirstTooltips: options.onlyFirstTooltips === undefined ? true : options.onlyFirstTooltips,
31
+ maxBarNumber: options.maxBarNumber === undefined ? 5 : options.maxBarNumber,
32
+ stacked: options.stacked === undefined ? true : options.stacked,
33
+ suggestedMax: options.suggestedMax === undefined ? 10 : options.suggestedMax,
34
+ showLegend: options.showLegend === undefined ? false : options.showLegend,
35
+ rotateLabel: options.rotateLabel === undefined ? true : options.rotateLabel,
36
+ yAxisTopTitle: yAxisTopTitle ? yAxisTopTitle : '',
37
+ tooltipLabelPostfix: tooltips.labelPostfix || '',
38
+ showFullLabelOnHover: options.showFullLabelOnHover === undefined ? false : options.showFullLabelOnHover
39
+ };
40
+ }, [options]);
41
+ const defaultOptions = useMemo(() => {
42
+ return {
43
+ responsive: true,
44
+ maintainAspectRatio: false,
45
+ aspectRatio: 1,
46
+ interaction: {
47
+ mode: 'nearest',
48
+ intersect: false
49
+ },
50
+ plugins: {
51
+ padEmptyChartBar: {
52
+ maxBarNumber: customOptions.maxBarNumber
53
+ },
54
+ legend: {
55
+ position: 'bottom',
56
+ display: customOptions.showLegend
57
+ },
58
+ tooltip: {
59
+ enabled: false,
60
+ intersect: false,
61
+ filter(context) {
62
+ return !customOptions.onlyFirstTooltips || context.datasetIndex === 0 && context.label !== 'null';
63
+ },
64
+ callbacks: {
65
+ title(context) {
66
+ return context[0] ? context[0].label.match(/(.{1,20})/g) : '';
67
+ },
68
+ label(context) {
69
+ const tooltipLabel = context.dataset.tooltipLabels?.[context.dataIndex];
70
+ if (tooltipLabel !== undefined) {
71
+ return `${context.dataset.label}: ${tooltipLabel}`;
72
+ }
73
+ const label = context.dataset.data[context.dataIndex];
74
+ if (context.dataset.customLabel) {
75
+ return context.dataset.customLabel[context.dataIndex].toString();
76
+ }
77
+ return `${context.dataset.label}: ${label.toString()}${customOptions.tooltipLabelPostfix}`;
78
+ },
79
+ labelTextColor(context) {
80
+ const {
81
+ color
82
+ } = context.dataset;
83
+ if (!color) {
84
+ return theme.fontOnPrimary;
85
+ }
86
+ if (color && Array.isArray(color)) {
87
+ return color[context.dataIndex % color.length];
88
+ }
89
+ return color;
90
+ }
91
+ }
92
+ },
93
+ yAxisTopTitle: {
94
+ title: customOptions.yAxisTopTitle
95
+ },
96
+ xAxisLabelTooltip: {
97
+ enabled: customOptions.showFullLabelOnHover
98
+ }
99
+ },
100
+ scales: {
101
+ x: {
102
+ stacked: customOptions.stacked,
103
+ grid: {
104
+ display: false,
105
+ drawBorder: false
106
+ },
107
+ ticks: {
108
+ minRotation: customOptions.rotateLabel ? 15 : 0,
109
+ callback(value) {
110
+ const label = this.getLabelForValue(value);
111
+ return label && label.length > 11 ? `${label.substr(0, 11)}...` : label;
112
+ }
113
+ }
114
+ },
115
+ y: {
116
+ beginAtZero: true,
117
+ suggestedMax: customOptions.suggestedMax,
118
+ grid: {
119
+ display: false,
120
+ drawBorder: false
121
+ },
122
+ ticks: {
123
+ callback(value) {
124
+ if (value % 1 === 0) {
125
+ return value;
126
+ }
127
+ return null;
128
+ }
129
+ }
130
+ }
131
+ },
132
+ layout: {
133
+ padding: {
134
+ top: 32
135
+ }
136
+ }
137
+ };
138
+ }, [customOptions, theme.fontOnPrimary]);
139
+ return /*#__PURE__*/_jsx(Bar, {
140
+ height: height,
141
+ data: data,
142
+ options: defaultOptions,
143
+ plugins: [padEmptyChartBar, yAxisTopTitlePlugin, xAxisLabelTooltipPlugin, customTooltipLifecyclePlugin],
144
+ ...props
145
+ });
146
+ };
147
+ export default BarChart;
@@ -0,0 +1,110 @@
1
+ import { useContext, useMemo, useState } from 'react';
2
+ import styled, { ThemeContext } from 'styled-components';
3
+ import { Doughnut, defaults } from 'react-chartjs-2';
4
+ import uniqueId from 'lodash.uniqueid';
5
+ import htmlLegendPlugin from './utils/htmlLegendPlugin';
6
+ import customTooltip from './utils/customTooltip';
7
+ import customTooltipLifecyclePlugin from './utils/customTooltipLifecyclePlugin';
8
+ import centerTextPlugin from './utils/centerTextPlugin';
9
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
10
+ const DoughnutChart = _ref => {
11
+ let {
12
+ height = 300,
13
+ data,
14
+ showCenterText = false,
15
+ centerTextTitle,
16
+ ...props
17
+ } = _ref;
18
+ const [legendContainerId] = useState(uniqueId('legend-container-'));
19
+ const theme = useContext(ThemeContext);
20
+
21
+ // fix: read value from theme
22
+ defaults.font.family = theme.fontFamily;
23
+ defaults.font.size = 16;
24
+ defaults.color = theme.fontOnBg;
25
+ defaults.plugins.tooltip.external = customTooltip(theme);
26
+ const defaultOptions = useMemo(() => {
27
+ return {
28
+ responsive: true,
29
+ maintainAspectRatio: false,
30
+ aspectRatio: 1,
31
+ plugins: {
32
+ htmlLegend: {
33
+ containerID: legendContainerId
34
+ },
35
+ legend: {
36
+ display: false
37
+ },
38
+ tooltip: {
39
+ enabled: false,
40
+ callbacks: {
41
+ title(context) {
42
+ return context[0] ? context[0].label.match(/(.{1,20})/g) : '';
43
+ },
44
+ label(context) {
45
+ const label = context.dataset.data[context.dataIndex];
46
+ if (context.dataset.customLabel) {
47
+ return context.dataset.customLabel[context.dataIndex].toString();
48
+ }
49
+ return label.toString();
50
+ },
51
+ labelTextColor(context) {
52
+ const {
53
+ color
54
+ } = context.dataset;
55
+ if (!color) {
56
+ return theme.fontOnPrimary;
57
+ }
58
+ if (color && Array.isArray(color)) {
59
+ return color[context.dataIndex % color.length];
60
+ }
61
+ return color;
62
+ }
63
+ }
64
+ },
65
+ centerText: {
66
+ display: showCenterText,
67
+ title: centerTextTitle
68
+ }
69
+ }
70
+ };
71
+ }, [legendContainerId, theme.fontOnPrimary, showCenterText, centerTextTitle]);
72
+ return /*#__PURE__*/_jsxs(_Fragment, {
73
+ children: [/*#__PURE__*/_jsx("div", {
74
+ children: /*#__PURE__*/_jsx(Doughnut, {
75
+ height: height,
76
+ data: data,
77
+ options: defaultOptions,
78
+ plugins: [htmlLegendPlugin, centerTextPlugin, customTooltipLifecyclePlugin],
79
+ ...props
80
+ })
81
+ }), /*#__PURE__*/_jsx(LegendWrapper, {
82
+ id: legendContainerId
83
+ })]
84
+ });
85
+ };
86
+ const LegendWrapper = styled.div`
87
+ .custom-legend-tooltip {
88
+ position: relative;
89
+ }
90
+
91
+ .custom-legend-tooltip:hover::after {
92
+ content: attr(data-tooltip);
93
+ position: absolute;
94
+ top: calc(1rem + var(--spacing-xs));
95
+ left: 50%;
96
+ transform: translateX(-50%);
97
+ border: 1px solid var(--border-color);
98
+ color: var(--font-on-background);
99
+ background: var(--color-background2);
100
+ box-shadow: var(--box-shadow);
101
+ border-radius: calc(var(--border-radius) / 2);
102
+ padding: var(--spacing-xs);
103
+ font-size: var(--font-body1);
104
+ font-weight: var(--font-normal);
105
+ text-align: center;
106
+ width: max-content;
107
+ max-width: 50vw;
108
+ }
109
+ `;
110
+ export default DoughnutChart;