diginet-core-ui 1.3.73 → 1.3.75

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 (58) hide show
  1. package/assets/images/menu/dhr/MHRP29N0026.svg +13 -0
  2. package/assets/images/menu/dhr/MHRP29N0027.svg +14 -0
  3. package/assets/images/menu/dhr/MHRP29N0028.svg +15 -0
  4. package/components/accordion/details.js +19 -10
  5. package/components/accordion/group.js +15 -6
  6. package/components/accordion/index.js +20 -11
  7. package/components/accordion/summary.js +18 -9
  8. package/components/avatar/index.js +20 -20
  9. package/components/badge/index.js +17 -9
  10. package/components/button/icon.js +33 -25
  11. package/components/button/index.js +25 -17
  12. package/components/card/body.js +12 -4
  13. package/components/card/extra.js +12 -4
  14. package/components/card/footer.js +12 -4
  15. package/components/card/header.js +12 -4
  16. package/components/card/index.js +12 -4
  17. package/components/chip/index.js +6 -6
  18. package/components/form-control/attachment/index.js +197 -192
  19. package/components/form-control/date-picker/index.js +4 -2
  20. package/components/form-control/date-range-picker/index.js +21 -14
  21. package/components/form-control/dropdown/index.js +69 -48
  22. package/components/form-control/input-base/index.js +505 -483
  23. package/components/form-control/label/index.js +27 -21
  24. package/components/form-control/text-input/index.js +8 -5
  25. package/components/grid/Col.js +8 -7
  26. package/components/grid/Container.js +16 -15
  27. package/components/grid/Row.js +16 -15
  28. package/components/grid/index.js +17 -36
  29. package/components/image/index.js +164 -0
  30. package/components/index.js +3 -1
  31. package/components/modal/body.js +12 -9
  32. package/components/modal/footer.js +22 -11
  33. package/components/modal/header.js +25 -13
  34. package/components/modal/index.js +32 -30
  35. package/components/modal/modal.js +29 -25
  36. package/components/others/option-wrapper/index.js +5 -18
  37. package/components/paging/page-info.js +45 -33
  38. package/components/paging/page-selector2.js +45 -33
  39. package/components/popover/body.js +14 -6
  40. package/components/popover/footer.js +15 -6
  41. package/components/popover/header.js +17 -7
  42. package/components/popover/index.js +262 -129
  43. package/components/status/index.js +12 -4
  44. package/components/tab/tab-container.js +29 -27
  45. package/components/tab/tab-header.js +35 -30
  46. package/components/tab/tab-panel.js +31 -27
  47. package/components/tab/tab.js +47 -37
  48. package/components/tree-view/index.js +146 -111
  49. package/components/typography/index.js +47 -36
  50. package/icons/basic.js +248 -0
  51. package/icons/effect.js +44 -36
  52. package/package.json +1 -1
  53. package/readme.md +43 -0
  54. package/styles/general.js +34 -11
  55. package/theme/index.js +1 -1
  56. package/theme/set-theme.js +5 -4
  57. package/utils/index.js +13 -10
  58. package/utils/useMediaQuery.js +4 -2
