diginet-core-ui 1.3.65-beta.1 → 1.3.66

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 (40) hide show
  1. package/components/accordion/css.js +6 -6
  2. package/components/accordion/details.js +18 -13
  3. package/components/accordion/group.js +17 -16
  4. package/components/accordion/index.js +22 -17
  5. package/components/accordion/summary.js +32 -55
  6. package/components/avatar/index.js +9 -4
  7. package/components/badge/index.js +9 -4
  8. package/components/button/icon.js +9 -4
  9. package/components/button/index.js +292 -287
  10. package/components/chart/Pie-v2/Sector.js +2 -2
  11. package/components/chip/attach.js +5 -5
  12. package/components/chip/index.js +2 -1
  13. package/components/form-control/attachment/index.js +3 -5
  14. package/components/form-control/calendar/function.js +10 -20
  15. package/components/form-control/calendar/index.js +16 -16
  16. package/components/form-control/checkbox/index.js +1 -1
  17. package/components/form-control/date-picker/index.js +2 -2
  18. package/components/form-control/helper-text/index.js +3 -8
  19. package/components/form-control/input-base/index.js +49 -77
  20. package/components/form-control/money-input/index.js +2 -6
  21. package/components/form-control/number-input/index.js +11 -11
  22. package/components/form-control/number-input/index2.js +4 -13
  23. package/components/form-control/phone-input/index.js +9 -13
  24. package/components/form-control/text-input/index.js +3 -13
  25. package/components/index.js +4 -1
  26. package/components/others/option-wrapper/index.js +27 -21
  27. package/components/paging/page-info.js +88 -262
  28. package/components/paging/page-selector2.js +56 -95
  29. package/components/popover/index.js +6 -8
  30. package/components/progress/circular.js +12 -12
  31. package/components/tooltip/index.js +49 -45
  32. package/components/transfer/index.js +3 -3
  33. package/components/tree-view/index.js +6 -10
  34. package/icons/effect.js +24 -19
  35. package/package.json +31 -56
  36. package/readme.md +15 -0
  37. package/styles/color-helper.js +103 -103
  38. package/utils/error/error.js +2 -2
  39. package/utils/renderIcon.js +5 -5
  40. package/utils/useInput.js +8 -1
@@ -1,6 +1,6 @@
1
1
  import { css } from '@emotion/core';
2
2
  import theme from '../../theme/settings';
