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
@@ -8,7 +8,29 @@ import { getGlobal } from '../../../global';
8
8
  import locale from '../../../locale';
9
9
  import theme from '../../../theme/settings';
10
10
  import { date as moment } from '../../../utils';
11
- import { typography } from "../../../styles/typography";
11
+ import { color as colors } from '../../../styles/colors';
12
+ import { typography } from '../../../styles/typography';
13
+ import { alignCenter, border, borderBox, borderRadius4px, cursorPointer, flexCol, flexRow, inlineFlex, justifyBetween, pointerEventsNone, positionAbsolute, positionRelative, textCenter, userSelectNone } from '../../../styles/general';
14
+ const {
15
+ heading6
16
+ } = typography;
17
+ const {
18
+ system: {
19
+ active,
20
+ white
21
+ },
22
+ fill: {
23
+ hover: fillHover,
24
+ focus: fillFocus,
25
+ pressed: fillPressed
26
+ },
27
+ text: {
28
+ main,
29
+ normal_label
30
+ },
31
+ danger8,
32
+ info8
33
+ } = colors;
12
34
  /**
13
35
  * START STYLE
14
36
  */
@@ -21,39 +43,36 @@ import { typography } from "../../../styles/typography";
21
43
  */
22
44
 
23
45
  const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) => css`
24
- background-color: ${theme.colors.white};
25
- border-radius : ${theme.border.radius};
46
+ ${borderRadius4px}
47
+ ${borderBox}
48
+ ${flexCol}
49
+ background-color: ${white};
26
50
  box-shadow : ${boxShadow ? theme.boxShadows.large : 'none'};
27
- box-sizing : border-box;
28
- display : flex;
29
- flex-direction : column;
30
51
  max-width : 400px;
31
52
  min-width : 260px;
32
53
  width : 100%;
33
54
  .${unique.navigator.navigator} {
34
- display : flex;
35
- flex-direction : row;
55
+ ${flexRow}
56
+ ${justifyBetween}
36
57
  height : 28px;
37
- justify-content: space-between;
38
58
  margin : 0px 14px;
39
59
  margin-top : 14px;
40
60
  max-width : 400px;
41
61
  width : calc(100% - 28px);
42
62
  .${unique.navigator.around} {
43
- display : flex;
44
- flex-direction: row;
63
+ ${flexRow}
64
+ ${userSelectNone}
45
65
  height : 28px;
46
- user-select : none;
47
66
  width : 64px;
48
67
  }
49
68
  .${unique.navigator.center} {
50
- align-items: center;
51
- display : inline-flex;
69
+ ${inlineFlex}
70
+ ${alignCenter}
71
+ ${textCenter}
72
+ ${userSelectNone}
52
73
  height : 28px;
53
74
  margin : 0 4px;
54
75
  min-width : 150px;
55
- text-align : center;
56
- user-select: none;
57
76
  width : 100%;
58
77
  button {
59
78
  height: 28px;
@@ -68,11 +87,11 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
68
87
  margin: 0 2px;
69
88
  width : 28px;
70
89
  svg, path, g {
71
- pointer-events: none;
90
+ ${pointerEventsNone}
72
91
  }
73
92
  }
74
93
  .${unique.table.container} {
75
- display: flex;
94
+ ${flexRow}
76
95
  margin : 10px 0;
77
96
  margin-top: 6px;
78
97
  width : 100%;
@@ -84,46 +103,48 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
84
103
  table-layout : fixed;
85
104
  width : calc(100% - 32px);
86
105
  .${unique.table.data} {
87
- color : ${theme.colors.input};
88
- cursor : pointer;
106
+ ${cursorPointer}
107
+ ${positionRelative}
108
+ ${textCenter}
109
+ ${userSelectNone}
110
+ color : ${main};
89
111
  height : 24px;
90
112
  min-width : 24px;
91
113
  padding : 1px;
92
- position : relative;
93
- text-align : center;
94
- user-select: none;
95
114
  &:nth-of-type(7n - 1) {
96
- color: ${theme.colors.info8} !important;
115
+ color: ${info8} !important;
97
116
  }
98
117
  &:nth-of-type(7n) {
99
- color: ${theme.colors.danger8} !important;
118
+ color: ${danger8} !important;
100
119
  }
101
120
  &.next_month, &.previous_month, &.${unique.day.limit} {
102
- cursor : default;
103
121
  opacity : 0.25;
104
- pointer-events: none;
122
+ }
123
+ &.${unique.day.limit} {
124
+ ${pointerEventsNone}
125
+ cursor: default;
105
126
  }
106
127
  &:hover {
107
128
  span.${unique.day.day} {
108
- background-color: ${theme.colors.hover};
129
+ background-color: ${fillHover};
109
130
  }
110
131
  }
111
132
  ${onClickActive ? `&:active {
112
133
  span.${unique.day.day} {
113
- background-color: ${theme.colors.blue6};
134
+ background-color: ${fillPressed};
114
135
  }
115
136
  }` : ''}
116
137
  &.${unique.day.active} {
117
138
  span.${unique.day.day} {
118
- background-color: ${theme.colors.focus};
119
- ${typography.heading5};
139
+ ${heading6};
140
+ background-color: ${fillFocus};
120
141
  }
121
142
  }
122
143
  &.${unique.day.today} {
123
144
  span {
124
- border : ${theme.border.style} 1px ${theme.colors.primary};
125
- box-sizing : border-box;
126
- ${typography.heading5}
145
+ ${heading6}
146
+ ${borderBox}
147
+ ${border(1, active)}
127
148
  /* text-decoration-line : underline;
128
149
  text-decoration-thickness: 2px;
129
150
  text-underline-offset : 1px */
@@ -132,13 +153,13 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
132
153
  &.${unique.day.between} {
133
154
  opacity: 1;
134
155
  &::before{
135
- background-color: ${theme.colors.hover};
156
+ background-color: ${fillHover};
136
157
  }
137
158
  }
138
159
  &.${unique.day.from} {
139
160
  opacity: 1;
140
161
  &::before{
141
- background-color : ${theme.colors.hover};
162
+ background-color : ${fillHover};
142
163
  border-bottom-left-radius: 12px;
143
164
  border-top-left-radius : 12px;
144
165
  left : calc((100% - 24px)/2);
@@ -147,31 +168,31 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
147
168
  &.${unique.day.to} {
148
169
  opacity: 1;
149
170
  &::before{
150
- background-color : ${theme.colors.hover};
171
+ background-color : ${fillHover};
151
172
  border-bottom-right-radius: 12px;
152
173
  border-top-right-radius : 12px;
153
174
  right : calc((100% - 24px)/2);
154
175
  }
155
176
  }
156
177
  ::before {
157
- position: absolute;
178
+ ${positionAbsolute}
158
179
  inset: 1px -2px;
159
180
  content: '';
160
181
  }
161
182
  }
162
183
  .${unique.table.header} {
163
- color : ${theme.colors.label};
184
+ ${userSelectNone}
185
+ ${textCenter}
186
+ color : ${normal_label};
164
187
  height : 24px;
165
188
  min-width : 24px;
166
189
  padding : 0;
167
190
  padding-bottom: 6px;
168
- user-select : none;
169
- text-align : center;
170
191
  &:nth-of-type(6) {
171
- color: ${theme.colors.info8} !important;
192
+ color: ${info8} !important;
172
193
  }
173
194
  &:nth-of-type(7) {
174
- color: ${theme.colors.danger8} !important;
195
+ color: ${danger8} !important;
175
196
  }
176
197
  }
177
198
  }
@@ -200,7 +221,7 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
200
221
  margin: 0 2px;
201
222
  width : 24px;
202
223
  svg, path, g {
203
- pointer-events: none;
224
+ ${pointerEventsNone}
204
225
  }
205
226
  }
206
227
  }
@@ -469,7 +490,8 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
469
490
  tableData.push(jsx("td", {
470
491
  key: `previous_month-${prevDate - i + 1}`,
471
492
  "data-time": Date.parse(day) - (displayAnotherMonth ? 0 : 1),
472
- className: `${[className.table.data, 'previous_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active)].join(' ')}`
493
+ className: `${[className.table.data, 'previous_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit)].join(' ')}`,
494
+ onClick: onTableDataClick
473
495
  }, jsx(Typography, { ...typographyProps(className.day.day)
474
496
  }, displayAnotherMonth ? prevDate - i + 1 : '')));