@@ -0,0 +1,13 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_668_28)">
3
+ <path d="M18.1 30.4C17.9 30.1 17.5 29.9 17.1 29.9H8C7.4 29.9 6.9 30.4 6.9 31C6.9 31.6 7.4 32.1 8 32.1H17.1C17.6 32.1 18.1 31.7 18.2 31.2C18.2 31.1 18.2 31 18.2 30.9C18.3 30.8 18.2 30.5 18.1 30.4ZM8 20.7C7.4 20.7 6.9 21.2 6.9 21.8C6.9 22.4 7.4 23 8 23H19.8C20.4 22.1 21 21.4 21.8 20.7H8ZM21.7 16.1H8C7.4 16.1 6.9 16.6 6.9 17.2C6.9 17.8 7.4 18.3 8 18.3H21.7C22.3 18.3 22.8 17.8 22.8 17.2C22.8 16.6 22.3 16.1 21.7 16.1ZM8 25.3C7.4 25.3 6.9 25.8 6.9 26.4C6.9 27 7.4 27.5 8 27.5H18.1C18.2 26.7 18.4 25.9 18.7 25.2H8V25.3ZM18.1 30.4C17.9 30.1 17.5 29.9 17.1 29.9H8C7.4 29.9 6.9 30.4 6.9 31C6.9 31.6 7.4 32.1 8 32.1H17.1C17.6 32.1 18.1 31.7 18.2 31.2C18.2 31.1 18.2 31 18.2 30.9C18.3 30.8 18.2 30.5 18.1 30.4ZM8 25.3C7.4 25.3 6.9 25.8 6.9 26.4C6.9 27 7.4 27.5 8 27.5H18.1C18.2 26.7 18.4 25.9 18.7 25.2H8V25.3ZM8 20.7C7.4 20.7 6.9 21.2 6.9 21.8C6.9 22.4 7.4 23 8 23H19.8C20.4 22.1 21 21.4 21.8 20.7H8ZM21.7 16.1H8C7.4 16.1 6.9 16.6 6.9 17.2C6.9 17.8 7.4 18.3 8 18.3H21.7C22.3 18.3 22.8 17.8 22.8 17.2C22.8 16.6 22.3 16.1 21.7 16.1ZM29.4 9.5L20.3 0.3C20 0.1 19.7 0 19.4 0H3.4C1.5 0 0 1.5 0 3.4V35.5C0 37.5 1.5 39 3.4 39H24.4C23.2 38.4 22.1 37.7 21.1 36.7H3.4C2.8 36.7 2.3 36.2 2.3 35.6V3.4C2.3 2.8 2.8 2.3 3.4 2.3H18.3V8C18.3 9.9 19.8 11.4 21.7 11.4H27.4V18.1C27.9 18 28.4 18 29 18C29.2 18 29.5 18 29.7 18V10.3C29.7 10 29.6 9.7 29.4 9.5ZM21.7 9.1C21.1 9.1 20.6 8.6 20.6 8V3.9L25.8 9.1H21.7ZM21.7 16.1H8C7.4 16.1 6.9 16.6 6.9 17.2C6.9 17.8 7.4 18.3 8 18.3H21.7C22.3 18.3 22.8 17.8 22.8 17.2C22.8 16.6 22.3 16.1 21.7 16.1ZM21.8 20.7H8C7.4 20.7 6.9 21.2 6.9 21.8C6.9 22.4 7.4 23 8 23H19.8C20.3 22.1 21 21.4 21.8 20.7ZM8 25.3C7.4 25.3 6.9 25.8 6.9 26.4C6.9 27 7.4 27.5 8 27.5H18.1C18.2 26.7 18.4 25.9 18.7 25.2H8V25.3ZM17.1 29.9H8C7.4 29.9 6.9 30.4 6.9 31C6.9 31.6 7.4 32.1 8 32.1H17.1C17.6 32.1 18.1 31.7 18.2 31.2C18.2 31.1 18.2 31 18.2 30.9C18.2 30.7 18.1 30.4 18 30.3C17.9 30.1 17.5 29.9 17.1 29.9ZM8 25.3C7.4 25.3 6.9 25.8 6.9 26.4C6.9 27 7.4 27.5 8 27.5H18.1C18.2 26.7 18.4 25.9 18.7 25.2H8V25.3ZM21.7 16.1H8C7.4 16.1 6.9 16.6 6.9 17.2C6.9 17.8 7.4 18.3 8 18.3H21.7C22.3 18.3 22.8 17.8 22.8 17.2C22.8 16.6 22.3 16.1 21.7 16.1ZM8 20.7C7.4 20.7 6.9 21.2 6.9 21.8C6.9 22.4 7.4 23 8 23H19.8C20.4 22.1 21 21.4 21.8 20.7H8ZM18.1 30.4C17.9 30.1 17.5 29.9 17.1 29.9H8C7.4 29.9 6.9 30.4 6.9 31C6.9 31.6 7.4 32.1 8 32.1H17.1C17.6 32.1 18.1 31.7 18.2 31.2C18.2 31.1 18.2 31 18.2 30.9C18.3 30.8 18.2 30.5 18.1 30.4ZM18.1 30.4C17.9 30.1 17.5 29.9 17.1 29.9H8C7.4 29.9 6.9 30.4 6.9 31C6.9 31.6 7.4 32.1 8 32.1H17.1C17.6 32.1 18.1 31.7 18.2 31.2C18.2 31.1 18.2 31 18.2 30.9C18.3 30.8 18.2 30.5 18.1 30.4ZM8 20.7C7.4 20.7 6.9 21.2 6.9 21.8C6.9 22.4 7.4 23 8 23H19.8C20.4 22.1 21 21.4 21.8 20.7H8ZM21.7 16.1H8C7.4 16.1 6.9 16.6 6.9 17.2C6.9 17.8 7.4 18.3 8 18.3H21.7C22.3 18.3 22.8 17.8 22.8 17.2C22.8 16.6 22.3 16.1 21.7 16.1ZM8 25.3C7.4 25.3 6.9 25.8 6.9 26.4C6.9 27 7.4 27.5 8 27.5H18.1C18.2 26.7 18.4 25.9 18.7 25.2H8V25.3ZM21.7 16.1H8C7.4 16.1 6.9 16.6 6.9 17.2C6.9 17.8 7.4 18.3 8 18.3H21.7C22.3 18.3 22.8 17.8 22.8 17.2C22.8 16.6 22.3 16.1 21.7 16.1ZM8 20.7C7.4 20.7 6.9 21.2 6.9 21.8C6.9 22.4 7.4 23 8 23H19.8C20.4 22.1 21 21.4 21.8 20.7H8ZM8 25.3C7.4 25.3 6.9 25.8 6.9 26.4C6.9 27 7.4 27.5 8 27.5H18.1C18.2 26.7 18.4 25.9 18.7 25.2H8V25.3ZM18.1 30.4C17.9 30.1 17.5 29.9 17.1 29.9H8C7.4 29.9 6.9 30.4 6.9 31C6.9 31.6 7.4 32.1 8 32.1H17.1C17.6 32.1 18.1 31.7 18.2 31.2C18.2 31.1 18.2 31 18.2 30.9C18.3 30.8 18.2 30.5 18.1 30.4Z" fill="#2680EB"/>
4
+ <path d="M30.6 22.2C30.8 25.4 30.2 28.5 30 31.7C29.4 31.7 28.8 31.7 28.2 31.7C28 28.6 27.4 25.4 27.6 22.2C28.5 22.2 29.5 22.2 30.6 22.2Z" fill="#FF4444"/>
5
+ <path d="M30.6 34.3C30.6 35.2 29.9 35.9 29 35.9C28.1 35.9 27.4 35.2 27.5 34.3C27.5 33.4 28.2 32.7 29.1 32.7C29.9 32.7 30.6 33.4 30.6 34.3Z" fill="#FF4444"/>
6
+ <path d="M29 19C23.5 19 19 23.5 19 29C19 34.5 23.5 39 29 39C34.5 39 39 34.5 39 29C39 23.5 34.5 19 29 19ZM29 37C24.6 37 21 33.4 21 29C21 24.6 24.6 21 29 21C33.4 21 37 24.6 37 29C37 33.4 33.4 37 29 37Z" fill="#FF4444"/>
7
+ </g>
8
+ <defs>
9
+ <clipPath id="clip0_668_28">
10
+ <rect width="39" height="39" fill="white"/>
11
+ </clipPath>
12
+ </defs>
13
+ </svg>
@@ -0,0 +1,14 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_668_41)">
3
+ <path d="M16 0C11.8 0 7.7 1.7 4.7 4.7C1.7 7.7 0 11.8 0 16C0 24.8 7.2 32 16 32C17.1 32 18.1 31.9 19.1 31.7C18 31.6 17.2 30.7 17.2 29.7C17.2 29.5 17.2 29.3 17.3 29.1C16.9 29.1 16.4 29.2 16 29.2C8.8 29.1 2.9 23.3 2.9 16C2.9 8.8 8.8 2.9 16 2.9C23.3 2.9 29.1 8.8 29.1 16C29.1 17.9 28.7 19.7 27.9 21.4H31C31.6 19.7 31.9 17.9 31.9 16C32 7.2 24.8 0 16 0Z" fill="#2680EB"/>
4
+ <path d="M17.4 12.6L14.5 15.5V7.7C14.5 6.9 15.1 6.3 15.9 6.3C16.7 6.3 17.3 7 17.3 7.7V12.6H17.4Z" fill="#2680EB"/>
5
+ <path d="M25.9 16.9C25.9 17.7 25.3 18.3 24.5 18.3H17.3C17.3 18.3 17.4 18.3 17.4 18.2L20.2 15.4H24.5C25.3 15.4 25.9 16.1 25.9 16.9Z" fill="#2680EB"/>
6
+ <path d="M16 18.3C15.6 18.3 15.2 18.2 15 17.9C14.4 17.3 14.4 16.4 15 15.8L22.2 8.6C22.8 8 23.7 8 24.3 8.6C24.9 9.2 24.9 10.1 24.3 10.7L17.1 17.9C16.8 18.1 16.4 18.3 16 18.3Z" fill="#FF4444"/>
7
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M19.2999 24.5H20.4999C20.8999 25.7 22.0999 26.6 23.3999 26.6C24.6999 26.6 25.8999 25.7 26.2999 24.5H37.9999C38.5999 24.5 38.9999 24 38.9999 23.5C38.9999 22.9 38.4999 22.5 37.9999 22.5H26.2999C25.8999 21.3 24.6999 20.4 23.3999 20.4C22.0999 20.4 20.8999 21.3 20.4999 22.5H19.2999C18.6999 22.5 18.2999 23 18.2999 23.5C18.1999 24 18.6999 24.5 19.2999 24.5ZM35.8999 26.5C34.4999 26.5 33.3999 27.4 32.9999 28.6H19.2999C18.6999 28.6 18.2999 29.1 18.2999 29.6C18.2999 30.2 18.7999 30.6 19.2999 30.6H32.9999C33.3999 31.8 34.5999 32.7 35.8999 32.7C37.5999 32.7 38.9999 31.3 38.9999 29.6C38.9999 27.9 37.5999 26.5 35.8999 26.5ZM30.4999 34.8H37.9999C38.5999 34.8 38.9999 35.3 38.9999 35.8C38.9999 36.4 38.4999 36.8 37.9999 36.8H30.4999C30.0999 38 28.8999 38.9 27.5999 38.9C26.2999 38.9 25.0999 38 24.6999 36.8H19.2999C18.6999 36.8 18.2999 36.3 18.2999 35.8C18.2999 35.2 18.7999 34.8 19.2999 34.8H24.6999C25.0999 33.6 26.2999 32.7 27.5999 32.7C28.8999 32.7 30.0999 33.6 30.4999 34.8Z" fill="#FF8C00"/>
8
+ </g>
9
+ <defs>
10
+ <clipPath id="clip0_668_41">
11
+ <rect width="39" height="39" fill="white"/>
12
+ </clipPath>
13
+ </defs>
14
+ </svg>
@@ -0,0 +1,15 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_668_54)">
3
+ <path d="M16 0C11.8 0 7.7 1.7 4.7 4.7C1.7 7.7 0 11.8 0 16C0 17.8 0.3 19.4 0.8 21H1C1.5 20.2 2.4 19.6 3.3 19.5C3 18.4 2.9 17.2 2.9 16C2.9 8.8 8.8 2.9 16 2.9C23.3 2.9 29.1 8.8 29.1 16C29.1 16.7 29.1 17.3 28.9 18C29.9 18 30.8 18.1 31.7 18.4C31.8 17.6 31.9 16.8 31.9 16C32 7.2 24.8 0 16 0ZM18 29C17.3 29.1 16.7 29.1 16 29.1C15.8 29.1 15.6 29.1 15.4 29.1C15.1 29.5 14.8 29.8 14.5 30C15.4 30.1 16 30.8 16 31.7C16 31.8 16 31.9 16 32C16.8 32 17.6 31.9 18.4 31.8C18.1 30.9 18 30 18 29Z" fill="#2680EB"/>
4
+ <path d="M17.4 12.6L14.5 15.5V7.7C14.5 6.9 15.1 6.3 15.9 6.3C16.7 6.3 17.3 7 17.3 7.7V12.6H17.4Z" fill="#2680EB"/>
5
+ <path d="M25.9 16.9C25.9 17.7 25.3 18.3 24.5 18.3H17.3L20.2 15.4H24.5C25.3 15.4 25.9 16.1 25.9 16.9Z" fill="#2680EB"/>
6
+ <path d="M16 18.3C15.6 18.3 15.2 18.2 15 17.9C14.4 17.3 14.4 16.4 15 15.8L22.2 8.6C22.8 8 23.7 8 24.3 8.6C24.9 9.2 24.9 10.1 24.3 10.7L17.1 17.9C16.8 18.1 16.4 18.3 16 18.3Z" fill="#FF4444"/>
7
+ <path d="M29 19C23.5 19 19 23.5 19 29C19 34.5 23.5 39 29 39C34.5 39 39 34.5 39 29C39 23.5 34.5 19 29 19ZM35.2 25.8L29.3 33.8C29 34.3 28.4 34.6 27.8 34.6C27.2 34.6 26.7 34.4 26.3 34L22.8 30.2C22.2 29.6 22.3 28.6 22.9 28.1C23.5 27.5 24.5 27.6 25 28.2L27.5 30.9L27.6 31C27.7 31 27.7 31 27.7 30.9L32.7 24.1C33.2 23.4 34.1 23.3 34.8 23.8C35.6 24.2 35.7 25.1 35.2 25.8Z" fill="#1CA261"/>
8
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M0.8 23.5H1.7C1.9 24.4 2.8 25 3.8 25C4.8 25 5.6 24.4 5.9 23.5H14.3C14.7 23.5 15.1 23.2 15.1 22.7C15.1 22.3 14.8 21.9 14.3 21.9H5.9C5.6 21 4.8 20.4 3.8 20.4C2.8 20.4 1.9 21.1 1.6 22H0.8C0.3 22 0 22.3 0 22.7C0 23.2 0.3 23.5 0.8 23.5ZM12.8 25C11.8 25 11 25.6 10.7 26.5H0.8C0.4 26.5 0 26.8 0 27.3C0 27.7 0.3 28 0.8 28H10.7C11 28.9 11.8 29.5 12.8 29.5C14 29.5 15.1 28.5 15.1 27.2C15 26 14 25 12.8 25ZM8.9 31H14.3C14.7 31 15.1 31.3 15.1 31.8C15.1 32.2 14.8 32.6 14.3 32.6H8.9C8.6 33.4 7.7 34 6.8 34C5.9 34 5 33.4 4.7 32.5H0.8C0.4 32.5 0 32.2 0 31.7C0 31.3 0.3 31 0.8 31H4.7C5 30.1 5.8 29.5 6.8 29.5C7.8 29.5 8.6 30.1 8.9 31Z" fill="#FF8C00"/>
9
+ </g>
10
+ <defs>
11
+ <clipPath id="clip0_668_54">
12
+ <rect width="39" height="39" fill="white"/>
13
+ </clipPath>
14
+ </defs>
15
+ </svg>
@@ -4,7 +4,8 @@
4
4
  import { memo, forwardRef, useRef, useMemo, useImperativeHandle } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { jsx, css } from '@emotion/core';
