diginet-core-ui 1.3.34 → 1.3.35
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/assets/images/menu/dhr/MHRP09N0032.svg +7 -0
- package/components/avatar/index.js +19 -19
- package/components/badge/index.js +61 -64
- package/components/button/icon.js +21 -21
- package/components/button/index.js +180 -180
- package/components/button/ripple-effect.js +23 -23
- package/components/chart/Pie-v2/index.js +40 -42
- package/components/chip/index.js +129 -134
- package/components/form-control/attachment/index.js +431 -435
- package/components/form-control/calendar/function.js +69 -46
- package/components/form-control/calendar/index.js +12 -3
- package/components/form-control/control/index.js +35 -23
- package/components/form-control/date-picker/index.js +36 -36
- package/components/form-control/date-range-picker/index.js +84 -86
- package/components/form-control/dropdown/index.js +462 -431
- package/components/form-control/dropdown-box/index.js +53 -53
- package/components/form-control/label/index.js +16 -15
- package/components/form-control/money-input/index.js +106 -7
- package/components/form-control/radio/index.js +129 -132
- package/components/form-control/text-input/index.js +25 -28
- package/components/form-control/toggle/index.js +106 -107
- package/components/modal/modal.js +43 -46
- package/components/popover/index.js +27 -29
- package/components/popup/index.js +73 -77
- package/components/popup/proposals_popup.js +46 -48
- package/components/popup/v2/index.js +108 -110
- package/components/progress/circular.js +65 -66
- package/components/tab/tab-container.js +32 -14
- package/components/tab/tab-header.js +81 -56
- package/components/tab/tab-panel.js +46 -17
- package/components/tab/tab.js +105 -87
- package/components/tooltip/index.js +24 -26
- package/components/typography/index.js +10 -10
- package/icons/basic.js +148 -27
- package/icons/effect.js +26 -26
- package/package.json +1 -1
- package/readme.md +17 -0
- package/theme/settings.js +7 -5
- package/utils/number.js +11 -12
|
@@ -57,65 +57,65 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
57
57
|
/* Start styled */
|
|
58
58
|
|
|
59
59
|
const DropdownBoxRoot = css`
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
&.DGN-UI-Dropdown-Box {
|
|
61
|
+
${displayBlock}
|
|
62
|
+
${positionRelative}
|
|
63
63
|
min-width: 150px;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
height: max-content;
|
|
65
|
+
.end-icon > .DGN-UI-Icon {
|
|
66
|
+
transition: transform 250ms;
|
|
67
|
+
}
|
|
68
|
+
&.dropdown-showing {
|
|
69
|
+
.end-icon > .DGN-UI-ButtonIcon {
|
|
70
|
+
transform: rotateX(180deg);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
.DGN-UI-InputBase {
|
|
74
|
+
background-color: ${bgColor ? bgColor === true ? fillDisabled : bgColor : 'inherit'};
|
|
75
|
+
&.underlined {
|
|
76
|
+
height: 32px;
|
|
77
|
+
}
|
|
78
|
+
&.dropdown-focus {
|
|
79
|
+
background-color: inherit;
|
|
80
|
+
&::after {
|
|
81
|
+
border-bottom-color: ${info};
|
|
82
|
+
transform: scaleX(1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
`;
|
|
87
|
+
`;
|
|
88
88
|
const DropdownBoxCSS = css`
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
${displayBlock}
|
|
90
|
+
${paragraph1};
|
|
91
|
+
${positionFixed}
|
|
92
|
+
${borderBox}
|
|
93
93
|
${borderRadius4px}
|
|
94
94
|
width: 100%;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
95
|
+
height: auto;
|
|
96
|
+
max-height: 80%;
|
|
97
|
+
overflow: auto;
|
|
98
|
+
padding: 16px;
|
|
99
|
+
background-color: #fff;
|
|
100
|
+
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
101
|
+
opacity: 0;
|
|
102
|
+
transition: opacity 0.3s;
|
|
103
|
+
z-index: ${zIndex};
|
|
104
|
+
&::-webkit-scrollbar {
|
|
105
|
+
${borderRadius4px}
|
|
106
|
+
width: 8px;
|
|
107
|
+
background-color: #fff !important;
|
|
108
|
+
}
|
|
109
|
+
&::-webkit-scrollbar-thumb {
|
|
110
|
+
${borderRadius4px}
|
|
111
|
+
mix-blend-mode: normal;
|
|
112
|
+
background-color: ${scrollbar} !important;
|
|
113
|
+
background-clip: content-box;
|
|
114
|
+
}
|
|
115
|
+
.DGN-UI-TreeView {
|
|
116
|
+
padding: 1px;
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
119
119
|
/* End styled */
|
|
120
120
|
|
|
121
121
|
/* Start handler */
|
|
@@ -26,20 +26,6 @@ const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
26
26
|
className,
|
|
27
27
|
...props
|
|
28
28
|
}, ref) => {
|
|
29
|
-
const LabelRootCSS = css`
|
|
30
|
-
${ellipsis}
|
|
31
|
-
margin: 0px;
|
|
32
|
-
&.read-only,
|
|
33
|
-
&.disabled {
|
|
34
|
-
color: ${systemDisabled};
|
|
35
|
-
}
|
|
36
|
-
.required {
|
|
37
|
-
color: ${danger};
|
|
38
|
-
}
|
|
39
|
-
& + .DGN-UI-InputBase.outlined {
|
|
40
|
-
margin-top: 2px;
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
29
|
const LabelComp = useMemo(() => jsx(Typography, {
|
|
44
30
|
type: 'h6',
|
|
45
31
|
color: normal_label,
|
|
@@ -47,13 +33,28 @@ const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
47
33
|
ref: ref,
|
|
48
34
|
mapping: 'label',
|
|
49
35
|
css: LabelRootCSS,
|
|
50
|
-
className: ['DGN-UI-Label', className, readOnly ? 'read-only' : '', disabled ? 'disabled' : ''].join(' ').trim(),
|
|
36
|
+
className: ['DGN-UI-Label', className, readOnly ? 'read-only' : '', disabled ? 'disabled' : ''].join(' ').trim().replace(/\s+/g, ' '),
|
|
51
37
|
...props
|
|
52
38
|
}, children, required ? jsx("span", {
|
|
53
39
|
className: 'required'
|
|
54
40
|
}, " *") : null), [children, required, readOnly, disabled]);
|
|
55
41
|
return LabelComp;
|
|
56
42
|
}));
|
|
43
|
+
const LabelRootCSS = css`
|
|
44
|
+
${ellipsis}
|
|
45
|
+
min-height: 16px;
|
|
46
|
+
margin: 0px;
|
|
47
|
+
&.read-only,
|
|
48
|
+
&.disabled {
|
|
49
|
+
color: ${systemDisabled};
|
|
50
|
+
}
|
|
51
|
+
.required {
|
|
52
|
+
color: ${danger};
|
|
53
|
+
}
|
|
54
|
+
& + .DGN-UI-InputBase.outlined {
|
|
55
|
+
margin-top: 2px;
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
57
58
|
Label.defaultProps = {
|
|
58
59
|
required: false,
|
|
59
60
|
disabled: false,
|
|
@@ -7,6 +7,87 @@ import { jsx, css } from '@emotion/core';
|
|
|
7
7
|
import locale from '../../../locale';
|
|
8
8
|
import { InputBase, Label, HelperText } from '../../';
|
|
9
9
|
import { onValidate } from '../../../utils';
|
|
10
|
+
import { displayBlock, positionRelative } from '../../../styles/general';
|
|
11
|
+
import { getGlobal } from '../../../global';
|
|
12
|
+
|
|
13
|
+
const num2WordsVi = function () {
|
|
14
|
+
let t = ['không', 'một', 'hai', 'ba', 'bốn', 'năm', 'sáu', 'bảy', 'tám', 'chín'],
|
|
15
|
+
r = function (r, n) {
|
|
16
|
+
let o = '',
|
|
17
|
+
a = Math.floor(r / 10),
|
|
18
|
+
e = r % 10;
|
|
19
|
+
return a > 1 ? (o = ' ' + t[a] + ' mươi', 1 === e && (o += ' mốt')) : 1 === a ? (o = ' mười', 1 === e && (o += ' một')) : n && e > 0 && (o = ' lẻ'), 5 === e && a >= 1 ? o += ' lăm' : 4 === e && a >= 1 ? o += ' tư' : (e > 1 || 1 === e && 0 === a) && (o += ' ' + t[e]), o;
|
|
20
|
+
},
|
|
21
|
+
n = function (n, o) {
|
|
22
|
+
var a = '',
|
|
23
|
+
e = Math.floor(n / 100),
|
|
24
|
+
n = n % 100;
|
|
25
|
+
return o || e > 0 ? (a = ' ' + t[e] + ' trăm', a += r(n, !0)) : a = r(n, !1), a;
|
|
26
|
+
},
|
|
27
|
+
o = function (t, r) {
|
|
28
|
+
var o = '',
|
|
29
|
+
a = Math.floor(t / 1e6),
|
|
30
|
+
t = t % 1e6;
|
|
31
|
+
a > 0 && (o = n(a, r) + ' triệu', r = !0);
|
|
32
|
+
var e = Math.floor(t / 1e3),
|
|
33
|
+
t = t % 1e3;
|
|
34
|
+
return e > 0 && (o += n(e, r) + ' ngàn', r = !0), t > 0 && (o += n(t, r)), o;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
convert: function (r) {
|
|
39
|
+
let ty;
|
|
40
|
+
if (0 === r) return t[0];
|
|
41
|
+
let n = '',
|
|
42
|
+
a = '';
|
|
43
|
+
|
|
44
|
+
do ty = r % 1e9, r = Math.floor(r / 1e9), n = r > 0 ? o(ty, !0) + a + n : o(ty, !1) + a + n, a = ' tỷ'; while (r > 0);
|
|
45
|
+
|
|
46
|
+
return n.trim();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}();
|
|
50
|
+
|
|
51
|
+
var a = ['', 'one ', 'two ', 'three ', 'four ', 'five ', 'six ', 'seven ', 'eight ', 'nine ', 'ten ', 'eleven ', 'twelve ', 'thirteen ', 'fourteen ', 'fifteen ', 'sixteen ', 'seventeen ', 'eighteen ', 'nineteen '];
|
|
52
|
+
var b = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'];
|
|
53
|
+
|
|
54
|
+
const num2WordsEn = n => {
|
|
55
|
+
const arr = x => Array.from(x);
|
|
56
|
+
|
|
57
|
+
const num = x => Number(x) || 0;
|
|
58
|
+
|
|
59
|
+
const isEmpty = xs => xs.length === 0;
|
|
60
|
+
|
|
61
|
+
const take = n => xs => xs.slice(0, n);
|
|
62
|
+
|
|
63
|
+
const drop = n => xs => xs.slice(n);
|
|
64
|
+
|
|
65
|
+
const reverse = xs => xs.slice(0).reverse();
|
|
66
|
+
|
|
67
|
+
const comp = f => g => x => f(g(x));
|
|
68
|
+
|
|
69
|
+
const not = x => !x;
|
|
70
|
+
|
|
71
|
+
const chunk = n => xs => isEmpty(xs) ? [] : [take(n)(xs), ...chunk(n)(drop(n)(xs))];
|
|
72
|
+
|
|
73
|
+
let a = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'];
|
|
74
|
+
let b = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'];
|
|
75
|
+
let g = ['', 'thousand', 'million', 'billion', 'trillion', 'quadrillion', 'quintillion', 'sextillion', 'septillion', 'octillion', 'nonillion']; // this part is really nasty still
|
|
76
|
+
// it might edit this again later to show how Monoids could fix this up
|
|
77
|
+
|
|
78
|
+
let makeGroup = ([ones, tens, huns]) => {
|
|
79
|
+
return [num(huns) === 0 ? '' : a[huns] + ' hundred ', num(ones) === 0 ? b[tens] : b[tens] && b[tens] + '-' || '', a[tens + ones] || a[ones]].join('');
|
|
80
|
+
}; // "thousands" constructor; no real good names for this, i guess
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
let thousand = (group, i) => group === '' ? group : `${group} ${g[i]}`; // execute !
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
if (typeof n === 'number') return num2WordsEn(String(n));
|
|
87
|
+
if (n === '0') return 'zero';
|
|
88
|
+
return comp(chunk(3))(reverse)(arr(n)).map(makeGroup).map(thousand).filter(comp(not)(isEmpty)).reverse().join(' ');
|
|
89
|
+
};
|
|
90
|
+
|
|
10
91
|
const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
11
92
|
viewType,
|
|
12
93
|
valueTypeReturn,
|
|
@@ -44,6 +125,7 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
44
125
|
onKeyDown,
|
|
45
126
|
onKeyUp,
|
|
46
127
|
validates,
|
|
128
|
+
convertToWords,
|
|
47
129
|
...props
|
|
48
130
|
}, reference) => {
|
|
49
131
|
const ref = useRef(null);
|
|
@@ -65,8 +147,8 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
65
147
|
/* Start styled */
|
|
66
148
|
|
|
67
149
|
const MoneyInputRoot = css`
|
|
68
|
-
|
|
69
|
-
|
|
150
|
+
${displayBlock}
|
|
151
|
+
${positionRelative}
|
|
70
152
|
margin-bottom: 20px;
|
|
71
153
|
`;
|
|
72
154
|
/* End styled */
|
|
@@ -305,10 +387,15 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
305
387
|
inputRef.current.value = '';
|
|
306
388
|
} else {
|
|
307
389
|
const v = getValueWithDecimal(value.toString().replace('.', decimalSymbol));
|
|
308
|
-
|
|
390
|
+
|
|
391
|
+
if (convertToWords && !decimalDigit && (disabled || readOnly)) {
|
|
392
|
+
inputRef.current.value = Number.isInteger(value) ? locale.get() === 'vi' ? num2WordsVi.convert(value) : num2WordsEn(value) : getGlobal('helperInvalid');
|
|
393
|
+
} else {
|
|
394
|
+
inputRef.current.value = thousandSeparator ? getThousandSeparator(v) : v;
|
|
395
|
+
}
|
|
309
396
|
}
|
|
310
397
|
}
|
|
311
|
-
}, [value]);
|
|
398
|
+
}, [disabled, readOnly, value]);
|
|
312
399
|
useEffect(() => {
|
|
313
400
|
const valueInput = inputRef.current.value;
|
|
314
401
|
inputRef.current.value = getValueWithDecimal(valueInput);
|
|
@@ -316,8 +403,16 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
316
403
|
/* End handler */
|
|
317
404
|
|
|
318
405
|
useImperativeHandle(reference, () => {
|
|
319
|
-
ref.current
|
|
320
|
-
|
|
406
|
+
const currentRef = ref.current || {};
|
|
407
|
+
const _instance = {
|
|
408
|
+
getThousandSeparator: getThousandSeparator
|
|
409
|
+
}; // methods
|
|
410
|
+
|
|
411
|
+
_instance.__proto__ = {}; // hidden methods
|
|
412
|
+
|
|
413
|
+
currentRef.instance = _instance;
|
|
414
|
+
currentRef.getThousandSeparator = getThousandSeparator;
|
|
415
|
+
return currentRef;
|
|
321
416
|
});
|
|
322
417
|
const validateResult = validates && onValidate(value, validates, true);
|
|
323
418
|
return jsx("div", {
|
|
@@ -375,7 +470,8 @@ MoneyInput.defaultProps = {
|
|
|
375
470
|
allowZero: false,
|
|
376
471
|
disabledNegative: false,
|
|
377
472
|
thousandSeparator: false,
|
|
378
|
-
inputProps: {}
|
|
473
|
+
inputProps: {},
|
|
474
|
+
convertToWords: false
|
|
379
475
|
};
|
|
380
476
|
MoneyInput.propTypes = {
|
|
381
477
|
/** the type of border you want to display */
|
|
@@ -438,6 +534,9 @@ MoneyInput.propTypes = {
|
|
|
438
534
|
/** At least one character is required */
|
|
439
535
|
required: PropTypes.bool,
|
|
440
536
|
|
|
537
|
+
/** Convert money from number to words when readOnly || disabled */
|
|
538
|
+
convertToWords: PropTypes.bool,
|
|
539
|
+
|
|
441
540
|
/** props of input in MoneyInput component */
|
|
442
541
|
inputProps: PropTypes.object,
|
|
443
542
|
|
|
@@ -30,126 +30,123 @@ const Radio = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
30
30
|
allowSymbol: false
|
|
31
31
|
}));
|
|
32
32
|
const formCheck = css`
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
display: block;
|
|
34
|
+
position: relative;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
user-select: none;
|
|
37
|
+
&.disabled {
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
}
|
|
40
|
+
width: max-content;
|
|
41
|
+
`;
|
|
42
42
|
const formCheckInput = css`
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
`;
|
|
43
|
+
display: none;
|
|
44
|
+
position: absolute;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
&:disabled + label {
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
}
|
|
49
|
+
&:checked + label::after {
|
|
50
|
+
background-color: ${theme.colors.primary};
|
|
51
|
+
border: 1px solid ${theme.colors.primary};
|
|
52
|
+
transform: scale(0.5);
|
|
53
|
+
z-index: 0;
|
|
54
|
+
-webkit-transform: scale(0.6);
|
|
55
|
+
-ms-transform: scale(0.6);
|
|
56
|
+
}
|
|
57
|
+
&:checked + label::before {
|
|
58
|
+
border: 1px solid ${theme.colors.primary};
|
|
59
|
+
}
|
|
60
|
+
&:not(:checked) + label:hover::after,
|
|
61
|
+
&:not(:checked) + label:hover::before {
|
|
62
|
+
background: ${theme.colors.hover};
|
|
63
|
+
border: 1px solid ${theme.colors.primary};
|
|
64
|
+
}
|
|
65
|
+
&:not(:checked) + label::after,
|
|
66
|
+
&:not(:checked) + label::before {
|
|
67
|
+
background-color: white;
|
|
68
|
+
border: 1px solid ${theme.colors.border};
|
|
69
|
+
}
|
|
70
|
+
&:checked:disabled + label::after {
|
|
71
|
+
pointer-events: none;
|
|
72
|
+
cursor: not-allowed;
|
|
73
|
+
background: ${theme.colors.disabled};
|
|
74
|
+
border: 1px solid ${theme.colors.disabled};
|
|
75
|
+
}
|
|
76
|
+
&:checked:disabled + label::before {
|
|
77
|
+
pointer-events: none;
|
|
78
|
+
cursor: not-allowed;
|
|
79
|
+
background: ${theme.colors.dark12};
|
|
80
|
+
border: 1px solid ${theme.colors.disabled};
|
|
81
|
+
}
|
|
82
|
+
&:not(:checked):disabled + label::after {
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
cursor: not-allowed;
|
|
85
|
+
background: ${theme.colors.dark12};
|
|
86
|
+
border: 1px solid ${theme.colors.disabled};
|
|
87
|
+
}
|
|
88
|
+
&:not(:checked):disabled + label::before {
|
|
89
|
+
pointer-events: none;
|
|
90
|
+
cursor: not-allowed;
|
|
91
|
+
background: ${theme.colors.dark12};
|
|
92
|
+
border: 1px solid ${theme.colors.disabled};
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
96
95
|
const formCheckLabel = css`
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
`;
|
|
96
|
+
display: block;
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
position: relative;
|
|
99
|
+
padding-left: 2.19rem;
|
|
100
|
+
${typography.paragraph1};
|
|
101
|
+
margin-bottom: 0;
|
|
102
|
+
transition: 0.28s ease;
|
|
103
|
+
-o-transition: 0.28s ease;
|
|
104
|
+
-webkit-transition: 0.28s ease;
|
|
105
|
+
&::after {
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
content: '';
|
|
108
|
+
position: absolute;
|
|
109
|
+
height: 18px;
|
|
110
|
+
left: 0;
|
|
111
|
+
margin: 2px;
|
|
112
|
+
transition: 0.28s ease;
|
|
113
|
+
top: 0;
|
|
114
|
+
width: 18px;
|
|
115
|
+
z-index: 0;
|
|
116
|
+
border-radius: 50%;
|
|
117
|
+
-webkit-transition: 0.28s ease;
|
|
118
|
+
}
|
|
119
|
+
&::before {
|
|
120
|
+
box-sizing: border-box;
|
|
121
|
+
content: '';
|
|
122
|
+
position: absolute;
|
|
123
|
+
height: 18px;
|
|
124
|
+
left: 0;
|
|
125
|
+
margin: 2px;
|
|
126
|
+
transition: 0.28s ease;
|
|
127
|
+
top: 0;
|
|
128
|
+
width: 18px;
|
|
129
|
+
z-index: 0;
|
|
130
|
+
border-radius: 50%;
|
|
131
|
+
-webkit-transition: 0.28s ease;
|
|
132
|
+
}
|
|
133
|
+
&:hover::after {
|
|
134
|
+
background: ${theme.colors.hover};
|
|
135
|
+
border: 1px solid ${theme.colors.primary};
|
|
136
|
+
}
|
|
137
|
+
&:hover::before {
|
|
138
|
+
background: ${theme.colors.hover};
|
|
139
|
+
border: 1px solid ${theme.colors.primary};
|
|
140
|
+
}
|
|
141
|
+
&:hover::after {
|
|
142
|
+
box-shadow: 0 0 2px 2px ${theme.colors.focus};
|
|
143
|
+
background-color: ${theme.colors.focus};
|
|
144
|
+
}
|
|
145
|
+
&:hover::before {
|
|
146
|
+
box-shadow: 0 0 2px 2px ${theme.colors.focus};
|
|
147
|
+
background-color: ${theme.colors.focus};
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
153
150
|
|
|
154
151
|
const handleChange = e => {
|
|
155
152
|
const el = { ...e
|
|
@@ -197,11 +194,11 @@ const Radio = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
197
194
|
defaultChecked: defaultChecked,
|
|
198
195
|
css: formCheckInput,
|
|
199
196
|
id: id || unique,
|
|
200
|
-
onChange:
|
|
197
|
+
onChange: onChange ? handleChange : null
|
|
201
198
|
}), jsx("label", {
|
|
202
199
|
css: formCheckLabel,
|
|
203
200
|
htmlFor: id || unique
|
|
204
|
-
},
|
|
201
|
+
}, ' ', label || value));
|
|
205
202
|
}));
|
|
206
203
|
Radio.defaultProps = {
|
|
207
204
|
disabled: false,
|
|
@@ -211,18 +208,18 @@ Radio.defaultProps = {
|
|
|
211
208
|
className: ''
|
|
212
209
|
};
|
|
213
210
|
Radio.propTypes = {
|
|
214
|
-
/**
|
|
215
|
-
* If `true`, the component is disabled.
|
|
211
|
+
/**
|
|
212
|
+
* If `true`, the component is disabled.
|
|
216
213
|
*/
|
|
217
214
|
disabled: PropTypes.bool,
|
|
218
215
|
|
|
219
|
-
/**
|
|
220
|
-
|
|
221
|
-
|
|
216
|
+
/**
|
|
217
|
+
* If `true`, the component is checked.
|
|
218
|
+
*/
|
|
222
219
|
checked: PropTypes.bool,
|
|
223
220
|
|
|
224
|
-
/**
|
|
225
|
-
* If `true`, the component is defaultChecked.
|
|
221
|
+
/**
|
|
222
|
+
* If `true`, the component is defaultChecked.
|
|
226
223
|
*/
|
|
227
224
|
defaultChecked: PropTypes.bool,
|
|
228
225
|
|
|
@@ -244,11 +241,11 @@ Radio.propTypes = {
|
|
|
244
241
|
/** props for input */
|
|
245
242
|
inputProps: PropTypes.object,
|
|
246
243
|
|
|
247
|
-
/** Callback fired when the state is changed.
|
|
248
|
-
*
|
|
249
|
-
* @param {object} event The event source of the callback.
|
|
250
|
-
* You can pull out the new value by accessing `event.target.value` (string).
|
|
251
|
-
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
244
|
+
/** Callback fired when the state is changed.
|
|
245
|
+
*
|
|
246
|
+
* @param {object} event The event source of the callback.
|
|
247
|
+
* You can pull out the new value by accessing `event.target.value` (string).
|
|
248
|
+
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
252
249
|
* */
|
|
253
250
|
onChange: PropTypes.func
|
|
254
251
|
};
|