diginet-core-ui 1.4.14-beta.2 → 1.4.14-beta.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 (128) hide show
  1. package/components/accordion/details.js +36 -25
  2. package/components/accordion/group.js +33 -18
  3. package/components/accordion/index.js +42 -28
  4. package/components/accordion/summary.js +60 -52
  5. package/components/alert/index.js +84 -75
  6. package/components/alert/notify.js +53 -41
  7. package/components/avatar/index.js +97 -94
  8. package/components/badge/index.js +80 -78
  9. package/components/breadcrumb/index.js +62 -44
  10. package/components/button/icon.js +90 -70
  11. package/components/button/index.js +110 -88
  12. package/components/button/more.js +60 -39
  13. package/components/button/ripple-effect.js +1 -1
  14. package/components/card/body.js +38 -28
  15. package/components/card/extra.js +38 -28
  16. package/components/card/footer.js +38 -28
  17. package/components/card/header.js +39 -28
  18. package/components/card/index.js +79 -70
  19. package/components/chart/bar/Labels.js +14 -8
  20. package/components/chart/bar-v2/Labels.js +14 -8
  21. package/components/chart/line/Labels.js +14 -8
  22. package/components/chart/line/Path.js +3 -3
  23. package/components/chart/line/Point.js +12 -11
  24. package/components/chart/line-v2/Labels.js +14 -8
  25. package/components/check-text/index.js +21 -16
  26. package/components/check-text/interview-confirmation.js +21 -15
  27. package/components/check-text/interview-status.js +21 -15
  28. package/components/chip/attach.js +11 -7
  29. package/components/chip/index.js +83 -82
  30. package/components/collapse/index.js +1 -1
  31. package/components/dialogs/colors.js +13 -11
  32. package/components/divider/index.js +40 -22
  33. package/components/form-control/attachment/index.js +94 -57
  34. package/components/form-control/calendar/function.js +173 -169
  35. package/components/form-control/calendar/index.js +48 -36
  36. package/components/form-control/calendar/range.js +38 -22
  37. package/components/form-control/checkbox/index.js +87 -63
  38. package/components/form-control/control/index.js +9 -10
  39. package/components/form-control/date-picker/index.js +81 -64
  40. package/components/form-control/date-range-picker/index.js +98 -81
  41. package/components/form-control/dropdown/index.js +240 -215
  42. package/components/form-control/dropdown-box/index.js +56 -43
  43. package/components/form-control/form-group/index.js +7 -6
  44. package/components/form-control/helper-text/index.js +45 -41
  45. package/components/form-control/input-base/index.js +165 -133
  46. package/components/form-control/label/index.js +48 -41
  47. package/components/form-control/money-input/index.js +87 -79
  48. package/components/form-control/number-input/index.js +579 -521
  49. package/components/form-control/number-input/index2.js +107 -87
  50. package/components/form-control/password-input/index.js +71 -63
  51. package/components/form-control/radio/index.js +90 -74
  52. package/components/form-control/text-input/index.js +83 -74
  53. package/components/form-control/time-picker/index.js +79 -56
  54. package/components/form-control/time-picker/v2/index.js +90 -84
  55. package/components/form-control/toggle/index.js +144 -133
  56. package/components/form-view/helper-text.js +2 -2
  57. package/components/form-view/index.js +34 -31
  58. package/components/form-view/input.js +70 -69
  59. package/components/form-view/label.js +14 -9
  60. package/components/grid/Col.js +48 -39
  61. package/components/grid/Container.js +31 -38
  62. package/components/grid/Row.js +28 -32
  63. package/components/grid/index.js +66 -54
  64. package/components/image/index.js +37 -27
  65. package/components/list/list-item-action.js +36 -26
  66. package/components/list/list-item-icon.js +34 -29
  67. package/components/list/list-item-text.js +27 -22
  68. package/components/list/list-item.js +42 -36
  69. package/components/list/list.js +46 -38
  70. package/components/list/sub-header.js +33 -26
  71. package/components/modal/body.js +24 -14
  72. package/components/modal/footer.js +23 -13
  73. package/components/modal/header.js +39 -28
  74. package/components/modal/index.js +3 -3
  75. package/components/modal/modal.js +60 -49
  76. package/components/others/extra/index.js +31 -30
  77. package/components/others/import/index.js +2 -2
  78. package/components/others/scrollbar/index.js +32 -26
  79. package/components/paging/page-info.js +67 -68
  80. package/components/paging/page-selector.js +49 -49
  81. package/components/paper/index.js +32 -28
  82. package/components/popover/body.js +14 -8
  83. package/components/popover/footer.js +13 -8
  84. package/components/popover/header.js +17 -15
  85. package/components/popover/index.js +103 -92
  86. package/components/popup/danger_popup.js +17 -16
  87. package/components/popup/index.js +16 -17
  88. package/components/popup/v2/index.js +41 -54
  89. package/components/progress/circular.js +65 -80
  90. package/components/progress/linear.js +73 -58
  91. package/components/rating/index.js +49 -63
  92. package/components/slider/slider-container.js +49 -57
  93. package/components/slider/slider-item.js +30 -29
  94. package/components/status/index.js +23 -34
  95. package/components/tab/tab-header.js +20 -11
  96. package/components/tab/tab-panel.js +12 -7
  97. package/components/tab/tab.js +35 -22
  98. package/components/tooltip/index.js +24 -35
  99. package/components/transfer/index.js +105 -106
  100. package/components/tree-view/index.js +133 -115
  101. package/components/typography/index.js +72 -55
  102. package/global/index.js +2 -17
  103. package/icons/basic.js +975 -972
  104. package/icons/effect.js +21 -20
  105. package/package.json +3 -1
  106. package/styles/color-helper.js +105 -105
  107. package/styles/colors.js +168 -30
  108. package/styles/general.js +84 -16
  109. package/styles/sx/index.js +7 -4
  110. package/styles/utils.js +20 -19
  111. package/theme/createSpacing.js +10 -0
  112. package/theme/createTheme.js +26 -0
  113. package/theme/createZIndex.js +9 -0
  114. package/theme/index.js +13 -2
  115. package/theme/make-styles.js +2 -1
  116. package/theme/settings.js +699 -8
  117. package/theme/theme-provider.js +32 -15
  118. package/theme/theme.js +57 -56
  119. package/theme/use-classes.js +15 -0
  120. package/theme/utils/getThemeProps.js +12 -0
  121. package/theme/utils/resolveProps.js +17 -0
  122. package/theme/utils/useThemeProps.js +14 -0
  123. package/utils/handleBreakpoints.js +2 -2
  124. package/utils/hexToRGBA/index.js +7 -7
  125. package/utils/object/deepmerge.js +104 -0
  126. package/utils/object/object.js +7 -12
  127. package/utils/render-portal.js +4 -3
  128. package/theme/set-theme.js +0 -38
