diginet-core-ui 1.3.34 → 1.3.35

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 (39) hide show
  1. package/assets/images/menu/dhr/MHRP09N0032.svg +7 -0
  2. package/components/avatar/index.js +19 -19
  3. package/components/badge/index.js +61 -64
  4. package/components/button/icon.js +21 -21
  5. package/components/button/index.js +180 -180
  6. package/components/button/ripple-effect.js +23 -23
  7. package/components/chart/Pie-v2/index.js +40 -42
  8. package/components/chip/index.js +129 -134
  9. package/components/form-control/attachment/index.js +431 -435
  10. package/components/form-control/calendar/function.js +69 -46
  11. package/components/form-control/calendar/index.js +12 -3
  12. package/components/form-control/control/index.js +35 -23
  13. package/components/form-control/date-picker/index.js +36 -36
  14. package/components/form-control/date-range-picker/index.js +84 -86
  15. package/components/form-control/dropdown/index.js +462 -431
  16. package/components/form-control/dropdown-box/index.js +53 -53
  17. package/components/form-control/label/index.js +16 -15
  18. package/components/form-control/money-input/index.js +106 -7
  19. package/components/form-control/radio/index.js +129 -132
  20. package/components/form-control/text-input/index.js +25 -28
  21. package/components/form-control/toggle/index.js +106 -107
  22. package/components/modal/modal.js +43 -46
  23. package/components/popover/index.js +27 -29
  24. package/components/popup/index.js +73 -77
  25. package/components/popup/proposals_popup.js +46 -48
  26. package/components/popup/v2/index.js +108 -110
  27. package/components/progress/circular.js +65 -66
  28. package/components/tab/tab-container.js +32 -14
  29. package/components/tab/tab-header.js +81 -56
  30. package/components/tab/tab-panel.js +46 -17
  31. package/components/tab/tab.js +105 -87
  32. package/components/tooltip/index.js +24 -26
  33. package/components/typography/index.js +10 -10
  34. package/icons/basic.js +148 -27
  35. package/icons/effect.js +26 -26
  36. package/package.json +1 -1
  37. package/readme.md +17 -0
  38. package/theme/settings.js +7 -5
  39. package/utils/number.js +11 -12