7
- import { borderBox, displayBlock, overflowHidden, pointerEventsNone, positionRelative, userSelectNone } from '../../styles/general';
7
+ import { borderBox, displayBlock, overflowHidden, parseHeight, pointerEventsNone, positionRelative, userSelectNone } from '../../styles/general';
8
+ import { classNames } from '../../utils';
8
9
  import theme from '../../theme/settings';
9
10
  const {
10
11
  colors: {
@@ -18,16 +19,24 @@ const {
18
19
  spacing
19
20
  } = theme;
20
21
  const AccordionDetails = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
22
+ action = {},
21
23
  children,
22
24
  className,
23
25
  id,
24
26
  style
25
27
  }, reference) => {
26
28
  const ref = useRef(null);
27
- useImperativeHandle(reference, () => ({
28
- element: ref.current,
29
- instance: {}
30
- }));
29
+ useImperativeHandle(reference, () => {
30
+ const currentRef = ref.current || {};
31
+ currentRef.element = ref.current;
32
+ const _instance = { ...action
33
+ }; // methods
34
+
35
+ _instance.__proto__ = {}; // hidden methods
36
+
37
+ currentRef.instance = _instance;
38
+ return currentRef;
39
+ });
31
40
  return useMemo(() => {
32
41
  return jsx("div", {
33
42
  css: DetailsRootCSS,
@@ -36,15 +45,15 @@ const AccordionDetails = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
36
45
  id: id
37
46
  }, jsx("div", {
38
47
  style: style,
39
- className: ['DGN-UI-Accordion-Details-Content', className].join(' ').trim().replace(/\s+/g, ' ')
48
+ className: classNames('DGN-UI-Accordion-Details-Content', className)
40
49
  }, children));
41
- }, [style, className, children, id]);
50
+ }, [children, className, id, style]);
42
51
  }));