@@ -5,12 +5,13 @@ import { CircularProgress, Icon, Typography } from "./..";
5
5
  import OptionWrapper from "../others/option-wrapper";
6
6
  import PropTypes from 'prop-types';
7
7
  import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
8
- import { detectColor, fade, hexToRGBA, hslToRgb, isColor, isColorName, rgbaToHexA, rgbToHex } from "../../styles/color-helper";
8
+ import { detectColor, fade, hexToRGBA, hslToRgb, isColor, isColorName, rgbToHex, rgbaToHexA } from "../../styles/color-helper";
9
9
  import * as allColors from "../../styles/colors";
10
- import { alphaPseudo, bgColor, border, borderColor, borderNone, borderRadius4px, boxBorder, cursorNotAllowed, cursorPointer, displayFlex, displayInlineFlex, flexRow, itemsCenter, justifyCenter, mg, mgl, mgr, outlineNone, overflowHidden, parseHeight, parseMinWidth, parseMinWidthHeight, parseWidthHeight, pd, pointerEventsNone, positionRelative, textColor, userSelectNone, whiteSpaceNoWrap } from "../../styles/general";
11
- import { useColor as colors, useTheme } from "../../theme";
12
- import { classNames } from "../../utils";
10
+ import { alphaPseudo, bgColor, border, borderColor, borderNone, borderRadius4px, boxBorder, cursorNotAllowed, cursorPointer, displayFlex, displayInlineFlex, flexRow, itemsCenter, justifyCenter, outlineNone, overflowHidden, parseHeight, parseMinWidth, parseMinWidthHeight, parseWidthHeight, pointerEventsNone, positionRelative, textColor, userSelectNone, whiteSpaceNoWrap } from "../../styles/general";
11
+ import { useTheme } from "../../theme";
12
+ import { classNames, getProp } from "../../utils";
13
13
  import Ripple from "./ripple-effect";
14
+ import useThemeProps from "../../theme/utils/useThemeProps";
14
15
  const {
15
16
  spacing
16
17
  } = useTheme();
