armtek-uikit-react 1.0.118 → 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.
@@ -2,35 +2,40 @@
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
  }
9
- .checkbox__text_raw{
10
- padding-top: 2px;
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;
11
20
  }
12
21
  .checkbox__label{
13
22
  cursor: pointer;
14
23
  text-align: left;
15
24
  position: relative;
16
25
  display: block;
17
- font-size: 16px;
18
26
  line-height: 1.2;
19
- min-height: 22px;
20
- & .checkbox__text{
21
- display: block;
22
- padding-left: 31px;
23
- }
27
+ width:22px;
28
+ height: 22px;
24
29
  &:before{
25
- width:22px;
26
- height: 22px;
30
+ width: 100%;
31
+ height: 100%;
27
32
  border-radius: $radius;
28
33
  border: 1px solid $color-gray-700;
29
34
  background: #fff;
30
35
  position: absolute;
31
36
  content: '';
32
37
  left: 0;
33
- top: 0px;
38
+ top: 0;
34
39
  box-sizing: border-box;
35
40
  }
36
41
  &:after{
@@ -49,34 +54,20 @@
49
54
  }
50
55
 
51
56
  .checkbox_medium{
52
- min-height: 18px;
53
- & .checkbox__text{
54
- //padding-left: 27px;
55
- }
56
- &:before{
57
- width:18px;
58
- height: 18px;
59
- }
57
+ width:18px;
58
+ height: 18px;
60
59
  &:after{
61
60
  left: 6px;
62
61
  top: 2px;
63
62
  width: 6px;
64
63
  height: 10px;
65
64
  }
66
- & .checkbox__text_raw{
67
- padding-top: 0px;
68
- }
69
65
  }
66
+
70
67
  .checkbox_small{
71
68
  font-size: 14px;
72
- min-height: 16px;
73
- & .checkbox__text{
74
- padding-left: 25px;
75
- }
76
- &:before{
77
- width:16px;
78
- height: 16px;
79
- }
69
+ width:16px;
70
+ height: 16px;
80
71
  &:after{
81
72
  left: 5px;
82
73
  top: 3px;
@@ -84,6 +75,7 @@
84
75
  width: 6px;
85
76
  }
86
77
  }
78
+
87
79
  .checkbox__label_intermediate{
88
80
  &:after{
89
81
  border-left: none;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"armtek-uikit-react","version":"1.0.118","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
+ {"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 { isValidElement, 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,34 +21,43 @@ const Checkbox = props => {
21
21
  className,
22
22
  ...inputProps
23
23
  } = props;
24
- let [checked, setChecked] = useState(!!props.defaultChecked);
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__*/_jsx("div", {
31
- className: clsx(css.checkbox, className),
32
- children: /*#__PURE__*/_jsxs("label", {
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: [/*#__PURE__*/_jsx("input", {
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
- }), label && /*#__PURE__*/_jsx("span", {
46
- className: clsx(css.checkbox__text, {
47
- [css.checkbox__text_raw]: ! /*#__PURE__*/isValidElement(label)
48
- }),
49
- children: label
50
- })]
51
- })
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
+ })]
52
61
  })
53
62
  });
54
63
  };