43
52
  const DetailsRootCSS = css`
44
53
  ${displayBlock};
45
54
  ${positionRelative};
46
55
  ${overflowHidden};
47
- height: 0;
56
+ ${parseHeight(0)};
48
57
  transition: height 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
49
58
  .DGN-UI-Accordion-Details-Content {
50
59
  ${borderBox};
@@ -52,8 +61,8 @@ const DetailsRootCSS = css`
52
61
  padding: ${spacing([0, 6, 4, 6])};
53
62
  color: ${main};
54
63
  &.disabled {
55
- ${pointerEventsNone}
56
- ${userSelectNone}
64
+ ${pointerEventsNone};
65
+ ${userSelectNone};
57
66
  }
58
67
  }
59
68
  `;
@@ -5,11 +5,13 @@ import { memo, useRef, forwardRef, Children, cloneElement, useMemo, useImperativ
5
5
  import PropTypes from 'prop-types';
6
6
  import { jsx, css } from '@emotion/core';
7
7
  import { borderRadius4px } from '../../styles/general';
8
+ import classNames from '../../utils/classNames';
8
9
  import theme from '../../theme/settings';
9
10
  const {
10
11
  spacing
11
12
  } = theme;
12
13
  const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
14
+ action = {},
13
15
  children,
14
16
  className,
15
17
  collapseOther,
@@ -30,20 +32,27 @@ const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
30
32
  }
31
33
  };
32
34
 
33
- useImperativeHandle(reference, () => ({
34
- element: ref.current,
35
- instance: {}
36
- }));
35
+ useImperativeHandle(reference, () => {
36
+ const currentRef = ref.current || {};
37
+ currentRef.element = ref.current;
38
+ const _instance = { ...action
39
+ }; // methods
40
+
41
+ _instance.__proto__ = {}; // hidden methods
42
+
43
+ currentRef.instance = _instance;
44
+ return currentRef;
45
+ });
37
46
  return useMemo(() => {
38
47
  return jsx("div", {
39
48
  css: AccordionGroupRootCSS,
40
49
  ref: ref,
41
50
  style: style,
42
- className: ['DGN-UI-Accordion-Group', className].join(' ').trim().replace(/\s+/g, ' ')
51
+ className: classNames('DGN-UI-Accordion-Group', className)
43
52
  }, Children.map(children, child => child && /*#__PURE__*/cloneElement(child, {
44
53
  onExpand: e => onCollapseOther(e, child.props.onExpand)
45
54
  })));
46
- }, [style, className, children]);
55
+ }, [children, className, collapseOther, style]);
47
56
  }));
48
57
  const AccordionGroupRootCSS = css`