@@ -55,30 +56,41 @@ const typographySizeMap = new Map([['tiny', 'h5'], ['small', 'h5'], ['medium', '
55
56
  const minHeightSizeMap = new Map([['tiny', '24px'], ['small', '32px'], ['medium', '40px'], ['large', '48px'], ['giant', '56px']]);
56
57
  const minHeightSizeLinkMap = new Map([['tiny', '16px'], ['small', '20px'], ['medium', '24px'], ['large', '32px'], ['giant', '40px']]);
57
58
  const alphaLoading = 0.2;
58
- const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
59
- action = {},
60
- children,
61
- className,
62
- color: colorProp,
63
- disabled,
64
- endIcon,
65
- href,
66
- id,
67
- label,
68
- labelProps,
69
- loading,
70
- onClick,
71
- size,
72
- startIcon,
73
- stopPropagation,
74
- text,
75
- type,
76
- urlParams,
77
- viewType,
78
- ...props
79
- }, reference) => {
59
+ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
80
60
  if (!reference) reference = useRef(null);
81
- label = label || text || '';
61
+ const theme = useTheme();
62
+ const {
63
+ colors
64
+ } = theme;
65
+
66
+ // props priority: `inProps` > `themeDefaultProps`
67
+ const props = useThemeProps({
68
+ props: inProps,
69
+ name: 'Button'
70
+ });
71
+ const {
72
+ action = {},
73
+ children,
74
+ className,
75
+ color: colorProp,
76
+ disabled,
77
+ endIcon,
78
+ href,
79
+ id,
80
+ label: labelProp,
81
+ labelProps,
82
+ loading,
83
+ onClick,
84
+ size,
85
+ startIcon,
86
+ stopPropagation,
87
+ text,
88
+ type,
89
+ urlParams,
90
+ viewType,
91
+ ...other
92
+ } = props;
93
+ const label = labelProp || text || '';
82
94
  const ref = useRef(null);
83
95
  const rippleRef = useRef(null);
84
96
  const [urlState, setUrlState] = useState(href);
@@ -89,13 +101,13 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
89
101
  const typographySize = typographySizeMap.get(size);
90
102
  const iconMarginSize = iconMarginSizeMap.get(size);
91
103
  const minHeightSize = isViewTypeLink ? minHeightSizeLinkMap.get(size) : minHeightSizeMap.get(size);
92
- const color = colors[colorProp] || colorProp;
104
+ const color = getProp(colors, colorProp, colorProp);
93
105
  const TagName = href ? 'a' : 'button';
94
- const _ButtonRootCSS = ButtonRootCSS(color, isColorDefault, viewType, loading);
95
- const _ButtonIconCSS = ButtonIconCSS(endIcon, label, startIcon, iconMarginSize, iconSize);
96
- const _NonStartIconCSS = NonStartIconCSS(iconSize);
106
+ const _ButtonRootCSS = ButtonRootCSS(color, isColorDefault, viewType, loading, theme);
107
+ const _ButtonIconCSS = ButtonIconCSS(endIcon, label, startIcon, iconMarginSize, iconSize, theme);
108
+ const _NonStartIconCSS = NonStartIconCSS(iconSize, theme);
97
109
  const _ButtonLabelCSS = ButtonLabelCSS(loading, iconMarginSize);
98
- const _ButtonSizeCSS = ButtonSizeCSS(paddingSize, minHeightSize);
110
+ const _ButtonSizeCSS = ButtonSizeCSS(paddingSize, minHeightSize, theme);
99
111
  const _onClick = e => {
100
112
  if (href) e.preventDefault(); //Prevent open link when click
101
113
  onClick && stopPropagation && e.stopPropagation();
@@ -195,7 +207,7 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
195
207
  type: type,
196
208
  className: classNames('DGN-UI-Button', disabled && 'disabled', viewType, size, className),
197
209
  href: urlState || null,
198
- ...props
210
+ ...other
199
211
  }, start, jsx(Typography, {
200
212
  css: _ButtonLabelCSS,
201
213
  type: typographySize,
@@ -206,25 +218,29 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
206
218
  ref: rippleRef,
207
219
  color: getRippleColor(colorProp, viewType, allColors)
208
220
  }) : null);
209
- }, [children, className, colorProp, disabled, endIcon, href, id, label, labelProps, loading, onClick, size, startIcon, stopPropagation, type, urlParams, viewType, urlState]);
221
+ }, [children, className, colorProp, disabled, endIcon, href, id, labelProp, labelProps, loading, onClick, size, startIcon, stopPropagation, type, urlParams, viewType, urlState, theme]);
210
222
  }));
