diginet-core-ui 1.3.89-beta.4 → 1.3.90
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.
- package/components/avatar/index.js +135 -56
- package/components/form-control/attachment/index.js +1 -2
- package/components/form-control/date-range-picker/index.js +1 -1
- package/components/form-control/dropdown/index.js +59 -50
- package/components/grid/index.js +1 -3
- package/components/image/index.js +15 -13
- package/components/index.js +1 -1
- package/components/others/option-wrapper/index.js +1 -3
- package/components/popover/index.js +0 -4
- package/components/popup/proposals_popup.js +321 -0
- package/components/popup/v2/index.js +38 -43
- package/components/tree-view/css.js +107 -0
- package/components/tree-view/index.js +107 -103
- package/components/typography/index.js +1 -3
- package/global/index.js +2 -2
- package/icons/basic.js +56 -0
- package/package.json +31 -62
- package/readme.md +9 -0
- package/utils/index.js +0 -1
- package/utils/intersectionObserver.js +2 -3
- package/styles/sx/index.js +0 -23
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import { css,
|
|
3
|
+
import { jsx, css, keyframes } from '@emotion/core';
|
|
4
4
|
import AvatarDefault from "../../assets/avatar/default.svg";
|
|
5
|
-
import { ButtonIcon,
|
|
6
|
-
import OptionWrapper from "../others/option-wrapper";
|
|
5
|
+
import { ButtonIcon, ModalSample, Popover, Popup, Typography } from "./..";
|
|
7
6
|
import { getGlobal } from "../../global";
|
|
8
7
|
import PropTypes from 'prop-types';
|
|
9
8
|
import { forwardRef, Fragment, isValidElement, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
10
|
-
import {
|
|
9
|
+
import { itemsCenter, borderNone, displayBlock, displayNone, flexCol, displayInlineFlex, overflowHidden, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, userSelectNone } from "../../styles/general";
|
|
11
10
|
import { useTheme } from "../../theme";
|
|
12
|
-
import { classNames, isMobile } from "../../utils";
|
|
11
|
+
import { classNames, isMobile, randomString } from "../../utils";
|
|
12
|
+
import { useIntersection } from "../../utils/intersectionObserver";
|
|
13
|
+
import OptionWrapper from "../others/option-wrapper";
|
|
13
14
|
const {
|
|
14
15
|
colors: {
|
|
15
16
|
system: {
|
|
16
|
-
white
|
|
17
|
+
white
|
|
17
18
|
},
|
|
18
19
|
fill: {
|
|
19
20
|
tooltip: fillTooltip
|
|
@@ -21,8 +22,19 @@ const {
|
|
|
21
22
|
text: {
|
|
22
23
|
tooltip: textTooltip
|
|
23
24
|
}
|
|
24
|
-
}
|
|
25
|
+
},
|
|
26
|
+
spacing,
|
|
27
|
+
zIndex: zIndexCORE
|
|
25
28
|
} = useTheme();
|
|
29
|
+
const existed = {},
|
|
30
|
+
urlAvatar = {};
|
|
31
|
+
const blurKeyframe = keyframes`
|
|
32
|
+
0% { -webkit-filter: blur(4px);}
|
|
33
|
+
25% { -webkit-filter: blur(3px);}
|
|
34
|
+
50% { -webkit-filter: blur(2px);}
|
|
35
|
+
75% { -webkit-filter: blur(1px);}
|
|
36
|
+
100% { -webkit-filter: blur(0px);}
|
|
37
|
+
`;
|
|
26
38
|
const checkFileType = (type, matchType) => {
|
|
27
39
|
if (typeof matchType === 'object' && matchType instanceof RegExp) {
|
|
28
40
|
return matchType.test(type);
|
|
@@ -61,22 +73,30 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
61
73
|
width,
|
|
62
74
|
wrongTypeError
|
|
63
75
|
}, reference) => {
|
|
64
|
-
if (!reference) reference = useRef(null);
|
|
65
76
|
if (!defaultSrc) defaultSrc = AvatarDefault;
|
|
66
77
|
const ref = useRef(null);
|
|
67
78
|
const inputRef = useRef(null);
|
|
68
79
|
const avatarRef = useRef(null);
|
|
69
|
-
const
|
|
80
|
+
const popupRef = useRef(null);
|
|
81
|
+
const [unique] = useState(randomString(6, {
|
|
82
|
+
allowNumber: false,
|
|
83
|
+
allowSymbol: false
|
|
84
|
+
}));
|
|
70
85
|
const [viewAvatar, setViewAvatar] = useState(false);
|
|
71
86
|
const [viewMoreInfo, setViewMoreInfo] = useState(false);
|
|
72
87
|
const [srcState, setSrcState] = useState(src);
|
|
88
|
+
const [isInView, setIsInView] = useState(false);
|
|
89
|
+
const [onLoaded, setOnLoaded] = useState(false);
|
|
90
|
+
useIntersection(ref, () => {
|
|
91
|
+
setIsInView(true);
|
|
92
|
+
});
|
|
73
93
|
const _ActionIconCSS = ActionIconCSS(actionIconWidth);
|
|
74
|
-
const _AvatarPreviewCSS = AvatarPreviewCSS(readOnly
|
|
75
|
-
const _AvatarContainerCSS = AvatarContainerCSS(_ActionIconCSS.name);
|
|
94
|
+
const _AvatarPreviewCSS = AvatarPreviewCSS(readOnly);
|
|
95
|
+
const _AvatarContainerCSS = AvatarContainerCSS(_AvatarPreviewCSS.name, _ActionIconCSS.name);
|
|
76
96
|
const _AvatarRootCSS = AvatarRootCSS(width, height, outlined);
|
|
77
97
|
const _isMobile = isMobile.any();
|
|
78
98
|
const triggerInput = e => {
|
|
79
|
-
if (e || !
|
|
99
|
+
if (e || !existed[unique]) {
|
|
80
100
|
inputRef.current.click();
|
|
81
101
|
} else {
|
|
82
102
|
// on View
|
|
@@ -89,22 +109,29 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
89
109
|
const reader = new FileReader();
|
|
90
110
|
if (!checkFileType(file.type, matchType)) {
|
|
91
111
|
input.target.value = '';
|
|
92
|
-
|
|
112
|
+
popupRef.current.instance.show({
|
|
113
|
+
description: wrongTypeError
|
|
114
|
+
});
|
|
93
115
|
return;
|
|
94
116
|
}
|
|
95
117
|
if (+maxSize && file.size > maxSize * 1024 ** 2) {
|
|
96
118
|
input.target.value = '';
|
|
97
|
-
|
|
119
|
+
popupRef.current.instance.show({
|
|
120
|
+
description: maxSizeError
|
|
121
|
+
});
|
|
98
122
|
return;
|
|
99
123
|
}
|
|
100
124
|
reader.onload = e => {
|
|
101
|
-
|
|
125
|
+
urlAvatar[unique] = e.target.result;
|
|
126
|
+
setSrcState(urlAvatar[unique]);
|
|
127
|
+
existed[unique] = true;
|
|
102
128
|
};
|
|
103
129
|
reader.readAsDataURL(file);
|
|
104
130
|
!!onChange && onChange(input);
|
|
105
131
|
};
|
|
106
132
|
const onRemoveAvatar = () => {
|
|
107
133
|
setSrcState(null);
|
|
134
|
+
existed[unique] = false;
|
|
108
135
|
inputRef.current.value = '';
|
|
109
136
|
!!onRemove && onRemove();
|
|
110
137
|
};
|
|
@@ -125,6 +152,32 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
125
152
|
type: 'p1'
|
|
126
153
|
}, getGlobal('noDataText'));
|
|
127
154
|
};
|
|
155
|
+
const renderImage = () => {
|
|
156
|
+
const _image = jsx(Fragment, null, !onLoaded && jsx("img", {
|
|
157
|
+
src: defaultSrc,
|
|
158
|
+
alt: '',
|
|
159
|
+
style: {
|
|
160
|
+
objectFit: 'cover'
|
|
161
|
+
}
|
|
162
|
+
}), jsx("img", {
|
|
163
|
+
css: blurAnimationCSS,
|
|
164
|
+
src: srcState,
|
|
165
|
+
alt: srcState,
|
|
166
|
+
style: {
|
|
167
|
+
objectFit: 'cover'
|
|
168
|
+
},
|
|
169
|
+
onLoad: () => setOnLoaded(true)
|
|
170
|
+
}));
|
|
171
|
+
if (lazyLoading) {
|
|
172
|
+
return isInView ? _image : jsx("img", {
|
|
173
|
+
src: defaultSrc,
|
|
174
|
+
alt: '',
|
|
175
|
+
style: {
|
|
176
|
+
objectFit: 'cover'
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
} else return _image;
|
|
180
|
+
};
|
|
128
181
|
const showMoreInfo = () => {
|
|
129
182
|
if (hoverAble) setViewMoreInfo(true);
|
|
130
183
|
};
|
|
@@ -148,11 +201,22 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
148
201
|
};
|
|
149
202
|
useEffect(() => {
|
|
150
203
|
if (src) {
|
|
151
|
-
|
|
204
|
+
if (isInView || !lazyLoading) {
|
|
205
|
+
inputRef.current.value = '';
|
|
206
|
+
const img = document.createElement('img');
|
|
207
|
+
urlAvatar[unique] = src;
|
|
208
|
+
img.src = src;
|
|
209
|
+
img.alt = '';
|
|
210
|
+
img.onerror = () => {
|
|
211
|
+
setSrcState(defaultSrc);
|
|
212
|
+
existed[unique] = false;
|
|
213
|
+
};
|
|
214
|
+
img.onload = () => {
|
|
215
|
+
setSrcState(src);
|
|
216
|
+
existed[unique] = true;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
152
219
|
}
|
|
153
|
-
return () => {
|
|
154
|
-
setSrcState(defaultSrc);
|
|
155
|
-
};
|
|
156
220
|
}, [src]);
|
|
157
221
|
useImperativeHandle(reference, () => {
|
|
158
222
|
const currentRef = ref.current || {};
|
|
@@ -166,9 +230,11 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
166
230
|
});
|
|
167
231
|
return useMemo(() => {
|
|
168
232
|
return jsx(Fragment, null, jsx("div", {
|
|
169
|
-
css: _AvatarContainerCSS
|
|
170
|
-
}, jsx("div", {
|
|
233
|
+
css: _AvatarContainerCSS,
|
|
171
234
|
ref: ref,
|
|
235
|
+
id: unique,
|
|
236
|
+
className: classNames(disabled && 'disabled')
|
|
237
|
+
}, jsx("div", {
|
|
172
238
|
css: _AvatarRootCSS,
|
|
173
239
|
className: classNames('DGN-UI-Avatar', className),
|
|
174
240
|
style: style,
|
|
@@ -181,21 +247,14 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
181
247
|
onChange: onChangeAvatar,
|
|
182
248
|
disabled: disabled
|
|
183
249
|
}), jsx("div", {
|
|
184
|
-
ref: avatarRef,
|
|
185
250
|
css: _AvatarPreviewCSS,
|
|
186
251
|
onClick: _onClick,
|
|
252
|
+
ref: avatarRef,
|
|
187
253
|
onMouseEnter: _onMouseEnter,
|
|
188
254
|
onMouseLeave: _onMouseLeave,
|
|
189
255
|
tabIndex: "-1",
|
|
190
256
|
onBlur: closeMoreInfo
|
|
191
|
-
}, jsx(
|
|
192
|
-
circular: true,
|
|
193
|
-
defaultSrc: defaultSrc,
|
|
194
|
-
src: srcState,
|
|
195
|
-
width: '100%',
|
|
196
|
-
height: '100%',
|
|
197
|
-
lazyLoading: lazyLoading
|
|
198
|
-
}))), allowEdit && !readOnly && !disabled ? jsx("span", {
|
|
257
|
+
}, renderImage())), allowEdit && !readOnly && !disabled && jsx("span", {
|
|
199
258
|
css: _ActionIconCSS
|
|
200
259
|
}, jsx(ButtonIcon, {
|
|
201
260
|
viewType: 'ghost',
|
|
@@ -204,7 +263,7 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
204
263
|
height: actionIconHeight,
|
|
205
264
|
className: 'icon-edit',
|
|
206
265
|
onClick: triggerInput
|
|
207
|
-
}), clearAble && srcState
|
|
266
|
+
}), clearAble && srcState && jsx(ButtonIcon, {
|
|
208
267
|
viewType: 'ghost',
|
|
209
268
|
name: 'Delete',
|
|
210
269
|
width: actionIconWidth,
|
|
@@ -214,55 +273,68 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
214
273
|
style: {
|
|
215
274
|
marginTop: '8px'
|
|
216
275
|
}
|
|
217
|
-
})
|
|
276
|
+
}))), jsx(ModalSample, {
|
|
218
277
|
open: viewAvatar,
|
|
219
278
|
onClose: () => setViewAvatar(false),
|
|
220
279
|
width: 'max-content'
|
|
221
|
-
}, jsx(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
280
|
+
}, jsx("img", {
|
|
281
|
+
src: urlAvatar[unique],
|
|
282
|
+
alt: "",
|
|
283
|
+
style: {
|
|
284
|
+
objectFit: 'cover',
|
|
285
|
+
maxHeight: '100%',
|
|
286
|
+
maxWidth: '100%',
|
|
287
|
+
margin: 'auto',
|
|
288
|
+
display: 'block'
|
|
289
|
+
}
|
|
290
|
+
})), hoverAble && jsx(Popover, {
|
|
227
291
|
arrow: true,
|
|
228
292
|
open: viewMoreInfo,
|
|
229
293
|
pressESCToClose: false,
|
|
230
294
|
bgColor: fillTooltip,
|
|
231
295
|
anchor: avatarRef,
|
|
232
296
|
fullScreen: false,
|
|
297
|
+
width: 'max-content',
|
|
233
298
|
direction: direction
|
|
234
299
|
}, jsx("div", {
|
|
235
300
|
css: MoreInfoCSS
|
|
236
|
-
}, typeof data === 'function' ? data() : renderData()))
|
|
237
|
-
ref:
|
|
238
|
-
|
|
239
|
-
autoDisappear: true,
|
|
240
|
-
color: 'danger'
|
|
301
|
+
}, typeof data === 'function' ? data() : renderData())), !disabled && !readOnly && jsx(Popup, {
|
|
302
|
+
ref: popupRef,
|
|
303
|
+
type: 'danger'
|
|
241
304
|
}));
|
|
242
|
-
}, [actionIconHeight, actionIconWidth, allowEdit, clearAble, data, defaultSrc, direction, disabled, height, hoverAble, lazyLoading, matchType, maxSize, maxSizeError, outlined, readOnly, width, srcState, viewAvatar, viewMoreInfo]);
|
|
305
|
+
}, [actionIconHeight, actionIconWidth, allowEdit, clearAble, data, defaultSrc, direction, disabled, height, hoverAble, lazyLoading, matchType, maxSize, maxSizeError, outlined, readOnly, width, isInView, onLoaded, srcState, viewAvatar, viewMoreInfo]);
|
|
243
306
|
}));
|
|
244
307
|
const ActionIconCSS = actionIconWidth => css`
|
|
245
|
-
${displayFlex};
|
|
246
308
|
${flexCol};
|
|
247
309
|
${positionAbsolute};
|
|
248
|
-
${parseMinWidth(actionIconWidth)};
|
|
249
310
|
right: ${-actionIconWidth}px;
|
|
311
|
+
min-width: ${actionIconWidth}px;
|
|
250
312
|
transition: opacity 0.5s;
|
|
251
313
|
opacity: 0;
|
|
252
|
-
${
|
|
314
|
+
z-index: ${zIndexCORE(2)};
|
|
253
315
|
`;
|
|
254
|
-
const AvatarPreviewCSS =
|
|
316
|
+
const AvatarPreviewCSS = readOnly => css`
|
|
255
317
|
${displayBlock};
|
|
256
318
|
${positionRelative};
|
|
257
319
|
${overflowHidden};
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
320
|
+
width: 100%;
|
|
321
|
+
height: 100%;
|
|
322
|
+
border-radius: 50%;
|
|
323
|
+
cursor: ${readOnly ? 'initial' : 'pointer'};
|
|
261
324
|
`;
|
|
262
|
-
const AvatarContainerCSS = ActionIconCSSName => css`
|
|
325
|
+
const AvatarContainerCSS = (AvatarPreviewCSSName, ActionIconCSSName) => css`
|
|
263
326
|
${displayInlineFlex};
|
|
264
327
|
${positionRelative};
|
|
265
328
|
${itemsCenter};
|
|
329
|
+
&.disabled {
|
|
330
|
+
.css-${AvatarPreviewCSSName} {
|
|
331
|
+
${pointerEventsNone}
|
|
332
|
+
cursor: inherit;
|
|
333
|
+
}
|
|
334
|
+
.css-${ActionIconCSSName} {
|
|
335
|
+
display: none !important;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
266
338
|
&:hover {
|
|
267
339
|
.css-${ActionIconCSSName} {
|
|
268
340
|
opacity: 1;
|
|
@@ -275,18 +347,25 @@ const AvatarRootCSS = (width, height, outlined) => css`
|
|
|
275
347
|
${overflowHidden};
|
|
276
348
|
${userSelectNone};
|
|
277
349
|
${borderNone};
|
|
278
|
-
${boxContent};
|
|
279
350
|
${parseWidthHeight(width, height)};
|
|
280
|
-
${
|
|
281
|
-
border:
|
|
351
|
+
border: ${typeof outlined === 'boolean' && outlined ? `1px solid ${white}` : outlined};
|
|
352
|
+
border-radius: 50%;
|
|
353
|
+
box-sizing: content-box;
|
|
282
354
|
input {
|
|
283
355
|
${displayNone};
|
|
284
356
|
}
|
|
357
|
+
img {
|
|
358
|
+
width: 100%;
|
|
359
|
+
height: 100%;
|
|
360
|
+
}
|
|
285
361
|
`;
|
|
286
362
|
const MoreInfoCSS = css`
|
|
287
363
|
${displayBlock};
|
|
288
364
|
${positionRelative};
|
|
289
|
-
${
|
|
365
|
+
padding: ${spacing([2])};
|
|
366
|
+
`;
|
|
367
|
+
const blurAnimationCSS = css`
|
|
368
|
+
animation: ${blurKeyframe} 1s ease;
|
|
290
369
|
`;
|
|
291
370
|
Avatar.defaultProps = {
|
|
292
371
|
actionIconHeight: 24,
|
|
@@ -1301,8 +1301,7 @@ Attachment.defaultProps = {
|
|
|
1301
1301
|
maxSize: getGlobal(['errorDefault', 'maxSize']),
|
|
1302
1302
|
fileType: getGlobal(['errorDefault', 'fileType']),
|
|
1303
1303
|
existingFile: getGlobal(['errorDefault', 'existingFile'])
|
|
1304
|
-
}
|
|
1305
|
-
viewType: 'detail'
|
|
1304
|
+
}
|
|
1306
1305
|
};
|
|
1307
1306
|
Attachment.propTypes = {
|
|
1308
1307
|
/** File types that can be accepted. */
|
|
@@ -1182,7 +1182,7 @@ DateRangePicker.propTypes = {
|
|
|
1182
1182
|
style: PropTypes.object,
|
|
1183
1183
|
/** Text align of the input. */
|
|
1184
1184
|
textAlign: PropTypes.oneOf(['center', 'end', 'start']),
|
|
1185
|
-
/** The value of the input element, required for a controlled component.
|
|
1185
|
+
/** The value of the input element, required for a controlled component. */
|
|
1186
1186
|
value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string])),
|
|
1187
1187
|
/** The variant to use. */
|
|
1188
1188
|
viewType: PropTypes.oneOf(['outlined', 'underlined'])
|
|
@@ -6,18 +6,29 @@ import { getGlobal } from "../../../global";
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { forwardRef, Fragment, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
8
8
|
import ReactDOM, { createPortal } from 'react-dom';
|
|
9
|
-
import { bgColor, bgTransparent, border,
|
|
9
|
+
import { bgColor, bgTransparent, border, borderNone, borderRadius, borderRadius4px, boxBorder, breakWord, cursorDefault, cursorNotAllowed, cursorPointer, displayBlock, displayFlex, flexColReverse, flexRow, flexWrap, inset, insetX, itemsCenter, justifyCenter, justifyStart, mgb, mgl, mgr, mgt, outlineNone, overflowAuto, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMinHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdt, pdy, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, userSelectNone, z } from "../../../styles/general";
|
|
10
10
|
import { useTheme } from "../../../theme";
|
|
11
11
|
import { classNames, isMobile, mapParent, randomString, refType as ref, updatePosition } from "../../../utils";
|
|
12
12
|
const {
|
|
13
13
|
colors: {
|
|
14
14
|
system: {
|
|
15
|
+
active: systemActive,
|
|
16
|
+
disabled: systemDisabled,
|
|
17
|
+
rest: systemRest,
|
|
15
18
|
white: systemWhite
|
|
16
19
|
},
|
|
20
|
+
semantic: {
|
|
21
|
+
danger: semanticDanger
|
|
22
|
+
},
|
|
17
23
|
fill: {
|
|
24
|
+
hover: fillHover,
|
|
18
25
|
'scrollbar-tabbar': fillScrollbar
|
|
19
26
|
},
|
|
27
|
+
line: {
|
|
28
|
+
focus: lineFocus
|
|
29
|
+
},
|
|
20
30
|
text: {
|
|
31
|
+
main: textMain,
|
|
21
32
|
sub: textSub
|
|
22
33
|
}
|
|
23
34
|
},
|
|
@@ -1178,17 +1189,16 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1178
1189
|
return false;
|
|
1179
1190
|
}
|
|
1180
1191
|
}
|
|
1181
|
-
}) : jsx(
|
|
1182
|
-
css: _DropdownInputCSS,
|
|
1183
|
-
onClick: onClickInput
|
|
1184
|
-
}, jsx(Typography, {
|
|
1192
|
+
}) : jsx(Fragment, null, jsx(Typography, {
|
|
1185
1193
|
ref: inputRef,
|
|
1194
|
+
css: _DropdownInputCSS,
|
|
1186
1195
|
hoverTooltip: true,
|
|
1187
1196
|
lineClamp: multilineSelectedItem ? undefined : 1,
|
|
1188
1197
|
type: 'p1',
|
|
1189
1198
|
style: {
|
|
1190
1199
|
lineHeight: multiple ? '30px' : '24px'
|
|
1191
1200
|
},
|
|
1201
|
+
onClick: onClickInput,
|
|
1192
1202
|
tabIndex: -1
|
|
1193
1203
|
}, textValue))), jsx("div", {
|
|
1194
1204
|
ref: iconRef,
|
|
@@ -1246,7 +1256,7 @@ const DropdownInputCSS = (viewType, multiple, placeholder, disabled, readOnly) =
|
|
|
1246
1256
|
${paragraph1};
|
|
1247
1257
|
${disabled ? cursorNotAllowed : readOnly ? cursorDefault : cursorPointer};
|
|
1248
1258
|
${parseWidth('100%')};
|
|
1249
|
-
${
|
|
1259
|
+
color: ${textMain};
|
|
1250
1260
|
${pdt(0)};
|
|
1251
1261
|
${pdb([viewType !== 'outlined' ? 0 : 'inherit'])};
|
|
1252
1262
|
${pdl([viewType !== 'outlined' ? 0 : 4])};
|
|
@@ -1267,7 +1277,7 @@ const DropdownInputCSS = (viewType, multiple, placeholder, disabled, readOnly) =
|
|
|
1267
1277
|
${itemsCenter};
|
|
1268
1278
|
${justifyCenter};
|
|
1269
1279
|
content: '${placeholder}';
|
|
1270
|
-
${
|
|
1280
|
+
color: ${textSub};
|
|
1271
1281
|
}
|
|
1272
1282
|
&:not(:empty)::after {
|
|
1273
1283
|
visibility: hidden;
|
|
@@ -1286,7 +1296,7 @@ const DropdownInputCSS = (viewType, multiple, placeholder, disabled, readOnly) =
|
|
|
1286
1296
|
}
|
|
1287
1297
|
}
|
|
1288
1298
|
.DGN-UI-Typography {
|
|
1289
|
-
${disabled &&
|
|
1299
|
+
${disabled && `color: ${systemDisabled}`};
|
|
1290
1300
|
}
|
|
1291
1301
|
`;
|
|
1292
1302
|
const IconCSS = viewType => css`
|
|
@@ -1303,24 +1313,24 @@ const DropdownFormCSS = (viewType, multiple, disabled, placeholder, DropdownInpu
|
|
|
1303
1313
|
${boxBorder};
|
|
1304
1314
|
${parseWidth('100%')};
|
|
1305
1315
|
${pdy([multiple ? 0.25 : 1])};
|
|
1306
|
-
${!disabled &&
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1316
|
+
${!disabled && `
|
|
1317
|
+
&:not(:focus-within):hover {
|
|
1318
|
+
&::before {
|
|
1319
|
+
border-bottom-color: ${systemActive};
|
|
1320
|
+
}
|
|
1321
|
+
.css-${DropdownInputCSSName} {
|
|
1322
|
+
color: ${systemActive};
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1315
1325
|
`}
|
|
1316
1326
|
&:focus-within {
|
|
1317
|
-
${
|
|
1327
|
+
border-bottom-color: ${lineFocus};
|
|
1318
1328
|
&::after {
|
|
1319
|
-
|
|
1329
|
+
border-bottom-color: inherit;
|
|
1320
1330
|
transform: scaleX(1);
|
|
1321
1331
|
}
|
|
1322
1332
|
.css-${DropdownInputCSSName} {
|
|
1323
|
-
${
|
|
1333
|
+
color: ${systemActive};
|
|
1324
1334
|
}
|
|
1325
1335
|
}
|
|
1326
1336
|
&.dropdown-showing {
|
|
@@ -1332,27 +1342,27 @@ const DropdownFormCSS = (viewType, multiple, disabled, placeholder, DropdownInpu
|
|
|
1332
1342
|
content: '${placeholder}';
|
|
1333
1343
|
${parseHeight('100%')};
|
|
1334
1344
|
${overflowHidden};
|
|
1335
|
-
${
|
|
1345
|
+
color: ${textSub};
|
|
1336
1346
|
display: -webkit-box;
|
|
1337
1347
|
-webkit-line-clamp: 1;
|
|
1338
1348
|
-webkit-box-orient: vertical;
|
|
1339
1349
|
}
|
|
1340
1350
|
&::placeholder {
|
|
1341
|
-
${
|
|
1351
|
+
color: ${textSub};
|
|
1342
1352
|
}
|
|
1343
1353
|
&::before {
|
|
1344
1354
|
${positionAbsolute};
|
|
1345
1355
|
content: '';
|
|
1346
1356
|
${insetX(0)};
|
|
1347
1357
|
bottom: 0;
|
|
1348
|
-
${viewType === 'underlined' &&
|
|
1358
|
+
${viewType === 'underlined' && `border-bottom: 1px solid ${disabled ? systemDisabled : systemRest};`}
|
|
1349
1359
|
}
|
|
1350
1360
|
&::after {
|
|
1351
1361
|
${positionAbsolute};
|
|
1352
1362
|
content: '';
|
|
1353
1363
|
${insetX(0)};
|
|
1354
1364
|
bottom: -1px;
|
|
1355
|
-
|
|
1365
|
+
border-bottom: 2px solid transparent;
|
|
1356
1366
|
transform: scaleX(0);
|
|
1357
1367
|
transform-origin: center;
|
|
1358
1368
|
transition: all 0.2s ease;
|
|
@@ -1364,21 +1374,21 @@ const DropdownFormCSS = (viewType, multiple, disabled, placeholder, DropdownInpu
|
|
|
1364
1374
|
${positionRelative};
|
|
1365
1375
|
${borderRadius4px};
|
|
1366
1376
|
${boxBorder};
|
|
1367
|
-
${border(1, disabled ?
|
|
1377
|
+
${border(1, disabled ? systemDisabled : systemRest)};
|
|
1368
1378
|
${parseWidth('100%')};
|
|
1369
1379
|
${parseMinHeight(40)};
|
|
1370
1380
|
${mgt([0.5])};
|
|
1371
|
-
${!disabled &&
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1381
|
+
${!disabled && `
|
|
1382
|
+
&:not(:focus-within):hover {
|
|
1383
|
+
${bgColor(fillHover)};
|
|
1384
|
+
border-color: ${systemActive};
|
|
1385
|
+
input {
|
|
1386
|
+
${bgColor(fillHover)};
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1379
1389
|
`}
|
|
1380
1390
|
&:focus-within {
|
|
1381
|
-
${
|
|
1391
|
+
border-color: ${lineFocus};
|
|
1382
1392
|
}
|
|
1383
1393
|
&.dropdown-showing {
|
|
1384
1394
|
.icon-dropdown {
|
|
@@ -1389,13 +1399,13 @@ const DropdownFormCSS = (viewType, multiple, disabled, placeholder, DropdownInpu
|
|
|
1389
1399
|
content: '${placeholder}';
|
|
1390
1400
|
${parseHeight('100%')};
|
|
1391
1401
|
${overflowHidden};
|
|
1392
|
-
${
|
|
1402
|
+
color: ${textSub};
|
|
1393
1403
|
display: -webkit-box;
|
|
1394
1404
|
-webkit-line-clamp: 1;
|
|
1395
1405
|
-webkit-box-orient: vertical;
|
|
1396
1406
|
}
|
|
1397
1407
|
&::placeholder {
|
|
1398
|
-
${
|
|
1408
|
+
color: ${textSub};
|
|
1399
1409
|
}
|
|
1400
1410
|
&::after {
|
|
1401
1411
|
${positionAbsolute};
|
|
@@ -1414,7 +1424,7 @@ const DropdownListCSS = loading => css`
|
|
|
1414
1424
|
${parseWidth('100%')};
|
|
1415
1425
|
${parseMaxHeight(280)};
|
|
1416
1426
|
${loading ? overflowHidden : overflowAuto};
|
|
1417
|
-
${bgColor(
|
|
1427
|
+
${bgColor(systemWhite)};
|
|
1418
1428
|
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
1419
1429
|
${z(1)};
|
|
1420
1430
|
&::-webkit-scrollbar {
|
|
@@ -1444,19 +1454,19 @@ const DropdownItemCSS = (multiple, selectBox) => css`
|
|
|
1444
1454
|
${userSelectNone};
|
|
1445
1455
|
${parseMinHeight(40)};
|
|
1446
1456
|
${parseWidth('100%')};
|
|
1447
|
-
${bgColor(
|
|
1457
|
+
${bgColor(systemWhite)};
|
|
1448
1458
|
${pd([2, multiple && selectBox ? 0 : 4])};
|
|
1449
|
-
${
|
|
1459
|
+
color: ${textMain};
|
|
1450
1460
|
&.no-data {
|
|
1451
1461
|
${justifyCenter};
|
|
1452
1462
|
${cursorDefault};
|
|
1453
|
-
|
|
1463
|
+
font-style: italic;
|
|
1454
1464
|
}
|
|
1455
1465
|
&:not(.no-data):hover,
|
|
1456
1466
|
&:not(.no-data):focus {
|
|
1457
1467
|
${outlineNone};
|
|
1458
|
-
${bgColor(
|
|
1459
|
-
${
|
|
1468
|
+
${bgColor(fillHover)};
|
|
1469
|
+
color: ${systemActive};
|
|
1460
1470
|
}
|
|
1461
1471
|
`;
|
|
1462
1472
|
const DropdownRootCSS = (DropdownFormCSSName, DropdownInputCSSName) => css`
|
|
@@ -1466,21 +1476,21 @@ const DropdownRootCSS = (DropdownFormCSSName, DropdownInputCSSName) => css`
|
|
|
1466
1476
|
${parseHeight('max-content')};
|
|
1467
1477
|
&.error {
|
|
1468
1478
|
.css-${DropdownFormCSSName} {
|
|
1469
|
-
${
|
|
1479
|
+
border-color: ${semanticDanger};
|
|
1470
1480
|
path {
|
|
1471
|
-
${
|
|
1481
|
+
fill: ${semanticDanger};
|
|
1472
1482
|
}
|
|
1473
1483
|
&::before {
|
|
1474
|
-
${
|
|
1484
|
+
border-color: ${semanticDanger};
|
|
1475
1485
|
}
|
|
1476
1486
|
}
|
|
1477
1487
|
}
|
|
1478
1488
|
&.dgn-dropdown-loading,
|
|
1479
1489
|
&.disabled {
|
|
1480
1490
|
.css-${DropdownFormCSSName} {
|
|
1481
|
-
${
|
|
1491
|
+
border-color: ${systemDisabled};
|
|
1482
1492
|
&::before {
|
|
1483
|
-
${
|
|
1493
|
+
border-color: ${systemDisabled};
|
|
1484
1494
|
}
|
|
1485
1495
|
}
|
|
1486
1496
|
}
|
|
@@ -1497,11 +1507,10 @@ const DropdownCSS = (top, left, width, isMobile, allowSearch) => css`
|
|
|
1497
1507
|
${parseWidth(width)};
|
|
1498
1508
|
top: ${top}px;
|
|
1499
1509
|
left: ${left}px;
|
|
1500
|
-
${bgColor(
|
|
1510
|
+
${bgColor(systemWhite)};
|
|
1501
1511
|
${z(1)};
|
|
1502
|
-
${isMobile && allowSearch &&
|
|
1512
|
+
${isMobile && allowSearch && `
|
|
1503
1513
|
${parseHeight('max-content')};
|
|
1504
|
-
${displayFlex};
|
|
1505
1514
|
${flexColReverse};
|
|
1506
1515
|
bottom: 0;
|
|
1507
1516
|
top: auto;
|
package/components/grid/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
-
import OptionWrapper from "../others/option-wrapper";
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from 'react';
|
|
7
6
|
import { boxBorder } from "../../styles/general";
|
|
@@ -233,5 +232,4 @@ Grid.propTypes = {
|
|
|
233
232
|
/** If `true`, it sets `min-width: 0` on the item. Refer to the limitations section of the documentation to better understand the use case. */
|
|
234
233
|
zeroMinWidth: PropTypes.bool
|
|
235
234
|
};
|
|
236
|
-
export
|
|
237
|
-
export default OptionWrapper(Grid);
|
|
235
|
+
export default Grid;
|