diginet-core-ui 1.3.69-beta.9 → 1.3.70

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 (33) hide show
  1. package/components/avatar/index.js +4 -12
  2. package/components/badge/index.js +4 -12
  3. package/components/button/icon.js +4 -12
  4. package/components/button/index.js +12 -25
  5. package/components/card/body.js +4 -12
  6. package/components/card/extra.js +4 -12
  7. package/components/card/footer.js +4 -12
  8. package/components/card/header.js +4 -12
  9. package/components/card/index.js +4 -12
  10. package/components/chip/index.js +185 -154
  11. package/components/form-control/checkbox/index.js +16 -5
  12. package/components/form-control/date-picker/index.js +2 -4
  13. package/components/form-control/label/index.js +18 -29
  14. package/components/form-control/money-input/index.js +11 -11
  15. package/components/form-control/number-input/index2.js +18 -18
  16. package/components/form-control/phone-input/index.js +7 -7
  17. package/components/form-control/radio/index.js +15 -4
  18. package/components/form-control/text-input/index.js +212 -139
  19. package/components/form-control/toggle/index.js +17 -5
  20. package/components/others/option-wrapper/index.js +18 -5
  21. package/components/paging/page-info.js +10 -22
  22. package/components/paging/page-selector2.js +10 -22
  23. package/components/popover/body.js +4 -12
  24. package/components/popover/footer.js +4 -12
  25. package/components/popover/header.js +4 -12
  26. package/components/popover/index.js +104 -196
  27. package/components/status/index.js +4 -12
  28. package/components/tab/tab-header.js +7 -14
  29. package/components/tab/tab.js +1 -1
  30. package/components/tooltip/index.js +4 -10
  31. package/icons/effect.js +21 -29
  32. package/package.json +31 -59
  33. package/readme.md +9 -0
@@ -51,7 +51,6 @@ const checkFileType = (type, matchType) => {
51
51
  };
52
52
 
53
53
  const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
54
- action = {},
55
54
  src,
56
55
  defaultSrc,
57
56
  outlined,
@@ -242,17 +241,10 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
242
241
  }
243
242
  }
244
243
  }, [src]);