211
- const NonStartIconCSS = iconSize => css`
212
- ${mg(0)};
223
+ const NonStartIconCSS = (iconSize, {
224
+ spacing
225
+ }) => css`
226
+ margin: ${spacing([0])};
213
227
  ${parseHeight(iconSize)};
214
228
  ${parseMinWidth(0)};
215
229
  `;
216
- const ButtonIconCSS = (endIcon, label, startIcon, iconMarginSize, iconSize) => css`
230
+ const ButtonIconCSS = (endIcon, label, startIcon, iconMarginSize, iconSize, {
231
+ spacing
232
+ }) => css`
217
233
  ${displayFlex};
218
234
  ${flexRow};
219
235
  ${itemsCenter};
220
236
  ${justifyCenter};
221
237
  ${positionRelative};
222
238
  ${boxBorder};
223
- ${mgr(endIcon || label ? iconMarginSize : 0)};
239
+ margin-right: ${spacing(endIcon || label ? iconMarginSize : 0)};
224
240
  &.DGN-UI-Button-End-Icon,
225
241
  &.DGN-UI-Button-Custom-End-Icon {
226
- ${mgr('unset')};
227
- ${mgl(startIcon || label ? iconMarginSize : 0)};
242
+ margin-right: unset;
243
+ margin-left: ${spacing(startIcon || label ? iconMarginSize : 0)};
228
244
  }
229
245
  &.DGN-UI-Button-Start-Icon,
230
246
  &.DGN-UI-Button-End-Icon {
@@ -234,13 +250,17 @@ const ButtonIconCSS = (endIcon, label, startIcon, iconMarginSize, iconSize) => c
234
250
  const ButtonLabelCSS = (loading, iconMarginSize) => css`
235
251
  ${whiteSpaceNoWrap};
236
252
  ${textColor('inherit')};
237
- ${mgl(loading ? iconMarginSize : 0)};
253
+ margin-left: ${spacing(loading ? iconMarginSize : 0)};
238
254
  `;
239
- const ButtonSizeCSS = (paddingSize, minHeightSize) => css`
240
- ${pd(paddingSize)};
255
+ const ButtonSizeCSS = (paddingSize, minHeightSize, {
256
+ spacing
257
+ }) => css`
258
+ padding: ${spacing(paddingSize)};
241
259
  ${parseMinWidthHeight('max-content', minHeightSize)};
242
260
  `;
243
- const ButtonRootCSS = (color, isColorDefault, viewType, loading) => css`
261
+ const ButtonRootCSS = (color, isColorDefault, viewType, loading, {
262
+ colors
263
+ }) => css`
244
264
  ${displayInlineFlex};
245
265
  ${itemsCenter};
246
266
  ${justifyCenter};
@@ -266,29 +286,29 @@ const ButtonRootCSS = (color, isColorDefault, viewType, loading) => css`
266
286
  }
267
287
  `)}
268
288
  ${isColorDefault && css`
269
- ${border(1, 'system/rest')};
270
- ${textColor('system/rest')};
289
+ ${border(1, getProp(colors, 'system.rest'))};
290
+ ${textColor(getProp(colors, 'system.rest'))};
271
291
  ${loading && css`
272
- ${textColor('system/active')};
273
- ${borderColor('system/active')};
274
- ${bgColor(hexToRGBA('system/active', alphaLoading))};
292
+ ${textColor(getProp(colors, 'system.active'))};
293
+ ${borderColor(getProp(colors, 'system.active'))};
294
+ ${bgColor(hexToRGBA(getProp(colors, 'system.active'), alphaLoading))};
275
295
  `}
276
296
  ${Object.keys(alphaPseudo).map(key => css`
277
297
  &: ${key} {
278
- ${textColor('system/active')};
279
- ${borderColor('system/active')};
280
- ${bgColor(hexToRGBA('system/active', alphaPseudo[key]))};
298
+ ${textColor(getProp(colors, 'system.active'))};
299
+ ${borderColor(getProp(colors, 'system.active'))};
300
+ ${bgColor(hexToRGBA(getProp(colors, 'system.active'), alphaPseudo[key]))};
281
301
  }
282
302
  `)} // &:hover | &:focus | &:active
283
303
  `}
284
304
  &.disabled {
285
- ${borderColor('system/disabled')};
305
+ ${borderColor(getProp(colors, 'system.disabled'))};
286
306
  ${bgColor('transparent')};
287
307
  }
288
308
  `}
289
309
  ${viewType === 'filled' && css`
290
310
  ${borderNone};
291
- ${textColor('system/white')};
311
+ ${textColor(getProp(colors, 'system.standard'))};
292
312
  ${bgColor(color)};
293
313
  font-weight: bold;
