@cashub/ui 0.47.0 → 0.48.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/Tab/TabList.js +38 -26
  2. package/Tab/TabPanel.js +13 -20
  3. package/Tab/TabTab.js +36 -24
  4. package/Tab/index.js +15 -1
  5. package/Tab/subComponent/TabListV2.js +25 -0
  6. package/Tab/subComponent/TabPanelV2.js +52 -0
  7. package/Tab/subComponent/TabTabV2.js +63 -0
  8. package/VerticalTab/TabList.js +13 -18
  9. package/VerticalTab/TabPanel.js +16 -20
  10. package/VerticalTab/TabTab.js +40 -21
  11. package/VerticalTab/VerticalTab.js +8 -4
  12. package/alert/Alert.js +12 -5
  13. package/animate/Collapse.js +5 -7
  14. package/animate/Loader.js +18 -7
  15. package/animate/PulseRing.js +18 -5
  16. package/animate/Spinner.js +8 -3
  17. package/backdrop/BaseBackdrop.js +9 -3
  18. package/backdrop/LoadingBackdrop.js +7 -3
  19. package/backdrop/ModalBackdrop.js +5 -3
  20. package/badge/Badge.js +15 -3
  21. package/badge/BadgeDot.js +8 -3
  22. package/badge/BadgeFill.js +24 -6
  23. package/badge/BadgeWithText.js +13 -3
  24. package/billing/BarChart.js +1 -1
  25. package/breadcrumb/Breadcrumb.js +42 -3
  26. package/button/Button.js +88 -20
  27. package/button/ButtonGroup.js +33 -9
  28. package/button/IconButton.js +37 -10
  29. package/button/ScrollToTopButton.js +12 -4
  30. package/callout/Callout.js +37 -8
  31. package/chart/BarChart.js +10 -17
  32. package/chart/DoughnutChart.js +34 -20
  33. package/chart/LineChart.js +11 -18
  34. package/chart/SingleBarChart.js +22 -5
  35. package/chart/utils/centerTextPlugin.js +2 -2
  36. package/chart/utils/customTooltip.js +7 -7
  37. package/chart/utils/htmlLegendPlugin.js +1 -1
  38. package/container/FlexContainer.js +15 -7
  39. package/cropper/Cropper.js +1 -2
  40. package/datetimePicker/DatePicker.js +80 -26
  41. package/datetimePicker/DatePickerV2.js +95 -36
  42. package/datetimePicker/DatetimePicker.js +174 -11
  43. package/datetimePicker/DatetimePickerV2.js +87 -33
  44. package/datetimePicker/DatetimePickerV3.js +174 -11
  45. package/datetimePicker/TimeInput.js +35 -10
  46. package/datetimePicker/TimePicker.js +77 -22
  47. package/datetimePicker/TimePickerStyle.js +53 -3
  48. package/datetimePicker/TimePickerV2.js +54 -21
  49. package/datetimePicker/accordion/Month.js +93 -16
  50. package/datetimePicker/accordion/Year.js +96 -18
  51. package/datetimePicker/hooks/useChangeNumber.js +3 -6
  52. package/datetimePicker/hooks/useDecrease.js +3 -6
  53. package/datetimePicker/hooks/useIncrease.js +3 -6
  54. package/datetimePicker/subComponent/Accordion.js +101 -20
  55. package/descriptionList/DescriptionDetail.js +15 -4
  56. package/descriptionList/DescriptionList.js +12 -4
  57. package/descriptionList/DescriptionTerm.js +5 -3
  58. package/divider/Divider.js +15 -6
  59. package/dropdown/DropdownButtonOption.js +22 -6
  60. package/dropdown/DropdownContent.js +29 -15
  61. package/dropdown/DropdownDivOption.js +17 -3
  62. package/dropdown/DropdownLinkOption.js +14 -3
  63. package/dropdown/DropdownToggle.js +7 -15
  64. package/dropzone/FileDropzone.js +121 -22
  65. package/dropzone/ImageDropzone.js +83 -14
  66. package/dropzone/subComponent/Message.js +11 -4
  67. package/figure/IconFigure.js +16 -7
  68. package/figure/ImageFigure.js +19 -6
  69. package/file/HiddenFileInput.js +3 -3
  70. package/form/Checkbox.js +74 -13
  71. package/form/Fieldset.js +9 -3
  72. package/form/FormItem.js +10 -5
  73. package/form/Input.js +40 -7
  74. package/form/Label.js +34 -10
  75. package/form/MutedText.js +8 -4
  76. package/form/PasswordInput.js +20 -13
  77. package/form/RadioButton.js +55 -8
  78. package/form/SearchSelect.js +64 -12
  79. package/form/Searchbox.js +45 -19
  80. package/form/Slider.js +28 -10
  81. package/form/SwitchButton.js +48 -14
  82. package/form/Textarea.js +30 -3
  83. package/form/TreeView.js +13 -6
  84. package/grid/Column.js +23 -10
  85. package/grid/Grid.js +14 -6
  86. package/heading/Heading1.js +8 -4
  87. package/heading/Heading2.js +11 -5
  88. package/heading/Heading3.js +20 -8
  89. package/iconbox/ApplicationIconBox.js +48 -12
  90. package/iconbox/IconBox.js +31 -7
  91. package/iconbox/IconBoxV2.js +33 -8
  92. package/iconbox/subComponent/IconBoxFigure.js +17 -9
  93. package/iconbox/subComponent/IconBoxImage.js +21 -8
  94. package/image/ImageFluid.js +7 -3
  95. package/image/UploadImage.js +66 -18
  96. package/index.js +8 -1
  97. package/jsoneditor/JsonEditor.js +121 -15
  98. package/keyframe/Pulse.js +13 -3
  99. package/keyframe/Spin.js +5 -3
  100. package/layout/Aside.js +30 -5
  101. package/layout/Backdrop.js +8 -4
  102. package/layout/Container.js +21 -5
  103. package/layout/Footer.js +26 -7
  104. package/link/LinkSpan.js +37 -19
  105. package/map/GoogleMap.js +3 -7
  106. package/map/GoogleReverseGeolocation.js +6 -3
  107. package/map/LeafletMap.js +2 -2
  108. package/map/subComponent/GoogleMapContainer.js +16 -4
  109. package/map/subComponent/GoogleMapPopup.js +7 -10
  110. package/map/subComponent/GoogleMapWrapper.js +8 -15
  111. package/map/subComponent/LeafletDrawControl.js +9 -7
  112. package/map/subComponent/LeafletMapContainer.js +159 -4
  113. package/modal/StateModal.js +49 -28
  114. package/modal/TitleModal.js +70 -29
  115. package/package.json +1 -1
  116. package/page/Disclaimer.js +119 -3
  117. package/paginate/Paginate.js +54 -12
  118. package/popover/Popover.js +30 -25
  119. package/qrcode/QRCode.js +20 -6
  120. package/qrcode/QRCodeContainter.js +12 -4
  121. package/ribbon/Ribbon.js +29 -4
  122. package/section/Section.js +68 -20
  123. package/section/SectionBody.js +29 -8
  124. package/section/SectionHeader.js +36 -11
  125. package/section/SectionToolbar.js +9 -3
  126. package/section/SectionToolbarItem.js +8 -3
  127. package/select/InputSelect.js +16 -23
  128. package/select/Select.js +112 -43
  129. package/select/subComponent/Checkbox.js +24 -5
  130. package/select/subComponent/Footer.js +4 -3
  131. package/select/subComponent/ListBox.js +12 -5
  132. package/select/subComponent/Option.js +27 -7
  133. package/select/subComponent/OptionGroup.js +13 -3
  134. package/select/subComponent/Options.js +18 -5
  135. package/select/subComponent/SearchBox.js +34 -12
  136. package/select/subComponent/SelectedMultipleTags.js +21 -3
  137. package/select/subComponent/SelectedMultipleText.js +20 -4
  138. package/select/subComponent/SelectedSingle.js +7 -3
  139. package/styles/GlobalStyle.js +156 -45
  140. package/styles/mixin/backgroundColor.js +16 -8
  141. package/styles/mixin/borderColor.js +13 -7
  142. package/styles/mixin/color.js +13 -7
  143. package/styles/mixin/colorOnBackground.js +13 -7
  144. package/styles/mixin/inputPlaceholder.js +20 -3
  145. package/styles/mixin/media.js +5 -3
  146. package/styles/mixin/rounded.js +10 -6
  147. package/styles/mixin/scrollbar.js +13 -3
  148. package/styles/theme/dark.theme.js +15 -14
  149. package/styles/theme/light.theme.js +15 -14
  150. package/styles/theme/white.theme.js +15 -14
  151. package/table/GridTable.js +71 -33
  152. package/table/ImageBox.js +15 -5
  153. package/table/InfiniteGridTable.js +92 -46
  154. package/table/PermissionTable.js +32 -10
  155. package/table/SimpleGridTable.js +143 -0
  156. package/table/Table.js +198 -48
  157. package/table/__mock__/columns.js +1 -1
  158. package/table/index.js +7 -0
  159. package/table/subComponent/BaseTableHeadCell.js +37 -8
  160. package/table/subComponent/GridTableFooter.js +10 -4
  161. package/table/subComponent/GridTableHeadCell.js +6 -4
  162. package/table/subComponent/Resizer.js +19 -4
  163. package/table/subComponent/TableFooter.js +15 -6
  164. package/table/subComponent/TableFooterInfo.js +4 -3
  165. package/table/subComponent/TableFooterPager.js +19 -6
  166. package/table/subComponent/TableHeadCell.js +9 -3
  167. package/table/subComponent/TableSort.js +17 -7
  168. package/tagify/TagifyStyle.js +49 -3
  169. package/tagify/Tags.js +37 -21
  170. package/tagify/templates/getCreateButtonTemplate.js +5 -2
  171. package/text/Paragraph.js +50 -12
  172. package/timeline/Timeline.js +94 -17
  173. package/toast/CustomToastContainer.js +35 -3
  174. package/toast/MessageContainer.js +22 -4
  175. package/tooltip/Tooltip.js +47 -19
  176. package/treeView/TreeViewV2.js +1 -1
  177. package/treeView/TreeflexStyle.js +38 -3
  178. package/wizard/Wizard.js +115 -6
