diginet-core-ui 1.3.80-beta.7 → 1.3.81
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,28 +1,25 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
4
|
-
import { Icon } from "./..";
|
|
5
|
-
import OptionWrapper from "../others/option-wrapper";
|
|
3
|
+
import { memo, useRef, forwardRef, useMemo, useImperativeHandle } from 'react';
|
|
6
4
|
import PropTypes from 'prop-types';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
import { jsx, css } from '@emotion/core';
|
|
6
|
+
import OptionWrapper from "../others/option-wrapper";
|
|
7
|
+
import { color as colors } from "../../styles/colors";
|
|
8
|
+
import { typography } from "../../styles/typography";
|
|
9
|
+
import { alignCenter, borderBox, borderRadius4px, flexRow, flexWrap, inlineFlex, justifyCenter, pointerEventsNone, positionAbsolute, positionRelative } from "../../styles/general";
|
|
10
|
+
import Icon from "../../icons";
|
|
11
11
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
spacing
|
|
24
|
-
} = useTheme();
|
|
25
|
-
const colorMap = new Map([['default', systemRest]]);
|
|
12
|
+
paragraph1,
|
|
13
|
+
paragraph2,
|
|
14
|
+
paragraph3
|
|
15
|
+
} = typography;
|
|
16
|
+
const {
|
|
17
|
+
system: {
|
|
18
|
+
rest,
|
|
19
|
+
white
|
|
20
|
+
}
|
|
21
|
+
} = colors;
|
|
22
|
+
const colorMap = new Map([['default', rest]]);
|
|
26
23
|
const iconSizeMap = new Map([['medium', 24], ['large', 32], ['giant', 40]]);
|
|
27
24
|
const dotSizeMap = new Map([['medium', 8], ['large', 10], ['giant', 12]]);
|
|
28
25
|
const dotIndentMap = new Map([['medium', 4], ['large', 2]]);
|
|
@@ -73,30 +70,28 @@ const calDotPos = (anchorOrigin, contentDirection, dotSize, hasContent, size) =>
|
|
|
73
70
|
const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
74
71
|
action = {},
|
|
75
72
|
anchorOrigin,
|
|
76
|
-
children,
|
|
77
|
-
className,
|
|
78
|
-
color,
|
|
79
|
-
content,
|
|
80
73
|
contentDirection,
|
|
81
|
-
|
|
82
|
-
id,
|
|
83
|
-
invisible,
|
|
74
|
+
content,
|
|
84
75
|
max,
|
|
85
76
|
name,
|
|
86
|
-
|
|
77
|
+
color,
|
|
87
78
|
size,
|
|
79
|
+
className,
|
|
88
80
|
style,
|
|
81
|
+
showZero,
|
|
82
|
+
invisible,
|
|
83
|
+
children,
|
|
84
|
+
iconProps,
|
|
89
85
|
...props
|
|
90
86
|
}, reference) => {
|
|
91
|
-
if (!reference) reference = useRef(null);
|
|
92
87
|
const ref = useRef(null);
|
|
93
88
|
const typographySize = typographySizeMap.get(size);
|
|
94
89
|
const iconSize = iconSizeMap.get(size);
|
|
95
90
|
const dotSize = content || content === 0 && showZero ? dotSizeMap.get(size) + 8 : dotSizeMap.get(size);
|
|
96
91
|
const dotColor = colors[color] || colorMap.get(color) || color;
|
|
97
92
|
const dotPos = calDotPos(anchorOrigin, !children && name ? 'right' : contentDirection, dotSize, content || content === 0, size);
|
|
98
|
-
const _BadgeNumberCSS = BadgeNumberCSS(typographySize, children, name, dotSize, dotColor);
|
|
99
|
-
const _BadgeRootCSS = BadgeRootCSS(children, name, dotPos, _BadgeNumberCSS
|
|
93
|
+
const _BadgeNumberCSS = BadgeNumberCSS(typographySize, children, name, dotSize, dotColor, invisible);
|
|
94
|
+
const _BadgeRootCSS = BadgeRootCSS(children, name, dotPos, _BadgeNumberCSS);
|
|
100
95
|
useImperativeHandle(reference, () => {
|
|
101
96
|
const currentRef = ref.current || {};
|
|
102
97
|
currentRef.element = ref.current;
|
|
@@ -111,30 +106,28 @@ const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
111
106
|
let node = children;
|
|
112
107
|
if (!node && name) {
|
|
113
108
|
node = jsx(Icon, {
|
|
114
|
-
viewBox: true,
|
|
115
109
|
name: name,
|
|
116
110
|
width: iconSize,
|
|
117
111
|
height: iconSize,
|
|
118
|
-
|
|
112
|
+
viewBox: true,
|
|
119
113
|
...iconProps
|
|
120
114
|
});
|
|
121
115
|
}
|
|
122
116
|
return jsx("div", {
|
|
123
117
|
css: _BadgeRootCSS,
|
|
124
118
|
ref: ref,
|
|
125
|
-
|
|
126
|
-
className: classNames('DGN-UI-Badge', className),
|
|
119
|
+
className: ['DGN-UI-Badge', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
127
120
|
style: style,
|
|
128
121
|
...props
|
|
129
122
|
}, jsx("span", {
|
|
130
123
|
className: 'DGN-UI-Badge-Children'
|
|
131
|
-
}, node), content !== undefined &&
|
|
124
|
+
}, node), content !== undefined && jsx("span", {
|
|
132
125
|
css: _BadgeNumberCSS,
|
|
133
126
|
className: 'DGN-UI-Badge-Dot'
|
|
134
|
-
}, max && content > max ? max + '+' : content === 0 && !showZero ? null : content)
|
|
135
|
-
}, [anchorOrigin,
|
|
127
|
+
}, max && content > max ? max + '+' : content === 0 && !showZero ? null : content));
|
|
128
|
+
}, [anchorOrigin, contentDirection, content, name, size, children, max, showZero, invisible, color, style, className, iconProps]);
|
|
136
129
|
}));
|
|
137
|
-
const BadgeNumberCSS = (typographySize, children, name, dotSize, dotColor) => css`
|
|
130
|
+
const BadgeNumberCSS = (typographySize, children, name, dotSize, dotColor, invisible) => css`
|
|
138
131
|
${typographySize};
|
|
139
132
|
${flexRow};
|
|
140
133
|
${alignCenter};
|
|
@@ -143,88 +136,84 @@ const BadgeNumberCSS = (typographySize, children, name, dotSize, dotColor) => cs
|
|
|
143
136
|
${borderBox};
|
|
144
137
|
${pointerEventsNone};
|
|
145
138
|
${children || name ? positionAbsolute : positionRelative};
|
|
146
|
-
color: ${
|
|
147
|
-
${
|
|
139
|
+
color: ${white};
|
|
140
|
+
min-height: ${dotSize}px;
|
|
141
|
+
min-width: ${dotSize}px;
|
|
148
142
|
background-color: ${dotColor};
|
|
149
143
|
border-radius: ${dotSize / 2}px;
|
|
150
|
-
padding:
|
|
144
|
+
padding: 0 4px;
|
|
145
|
+
transition: transform 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
146
|
+
${invisible && 'transform: scale(0) translate(50%, -50%);'};
|
|
151
147
|
`;
|
|
152
|
-
const BadgeRootCSS = (children, name, dotPos,
|
|
148
|
+
const BadgeRootCSS = (children, name, dotPos, _BadgeNumberCSS) => css`
|
|
153
149
|
${inlineFlex};
|
|
154
150
|
${alignCenter};
|
|
155
151
|
${justifyCenter};
|
|
156
152
|
${positionRelative};
|
|
157
153
|
${borderBox};
|
|
158
154
|
${borderRadius4px};
|
|
159
|
-
${
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
color: ${white};
|
|
156
|
+
height: max-content;
|
|
157
|
+
min-height: max-content;
|
|
158
|
+
width: max-content;
|
|
159
|
+
min-width: max-content;
|
|
160
|
+
.css-${_BadgeNumberCSS.name} {
|
|
161
|
+
${(children || name) && dotPos}
|
|
163
162
|
}
|
|
164
163
|
`;
|
|
165
164
|
Badge.defaultProps = {
|
|
165
|
+
color: 'default',
|
|
166
|
+
size: 'medium',
|
|
166
167
|
anchorOrigin: {
|
|
167
168
|
vertical: 'top',
|
|
168
169
|
horizontal: 'right'
|
|
169
170
|
},
|
|
170
|
-
className: '',
|
|
171
|
-
color: 'default',
|
|
172
171
|
content: null,
|
|
173
|
-
contentDirection: 'left',
|
|
174
|
-
invisible: false,
|
|
175
172
|
max: 99,
|
|
173
|
+
contentDirection: 'left',
|
|
176
174
|
showZero: false,
|
|
177
|
-
|
|
175
|
+
invisible: false,
|
|
176
|
+
className: '',
|
|
178
177
|
style: {}
|
|
179
178
|
};
|
|
180
179
|
Badge.propTypes = {
|
|
181
|
-
/** The anchor of the badge. */
|
|
182
180
|
anchorOrigin: PropTypes.shape({
|
|
183
181
|
horizontal: PropTypes.oneOf(['left', 'right']),
|
|
184
182
|
vertical: PropTypes.oneOf(['top', 'bottom'])
|
|
185
183
|
}),
|
|
186
|
-
/**
|
|
187
|
-
children: PropTypes.node,
|
|
188
|
-
/** Class for component. */
|
|
189
|
-
className: PropTypes.string,
|
|
190
|
-
/** The color of the component. */
|
|
191
|
-
color: PropTypes.oneOfType([PropTypes.oneOf(['default', 'primary', 'info', 'success', 'warning', 'danger']), PropTypes.string]),
|
|
192
|
-
/** The content rendered within the badge. */
|
|
184
|
+
/** the quantity is shown on the badge */
|
|
193
185
|
content: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
194
|
-
/**
|
|
195
|
-
contentDirection: PropTypes.oneOf(['left', 'right']),
|
|
196
|
-
/** If `true`, the badge is invisible */
|
|
197
|
-
invisible: PropTypes.bool,
|
|
198
|
-
/** Max count to show. */
|
|
186
|
+
/** the largest number is displayed on the badge */
|
|
199
187
|
max: PropTypes.number,
|
|
200
|
-
/**
|
|
188
|
+
/** used to fill background for button */
|
|
189
|
+
contentDirection: PropTypes.oneOf(['left', 'right']),
|
|
190
|
+
/** background color of badge */
|
|
191
|
+
color: PropTypes.oneOfType([PropTypes.oneOf(['default', 'primary', 'info', 'success', 'warning', 'danger']), PropTypes.string]),
|
|
192
|
+
/** use name will replace children with ButtonIcon */
|
|
201
193
|
name: PropTypes.string,
|
|
202
|
-
/**
|
|
203
|
-
|
|
204
|
-
/**
|
|
194
|
+
/** other icon props when use prop name */
|
|
195
|
+
iconProps: PropTypes.object,
|
|
196
|
+
/** size of Badge
|
|
205
197
|
*
|
|
206
198
|
* * medium (dot 8px, typography p3)
|
|
207
199
|
* * large (button 10px, typography p2)
|
|
208
200
|
* * giant (button 12px, typography p1)
|
|
209
201
|
* */
|
|
210
202
|
size: PropTypes.oneOf(['medium', 'large', 'giant']),
|
|
211
|
-
/**
|
|
203
|
+
/** Controls whether the badge is hidden when content is zero */
|
|
204
|
+
showZero: PropTypes.bool,
|
|
205
|
+
/** If true, the badge is invisible */
|
|
206
|
+
invisible: PropTypes.bool,
|
|
207
|
+
/** className of component */
|
|
208
|
+
className: PropTypes.string,
|
|
209
|
+
/** style inline of component */
|
|
212
210
|
style: PropTypes.object,
|
|
213
|
-
/**
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
* * @param {optionName} - string
|
|
220
|
-
* * Returns value - any
|
|
221
|
-
* * option(optionName, optionValue): Updates the value of a single property
|
|
222
|
-
* * @param {optionName} - string
|
|
223
|
-
* * @param {optionValue} - any
|
|
224
|
-
* * option(options): Updates the values of several properties
|
|
225
|
-
* * @param {options} - object
|
|
226
|
-
*/
|
|
227
|
-
reference: ref
|
|
211
|
+
/** the function get ref */
|
|
212
|
+
refs: PropTypes.func,
|
|
213
|
+
/** the content displayed under the number of the badge */
|
|
214
|
+
children: PropTypes.node,
|
|
215
|
+
/** any props else */
|
|
216
|
+
props: PropTypes.any
|
|
228
217
|
};
|
|
229
218
|
export { Badge };
|
|
230
219
|
export default OptionWrapper(Badge);
|
|
@@ -1438,14 +1438,12 @@ Attachment.defaultProps = {
|
|
|
1438
1438
|
maxFile: Infinity,
|
|
1439
1439
|
multiple: true,
|
|
1440
1440
|
readOnly: false,
|
|
1441
|
-
style: {},
|
|
1442
1441
|
uploadErrorInfo: {
|
|
1443
1442
|
maxFile: getGlobal(['errorDefault', 'maxFile']),
|
|
1444
1443
|
maxSize: getGlobal(['errorDefault', 'maxSize']),
|
|
1445
1444
|
fileType: getGlobal(['errorDefault', 'fileType']),
|
|
1446
1445
|
existingFile: getGlobal(['errorDefault', 'existingFile'])
|
|
1447
|
-
}
|
|
1448
|
-
viewType: 'detail'
|
|
1446
|
+
}
|
|
1449
1447
|
};
|
|
1450
1448
|
Attachment.propTypes = {
|
|
1451
1449
|
/** File types that can be accepted. */
|
|
@@ -94,7 +94,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
94
94
|
const widthInit = useRef(null);
|
|
95
95
|
const isEnabled = !readOnly && !disabled;
|
|
96
96
|
const _InputBaseCSS = InputBaseCSS(readOnly, status);
|
|
97
|
-
const _SingleLineCSS = SingleLineCSS(autoWidth
|
|
97
|
+
const _SingleLineCSS = SingleLineCSS(autoWidth);
|
|
98
98
|
const _InputCSS = InputCSS(autoWidth, isEnabled, hoverTooltip);
|
|
99
99
|
const _TypoCSS = TypoCSS(disabled);
|
|
100
100
|
const _TextAreaCSS = TextAreaCSS(resize, readOnly);
|
|
@@ -410,18 +410,16 @@ const InputBaseCSS = (readOnly, status) => css`
|
|
|
410
410
|
top: 100%;
|
|
411
411
|
}
|
|
412
412
|
`;
|
|
413
|
-
const SingleLineCSS =
|
|
413
|
+
const SingleLineCSS = autoWidth => css`
|
|
414
414
|
${parseWidthHeight(autoWidth ? 'max-content' : 'auto', 'max-content')}
|
|
415
415
|
${alignCenter};
|
|
416
416
|
flex: 1 1 auto;
|
|
417
417
|
&:focus-within {
|
|
418
|
-
${
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
`}
|
|
418
|
+
border-bottom-color: ${semanticInfo};
|
|
419
|
+
&::after {
|
|
420
|
+
border-bottom-color: inherit;
|
|
421
|
+
transform: scaleX(1);
|
|
422
|
+
}
|
|
425
423
|
}
|
|
426
424
|
&.outlined {
|
|
427
425
|
${parseHeight(40)};
|
package/components/tab/tab.js
CHANGED
|
@@ -102,7 +102,7 @@ const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
102
102
|
css: _IndicatorCSS,
|
|
103
103
|
className: 'Indicator'
|
|
104
104
|
}));
|
|
105
|
-
}, [children, className, color, disabled, endIcon, index, label,
|
|
105
|
+
}, [children, className, color, disabled, endIcon, index, label, level, onClick, props, startIcon, style, isVertical, tabIndexState]);
|
|
106
106
|
}));
|
|
107
107
|
const TabButtonCSS = (color, isVertical) => css`
|
|
108
108
|
${flexRow};
|
package/package.json
CHANGED
|
@@ -1,73 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "diginet-core-ui",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.3.81",
|
|
4
|
+
"description": "The DigiNet core ui",
|
|
5
|
+
"homepage": "https://diginet.com.vn",
|
|
5
6
|
"main": "index.js",
|
|
6
|
-
"license": "UNLICENSED",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start": "
|
|
9
|
-
"start
|
|
10
|
-
"build
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"build:darwin:linux:default": "rm -rf dist && npm run compile && sass --style=compressed src/scss:dist/css && cp -rf src/assets dist/assets",
|
|
14
|
-
"compile": "babel src --out-dir dist --ignore **/*.stories.js",
|
|
15
|
-
"pack": "npm run build && cp *.md dist/ && npm run version:bump --silent && npm run version:add --silent && cd dist && npm pack",
|
|
16
|
-
"production-keep-version": "npm run build && cp *.md dist/ && cp package.json dist/ && cd dist && npm publish",
|
|
17
|
-
"beta": "npm run build && cp *.md dist/ && cp package.json dist/ && cd dist && npm publish --tag beta",
|
|
18
|
-
"production": "npm run build && cp *.md dist/ && npm run version:bump --silent && npm run version:add --silent && cd dist && npm publish",
|
|
19
|
-
"version:add": "run-script-os",
|
|
20
|
-
"version:add:windows": "cat package.json.tmp | sed \"s/0.0.0/%npm_package_version%/g\" > dist/package.json",
|
|
21
|
-
"version:add:darwin:linux:default": "VERSION=$(npm run version:extract --silent) && cat package.json.tmp | sed \"s/0.0.0/${VERSION}/g\" > dist/package.json",
|
|
22
|
-
"version:bump": "npm version patch --no-git-tag-version --silent",
|
|
23
|
-
"version:extract": "cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'",
|
|
24
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
25
|
-
"lint": "eslint --fix --config .eslintrc.js \"**/*.js\"",
|
|
26
|
-
"eslint-test": "onchange \"src/**/*.{js,jsx,json}\" -- eslint . --fix",
|
|
27
|
-
"test-storybook": "test-storybook --url http://localhost:9050"
|
|
8
|
+
"start-js": "react-scripts start --max_old_space_size=4096",
|
|
9
|
+
"start": "npx npm-run-all -p start-js",
|
|
10
|
+
"build": "GENERATE_SOURCEMAP=false && react-scripts build --env=production --max_old_space_size=8192",
|
|
11
|
+
"eject": "react-scripts eject",
|
|
12
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
28
13
|
},
|
|
29
14
|
"dependencies": {
|
|
30
15
|
"@emotion/core": "^10.0.35",
|
|
31
|
-
"babel-plugin-module-resolver": "^4.1.0",
|
|
32
16
|
"prop-types": "^15.7.2"
|
|
33
17
|
},
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
"git add"
|
|
38
|
-
]
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://diginetvn@bitbucket.org/diginetvn/diginet-core-ui.git"
|
|
39
21
|
},
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"husky": "^7.0.4",
|
|
61
|
-
"jest": "^27.5.1",
|
|
62
|
-
"lint-staged": "^12.1.2",
|
|
63
|
-
"mkdirp": "^1.0.4",
|
|
64
|
-
"npm-run-all": "^4.1.5",
|
|
65
|
-
"onchange": "^7.1.0",
|
|
66
|
-
"postcss-flexbugs-fixes": "^5.0.2",
|
|
67
|
-
"react": "^17.0.1",
|
|
68
|
-
"react-dom": "^17.0.1",
|
|
69
|
-
"rimraf": "^3.0.2",
|
|
70
|
-
"run-script-os": "^1.1.6",
|
|
71
|
-
"sass": "^1.37.0"
|
|
72
|
-
}
|
|
22
|
+
"keywords": [
|
|
23
|
+
"core ui",
|
|
24
|
+
"diginet"
|
|
25
|
+
],
|
|
26
|
+
"author": "rocachien",
|
|
27
|
+
"contributors": [
|
|
28
|
+
{
|
|
29
|
+
"name": "Chien Do",
|
|
30
|
+
"email": "rocachien@gmail.com"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "Nhat Tran",
|
|
34
|
+
"email": "tranminhnhat1005@gmail.com"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "Thuan Nguyen",
|
|
38
|
+
"email": "nt.thuan.hutech@gmail.com"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"license": "MIT"
|
|
73
42
|
}
|
package/readme.md
CHANGED
|
@@ -38,6 +38,16 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.81
|
|
42
|
+
- \[Added\]: Icon – Feedback, Newspaper
|
|
43
|
+
- \[Changed\]: Button – Add prop href, urlParams
|
|
44
|
+
- \[Changed\]: Divider – Allow using CORE colors
|
|
45
|
+
- \[Fixed\]: Attachment – Fix callback return attached items not file type; Optimize code
|
|
46
|
+
- \[Fixed\]: PopupV2 – Fix warning prop description
|
|
47
|
+
- \[Fixed\]: Popover – Fix backdrop scroll when show popover
|
|
48
|
+
- \[Fixed\]: DateRangePicker – Fix cannot click end icon
|
|
49
|
+
- \[Fixed\]: CircularProgress – Temporary fix transform rotate inside flex column
|
|
50
|
+
|
|
41
51
|
## 1.3.80
|
|
42
52
|
- \[Changed\]: ButtonMore – Update Button More with new design
|
|
43
53
|
- \[Changed\]: BABEL – Add babel-plugin-module-resolver
|