475
497
  }
@@ -498,7 +520,8 @@ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTa
498
520
  tableData.push(jsx("td", {
499
521
  key: `next_month-${i + 1}`,
500
522
  "data-time": Date.parse(day) + (displayAnotherMonth ? 0 : 1),
501
- className: `${[className.table.data, 'next_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active)].join(' ')}`
523
+ className: `${[className.table.data, 'next_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit)].join(' ')}`,
524
+ onClick: onTableDataClick
502
525
  }, jsx(Typography, { ...typographyProps(className.day.day)
503
526
  }, displayAnotherMonth ? i + 1 : '')));
504
527
  }
@@ -4,8 +4,7 @@
4
4
  import { css, jsx } from '@emotion/core';
5
5
  import PropTypes from 'prop-types';
6
6
  import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
7
- import theme from '../../../theme/settings';
8
- import { date as moment, randomString } from '../../../utils';
7
+ import { date as moment } from '../../../utils';
9
8
  import { isAfterLimit, isBeforeLimit, onUpdateCalendar, renderHeader, renderNavigator, isValidDate, generateCalendarCSS } from './function';
10
9
  const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
11
10
  actions,
@@ -98,7 +97,17 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
98
97
  node.classList.add(unique.day.active);
99
98
  const timeStamp = Number(node.dataset.time);
