diginet-core-ui 1.3.98 → 1.3.99
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/form-control/attachment/index.js +25 -16
- package/components/form-control/dropdown/index.js +8 -9
- package/components/tab/tab-container.js +1 -10
- package/components/tab/tab-header.js +6 -11
- package/components/tab/tab-panel.js +7 -14
- package/components/tab/tab.js +16 -24
- package/package.json +1 -1
- package/readme.md +6 -0
- package/styles/general.js +7 -1
- package/styles/typography.js +40 -7
|
@@ -478,15 +478,18 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
478
478
|
};
|
|
479
479
|
|
|
480
480
|
const checkExistingFile = newFile => {
|
|
481
|
-
const files =
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
481
|
+
const files = [...dataState, ...newDataState];
|
|
482
|
+
return files.some(file => ((file === null || file === void 0 ? void 0 : file.FileName) || (file === null || file === void 0 ? void 0 : file.name)) === ((newFile === null || newFile === void 0 ? void 0 : newFile.FileName) || (newFile === null || newFile === void 0 ? void 0 : newFile.name)) && ((file === null || file === void 0 ? void 0 : file.FileSize) || (file === null || file === void 0 ? void 0 : file.size)) === ((newFile === null || newFile === void 0 ? void 0 : newFile.FileSize) || (newFile === null || newFile === void 0 ? void 0 : newFile.size)));
|
|
483
|
+
// const files = allNewAttached.getAll('files');
|
|
484
|
+
// if (files && files.length) {
|
|
485
|
+
// const length = files.length;
|
|
486
|
+
// for (let i = 0; i < length; i++) {
|
|
487
|
+
// if (parseStringify(newFile) === parseStringify(files[i])) return true;
|
|
488
|
+
// }
|
|
489
|
+
// }
|
|
490
|
+
// return false;
|
|
489
491
|
};
|
|
492
|
+
|
|
490
493
|
const checkAcceptFileType = newFile => {
|
|
491
494
|
if (!accept || !accept.length) return true;
|
|
492
495
|
const type = typeof accept === 'string' ? accept : accept.join('-');
|
|
@@ -682,14 +685,17 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
682
685
|
document.removeEventListener('keydown', onKeyDown);
|
|
683
686
|
document.removeEventListener('click', clickOutOfItem);
|
|
684
687
|
};
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
688
|
+
|
|
689
|
+
// const parseStringify = fileInfo =>
|
|
690
|
+
// JSON.stringify({
|
|
691
|
+
// lastModified: fileInfo.lastModified,
|
|
692
|
+
// lastModifiedDate: fileInfo.lastModifiedDate,
|
|
693
|
+
// name: fileInfo.name,
|
|
694
|
+
// size: fileInfo.size,
|
|
695
|
+
// type: fileInfo.type,
|
|
696
|
+
// webkitRelativePath: fileInfo.webkitRelativePath,
|
|
697
|
+
// });
|
|
698
|
+
|
|
693
699
|
const mountDomain = item => {
|
|
694
700
|
if (!item) return item;
|
|
695
701
|
const cloneItem = JSON.parse(JSON.stringify(item));
|
|
@@ -777,6 +783,9 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
777
783
|
}
|
|
778
784
|
};
|
|
779
785
|
}, [data]);
|
|
786
|
+
useEffect(() => {
|
|
787
|
+
setNewDataState([]);
|
|
788
|
+
}, [dataState]);
|
|
780
789
|
useEffect(() => {
|
|
781
790
|
if (inputProps && Object.keys(inputProps).length) {
|
|
782
791
|
Object.keys(inputProps).forEach(name => {
|
|
@@ -382,12 +382,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
382
382
|
// if (handleRenderBySearch(data, pattern)) continue;
|
|
383
383
|
// } else if (pattern && !new RegExp(pattern).test(displayText.normalize())) continue;
|
|
384
384
|
|
|
385
|
-
if (
|
|
386
|
-
displayText = renderItem({
|
|
387
|
-
data,
|
|
388
|
-
index
|
|
389
|
-
});
|
|
390
|
-
} else if (subText) {
|
|
385
|
+
if (subText) {
|
|
391
386
|
displayText = jsx(Fragment, null, jsx(Typography, {
|
|
392
387
|
className: 'DGN-UI-Dropdown-PrimaryText',
|
|
393
388
|
type: 'p1'
|
|
@@ -403,7 +398,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
403
398
|
const value = typeof data === 'object' ? data[valueExpr] : data;
|
|
404
399
|
let itemDisabled = typeof data === 'object' ? data['disabled'] : false;
|
|
405
400
|
const icon = getIconFromData(data);
|
|
406
|
-
const text =
|
|
401
|
+
const text = renderItem && typeof renderItem === 'function' ? renderItem({
|
|
402
|
+
data,
|
|
403
|
+
index
|
|
404
|
+
}) : jsx(Typography, {
|
|
407
405
|
type: 'p1'
|
|
408
406
|
}, displayText);
|
|
409
407
|
if (multiple && selectBox) {
|
|
@@ -961,11 +959,12 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
961
959
|
}, content);
|
|
962
960
|
if (typeof renderSelectedItem === 'function') {
|
|
963
961
|
inputRef.current.innerHTML = '';
|
|
964
|
-
const item =
|
|
962
|
+
const item = renderSelectedItem({
|
|
965
963
|
data
|
|
966
|
-
})
|
|
964
|
+
});
|
|
967
965
|
const el = document.createElement('div');
|
|
968
966
|
el.style.display = 'flex';
|
|
967
|
+
el.style.width = '100%';
|
|
969
968
|
el.style.minHeight = '24px';
|
|
970
969
|
if (!multilineSelectedItem) el.style.maxHeight = '24px';
|
|
971
970
|
ReactDOM.render(item, inputRef.current.appendChild(el));
|
|
@@ -4,7 +4,7 @@ import { css, jsx } from '@emotion/core';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React, { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
6
6
|
import { displayFlex, flexCol, flexRow, parseWidth, positionRelative, typographyTypes } from "../../styles/general";
|
|
7
|
-
import { classNames
|
|
7
|
+
import { classNames } from "../../utils";
|
|
8
8
|
import TabContext from "./context";
|
|
9
9
|
const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
10
10
|
action = {},
|
|
@@ -23,10 +23,6 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
23
23
|
value
|
|
24
24
|
} = props;
|
|
25
25
|
const [tabIndexState, setTabIndexState] = useState(tabIndex || value);
|
|
26
|
-
const [id] = useState(randomString(6, {
|
|
27
|
-
allowNumber: false,
|
|
28
|
-
allowSymbol: false
|
|
29
|
-
}));
|
|
30
26
|
if (level === 'level1') level = 'h3';
|
|
31
27
|
if (level === 'level2') level = 'p1';
|
|
32
28
|
const _TabContainerCSS = TabContainerCSS(direction, width);
|
|
@@ -47,7 +43,6 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
47
43
|
return jsx("div", {
|
|
48
44
|
css: _TabContainerCSS,
|
|
49
45
|
ref: ref,
|
|
50
|
-
id: `DGN-${id}-tab-button-container`,
|
|
51
46
|
className: classNames('DGN-UI-Tab-Container', className),
|
|
52
47
|
style: style,
|
|
53
48
|
...props
|
|
@@ -93,9 +88,5 @@ TabContainer.propTypes = {
|
|
|
93
88
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
94
89
|
/** Any props else. */
|
|
95
90
|
props: PropTypes.any
|
|
96
|
-
/**
|
|
97
|
-
* Ref methods.
|
|
98
|
-
*/
|
|
99
91
|
};
|
|
100
|
-
|
|
101
92
|
export default TabContainer;
|
|
@@ -4,7 +4,7 @@ import { css, jsx } from '@emotion/core';
|
|
|
4
4
|
import { ButtonIcon } from "./..";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React, { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
7
|
-
import { boxBorder, displayFlex, displayNone, flexCol, flexRow, justifyCenter, mg, overflowHidden,
|
|
7
|
+
import { boxBorder, displayFlex, displayNone, flexCol, flexRow, justifyCenter, mg, overflowHidden, parseWidth, parseWidthHeight, pd, positionRelative, selfCenter, whiteSpaceNoWrap } from "../../styles/general";
|
|
8
8
|
import { classNames } from "../../utils";
|
|
9
9
|
import TabContext from "./context";
|
|
10
10
|
const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
@@ -50,11 +50,10 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
50
50
|
return useMemo(() => {
|
|
51
51
|
return jsx("div", {
|
|
52
52
|
css: _ContainerCSS,
|
|
53
|
-
id: `DGN-control`,
|
|
54
53
|
className: classNames('DGN-UI-Tab-Header-Container', className),
|
|
55
54
|
style: style,
|
|
56
55
|
...props
|
|
57
|
-
}, scrollButtons && !isVertical
|
|
56
|
+
}, scrollButtons && !isVertical ? jsx(ButtonIcon, {
|
|
58
57
|
css: ScrollLeftButtonCSS,
|
|
59
58
|
name: isVertical ? 'ArrowUp' : 'ArrowLeft',
|
|
60
59
|
viewType: 'text',
|
|
@@ -62,7 +61,7 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
62
61
|
viewBox: true,
|
|
63
62
|
disabled: !showScrollLeftButton,
|
|
64
63
|
onClick: () => _onClickScrollButton(true)
|
|
65
|
-
}), jsx("div", {
|
|
64
|
+
}) : null, jsx("div", {
|
|
66
65
|
css: [_TabHeaderCSS, !isVertical && TabHeaderHorizontalCSS],
|
|
67
66
|
className: 'DGN-UI-Tab-Header',
|
|
68
67
|
ref: ref,
|
|
@@ -72,7 +71,7 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
72
71
|
}
|
|
73
72
|
}, React.Children.map(children, child => child && /*#__PURE__*/React.cloneElement(child, {
|
|
74
73
|
level
|
|
75
|
-
}))), scrollButtons && !isVertical
|
|
74
|
+
}))), scrollButtons && !isVertical ? jsx(ButtonIcon, {
|
|
76
75
|
css: ScrollRightButtonCSS,
|
|
77
76
|
name: isVertical ? 'ArrowDown' : 'ArrowRight',
|
|
78
77
|
viewType: 'text',
|
|
@@ -80,7 +79,7 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
80
79
|
viewBox: true,
|
|
81
80
|
disabled: !showScrollRightButton,
|
|
82
81
|
onClick: () => _onClickScrollButton(false)
|
|
83
|
-
}));
|
|
82
|
+
}) : null);
|
|
84
83
|
}, [centered, children, className, level, props, scrollButtons, style, width, direction, isVertical, scrollLeft]);
|
|
85
84
|
}));
|
|
86
85
|
const ContainerCSS = (centered, isVertical, width) => css`
|
|
@@ -91,7 +90,6 @@ const ContainerCSS = (centered, isVertical, width) => css`
|
|
|
91
90
|
${parseWidthHeight(width, 'auto')};
|
|
92
91
|
${centered && justifyCenter};
|
|
93
92
|
${isVertical ? flexCol : flexRow};
|
|
94
|
-
${parseMaxWidth(isVertical ? 'max-content' : '100%')};
|
|
95
93
|
${pd(0)};
|
|
96
94
|
`;
|
|
97
95
|
const TabHeaderCSS = width => css`
|
|
@@ -100,6 +98,7 @@ const TabHeaderCSS = width => css`
|
|
|
100
98
|
${parseWidth(width)};
|
|
101
99
|
`;
|
|
102
100
|
const TabHeaderHorizontalCSS = css`
|
|
101
|
+
${displayFlex};
|
|
103
102
|
${flexRow};
|
|
104
103
|
${positionRelative};
|
|
105
104
|
${whiteSpaceNoWrap};
|
|
@@ -142,9 +141,5 @@ TabHeader.propTypes = {
|
|
|
142
141
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
143
142
|
/** Any props else. */
|
|
144
143
|
props: PropTypes.any
|
|
145
|
-
/**
|
|
146
|
-
* Ref methods.
|
|
147
|
-
*/
|
|
148
144
|
};
|
|
149
|
-
|
|
150
145
|
export default TabHeader;
|
|
@@ -23,8 +23,8 @@ const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
23
23
|
const [isRendered, setIsRendered] = useState(false);
|
|
24
24
|
const ref = useRef(null);
|
|
25
25
|
const isVertical = direction === 'vertical';
|
|
26
|
-
const
|
|
27
|
-
const _TabPanelCSS = TabPanelCSS(isVertical,
|
|
26
|
+
const isSelected = index === tabIndexState;
|
|
27
|
+
const _TabPanelCSS = TabPanelCSS(isVertical, isSelected);
|
|
28
28
|
useEffect(() => {
|
|
29
29
|
if (isRendered) return;else if (index === tabIndexState) setIsRendered(true);
|
|
30
30
|
}, [tabIndexState]);
|
|
@@ -42,23 +42,20 @@ const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
42
42
|
return jsx("div", {
|
|
43
43
|
css: _TabPanelCSS,
|
|
44
44
|
ref: ref,
|
|
45
|
-
role: 'tab-panel',
|
|
46
|
-
"aria-labelledby": `tab-${index}`,
|
|
47
|
-
id: `tab-panel-${index}`,
|
|
48
45
|
className: classNames('DGN-UI-Tab-Panel', className),
|
|
49
46
|
style: style,
|
|
50
47
|
...props
|
|
51
|
-
},
|
|
52
|
-
}, [children, className, index, lazyLoading, props, style,
|
|
48
|
+
}, isSelected || !lazyLoading || isRendered ? children : null);
|
|
49
|
+
}, [children, className, index, lazyLoading, props, style, isSelected, isRendered, tabIndexState]);
|
|
53
50
|
}));
|
|
54
|
-
const TabPanelCSS = (isVertical,
|
|
51
|
+
const TabPanelCSS = (isVertical, isSelected) => css`
|
|
55
52
|
${displayFlex};
|
|
56
53
|
${flexCol};
|
|
57
54
|
${boxBorder};
|
|
58
55
|
${positionRelative};
|
|
59
|
-
${
|
|
56
|
+
${isSelected ? flexCol : displayNone};
|
|
60
57
|
${parseWidthHeight('100%', isVertical ? 300 : '100%')};
|
|
61
|
-
${textColor('text
|
|
58
|
+
${textColor('text/main')};
|
|
62
59
|
${pd([0, isVertical ? 3 : 2.5])};
|
|
63
60
|
`;
|
|
64
61
|
TabPanel.defaultProps = {
|
|
@@ -79,9 +76,5 @@ TabPanel.propTypes = {
|
|
|
79
76
|
style: PropTypes.object,
|
|
80
77
|
/** Any props else. */
|
|
81
78
|
props: PropTypes.any
|
|
82
|
-
/**
|
|
83
|
-
* Ref methods.
|
|
84
|
-
*/
|
|
85
79
|
};
|
|
86
|
-
|
|
87
80
|
export default TabPanel;
|
package/components/tab/tab.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Icon, Typography } from "./..";
|
|
|
5
5
|
import Ripple from "../button/ripple-effect";
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from 'react';
|
|
8
|
-
import { bgColor,
|
|
8
|
+
import { bgColor, borderRadius, bottom, boxBorder, breakWord, cursorDefault, cursorPointer, displayFlex, flexRow, itemsCenter, justifyCenter, justifyStart, left, mgl, mgr, outlineNone, overflowHidden, parseHeight, parseMaxWidth, parseMaxWidthHeight, parseMinWidth, parseWidth, pd, pointerEventsAuto, pointerEventsNone, positionAbsolute, positionRelative, shadowNone, textCenter, textColor, userSelectNone, whiteSpaceNoWrap } from "../../styles/general";
|
|
9
9
|
import { classNames } from "../../utils";
|
|
10
10
|
import TabContext from "./context";
|
|
11
11
|
const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
@@ -59,8 +59,7 @@ const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
return jsx("span", {
|
|
62
|
-
css: IconCSS,
|
|
63
|
-
className: isEndIcon ? 'end-icon' : ''
|
|
62
|
+
css: [IconCSS, isEndIcon && EndIconCSS]
|
|
64
63
|
}, node);
|
|
65
64
|
};
|
|
66
65
|
return useMemo(() => {
|
|
@@ -100,7 +99,6 @@ const TabItemCSS = (color, isVertical) => css`
|
|
|
100
99
|
${whiteSpaceNoWrap};
|
|
101
100
|
${shadowNone};
|
|
102
101
|
${!isVertical && textCenter};
|
|
103
|
-
${bgColor('system.white')};
|
|
104
102
|
${textColor(color)};
|
|
105
103
|
${parseMinWidth(80)};
|
|
106
104
|
${parseMaxWidth(isVertical ? '100%' : 287)};
|
|
@@ -108,29 +106,26 @@ const TabItemCSS = (color, isVertical) => css`
|
|
|
108
106
|
${pointerEventsAuto};
|
|
109
107
|
${userSelectNone};
|
|
110
108
|
flex: 0 0 auto;
|
|
111
|
-
border: 0;
|
|
112
109
|
transition: all 0.2s ease-in-out, background-color 0.2s ease-in-out;
|
|
113
110
|
:hover:not(.selected):not(.disabled),
|
|
114
111
|
:focus {
|
|
115
|
-
${
|
|
116
|
-
${textColor('system.rest')};
|
|
112
|
+
${textColor('system/rest')};
|
|
117
113
|
.Indicator {
|
|
118
|
-
${bgColor('system
|
|
114
|
+
${bgColor('system/rest')};
|
|
119
115
|
transform: scale(1);
|
|
120
116
|
}
|
|
121
117
|
}
|
|
122
118
|
`;
|
|
123
119
|
const TabItemDisabledCSS = css`
|
|
124
120
|
${pointerEventsNone};
|
|
125
|
-
${bgTransparent};
|
|
126
121
|
${cursorDefault};
|
|
127
|
-
${
|
|
122
|
+
${bgColor('transparent')};
|
|
123
|
+
${textColor('system/disabled')};
|
|
128
124
|
`;
|
|
129
125
|
const TabItemSelectedCSS = css`
|
|
130
|
-
${
|
|
131
|
-
${textColor('system.active')};
|
|
126
|
+
${textColor('system/active')};
|
|
132
127
|
.Indicator {
|
|
133
|
-
${bgColor('system
|
|
128
|
+
${bgColor('system/active')};
|
|
134
129
|
transform: scale(1);
|
|
135
130
|
}
|
|
136
131
|
`;
|
|
@@ -139,12 +134,13 @@ const IndicatorCSS = isVertical => css`
|
|
|
139
134
|
${parseHeight(isVertical ? '100%' : 4)};
|
|
140
135
|
${parseWidth(isVertical ? 4 : '100%')}
|
|
141
136
|
${borderRadius(1)};
|
|
142
|
-
bottom
|
|
143
|
-
left
|
|
137
|
+
${bottom(0)};
|
|
138
|
+
${left(0)};
|
|
144
139
|
transform: ${isVertical ? 'scaleY(0)' : 'scaleX(0)'};
|
|
145
140
|
transition: transform 0.2s ease-in-out;
|
|
146
141
|
`;
|
|
147
142
|
const IconCSS = css`
|
|
143
|
+
${displayFlex};
|
|
148
144
|
${flexRow};
|
|
149
145
|
${itemsCenter};
|
|
150
146
|
${justifyCenter};
|
|
@@ -152,14 +148,14 @@ const IconCSS = css`
|
|
|
152
148
|
${boxBorder};
|
|
153
149
|
${parseMaxWidthHeight(24)};
|
|
154
150
|
${mgr([1])};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
151
|
+
`;
|
|
152
|
+
const EndIconCSS = css`
|
|
153
|
+
${mgr('unset')};
|
|
154
|
+
${mgl([1])};
|
|
159
155
|
`;
|
|
160
156
|
TabItem.defaultProps = {
|
|
161
157
|
className: '',
|
|
162
|
-
color: 'system
|
|
158
|
+
color: 'system/rest',
|
|
163
159
|
disabled: false,
|
|
164
160
|
label: '',
|
|
165
161
|
style: {}
|
|
@@ -189,9 +185,5 @@ TabItem.propTypes = {
|
|
|
189
185
|
style: PropTypes.object,
|
|
190
186
|
/** Any props else. */
|
|
191
187
|
props: PropTypes.any
|
|
192
|
-
/**
|
|
193
|
-
* Ref methods.
|
|
194
|
-
*/
|
|
195
188
|
};
|
|
196
|
-
|
|
197
189
|
export default TabItem;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,6 +38,12 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.99
|
|
42
|
+
- \[Changed\]: Typography – Add new text style
|
|
43
|
+
- \[Fixed\]: Tab – Fix background UI not match design
|
|
44
|
+
- \[Fixed\]: Dropdown – Fix case renderItem, renderSelectedItem inside Typography
|
|
45
|
+
- \[Fixed\]: Attachment – Fix bug not reset new upload data
|
|
46
|
+
|
|
41
47
|
## 1.3.98
|
|
42
48
|
- \[Changed\]: Image – Change default image
|
|
43
49
|
- \[Changed\]: Icon – Update Image, Another, Compressed, Presentation, Sheet, Word, PDF
|
package/styles/general.js
CHANGED
|
@@ -51,6 +51,9 @@ const animation = ({
|
|
|
51
51
|
}) => css`
|
|
52
52
|
animation: ${keyframes} ${duration} ${timingFunction};
|
|
53
53
|
`;
|
|
54
|
+
const aspectSquare = css`
|
|
55
|
+
aspect-ratio: 1 / 1;
|
|
56
|
+
`;
|
|
54
57
|
const bgColor = cl => css`
|
|
55
58
|
background-color: ${getColor(cl)};
|
|
56
59
|
`;
|
|
@@ -90,6 +93,9 @@ const borderRadius4px = css`
|
|
|
90
93
|
const borderRadius50 = css`
|
|
91
94
|
border-radius: 50%;
|
|
92
95
|
`;
|
|
96
|
+
const borderRight = (withVl, colorVl) => css`
|
|
97
|
+
border-right: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system/dark')};
|
|
98
|
+
`;
|
|
93
99
|
const borderTop = (withVl, colorVl) => css`
|
|
94
100
|
border-top: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system/dark')};
|
|
95
101
|
`;
|
|
@@ -481,4 +487,4 @@ const whiteSpacePreWrap = css`
|
|
|
481
487
|
const z = vl => css`
|
|
482
488
|
z-index: ${zIndex(vl)};
|
|
483
489
|
`;
|
|
484
|
-
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, overflowXHidden, 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 };
|
|
490
|
+
export { animation, aspectSquare, bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderDashed, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, borderRight, 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, overflowXHidden, 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/styles/typography.js
CHANGED
|
@@ -13,9 +13,12 @@ const fontNormal = css`
|
|
|
13
13
|
const fontWeightBold = css`
|
|
14
14
|
font-weight: 700;
|
|
15
15
|
`;
|
|
16
|
-
const
|
|
16
|
+
const fontWeightMedium = css`
|
|
17
17
|
font-weight: 500;
|
|
18
18
|
`;
|
|
19
|
+
const fontWeightRegular = css`
|
|
20
|
+
font-weight: 400;
|
|
21
|
+
`;
|
|
19
22
|
const fontWeightNormal = css`
|
|
20
23
|
font-weight: normal;
|
|
21
24
|
`;
|
|
@@ -28,7 +31,7 @@ const getFontSize = size => css`
|
|
|
28
31
|
const title1 = css`
|
|
29
32
|
${fontNormal};
|
|
30
33
|
${fontWeightBold};
|
|
31
|
-
${getFontSize(parseInt(fontSize) +
|
|
34
|
+
${getFontSize(parseInt(fontSize) + 12)}; //28
|
|
32
35
|
`;
|
|
33
36
|
const title2 = css`
|
|
34
37
|
${fontNormal};
|
|
@@ -72,22 +75,52 @@ const heading5 = css`
|
|
|
72
75
|
`;
|
|
73
76
|
const heading6 = css`
|
|
74
77
|
${fontNormal};
|
|
75
|
-
${
|
|
78
|
+
${fontWeightMedium};
|
|
76
79
|
${getFontSize(parseInt(fontSize) - 4)}; //12
|
|
77
80
|
`;
|
|
81
|
+
const body1 = css`
|
|
82
|
+
${fontNormal};
|
|
83
|
+
${fontWeightRegular};
|
|
84
|
+
${getFontSize(parseInt(fontSize) + 12)}; //28
|
|
85
|
+
`;
|
|
86
|
+
const body2 = css`
|
|
87
|
+
${fontNormal};
|
|
88
|
+
${fontWeightRegular};
|
|
89
|
+
${getFontSize(parseInt(fontSize) + 10)}; //26
|
|
90
|
+
`;
|
|
91
|
+
const body3 = css`
|
|
92
|
+
${fontNormal};
|
|
93
|
+
${fontWeightRegular};
|
|
94
|
+
${getFontSize(parseInt(fontSize) + 8)}; //24
|
|
95
|
+
`;
|
|
96
|
+
const body4 = css`
|
|
97
|
+
${fontNormal};
|
|
98
|
+
${fontWeightRegular};
|
|
99
|
+
${getFontSize(parseInt(fontSize) + 6)}; //22
|
|
100
|
+
`;
|
|
101
|
+
const body5 = css`
|
|
102
|
+
${fontNormal};
|
|
103
|
+
${fontWeightRegular};
|
|
104
|
+
${getFontSize(parseInt(fontSize) + 4)}; //20
|
|
105
|
+
`;
|
|
106
|
+
const body6 = css`
|
|
107
|
+
${fontNormal};
|
|
108
|
+
${fontWeightRegular};
|
|
109
|
+
${getFontSize(parseInt(fontSize) + 2)}; //18
|
|
110
|
+
`;
|
|
78
111
|
const paragraph1 = css`
|
|
79
112
|
${fontNormal};
|
|
80
|
-
${
|
|
113
|
+
${fontWeightRegular};
|
|
81
114
|
${getFontSize(parseInt(fontSize))}; //16
|
|
82
115
|
`;
|
|
83
116
|
const paragraph2 = css`
|
|
84
117
|
${fontNormal};
|
|
85
|
-
${
|
|
118
|
+
${fontWeightRegular};
|
|
86
119
|
${getFontSize(parseInt(fontSize) - 2)}; //14
|
|
87
120
|
`;
|
|
88
121
|
const paragraph3 = css`
|
|
89
122
|
${fontNormal};
|
|
90
|
-
${
|
|
123
|
+
${fontWeightRegular};
|
|
91
124
|
${getFontSize(parseInt(fontSize) - 4)}; //12
|
|
92
125
|
`;
|
|
93
126
|
const uppercase = css`
|
|
@@ -101,7 +134,7 @@ const helperText = css`
|
|
|
101
134
|
font-size: ${parseInt(fontSize) - 4}px; //12
|
|
102
135
|
${fontWeightNormal}
|
|
103
136
|
`;
|
|
104
|
-
export const typography = [[title1, ['title1', 't1']], [title2, ['title2', 't2']], [title3, ['title3', 't3']], [title4, ['title4', 't4']], [heading1, ['heading1', 'h1']], [heading2, ['heading2', 'h2']], [heading3, ['heading3', 'h3']], [heading4, ['heading4', 'h4']], [heading5, ['heading5', 'h5']], [heading6, ['heading6', 'h6']], [paragraph1, ['paragraph1', 'p1']], [paragraph2, ['paragraph2', 'p2']], [paragraph3, ['paragraph3', 'p3']], [uppercase, ['uppercase']], [label, ['label']], [helperText, ['helperText']]].reduce((obj, [value, keys]) => {
|
|
137
|
+
export const typography = [[title1, ['title1', 't1']], [title2, ['title2', 't2']], [title3, ['title3', 't3']], [title4, ['title4', 't4']], [heading1, ['heading1', 'h1']], [heading2, ['heading2', 'h2']], [heading3, ['heading3', 'h3']], [heading4, ['heading4', 'h4']], [heading5, ['heading5', 'h5']], [heading6, ['heading6', 'h6']], [body1, ['body1', 'b1']], [body2, ['body2', 'b2']], [body3, ['body3', 'b3']], [body4, ['body4', 'b4']], [body5, ['body5', 'b5']], [body6, ['body6', 'b6']], [paragraph1, ['paragraph1', 'p1']], [paragraph2, ['paragraph2', 'p2']], [paragraph3, ['paragraph3', 'p3']], [uppercase, ['uppercase']], [label, ['label']], [helperText, ['helperText']]].reduce((obj, [value, keys]) => {
|
|
105
138
|
for (const key of keys) {
|
|
106
139
|
obj = {
|
|
107
140
|
...obj,
|