@@ -0,0 +1,7 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M17 23.14H8C7.37 23.14 6.86 23.65 6.86 24.28C6.86 24.91 7.37 25.43 8 25.43H17C17.63 25.43 18.14 24.91 18.14 24.28C18.14 23.65 17.63 23.14 17 23.14ZM21.71 18.57H8C7.37 18.57 6.86 19.08 6.86 19.71C6.86 20.34 7.37 20.86 8 20.86H21.71C22.34 20.86 22.85 20.34 22.85 19.71C22.85 19.08 22.34 18.57 21.71 18.57ZM21.71 14H8C7.37 14 6.86 14.51 6.86 15.14C6.86 15.77 7.37 16.29 8 16.29H21.71C22.34 16.29 22.85 15.77 22.85 15.14C22.85 14.51 22.34 14 21.71 14ZM8 16.29H21.71C22.34 16.29 22.85 15.77 22.85 15.14C22.85 14.51 22.34 14 21.71 14H8C7.37 14 6.86 14.51 6.86 15.14C6.86 15.77 7.37 16.29 8 16.29ZM21.71 18.57H8C7.37 18.57 6.86 19.08 6.86 19.71C6.86 20.34 7.37 20.86 8 20.86H21.71C22.34 20.86 22.85 20.34 22.85 19.71C22.85 19.08 22.34 18.57 21.71 18.57ZM17 23.14H8C7.37 23.14 6.86 23.65 6.86 24.28C6.86 24.91 7.37 25.43 8 25.43H17C17.63 25.43 18.14 24.91 18.14 24.28C18.14 23.65 17.63 23.14 17 23.14ZM29.56 25.16L29.46 25.28L29.39 25.36L29.41 25.38L28.64 26.23C28.22 26.69 27.82 27.12 27.42 27.52V35.57C27.42 36.2 26.91 36.71 26.28 36.71H3.43C2.8 36.71 2.29 36.2 2.29 35.57V3.43C2.29 2.8 2.8 2.29 3.43 2.29H18.28V8C18.28 9.89 19.82 11.43 21.71 11.43H27.01C27.28 11.09 27.53 10.78 27.77 10.49C28.18 9.99 28.58 9.52 28.96 9.07L20.23 0.33C20.02 0.12 19.73 0 19.42 0H3.43C1.54 0 0 1.54 0 3.43V35.57C0 37.46 1.54 39 3.43 39H26.28C28.17 39 29.71 37.46 29.71 35.57V24.99C29.67 25.05 29.62 25.1 29.56 25.16ZM20.57 3.9L25.81 9.14H21.71C21.08 9.14 20.57 8.63 20.57 8V3.9ZM21.71 14H8C7.37 14 6.86 14.51 6.86 15.14C6.86 15.77 7.37 16.29 8 16.29H21.71C22.34 16.29 22.85 15.77 22.85 15.14C22.85 14.51 22.34 14 21.71 14ZM22.85 19.71C22.85 19.08 22.34 18.57 21.71 18.57H8C7.37 18.57 6.86 19.08 6.86 19.71C6.86 20.34 7.37 20.86 8 20.86H21.71C22.34 20.86 22.85 20.34 22.85 19.71ZM8 23.14C7.37 23.14 6.86 23.65 6.86 24.28C6.86 24.91 7.37 25.43 8 25.43H17C17.63 25.43 18.14 24.91 18.14 24.28C18.14 23.65 17.63 23.14 17 23.14H8Z" fill="#2680EB"/>
3
+ <path d="M11.61 31.37C10.73 31.43 10.2 31.99 9.70997 32.57C9.41997 32.92 9.23997 33.37 8.92997 33.7C8.76997 33.88 8.43997 33.9 8.18997 34C8.12997 33.73 7.93997 33.41 8.01997 33.21C8.50997 32.08 9.26997 31.16 10.38 30.58C11.71 29.89 12.55 30.3 12.85 31.76C12.88 31.88 12.91 32.01 12.93 32.06C13.63 31.76 14.29 31.37 15.01 31.21C16.17 30.94 17.26 31.35 18.26 31.93C18.42 32.02 18.42 32.4 18.5 32.64C18.26 32.71 17.99 32.89 17.78 32.84C17.23 32.72 16.71 32.48 16.17 32.32C15.45 32.11 14.79 32.31 14.18 32.71C13.98 32.84 13.79 32.99 13.58 33.1C12.78 33.53 12.2 33.29 11.92 32.41C11.8 32.08 11.71 31.74 11.61 31.37Z" fill="#FF8C00"/>
4
+ <path d="M35.16 6.17998C35.31 6.27998 35.44 6.35999 35.55 6.45999C35.69 6.57999 35.8 6.56998 35.95 6.44998C36.34 6.12998 36.74 5.81998 37.15 5.51998C37.63 5.16998 38.1 5.15998 38.53 5.44998C38.94 5.72998 39.09 6.20999 38.93 6.77999C38.19 9.51999 37.01 12.07 35.66 14.55C33.77 18.03 31.54 21.27 28.99 24.3C28.9 24.4 28.82 24.5 28.7 24.63C27.17 23.58 25.65 22.53 24.09 21.46C26.72 16.65 29.91 12.28 33.79 8.37998C33.58 8.22998 33.39 8.09998 33.18 7.94998C32.89 8.23998 32.58 8.50998 32.32 8.81998C30.96 10.4 29.61 11.99 28.26 13.58C28.2 13.65 28.16 13.72 28.1 13.79C27.85 14.06 27.48 14.09 27.21 13.88C26.94 13.67 26.88 13.28 27.09 12.99C27.56 12.36 28.04 11.74 28.54 11.14C30.55 8.68999 32.7 6.38998 35.24 4.46998C35.38 4.35998 35.52 4.25998 35.67 4.15998C36 3.93998 36.37 3.98998 36.58 4.26998C36.81 4.57998 36.76 4.94998 36.43 5.19998C36.12 5.44998 35.8 5.67998 35.48 5.91998C35.38 5.98998 35.28 6.06998 35.16 6.17998Z" fill="#FF8C00"/>
5
+ <path d="M27.9 25.55C26.35 27.25 24.74 28.83 22.93 30.19C22.84 30.25 22.66 30.3 22.59 30.26C22.02 29.89 21.46 29.49 20.9 29.11C21.21 27.64 22.66 24.04 23.54 22.55C24.99 23.55 26.43 24.55 27.9 25.55Z" fill="#FF8C00"/>
6
+ <path d="M21.89 31.23C21.37 31.7 20.92 32.12 20.46 32.52C20.27 32.68 20.01 32.77 19.83 32.58C19.71 32.44 19.62 32.16 19.67 32C19.86 31.4 20.11 30.83 20.32 30.29C20.83 30.61 21.32 30.9 21.89 31.23Z" fill="#FF8C00"/>
7
+ </svg>
@@ -458,18 +458,18 @@ Avatar.propTypes = {
458
458
  /** source of file (http:// or https://) */
459
459
  src: PropTypes.string,
460
460
 
461
- /**
462
- * it is used to display the default if there is no src<br />
463
- * if undefined, will display icons available in the icons store
461
+ /**
462
+ * it is used to display the default if there is no src<br />
463
+ * if undefined, will display icons available in the icons store
464
464
  */
465
465
  defaultSrc: PropTypes.string,
466
466
 
467
467
  /** the direction to display more info */
468
468
  direction: PropTypes.oneOf(['top', 'down', 'left', 'right']),
469
469
 
470
- /**
471
- * data to display when hoverAble is true<br />
472
- * data is an object or function return a jsx element
470
+ /**
471
+ * data to display when hoverAble is true<br />
472
+ * data is an object or function return a jsx element
473
473
  */
474
474
  data: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
475
475
 
@@ -485,19 +485,19 @@ Avatar.propTypes = {
485
485
  /** any props else */
486
486
  props: PropTypes.any,
487
487
 
488
- /**
489
- * ref methods
490
- *
491
- * * option(): Gets all UI component properties
492
- * * Returns value - object
493
- * * option(optionName): Gets the value of a single property
494
- * * @param {optionName} - string
495
- * * Returns value - any
496
- * * option(optionName, optionValue): Updates the value of a single property
497
- * * @param {optionName} - string
498
- * * @param {optionValue} - any
499
- * * option(options): Updates the values of several properties
500
- * * @param {options} - object
488
+ /**
489
+ * ref methods
490
+ *
491
+ * * option(): Gets all UI component properties
492
+ * * Returns value - object
493
+ * * option(optionName): Gets the value of a single property
494
+ * * @param {optionName} - string
495
+ * * Returns value - any
496
+ * * option(optionName, optionValue): Updates the value of a single property
497
+ * * @param {optionName} - string
498
+ * * @param {optionValue} - any
499
+ * * option(options): Updates the values of several properties
500
+ * * @param {options} - object
501
501
  */
502
502
  reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
503
503
  current: PropTypes.instanceOf(Element)
@@ -1,7 +1,7 @@
1
1
  /** @jsxRuntime classic */
2
2
 
3
3
  /** @jsx jsx */
4
- import { memo, useRef, forwardRef, useEffect, useMemo, useImperativeHandle } from 'react';
4
+ import { memo, useRef, forwardRef, useMemo, useImperativeHandle } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { jsx, css } from '@emotion/core';
7
7
  import OptionWrapper from '../others/option-wrapper';
@@ -16,18 +16,11 @@ const {
16
16
  } = typography;
17
17
  const {
18
18
  system: {
19
- active,
20
19
  rest,
21
20
  white
22
- },
23
- semantic: {
24
- success,
25
- warning,
26
- danger,
27
- info
28
21
  }
29
22
  } = colors;
30
- const colorMap = new Map([['default', rest], ['primary', active], ['success', success], ['warning', warning], ['danger', danger], ['info', info]]);
23
+ const colorMap = new Map([['default', rest]]);
31
24
  const iconSizeMap = new Map([['medium', 24], ['large', 32], ['giant', 40]]);
32
25
  const dotSizeMap = new Map([['medium', 8], ['large', 10], ['giant', 12]]);
33
26
  const dotIndentMap = new Map([['medium', 4], ['large', 2]]);
@@ -41,15 +34,15 @@ const calDotPos = (anchorOrigin, contentDirection, dotSize, hasContent, size) =>
41
34
  } = anchorOrigin;
42
35
  const dotIndent = hasContent ? dotIndentMap.get(size) || 0 : 0;
43
36
  const verticalCssRight = vertical === 'bottom' ? css`
44
- bottom: ${-dotIndent}px;
45
- ` : css`
46
- top: ${-dotIndent}px;
47
- `;
37
+ bottom: ${-dotIndent}px;
38
+ ` : css`
39
+ top: ${-dotIndent}px;
40
+ `;
48
41
  const verticalCssLeft = vertical === 'bottom' ? css`
49
- bottom: ${-halfDotSize}px;
50
- ` : css`
51
- top: ${-halfDotSize}px;
52
- `;
42
+ bottom: ${-halfDotSize}px;
43
+ ` : css`
44
+ top: ${-halfDotSize}px;
45
+ `;
53
46
 
54
47
  if (contentDirection === 'right') {
55
48
  if (horizontal === 'left') {
@@ -90,7 +83,6 @@ const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
90
83
  style,
91
84
  showZero,
92
85
  invisible,
93
- refs,
94
86
  children,
95
87
  iconProps,
96
88
  ...props
@@ -99,45 +91,13 @@ const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
99
91
  const typographySize = typographySizeMap.get(size);
100
92
  const iconSize = iconSizeMap.get(size);
101
93
  const dotSize = content || content === 0 && showZero ? dotSizeMap.get(size) + 8 : dotSizeMap.get(size);
102
- const dotColor = colorMap.get(color) || colors[color] || color;
94
+ const dotColor = colors[color] || colorMap.get(color) || color;
103
95
  const dotPos = calDotPos(anchorOrigin, !children && name ? 'right' : contentDirection, dotSize, content || content === 0, size);
104
- const BadgeNumber = css`
105
- ${typographySize};
106
- ${flexRow}
107
- ${alignCenter}
108
- ${justifyCenter}
109
- ${flexWrap}
110
- ${borderBox}
111
- ${pointerEventsNone}
112
- ${children || name ? positionAbsolute : positionRelative}
113
- color: ${white};
114
- min-height: ${dotSize}px;
115
- min-width: ${dotSize}px;
116
- background-color: ${dotColor};
117
- border-radius: ${dotSize / 2}px;
118
- padding: 0 4px;
119
- transition: transform 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
120
- ${invisible && 'transform: scale(0) translate(50%, -50%);'};
121
- `;
122
- const BadgeRoot = css`
123
- ${inlineFlex}
124
- ${alignCenter}
125
- ${justifyCenter}
126
- ${positionRelative}
127
- ${borderBox}
128
- ${borderRadius4px}
129
- height: max-content;
130
- min-height: max-content;
131
- width: max-content;
132
- min-width: max-content;
133
- color: ${white};
134
- .css-${BadgeNumber.name} {
135
- ${(children || name) && dotPos}
136
- }
137
- `;
138
- useEffect(() => {
139
- if (refs) refs(ref);
140
- }, []);
96
+
97
+ const _BadgeNumberCSS = BadgeNumberCSS(typographySize, children, name, dotSize, dotColor, invisible);
98
+
99
+ const _BadgeRootCSS = BadgeRootCSS(children, name, dotPos, _BadgeNumberCSS);
100
+
141
101
  useImperativeHandle(reference, () => {
142
102
  const currentRef = ref.current || {};
143
103
  const _instance = {}; // methods
@@ -161,7 +121,7 @@ const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
161
121
  }
162
122
 
163
123
  return jsx("div", {
164
- css: BadgeRoot,
124
+ css: _BadgeRootCSS,
165
125
  ref: ref,
166
126
  className: ['DGN-UI-Badge', className].join(' ').trim().replace(/\s+/g, ' '),
167
127
  style: style,
@@ -169,11 +129,48 @@ const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
169
129
  }, jsx("span", {
170
130
  className: 'DGN-UI-Badge-Children'
171
131
  }, node), content !== undefined && jsx("span", {
172
- css: BadgeNumber,
132
+ css: _BadgeNumberCSS,
173
133
  className: 'DGN-UI-Badge-Dot'
174
134
  }, max && content > max ? max + '+' : content === 0 && !showZero ? null : content));
175
- }, [anchorOrigin, contentDirection, content, name, size, children, max, showZero, invisible, color, style, className]);
135
+ }, [anchorOrigin, contentDirection, content, name, size, children, max, showZero, invisible, color, style, className, iconProps]);
176
136
  }));