100
99
  const objNewDate = new Date(timeStamp);
100
+
101
+ const _navigatorValue = new Date(navigatorValue.current);
102
+
103
+ const objNewDateMonth = objNewDate.getMonth() + 1;
104
+ const objNewDateYear = objNewDate.getFullYear();
105
+ const navigatorMonth = _navigatorValue.getMonth() + 1;
106
+
107
+ const navigatorYear = _navigatorValue.getFullYear();
108
+
101
109
  onUpdateActiveValue(objNewDate);
110
+ if (objNewDateMonth > navigatorMonth || objNewDateYear > navigatorYear) setNextMonth();else if (objNewDateMonth < navigatorMonth || objNewDateYear < navigatorYear) setPrevMonth();
102
111
  !!onClick && onClick({
103
112
  value: objNewDate
104
113
  });
@@ -208,7 +217,7 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
208
217
  */
209
218
 
210
219
  return jsx("div", { ...props,
211
- className: [unique.container, className].join(' '),
220
+ className: [unique.container, className].join(' ').trim().replace(/\s+/g, ' '),
212
221
  css: generateCalendarCSS(unique),
213
222
  ref: ref
214
223
  }, renderNavigator(unique, navigatorRefs, setPrevYear, setPrevMonth, setNextMonth, setNextYear), tableMemo, actions);
@@ -1,14 +1,16 @@
1
1
  /** @jsxRuntime classic */
2
2
 
3
3
  /** @jsx jsx */
4
+ import { forwardRef, memo, useImperativeHandle, useLayoutEffect, useRef } from 'react';
4
5
  import { css, jsx } from '@emotion/core';
5
6
  import PropTypes from 'prop-types';
6
- import { Children, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react';
7
- import theme from '../../../theme/settings';
8
- import { typography } from "../../../styles/typography";
7
+ import { displayBlock, pointerEventsNone, positionRelative, userSelectNone } from '../../../styles/general';
8
+ import { color as colors } from '../../../styles/colors';
9
9
  const {
10
- colors
11
- } = theme;
10
+ semantic: {
11
+ danger
12
+ }
13
+ } = colors;
12
14
  const Control = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
13
15
  children,
14
16
  className,
@@ -18,26 +20,10 @@ const Control = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
18
20
  ...props
19
21
  }, reference) => {
20
22
  const ref = useRef(null);
21
- useImperativeHandle(reference, () => ref.current);
22
23
  const classes = {
23
24
  disabled: 'DGN-UI-Control-disabled',
24
25
  error: 'DGN-UI-Control-error'
25
26
  };
26
- const controlRootCSS = css`
27
- ${typography.paragraph3};
28
- margin-bottom: 20px;
29
- position : relative;
30
- &.${classes.disabled} {
31
- pointer-events: none;
32
- user-select : none;
33
- }
34
- &.${classes.error} {
35
- * :not(label) {
36
- color: ${colors.danger};
37
- }
38
- }
39
-
40
- `;
41
27
  useLayoutEffect(() => {
42
28
  if (disabled) {
43
29
  ref.current.classList.add(classes.disabled);
@@ -59,15 +45,41 @@ const Control = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
59
45
  }
60
46
  };
61
47
  }, [disabled, error]);
