diginet-core-ui 1.3.74 → 1.3.75-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/button/icon.js +21 -21
- package/components/button/index.js +13 -13
- package/components/form-control/attachment/index.js +24 -22
- package/components/form-control/checkbox/index.js +41 -37
- package/components/form-control/date-range-picker/index.js +325 -312
- package/components/form-control/dropdown/index.js +35 -35
- package/components/form-control/label/index.js +6 -6
- package/components/form-control/number-input/index2.js +152 -147
- package/components/popover/index.js +38 -27
- package/components/progress/circular.js +201 -145
- package/components/tab/tab-container.js +21 -19
- package/components/tab/tab-header.js +37 -35
- package/components/tab/tab-panel.js +15 -13
- package/components/tab/tab.js +16 -14
- package/components/tooltip/index.js +61 -58
- package/components/tree-view/index.js +38 -38
- package/components/typography/index.js +12 -12
- package/package.json +61 -31
- package/readme.md +3 -0
- package/styles/general.js +11 -11
- package/theme/set-theme.js +3 -3
|
@@ -376,14 +376,14 @@ ButtonIcon.propTypes = {
|
|
|
376
376
|
/** Name of [icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic). */
|
|
377
377
|
name: PropTypes.string,
|
|
378
378
|
|
|
379
|
-
/**
|
|
380
|
-
* The size of the component.
|
|
381
|
-
*
|
|
382
|
-
* * tiny (button 24px, icon 16px)
|
|
383
|
-
* * small (button 32px, icon 20px)
|
|
384
|
-
* * medium (button 40px, icon 24px)
|
|
385
|
-
* * large (button 48px, icon 32px)
|
|
386
|
-
* * giant (button 56px, icon 40px)
|
|
379
|
+
/**
|
|
380
|
+
* The size of the component.
|
|
381
|
+
*
|
|
382
|
+
* * tiny (button 24px, icon 16px)
|
|
383
|
+
* * small (button 32px, icon 20px)
|
|
384
|
+
* * medium (button 40px, icon 24px)
|
|
385
|
+
* * large (button 48px, icon 32px)
|
|
386
|
+
* * giant (button 56px, icon 40px)
|
|
387
387
|
* */
|
|
388
388
|
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant']),
|
|
389
389
|
|
|
@@ -399,19 +399,19 @@ ButtonIcon.propTypes = {
|
|
|
399
399
|
/** Width of the component. */
|
|
400
400
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
401
401
|
|
|
402
|
-
/**
|
|
403
|
-
* ref methods (ref.current.instance.*method*)
|
|
404
|
-
*
|
|
405
|
-
* * option(): Gets all UI component properties
|
|
406
|
-
* * Returns value - object
|
|
407
|
-
* * option(optionName): Gets the value of a single property
|
|
408
|
-
* * @param {optionName} - string
|
|
409
|
-
* * Returns value - any
|
|
410
|
-
* * option(optionName, optionValue): Updates the value of a single property
|
|
411
|
-
* * @param {optionName} - string
|
|
412
|
-
* * @param {optionValue} - any
|
|
413
|
-
* * option(options): Updates the values of several properties
|
|
414
|
-
* * @param {options} - object
|
|
402
|
+
/**
|
|
403
|
+
* ref methods (ref.current.instance.*method*)
|
|
404
|
+
*
|
|
405
|
+
* * option(): Gets all UI component properties
|
|
406
|
+
* * Returns value - object
|
|
407
|
+
* * option(optionName): Gets the value of a single property
|
|
408
|
+
* * @param {optionName} - string
|
|
409
|
+
* * Returns value - any
|
|
410
|
+
* * option(optionName, optionValue): Updates the value of a single property
|
|
411
|
+
* * @param {optionName} - string
|
|
412
|
+
* * @param {optionValue} - any
|
|
413
|
+
* * option(options): Updates the values of several properties
|
|
414
|
+
* * @param {options} - object
|
|
415
415
|
*/
|
|
416
416
|
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
417
417
|
current: PropTypes.instanceOf(Element)
|
|
@@ -491,19 +491,19 @@ Button.propTypes = {
|
|
|
491
491
|
/** The variant to use. */
|
|
492
492
|
viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'link']),
|
|
493
493
|
|
|
494
|
-
/**
|
|
495
|
-
* ref methods (ref.current.instance.*method*)
|
|
496
|
-
*
|
|
497
|
-
* * option(): Gets all UI component properties
|
|
498
|
-
* * Returns value - object
|
|
499
|
-
* * option(optionName): Gets the value of a single property
|
|
500
|
-
* * @param {optionName} - string
|
|
501
|
-
* * Returns value - any
|
|
502
|
-
* * option(optionName, optionValue): Updates the value of a single property
|
|
503
|
-
* * @param {optionName} - string
|
|
504
|
-
* * @param {optionValue} - any
|
|
505
|
-
* * option(options): Updates the values of several properties
|
|
506
|
-
* * @param {options} - object
|
|
494
|
+
/**
|
|
495
|
+
* ref methods (ref.current.instance.*method*)
|
|
496
|
+
*
|
|
497
|
+
* * option(): Gets all UI component properties
|
|
498
|
+
* * Returns value - object
|
|
499
|
+
* * option(optionName): Gets the value of a single property
|
|
500
|
+
* * @param {optionName} - string
|
|
501
|
+
* * Returns value - any
|
|
502
|
+
* * option(optionName, optionValue): Updates the value of a single property
|
|
503
|
+
* * @param {optionName} - string
|
|
504
|
+
* * @param {optionValue} - any
|
|
505
|
+
* * option(options): Updates the values of several properties
|
|
506
|
+
* * @param {options} - object
|
|
507
507
|
*/
|
|
508
508
|
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
509
509
|
current: PropTypes.instanceOf(Element)
|
|
@@ -1774,12 +1774,14 @@ Attachment.defaultProps = {
|
|
|
1774
1774
|
maxFile: Infinity,
|
|
1775
1775
|
multiple: true,
|
|
1776
1776
|
readOnly: false,
|
|
1777
|
+
style: {},
|
|
1777
1778
|
uploadErrorInfo: {
|
|
1778
1779
|
maxFile: getGlobal(['errorDefault', 'maxFile']),
|
|
1779
1780
|
maxSize: getGlobal(['errorDefault', 'maxSize']),
|
|
1780
1781
|
fileType: getGlobal(['errorDefault', 'fileType']),
|
|
1781
1782
|
existingFile: getGlobal(['errorDefault', 'existingFile'])
|
|
1782
|
-
}
|
|
1783
|
+
},
|
|
1784
|
+
viewType: 'detail'
|
|
1783
1785
|
};
|
|
1784
1786
|
Attachment.propTypes = {
|
|
1785
1787
|
/** File types that can be accepted. */
|
|
@@ -1791,17 +1793,17 @@ Attachment.propTypes = {
|
|
|
1791
1793
|
/** Class for component. */
|
|
1792
1794
|
className: PropTypes.string,
|
|
1793
1795
|
|
|
1794
|
-
/** List attachment:<br />
|
|
1795
|
-
* [{<br />
|
|
1796
|
-
* "AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
|
|
1797
|
-
* "URL": "https://apricot.diginet.com.vn/cdn-dev/file/8a07bee1eeff17a14eee.jpg?path=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlUGF0aCI6Ii8yMDIwLzA4LzQ0YjNhYjQ4LTMwNGQtNDQ3NC05ZDk0LWNkNGVlMDQwOGNlMy5qcGciLCJmaWxlTmFtZSI6IjhhMDdiZWUxZWVmZjE3YTE0ZWVlLmpwZyIsImZpbGVTaXplIjoyNDg4MzcsImZpbGVUeXBlIjoiaW1hZ2UvanBlZyIsImlhdCI6MTU5ODI0NDMwMiwiZXhwIjo4Nzk5ODI0NDMwMn0.fow6O5fp2z3vieA9gom5RRwQ7xxwBx9_7X2Fe8T2YI0",<br />
|
|
1798
|
-
* "FileName": "8a07bee1eeff17a14eee.jpg",<br />
|
|
1799
|
-
* "FileSize": 248837,<br />
|
|
1800
|
-
* "KeyID": "W39OAD3YGLCWAQKV1D6PGEKNW4RLGVTZTUWLYEVFQ2QG8AOCXW",<br />
|
|
1801
|
-
* "CreateUserID": "LEMONADMIN",<br />
|
|
1802
|
-
* "CreateDate": "2020-08-24T11:54:04.307Z",<br />
|
|
1803
|
-
* "UserName": "Quản trị hệ thống"<br />
|
|
1804
|
-
* }, ...]
|
|
1796
|
+
/** List attachment:<br />
|
|
1797
|
+
* [{<br />
|
|
1798
|
+
* "AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
|
|
1799
|
+
* "URL": "https://apricot.diginet.com.vn/cdn-dev/file/8a07bee1eeff17a14eee.jpg?path=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlUGF0aCI6Ii8yMDIwLzA4LzQ0YjNhYjQ4LTMwNGQtNDQ3NC05ZDk0LWNkNGVlMDQwOGNlMy5qcGciLCJmaWxlTmFtZSI6IjhhMDdiZWUxZWVmZjE3YTE0ZWVlLmpwZyIsImZpbGVTaXplIjoyNDg4MzcsImZpbGVUeXBlIjoiaW1hZ2UvanBlZyIsImlhdCI6MTU5ODI0NDMwMiwiZXhwIjo4Nzk5ODI0NDMwMn0.fow6O5fp2z3vieA9gom5RRwQ7xxwBx9_7X2Fe8T2YI0",<br />
|
|
1800
|
+
* "FileName": "8a07bee1eeff17a14eee.jpg",<br />
|
|
1801
|
+
* "FileSize": 248837,<br />
|
|
1802
|
+
* "KeyID": "W39OAD3YGLCWAQKV1D6PGEKNW4RLGVTZTUWLYEVFQ2QG8AOCXW",<br />
|
|
1803
|
+
* "CreateUserID": "LEMONADMIN",<br />
|
|
1804
|
+
* "CreateDate": "2020-08-24T11:54:04.307Z",<br />
|
|
1805
|
+
* "UserName": "Quản trị hệ thống"<br />
|
|
1806
|
+
* }, ...]
|
|
1805
1807
|
*/
|
|
1806
1808
|
data: PropTypes.array,
|
|
1807
1809
|
|
|
@@ -1844,16 +1846,16 @@ Attachment.propTypes = {
|
|
|
1844
1846
|
/** Download attached event, if not it will use default. */
|
|
1845
1847
|
onDownload: PropTypes.func,
|
|
1846
1848
|
|
|
1847
|
-
/**
|
|
1848
|
-
* event when removed file(s)
|
|
1849
|
-
*
|
|
1850
|
-
* return data: {<br/>
|
|
1851
|
-
* attached: [Files] (insist old and all new files )<br/>
|
|
1852
|
-
* allNewAttached: [Files]<br/>
|
|
1853
|
-
* oldAttached: [Files]<br/>
|
|
1854
|
-
* removedAttached: [Files]<br/>
|
|
1855
|
-
* element: [NodeList (just removed)]<br/>
|
|
1856
|
-
* }
|
|
1849
|
+
/**
|
|
1850
|
+
* event when removed file(s)
|
|
1851
|
+
*
|
|
1852
|
+
* return data: {<br/>
|
|
1853
|
+
* attached: [Files] (insist old and all new files )<br/>
|
|
1854
|
+
* allNewAttached: [Files]<br/>
|
|
1855
|
+
* oldAttached: [Files]<br/>
|
|
1856
|
+
* removedAttached: [Files]<br/>
|
|
1857
|
+
* element: [NodeList (just removed)]<br/>
|
|
1858
|
+
* }
|
|
1857
1859
|
*/
|
|
1858
1860
|
onRemove: PropTypes.func,
|
|
1859
1861
|
|
|
@@ -5,8 +5,8 @@ import { css, jsx } from '@emotion/core';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { forwardRef, memo, useEffect, useRef, useState, useImperativeHandle, Fragment } from 'react';
|
|
7
7
|
import { Typography } from '../..';
|
|
8
|
-
import { alignCenter, alignStart, borderBox, cursorPointer, displayBlock, flexRow, positionAbsolute, positionRelative, cursorNoDrop, parseWidthHeight } from '../../../styles/general';
|
|
9
|
-
import { randomString } from '../../../utils';
|
|
8
|
+
import { alignCenter, alignStart, borderBox, cursorPointer, displayBlock, flexRow, positionAbsolute, positionRelative, cursorNoDrop, parseWidthHeight, border } from '../../../styles/general';
|
|
9
|
+
import { classNames, randomString, refType as ref } from '../../../utils';
|
|
10
10
|
import { color as colors } from '../../../styles/colors';
|
|
11
11
|
import theme from '../../../theme/settings';
|
|
12
12
|
const {
|
|
@@ -29,26 +29,27 @@ const {
|
|
|
29
29
|
} = theme;
|
|
30
30
|
const padding = spacing(0.75);
|
|
31
31
|
const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
32
|
-
|
|
32
|
+
action = {},
|
|
33
|
+
checked,
|
|
34
|
+
children,
|
|
33
35
|
className,
|
|
34
|
-
disabled,
|
|
35
|
-
readOnly,
|
|
36
|
-
name,
|
|
37
|
-
label,
|
|
38
36
|
color,
|
|
39
|
-
value,
|
|
40
|
-
checked,
|
|
41
37
|
defaultChecked,
|
|
42
38
|
determinate,
|
|
43
|
-
|
|
44
|
-
inputRef,
|
|
45
|
-
children,
|
|
46
|
-
inputProps,
|
|
39
|
+
disabled,
|
|
47
40
|
forTreeView,
|
|
48
|
-
|
|
41
|
+
id,
|
|
42
|
+
inputProps,
|
|
43
|
+
inputRef,
|
|
44
|
+
label,
|
|
49
45
|
labelProps,
|
|
50
|
-
|
|
46
|
+
name,
|
|
47
|
+
onChange,
|
|
48
|
+
readOnly,
|
|
51
49
|
required,
|
|
50
|
+
stopPropagation,
|
|
51
|
+
value,
|
|
52
|
+
width,
|
|
52
53
|
...props
|
|
53
54
|
}, reference) => {
|
|
54
55
|
if (!inputRef) {
|
|
@@ -82,11 +83,11 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
setChecked(checked !== undefined ? Boolean(checked) : !checkedState);
|
|
86
|
+
const currentInputRef = inputRef.current;
|
|
87
|
+
if (!forTreeView) inputRef.current.checked = !checkedState;
|
|
85
88
|
const e = {
|
|
86
89
|
value: forTreeView ? oldLogicChecked : !checkedState,
|
|
87
|
-
target:
|
|
88
|
-
checked: !checkedState
|
|
89
|
-
}
|
|
90
|
+
target: currentInputRef
|
|
90
91
|
};
|
|
91
92
|
if (onChange) onChange(e, checkedState);
|
|
92
93
|
};
|
|
@@ -102,10 +103,12 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
102
103
|
}, [checked]);
|
|
103
104
|
useImperativeHandle(reference, () => {
|
|
104
105
|
const currentRef = ref.current || {};
|
|
106
|
+
currentRef.element = ref.current;
|
|
105
107
|
const _instance = {
|
|
106
108
|
determinate: determinate,
|
|
107
109
|
setChecked: setChecked,
|
|
108
|
-
getChecked: () => checkedState
|
|
110
|
+
getChecked: () => checkedState,
|
|
111
|
+
...action
|
|
109
112
|
}; // methods
|
|
110
113
|
|
|
111
114
|
_instance.__proto__ = {}; // hidden methods
|
|
@@ -121,17 +124,17 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
121
124
|
return jsx("div", {
|
|
122
125
|
id: 'DGN-UI-Checkbox-' + id.replace('DGN-UI-', ''),
|
|
123
126
|
css: CheckboxContainerCSS,
|
|
124
|
-
className:
|
|
127
|
+
className: classNames('DGN-UI-Checkbox', className),
|
|
125
128
|
ref: ref,
|
|
126
129
|
...props,
|
|
127
130
|
onClick: handleChange
|
|
128
131
|
}, jsx("div", {
|
|
129
132
|
css: CheckBoxRootCSS,
|
|
130
|
-
className:
|
|
133
|
+
className: classNames('DGN-UI-Checkbox-Root', disabled && 'disabled', readOnly && 'read-only')
|
|
131
134
|
}, jsx("input", {
|
|
132
135
|
value: value,
|
|
133
136
|
...inputProps,
|
|
134
|
-
className:
|
|
137
|
+
className: classNames(determinate ? 'determinate' : 'indeterminate', inputProps === null || inputProps === void 0 ? void 0 : inputProps.className),
|
|
135
138
|
readOnly: readOnly || inputProps.readOnly,
|
|
136
139
|
disabled: disabled || inputProps.disabled,
|
|
137
140
|
ref: inputRef,
|
|
@@ -145,7 +148,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
145
148
|
}), jsx("label", {
|
|
146
149
|
css: CheckBoxLabelCSS
|
|
147
150
|
}, jsx("span", {
|
|
148
|
-
className:
|
|
151
|
+
className: classNames(determinate ? 'determinate' : 'indeterminate', readOnly && 'read-only', disabled && 'disabled'),
|
|
149
152
|
css: _CheckBoxSquareCSS
|
|
150
153
|
}), (children || label) && jsx(Typography, {
|
|
151
154
|
type: 'p1',
|
|
@@ -167,35 +170,33 @@ const CheckBoxSquareCSS = (width, clMain) => css`
|
|
|
167
170
|
${cursorPointer};
|
|
168
171
|
${borderBox};
|
|
169
172
|
${parseWidthHeight(width, width)};
|
|
173
|
+
${border(2, rest)};
|
|
170
174
|
min-width: ${width};
|
|
171
175
|
min-height: ${width};
|
|
172
176
|
background-color: ${white};
|
|
173
|
-
border: 2px solid ${rest};
|
|
174
177
|
border-radius: 2px;
|
|
175
178
|
margin: ${padding}px;
|
|
176
179
|
&.determinate {
|
|
177
180
|
&::after {
|
|
178
181
|
${displayBlock};
|
|
179
182
|
${positionAbsolute};
|
|
183
|
+
${parseWidthHeight(12.6, 7)};
|
|
180
184
|
content: '';
|
|
181
|
-
height: 7px;
|
|
182
185
|
left: 50%;
|
|
183
186
|
top: 43%;
|
|
184
187
|
transform: translate(-50%, -50%) scale(0) rotate(45deg);
|
|
185
188
|
transition: transform 0.3s;
|
|
186
|
-
width: 12.6px;
|
|
187
189
|
}
|
|
188
190
|
}
|
|
189
191
|
&.indeterminate {
|
|
190
192
|
&::after {
|
|
191
193
|
${flexRow};
|
|
192
194
|
${positionAbsolute};
|
|
195
|
+
${parseWidthHeight(10, 2)};
|
|
193
196
|
content: '';
|
|
194
197
|
background-color: white;
|
|
195
198
|
left: 2px;
|
|
196
199
|
top: 6px;
|
|
197
|
-
width: 10px;
|
|
198
|
-
height: 2px;
|
|
199
200
|
transition: transform 0.3s;
|
|
200
201
|
transform: scale(0);
|
|
201
202
|
}
|
|
@@ -278,17 +279,17 @@ const CheckboxContainerCSS = css`
|
|
|
278
279
|
width: fit-content;
|
|
279
280
|
`;
|
|
280
281
|
Checkbox.defaultProps = {
|
|
281
|
-
label: '',
|
|
282
282
|
className: '',
|
|
283
283
|
color: 'primary',
|
|
284
|
-
disabled: false,
|
|
285
|
-
readOnly: false,
|
|
286
284
|
defaultChecked: false,
|
|
287
285
|
determinate: true,
|
|
286
|
+
disabled: false,
|
|
288
287
|
inputProps: {},
|
|
288
|
+
label: '',
|
|
289
289
|
labelProps: {},
|
|
290
|
-
|
|
291
|
-
stopPropagation: true
|
|
290
|
+
readOnly: false,
|
|
291
|
+
stopPropagation: true,
|
|
292
|
+
width: 18
|
|
292
293
|
};
|
|
293
294
|
Checkbox.propTypes = {
|
|
294
295
|
/** If `true`, the component is checked. */
|
|
@@ -315,6 +316,9 @@ Checkbox.propTypes = {
|
|
|
315
316
|
/** [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element. */
|
|
316
317
|
inputProps: PropTypes.object,
|
|
317
318
|
|
|
319
|
+
/** Pass a ref to the input element. */
|
|
320
|
+
inputRef: ref,
|
|
321
|
+
|
|
318
322
|
/** The name of the Radio is displayed on the interface. */
|
|
319
323
|
label: PropTypes.string,
|
|
320
324
|
|
|
@@ -334,13 +338,13 @@ Checkbox.propTypes = {
|
|
|
334
338
|
/** If `true`, the component is readonly. */
|
|
335
339
|
readOnly: PropTypes.bool,
|
|
336
340
|
|
|
337
|
-
/**
|
|
338
|
-
|
|
341
|
+
/** If `true`, the label will indicate that the checkbox is required. */
|
|
342
|
+
required: PropTypes.bool,
|
|
339
343
|
|
|
340
344
|
/** The value of input */
|
|
341
345
|
value: PropTypes.any,
|
|
342
346
|
|
|
343
|
-
/**
|
|
344
|
-
|
|
347
|
+
/** The width of checkbox. */
|
|
348
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
345
349
|
};
|
|
346
350
|
export default Checkbox;
|