245
- useImperativeHandle(reference, () => {
246
- const currentRef = ref.current || {};
247
- currentRef.element = ref.current;
248
- const _instance = { ...action
249
- }; // methods
250
-
251
- _instance.__proto__ = {}; // hidden methods
252
-
253
- currentRef.instance = _instance;
254
- return currentRef;
255
- });
244
+ useImperativeHandle(reference, () => ({
245
+ element: ref.current,
246
+ instance: {}
247
+ }));
256
248
  return useMemo(() => {
257
249
  return jsx(Fragment, null, jsx("div", {
258
250
  css: _AvatarContainerCSS,
@@ -72,7 +72,6 @@ const calDotPos = (anchorOrigin, contentDirection, dotSize, hasContent, size) =>
72
72
  };
73
73
 
74
74
  const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
75
- action = {},
76
75
  anchorOrigin,
77
76
  contentDirection,
78
77
  content,
@@ -99,17 +98,10 @@ const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
99
98
 
100
99
  const _BadgeRootCSS = BadgeRootCSS(children, name, dotPos, _BadgeNumberCSS);
101
100
 
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
- });
101
+ useImperativeHandle(reference, () => ({
102
+ element: ref.current,
103
+ instance: {}
104
+ }));
113
105
  return useMemo(() => {
114
106
  let node = children;
115
107
 
@@ -71,7 +71,6 @@ const renderIconLoading = iconSize => {
71
71
  };
72
72
 
73
73
  const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
74
- action = {},
75
74
  viewType,
76
75
  color,
77
76
  size,
@@ -105,17 +104,10 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
105
104
 
106
105
  const _ButtonRootCSS = ButtonRootCSS(circular, size, width, _width, height, _height, buttonSize, iconSize, colorHover, color, _color, name);
107
106
 
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
- });
107
+ useImperativeHandle(reference, () => ({
108
+ element: ref.current,
109
+ instance: {}
110
+ }));
119
111
 
120
112
  const _onClick = event => {
121
113
  event.persist();
@@ -12,7 +12,6 @@ import Ripple from './ripple-effect';
12
12
  import CircularProgress from '../progress/circular';
13
13
  import Icon from '../../icons';
14
14
  import { flexRow, alignCenter, justifyCenter, positionRelative, borderRadius4px, borderBox, noPadding, noBorder, cursorPointer, overflowHidden, pointerEventsNone, outlineNone, userSelectNone, backgroundTransparent, inlineFlex, noMargin } from '../../styles/general';
15
- import { classNames } from '../../utils';
16
15
  import theme from '../../theme/settings';
17
16
  const {
18
17
  colors: {
@@ -34,8 +33,7 @@ const {
34
33
  },
35
34
  typography: {
36
35
  uppercase
37
- },
38
- spacing
36
+ }
39
37
  } = theme;
40
38
  export const getRippleColor = (color, viewType, colors) => {
41
39
  if (!isColor(color) && !isColorName(color)) {
@@ -85,13 +83,12 @@ export const getClassNameFromColor = color => {
85
83
  return !isColor(color) && !isColorName(color) ? color : 'custom-color';
86
84
  };
87
85
  const colorMap = new Map([['primary', active], ['success', success], ['warning', warning], ['danger', danger], ['info', info]]);
88
- const iconSizeMap = new Map([['tiny', spacing([4])], ['small', spacing([5])], ['medium', spacing([6])], ['large', spacing([8])], ['giant', spacing([10])]]);
89
- const paddingSizeMap = new Map([['tiny', spacing([1, 2])], ['small', spacing([1.5, 3])], ['medium', spacing([2, 4])], ['large', spacing([2, 5])], ['giant', spacing([2, 6])]]);
90
- const outlinedPaddingSizeMap = new Map([['tiny', spacing([0.75, 1.75])], ['small', spacing([1.25, 2.75])], ['medium', spacing([1.75, 3.75])], ['large', spacing([1.75, 4.75])], ['giant', spacing([1.75, 5.75])]]);
86
+ const iconSizeMap = new Map([['tiny', '16px'], ['small', '20px'], ['medium', '24px'], ['large', '32px'], ['giant', '40px']]);
87
+ const paddingSizeMap = new Map([['tiny', '4px 8px'], ['small', '6px 12px'], ['medium', '8px 16px'], ['large', '8px 20px'], ['giant', '8px 24px']]);
88
+ const outlinedPaddingSizeMap = new Map([['tiny', '3px 7px'], ['small', '5px 11px'], ['medium', '7px 15px'], ['large', '7px 19px'], ['giant', '7px 23px']]);
91
89
  const iconMarginSizeMap = new Map([['tiny', '4px'], ['small', '4px'], ['medium', '4px'], ['large', '6px'], ['giant', '8px']]);
92
90
  const typographySizeMap = new Map([['tiny', 'heading5'], ['small', 'heading5'], ['medium', 'heading4'], ['large', 'heading2'], ['giant', 'heading1']]);
93
91
  const minHeightSizeMap = new Map([['tiny', '24px'], ['small', '32px'], ['medium', '40px'], ['large', '48px'], ['giant', '56px']]);
94
- const minHeightSizeLinkMap = new Map([['tiny', '16px'], ['small', '20px'], ['medium', '24px'], ['large', '32px'], ['giant', '40px']]);
95
92
  const alphaArr = {
96
93
  hover: 0.1,
97
94
  focus: 0.2,
@@ -99,7 +96,6 @@ const alphaArr = {
99
96
  };
100
97
  const alphaLoading = 0.2;
101
98
  const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
102
- action = {},
103
99
  children,
104
100
  className,
105
101
  color,
@@ -125,23 +121,15 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
125
121
  const typographySize = typographySizeMap.get(size);
126
122
  const iconMarginSize = iconMarginSizeMap.get(size);
127
123
  const minHeightSize = minHeightSizeMap.get(size);
128
- const minHeightSizeLink = minHeightSizeLinkMap.get(size);
129
124
 
130
125
  const _ButtonText = ButtonText(loading, iconMarginSize);
131
126
 
132
- const _ButtonRoot = ButtonRoot(viewType, size, paddingSize, minHeightSize, minHeightSizeLink, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color);
133
-
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
127
+ const _ButtonRoot = ButtonRoot(viewType, size, paddingSize, minHeightSize, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color);
141
128
 
142
- currentRef.instance = _instance;
143
- return currentRef;
144
- });
129
+ useImperativeHandle(reference, () => ({
130
+ element: ref.current,
131
+ instance: {}
132
+ }));
145
133
  const StartIcon = useMemo(() => {
146
134
  let node = startIcon;
147
135
 
@@ -231,7 +219,7 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
231
219
  onClick: _onClick,
232
220
  id: id,
233
221
  type: type,
234
- className: classNames('DGN-UI-Button', viewType, getClassNameFromColor(color), size, loading && 'button--loading', disabled && 'button--disabled', className),
222
+ className: ['DGN-UI-Button', viewType, getClassNameFromColor(color), size, loading && 'button--loading', disabled && 'button--disabled', className].join(' ').trim().replace(/\s+/g, ' '),
235
223
  ...props
236
224
  }, start, jsx(Typography, {
237
225
  css: _ButtonText,
@@ -240,7 +228,7 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
240
228
  }, children || label), end && end, !disabled && !loading && viewType !== 'link' && jsx(Ripple, {
241
229
  color: getRippleColor(color, viewType, allColors)
242
230
  }));
243
- }, [children, className, color, disabled, endIcon, id, label, loading, onClick, size, startIcon, type, viewType]);
231
+ }, [size, viewType, color, disabled, onClick, loading, startIcon, endIcon, label, type, className, children, id]);
244
232
  }));