48
+ useImperativeHandle(reference, () => {
49
+ const currentRef = ref.current || {};
50
+ const _instance = {}; // methods
51
+
52
+ _instance.__proto__ = {}; // hidden methods
53
+
54
+ currentRef.instance = _instance;
55
+ return currentRef;
56
+ });
62
57
  return jsx("div", { ...props,
63
- className: ['DGN-UI-Control', className].join(' '),
64
- css: controlRootCSS,
58
+ className: ['DGN-UI-Control', className].join(' ').trim().replace(/\s+/g, ' '),
59
+ css: controlRootCSS(classes),
65
60
  style: style,
66
61
  ref: ref
67
62
  }, children);
68
63
  }));
64
+
65
+ const controlRootCSS = classes => css`
66
+ ${displayBlock}
67
+ ${positionRelative}
68
+ margin-bottom: 20px;
69
+ &.${classes.disabled} {
70
+ ${pointerEventsNone}
71
+ ${userSelectNone}
72
+ }
73
+ &.${classes.error} {
74
+ * :not(label) {
75
+ color: ${danger};
76
+ }
77
+ }
78
+ `;
79
+
69
80
  Control.defaultProps = {
70
81
  className: '',
82
+ style: {},
71
83
  disabled: false,
72
84
  error: ''
73
85
  };
@@ -90,21 +90,22 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
90
90
  const confirmText = getGlobal(['confirm']);
91
91
  const cancelText = getGlobal(['cancel']);
92
92
  const iconAreaCSS = css`
93
- align-items : center;
94
- color : inherit;
95
- display : flex;
96
- .${unique.icon} {
97
- cursor : pointer;
98
- opacity : 0;
99
- transition : display 50ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, opacity 300ms cubic-bezier(0.4, 0, 0.2, 1) 50ms;
100
- display : none;
101
- will-change: display, opacity;
102
- }
103
- .${unique.icon}-accept {
104
- opacity : 1;
105
- display: block;
106
- }
107
- `;
93
+ align-items: center;
94
+ color: inherit;
95
+ display: flex;
96
+ .${unique.icon} {
97
+ cursor: pointer;
98
+ opacity: 0;
99
+ transition: display 50ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
100
+ opacity 300ms cubic-bezier(0.4, 0, 0.2, 1) 50ms;
101
+ display: none;
102
+ will-change: display, opacity;
103
+ }
104
+ .${unique.icon}-accept {
105
+ opacity: 1;
106
+ display: block;
107
+ }
108
+ `;
108
109
  const hiddenStyle = {
109
110
  opacity: 0,
110
111
  display: 'none'
@@ -117,21 +118,22 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
117
118
  const pickerCSS = {
118
119
  backGr: 'background-color: transparent; inset: 0px; pointer-events: auto; position: fixed; z-index: 9001;',
119
120
  picker: (position, left, width) => css`
120
- background-color: ${theme.colors.white};
121
- border-radius : ${theme.border.radius};
122
- height : max-content;
123
- left : ${left}px;
124
- max-width : 400px;
125
- min-width : ${window.innerWidth <= 599 ? 280 : 314}px;
126
- opacity : 0;
127
- position : fixed;
128
- top : ${position.top}px;
129
- transform : scale(0);
130
- transform-origin: ${position.transformOrigin};
131
- transition : opacity 120ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
132
- width : ${width}px;
133
- z-index : 9002;
134
- `,
121
+ background-color: ${theme.colors.white};
122
+ border-radius: ${theme.border.radius};
123
+ height: max-content;
124
+ left: ${left}px;
125
+ max-width: 400px;
126
+ min-width: ${window.innerWidth <= 599 ? 280 : 314}px;
127
+ opacity: 0;
128
+ position: fixed;
129
+ top: ${position.top}px;
130
+ transform: scale(0);
131
+ transform-origin: ${position.transformOrigin};
132
+ transition: opacity 120ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
133
+ transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
134
+ width: ${width}px;
135
+ z-index: 9002;
136
+ `,
135
137
  active: {
136
138
  opacity: 1,
137
139
  transform: 'scale(1)'
@@ -143,10 +145,10 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
143
145
  }
144
146
  };
145
147
  const controlContainerCSS = css`
146
- display : flex;
147
- justify-content: flex-end;
148
- margin : 0 16px 16px;
149
- `;
148
+ display: flex;
149
+ justify-content: flex-end;
150
+ margin: 0 16px 16px;
151
+ `;
150
152
  const buttonProps = {
151
153
  style: {
152
154
  margin: '0 2px',
@@ -267,8 +269,6 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
267
269
  target: null
268
270
  });
269
271
  }
270
-
271
- ;
272
272
  };
273
273
 
274
274
  const onScroll = () => {