armtek-uikit-react 1.0.117 → 1.0.119
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/Checkbox.scss +20 -26
- package/assets/global.css +1 -0
- package/package.json +1 -1
- package/ui/Form/Checkbox/Checkbox.js +22 -11
package/assets/Checkbox.scss
CHANGED
|
@@ -2,23 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
.checkbox{
|
|
4
4
|
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
.checkbox_text{
|
|
8
|
+
align-items: center;
|
|
5
9
|
}
|
|
6
10
|
.checkbox__input{
|
|
7
11
|
display: none;
|
|
8
12
|
}
|
|
13
|
+
.checkbox__text{
|
|
14
|
+
padding-left: calc(var(--size-step));
|
|
15
|
+
font-size: 16px;
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
18
|
+
.checkbox__text_size_small{
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
}
|
|
9
21
|
.checkbox__label{
|
|
10
22
|
cursor: pointer;
|
|
11
23
|
text-align: left;
|
|
12
24
|
position: relative;
|
|
13
25
|
display: block;
|
|
14
|
-
font-size: 16px;
|
|
15
26
|
line-height: 1.2;
|
|
16
27
|
width:22px;
|
|
17
28
|
height: 22px;
|
|
18
|
-
& .checkbox__text{
|
|
19
|
-
display: block;
|
|
20
|
-
padding-left: 31px;
|
|
21
|
-
}
|
|
22
29
|
&:before{
|
|
23
30
|
width: 100%;
|
|
24
31
|
height: 100%;
|
|
@@ -28,7 +35,7 @@
|
|
|
28
35
|
position: absolute;
|
|
29
36
|
content: '';
|
|
30
37
|
left: 0;
|
|
31
|
-
top:
|
|
38
|
+
top: 0;
|
|
32
39
|
box-sizing: border-box;
|
|
33
40
|
}
|
|
34
41
|
&:after{
|
|
@@ -36,7 +43,7 @@
|
|
|
36
43
|
position: absolute;
|
|
37
44
|
transform: rotate(45deg);
|
|
38
45
|
left: 8px;
|
|
39
|
-
top:
|
|
46
|
+
top: 4px;
|
|
40
47
|
width: 7px;
|
|
41
48
|
height: 11px;
|
|
42
49
|
border-bottom: 2px solid;
|
|
@@ -44,61 +51,48 @@
|
|
|
44
51
|
display: none;
|
|
45
52
|
box-sizing: border-box;
|
|
46
53
|
}
|
|
47
|
-
& span{
|
|
48
|
-
display: inline-block;
|
|
49
|
-
padding-left: 5px;
|
|
50
|
-
}
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
.checkbox_medium{
|
|
54
57
|
width:18px;
|
|
55
58
|
height: 18px;
|
|
56
|
-
& .checkbox__text{
|
|
57
|
-
//padding-left: 27px;
|
|
58
|
-
}
|
|
59
59
|
&:after{
|
|
60
60
|
left: 6px;
|
|
61
61
|
top: 2px;
|
|
62
62
|
width: 6px;
|
|
63
63
|
height: 10px;
|
|
64
64
|
}
|
|
65
|
-
&:before{
|
|
66
|
-
top:-1px;
|
|
67
|
-
}
|
|
68
65
|
}
|
|
66
|
+
|
|
69
67
|
.checkbox_small{
|
|
70
68
|
font-size: 14px;
|
|
71
69
|
width:16px;
|
|
72
70
|
height: 16px;
|
|
73
|
-
& .checkbox__text{
|
|
74
|
-
padding-left: 25px;
|
|
75
|
-
}
|
|
76
71
|
&:after{
|
|
77
72
|
left: 5px;
|
|
78
|
-
top:
|
|
73
|
+
top: 3px;
|
|
79
74
|
height: 8px;
|
|
80
75
|
width: 6px;
|
|
81
76
|
}
|
|
82
|
-
&:before{
|
|
83
|
-
top: -2px;
|
|
84
|
-
}
|
|
85
77
|
}
|
|
78
|
+
|
|
86
79
|
.checkbox__label_intermediate{
|
|
87
80
|
&:after{
|
|
88
81
|
border-left: none;
|
|
89
82
|
width: 14px;
|
|
90
83
|
transform: none;
|
|
91
|
-
top:
|
|
84
|
+
top: 10px;
|
|
92
85
|
height: 0;
|
|
93
86
|
left: 4px;
|
|
94
87
|
border-right: none;
|
|
95
88
|
}
|
|
96
89
|
&.checkbox_medium:after{
|
|
97
90
|
width: 11px;
|
|
91
|
+
top: 8px;
|
|
98
92
|
}
|
|
99
93
|
&.checkbox_small:after{
|
|
100
94
|
width: 9px;
|
|
101
|
-
top:
|
|
95
|
+
top: 7px;
|
|
102
96
|
}
|
|
103
97
|
}
|
|
104
98
|
|
package/assets/global.css
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"armtek-uikit-react","version":"1.0.
|
|
1
|
+
{"name":"armtek-uikit-react","version":"1.0.119","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"build":"^0.1.4","clsx":"^2.0.0","rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*","react-transition-group":"^4.4.5"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { useState } from 'react';
|
|
3
|
+
import { isValidElement, useRef, useState } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import css from "./Checkbox.module.scss";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -21,32 +21,43 @@ const Checkbox = props => {
|
|
|
21
21
|
className,
|
|
22
22
|
...inputProps
|
|
23
23
|
} = props;
|
|
24
|
-
|
|
24
|
+
const [checked, setChecked] = useState(!!props.defaultChecked);
|
|
25
|
+
const labelRef = useRef(null);
|
|
25
26
|
const handleChange = e => {
|
|
26
27
|
if (inputProps.checked === undefined) setChecked(prev => !prev);
|
|
27
28
|
if (onChange) onChange(e);
|
|
28
29
|
};
|
|
29
30
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
30
|
-
children: /*#__PURE__*/
|
|
31
|
-
className: clsx(css.checkbox, className
|
|
32
|
-
|
|
31
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
32
|
+
className: clsx(css.checkbox, className, {
|
|
33
|
+
[css.checkbox_text]: ! /*#__PURE__*/isValidElement(label)
|
|
34
|
+
}),
|
|
35
|
+
children: [/*#__PURE__*/_jsx("label", {
|
|
36
|
+
ref: labelRef,
|
|
33
37
|
className: clsx(css.checkbox__label, css['checkbox_' + size], css['checkbox_' + variant], css['checkbox_' + color], {
|
|
34
38
|
[css.checkbox__label_checked]: inputProps.checked !== undefined ? inputProps.checked : checked,
|
|
35
39
|
[css.checkbox__label_intermediate]: !!intermediate,
|
|
36
40
|
[css.checkbox__label_disabled]: !!inputProps.disabled
|
|
37
41
|
}),
|
|
38
|
-
children:
|
|
42
|
+
children: /*#__PURE__*/_jsx("input", {
|
|
39
43
|
...inputProps,
|
|
40
44
|
className: clsx(css.checkbox__input, {
|
|
41
45
|
'_checked': !!inputProps.checked
|
|
42
46
|
}),
|
|
43
47
|
onChange: handleChange,
|
|
44
48
|
type: props.type || 'checkbox'
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
})
|
|
50
|
+
}), label && /*#__PURE__*/_jsx("span", {
|
|
51
|
+
onClick: () => {
|
|
52
|
+
var _labelRef$current;
|
|
53
|
+
return (_labelRef$current = labelRef.current) == null ? void 0 : _labelRef$current.click();
|
|
54
|
+
},
|
|
55
|
+
className: clsx(css.checkbox__text, {
|
|
56
|
+
[css.checkbox__text_raw]: ! /*#__PURE__*/isValidElement(label),
|
|
57
|
+
[css['checkbox_text_size_' + size]]: size
|
|
58
|
+
}),
|
|
59
|
+
children: label
|
|
60
|
+
})]
|
|
50
61
|
})
|
|
51
62
|
});
|
|
52
63
|
};
|