245
233
  const ButtonIcon = css`
246
234
  ${flexRow};
@@ -256,7 +244,7 @@ const ButtonText = (loading, iconMarginSize) => css`
256
244
  margin: 0 ${loading ? iconMarginSize : 0};
257
245
  `;
258
246
 
259
- const ButtonRoot = (viewType, size, paddingSize, minHeightSize, minHeightSizeLink, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color) => css`
247
+ const ButtonRoot = (viewType, size, paddingSize, minHeightSize, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color) => css`
260
248
  ${inlineFlex};
261
249
  ${alignCenter};
262
250
  ${justifyCenter};
@@ -425,7 +413,6 @@ const ButtonRoot = (viewType, size, paddingSize, minHeightSize, minHeightSizeLin
425
413
  }
426
414
  }
427
415
  &.link {
428
- min-height: ${minHeightSizeLink};
429
416
  ${backgroundTransparent};
430
417
  ${noBorder};
431
418
  ${noPadding};
@@ -6,7 +6,6 @@ import PropTypes from 'prop-types';
6
6
  import { jsx } from '@emotion/core';
7
7
  import OptionWrapper from '../others/option-wrapper';
8
8
  const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
9
- action = {},
10
9
  children,
11
10
  className,
12
11
  id,
@@ -14,17 +13,10 @@ const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
14
13
  title
15
14
  }, reference) => {
16
15
  const ref = useRef(null);
17
- useImperativeHandle(reference, () => {
18
- const currentRef = ref.current || {};
19
- currentRef.element = ref.current;
20
- const _instance = { ...action
21
- }; // methods
22
-
23
- _instance.__proto__ = {}; // hidden methods
24
-
25
- currentRef.instance = _instance;
26
- return currentRef;
27
- });
16
+ useImperativeHandle(reference, () => ({
17
+ element: ref.current,
18
+ instance: {}
19
+ }));
28
20
  return useMemo(() => {
29
21
  return jsx("div", {
30
22
  id: id,
@@ -6,7 +6,6 @@ import PropTypes from 'prop-types';
6
6
  import { jsx } from '@emotion/core';
7
7
  import OptionWrapper from '../others/option-wrapper';
8
8
  const CardExtra = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
9
- action = {},
10
9
  children,
11
10
  className,
12
11
  id,
@@ -14,17 +13,10 @@ const CardExtra = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
14
13
  title
15
14
  }, reference) => {
16
15
  const ref = useRef(null);
17
- useImperativeHandle(reference, () => {
18
- const currentRef = ref.current || {};
19
- currentRef.element = ref.current;
20
- const _instance = { ...action
21
- }; // methods
22
-
23
- _instance.__proto__ = {}; // hidden methods
24
-
25
- currentRef.instance = _instance;
26
- return currentRef;
27
- });
16
+ useImperativeHandle(reference, () => ({
17
+ element: ref.current,
18
+ instance: {}
19
+ }));
28
20
  return useMemo(() => {
29
21
  return jsx("div", {
30
22
  id: id,
@@ -6,7 +6,6 @@ import PropTypes from 'prop-types';
6
6
  import { jsx } from '@emotion/core';
7
7
  import OptionWrapper from '../others/option-wrapper';
8
8
  const CardFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
9
- action = {},
10
9
  children,
11
10
  className,
12
11
  id,
@@ -14,17 +13,10 @@ const CardFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
14
13
  title
15
14
  }, reference) => {
16
15
  const ref = useRef(null);
17
- useImperativeHandle(reference, () => {
18
- const currentRef = ref.current || {};
19
- currentRef.element = ref.current;
20
- const _instance = { ...action
21
- }; // methods
22
-
23
- _instance.__proto__ = {}; // hidden methods
24
-
25
- currentRef.instance = _instance;
26
- return currentRef;
27
- });
16
+ useImperativeHandle(reference, () => ({
17
+ element: ref.current,
18
+ instance: {}
19
+ }));
28
20
  return useMemo(() => {
29
21
  return jsx("div", {
30
22
  id: id,
@@ -7,7 +7,6 @@ import { jsx } from '@emotion/core';
7
7
  import OptionWrapper from '../others/option-wrapper';
8
8
  import Typography from '../typography';
9
9
  const CardHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
10
- action = {},
11
10
  children,
12
11
  className,
13
12
  id,
@@ -15,17 +14,10 @@ const CardHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
15
14
  title
16
15
  }, reference) => {
17
16
  const ref = useRef(null);
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
- });
17
+ useImperativeHandle(reference, () => ({
18
+ element: ref.current,
19
+ instance: {}
20
+ }));
29
21
  return useMemo(() => {
30
22
  return jsx("div", {
31
23
  id: id,
@@ -23,7 +23,6 @@ const {
23
23
  spacing
24
24
  } = theme;
25
25
  const Card = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
26
- action = {},
27
26
  body: bodyProp,
28
27
  bodyStyle,
29
28
  children,
@@ -45,17 +44,10 @@ const Card = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
45
44
 
46
45
  const _CardCSS = CardCSS(width, height, headerDivider, footerDivider, dividerColor);
47
46
 
48
- useImperativeHandle(reference, () => {
49
- const currentRef = ref.current || {};
50
- currentRef.element = ref.current;
51
- const _instance = { ...action
52
- }; // methods
53
-
54
- _instance.__proto__ = {}; // hidden methods
55
-
56
- currentRef.instance = _instance;
57
- return currentRef;
58
- });
47
+ useImperativeHandle(reference, () => ({
48
+ element: ref.current,
49
+ instance: {}
50
+ }));
59
51
  const head = header || title ? jsx(CardHeader, {
60
52
  className: (className === null || className === void 0 ? void 0 : className.header) || '',
61
53
  style: headerStyle,