@@ -12,17 +12,7 @@ var _GridTableHeadCell = _interopRequireDefault(require("./subComponent/GridTabl
12
12
  var _Resizer = _interopRequireDefault(require("./subComponent/Resizer"));
13
13
  var _Popover = _interopRequireDefault(require("../popover/Popover"));
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
16
- const _excluded = ["title", "fieldName", "render", "custom", "width"];
17
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
19
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
20
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
21
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
24
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
25
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
26
16
  const ROW_HEIGHT = 48;
27
17
  const OVER_SCAN_COUNT = 5;
28
18
  const InfiniteGridTable = _ref => {
@@ -50,7 +40,10 @@ const InfiniteGridTable = _ref => {
50
40
  info: 'Showing _START_ to _END_ of _TOTAL_ entries',
51
41
  empty: 'No data available in table'
52
42
  };
53
- return _objectSpread(_objectSpread({}, defaultTexts), translation);
43
+ return {
44
+ ...defaultTexts,
45
+ ...translation
46
+ };
54
47
  }, [translation]);
55
48
  const tableHeight = (0, _react.useMemo)(() => {
56
49
  // when data is empty, table will generate a row to show a message
@@ -100,11 +93,14 @@ const InfiniteGridTable = _ref => {
100
93
  setTableColumns(previous => {
101
94
  return previous.map((column, index) => {
102
95
  if (index === targetIndex) {
103
- return _objectSpread(_objectSpread({}, column), {}, {
104
- width: "".concat(width, "px")
105
- });
96
+ return {
97
+ ...column,
98
+ width: `${width}px`
99
+ };
106
100
  }
107
- return _objectSpread({}, column);
101
+ return {
102
+ ...column
103
+ };
108
104
  });
109
105
  });
110
106
  }, []);
@@ -153,11 +149,11 @@ const InfiniteGridTable = _ref => {
153
149
  } = column;
154
150
  let key = 'TH';
155
151
  if (title) {
156
- key += "".concat(key).concat(title);
152
+ key += `${key}${title}`;
157
153
  } else if (fieldName) {
158
- key += "".concat(key).concat(fieldName);
154
+ key += `${key}${fieldName}`;
159
155
  } else {
160
- key += "".concat(key).concat(index);
156
+ key += `${key}${index}`;
161
157
  }
162
158
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridTableHeadCell.default, {
163
159
  width: width,
@@ -193,13 +189,13 @@ const InfiniteGridTable = _ref => {
193
189
  return visibleData.map((row, rowIndex) => {
194
190
  const tds = tableColumns.map((column, columnIndex) => {
195
191
  const {
196
- title,
197
- fieldName,
198
- render,
199
- custom,
200
- width
201
- } = column,
202
- props = _objectWithoutProperties(column, _excluded);
192
+ title,
193
+ fieldName,
194
+ render,
195
+ custom,
196
+ width,
197
+ ...props
198
+ } = column;
203
199
  const key = rowIndex + columnIndex.toString();
204
200
  let renderedData = null;
205
201
  if (custom && render) {
@@ -213,13 +209,13 @@ const InfiniteGridTable = _ref => {
213
209
  children: render ? render(row[fieldName], row) : String(row[fieldName])
214
210
  });
215
211
  }
216
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(TD, _objectSpread(_objectSpread({
212
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(TD, {
217
213
  "data-label": title,
218
214
  backgroundReverse: backgroundReverse,
219
- $width: width
220
- }, props), {}, {
215
+ $width: width,
216
+ ...props,
221
217
  children: renderedData
222
- }), columnIndex);
218
+ }, columnIndex);
223
219
  });
224
220
  tds.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(TD, {
225
221
  role: "presentation",
@@ -234,7 +230,7 @@ const InfiniteGridTable = _ref => {
234
230
  position: 'absolute',
235
231
  display: 'flex',
236
232
  left: 0,
237
- top: "".concat(top, "px")
233
+ top: `${top}px`
238
234
  },
239
235
  children: tds
240
236
  }, index);
@@ -266,10 +262,11 @@ const InfiniteGridTable = _ref => {
266
262
  } = column;
267
263
  return title === previousTitle && fieldName === previousFieldName;
268
264
  });
269
- const width = (previousColumn === null || previousColumn === void 0 ? void 0 : previousColumn.width) || column.width;
270
- return _objectSpread(_objectSpread({}, column), {}, {
265
+ const width = previousColumn?.width || column.width;
266
+ return {
267
+ ...column,
271
268
  width
272
- });
269
+ };
273
270
  });