49
58
  ${borderRadius4px};
@@ -6,7 +6,8 @@ import PropTypes from 'prop-types';
6
6
  import { jsx, css } from '@emotion/core';
7
7
  import AccordionContext from './context';
8
8
  import Divider from '../divider';
9
- import { borderRadius4px, displayBlock, positionRelative } from '../../styles/general';
9
+ import { borderRadius4px, displayBlock, parseWidth, positionRelative } from '../../styles/general';
10
+ import classNames from '../../utils/classNames';
10
11
  import theme from '../../theme/settings';
11
12
  const {
12
13
  colors: {
@@ -16,6 +17,7 @@ const {
16
17
  }
17
18
  } = theme;
18
19
  const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
20
+ action = {},
19
21
  boxShadow,
20
22
  children,
21
23
  className,
@@ -49,17 +51,24 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
49
51
  });
50
52
  };
51
53
 
52
- useImperativeHandle(reference, () => ({
53
- element: ref.current,
54
- instance: {}
55
- }));
54
+ useImperativeHandle(reference, () => {
55
+ const currentRef = ref.current || {};
56
+ currentRef.element = ref.current;
57
+ const _instance = { ...action
58
+ }; // methods
59
+
60
+ _instance.__proto__ = {}; // hidden methods
61
+
62
+ currentRef.instance = _instance;
63
+ return currentRef;
64
+ });
56
65
  return useMemo(() => {
57
66
  return jsx("div", {
58
67
  id: id,
59
68
  css: AccordionRootCSS,
60
69
  ref: ref,
61
70
  style: style,
62
- className: ['DGN-UI-Accordion', disabled ? 'disabled' : '', boxShadow === true ? 'boxShadow' : '', expandState ? 'expanding' : '', className].join(' ').trim().replace(/\s+/g, ' ')
71
+ className: classNames('DGN-UI-Accordion', disabled && 'disabled', boxShadow === true && 'boxShadow', expandState && 'expanding', className)
63
72
  }, jsx(AccordionContext.Provider, {
64
73
  value: {
65
74
  expanded,
@@ -77,13 +86,13 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
77
86
  display: 'none'
78
87
  }
79
88
  })));
80
- }, [id, disabled, className, style, boxShadow, onClick, children, expanded, onExpand, onCollapse, expandState]);
89
+ }, [boxShadow, children, className, disabled, expanded, id, onClick, onCollapse, onExpand, style, expandState]);
81
90
  }));
