diginet-core-ui 1.3.90-beta.1 → 1.3.90-beta.3

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.
@@ -1,36 +1,18 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
-
4
3
  import { css, jsx } from '@emotion/core';
5
- import { render } from 'react-dom';
6
4
  import { Button, ButtonIcon, Typography } from "../..";
7
5
  import { getGlobal } from "../../../global";
8
6
  import locale from "../../../locale";
9
- import theme from "../../../theme/settings";
7
+ import { render } from 'react-dom';
8
+ import { bgColor, border, borderRadius, boxBorder, cursorDefault, cursorPointer, displayFlex, flexCol, flexRow, inset, itemsCenter, justifyBetween, mg, parseHeight, parseMaxWidth, parseMinWidth, parseWidth, pointerEventsNone, positionAbsolute, positionRelative, textCenter, textColor, userSelectNone } from "../../../styles/general";
9
+ import { useTheme } from "../../../theme";
10
10
  import { date as moment } from "../../../utils";
11
- import { useColor as colors } from "../../../theme";
12
- import { typography } from "../../../styles/typography";
13
- import { itemsCenter, border, boxBorder, borderRadius4px, cursorPointer, flexCol, flexRow, displayInlineFlex, justifyBetween, pointerEventsNone, positionAbsolute, positionRelative, textCenter, userSelectNone } from "../../../styles/general";
14
- const {
15
- heading6
16
- } = typography;
17
11
  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
+ boxShadows: {
13
+ large: boxShadowsLarge
14
+ }
15
+ } = useTheme();
34
16
 
35
17
  /**
36
18
  * START STYLE
@@ -43,160 +25,127 @@ const {
43
25
  * @returns
44
26
  */