294
314
  ${loading && css`
@@ -302,16 +322,16 @@ const ButtonRootCSS = (color, isColorDefault, viewType, loading) => css`
302
322
  filter: brightness(0.7);
303
323
  }
304
324
  ${isColorDefault && css`
305
- ${bgColor('system/rest')};
306
- ${loading && bgColor('system/active')};
325
+ ${bgColor(getProp(colors, 'system.rest'))};
326
+ ${loading && bgColor(getProp(colors, 'system.active'))};
307
327
  &:hover,
308
328
  &:focus,
309
329
  &:active {
310
- ${bgColor('system/active')};
330
+ ${bgColor(getProp(colors, 'system.active'))};
311
331
  }
312
332
  `}
313
333
  &.disabled {
314
- ${bgColor('fill/disabled')};
334
+ ${bgColor(getProp(colors, 'fill.disabled'))};
315
335
  }
316
336
  `}
317
337
  ${viewType === 'text' && css`
@@ -325,15 +345,15 @@ const ButtonRootCSS = (color, isColorDefault, viewType, loading) => css`
325
345
  }
326
346
  `)}
327
347
  ${isColorDefault && css`
328
- ${textColor('system/rest')};
348
+ ${textColor(getProp(colors, 'system.rest'))};
329
349
  ${loading && css`
330
- ${textColor('system/active')};
331
- ${bgColor(hexToRGBA('system/active', alphaLoading))};
350
+ ${textColor(getProp(colors, 'system.active'))};
351
+ ${bgColor(hexToRGBA(getProp(colors, 'system.active'), alphaLoading))};
332
352
  `}
333
353
  ${Object.keys(alphaPseudo).map(key => css`
334
354
  &: ${key} {
335
- ${textColor('system/active')};
336
- ${bgColor(hexToRGBA('system/active', alphaPseudo[key]))};
355
+ ${textColor(getProp(colors, 'system.active'))};
356
+ ${bgColor(hexToRGBA(getProp(colors, 'system.active'), alphaPseudo[key]))};
337
357
  }
338
358
  `)}
339
359
  `}
@@ -343,7 +363,7 @@ const ButtonRootCSS = (color, isColorDefault, viewType, loading) => css`
343
363
  `}
344
364
  ${viewType === 'link' && css`
345
365
  ${borderNone};
346
- ${textColor(isColorDefault ? 'semantic/info' : color)};
366
+ ${textColor(isColorDefault ? getProp(colors, 'semantic.info') : color)};
347
367
  ${bgColor('transparent')};
348
368
  ${loading && css`
349
369
  filter: brightness(0.85);
@@ -358,20 +378,22 @@ const ButtonRootCSS = (color, isColorDefault, viewType, loading) => css`
358
378
  `}
359
379
  &.disabled {
360
380
  ${cursorNotAllowed};
361
- ${textColor('system/disabled')};
381
+ ${textColor(getProp(colors, 'system.disabled'))};
362
382
  filter: brightness(1);
363
383
  }
