diginet-core-ui 1.3.94-beta.2 → 1.3.94-beta.4
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/button/more.js +1 -0
- package/components/modal/body.js +8 -4
- package/components/modal/footer.js +5 -2
- package/components/modal/header.js +3 -1
- package/components/modal/modal.js +8 -4
- package/components/paging/page-info.js +42 -39
- package/components/paging/page-selector2.js +10 -11
- package/package.json +2 -2
- package/styles/animations.js +13 -0
- package/styles/colors.js +2 -1
- package/styles/general.js +17 -3
- package/utils/index.js +2 -0
- package/utils/refMethodType.js +6 -0
- package/utils/useElementSize.js +2 -1
|
@@ -20,6 +20,7 @@ const ButtonMore = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
20
20
|
popoverProp,
|
|
21
21
|
style
|
|
22
22
|
}, reference) => {
|
|
23
|
+
if (!reference) reference = useRef(null);
|
|
23
24
|
const isOptionFull = optionType === 'full';
|
|
24
25
|
const ref = useRef(null);
|
|
25
26
|
const [openState, setOpenState] = useState(false);
|
package/components/modal/body.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import OptionWrapper from "../others/option-wrapper";
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
6
|
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
6
7
|
import { boxBorder, displayBlock, displayNone, order, overflowAuto, parseWidthHeight, positionRelative } from "../../styles/general";
|
|
@@ -11,7 +12,8 @@ const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
11
12
|
children,
|
|
12
13
|
className,
|
|
13
14
|
id,
|
|
14
|
-
style
|
|
15
|
+
style,
|
|
16
|
+
...props
|
|
15
17
|
}, reference) => {
|
|
16
18
|
if (!reference) reference = useRef(null);
|
|
17
19
|
const ref = useRef(null);
|
|
@@ -31,9 +33,10 @@ const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
31
33
|
ref: ref,
|
|
32
34
|
id: id,
|
|
33
35
|
className: classNames('DGN-UI-Modal-Body', className),
|
|
34
|
-
style: style
|
|
36
|
+
style: style,
|
|
37
|
+
...props
|
|
35
38
|
}, children);
|
|
36
|
-
}, [children, className, id, style]);
|
|
39
|
+
}, [children, className, id, style, props]);
|
|
37
40
|
}));
|
|
38
41
|
const ModalBodyCSS = css`
|
|
39
42
|
${displayBlock};
|
|
@@ -59,4 +62,5 @@ ModalBody.propTypes = {
|
|
|
59
62
|
/** Style inline of component. */
|
|
60
63
|
style: PropTypes.object
|
|
61
64
|
};
|
|
62
|
-
export
|
|
65
|
+
export { ModalBody };
|
|
66
|
+
export default OptionWrapper(ModalBody);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import OptionWrapper from "../others/option-wrapper";
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
6
|
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
6
|
-
import { boxBorder, flexRow, itemsCenter, justifyEnd, order, parseWidth, positionRelative } from "../../styles/general";
|
|
7
|
+
import { boxBorder, displayFlex, flexRow, itemsCenter, justifyEnd, order, parseWidth, positionRelative } from "../../styles/general";
|
|
7
8
|
import { classNames } from "../../utils";
|
|
8
9
|
import { responsivePaddingCSS } from "./header";
|
|
9
10
|
const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
@@ -38,6 +39,7 @@ const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
38
39
|
}, [boxShadow, children, className, id, style]);
|
|
39
40
|
}));
|
|
40
41
|
const ModalFooterCSS = boxShadow => css`
|
|
42
|
+
${displayFlex};
|
|
41
43
|
${flexRow};
|
|
42
44
|
${positionRelative};
|
|
43
45
|
${itemsCenter};
|
|
@@ -64,4 +66,5 @@ ModalFooter.propTypes = {
|
|
|
64
66
|
/** Style inline of component. */
|
|
65
67
|
style: PropTypes.object
|
|
66
68
|
};
|
|
67
|
-
export
|
|
69
|
+
export { ModalFooter };
|
|
70
|
+
export default OptionWrapper(ModalFooter);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import { ButtonIcon, Typography } from "./..";
|
|
5
|
+
import OptionWrapper from "../others/option-wrapper";
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from 'react';
|
|
7
8
|
import { bgColor, boxBorder, cursorMove, displayFlex, flexRow, itemsCenter, justifyBetween, mgl, order, parseWidth, parseWidthHeight, positionRelative, truncate } from "../../styles/general";
|
|
@@ -114,4 +115,5 @@ ModalHeader.propTypes = {
|
|
|
114
115
|
/** The content of the component if not have prop `children`. */
|
|
115
116
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|
|
116
117
|
};
|
|
117
|
-
export
|
|
118
|
+
export { ModalHeader };
|
|
119
|
+
export default OptionWrapper(ModalHeader);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import OptionWrapper from "../others/option-wrapper";
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
6
|
import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
6
7
|
import { createPortal } from 'react-dom';
|
|
7
8
|
import { animations } from "../../styles/animation";
|
|
8
|
-
import { bgColor,
|
|
9
|
+
import { bgColor, borderRadius, boxBorder, cursorMove, displayFlex, flexCol, flexRow, justifyCenter, left, parseMaxWidthHeight, parseMinWidth, parseWidthHeight, pdt, positionAbsolute, positionRelative, top } from "../../styles/general";
|
|
9
10
|
import { useTheme } from "../../theme";
|
|
10
11
|
import { classNames, useDelayUnmount } from "../../utils";
|
|
11
12
|
import ModalContext from "./context";
|
|
@@ -187,6 +188,7 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
187
188
|
}, [alignment, autoFocus, children, className, darkTheme, dragAnyWhere, id, moveable, moveOutScreen, onClose, open, pressESCToClose, style, width, zIndex, openState, showModal]);
|
|
188
189
|
}));
|
|
189
190
|
const ModalContainerCSS = (zIndex, alignment, darkTheme) => css`
|
|
191
|
+
${displayFlex};
|
|
190
192
|
${flexRow};
|
|
191
193
|
${positionAbsolute}
|
|
192
194
|
${justifyCenter};
|
|
@@ -200,15 +202,16 @@ const ModalContainerCSS = (zIndex, alignment, darkTheme) => css`
|
|
|
200
202
|
`;
|
|
201
203
|
const ModalBoxCSS = (width, moveable, dragAnyWhere) => css`
|
|
202
204
|
${paragraph1};
|
|
205
|
+
${displayFlex};
|
|
203
206
|
${flexCol};
|
|
204
207
|
${positionRelative};
|
|
205
|
-
${
|
|
208
|
+
${borderRadius(4)};
|
|
206
209
|
${boxBorder};
|
|
207
210
|
${parseWidthHeight(width, 'max-content')};
|
|
208
211
|
${parseMaxWidthHeight('90%', 'calc(100% - 12px)')};
|
|
209
212
|
${parseMinWidth(150)};
|
|
210
213
|
${moveable && dragAnyWhere && cursorMove};
|
|
211
|
-
${bgColor('system
|
|
214
|
+
${bgColor('system/white')};
|
|
212
215
|
margin: 0 auto;
|
|
213
216
|
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
214
217
|
-webkit-box-orient: vertical;
|
|
@@ -267,4 +270,5 @@ Modal.propTypes = {
|
|
|
267
270
|
/** The z-index of component. */
|
|
268
271
|
zIndex: PropTypes.number
|
|
269
272
|
};
|
|
270
|
-
export
|
|
273
|
+
export { Modal };
|
|
274
|
+
export default OptionWrapper(Modal);
|
|
@@ -6,27 +6,18 @@ import OptionWrapper from "../others/option-wrapper";
|
|
|
6
6
|
import { getGlobal } from "../../global";
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import { bgColor, borderTop, boxBorder, cursorPointer, displayFlex, flexRow, itemsCenter, justifyCenter, mg, mgb, mgl, noPadding, parseHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidthHeight, pd, textCenter, textColor, textLeft, whiteSpaceNoWrap } from "../../styles/general";
|
|
10
10
|
import { useTheme } from "../../theme";
|
|
11
11
|
import { classNames, refType as ref } from "../../utils";
|
|
12
12
|
const {
|
|
13
13
|
colors: {
|
|
14
14
|
system: {
|
|
15
|
-
active: systemActive
|
|
16
|
-
white: systemWhite
|
|
17
|
-
},
|
|
18
|
-
line: {
|
|
19
|
-
system: lineSystem,
|
|
20
|
-
category: lineCategory
|
|
21
|
-
},
|
|
22
|
-
text: {
|
|
23
|
-
main: textMain
|
|
15
|
+
active: systemActive
|
|
24
16
|
}
|
|
25
17
|
},
|
|
26
18
|
typography: {
|
|
27
19
|
paragraph2
|
|
28
|
-
}
|
|
29
|
-
spacing
|
|
20
|
+
}
|
|
30
21
|
} = useTheme();
|
|
31
22
|
const getLastPage = (totalItems, itemsPerPage) => {
|
|
32
23
|
let _lastPage = 0;
|
|
@@ -57,7 +48,7 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
57
48
|
if (!reference) reference = useRef(null);
|
|
58
49
|
const ref = useRef(null);
|
|
59
50
|
const timer = useRef(null);
|
|
60
|
-
const currentPageRef = useRef(
|
|
51
|
+
const currentPageRef = useRef(currentPage);
|
|
61
52
|
const numberRef = useRef(null);
|
|
62
53
|
const totalRef = useRef(null);
|
|
63
54
|
const [totalItemsState, setTotalItemsState] = useState(totalItems);
|
|
@@ -67,7 +58,7 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
67
58
|
const [disablePrevState, setDisablePrevState] = useState(true);
|
|
68
59
|
const [disableNextState, setDisableNextState] = useState(!(totalItems > itemsPerPage));
|
|
69
60
|
const [inputPageValue, setInputPageValue] = useState(currentPage);
|
|
70
|
-
const
|
|
61
|
+
const _PagingInfoCSS = PagingInfoCSS(bgColor, typeShort);
|
|
71
62
|
const _onChangePage = async ({
|
|
72
63
|
page,
|
|
73
64
|
e,
|
|
@@ -296,7 +287,7 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
296
287
|
const showPaging = checkShowPaging();
|
|
297
288
|
return showPaging ? jsx("div", {
|
|
298
289
|
ref: ref,
|
|
299
|
-
css:
|
|
290
|
+
css: _PagingInfoCSS,
|
|
300
291
|
id: id,
|
|
301
292
|
style: style,
|
|
302
293
|
className: classNames('DGN-UI-PagingInfo', className)
|
|
@@ -363,9 +354,7 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
363
354
|
totalRef.current = refs;
|
|
364
355
|
setWithNumber(refs, null);
|
|
365
356
|
},
|
|
366
|
-
css:
|
|
367
|
-
${whiteSpaceNoWrap}
|
|
368
|
-
`,
|
|
357
|
+
css: whiteSpaceNoWrap,
|
|
369
358
|
type: 'p2'
|
|
370
359
|
}, lastPage)), jsx(ButtonIcon, {
|
|
371
360
|
circular: true,
|
|
@@ -412,7 +401,7 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
412
401
|
}, typeShort ? jsx(Divider, {
|
|
413
402
|
direction: 'vertical',
|
|
414
403
|
height: 24,
|
|
415
|
-
color:
|
|
404
|
+
color: 'line/category'
|
|
416
405
|
}) : getGlobal('lineNumber'), jsx(Dropdown, {
|
|
417
406
|
allowSearch: false,
|
|
418
407
|
viewType: 'underlined',
|
|
@@ -435,57 +424,59 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
435
424
|
}, typeShort ? jsx(Divider, {
|
|
436
425
|
direction: 'vertical',
|
|
437
426
|
height: 24,
|
|
438
|
-
color:
|
|
427
|
+
color: 'line/category'
|
|
439
428
|
}) : getGlobal('total') + ':', totalItemsState)) : null;
|
|
440
429
|
}, [bgColor, className, hideWithPage, style, typeShort, currentPageState, disableNextState, disablePrevState, inputPageValue, itemsPerPageState, listPerPageState, totalItemsState]);
|
|
441
430
|
}));
|
|
442
431
|
const ViewNumberInput = css`
|
|
432
|
+
${displayFlex};
|
|
443
433
|
${flexRow};
|
|
444
434
|
${itemsCenter};
|
|
445
435
|
${justifyCenter};
|
|
436
|
+
${mg([0, 1])};
|
|
446
437
|
transition: all 0.1s;
|
|
447
|
-
margin: ${spacing([0, 1])};
|
|
448
438
|
`;
|
|
449
|
-
const
|
|
439
|
+
const PagingInfoCSS = (bgCl, typeShort) => css`
|
|
440
|
+
${displayFlex};
|
|
450
441
|
${flexRow};
|
|
451
442
|
${itemsCenter};
|
|
452
443
|
${paragraph2};
|
|
453
444
|
${boxBorder};
|
|
454
445
|
${parseHeight(40)};
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
446
|
+
${borderTop(1, 'line/system')};
|
|
447
|
+
${pd([1, 0])};
|
|
448
|
+
${bgColor(bgCl)};
|
|
449
|
+
${textColor('text/main')};
|
|
459
450
|
.inputPage {
|
|
460
451
|
${textCenter};
|
|
461
|
-
|
|
452
|
+
${mg([0, 0.5])};
|
|
462
453
|
.DGN-UI-InputBase {
|
|
463
454
|
${noPadding};
|
|
464
455
|
input {
|
|
465
456
|
${paragraph2};
|
|
466
457
|
${textCenter};
|
|
467
|
-
|
|
468
|
-
|
|
458
|
+
${textColor('system/active')};
|
|
459
|
+
${textLeft};
|
|
469
460
|
}
|
|
470
461
|
}
|
|
471
462
|
}
|
|
472
463
|
.txt-line-number {
|
|
464
|
+
${displayFlex};
|
|
473
465
|
${whiteSpaceNoWrap};
|
|
474
466
|
${itemsCenter};
|
|
475
467
|
opacity: 0;
|
|
476
|
-
display: flex !important;
|
|
477
468
|
transition: opacity 0.3s ease;
|
|
478
469
|
}
|
|
479
470
|
.DGN-UI-Divider {
|
|
480
|
-
|
|
471
|
+
${mg([0, 2])};
|
|
481
472
|
}
|
|
482
473
|
.DGN-UI-Dropdown {
|
|
483
|
-
|
|
484
|
-
|
|
474
|
+
${mgl([typeShort ? 0 : 2])};
|
|
475
|
+
${mgb(0)};
|
|
485
476
|
${parseMinWidth(52)};
|
|
486
477
|
.DGN-UI-Dropdown-Form {
|
|
487
478
|
${parseMinHeight(24)};
|
|
488
|
-
|
|
479
|
+
${pd(0)};
|
|
489
480
|
input,
|
|
490
481
|
span {
|
|
491
482
|
${paragraph2};
|
|
@@ -493,7 +484,7 @@ const pagingInfoCSS = (bgColor, typeShort) => css`
|
|
|
493
484
|
${cursorPointer};
|
|
494
485
|
}
|
|
495
486
|
.DGN-UI-Dropdown-Icon {
|
|
496
|
-
|
|
487
|
+
${mgl([1.5])};
|
|
497
488
|
div,
|
|
498
489
|
span,
|
|
499
490
|
svg {
|
|
@@ -504,16 +495,17 @@ const pagingInfoCSS = (bgColor, typeShort) => css`
|
|
|
504
495
|
}
|
|
505
496
|
}
|
|
506
497
|
.total-items {
|
|
507
|
-
${
|
|
498
|
+
${displayFlex};
|
|
508
499
|
${flexRow};
|
|
500
|
+
${whiteSpaceNoWrap};
|
|
509
501
|
${itemsCenter};
|
|
510
|
-
|
|
502
|
+
${mgl([typeShort ? 0 : 4])};
|
|
511
503
|
opacity: 0;
|
|
512
504
|
transition: opacity 0.3s ease;
|
|
513
505
|
}
|
|
514
506
|
`;
|
|
515
507
|
PagingInfo.defaultProps = {
|
|
516
|
-
bgColor:
|
|
508
|
+
bgColor: 'system/white',
|
|
517
509
|
className: '',
|
|
518
510
|
currentPage: 0,
|
|
519
511
|
hideWithPage: 'none',
|
|
@@ -572,8 +564,19 @@ PagingInfo.propTypes = {
|
|
|
572
564
|
* * @param {per} - number
|
|
573
565
|
* * setTotalItems(items): Set total items
|
|
574
566
|
* * @param {items} - number
|
|
567
|
+
*
|
|
568
|
+
* * option(): Gets all UI component properties
|
|
569
|
+
* * Returns value - object
|
|
570
|
+
* * option(optionName): Gets the value of a single property
|
|
571
|
+
* * @param {optionName} - string
|
|
572
|
+
* * Returns value - any
|
|
573
|
+
* * option(optionName, optionValue): Updates the value of a single property
|
|
574
|
+
* * @param {optionName} - string
|
|
575
|
+
* * @param {optionValue} - any
|
|
576
|
+
* * option(options): Updates the values of several properties
|
|
577
|
+
* * @param {options} - object
|
|
575
578
|
*/
|
|
576
|
-
|
|
579
|
+
ref: ref
|
|
577
580
|
};
|
|
578
581
|
export { PagingInfo };
|
|
579
582
|
export default OptionWrapper(PagingInfo);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { jsx, css } from '@emotion/core';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { ButtonIcon } from "./..";
|
|
6
5
|
import OptionWrapper from "../others/option-wrapper";
|
|
7
6
|
import { getGlobal } from "../../global";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
9
|
+
import { boxBorder, flexRow, itemsCenter, parseHeight } from "../../styles/general";
|
|
10
|
+
import { useTheme } from "../../theme";
|
|
11
|
+
import { refType as ref } from "../../utils";
|
|
11
12
|
import { useElementSize } from "../../utils/useElementSize";
|
|
12
13
|
const {
|
|
13
14
|
colors: {
|
|
@@ -22,7 +23,7 @@ const {
|
|
|
22
23
|
paragraph2
|
|
23
24
|
},
|
|
24
25
|
spacing
|
|
25
|
-
} =
|
|
26
|
+
} = useTheme();
|
|
26
27
|
const getLastPage = (totalItems, itemsPerPage) => {
|
|
27
28
|
let _lastPage = 0;
|
|
28
29
|
if (totalItems && totalItems >= 0 && itemsPerPage && itemsPerPage > 0) {
|
|
@@ -49,7 +50,7 @@ const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
49
50
|
}, reference) => {
|
|
50
51
|
const ref = useRef(null);
|
|
51
52
|
const timer = useRef(null);
|
|
52
|
-
const currentPageRef = useRef(
|
|
53
|
+
const currentPageRef = useRef(currentPage);
|
|
53
54
|
const [totalItemsState, setTotalItemsState] = useState(totalItems);
|
|
54
55
|
const [itemsPerPageState, setItemsPerPageState] = useState(itemsPerPage || 10);
|
|
55
56
|
const [currentPageState, setCurrentPageState] = useState(currentPage);
|
|
@@ -377,9 +378,7 @@ PagingSelector.propTypes = {
|
|
|
377
378
|
* * setTotalItems(items): Set total items
|
|
378
379
|
* * @param {items} - number
|
|
379
380
|
*/
|
|
380
|
-
|
|
381
|
-
current: PropTypes.instanceOf(Element)
|
|
382
|
-
})])
|
|
381
|
+
ref: ref
|
|
383
382
|
};
|
|
384
383
|
export { PagingSelector };
|
|
385
384
|
export default OptionWrapper(PagingSelector);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "diginet-core-ui",
|
|
3
|
-
"version": "1.3.94-beta.
|
|
3
|
+
"version": "1.3.94-beta.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -68,6 +68,6 @@
|
|
|
68
68
|
"react-dom": "^17.0.1",
|
|
69
69
|
"rimraf": "^3.0.2",
|
|
70
70
|
"run-script-os": "^1.1.6",
|
|
71
|
-
"sass": "
|
|
71
|
+
"sass": "1.58.3"
|
|
72
72
|
}
|
|
73
73
|
}
|
package/styles/colors.js
CHANGED
|
@@ -301,7 +301,8 @@ color.fill = {
|
|
|
301
301
|
tooltip: hexToRGBA(color.dark, 0.9),
|
|
302
302
|
focus: color.blue16,
|
|
303
303
|
focusshd: hexToRGBA(color.dark, 0.1),
|
|
304
|
-
headerUI: color.dark13
|
|
304
|
+
headerUI: color.dark13,
|
|
305
|
+
'header-datagrid': color.brand1
|
|
305
306
|
};
|
|
306
307
|
color.text = {
|
|
307
308
|
main: color.dark,
|
package/styles/general.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { css } from '@emotion/core';
|
|
2
|
+
import { animations } from "./animations";
|
|
2
3
|
import { getColor, parseCSSValue, parseToPixel } from "./utils";
|
|
3
4
|
export const rootSpacing = 4;
|
|
4
5
|
export let rootZIndex = 1500;
|
|
@@ -43,6 +44,13 @@ export const setZIndex = number => {
|
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
// Common CSS
|
|
47
|
+
const animation = ({
|
|
48
|
+
keyframes = animations.fadeIn,
|
|
49
|
+
duration = '0.5s',
|
|
50
|
+
timingFunction = 'ease'
|
|
51
|
+
}) => css`
|
|
52
|
+
animation: ${keyframes} ${duration} ${timingFunction};
|
|
53
|
+
`;
|
|
46
54
|
const bgColor = cl => css`
|
|
47
55
|
background-color: ${getColor(cl)};
|
|
48
56
|
`;
|
|
@@ -53,10 +61,10 @@ const bgTransparent = css`
|
|
|
53
61
|
background-color: transparent;
|
|
54
62
|
`;
|
|
55
63
|
const border = (withVl, colorVl) => css`
|
|
56
|
-
border: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system
|
|
64
|
+
border: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system/dark')};
|
|
57
65
|
`;
|
|
58
66
|
const borderBottom = (withVl, colorVl) => css`
|
|
59
|
-
border-bottom: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system
|
|
67
|
+
border-bottom: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system/dark')};
|
|
60
68
|
`;
|
|
61
69
|
const borderBottomColor = cl => css`
|
|
62
70
|
border-bottom-color: ${getColor(cl)};
|
|
@@ -82,6 +90,12 @@ const borderRadius4px = css`
|
|
|
82
90
|
const borderRadius50 = css`
|
|
83
91
|
border-radius: 50%;
|
|
84
92
|
`;
|
|
93
|
+
const borderTop = (withVl, colorVl) => css`
|
|
94
|
+
border-top: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system/dark')};
|
|
95
|
+
`;
|
|
96
|
+
const borderTopColor = cl => css`
|
|
97
|
+
border-top-color: ${getColor(cl)};
|
|
98
|
+
`;
|
|
85
99
|
const bottom = vl => css`
|
|
86
100
|
bottom: ${parseCSSValue(vl)};
|
|
87
101
|
`;
|
|
@@ -464,4 +478,4 @@ const whiteSpacePreWrap = css`
|
|
|
464
478
|
const z = vl => css`
|
|
465
479
|
z-index: ${zIndex(vl)};
|
|
466
480
|
`;
|
|
467
|
-
export { bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderDashed, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, listNone, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textSentence, textUnderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
|
|
481
|
+
export { animation, bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderDashed, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, borderTop, borderTopColor, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, listNone, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textSentence, textUnderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
|
package/utils/index.js
CHANGED
|
@@ -12,12 +12,14 @@ export { default as parseTextToHTML } from "./parseHTML";
|
|
|
12
12
|
export { default as promisify } from "./promisify";
|
|
13
13
|
export { default as randomString } from "./randomString";
|
|
14
14
|
export { default as refType } from "./refType";
|
|
15
|
+
export { default as refMethodType } from "./refMethodType";
|
|
15
16
|
export { default as removeUnicode } from "./remove-unicode";
|
|
16
17
|
export { default as renderHTML } from "./renderHTML";
|
|
17
18
|
export { default as renderIcon } from "./renderIcon";
|
|
18
19
|
export { default as SbTemplate } from "./sb-template";
|
|
19
20
|
export { default as updatePosition } from "./updatePosition";
|
|
20
21
|
export { default as useDelayUnmount } from "./useDelayUnmount";
|
|
22
|
+
export { default as useElementSize } from "./useElementSize";
|
|
21
23
|
export { default as useInput } from "./useInput";
|
|
22
24
|
export { default as useIntersection } from "./intersectionObserver";
|
|
23
25
|
export { default as useMediaQuery } from "./useMediaQuery";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const refMethodType = (props, propName, componentName) => {
|
|
2
|
+
if (propName in props) {
|
|
3
|
+
return new Error(`Invalid prop ${propName} passed to ${componentName}. Don't use this prop! This prop only used for showing ref methods on storybook!`);
|
|
4
|
+
}
|
|
5
|
+
};
|
|
6
|
+
export default refMethodType;
|
package/utils/useElementSize.js
CHANGED