3
- import { alignCenter, backgroundTransparent, borderBox, borderRadius4px, breakWord, cursorPointer, displayInlineBlock, flexRow, flexRowReverse, inlineFlex, justifyBetween, justifyCenter, justifyEnd, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, userSelectNone } from '../../styles/general';
3
+ import { alignCenter, alignStart, backgroundTransparent, borderBox, borderRadius4px, breakWord, cursorPointer, displayInlineBlock, flexRow, flexRowReverse, inlineFlex, justifyBetween, justifyCenter, justifyEnd, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, userSelectNone } from '../../styles/general';
4
4
  const {
5
5
  colors: {
6
6
  system: {
@@ -24,13 +24,13 @@ export const SummaryRootCSS = background => css`
24
24
  ${flexRow};
25
25
  ${positionRelative};
26
26
  ${justifyBetween};
27
- ${alignCenter};
27
+ ${alignStart};
28
28
  ${cursorPointer};
29
29
  ${borderBox};
30
30
  ${borderRadius4px};
31
31
  width: 100%;
32
32
  min-height: 56px;
33
- padding: ${spacing([4, 6])};
33
+ padding: ${spacing(4)}px ${spacing(6)}px;
34
34
  ${background && `background-color: ${background === true ? headerbar : theme.colors[background] || background};`};
35
35
  .Accordion-Expand-Icon,
36
36
  .Accordion-Collapse-Icon {
@@ -61,7 +61,7 @@ export const SummaryRootCSS = background => css`
61
61
  ${flexRowReverse};
62
62
  ${justifyEnd};
63
63
  .Accordion-Icon.rotate-able {
64
- margin-right: ${spacing([2])};
64
+ margin-right: ${spacing(2)}px;
65
65
  &.TreeView {
66
66
  transform: rotateZ(-90deg);
67
67
  }
@@ -69,7 +69,7 @@ export const SummaryRootCSS = background => css`
69
69
  }
70
70
  &.end {
71
71
  .Accordion-Icon.rotate-able {
72
- margin-left: ${spacing([2])};
72
+ margin-left: ${spacing(2)}px;
73
73
  &.TreeView {
74
74
  transform: rotateZ(90deg);
75
75
  }
@@ -131,10 +131,10 @@ export const SummaryRootCSS = background => css`
131
131
  ${heading3};
132
132
  ${flexRow};
133
133
  ${positionRelative};
134
+ ${alignCenter};
134
135
  ${breakWord};
135
136
  ${userSelectNone};
136
137
  ${borderBox}
137
- ${alignCenter};
138
138
  color: ${active};
139
139
  width: 100%;
140
140
  min-height: 24px;
@@ -20,14 +20,19 @@ const {
20
20
  const AccordionDetails = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
21
21
  children,
22
22
  className,
23
- id,
24
- style
23
+ style,
24
+ id
25
25
  }, reference) => {
26
26
  const ref = useRef(null);
27
- useImperativeHandle(reference, () => ({
28
- element: ref.current,
29
- instance: {}
30
- }));
27
+ useImperativeHandle(reference, () => {
28
+ const currentRef = ref.current || {};
29
+ const _instance = {}; // methods
30
+
31
+ _instance.__proto__ = {}; // hidden methods
32
+
33
+ currentRef.instance = _instance;
34
+ return currentRef;
35
+ });
31
36
  return useMemo(() => {
32
37
  return jsx("div", {
33
38
  css: DetailsRootCSS,
@@ -49,7 +54,7 @@ const DetailsRootCSS = css`
49
54
  .DGN-UI-Accordion-Details-Content {
50
55
  ${borderBox};
51
56
  ${paragraph1};
52
- padding: ${spacing([0, 6, 4, 6])};
57
+ padding: 0 ${spacing(6)}px ${spacing(4)}px ${spacing(6)}px;
53
58
  color: ${main};
54
59
  &.disabled {
55
60
  ${pointerEventsNone}
@@ -59,17 +64,17 @@ const DetailsRootCSS = css`
59
64
  `;
60
65
  AccordionDetails.defaultProps = {
61
66
  className: '',
62
- id: '',
63
- style: {}
67
+ style: {},
68
+ id: ''
64
69
  };
65
70
  AccordionDetails.propTypes = {
66
71
  /** The content of the component. */
67
72
  children: PropTypes.node,
68
73
 
69
- /** Class for component. */
70
- className: PropTypes.string,
71
-
72
74
  /** Style inline of component. */
73
- style: PropTypes.object
75
+ style: PropTypes.object,
76
+
77
+ /** Class for component. */
78
+ className: PropTypes.string
74
79
  };
75
80
  export default AccordionDetails;
@@ -5,13 +5,9 @@ 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 theme from '../../theme/settings';
9
- const {
10
- spacing
11
- } = theme;
12
8
  const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
13
- children,
14
9
  className,
10
+ children,
15
11
  collapseOther,
16
12
  style
17
13
  }, reference) => {
@@ -30,10 +26,15 @@ const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
30
26
  }
31
27
  };
32
28
 
33
- useImperativeHandle(reference, () => ({
34
- element: ref.current,
35
- instance: {}
36
- }));
29
+ useImperativeHandle(reference, () => {
30
+ const currentRef = ref.current || {};
31
+ const _instance = {}; // methods
32
+
33
+ _instance.__proto__ = {}; // hidden methods
34
+
35
+ currentRef.instance = _instance;
36
+ return currentRef;
37
+ });
37
38
  return useMemo(() => {
38
39
  return jsx("div", {
39
40
  css: AccordionGroupRootCSS,
@@ -55,7 +56,7 @@ const AccordionGroupRootCSS = css`
55
56
  }
56
57
  &.expanding {
57
58
  ${borderRadius4px};
58
- margin: ${spacing([0, 0, 4, 0])};
59
+ margin: 0 0 16px 0;
59
60
  .DGN-UI-Divider {
60
61
  display: none !important;
61
62
  }
@@ -68,7 +69,7 @@ const AccordionGroupRootCSS = css`
68
69
  }
69
70
  &.expanding {
70
71
  ${borderRadius4px};
71
- margin: ${spacing([4, 0, 0, 0])};
72
+ margin: 16px 0 0 0;
72
73
  .DGN-UI-Accordion-Summary {
73
74
  border-radius: 4px 4px 0px 0px;
74
75
  }
@@ -84,7 +85,7 @@ const AccordionGroupRootCSS = css`
84
85
  }
85
86
  &.expanding {
86
87
  ${borderRadius4px};
87
- margin: ${spacing([4, 0])};
88
+ margin: 16px 0;
88
89
  .DGN-UI-Accordion-Summary {
89
90
  border-radius: 4px 4px 0px 0px;
90
91
  }
@@ -115,13 +116,13 @@ AccordionGroup.propTypes = {
115
116
  /** The content of the component. */
116
117
  children: PropTypes.node,
117
118
 
119
+ /** Style inline of component. */
120
+ style: PropTypes.object,
121
+
118
122
  /** Class for component. */
119
123
  className: PropTypes.string,
120
124
 
121
125
  /** If `true`, collapse other when expand */
122
- collapseOther: PropTypes.bool,
123
-
124
- /** Style inline of component. */
125
- style: PropTypes.object
126
+ collapseOther: PropTypes.bool
126
127
  };
127
128
  export default AccordionGroup;
@@ -16,16 +16,16 @@ const {
16
16
  }
17
17
  } = theme;
18
18
  const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
19
- boxShadow,
20
- children,
21
- className,
19
+ id,
22
20
  disabled,
23
21
  expand,
24
22
  expanded,
25
- id,
26
23
  onClick,
27
- onCollapse,
28
24
  onExpand,
25
+ onCollapse,
26
+ boxShadow,
27
+ className,
28
+ children,
29
29
  style
30
30
  }, reference) => {
31
31
  const ref = useRef(null);
@@ -49,17 +49,22 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
49
49
  });
50
50
  };
51
51
 
52
- useImperativeHandle(reference, () => ({
53
- element: ref.current,
54
- instance: {}
55
- }));
52
+ useImperativeHandle(reference, () => {
53
+ const currentRef = ref.current || {};
54
+ const _instance = {}; // methods
55
+
56
+ _instance.__proto__ = {}; // hidden methods
57
+
58
+ currentRef.instance = _instance;
59
+ return currentRef;
60
+ });
56
61
  return useMemo(() => {
57
62
  return jsx("div", {
58
63
  id: id,
59
64
  css: AccordionRootCSS,
60
65
  ref: ref,
61
66
  style: style,
62
- className: ['DGN-UI-Accordion', disabled ? 'disabled' : '', boxShadow === true ? 'boxShadow' : '', expandState ? 'expanding' : '', className].join(' ').trim().replace(/\s+/g, ' ')
67
+ className: ['DGN-UI-Accordion', disabled ? 'disabled' : '', className, boxShadow === true ? 'boxShadow' : '', expandState ? 'expanding' : ''].join(' ').trim().replace(/\s+/g, ' ')
63
68
  }, jsx(AccordionContext.Provider, {
64
69
  value: {
65
70
  expanded,
@@ -101,12 +106,12 @@ Accordion.defaultProps = {
101
106
  style: {}
102
107
  };
103
108
  Accordion.propTypes = {
104
- /** The box-shadow of component. */
105
- boxShadow: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
106
-
107
109
  /** The content of the component (insist <AccordionSummary />, <AccordionDetails />). */
108
110
  children: PropTypes.node,
109
111
 
112
+ /** Style inline of component. */
113
+ style: PropTypes.object,
114
+
110
115
  /** Class for component. */
111
116
  className: PropTypes.string,
112
117
 
@@ -119,13 +124,13 @@ Accordion.propTypes = {
119
124
  /** Expand state of accordion (should use this). */
120
125
  expanded: PropTypes.bool,
121
126
 
122
- /** Callback fired when Accordion is collapsed. */
123
- onCollapse: PropTypes.func,
127
+ /** The box-shadow of component. */
128
+ boxShadow: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
124
129
 
125
130
  /** Callback fired when Accordion is expanded. */
126
131
  onExpand: PropTypes.func,
127
132
 
128
- /** Style inline of component. */
129
- style: PropTypes.object
133
+ /** Callback fired when Accordion is collapsed. */
134
+ onCollapse: PropTypes.func
130
135
  };
131
136
  export default Accordion;
@@ -4,31 +4,20 @@
4
4
  import { memo, useEffect, useRef, useContext, forwardRef, useMemo, useImperativeHandle } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { jsx } from '@emotion/core';
7
+ import { renderIcon } from '../../utils';
7
8
  import { SummaryRootCSS } from './css';
8
9
  import AccordionContext from './context';
9
- import { ButtonIcon, Typography } from '..';
10
- import theme from '../../theme/settings';
11
- const {
12
- colors: {
13
- system: {
14
- active,
15
- disabled: systemDisabled
16
- }
17
- },
18
- spacing
19
- } = theme;
20
10
  const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
21
- background,
22
- children,
23
- className,
24
- collapseIcon,
11
+ id,
25
12
  expandIcon,
13
+ collapseIcon,
26
14
  expandIconAt,
27
- expandIconProps,
28
- id,
15
+ background,
16
+ className,
29
17
  onClick,
30
- style,
31
- title
18
+ children,
19
+ expandIconProps,
20
+ style
32
21
  }, reference) => {
33
22
  const {
34
23
  expanded,
@@ -113,10 +102,15 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
113
102
  showHideDetailHandler('hide');
114
103
  }
115
104
  }, [expandState]);
116
- useImperativeHandle(reference, () => ({
117
- element: ref.current,
118
- instance: {}
119
- }));
105
+ useImperativeHandle(reference, () => {
106
+ const currentRef = ref.current || {};
107
+ const _instance = {}; // methods
108
+
109
+ _instance.__proto__ = {}; // hidden methods
110
+
111
+ currentRef.instance = _instance;
112
+ return currentRef;
113
+ });
120
114
  return useMemo(() => {
121
115
  return jsx("div", {
122
116
  id: id,
@@ -128,27 +122,16 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
128
122
  className: ['DGN-UI-Accordion-Summary', disabled ? 'disabled' : '', expandIcon ? expandIconAt : '', expandState ? 'expanding' : '', className].join(' ').trim().replace(/\s+/g, ' ')
129
123
  }, jsx("div", {
130
124
  className: 'DGN-UI-Accordion-Summary-Content'
131
- }, jsx(Typography, {
132
- type: 'h3',
133
- lineClamp: 2,
134
- color: disabled ? systemDisabled : active,
135
- style: {
136
- marginRight: children && title ? spacing([4]) : 0
137
- }
138
- }, title || ''), children), !!expandIcon && jsx("div", {
125
+ }, children), !!expandIcon && jsx("div", {
139
126
  className: 'Accordion-Icon-Root'
140
127
  }, jsx("div", { ...expandIconProps,
141
128
  ref: expandIconRef,
142
129
  className: ['Accordion-Icon', collapseIcon ? '' : 'rotate-able', expandIconProps.className ? expandIconProps.className : ''].join(' ').trim().replace(/\s+/g, ' ')
143
- }, typeof expandIcon === 'string' ? jsx(ButtonIcon, {
144
- viewType: 'ghost',
145
- name: expandIcon,
130
+ }, typeof expandIcon === 'string' ? renderIcon(expandIcon, 'effect', {
146
131
  className: 'Accordion-Expand-Icon'
147
132
  }) : jsx("span", {
148
133
  className: 'Accordion-Expand-Icon effect'
149
- }, expandIcon), !!collapseIcon && (typeof collapseIcon === 'string' ? jsx(ButtonIcon, {
150
- viewType: 'ghost',
151
- name: collapseIcon,
134
+ }, expandIcon), !!collapseIcon && (typeof collapseIcon === 'string' ? renderIcon(collapseIcon, 'effect', {
152
135
  className: 'Accordion-Collapse-Icon'
153
136
  }) : jsx("span", {
154
137
  className: 'Accordion-Collapse-Icon effect'
@@ -156,41 +139,35 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
156
139
  }, [id, expandIcon, expandIconAt, className, background, children, collapseIcon, expandIconProps, style, expandState, disabled]);
157
140
  }));
158
141
  AccordionSummary.defaultProps = {
159
- className: '',
160
- expandIcon: 'ArrowRight',
161
142
  expandIconAt: 'start',
162
143
  expandIconProps: {},
144
+ className: '',
145
+ expandIcon: 'ArrowRight',
163
146
  style: {}
164
147
  };
165
148
  AccordionSummary.propTypes = {
166
- /** Background for label summary. */
167
- background: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
168
-
169
149
  /** The content of the component. */
170
150
  children: PropTypes.node,
171
151
 
152
+ /** Style inline of component. */
153
+ style: PropTypes.object,
154
+
172
155
  /** Class for component. */
173
156
  className: PropTypes.string,
174
157
 
175
- /** Icon display for collapse icon. */
176
- collapseIcon: PropTypes.any,
177
-
178
158
  /** Icon display for expand icon. */
179
159
  expandIcon: PropTypes.any,
180
160
 
161
+ /** Icon display for collapse icon. */
162
+ collapseIcon: PropTypes.any,
163
+
181
164
  /** Position to render icon. */
182
165
  expandIconAt: PropTypes.oneOf(['start', 'end']),
183
166
 
184
- /** Other props of icons. */
185
- expandIconProps: PropTypes.any,
186
-
187
- /** Callback fired when the component is clicked. */
188
- onClick: PropTypes.func,
189
-
190
- /** Style inline of component. */
191
- style: PropTypes.object,
167
+ /** Background for label summary. */
168
+ background: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
192
169
 
193
- /** The title of the component. */
194
- title: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
170
+ /** Other props of icons. */
171
+ expandIconProps: PropTypes.any
195
172
  };
196
173
  export default AccordionSummary;
@@ -241,10 +241,15 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
241
241
  }
242
242
  }
243
243
  }, [src]);
244
- useImperativeHandle(reference, () => ({
245
- element: ref.current,
246
- instance: {}
247
- }));
244
+ useImperativeHandle(reference, () => {
245
+ const currentRef = ref.current || {};
246
+ const _instance = {}; // methods
247
+
248
+ _instance.__proto__ = {}; // hidden methods
249
+
250
+ currentRef.instance = _instance;
251
+ return currentRef;
252
+ });
248
253
  return useMemo(() => {
249
254
  return jsx(Fragment, null, jsx("div", {
250
255
  css: _AvatarContainerCSS,
@@ -98,10 +98,15 @@ const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
98
98
 
99
99
  const _BadgeRootCSS = BadgeRootCSS(children, name, dotPos, _BadgeNumberCSS);
100
100
 
101
- useImperativeHandle(reference, () => ({
102
- element: ref.current,
103
- instance: {}
104
- }));
101
+ useImperativeHandle(reference, () => {
102
+ const currentRef = ref.current || {};
103
+ const _instance = {}; // methods
104
+
105
+ _instance.__proto__ = {}; // hidden methods
106
+
107
+ currentRef.instance = _instance;
108
+ return currentRef;
109
+ });
105
110
  return useMemo(() => {
106
111
  let node = children;
107
112
 
@@ -104,10 +104,15 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
104
104
 
105
105
  const _ButtonRootCSS = ButtonRootCSS(circular, size, width, _width, height, _height, buttonSize, iconSize, colorHover, color, _color, name);
106
106
 
107
- useImperativeHandle(reference, () => ({
108
- element: ref.current,
109
- instance: {}
110
- }));
107
+ useImperativeHandle(reference, () => {
108
+ const currentRef = ref.current || {};
109
+ const _instance = {}; // methods
110
+
111
+ _instance.__proto__ = {}; // hidden methods
112
+
113
+ currentRef.instance = _instance;
114
+ return currentRef;
115
+ });
111
116
 
112
117
  const _onClick = event => {
113
118
  event.persist();