364
384
  `;
365
- Button.defaultProps = {
366
- className: '',
367
- color: 'default',
368
- disabled: false,
369
- label: '',
370
- loading: false,
371
- size: 'medium',
372
- stopPropagation: true,
373
- viewType: 'text'
374
- };
385
+
386
+ // Button.defaultProps = {
387
+ // className: '',
388
+ // color: 'default',
389
+ // disabled: false,
390
+ // label: '',
391
+ // loading: false,
392
+ // size: 'medium',
393
+ // stopPropagation: true,
394
+ // viewType: 'text',
395
+ // };
396
+
375
397
  Button.propTypes = {
376
398
  /** The content of the component. */
377
399
  children: PropTypes.node,
@@ -401,19 +423,19 @@ Button.propTypes = {
401
423
  urlParams: PropTypes.object,
402
424
  /** The variant to use. */
403
425
  viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'link'])
404
- /**
405
- * ref methods (ref.current.instance.*method*)
406
- *
407
- * * option(): Gets all UI component properties
408
- * * Returns value - object
409
- * * option(optionName): Gets the value of a single property
410
- * * @param {optionName} - string
411
- * * Returns value - any
412
- * * option(optionName, optionValue): Updates the value of a single property
413
- * * @param {optionName} - string
414
- * * @param {optionValue} - any
415
- * * option(options): Updates the values of several properties
416
- * * @param {options} - object
426
+ /**
427
+ * ref methods (ref.current.instance.*method*)
428
+ *
429
+ * * option(): Gets all UI component properties
430
+ * * Returns value - object
431
+ * * option(optionName): Gets the value of a single property
432
+ * * @param {optionName} - string
433
+ * * Returns value - any
434
+ * * option(optionName, optionValue): Updates the value of a single property
435
+ * * @param {optionName} - string
436
+ * * @param {optionValue} - any
437
+ * * option(options): Updates the values of several properties
438
+ * * @param {options} - object
417
439
  */
418
440
  };
419
441
 
@@ -5,27 +5,39 @@ import { ButtonIcon, Icon, Popover, Tooltip, Typography } from "./..";
5
5
  import OptionWrapper from "../others/option-wrapper";
6
6
  import PropTypes from 'prop-types';
7
7
  import React, { forwardRef, isValidElement, memo, useImperativeHandle, useMemo, useRef, useState } from 'react';
8
- import { bgColor, borderNone, cursorPointer, displayFlex, flexCol, flexRow, gap, itemsCenter, outlineNone, parseHeight, pd, pdl } from "../../styles/general";
9
- import { classNames } from "../../utils";
10
- const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
11
- action = {},
12
- anchor,
13
- buttonProps,
14
- className,
15
- disabled,
16
- id,
17
- labelProp,
18
- options,
19
- optionType,
20
- popoverProp,
21
- style
22
- }, reference) => {
8
+ import { bgColor, borderNone, cursorPointer, displayFlex, flexCol, flexRow, itemsCenter, outlineNone, parseHeight } from "../../styles/general";
9
+ import { useTheme } from "../../theme";
10
+ import useThemeProps from "../../theme/utils/useThemeProps";
11
+ import { classNames, getProp } from "../../utils";
12
+ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
23
13
  if (!reference) reference = useRef(null);
14
+ const theme = useTheme();
15
+
16
+ // props priority: `inProps` > `themeDefaultProps`
17
+ const props = useThemeProps({
18
+ props: inProps,
19
+ name: 'ButtonMore'
20
+ });
21
+ const {
22
+ action = {},
23
+ anchor: anchorProp,
24
+ buttonProps,
25
+ className,
26
+ disabled,
27
+ id,
28
+ labelProp,
29
+ options,
30
+ optionType,
31
+ popoverProp,
32
+ style
33
+ } = props;
24
34
  const isOptionFull = optionType === 'full';
35
+ let anchor = anchorProp;
25
36
  const ref = useRef(null);
26
37
  const [openState, setOpenState] = useState(false);
27
38
  const [iconState, setIconState] = useState(false);
28
- const _PopoverCSS = PopoverCSS(isOptionFull);
39
+ const _OptionFullCSS = OptionFullCSS(theme);
40
+ const _PopoverCSS = PopoverCSS(isOptionFull, theme);
29
41
  const openPopover = () => {
30
42
  setOpenState(true);
31
43
  };
@@ -44,7 +56,7 @@ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
44
56
  });
45
57
  const renderOptions = () => {
46
58
  return options.map((item, idx) => {
47
- if (item !== null && item !== void 0 && item.hidden) return;else if ( /*#__PURE__*/isValidElement(item)) return item;else {
59
+ if (item !== null && item !== void 0 && item.hidden) return null;else if ( /*#__PURE__*/isValidElement(item)) return item;else {
48
60
  const icon = item === null || item === void 0 ? void 0 : item.icon;
49
61
  const label = item === null || item === void 0 ? void 0 : item.label;
50
62
  const action = () => {
@@ -54,7 +66,7 @@ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
54
66
  if (icon && !iconState) setIconState(true);
55
67
  return isOptionFull ? jsx("button", {
56
68
  key: idx,
57
- css: OptionFullCSS,
69
+ css: _OptionFullCSS,
58
70
  className: 'DGN-UI-ButtonMore-Option',
59
71
  onClick: action
60
72
  }, icon ? jsx(Icon, {
@@ -62,9 +74,9 @@ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
62
74
  name: icon,
63
75
  width: 20,
64
76
  height: 20,
65
- color: 'system/dark'
77
+ color: 'system/on-standard'
66
78
  }) : null, jsx(Typography, {
67
- css: !icon && iconState && ExtraPaddingCSS,
79
+ css: !icon && iconState && ExtraPaddingCSS(theme),
68
80
  className: 'DGN-UI-ButtonMore-Label',
69
81
  ...labelProp
70
82
  }, label)) : jsx(Tooltip, {
@@ -124,14 +136,19 @@ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
124
136
  }),
125
137
  ...popoverProp
126
138
  }, renderOptions());
127
- }, [buttonProps, className, disabled, id, options, optionType, popoverProp, style, iconState, openState]);
139
+ }, [buttonProps, className, disabled, id, options, optionType, popoverProp, style, iconState, openState, theme]);
128
140
  }));
129
- const PopoverCSS = isOptionFull => css`
141
+ const PopoverCSS = (isOptionFull, {
142
+ spacing
143
+ }) => css`
130
144
  ${displayFlex};
131
145
  ${isOptionFull ? flexCol : flexRow};
132
- ${pd(isOptionFull ? [1, 0] : [0, 2])}
146
+ padding: ${spacing(isOptionFull ? [1, 0] : [0, 2])};
133
147
  `;