45
27
  const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) => css`
46
- ${borderRadius4px}
47
- ${boxBorder}
48
- ${flexCol}
49
- background-color: ${white};
50
- box-shadow: ${boxShadow ? theme.boxShadows.large : 'none'};
51
- max-width: 400px;
52
- min-width: 260px;
53
- width: 100%;
28
+ ${displayFlex};
29
+ ${flexCol};
30
+ ${boxBorder};
31
+ ${borderRadius('0px 0px 4px 4px')};
32
+ ${bgColor('system.white')};
33
+ ${parseWidth('100%')};
34
+ ${parseMinWidth(260)};
35
+ ${parseMaxWidth(400)};
36
+ box-shadow: ${boxShadow ? boxShadowsLarge : 'none'};
54
37
  .${unique.navigator.navigator} {
55
- ${flexRow}
56
- ${justifyBetween}
57
- height : 28px;
58
- margin: 0px 14px;
59
- margin-top: 14px;
60
- max-width: 400px;
61
- width: calc(100% - 28px);
38
+ ${displayFlex};
39
+ ${flexRow};
40
+ ${justifyBetween};
41
+ ${itemsCenter};
42
+ ${parseMaxWidth(400)};
43
+ ${mg([4, 4, 0])};
62
44
  .${unique.navigator.around} {
63
- ${flexRow}
64
- ${userSelectNone}
65
- height : 28px;
66
- width: 64px;
45
+ ${displayFlex};
46
+ ${flexRow};
67
47
  }
68
48
  .${unique.navigator.center} {
69
- ${displayInlineFlex}
70
- ${itemsCenter}
71
- ${textCenter}
72
- ${userSelectNone}
73
- height : 28px;
74
- margin: 0 4px;
75
- min-width: 150px;
76
- width: 100%;
77
- button {
78
- height: 28px;
79
- }
80
- .DGN-UI-Typography {
81
- min-width: 150px;
82
- }
83
- }
84
- }
85
- .${unique.icon} {
86
- height: 28px;
87
- margin: 0 2px;
88
- width: 28px;
89
- svg,
90
- path,
91
- g {
92
- ${pointerEventsNone}
49
+ ${parseWidth('100%')};
93
50
  }
94
51
  }
95
52
  .${unique.table.container} {
96
- ${flexRow}
97
- margin : 10px 0;
98
- margin-top: 6px;
99
- width: 100%;
53
+ ${displayFlex};
54
+ ${flexRow};
55
+ ${mg([2, 0])};
100
56
  }
101
57
  .${unique.table.table} {
58
+ ${mg([0, 4])};
59
+ ${parseWidth('calc(100% - 32px)')};
102
60
  border-collapse: separate;
103
- margin: 0 16px;
104
61
  padding: 0;
105
62
  table-layout: fixed;
106
- width: calc(100% - 32px);
107
63
  .${unique.table.data} {
108
- ${cursorPointer}
109
- ${positionRelative}
110
- ${textCenter}
111
- ${userSelectNone}
112
- color : ${main};
113
- height: 24px;
114
- min-width: 24px;
115
- padding: 1px;
116
- &:nth-of-type(7n - 1) {
117
- color: ${info8} !important;
118
- }
119
- &:nth-of-type(7n) {
120
- color: ${danger8} !important;
121
- }
122
- &.next_month,
123
- &.previous_month,
124
- &.${unique.day.limit} {
125
- opacity: 0.25;
126
- }
127
- &.${unique.day.limit} {
128
- ${pointerEventsNone}
129
- cursor: default;
130
- }
131
- &:hover {
132
- span.${unique.day.day} {
133
- background-color: ${fillHover};
64
+ &:not(.empty) {
65
+ ${cursorPointer};
66
+ ${positionRelative};
67
+ ${textCenter};
68
+ ${userSelectNone};
69
+ ${textColor('text.main')};
70
+ &:nth-of-type(7n - 1) {
71
+ ${textColor('info8')};
134
72
  }
135
- }
136
- ${onClickActive ? `&:active {
137
- span.${unique.day.day} {
138
- background-color: ${fillPressed};
139
- }
140
- }` : ''}
141
- &.${unique.day.active} {
142
- span.${unique.day.day} {
143
- ${heading6};
144
- background-color: ${fillFocus};
73
+ &:nth-of-type(7n) {
74
+ ${textColor('danger8')};
145
75
  }
146
- }
147
- &.${unique.day.today} {
148
- span {
149
- ${heading6}
150
- ${boxBorder}
151
- ${border(1, active)}
152
- /* text-decoration-line : underline;
153
- text-decoration-thickness: 2px;
154
- text-underline-offset : 1px */
76
+ &.next_month,
77
+ &.previous_month,
78
+ &.${unique.day.limit} {
79
+ opacity: 0.25;
155
80
  }
156
- }
157
- &.${unique.day.between} {
158
- opacity: 1;
159
- &::before {
160
- background-color: ${fillHover};
81
+ &.${unique.day.limit} {
82
+ ${pointerEventsNone};
83
+ ${cursorDefault};
161
84
  }
162
- }
163
- &.${unique.day.from} {
164
- opacity: 1;
165
- &::before {
166
- background-color: ${fillHover};
167
- border-bottom-left-radius: 12px;
168
- border-top-left-radius: 12px;
169
- left: calc((100% - 24px) / 2);
85
+ &:hover {
86
+ span.${unique.day.day} {
87
+ ${bgColor('fill.hover')};
88
+ }
170
89
  }
171
- }
172
- &.${unique.day.to} {
173
- opacity: 1;
174
- &::before {
175
- background-color: ${fillHover};
176
- border-bottom-right-radius: 12px;
177
- border-top-right-radius: 12px;
178
- right: calc((100% - 24px) / 2);
90
+ ${onClickActive && css`
91
+ &:active {
92
+ span.${unique.day.day} {
93
+ ${bgColor('fill.pressed')};
94
+ }
95
+ }
96
+ `}
97
+ &.${unique.day.active} {
98
+ span.${unique.day.day} {
99
+ ${bgColor('fill.focus')};
100
+ }
101
+ }
102
+ &.${unique.day.today} {
103
+ span {
104
+ ${boxBorder};
105
+ ${border(1, 'system.active')};
106
+ }
107
+ }
108
+ &.${unique.day.between} {
109
+ opacity: 1;
110
+ &::before {
111
+ ${bgColor('fill.hover')};
112
+ }
113
+ }
114
+ &.${unique.day.from} {
115
+ opacity: 1;
116
+ &::before {
117
+ ${bgColor('fill.hover')};
118
+ border-bottom-left-radius: 12px;
119
+ border-top-left-radius: 12px;
120
+ left: calc((100% - 24px) / 2);
121
+ }
122
+ }
123
+ &.${unique.day.to} {
124
+ opacity: 1;
125
+ &::before {
126
+ ${bgColor('fill.hover')};
127
+ border-bottom-right-radius: 12px;
128
+ border-top-right-radius: 12px;
129
+ right: calc((100% - 24px) / 2);
130
+ }
131
+ }
132
+ ::before {
133
+ ${positionAbsolute};
134
+ ${inset('1px -2px')};
135
+ content: '';
179
136
  }
180
- }
181
- ::before {
182
- ${positionAbsolute}
183
- inset: 1px -2px;
184
- content: '';
185
137
  }
186
138
  }
187
139
  .${unique.table.header} {
188
- ${userSelectNone}
189
- ${textCenter}
190
- color : ${normal_label};
191
- height: 24px;
192
- min-width: 24px;
193
- padding: 0;
194
- padding-bottom: 6px;
140
+ ${userSelectNone};
141
+ ${textCenter};
142
+ ${parseHeight(24)};
143
+ ${textColor('text.normal_label')};
195
144
  &:nth-of-type(6) {
196
- color: ${info8} !important;
145
+ ${textColor('info8')};
197
146
  }
198
147
  &:nth-of-type(7) {
199
- color: ${danger8} !important;
148
+ ${textColor('danger8')};
200
149
  }
201
150
  }
202
151
  }
@@ -280,10 +229,8 @@ const buttonIconProps = className => {
280
229
  return {
281
230
  className,
282
231
  circular: true,
283
- height: 28,
284
- viewBox: true,
285
232
  viewType: 'text',
286
- width: 28
233
+ size: 'small'
287
234
  };
288
235
  };
289
236
  /**
@@ -296,10 +243,9 @@ const buttonTextProps = fn => {
296
243
  return {
297
244
  onClick: fn,
298
245
  color: 'primary',
246
+ size: 'small',
299
247
  style: {
300
248
  borderRadius: 20,
301
- margin: 0,
302
- padding: '2px 4px',
303
249
  textTransform: 'initial',
304
250
  width: '100%'
305
251
  }
@@ -260,7 +260,7 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
260
260
  tableData.push(jsx("td", {
261
261
  key: `previous_month-${prevDate - i + 1}`,
262
262
  "data-time": day - 1,
263
- className: classNames(unique.table.data, 'previous_month', isBetween(day - 1))
263
+ className: classNames(unique.table.data, 'previous_month', isBetween(day - 1), 'empty')
264
264
  }, jsx("span", {
265
265
  className: unique.day.day
266
266
  })));
@@ -300,7 +300,7 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
300
300
  tableData.push(jsx("td", {
301
301
  key: `next_month-${i + 1}`,
302
302
  "data-time": i < 6 - weekDateLast && day + 1,
303
- className: classNames(unique.table.data, 'next_month', i < 6 - weekDateLast && isBetween(day + 1))
303
+ className: classNames(unique.table.data, 'next_month', i < 6 - weekDateLast && isBetween(day + 1), 'empty')
304
304
  }, jsx("span", {
305
305
  className: unique.day.day
306
306
  })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.3.90-beta.1",
3
+ "version": "1.3.90-beta.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",
package/styles/general.js CHANGED
@@ -4,10 +4,10 @@ export const rootSpacing = 4;
4
4
  export let rootZIndex = 1500;
5
5
  export const typographyTypes = ['t1', 't2', 't3', 't4', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p1', 'p2', 'p3', 'title1', 'title2', 'title3', 'title4', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6', 'paragraph1', 'paragraph2', 'paragraph3'];
6
6
 
7
- /**
8
- * get value spacing with rootZIndex
9
- * @param number
10
- * @return {number}
7
+ /**
8
+ * get value spacing with rootZIndex
9
+ * @param number
10
+ * @return {number}
11
11
  */
12
12
  export const zIndex = number => {
13
13
  number = Number(number || 0);
@@ -15,10 +15,10 @@ export const zIndex = number => {
15
15
  return rootZIndex + number;
16
16
  };
17
17
 
18
- /**
19
- * get value spacing with rootSpacing
20
- * @param {(number|number[])} vl - default 1
21
- * @returns {(number|string)}
18
+ /**
19
+ * get value spacing with rootSpacing
20
+ * @param {(number|number[])} vl - default 1
21
+ * @returns {(number|string)}
22
22
  */
23
23
 
24
24
  export const getSpacing = (vl = 1) => {
@@ -28,9 +28,9 @@ export const getSpacing = (vl = 1) => {
28
28
  } else return vl;
29
29
  };
30
30
 
31
- /**
32
- * replace rootZIndex
33
- * @param number
31
+ /**
32
+ * replace rootZIndex
33
+ * @param number
34
34
  */
35
35
  export const setZIndex = number => {
36
36
  number = Number(number || 0);