82
91
  const AccordionRootCSS = css`
83
92
  ${displayBlock};
84
93
  ${positionRelative};
85
94
  ${borderRadius4px};
86
- width: 100%;
95
+ ${parseWidth('100%')};
87
96
  transition: margin 300ms ease;
88
97
  &.boxShadow {
89
98
  box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.25);
@@ -94,10 +103,10 @@ const AccordionRootCSS = css`
94
103
  }
95
104
  `;
96
105
  Accordion.defaultProps = {
97
- expand: false,
98
- disabled: false,
99
- className: '',
100
106
  boxShadow: true,
107
+ className: '',
108
+ disabled: false,
109
+ expand: false,
101
110
  style: {}
102
111
  };
103
112
  Accordion.propTypes = {
@@ -7,6 +7,7 @@ import { jsx } from '@emotion/core';
7
7
  import { SummaryRootCSS } from './css';
8
8
  import AccordionContext from './context';
9
9
  import { ButtonIcon, Typography } from '..';
10
+ import { classNames } from '../../utils';
10
11
  import theme from '../../theme/settings';
11
12
  const {
12
13
  colors: {
@@ -18,6 +19,7 @@ const {
18
19
  spacing
19
20
  } = theme;
20
21
  const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
22
+ action = {},
21
23
  background,
22
24
  children,
23
25
  className,
@@ -61,10 +63,10 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
61
63
 
62
64
  if (expandState) {
63
65
  if (expanded === undefined) setExpandState(false);
64
- !!onCollapse && onCollapse(e);
66
+ !!onCollapse && onCollapse(ref.current);
65
67
  } else if (!expandState) {
66
68
  if (expanded === undefined) setExpandState(true);
67
- !!onExpand && onExpand(e);
69
+ !!onExpand && onExpand(ref.current);
68
70
  }
69
71
  };
70
72
 
@@ -113,10 +115,17 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
113
115
  showHideDetailHandler('hide');
114
116
  }
115
117
  }, [expandState]);
116
- useImperativeHandle(reference, () => ({
117
- element: ref.current,
118
- instance: {}
119
- }));
118
+ useImperativeHandle(reference, () => {
119
+ const currentRef = ref.current || {};
120
+ currentRef.element = ref.current;
121
+ const _instance = { ...action
122
+ }; // methods
123
+
124
+ _instance.__proto__ = {}; // hidden methods
125
+
126
+ currentRef.instance = _instance;
127
+ return currentRef;
128
+ });
120
129
  return useMemo(() => {
121
130
  return jsx("div", {
122
131
  id: id,
@@ -125,7 +134,7 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
125
134
  tabIndex: "-1",
126
135
  onClick: _onClick,
127
136
  style: style,
128
- className: ['DGN-UI-Accordion-Summary', disabled ? 'disabled' : '', expandIcon ? expandIconAt : '', expandState ? 'expanding' : '', className].join(' ').trim().replace(/\s+/g, ' ')
137
+ className: classNames('DGN-UI-Accordion-Summary', disabled && 'disabled', expandIcon && expandIconAt, expandState && 'expanding', className)
129
138
  }, jsx("div", {
130
139
  className: 'DGN-UI-Accordion-Summary-Content'
131
140
  }, jsx(Typography, {
@@ -139,7 +148,7 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
139
148
  className: 'Accordion-Icon-Root'
140
149
  }, jsx("div", { ...expandIconProps,
141
150
  ref: expandIconRef,
142
- className: ['Accordion-Icon', collapseIcon ? '' : 'rotate-able', expandIconProps.className ? expandIconProps.className : ''].join(' ').trim().replace(/\s+/g, ' ')
151
+ className: classNames('Accordion-Icon', !collapseIcon && 'rotate-able', expandIconProps === null || expandIconProps === void 0 ? void 0 : expandIconProps.className)
143
152
  }, typeof expandIcon === 'string' ? jsx(ButtonIcon, {
144
153
  viewType: 'ghost',
145
154
  name: expandIcon,
@@ -153,7 +162,7 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
153
162
  }) : jsx("span", {
154
163
  className: 'Accordion-Collapse-Icon effect'
155
164
  }, collapseIcon)))));
156
- }, [id, expandIcon, expandIconAt, className, background, children, collapseIcon, expandIconProps, style, expandState, disabled]);
165
+ }, [background, children, className, collapseIcon, expandIcon, expandIconAt, expandIconProps, id, onClick, style, title, disabled, expanded, expandState, onClickAccordion, onCollapse, onExpand]);
157
166
  }));
158
167
  AccordionSummary.defaultProps = {
159
168
  className: '',
@@ -232,7 +232,7 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
232
232
  img.alt = '';
233
233
 
234
234
  img.onerror = () => {
235
- setSrcState(null);
235
+ setSrcState(defaultSrc);
236
236
  existed[unique] = false;
237
237
  };
238
238
 
@@ -437,15 +437,15 @@ Avatar.propTypes = {
437
437
  /** If `true`, display remove avatar icon. */
438
438
  clearAble: PropTypes.bool,
439
439
 
440
- /**
441
- * data to display when hoverAble is true<br />
442
- * data is an object or function return a jsx element
440
+ /**
441
+ * data to display when hoverAble is true<br />
442
+ * data is an object or function return a jsx element
443
443
  */
444
444
  data: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
445
445
 
446
- /**
447
- * it is used to display the default if there is no src<br />
448
- * if undefined, will display icons available in the icons store
446
+ /**
447
+ * it is used to display the default if there is no src<br />
448
+ * if undefined, will display icons available in the icons store
449
449
  */
450
450
  defaultSrc: PropTypes.string,
451
451
 
@@ -500,19 +500,19 @@ Avatar.propTypes = {
500
500
  /** the error to show on wrong type */
501
501
  wrongTypeError: PropTypes.string,
502
502
 
503
- /**
504
- * ref methods
505
- *
506
- * * option(): Gets all UI component properties
507
- * * Returns value - object
508
- * * option(optionName): Gets the value of a single property
509
- * * @param {optionName} - string
510
- * * Returns value - any
511
- * * option(optionName, optionValue): Updates the value of a single property
512
- * * @param {optionName} - string
513
- * * @param {optionValue} - any
514
- * * option(options): Updates the values of several properties
515
- * * @param {options} - object
503
+ /**
504
+ * ref methods
505
+ *
506
+ * * option(): Gets all UI component properties
507
+ * * Returns value - object
508
+ * * option(optionName): Gets the value of a single property
509
+ * * @param {optionName} - string
510
+ * * Returns value - any
511
+ * * option(optionName, optionValue): Updates the value of a single property
512
+ * * @param {optionName} - string
513
+ * * @param {optionValue} - any
514
+ * * option(options): Updates the values of several properties
515
+ * * @param {options} - object
516
516
  */
517
517
  reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
518
518
  current: PropTypes.instanceOf(Element)
@@ -72,6 +72,7 @@ const calDotPos = (anchorOrigin, contentDirection, dotSize, hasContent, size) =>
72
72
  };
73
73
 
74
74
  const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
75
+ action = {},
75
76
  anchorOrigin,
76
77
  contentDirection,
77
78
  content,
@@ -98,10 +99,17 @@ const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
98
99
 
99
100
  const _BadgeRootCSS = BadgeRootCSS(children, name, dotPos, _BadgeNumberCSS);
100
101
 
101
- useImperativeHandle(reference, () => ({
102
- element: ref.current,
103
- instance: {}
104
- }));
102
+ useImperativeHandle(reference, () => {
103
+ const currentRef = ref.current || {};
104
+ currentRef.element = ref.current;
105
+ const _instance = { ...action
106
+ }; // methods
107
+
108
+ _instance.__proto__ = {}; // hidden methods
109
+
110
+ currentRef.instance = _instance;
111
+ return currentRef;
112
+ });
105
113
  return useMemo(() => {
106
114
  let node = children;
107
115
 
@@ -205,11 +213,11 @@ Badge.propTypes = {
205
213
  /** other icon props when use prop name */
206
214
  iconProps: PropTypes.object,
207
215
 
208
- /** size of Badge
209
- *
210
- * * medium (dot 8px, typography p3)
211
- * * large (button 10px, typography p2)
212
- * * giant (button 12px, typography p1)
216
+ /** size of Badge
217
+ *
218
+ * * medium (dot 8px, typography p3)
219
+ * * large (button 10px, typography p2)
220
+ * * giant (button 12px, typography p1)
213
221
  * */
214
222
  size: PropTypes.oneOf(['medium', 'large', 'giant']),
215
223
 
@@ -71,6 +71,7 @@ const renderIconLoading = iconSize => {
71
71
  };
72
72
 
73
73
  const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
74
+ action = {},
74
75
  viewType,
75
76
  color,
76
77
  size,
@@ -104,10 +105,17 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
104
105
 
105
106
  const _ButtonRootCSS = ButtonRootCSS(circular, size, width, _width, height, _height, buttonSize, iconSize, colorHover, color, _color, name);
106
107
 
107
- useImperativeHandle(reference, () => ({
108
- element: ref.current,
109
- instance: {}
110
- }));
108
+ useImperativeHandle(reference, () => {
109
+ const currentRef = ref.current || {};
110
+ currentRef.element = ref.current;
111
+ const _instance = { ...action
112
+ }; // methods
113
+
114
+ _instance.__proto__ = {}; // hidden methods
115
+
116
+ currentRef.instance = _instance;
117
+ return currentRef;
118
+ });
111
119
 
112
120
  const _onClick = event => {
113
121
  event.persist();
@@ -368,14 +376,14 @@ ButtonIcon.propTypes = {
368
376
  /** Name of [icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic). */
369
377
  name: PropTypes.string,
370
378
 
371
- /**
372
- * The size of the component.
373
- *
374
- * * tiny (button 24px, icon 16px)
375
- * * small (button 32px, icon 20px)
376
- * * medium (button 40px, icon 24px)
377
- * * large (button 48px, icon 32px)
378
- * * giant (button 56px, icon 40px)
379
+ /**
380
+ * The size of the component.
381
+ *
382
+ * * tiny (button 24px, icon 16px)
383
+ * * small (button 32px, icon 20px)
384
+ * * medium (button 40px, icon 24px)
385
+ * * large (button 48px, icon 32px)
386
+ * * giant (button 56px, icon 40px)
379
387
  * */
380
388
  size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant']),
381
389
 
@@ -391,19 +399,19 @@ ButtonIcon.propTypes = {
391
399
  /** Width of the component. */
392
400
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
393
401
 
394
- /**
395
- * ref methods (ref.current.instance.*method*)
396
- *
397
- * * option(): Gets all UI component properties
398
- * * Returns value - object
399
- * * option(optionName): Gets the value of a single property
400
- * * @param {optionName} - string
401
- * * Returns value - any
402
- * * option(optionName, optionValue): Updates the value of a single property
403
- * * @param {optionName} - string
404
- * * @param {optionValue} - any
405
- * * option(options): Updates the values of several properties
406
- * * @param {options} - object
402
+ /**
403
+ * ref methods (ref.current.instance.*method*)
404
+ *
405
+ * * option(): Gets all UI component properties
406
+ * * Returns value - object
407
+ * * option(optionName): Gets the value of a single property
408
+ * * @param {optionName} - string
409
+ * * Returns value - any
410
+ * * option(optionName, optionValue): Updates the value of a single property
411
+ * * @param {optionName} - string
412
+ * * @param {optionValue} - any
413
+ * * option(options): Updates the values of several properties
414
+ * * @param {options} - object
407
415
  */
408
416
  reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
409
417
  current: PropTypes.instanceOf(Element)
@@ -99,6 +99,7 @@ const alphaArr = {
99
99
  };
100
100
  const alphaLoading = 0.2;
101
101
  const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
102
+ action = {},
102
103
  children,
103
104
  className,
104
105
  color,
@@ -130,10 +131,17 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
130
131
 
131
132
  const _ButtonRoot = ButtonRoot(viewType, size, paddingSize, minHeightSize, minHeightSizeLink, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color);
132
133
 
133
- useImperativeHandle(reference, () => ({
134
- element: ref.current,
135
- instance: {}
136
- }));
134
+ useImperativeHandle(reference, () => {
135
+ const currentRef = ref.current || {};
136
+ currentRef.element = ref.current;
137
+ const _instance = { ...action
138
+ }; // methods
139
+
140
+ _instance.__proto__ = {}; // hidden methods
141
+
142
+ currentRef.instance = _instance;
143
+ return currentRef;
144
+ });
137
145
  const StartIcon = useMemo(() => {
138
146
  let node = startIcon;
139
147
 
@@ -483,19 +491,19 @@ Button.propTypes = {
483
491
  /** The variant to use. */
484
492
  viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'link']),
485
493
 
486
- /**
487
- * ref methods (ref.current.instance.*method*)
488
- *
489
- * * option(): Gets all UI component properties
490
- * * Returns value - object
491
- * * option(optionName): Gets the value of a single property
492
- * * @param {optionName} - string
493
- * * Returns value - any
494
- * * option(optionName, optionValue): Updates the value of a single property
495
- * * @param {optionName} - string
496
- * * @param {optionValue} - any
497
- * * option(options): Updates the values of several properties
498
- * * @param {options} - object
494
+ /**
495
+ * ref methods (ref.current.instance.*method*)
496
+ *
497
+ * * option(): Gets all UI component properties
498
+ * * Returns value - object
499
+ * * option(optionName): Gets the value of a single property
500
+ * * @param {optionName} - string
501
+ * * Returns value - any
502
+ * * option(optionName, optionValue): Updates the value of a single property
503
+ * * @param {optionName} - string
504
+ * * @param {optionValue} - any
505
+ * * option(options): Updates the values of several properties
506
+ * * @param {options} - object
499
507
  */
500
508
  reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
501
509
  current: PropTypes.instanceOf(Element)
@@ -7,6 +7,7 @@ import { jsx } from '@emotion/core';
7
7
  import OptionWrapper from '../others/option-wrapper';
8
8
  import { classNames } from '../../utils';
9
9
  const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
10
+ action = {},
10
11
  children,
11
12
  className,
12
13
  id,
@@ -14,10 +15,17 @@ const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
14
15
  title
15
16
  }, reference) => {
16
17
  const ref = useRef(null);
17
- useImperativeHandle(reference, () => ({
18
- element: ref.current,
19
- instance: {}
20
- }));
18
+ useImperativeHandle(reference, () => {
19
+ const currentRef = ref.current || {};
20
+ currentRef.element = ref.current;
21
+ const _instance = { ...action
22
+ }; // methods
23
+
24
+ _instance.__proto__ = {}; // hidden methods
25
+
26
+ currentRef.instance = _instance;
27
+ return currentRef;
28
+ });
21
29
  return useMemo(() => {
22
30
  return jsx("div", {
23
31
  id: id,
@@ -7,6 +7,7 @@ import { jsx } from '@emotion/core';
7
7
  import OptionWrapper from '../others/option-wrapper';
8
8
  import { classNames } from '../../utils';
9
9
  const CardExtra = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
10
+ action = {},
10
11
  children,
11
12
  className,
12
13
  id,
@@ -14,10 +15,17 @@ const CardExtra = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
14
15
  title
15
16
  }, reference) => {
16
17
  const ref = useRef(null);
17
- useImperativeHandle(reference, () => ({
18
- element: ref.current,
19
- instance: {}
20
- }));
18
+ useImperativeHandle(reference, () => {
19
+ const currentRef = ref.current || {};
20
+ currentRef.element = ref.current;
21
+ const _instance = { ...action
22
+ }; // methods
23
+
24
+ _instance.__proto__ = {}; // hidden methods
25
+
26
+ currentRef.instance = _instance;
27
+ return currentRef;
28
+ });
21
29
  return useMemo(() => {
22
30
  return jsx("div", {
23
31
  id: id,