134
- const OptionFullCSS = css`
148
+ const OptionFullCSS = ({
149
+ colors,
150
+ spacing
151
+ }) => css`
135
152
  ${displayFlex};
136
153
  ${flexRow};
137
154
  ${itemsCenter};
@@ -139,29 +156,33 @@ const OptionFullCSS = css`
139
156
  ${outlineNone};
140
157
  ${borderNone}
141
158
  ${parseHeight(28)};
142
- ${pd([0, 4])};
143
- ${gap([0, 1])};
144
- ${bgColor('system/white')};
159
+ padding: ${spacing([0, 4])};
160
+ gap: ${spacing([0, 1])};
161
+ ${bgColor(getProp(colors, 'system/standard'))};
145
162
  transition: all 0.5s ease;
146
163
  &:hover,
147
164
  &:focus {
148
- ${bgColor('fill/hover')};
165
+ ${bgColor(getProp(colors, 'fill/hover'))};
149
166
  }
150
167
  &:active {
151
- ${bgColor('fill/pressed')};
168
+ ${bgColor(getProp(colors, 'fill/pressed'))};
152
169
  }
153
170
  `;
154
- const ExtraPaddingCSS = css`
155
- ${pdl([6])};
171
+ const ExtraPaddingCSS = ({
172
+ spacing
173
+ }) => css`
174
+ padding-left: ${spacing([6])};
156
175
  `;
157
- ButtonMore.defaultProps = {
158
- buttonProps: {},
159
- className: '',
160
- disabled: false,
161
- options: [],
162
- optionType: 'full',
163
- style: {}
164
- };
176
+
177
+ // ButtonMore.defaultProps = {
178
+ // buttonProps: {},
179
+ // className: '',
180
+ // disabled: false,
181
+ // options: [],
182
+ // optionType: 'full',
183
+ // style: {},
184
+ // };
185
+
165
186
  ButtonMore.propTypes = {
166
187
  /** [Props](https://core.diginet.com.vn/ui/?path=/docs/components-buttonicon) applied to the main `ButtonIcon`. */
167
188
  buttonProps: PropTypes.object,
@@ -15,7 +15,7 @@ const useDebouncedRippleCleanUp = (rippleCount, duration, cleanUpFunction) => {
15
15
  };
16
16
  const Ripple = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
17
17
  duration = 850,
18
- color = 'system.white',
18
+ color = 'system/standard',
19
19
  circular = false,
20
20
  ...props
21
21
  }, ref) => {
@@ -1,18 +1,26 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
- import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
4
- import PropTypes from 'prop-types';
5
3
  import { jsx } from '@emotion/core';
6
4
  import OptionWrapper from "../others/option-wrapper";
5
+ import PropTypes from 'prop-types';
6
+ import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
7
+ import useThemeProps from "../../theme/utils/useThemeProps";
7
8
  import { classNames, refType as ref } from "../../utils";
8
- const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
9
- action = {},
10
- children,
11
- className,
12
- id,
13
- style,
14
- title
15
- }, reference) => {
9
+ const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
10
+ if (!reference) reference = useRef(null);
11
+
12
+ // props priority: `inProps` > `themeDefaultProps`
13
+ const props = useThemeProps({
14
+ props: inProps,
15
+ name: 'CardBody'
16
+ });
17
+ const {
18
+ action = {},
19
+ children,
20
+ className,
21
+ id,
22
+ style
23
+ } = props;
16
24
  const ref = useRef(null);
17
25
  useImperativeHandle(reference, () => {
18
26
  const currentRef = ref.current || {};
@@ -31,12 +39,14 @@ const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
31
39
  style: style,
32
40
  className: classNames(`DGN-UI-Card-Body`, className)
33
41
  }, children);
34
- }, [children, className, id, style, title]);
42
+ }, [children, className, id, style]);
35
43
  }));
36
- CardBody.defaultProps = {
37
- className: '',
38
- style: {}
39
- };
44
+
45
+ // CardBody.defaultProps = {
46
+ // className: '',
47
+ // style: {},
48
+ // };
49
+
40
50
  CardBody.propTypes = {
41
51
  /** The content of the component. */
42
52
  children: PropTypes.node,
@@ -46,19 +56,19 @@ CardBody.propTypes = {
46
56
  style: PropTypes.object,
47
57
  /** The title of the component's header. */
48
58
  title: PropTypes.string,
49
- /**
50
- * ref methods (ref.current.instance.*method*)
51
- *
52
- * * option(): Gets all UI component properties
53
- * * Returns value - object
54
- * * option(optionName): Gets the value of a single property
55
- * * @param {optionName} - string
56
- * * Returns value - any
57
- * * option(optionName, optionValue): Updates the value of a single property
58
- * * @param {optionName} - string
59
- * * @param {optionValue} - any
60
- * * option(options): Updates the values of several properties
61
- * * @param {options} - object
59
+ /**
60
+ * ref methods (ref.current.instance.*method*)
61
+ *
62
+ * * option(): Gets all UI component properties
63
+ * * Returns value - object
64
+ * * option(optionName): Gets the value of a single property
65
+ * * @param {optionName} - string
66
+ * * Returns value - any
67
+ * * option(optionName, optionValue): Updates the value of a single property
68
+ * * @param {optionName} - string
69
+ * * @param {optionValue} - any
70
+ * * option(options): Updates the values of several properties
71
+ * * @param {options} - object
62
72
  */
63
73
  ref: ref
64
74
  };
@@ -1,18 +1,26 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
- import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
4
- import PropTypes from 'prop-types';
5
3
  import { jsx } from '@emotion/core';
6
4
  import OptionWrapper from "../others/option-wrapper";
5
+ import PropTypes from 'prop-types';
6
+ import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
7
+ import useThemeProps from "../../theme/utils/useThemeProps";
7
8
  import { classNames, refType as ref } from "../../utils";
8
- const CardExtra = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
9
- action = {},
10
- children,
11
- className,
12
- id,
13
- style,
14
- title
15
- }, reference) => {
9
+ const CardExtra = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
10
+ if (!reference) reference = useRef(null);
11
+
12
+ // props priority: `inProps` > `themeDefaultProps`
13
+ const props = useThemeProps({
14
+ props: inProps,
15
+ name: 'CardExtra'
16
+ });
17
+ const {
18
+ action = {},
19
+ children,
20
+ className,
21
+ id,
22
+ style
23
+ } = props;
16
24
  const ref = useRef(null);
17
25
  useImperativeHandle(reference, () => {
18
26
  const currentRef = ref.current || {};
@@ -31,12 +39,14 @@ const CardExtra = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
31
39
  style: style,
32
40
  className: classNames(`DGN-UI-Card-Extra`, className)
33
41
  }, children);
34
- }, [children, className, id, style, title]);
42
+ }, [children, className, id, style]);
35
43
  }));
36
- CardExtra.defaultProps = {
37
- className: '',
38
- style: {}
39
- };
44
+
45
+ // CardExtra.defaultProps = {
46
+ // className: '',
47
+ // style: {},
48
+ // };
49
+
40
50
  CardExtra.propTypes = {
41
51
  /** The content of the component. */
42
52
  children: PropTypes.node,
@@ -46,19 +56,19 @@ CardExtra.propTypes = {
46
56
  style: PropTypes.object,
47
57
  /** The title of the component's header. */
48
58
  title: PropTypes.string,
49
- /**
50
- * ref methods (ref.current.instance.*method*)
51
- *
52
- * * option(): Gets all UI component properties
53
- * * Returns value - object
54
- * * option(optionName): Gets the value of a single property
55
- * * @param {optionName} - string
56
- * * Returns value - any
57
- * * option(optionName, optionValue): Updates the value of a single property
58
- * * @param {optionName} - string
59
- * * @param {optionValue} - any
60
- * * option(options): Updates the values of several properties
61
- * * @param {options} - object
59
+ /**
60
+ * ref methods (ref.current.instance.*method*)
61
+ *
62
+ * * option(): Gets all UI component properties
63
+ * * Returns value - object
64
+ * * option(optionName): Gets the value of a single property
65
+ * * @param {optionName} - string
66
+ * * Returns value - any
67
+ * * option(optionName, optionValue): Updates the value of a single property
68
+ * * @param {optionName} - string
69
+ * * @param {optionValue} - any
70
+ * * option(options): Updates the values of several properties
71
+ * * @param {options} - object
62
72
  */
63
73
  ref: ref
64
74
  };