274
271
  });
275
272
  }, [columns]);
@@ -296,7 +293,7 @@ const InfiniteGridTable = _ref => {
296
293
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
297
294
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(TableWrapper, {
298
295
  style: {
299
- height: "".concat(tableHeight, "px")
296
+ height: `${tableHeight}px`
300
297
  },
301
298
  ref: wrapperRef,
302
299
  backgroundReverse: backgroundReverse,
@@ -318,40 +315,89 @@ const InfiniteGridTable = _ref => {
318
315
  })]
319
316
  });
320
317
  };
321
- const TableWrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n background: ", ";\n"])), _ref2 => {
318
+ const TableWrapper = _styledComponents.default.div`
319
+ overflow: hidden;
320
+ background: ${_ref2 => {
322
321
  let {
323
322
  backgroundReverse
324
323
  } = _ref2;
325
324
  return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
326
- });
327
- const ResponsiveTable = _styledComponents.default.table(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n /* make fixed width work */\n position: relative;\n width: 0px;\n color: var(--font-on-background);\n table-layout: fixed;\n border-collapse: collapse;\n"])));
328
- const TD = _styledComponents.default.td(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n align-content: center;\n width: ", ";\n height: 48px;\n padding: 0 var(--spacing-xs);\n border-top: 1px solid var(--border-color);\n border-right: 1px solid var(--border-color);\n border-bottom: 1px solid var(--border-color);\n text-align: ", ";\n background: ", ";\n\n &:last-child {\n border-right: none;\n padding: 0;\n }\n\n > span {\n display: inline-block;\n width: 100%;\n padding: 0 2px;\n overflow: hidden;\n white-space: pre;\n text-overflow: ellipsis;\n }\n"])), _ref3 => {
325
+ }};
326
+ `;
327
+ const ResponsiveTable = _styledComponents.default.table`
328
+ /* make fixed width work */
329
+ position: relative;
330
+ width: 0px;
331
+ color: var(--font-on-background);
332
+ table-layout: fixed;
333
+ border-collapse: collapse;
334
+ `;
335
+ const TD = _styledComponents.default.td`
336
+ align-content: center;
337
+ width: ${_ref3 => {
329
338
  let {
330
339
  $width
331
340
  } = _ref3;
332
341
  return $width;
333
- }, _ref4 => {
342
+ }};
343
+ height: 48px;
344
+ padding: 0 var(--spacing-xs);
345
+ border-top: 1px solid var(--border-color);
346
+ border-right: 1px solid var(--border-color);
347
+ border-bottom: 1px solid var(--border-color);
348
+ text-align: ${_ref4 => {
334
349
  let {
335
350
  center
336
351
  } = _ref4;
337
352
  return center ? 'center' : 'left';
338
- }, _ref5 => {
353
+ }};
354
+ background: ${_ref5 => {
339
355
  let {
340
356
  backgroundReverse
341
357
  } = _ref5;
342
358
  return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
343
- });
344
- const Scrollbar = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: sticky;\n bottom: 0;\n width: 100%;\n overflow: auto;\n background: ", ";\n\n ::before {\n display: block;\n content: '';\n width: ", ";\n height: 1px;\n }\n\n ", "\n"])), _ref6 => {
359
+ }};
360
+
361
+ &:last-child {
362
+ border-right: none;
363
+ padding: 0;
364
+ }
365
+
366
+ > span {
367
+ display: inline-block;
368
+ width: 100%;
369
+ padding: 0 2px;
370
+ overflow: hidden;
371
+ white-space: pre;
372
+ text-overflow: ellipsis;
373
+ }
374
+ `;
375
+ const Scrollbar = _styledComponents.default.div`
376
+ position: sticky;
377
+ bottom: 0;
378
+ width: 100%;
379
+ overflow: auto;
380
+ background: ${_ref6 => {
345
381
  let {
346
382
  backgroundReverse
347
383
  } = _ref6;
348
384
  return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
349
- }, _ref7 => {
385
+ }};
386
+
387
+ ::before {
388
+ display: block;
389
+ content: '';
390
+ width: ${_ref7 => {
350
391
  let {
351
392
  width
352
393
  } = _ref7;
353
- return "".concat(width, "px");
354
- }, (0, _scrollbar.default)({
394
+ return `${width}px`;
395
+ }};
396
+ height: 1px;
397
+ }
398
+
399
+ ${(0, _scrollbar.default)({
355
400
  size: 'large'
356
- }));
401
+ })}
402
+ `;
357
403
  var _default = exports.default = InfiniteGridTable;