137
+
138
+ const BadgeNumberCSS = (typographySize, children, name, dotSize, dotColor, invisible) => css`
139
+ ${typographySize};
140
+ ${flexRow};
141
+ ${alignCenter};
142
+ ${justifyCenter};
143
+ ${flexWrap};
144
+ ${borderBox};
145
+ ${pointerEventsNone};
146
+ ${children || name ? positionAbsolute : positionRelative};
147
+ color: ${white};
148
+ min-height: ${dotSize}px;
149
+ min-width: ${dotSize}px;
150
+ background-color: ${dotColor};
151
+ border-radius: ${dotSize / 2}px;
152
+ padding: 0 4px;
153
+ transition: transform 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
154
+ ${invisible && 'transform: scale(0) translate(50%, -50%);'};
155
+ `;
156
+
157
+ const BadgeRootCSS = (children, name, dotPos, _BadgeNumberCSS) => css`
158
+ ${inlineFlex};
159
+ ${alignCenter};
160
+ ${justifyCenter};
161
+ ${positionRelative};
162
+ ${borderBox};
163
+ ${borderRadius4px};
164
+ color: ${white};
165
+ height: max-content;
166
+ min-height: max-content;
167
+ width: max-content;
168
+ min-width: max-content;
169
+ .css-${_BadgeNumberCSS.name} {
170
+ ${(children || name) && dotPos}
171
+ }
172
+ `;
173
+
177
174
  Badge.defaultProps = {
178
175
  color: 'default',
179
176
  size: 'medium',
@@ -213,11 +210,11 @@ Badge.propTypes = {
213
210
  /** other icon props when use prop name */
214
211
  iconProps: PropTypes.object,
215
212
 
216
- /** size of Badge
217
- *
218
- * * medium (dot 8px, typography p3)
219
- * * large (button 10px, typography p2)
220
- * * giant (button 12px, typography p1)
213
+ /** size of Badge
214
+ *
215
+ * * medium (dot 8px, typography p3)
216
+ * * large (button 10px, typography p2)
217
+ * * giant (button 12px, typography p1)
221
218
  * */
222
219
  size: PropTypes.oneOf(['medium', 'large', 'giant']),
223
220
 
@@ -359,14 +359,14 @@ ButtonIcon.propTypes = {
359
359
  /** custom hover color for button with color 'default' */
360
360
  colorHover: PropTypes.string,
361
361
 
362
- /**
363
- * size of button
364
- *
365
- * * tiny (button 24px, icon 16px)
366
- * * small (button 32px, icon 20px)
367
- * * medium (button 40px, icon 24px)
368
- * * large (button 48px, icon 32px)
369
- * * giant (button 56px, icon 40px)
362
+ /**
363
+ * size of button
364
+ *
365
+ * * tiny (button 24px, icon 16px)
366
+ * * small (button 32px, icon 20px)
367
+ * * medium (button 40px, icon 24px)
368
+ * * large (button 48px, icon 32px)
369
+ * * giant (button 56px, icon 40px)
370
370
  * */
371
371
  size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant']),
372
372
 
@@ -403,19 +403,19 @@ ButtonIcon.propTypes = {
403
403
  /** status loading of button */
404
404
  loading: PropTypes.bool,
405
405
 
406
- /**
407
- * ref methods
408
- *
409
- * * option(): Gets all UI component properties
410
- * * Returns value - object
411
- * * option(optionName): Gets the value of a single property
412
- * * @param {optionName} - string
413
- * * Returns value - any
414
- * * option(optionName, optionValue): Updates the value of a single property
415
- * * @param {optionName} - string
416
- * * @param {optionValue} - any
417
- * * option(options): Updates the values of several properties
418
- * * @param {options} - object
406
+ /**
407
+ * ref methods
408
+ *
409
+ * * option(): Gets all UI component properties
410
+ * * Returns value - object
411
+ * * option(optionName): Gets the value of a single property
412
+ * * @param {optionName} - string
413
+ * * Returns value - any
414
+ * * option(optionName, optionValue): Updates the value of a single property
415
+ * * @param {optionName} - string
416
+ * * @param {optionValue} - any
417
+ * * option(options): Updates the values of several properties
418
+ * * @param {options} - object
419
419
  */
420
420
  reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
421
421
  current: PropTypes.instanceOf(Element)