diginet-core-ui 1.3.81 → 1.3.82-beta.2
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/badge/index.js +86 -75
- package/components/form-control/attachment/index.js +5 -1
- package/components/form-control/input-base/index.js +20 -20
- package/components/form-control/label/index.js +9 -8
- package/components/grid/Col.js +5 -2
- package/components/grid/Container.js +2 -2
- package/components/grid/Row.js +2 -2
- package/components/grid/index.js +14 -9
- package/components/popover/index.js +1 -1
- package/components/progress/circular.js +11 -9
- package/components/tab/tab.js +1 -1
- package/components/typography/index.js +1 -1
- package/icons/menu/v2/index.js +40 -16
- package/package.json +62 -31
- package/readme.md +3 -0
- package/utils/index.js +9 -8
|
@@ -1,25 +1,28 @@
|
|
|
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 { Icon } from "./..";
|
|
6
5
|
import OptionWrapper from "../others/option-wrapper";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { alignCenter, borderBox, borderRadius4px, flexRow, flexWrap, inlineFlex, justifyCenter, pointerEventsNone, positionAbsolute, positionRelative } from "../../styles/general";
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
paragraph1,
|
|
13
|
-
paragraph2,
|
|
14
|
-
paragraph3
|
|
15
|
-
} = typography;
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
8
|
+
import { alignCenter, borderBox, borderRadius4px, flexRow, flexWrap, inlineFlex, justifyCenter, parseMinWidthHeight, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative } from "../../styles/general";
|
|
9
|
+
import { useColor as colors, useTheme } from "../../theme";
|
|
10
|
+
import { classNames, refType as ref } from "../../utils";
|
|
16
11
|
const {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
12
|
+
colors: {
|
|
13
|
+
system: {
|
|
14
|
+
rest: systemRest,
|
|
15
|
+
white: systemWhite
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
typography: {
|
|
19
|
+
paragraph1,
|
|
20
|
+
paragraph2,
|
|
21
|
+
paragraph3
|
|
22
|
+
},
|
|
23
|
+
spacing
|
|
24
|
+
} = useTheme();
|
|
25
|
+
const colorMap = new Map([['default', systemRest]]);
|
|
23
26
|
const iconSizeMap = new Map([['medium', 24], ['large', 32], ['giant', 40]]);
|
|
24
27
|
const dotSizeMap = new Map([['medium', 8], ['large', 10], ['giant', 12]]);
|
|
25
28
|
const dotIndentMap = new Map([['medium', 4], ['large', 2]]);
|
|
@@ -70,28 +73,30 @@ const calDotPos = (anchorOrigin, contentDirection, dotSize, hasContent, size) =>
|
|
|
70
73
|
const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
71
74
|
action = {},
|
|
72
75
|
anchorOrigin,
|
|
73
|
-
|
|
76
|
+
children,
|
|
77
|
+
className,
|
|
78
|
+
color,
|
|
74
79
|
content,
|
|
80
|
+
contentDirection,
|
|
81
|
+
iconProps,
|
|
82
|
+
id,
|
|
83
|
+
invisible,
|
|
75
84
|
max,
|
|
76
85
|
name,
|
|
77
|
-
|
|
86
|
+
showZero,
|
|
78
87
|
size,
|
|
79
|
-
className,
|
|
80
88
|
style,
|
|
81
|
-
showZero,
|
|
82
|
-
invisible,
|
|
83
|
-
children,
|
|
84
|
-
iconProps,
|
|
85
89
|
...props
|
|
86
90
|
}, reference) => {
|
|
91
|
+
if (!reference) reference = useRef(null);
|
|
87
92
|
const ref = useRef(null);
|
|
88
93
|
const typographySize = typographySizeMap.get(size);
|
|
89
94
|
const iconSize = iconSizeMap.get(size);
|
|
90
95
|
const dotSize = content || content === 0 && showZero ? dotSizeMap.get(size) + 8 : dotSizeMap.get(size);
|
|
91
96
|
const dotColor = colors[color] || colorMap.get(color) || color;
|
|
92
97
|
const dotPos = calDotPos(anchorOrigin, !children && name ? 'right' : contentDirection, dotSize, content || content === 0, size);
|
|
93
|
-
const _BadgeNumberCSS = BadgeNumberCSS(typographySize, children, name, dotSize, dotColor
|
|
94
|
-
const _BadgeRootCSS = BadgeRootCSS(children, name, dotPos, _BadgeNumberCSS);
|
|
98
|
+
const _BadgeNumberCSS = BadgeNumberCSS(typographySize, children, name, dotSize, dotColor);
|
|
99
|
+
const _BadgeRootCSS = BadgeRootCSS(children, name, dotPos, _BadgeNumberCSS.name);
|
|
95
100
|
useImperativeHandle(reference, () => {
|
|
96
101
|
const currentRef = ref.current || {};
|
|
97
102
|
currentRef.element = ref.current;
|
|
@@ -106,28 +111,30 @@ const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
106
111
|
let node = children;
|
|
107
112
|
if (!node && name) {
|
|
108
113
|
node = jsx(Icon, {
|
|
114
|
+
viewBox: true,
|
|
109
115
|
name: name,
|
|
110
116
|
width: iconSize,
|
|
111
117
|
height: iconSize,
|
|
112
|
-
|
|
118
|
+
color: 'currentColor',
|
|
113
119
|
...iconProps
|
|
114
120
|
});
|
|
115
121
|
}
|
|
116
122
|
return jsx("div", {
|
|
117
123
|
css: _BadgeRootCSS,
|
|
118
124
|
ref: ref,
|
|
119
|
-
|
|
125
|
+
id: id,
|
|
126
|
+
className: classNames('DGN-UI-Badge', className),
|
|
120
127
|
style: style,
|
|
121
128
|
...props
|
|
122
129
|
}, jsx("span", {
|
|
123
130
|
className: 'DGN-UI-Badge-Children'
|
|
124
|
-
}, node), content !== undefined && jsx("span", {
|
|
131
|
+
}, node), content !== undefined && !invisible ? jsx("span", {
|
|
125
132
|
css: _BadgeNumberCSS,
|
|
126
133
|
className: 'DGN-UI-Badge-Dot'
|
|
127
|
-
}, max && content > max ? max + '+' : content === 0 && !showZero ? null : content));
|
|
128
|
-
}, [anchorOrigin,
|
|
134
|
+
}, max && content > max ? max + '+' : content === 0 && !showZero ? null : content) : null);
|
|
135
|
+
}, [anchorOrigin, children, className, color, content, contentDirection, iconProps, id, invisible, max, name, showZero, size, style, props]);
|
|
129
136
|
}));
|
|
130
|
-
const BadgeNumberCSS = (typographySize, children, name, dotSize, dotColor
|
|
137
|
+
const BadgeNumberCSS = (typographySize, children, name, dotSize, dotColor) => css`
|
|
131
138
|
${typographySize};
|
|
132
139
|
${flexRow};
|
|
133
140
|
${alignCenter};
|
|
@@ -136,84 +143,88 @@ const BadgeNumberCSS = (typographySize, children, name, dotSize, dotColor, invis
|
|
|
136
143
|
${borderBox};
|
|
137
144
|
${pointerEventsNone};
|
|
138
145
|
${children || name ? positionAbsolute : positionRelative};
|
|
139
|
-
color: ${
|
|
140
|
-
|
|
141
|
-
min-width: ${dotSize}px;
|
|
146
|
+
color: ${systemWhite};
|
|
147
|
+
${parseMinWidthHeight(dotSize)};
|
|
142
148
|
background-color: ${dotColor};
|
|
143
149
|
border-radius: ${dotSize / 2}px;
|
|
144
|
-
padding: 0
|
|
145
|
-
transition: transform 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
146
|
-
${invisible && 'transform: scale(0) translate(50%, -50%);'};
|
|
150
|
+
padding: ${spacing([0, 1])};
|
|
147
151
|
`;
|
|
148
|
-
const BadgeRootCSS = (children, name, dotPos,
|
|
152
|
+
const BadgeRootCSS = (children, name, dotPos, BadgeNumberCSSName) => css`
|
|
149
153
|
${inlineFlex};
|
|
150
154
|
${alignCenter};
|
|
151
155
|
${justifyCenter};
|
|
152
156
|
${positionRelative};
|
|
153
157
|
${borderBox};
|
|
154
158
|
${borderRadius4px};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
min-width: max-content;
|
|
160
|
-
.css-${_BadgeNumberCSS.name} {
|
|
161
|
-
${(children || name) && dotPos}
|
|
159
|
+
${parseWidthHeight('max-content')};
|
|
160
|
+
${parseMinWidthHeight('max-content')};
|
|
161
|
+
.css-${BadgeNumberCSSName} {
|
|
162
|
+
${(children || name) && dotPos};
|
|
162
163
|
}
|
|
163
164
|
`;
|
|
164
165
|
Badge.defaultProps = {
|
|
165
|
-
color: 'default',
|
|
166
|
-
size: 'medium',
|
|
167
166
|
anchorOrigin: {
|
|
168
167
|
vertical: 'top',
|
|
169
168
|
horizontal: 'right'
|
|
170
169
|
},
|
|
170
|
+
className: '',
|
|
171
|
+
color: 'default',
|
|
171
172
|
content: null,
|
|
172
|
-
max: 99,
|
|
173
173
|
contentDirection: 'left',
|
|
174
|
-
showZero: false,
|
|
175
174
|
invisible: false,
|
|
176
|
-
|
|
175
|
+
max: 99,
|
|
176
|
+
showZero: false,
|
|
177
|
+
size: 'medium',
|
|
177
178
|
style: {}
|
|
178
179
|
};
|
|
179
180
|
Badge.propTypes = {
|
|
181
|
+
/** The anchor of the badge. */
|
|
180
182
|
anchorOrigin: PropTypes.shape({
|
|
181
183
|
horizontal: PropTypes.oneOf(['left', 'right']),
|
|
182
184
|
vertical: PropTypes.oneOf(['top', 'bottom'])
|
|
183
185
|
}),
|
|
184
|
-
/**
|
|
186
|
+
/** The badge will be added relative to this node. */
|
|
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. */
|
|
185
193
|
content: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
186
|
-
/**
|
|
187
|
-
max: PropTypes.number,
|
|
188
|
-
/** used to fill background for button */
|
|
194
|
+
/** Direction of content within the badge */
|
|
189
195
|
contentDirection: PropTypes.oneOf(['left', 'right']),
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
/**
|
|
196
|
+
/** If `true`, the badge is invisible */
|
|
197
|
+
invisible: PropTypes.bool,
|
|
198
|
+
/** Max count to show. */
|
|
199
|
+
max: PropTypes.number,
|
|
200
|
+
/** Prop name of [ButtonIcon](https://core.diginet.com.vn/ui/?path=/docs/buttonicon) components. */
|
|
193
201
|
name: PropTypes.string,
|
|
194
|
-
/**
|
|
195
|
-
|
|
196
|
-
/**
|
|
202
|
+
/** Controls whether the badge is hidden when `content` is zero. */
|
|
203
|
+
showZero: PropTypes.bool,
|
|
204
|
+
/** Size of the components.
|
|
197
205
|
*
|
|
198
206
|
* * medium (dot 8px, typography p3)
|
|
199
207
|
* * large (button 10px, typography p2)
|
|
200
208
|
* * giant (button 12px, typography p1)
|
|
201
209
|
* */
|
|
202
210
|
size: PropTypes.oneOf(['medium', 'large', 'giant']),
|
|
203
|
-
/**
|
|
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 */
|
|
211
|
+
/** Style inline of component. */
|
|
210
212
|
style: PropTypes.object,
|
|
211
|
-
/**
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
/**
|
|
214
|
+
* ref methods (ref.current.instance.*method*)
|
|
215
|
+
*
|
|
216
|
+
* * option(): Gets all UI component properties
|
|
217
|
+
* * Returns value - object
|
|
218
|
+
* * option(optionName): Gets the value of a single property
|
|
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
|
|
217
228
|
};
|
|
218
229
|
export { Badge };
|
|
219
230
|
export default OptionWrapper(Badge);
|
|
@@ -1078,6 +1078,8 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1078
1078
|
title: "",
|
|
1079
1079
|
onDrop: onDropInput,
|
|
1080
1080
|
onDragLeave: onDropInput,
|
|
1081
|
+
onClick: e => e.target.value = null // Fix not fire onChange when select same file
|
|
1082
|
+
,
|
|
1081
1083
|
...inputProps
|
|
1082
1084
|
})), [inputProps]);
|
|
1083
1085
|
const AttachedView = useMemo(() => jsx(ScrollBar, {
|
|
@@ -1438,12 +1440,14 @@ Attachment.defaultProps = {
|
|
|
1438
1440
|
maxFile: Infinity,
|
|
1439
1441
|
multiple: true,
|
|
1440
1442
|
readOnly: false,
|
|
1443
|
+
style: {},
|
|
1441
1444
|
uploadErrorInfo: {
|
|
1442
1445
|
maxFile: getGlobal(['errorDefault', 'maxFile']),
|
|
1443
1446
|
maxSize: getGlobal(['errorDefault', 'maxSize']),
|
|
1444
1447
|
fileType: getGlobal(['errorDefault', 'fileType']),
|
|
1445
1448
|
existingFile: getGlobal(['errorDefault', 'existingFile'])
|
|
1446
|
-
}
|
|
1449
|
+
},
|
|
1450
|
+
viewType: 'detail'
|
|
1447
1451
|
};
|
|
1448
1452
|
Attachment.propTypes = {
|
|
1449
1453
|
/** File types that can be accepted. */
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { jsx, css } from '@emotion/core';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { Icon, Typography } from "../..";
|
|
7
5
|
import { getGlobal } from "../../../global";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
8
|
+
import { alignCenter, backgroundTransparent, border, borderBox, borderNone, borderRadius4px, displayBlock, flexRow, outlineNone, parseHeight, parseMinHeight, parseMinWidthHeight, parseWidth, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative } from "../../../styles/general";
|
|
9
|
+
import { useColor as colors, useTheme } from "../../../theme";
|
|
10
|
+
import { classNames, refType as ref, useInput } from "../../../utils";
|
|
13
11
|
const {
|
|
14
12
|
colors: {
|
|
15
13
|
system: {
|
|
@@ -77,6 +75,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
77
75
|
viewType,
|
|
78
76
|
...props
|
|
79
77
|
}, reference) => {
|
|
78
|
+
if (!reference) reference = useRef(null);
|
|
80
79
|
if (!autoWidth && inputProps !== null && inputProps !== void 0 && inputProps.autoWidth) autoWidth = inputProps.autoWidth;
|
|
81
80
|
const _onChange = e => {
|
|
82
81
|
onChange && onChange(e);
|
|
@@ -94,7 +93,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
94
93
|
const widthInit = useRef(null);
|
|
95
94
|
const isEnabled = !readOnly && !disabled;
|
|
96
95
|
const _InputBaseCSS = InputBaseCSS(readOnly, status);
|
|
97
|
-
const _SingleLineCSS = SingleLineCSS(autoWidth);
|
|
96
|
+
const _SingleLineCSS = SingleLineCSS(autoWidth, readOnly);
|
|
98
97
|
const _InputCSS = InputCSS(autoWidth, isEnabled, hoverTooltip);
|
|
99
98
|
const _TypoCSS = TypoCSS(disabled);
|
|
100
99
|
const _TextAreaCSS = TextAreaCSS(resize, readOnly);
|
|
@@ -406,20 +405,22 @@ const InputBaseCSS = (readOnly, status) => css`
|
|
|
406
405
|
}`}
|
|
407
406
|
& + .DGN-UI-HelperText {
|
|
408
407
|
${positionAbsolute};
|
|
409
|
-
|
|
408
|
+
${parseMinHeight(16)};
|
|
410
409
|
top: 100%;
|
|
411
410
|
}
|
|
412
411
|
`;
|
|
413
|
-
const SingleLineCSS = autoWidth => css`
|
|
412
|
+
const SingleLineCSS = (autoWidth, readOnly) => css`
|
|
414
413
|
${parseWidthHeight(autoWidth ? 'max-content' : 'auto', 'max-content')}
|
|
415
414
|
${alignCenter};
|
|
416
415
|
flex: 1 1 auto;
|
|
417
416
|
&:focus-within {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
417
|
+
${!readOnly && `
|
|
418
|
+
border-bottom-color: ${semanticInfo};
|
|
419
|
+
&::after {
|
|
420
|
+
border-bottom-color: inherit;
|
|
421
|
+
transform: scaleX(1);
|
|
422
|
+
}
|
|
423
|
+
`}
|
|
423
424
|
}
|
|
424
425
|
&.outlined {
|
|
425
426
|
${parseHeight(40)};
|
|
@@ -432,7 +433,7 @@ const InputCSS = (autoWidth, isEnabled, hoverTooltip) => css`
|
|
|
432
433
|
${outlineNone};
|
|
433
434
|
transition: all 0.1s;
|
|
434
435
|
color: ${textMain};
|
|
435
|
-
|
|
436
|
+
${backgroundTransparent};
|
|
436
437
|
padding-top: 0;
|
|
437
438
|
padding-bottom: 0;
|
|
438
439
|
${paragraph1};
|
|
@@ -493,9 +494,8 @@ const TextAreaCSS = (resize, readOnly) => css`
|
|
|
493
494
|
${positionRelative};
|
|
494
495
|
${borderBox};
|
|
495
496
|
${parseWidth('100%')};
|
|
497
|
+
${parseMinWidthHeight('max-content')};
|
|
496
498
|
color: ${textMain};
|
|
497
|
-
min-height: max-content;
|
|
498
|
-
min-width: max-content;
|
|
499
499
|
background-color: transparent;
|
|
500
500
|
padding: ${spacing(0.5, 0)};
|
|
501
501
|
overflow-y: auto;
|
|
@@ -5,7 +5,7 @@ import { Typography } from "../..";
|
|
|
5
5
|
import OptionWrapper from "../../others/option-wrapper";
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
8
|
-
import { flexRow, typographyTypes } from "../../../styles/general";
|
|
8
|
+
import { flexRow, parseMinHeight, typographyTypes } from "../../../styles/general";
|
|
9
9
|
import { useTheme } from "../../../theme";
|
|
10
10
|
import { classNames } from "../../../utils";
|
|
11
11
|
const {
|
|
@@ -33,6 +33,7 @@ const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
33
33
|
type,
|
|
34
34
|
...props
|
|
35
35
|
}, reference) => {
|
|
36
|
+
if (!reference) reference = useRef(null);
|
|
36
37
|
const ref = useRef(null);
|
|
37
38
|
useImperativeHandle(reference, () => {
|
|
38
39
|
const currentRef = ref.current || {};
|
|
@@ -71,19 +72,19 @@ const LabelContainerCSS = css`
|
|
|
71
72
|
}
|
|
72
73
|
`;
|
|
73
74
|
const LabelRootCSS = css`
|
|
74
|
-
|
|
75
|
+
${parseMinHeight(16)};
|
|
75
76
|
margin: 0;
|
|
76
77
|
word-break: break-all;
|
|
77
78
|
`;
|
|
78
79
|
Label.defaultProps = {
|
|
79
|
-
|
|
80
|
+
children: '',
|
|
81
|
+
className: '',
|
|
80
82
|
color: normal_label,
|
|
81
|
-
lineClamp: 1,
|
|
82
|
-
required: false,
|
|
83
83
|
disabled: false,
|
|
84
|
+
lineClamp: 1,
|
|
84
85
|
readOnly: false,
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
required: false,
|
|
87
|
+
type: 'h6'
|
|
87
88
|
};
|
|
88
89
|
Label.propTypes = {
|
|
89
90
|
/** The content of the component. */
|
|
@@ -99,7 +100,7 @@ Label.propTypes = {
|
|
|
99
100
|
/** Consult [Typography's](https://core.diginet.com.vn/ui/?path=/docs/typography) documents. */
|
|
100
101
|
color: PropTypes.string,
|
|
101
102
|
/** Consult [Typography's](https://core.diginet.com.vn/ui/?path=/docs/typography) documents. */
|
|
102
|
-
lineClamp: PropTypes.number,
|
|
103
|
+
lineClamp: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto'])]),
|
|
103
104
|
/** Consult [Typography's](https://core.diginet.com.vn/ui/?path=/docs/typography) documents. */
|
|
104
105
|
hoverTooltip: PropTypes.bool,
|
|
105
106
|
/** Consult [Typography's](https://core.diginet.com.vn/ui/?path=/docs/typography) documents. */
|
package/components/grid/Col.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { jsx } from '@emotion/core';
|
|
5
|
-
import
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
6
5
|
import { makeStyles } from "../../theme";
|
|
7
6
|
import { classNames } from "../../utils";
|
|
7
|
+
import Grid from '.';
|
|
8
8
|
const useStyles = makeStyles({
|
|
9
9
|
customCol: {
|
|
10
10
|
'& .DGN-UI-Control': {
|
|
@@ -45,6 +45,7 @@ Col.defaultProps = {
|
|
|
45
45
|
md: false,
|
|
46
46
|
sm: false,
|
|
47
47
|
style: {},
|
|
48
|
+
verticalAlign: 'auto',
|
|
48
49
|
wrap: 'wrap',
|
|
49
50
|
xl: false,
|
|
50
51
|
xs: true,
|
|
@@ -67,6 +68,8 @@ Col.propTypes = {
|
|
|
67
68
|
sm: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
68
69
|
/** Style inline of component. */
|
|
69
70
|
style: PropTypes.object,
|
|
71
|
+
/** Self-align of the grid item. */
|
|
72
|
+
verticalAlign: PropTypes.oneOf(['auto', 'start', 'center', 'end']),
|
|
70
73
|
/** Defines the flex-wrap style property. It's applied for all screen sizes. */
|
|
71
74
|
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
|
|
72
75
|
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `xl` breakpoint and wider screens if not overridden. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { jsx } from '@emotion/core';
|
|
5
|
-
import
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
6
5
|
import { classNames } from "../../utils";
|
|
6
|
+
import Grid from '.';
|
|
7
7
|
const checkChildren = children => {
|
|
8
8
|
if (!children) return false;
|
|
9
9
|
if (Array.isArray(children)) {
|
package/components/grid/Row.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { jsx } from '@emotion/core';
|
|
5
|
-
import
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
6
5
|
import { classNames } from "../../utils";
|
|
6
|
+
import Grid from '.';
|
|
7
7
|
const checkChildren = children => {
|
|
8
8
|
if (!children) return false;
|
|
9
9
|
if (Array.isArray(children)) {
|
package/components/grid/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import {
|
|
6
|
-
import GridContext from "./context";
|
|
7
|
-
import theme from "../../theme/settings";
|
|
8
|
-
import { breakpointKeys } from "../../theme/createBreakpoints";
|
|
5
|
+
import { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from 'react';
|
|
9
6
|
import { borderBox } from "../../styles/general";
|
|
7
|
+
import { useTheme } from "../../theme";
|
|
8
|
+
import { breakpointKeys } from "../../theme/createBreakpoints";
|
|
10
9
|
import { classNames, handleBreakpoints } from "../../utils";
|
|
10
|
+
import GridContext from "./context";
|
|
11
11
|
const {
|
|
12
12
|
breakpoints: themeBreakpoints,
|
|
13
13
|
spacing: themeSpacing
|
|
14
|
-
} =
|
|
14
|
+
} = useTheme();
|
|
15
15
|
const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
16
16
|
action = {},
|
|
17
17
|
children,
|
|
@@ -30,6 +30,7 @@ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
30
30
|
spacing,
|
|
31
31
|
style,
|
|
32
32
|
topSpacing: topSpacingProp,
|
|
33
|
+
verticalAlign,
|
|
33
34
|
wrap,
|
|
34
35
|
xl,
|
|
35
36
|
xs,
|
|
@@ -42,7 +43,7 @@ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
42
43
|
const topSpacing = topSpacingProp !== null && topSpacingProp !== void 0 ? topSpacingProp : rowSpacing;
|
|
43
44
|
const leftSpacing = leftSpacingProp !== null && leftSpacingProp !== void 0 ? leftSpacingProp : columnSpacing;
|
|
44
45
|
const ref = useRef(null);
|
|
45
|
-
const _GridCSS = GridCSS(direction, zeroMinWidth, container, item, wrap);
|
|
46
|
+
const _GridCSS = GridCSS(direction, zeroMinWidth, container, item, wrap, verticalAlign);
|
|
46
47
|
const _GridSpacingCSS = GridSpacingCSS(rowSpacing, columnSpacing, topSpacing, leftSpacing);
|
|
47
48
|
const _HandleGridCSS = HandleGridCSS([xs, sm, md, lg, xl], columns);
|
|
48
49
|
useImperativeHandle(reference, () => {
|
|
@@ -65,7 +66,7 @@ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
65
66
|
}, jsx(GridContext.Provider, {
|
|
66
67
|
value: columns
|
|
67
68
|
}, children));
|
|
68
|
-
}, [columns, columnSpacing, leftSpacing, rowSpacing, topSpacing, children, className, container, direction, id, item, lg, md, sm, spacing, style, wrap, xl, xs, zeroMinWidth]);
|
|
69
|
+
}, [columns, columnSpacing, leftSpacing, rowSpacing, topSpacing, children, className, container, direction, id, item, lg, md, sm, spacing, style, verticalAlign, wrap, xl, xs, zeroMinWidth]);
|
|
69
70
|
}));
|
|
70
71
|
const getOffset = val => {
|
|
71
72
|
const parse = parseFloat(val);
|
|
@@ -108,7 +109,7 @@ const handleGrid = (size, value, columns) => {
|
|
|
108
109
|
${css}
|
|
109
110
|
}`;
|
|
110
111
|
};
|
|
111
|
-
const GridCSS = (direction, zeroMinWidth, container, item, wrap) => css`
|
|
112
|
+
const GridCSS = (direction, zeroMinWidth, container, item, wrap, verticalAlign) => css`
|
|
112
113
|
${borderBox};
|
|
113
114
|
${container && `
|
|
114
115
|
display: flex;
|
|
@@ -117,6 +118,7 @@ const GridCSS = (direction, zeroMinWidth, container, item, wrap) => css`
|
|
|
117
118
|
`};
|
|
118
119
|
${item && `
|
|
119
120
|
margin: 0;
|
|
121
|
+
align-self: ${verticalAlign}
|
|
120
122
|
`};
|
|
121
123
|
${zeroMinWidth && `min-width: 0;`}
|
|
122
124
|
${handleBreakpoints(direction, propValue => {
|
|
@@ -182,6 +184,7 @@ Grid.defaultProps = {
|
|
|
182
184
|
sm: false,
|
|
183
185
|
spacing: 0,
|
|
184
186
|
style: {},
|
|
187
|
+
verticalAlign: 'auto',
|
|
185
188
|
wrap: 'wrap',
|
|
186
189
|
xl: false,
|
|
187
190
|
xs: false,
|
|
@@ -218,6 +221,8 @@ Grid.propTypes = {
|
|
|
218
221
|
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
219
222
|
/** Defines the vertical space of `container` components. */
|
|
220
223
|
topSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
224
|
+
/** Self-align of the grid item. */
|
|
225
|
+
verticalAlign: PropTypes.oneOf(['auto', 'start', 'center', 'end']),
|
|
221
226
|
/** Defines the flex-wrap style property. It's applied for all screen sizes. */
|
|
222
227
|
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
|
|
223
228
|
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `xl` breakpoint and wider screens if not overridden. */
|
|
@@ -182,7 +182,7 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
182
182
|
};
|
|
183
183
|
const updatePositionPopover = (el = null, cb) => {
|
|
184
184
|
var _window, _window2, _anchor6, _anchorRect, _anchorRect2, _anchor7, _anchorRect3, _anchorRect4, _anchorRect5, _anchorRect6, _anchorRect7, _anchorRect8, _anchorRect9, _anchorRect10, _anchorRect11, _anchorRect12, _newDirectionObject, _newDirectionObject$t, _transformOrigin, _newDirectionObject2, _newDirectionObject2$, _transformOrigin2;
|
|
185
|
-
|
|
185
|
+
if (el instanceof Element) setElement(el);
|
|
186
186
|
if (!ref.current) {
|
|
187
187
|
window.removeEventListener('resize', updatePositionPopover);
|
|
188
188
|
return;
|
|
@@ -167,12 +167,12 @@ const CircularProgress = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
167
167
|
const radius = Math.max(0, (containerW - circleStrokeW) / 2);
|
|
168
168
|
const radiusX10 = radius * 10;
|
|
169
169
|
const circumference = radius * 2 * Math.PI;
|
|
170
|
-
const _ContainerCSS = ContainerCSS(containerW);
|
|
170
|
+
const _ContainerCSS = ContainerCSS(containerW, directionAngle);
|
|
171
171
|
const _CircleBackgroundCSS = CircleBackgroundCSS(background, !determinate);
|
|
172
172
|
const _CircleMainCSS = CircleMainCSS(color);
|
|
173
173
|
const _CircleMainIndeterminateCSS = CircleMainIndeterminateCSS(radiusX10);
|
|
174
|
-
const _CircleMainDeterminateCSS = CircleMainDeterminateCSS(circumference, percent,
|
|
175
|
-
const _TextCSS = TextCSS(percentColor, color, dimension);
|
|
174
|
+
const _CircleMainDeterminateCSS = CircleMainDeterminateCSS(circumference, percent, duration);
|
|
175
|
+
const _TextCSS = TextCSS(percentColor, color, dimension, directionAngle);
|
|
176
176
|
useImperativeHandle(reference, () => {
|
|
177
177
|
const currentRef = ref.current || {};
|
|
178
178
|
currentRef.element = ref.current;
|
|
@@ -234,9 +234,11 @@ const keyframeDash = r => keyframes`
|
|
|
234
234
|
stroke-dashoffset: -${r * 124 / 200};
|
|
235
235
|
}
|
|
236
236
|
`;
|
|
237
|
-
const ContainerCSS = containerW => css`
|
|
237
|
+
const ContainerCSS = (containerW, directionAngle) => css`
|
|
238
238
|
${displayInlineBlock};
|
|
239
239
|
${parseWidthHeight(containerW)};
|
|
240
|
+
transform: rotate(${directionAngle}deg);
|
|
241
|
+
transform-origin: center;
|
|
240
242
|
`;
|
|
241
243
|
const AnimationRotateCSS = css`
|
|
242
244
|
animation: ${keyframeRotate} 2s linear infinite;
|
|
@@ -251,11 +253,9 @@ const CircleMainCSS = color => css`
|
|
|
251
253
|
stroke: ${color};
|
|
252
254
|
stroke-linecap: round;
|
|
253
255
|
`;
|
|
254
|
-
const CircleMainDeterminateCSS = (circumference, percent,
|
|
256
|
+
const CircleMainDeterminateCSS = (circumference, percent, duration) => css`
|
|
255
257
|
stroke-dasharray: ${`${circumference} ${circumference}`};
|
|
256
258
|
stroke-dashoffset: ${circumference - validatePercent(percent) / 100 * circumference};
|
|
257
|
-
// transform: rotate(${directionAngle}deg);
|
|
258
|
-
transform-origin: center;
|
|
259
259
|
transition: stroke-dashoffset ${duration}s cubic-bezier(0.77, 0, 0.175, 1); /* easeInOutQuart */
|
|
260
260
|
`;
|
|
261
261
|
const CircleMainIndeterminateCSS = radiusX10 => css`
|
|
@@ -263,11 +263,13 @@ const CircleMainIndeterminateCSS = radiusX10 => css`
|
|
|
263
263
|
stroke-dashoffset: 0;
|
|
264
264
|
animation: ${keyframeDash(radiusX10)} 2s ease-in-out infinite;
|
|
265
265
|
`;
|
|
266
|
-
const TextCSS = (percentColor, color, dimension) => css`
|
|
266
|
+
const TextCSS = (percentColor, color, dimension, directionAngle) => css`
|
|
267
267
|
${userSelectNone};
|
|
268
268
|
fill: ${percentColor ? percentColor : color};
|
|
269
269
|
${dimension.labelStyle}
|
|
270
270
|
text-anchor: middle;
|
|
271
|
+
transform: rotate(${-directionAngle}deg);
|
|
272
|
+
transform-origin: center;
|
|
271
273
|
`;
|
|
272
274
|
CircularProgress.defaultProps = {
|
|
273
275
|
background: lineCategory,
|
|
@@ -278,7 +280,7 @@ CircularProgress.defaultProps = {
|
|
|
278
280
|
duration: 1,
|
|
279
281
|
percent: 25,
|
|
280
282
|
percentColor: semanticInfo,
|
|
281
|
-
showValue:
|
|
283
|
+
showValue: true,
|
|
282
284
|
size: 'medium',
|
|
283
285
|
style: {}
|
|
284
286
|
};
|
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, level, onClick, props, startIcon, style, isVertical, tabIndexState]);
|
|
105
|
+
}, [children, className, color, disabled, endIcon, index, label, labelProps, level, onClick, props, startIcon, style, isVertical, tabIndexState]);
|
|
106
106
|
}));
|
|
107
107
|
const TabButtonCSS = (color, isVertical) => css`
|
|
108
108
|
${flexRow};
|
|
@@ -176,7 +176,7 @@ Typography.propTypes = {
|
|
|
176
176
|
/** If `true`, hover will show tooltip when text clamped. */
|
|
177
177
|
hoverTooltip: PropTypes.bool,
|
|
178
178
|
/** The line-clamp property truncates text at a specific number of lines. */
|
|
179
|
-
lineClamp: PropTypes.number,
|
|
179
|
+
lineClamp: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto'])]),
|
|
180
180
|
/** The component used for the root node. Either a string to use a HTML element or a component. */
|
|
181
181
|
mapping: PropTypes.string,
|
|
182
182
|
/** Callback fired when the component is clicked. */
|
package/icons/menu/v2/index.js
CHANGED
|
@@ -2,18 +2,32 @@
|
|
|
2
2
|
/* eslint-disable no-empty */
|
|
3
3
|
/** @jsxRuntime classic */
|
|
4
4
|
/** @jsx jsx */
|
|
5
|
-
import { memo, forwardRef, useRef, useMemo } from 'react';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
5
|
import { jsx } from '@emotion/core';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
8
|
+
import { classNames } from "../../../utils";
|
|
8
9
|
const IconMenu = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
9
|
-
|
|
10
|
+
action,
|
|
11
|
+
className,
|
|
12
|
+
height,
|
|
13
|
+
id,
|
|
10
14
|
name,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
style,
|
|
16
|
+
type,
|
|
17
|
+
width
|
|
18
|
+
}, reference) => {
|
|
19
|
+
if (!reference) reference = useRef(null);
|
|
20
|
+
const ref = useRef(null);
|
|
21
|
+
useImperativeHandle(reference, () => {
|
|
22
|
+
const currentRef = ref.current || {};
|
|
23
|
+
currentRef.element = ref.current;
|
|
24
|
+
const _instance = {
|
|
25
|
+
...action
|
|
26
|
+
}; // methods
|
|
27
|
+
_instance.__proto__ = {}; // hidden methods
|
|
28
|
+
currentRef.instance = _instance;
|
|
29
|
+
return currentRef;
|
|
30
|
+
});
|
|
17
31
|
const getResourceImage = fileName => {
|
|
18
32
|
let icon = require("../../../assets/images/menu/dhr/Default.svg");
|
|
19
33
|
try {
|
|
@@ -22,26 +36,36 @@ const IconMenu = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
22
36
|
return icon;
|
|
23
37
|
};
|
|
24
38
|
return useMemo(() => jsx("img", {
|
|
39
|
+
ref: ref,
|
|
40
|
+
id: id,
|
|
41
|
+
className: classNames('DGN-UI-IconMenu', className),
|
|
42
|
+
style: style,
|
|
25
43
|
src: getResourceImage(name + '.svg'),
|
|
26
44
|
width: width,
|
|
27
45
|
height: height,
|
|
28
|
-
alt:
|
|
29
|
-
}), [
|
|
46
|
+
alt: name
|
|
47
|
+
}), [className, height, id, name, style, type, width]);
|
|
30
48
|
}));
|
|
31
49
|
IconMenu.defaultProps = {
|
|
50
|
+
className: '',
|
|
51
|
+
height: '100%',
|
|
32
52
|
name: 'Default',
|
|
33
53
|
type: 'dhr',
|
|
34
54
|
width: '100%',
|
|
35
|
-
|
|
55
|
+
style: {}
|
|
36
56
|
};
|
|
37
57
|
IconMenu.propTypes = {
|
|
38
|
-
/**
|
|
39
|
-
|
|
58
|
+
/** Class for component. */
|
|
59
|
+
className: PropTypes.string,
|
|
60
|
+
/** Height of icon. */
|
|
61
|
+
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
40
62
|
/** Name of icon. */
|
|
41
63
|
name: PropTypes.string,
|
|
64
|
+
/** Menu type (DHR || ERP || BEM). */
|
|
65
|
+
type: PropTypes.oneOf(['dhr', 'erp', 'bem']),
|
|
42
66
|
/** Width of icon. */
|
|
43
67
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
44
|
-
/**
|
|
45
|
-
|
|
68
|
+
/** Style inline of component. */
|
|
69
|
+
style: PropTypes.object
|
|
46
70
|
};
|
|
47
71
|
export default IconMenu;
|
package/package.json
CHANGED
|
@@ -1,42 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "diginet-core-ui",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "
|
|
5
|
-
"homepage": "https://diginet.com.vn",
|
|
3
|
+
"version": "1.3.82-beta.2",
|
|
4
|
+
"description": "",
|
|
6
5
|
"main": "index.js",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"start
|
|
9
|
-
"start": "
|
|
10
|
-
"build": "
|
|
11
|
-
"
|
|
12
|
-
"
|
|
8
|
+
"start": "npm-run-all --parallel start-sb eslint-test",
|
|
9
|
+
"start-sb": "start-storybook -p 9050",
|
|
10
|
+
"build-storybook": "build-storybook -c .storybook -s src",
|
|
11
|
+
"build": "run-script-os",
|
|
12
|
+
"build:windows": "rimraf dist && mkdirp dist/components && npm run compile && sass --style=compressed src/scss:dist/css && xcopy src\\\\assets dist\\\\assets\\ /e /y",
|
|
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"
|
|
13
28
|
},
|
|
14
29
|
"dependencies": {
|
|
15
30
|
"@emotion/core": "^10.0.35",
|
|
31
|
+
"babel-plugin-module-resolver": "^4.1.0",
|
|
16
32
|
"prop-types": "^15.7.2"
|
|
17
33
|
},
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
34
|
+
"lint-staged": {
|
|
35
|
+
"*/**/*.{js,jsx,json}": [
|
|
36
|
+
"prettier --write",
|
|
37
|
+
"git add"
|
|
38
|
+
]
|
|
21
39
|
},
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@babel/cli": "^7.14.3",
|
|
42
|
+
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
|
43
|
+
"@babel/plugin-proposal-logical-assignment-operators": "^7.16.0",
|
|
44
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
45
|
+
"@babel/plugin-proposal-optional-chaining": "^7.14.2",
|
|
46
|
+
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
|
47
|
+
"@babel/plugin-proposal-private-property-in-object": "^7.18.6",
|
|
48
|
+
"@babel/preset-react": "^7.13.13",
|
|
49
|
+
"@storybook/addon-actions": "6.2.9",
|
|
50
|
+
"@storybook/addon-essentials": "6.2.9",
|
|
51
|
+
"@storybook/addon-links": "6.2.9",
|
|
52
|
+
"@storybook/addon-postcss": "^2.0.0",
|
|
53
|
+
"@storybook/react": "6.2.9",
|
|
54
|
+
"@storybook/test-runner": "^0.7.1",
|
|
55
|
+
"autoprefixer": "^10.3.1",
|
|
56
|
+
"babel-loader": "^8.2.2",
|
|
57
|
+
"eslint": "^8.4.1",
|
|
58
|
+
"eslint-plugin-react": "^7.27.1",
|
|
59
|
+
"eslint-plugin-regex": "^1.10.0",
|
|
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
|
+
}
|
|
42
73
|
}
|
package/readme.md
CHANGED
package/utils/index.js
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import * as utils from '.';
|
|
2
|
-
export
|
|
2
|
+
export { default as capitalize } from "./string/capitalize";
|
|
3
|
+
export { default as capitalizeSentenceCase } from "./string/capitalizeSentenceCase";
|
|
3
4
|
export { default as classNames } from "./classNames";
|
|
4
|
-
export * from "./date";
|
|
5
5
|
export { default as date } from "./date";
|
|
6
6
|
export { default as getFileType } from "./getFileType";
|
|
7
7
|
export { default as handleBreakpoints } from "./handleBreakpoints";
|
|
8
8
|
export { default as isMobile } from "./isMobile";
|
|
9
9
|
export { default as mapParent } from "./map-parent";
|
|
10
|
+
export { default as onValidate } from "./validate";
|
|
10
11
|
export { default as parseTextToHTML } from "./parseHTML";
|
|
11
12
|
export { default as promisify } from "./promisify";
|
|
12
13
|
export { default as randomString } from "./randomString";
|
|
13
14
|
export { default as refType } from "./refType";
|
|
14
15
|
export { default as removeUnicode } from "./remove-unicode";
|
|
15
|
-
export * from "./render-portal";
|
|
16
16
|
export { default as renderHTML } from "./renderHTML";
|
|
17
17
|
export { default as renderIcon } from "./renderIcon";
|
|
18
|
-
export * from "./sb-template";
|
|
19
18
|
export { default as SbTemplate } from "./sb-template";
|
|
20
|
-
export { default as capitalize } from "./string/capitalize";
|
|
21
|
-
export { default as capitalizeSentenceCase } from "./string/capitalizeSentenceCase";
|
|
22
|
-
export * from "./string/string";
|
|
23
19
|
export { default as updatePosition } from "./updatePosition";
|
|
24
20
|
export { default as useDelayUnmount } from "./useDelayUnmount";
|
|
21
|
+
export { default as useInput } from "./useInput";
|
|
25
22
|
export { default as useMediaQuery } from "./useMediaQuery";
|
|
26
23
|
export { default as useOnClickOutside } from "./useOnClickOutside";
|
|
27
24
|
export { default as usePortal } from "./usePortal";
|
|
25
|
+
export * from "./array/array";
|
|
26
|
+
export * from "./date";
|
|
27
|
+
export * from "./render-portal";
|
|
28
|
+
export * from "./sb-template";
|
|
29
|
+
export * from "./string/string";
|
|
28
30
|
export * from "./validate";
|
|
29
|
-
export { default as onValidate } from "./validate";
|
|
30
31
|
export default utils;
|