@@ -5,37 +5,59 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
- var _templateObject, _templateObject2, _templateObject3;
9
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
11
- const PermissionTable = _styledComponents.default.table(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n vertical-align: middle;\n table-layout: fixed;\n border: 0;\n color: var(--font-on-background);\n"])));
12
- const TH = _styledComponents.default.th(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: var(--spacing) 0;\n border-bottom: 1px solid var(--border-color);\n font-weight: var(--font-bold);\n\n ", "\n ", "\n"])), _ref => {
9
+ const PermissionTable = _styledComponents.default.table`
10
+ width: 100%;
11
+ vertical-align: middle;
12
+ table-layout: fixed;
13
+ border: 0;
14
+ color: var(--font-on-background);
15
+ `;
16
+ const TH = _styledComponents.default.th`
17
+ padding: var(--spacing) 0;
18
+ border-bottom: 1px solid var(--border-color);
19
+ font-weight: var(--font-bold);
20
+
21
+ ${_ref => {
13
22
  let {
14
23
  clickable
15
24
  } = _ref;
16
25
  return clickable && 'cursor: pointer;';
17
- }, _ref2 => {
26
+ }}
27
+ ${_ref2 => {
18
28
  let {
19
29
  alignCenter
20
30
  } = _ref2;
21
31
  return alignCenter && 'text-align: center;';
22
- });
23
- const TD = _styledComponents.default.td(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: var(--spacing) 0;\n border-bottom: 1px solid var(--border-color);\n\n &:nth-child(even) {\n background: var(--color-background1);\n }\n\n ", "\n ", "\n ", "\n"])), _ref3 => {
32
+ }}
33
+ `;
34
+ const TD = _styledComponents.default.td`
35
+ padding: var(--spacing) 0;
36
+ border-bottom: 1px solid var(--border-color);
37
+
38
+ &:nth-child(even) {
39
+ background: var(--color-background1);
40
+ }
41
+
42
+ ${_ref3 => {
24
43
  let {
25
44
  clickable
26
45
  } = _ref3;
27
46
  return clickable && 'cursor: pointer;';
28
- }, _ref4 => {
47
+ }}
48
+ ${_ref4 => {
29
49
  let {
30
50
  alignCenter
31
51
  } = _ref4;
32
52
  return alignCenter && 'text-align: center;';
33
- }, _ref5 => {
53
+ }}
54
+ ${_ref5 => {
34
55
  let {
35
56
  bold
36
57
  } = _ref5;
37
58
  return bold && 'font-weight: var(--font-bold);';
38
- });
59
+ }}
60
+ `;
39
61
  var _default = exports.default = Object.assign(PermissionTable, {
40
62
  TH,
41
63
  TD
@@ -0,0 +1,143 @@
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 _styledComponents = _interopRequireDefault(require("styled-components"));
9
+ var _GridTableHeadCell = _interopRequireDefault(require("./subComponent/GridTableHeadCell"));
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ const SimpleGridTable = _ref => {
13
+ let {
14
+ columns,
15
+ data,
16
+ backgroundReverse,
17
+ translation
18
+ } = _ref;
19
+ const texts = (0, _react.useMemo)(() => {
20
+ const defaultTexts = {
21
+ empty: 'No data available in table'
22
+ };
23
+ return {
24
+ ...defaultTexts,
25
+ ...translation
26
+ };
27
+ }, [translation]);
28
+ const tableHeads = (0, _react.useMemo)(() => {
29
+ const tableHeads = columns.map((column, index) => {
30
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(TH, {
31
+ backgroundReverse: !backgroundReverse,
32
+ children: column.title
33
+ }, `TH${index}`);
34
+ });
35
+ return tableHeads;
36
+ }, [backgroundReverse, columns]);
37
+ const tableRows = (0, _react.useMemo)(() => {
38
+ if (data.length === 0) {
39
+ return null;
40
+ }
41
+ return data.map((row, rowIndex) => {
42
+ const tds = columns.map((column, columnIndex) => {
43
+ const {
44
+ title,
45
+ fieldName,
46
+ render
47
+ } = column;
48
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(TD, {
49
+ "data-label": title,
50
+ backgroundReverse: backgroundReverse,
51
+ children: render ? render(row[fieldName], row) : String(row[fieldName])
52
+ }, columnIndex);
53
+ });
54
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(TR, {
55
+ children: tds
56
+ }, rowIndex);
57
+ });
58
+ }, [backgroundReverse, columns, data]);
59
+ const generateEmptyMessage = (0, _react.useCallback)(() => {
60
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(TR, {
61
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TD, {
62
+ center: true,
63
+ colSpan: columns.length,
64
+ backgroundReverse: backgroundReverse,
65
+ children: texts.empty
66
+ })
67
+ });
68
+ }, [backgroundReverse, columns, texts]);
69
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
70
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TableWrapper, {
71
+ backgroundReverse: backgroundReverse,
72
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(ResponsiveTable, {
73
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
74
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("tr", {
75
+ children: tableHeads
76
+ })
77
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
78
+ children: tableRows || generateEmptyMessage()
79
+ })]
80
+ })
81
+ })
82
+ });
83
+ };
84
+ const TableWrapper = _styledComponents.default.div`
85
+ background: ${_ref2 => {
86
+ let {
87
+ backgroundReverse
88
+ } = _ref2;
89
+ return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
90
+ }};
91
+ `;
92
+ const ResponsiveTable = _styledComponents.default.table`
93
+ width: 100%;
94
+ color: var(--font-on-background);
95
+ table-layout: fixed;
96
+ border-collapse: separate;
97
+ border-spacing: 0;
98
+ border: 1px solid var(--border-color);
99
+ border-radius: 8px;
100
+ overflow: hidden;
101
+ `;
102
+ const TH = (0, _styledComponents.default)(_GridTableHeadCell.default)`
103
+ text-align: left;
104
+ border-top: none;
105
+ border-right: 1px solid var(--border-color);
106
+
107
+ &:last-child {
108
+ border-right: none;
109
+ }
110
+ `;
111
+ const TD = _styledComponents.default.td`
112
+ height: 48px;
113
+ padding: 0 var(--spacing-xs);
114
+ border-bottom: 1px solid var(--border-color);
115
+ border-right: 1px solid var(--border-color);
116
+ text-align: ${_ref3 => {
117
+ let {
118
+ center
119
+ } = _ref3;
120
+ return center ? 'center' : 'left';
121
+ }};
122
+ background: ${_ref4 => {
123
+ let {
124
+ backgroundReverse
125
+ } = _ref4;
126
+ return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
127
+ }};
128
+ overflow: hidden;
129
+ text-overflow: ellipsis;
130
+ white-space: nowrap;
131
+
132
+ &:last-child {
133
+ border-right: none;
134
+ }
135
+ `;
136
+ const TR = _styledComponents.default.tr`
137
+ &:last-child {
138
+ ${TD} {
139
+ border-bottom: none;
140
+ }
141
+ }
142
+ `;
143
+ var _default = exports.default = SimpleGridTable;