@alfalab/core-components-switch 4.2.0 → 4.2.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/Component.js +1 -1
- package/cssm/index.module.css +4 -4
- package/esm/Component.js +1 -1
- package/esm/index.css +32 -32
- package/index.css +32 -32
- package/modern/Component.js +1 -1
- package/modern/index.css +32 -32
- package/package.json +2 -2
- package/src/index.module.css +1 -1
package/Component.js
CHANGED
|
@@ -15,7 +15,7 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
15
15
|
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
16
16
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
17
17
|
|
|
18
|
-
var styles = {"component":"
|
|
18
|
+
var styles = {"component":"switch__component_6y8qd","start":"switch__start_6y8qd","center":"switch__center_6y8qd","addons":"switch__addons_6y8qd","block":"switch__block_6y8qd","switch":"switch__switch_6y8qd","content":"switch__content_6y8qd","label":"switch__label_6y8qd","errorMessage":"switch__errorMessage_6y8qd","hint":"switch__hint_6y8qd","reversed":"switch__reversed_6y8qd","checked":"switch__checked_6y8qd","disabled":"switch__disabled_6y8qd","focused":"switch__focused_6y8qd"};
|
|
19
19
|
require('./index.css')
|
|
20
20
|
|
|
21
21
|
var Switch = React.forwardRef(function (_a, ref) {
|
package/cssm/index.module.css
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
--color-light-neutral-translucent-700-hover: rgba(4, 4, 19, 0.55);
|
|
8
8
|
--color-light-status-positive: #0cc44d;
|
|
9
9
|
--color-light-status-positive-hover: #04b545;
|
|
10
|
-
--color-light-text-negative: #
|
|
11
|
-
--color-light-text-primary:
|
|
10
|
+
--color-light-text-negative: #ec2d20;
|
|
11
|
+
--color-light-text-primary: rgba(3, 3, 6, 0.88);
|
|
12
12
|
--color-light-text-secondary: rgba(4, 4, 19, 0.55);
|
|
13
|
-
--color-static-neutral-
|
|
13
|
+
--color-static-neutral-0: #fff; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
14
14
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
15
15
|
} :root {
|
|
16
16
|
} :root {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
--switch-disabled-checked-bg-color: var(--switch-disabled-bg-color);
|
|
55
55
|
|
|
56
56
|
/* icon */
|
|
57
|
-
--switch-icon-color: var(--color-static-neutral-
|
|
57
|
+
--switch-icon-color: var(--color-static-neutral-0);
|
|
58
58
|
--switch-icon-disabled-color: var(--color-light-neutral-translucent-500);
|
|
59
59
|
} .component {
|
|
60
60
|
display: inline-flex;
|
package/esm/Component.js
CHANGED
|
@@ -5,7 +5,7 @@ import cn from 'classnames';
|
|
|
5
5
|
import { dom } from '@alfalab/core-components-shared/esm';
|
|
6
6
|
import { useFocus } from '@alfalab/hooks';
|
|
7
7
|
|
|
8
|
-
var styles = {"component":"
|
|
8
|
+
var styles = {"component":"switch__component_6y8qd","start":"switch__start_6y8qd","center":"switch__center_6y8qd","addons":"switch__addons_6y8qd","block":"switch__block_6y8qd","switch":"switch__switch_6y8qd","content":"switch__content_6y8qd","label":"switch__label_6y8qd","errorMessage":"switch__errorMessage_6y8qd","hint":"switch__hint_6y8qd","reversed":"switch__reversed_6y8qd","checked":"switch__checked_6y8qd","disabled":"switch__disabled_6y8qd","focused":"switch__focused_6y8qd"};
|
|
9
9
|
require('./index.css')
|
|
10
10
|
|
|
11
11
|
var Switch = forwardRef(function (_a, ref) {
|
package/esm/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1j6ih */
|
|
2
2
|
:root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-border-link: #2288fa;
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
--color-light-neutral-translucent-700-hover: rgba(4, 4, 19, 0.55);
|
|
9
9
|
--color-light-status-positive: #0cc44d;
|
|
10
10
|
--color-light-status-positive-hover: #04b545;
|
|
11
|
-
--color-light-text-negative: #
|
|
12
|
-
--color-light-text-primary:
|
|
11
|
+
--color-light-text-negative: #ec2d20;
|
|
12
|
+
--color-light-text-primary: rgba(3, 3, 6, 0.88);
|
|
13
13
|
--color-light-text-secondary: rgba(4, 4, 19, 0.55);
|
|
14
|
-
--color-static-neutral-
|
|
14
|
+
--color-static-neutral-0: #fff; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
15
15
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
16
16
|
} :root {
|
|
17
17
|
} :root {
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
--switch-disabled-checked-bg-color: var(--switch-disabled-bg-color);
|
|
56
56
|
|
|
57
57
|
/* icon */
|
|
58
|
-
--switch-icon-color: var(--color-static-neutral-
|
|
58
|
+
--switch-icon-color: var(--color-static-neutral-0);
|
|
59
59
|
--switch-icon-disabled-color: var(--color-light-neutral-translucent-500);
|
|
60
|
-
} .
|
|
60
|
+
} .switch__component_6y8qd {
|
|
61
61
|
display: inline-flex;
|
|
62
62
|
align-items: flex-start;
|
|
63
63
|
margin: 0;
|
|
@@ -65,20 +65,20 @@
|
|
|
65
65
|
border: 0;
|
|
66
66
|
cursor: pointer;
|
|
67
67
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
68
|
-
} .
|
|
68
|
+
} .switch__component_6y8qd input {
|
|
69
69
|
opacity: 0;
|
|
70
70
|
position: absolute;
|
|
71
|
-
} .
|
|
71
|
+
} .switch__start_6y8qd {
|
|
72
72
|
align-items: flex-start;
|
|
73
|
-
} .
|
|
73
|
+
} .switch__center_6y8qd {
|
|
74
74
|
align-items: center;
|
|
75
|
-
} .
|
|
75
|
+
} .switch__addons_6y8qd {
|
|
76
76
|
margin-left: auto;
|
|
77
77
|
padding-left: var(--gap-m);
|
|
78
78
|
line-height: 24px;
|
|
79
|
-
} .
|
|
79
|
+
} .switch__block_6y8qd {
|
|
80
80
|
width: 100%;
|
|
81
|
-
} .
|
|
81
|
+
} .switch__switch_6y8qd {
|
|
82
82
|
position: relative;
|
|
83
83
|
border-radius: var(--border-radius-xl);
|
|
84
84
|
width: 36px;
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
border: 2px solid var(--switch-border-color);
|
|
90
90
|
transition: background-color 0.2s ease, border-color 0.2s ease;
|
|
91
91
|
box-sizing: border-box
|
|
92
|
-
} .
|
|
92
|
+
} .switch__switch_6y8qd:hover {
|
|
93
93
|
background-color: var(--switch-hover-bg-color);
|
|
94
|
-
} .
|
|
94
|
+
} .switch__switch_6y8qd:before {
|
|
95
95
|
content: '';
|
|
96
96
|
position: absolute;
|
|
97
97
|
top: 0;
|
|
@@ -103,58 +103,58 @@
|
|
|
103
103
|
background-color: var(--switch-icon-color);
|
|
104
104
|
box-sizing: border-box;
|
|
105
105
|
transition: transform 0.2s ease;
|
|
106
|
-
} .
|
|
106
|
+
} .switch__content_6y8qd {
|
|
107
107
|
margin-left: var(--gap-s);
|
|
108
108
|
flex-grow: 1;
|
|
109
|
-
} .
|
|
109
|
+
} .switch__label_6y8qd {
|
|
110
110
|
font-size: 16px;
|
|
111
111
|
line-height: 24px;
|
|
112
112
|
font-weight: 400;
|
|
113
113
|
display: block;
|
|
114
114
|
color: var(--switch-label-color);
|
|
115
|
-
} .
|
|
115
|
+
} .switch__label_6y8qd:not(:only-child) {
|
|
116
116
|
margin-bottom: var(--gap-2xs);
|
|
117
|
-
} .
|
|
117
|
+
} .switch__errorMessage_6y8qd {
|
|
118
118
|
font-size: 14px;
|
|
119
119
|
line-height: 18px;
|
|
120
120
|
font-weight: 400;
|
|
121
121
|
color: var(--switch-error-color);
|
|
122
|
-
} .
|
|
122
|
+
} .switch__hint_6y8qd {
|
|
123
123
|
font-size: 14px;
|
|
124
124
|
line-height: 18px;
|
|
125
125
|
font-weight: 400;
|
|
126
126
|
display: block;
|
|
127
127
|
color: var(--switch-hint-color);
|
|
128
|
-
} /* Reversed state */ .
|
|
128
|
+
} /* Reversed state */ .switch__component_6y8qd.switch__reversed_6y8qd {
|
|
129
129
|
flex-direction: row-reverse;
|
|
130
|
-
} .
|
|
130
|
+
} .switch__reversed_6y8qd .switch__content_6y8qd {
|
|
131
131
|
margin-right: var(--gap-m);
|
|
132
132
|
margin-left: 0;
|
|
133
|
-
} .
|
|
133
|
+
} .switch__reversed_6y8qd .switch__addons_6y8qd {
|
|
134
134
|
margin-left: 0;
|
|
135
135
|
padding-left: 0;
|
|
136
136
|
margin-right: auto;
|
|
137
137
|
padding-right: var(--gap-m);
|
|
138
|
-
} /* Checked state */ .
|
|
138
|
+
} /* Checked state */ .switch__checked_6y8qd .switch__switch_6y8qd {
|
|
139
139
|
background-color: var(--switch-checked-bg-color)
|
|
140
|
-
} .
|
|
140
|
+
} .switch__checked_6y8qd .switch__switch_6y8qd:hover {
|
|
141
141
|
background-color: var(--switch-checked-hover-bg-color);
|
|
142
|
-
} .
|
|
142
|
+
} .switch__checked_6y8qd .switch__switch_6y8qd:before {
|
|
143
143
|
/* ширина компонента(36px + 2*2px) - отступы(2 * 2px) - размер кружка(20px) */
|
|
144
144
|
transform: translateX(16px);
|
|
145
|
-
} /* Disabled state */ .
|
|
145
|
+
} /* Disabled state */ .switch__disabled_6y8qd {
|
|
146
146
|
cursor: var(--disabled-cursor);
|
|
147
|
-
} .
|
|
147
|
+
} .switch__disabled_6y8qd .switch__switch_6y8qd {
|
|
148
148
|
background-color: var(--switch-disabled-bg-color)
|
|
149
|
-
} .
|
|
149
|
+
} .switch__disabled_6y8qd .switch__switch_6y8qd:before {
|
|
150
150
|
background-color: var(--switch-icon-disabled-color);
|
|
151
|
-
} .
|
|
151
|
+
} .switch__disabled_6y8qd.switch__checked_6y8qd .switch__switch_6y8qd {
|
|
152
152
|
background-color: var(--switch-disabled-checked-bg-color);
|
|
153
|
-
} .
|
|
153
|
+
} .switch__disabled_6y8qd .switch__label_6y8qd {
|
|
154
154
|
color: var(--switch-disabled-color);
|
|
155
|
-
} .
|
|
155
|
+
} .switch__disabled_6y8qd .switch__hint_6y8qd {
|
|
156
156
|
color: var(--switch-disabled-color);
|
|
157
|
-
} /* Focused state */ .
|
|
157
|
+
} /* Focused state */ .switch__focused_6y8qd .switch__switch_6y8qd {
|
|
158
158
|
outline: 2px solid var(--focus-color);
|
|
159
159
|
outline-offset: 2px;
|
|
160
160
|
}
|
package/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1j6ih */
|
|
2
2
|
:root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-border-link: #2288fa;
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
--color-light-neutral-translucent-700-hover: rgba(4, 4, 19, 0.55);
|
|
9
9
|
--color-light-status-positive: #0cc44d;
|
|
10
10
|
--color-light-status-positive-hover: #04b545;
|
|
11
|
-
--color-light-text-negative: #
|
|
12
|
-
--color-light-text-primary:
|
|
11
|
+
--color-light-text-negative: #ec2d20;
|
|
12
|
+
--color-light-text-primary: rgba(3, 3, 6, 0.88);
|
|
13
13
|
--color-light-text-secondary: rgba(4, 4, 19, 0.55);
|
|
14
|
-
--color-static-neutral-
|
|
14
|
+
--color-static-neutral-0: #fff; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
15
15
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
16
16
|
} :root {
|
|
17
17
|
} :root {
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
--switch-disabled-checked-bg-color: var(--switch-disabled-bg-color);
|
|
56
56
|
|
|
57
57
|
/* icon */
|
|
58
|
-
--switch-icon-color: var(--color-static-neutral-
|
|
58
|
+
--switch-icon-color: var(--color-static-neutral-0);
|
|
59
59
|
--switch-icon-disabled-color: var(--color-light-neutral-translucent-500);
|
|
60
|
-
} .
|
|
60
|
+
} .switch__component_6y8qd {
|
|
61
61
|
display: inline-flex;
|
|
62
62
|
align-items: flex-start;
|
|
63
63
|
margin: 0;
|
|
@@ -65,20 +65,20 @@
|
|
|
65
65
|
border: 0;
|
|
66
66
|
cursor: pointer;
|
|
67
67
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
68
|
-
} .
|
|
68
|
+
} .switch__component_6y8qd input {
|
|
69
69
|
opacity: 0;
|
|
70
70
|
position: absolute;
|
|
71
|
-
} .
|
|
71
|
+
} .switch__start_6y8qd {
|
|
72
72
|
align-items: flex-start;
|
|
73
|
-
} .
|
|
73
|
+
} .switch__center_6y8qd {
|
|
74
74
|
align-items: center;
|
|
75
|
-
} .
|
|
75
|
+
} .switch__addons_6y8qd {
|
|
76
76
|
margin-left: auto;
|
|
77
77
|
padding-left: var(--gap-m);
|
|
78
78
|
line-height: 24px;
|
|
79
|
-
} .
|
|
79
|
+
} .switch__block_6y8qd {
|
|
80
80
|
width: 100%;
|
|
81
|
-
} .
|
|
81
|
+
} .switch__switch_6y8qd {
|
|
82
82
|
position: relative;
|
|
83
83
|
border-radius: var(--border-radius-xl);
|
|
84
84
|
width: 36px;
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
border: 2px solid var(--switch-border-color);
|
|
90
90
|
transition: background-color 0.2s ease, border-color 0.2s ease;
|
|
91
91
|
box-sizing: border-box
|
|
92
|
-
} .
|
|
92
|
+
} .switch__switch_6y8qd:hover {
|
|
93
93
|
background-color: var(--switch-hover-bg-color);
|
|
94
|
-
} .
|
|
94
|
+
} .switch__switch_6y8qd:before {
|
|
95
95
|
content: '';
|
|
96
96
|
position: absolute;
|
|
97
97
|
top: 0;
|
|
@@ -103,58 +103,58 @@
|
|
|
103
103
|
background-color: var(--switch-icon-color);
|
|
104
104
|
box-sizing: border-box;
|
|
105
105
|
transition: transform 0.2s ease;
|
|
106
|
-
} .
|
|
106
|
+
} .switch__content_6y8qd {
|
|
107
107
|
margin-left: var(--gap-s);
|
|
108
108
|
flex-grow: 1;
|
|
109
|
-
} .
|
|
109
|
+
} .switch__label_6y8qd {
|
|
110
110
|
font-size: 16px;
|
|
111
111
|
line-height: 24px;
|
|
112
112
|
font-weight: 400;
|
|
113
113
|
display: block;
|
|
114
114
|
color: var(--switch-label-color);
|
|
115
|
-
} .
|
|
115
|
+
} .switch__label_6y8qd:not(:only-child) {
|
|
116
116
|
margin-bottom: var(--gap-2xs);
|
|
117
|
-
} .
|
|
117
|
+
} .switch__errorMessage_6y8qd {
|
|
118
118
|
font-size: 14px;
|
|
119
119
|
line-height: 18px;
|
|
120
120
|
font-weight: 400;
|
|
121
121
|
color: var(--switch-error-color);
|
|
122
|
-
} .
|
|
122
|
+
} .switch__hint_6y8qd {
|
|
123
123
|
font-size: 14px;
|
|
124
124
|
line-height: 18px;
|
|
125
125
|
font-weight: 400;
|
|
126
126
|
display: block;
|
|
127
127
|
color: var(--switch-hint-color);
|
|
128
|
-
} /* Reversed state */ .
|
|
128
|
+
} /* Reversed state */ .switch__component_6y8qd.switch__reversed_6y8qd {
|
|
129
129
|
flex-direction: row-reverse;
|
|
130
|
-
} .
|
|
130
|
+
} .switch__reversed_6y8qd .switch__content_6y8qd {
|
|
131
131
|
margin-right: var(--gap-m);
|
|
132
132
|
margin-left: 0;
|
|
133
|
-
} .
|
|
133
|
+
} .switch__reversed_6y8qd .switch__addons_6y8qd {
|
|
134
134
|
margin-left: 0;
|
|
135
135
|
padding-left: 0;
|
|
136
136
|
margin-right: auto;
|
|
137
137
|
padding-right: var(--gap-m);
|
|
138
|
-
} /* Checked state */ .
|
|
138
|
+
} /* Checked state */ .switch__checked_6y8qd .switch__switch_6y8qd {
|
|
139
139
|
background-color: var(--switch-checked-bg-color)
|
|
140
|
-
} .
|
|
140
|
+
} .switch__checked_6y8qd .switch__switch_6y8qd:hover {
|
|
141
141
|
background-color: var(--switch-checked-hover-bg-color);
|
|
142
|
-
} .
|
|
142
|
+
} .switch__checked_6y8qd .switch__switch_6y8qd:before {
|
|
143
143
|
/* ширина компонента(36px + 2*2px) - отступы(2 * 2px) - размер кружка(20px) */
|
|
144
144
|
transform: translateX(16px);
|
|
145
|
-
} /* Disabled state */ .
|
|
145
|
+
} /* Disabled state */ .switch__disabled_6y8qd {
|
|
146
146
|
cursor: var(--disabled-cursor);
|
|
147
|
-
} .
|
|
147
|
+
} .switch__disabled_6y8qd .switch__switch_6y8qd {
|
|
148
148
|
background-color: var(--switch-disabled-bg-color)
|
|
149
|
-
} .
|
|
149
|
+
} .switch__disabled_6y8qd .switch__switch_6y8qd:before {
|
|
150
150
|
background-color: var(--switch-icon-disabled-color);
|
|
151
|
-
} .
|
|
151
|
+
} .switch__disabled_6y8qd.switch__checked_6y8qd .switch__switch_6y8qd {
|
|
152
152
|
background-color: var(--switch-disabled-checked-bg-color);
|
|
153
|
-
} .
|
|
153
|
+
} .switch__disabled_6y8qd .switch__label_6y8qd {
|
|
154
154
|
color: var(--switch-disabled-color);
|
|
155
|
-
} .
|
|
155
|
+
} .switch__disabled_6y8qd .switch__hint_6y8qd {
|
|
156
156
|
color: var(--switch-disabled-color);
|
|
157
|
-
} /* Focused state */ .
|
|
157
|
+
} /* Focused state */ .switch__focused_6y8qd .switch__switch_6y8qd {
|
|
158
158
|
outline: 2px solid var(--focus-color);
|
|
159
159
|
outline-offset: 2px;
|
|
160
160
|
}
|
package/modern/Component.js
CHANGED
|
@@ -4,7 +4,7 @@ import cn from 'classnames';
|
|
|
4
4
|
import { dom } from '@alfalab/core-components-shared/modern';
|
|
5
5
|
import { useFocus } from '@alfalab/hooks';
|
|
6
6
|
|
|
7
|
-
const styles = {"component":"
|
|
7
|
+
const styles = {"component":"switch__component_6y8qd","start":"switch__start_6y8qd","center":"switch__center_6y8qd","addons":"switch__addons_6y8qd","block":"switch__block_6y8qd","switch":"switch__switch_6y8qd","content":"switch__content_6y8qd","label":"switch__label_6y8qd","errorMessage":"switch__errorMessage_6y8qd","hint":"switch__hint_6y8qd","reversed":"switch__reversed_6y8qd","checked":"switch__checked_6y8qd","disabled":"switch__disabled_6y8qd","focused":"switch__focused_6y8qd"};
|
|
8
8
|
require('./index.css')
|
|
9
9
|
|
|
10
10
|
const Switch = forwardRef(({ reversed = false, checked = false, align = 'start', addons, block, disabled, inactive, error, label, hint, name, value, className, onChange, dataTestId, ...restProps }, ref) => {
|
package/modern/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1j6ih */
|
|
2
2
|
:root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-border-link: #2288fa;
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
--color-light-neutral-translucent-700-hover: rgba(4, 4, 19, 0.55);
|
|
9
9
|
--color-light-status-positive: #0cc44d;
|
|
10
10
|
--color-light-status-positive-hover: #04b545;
|
|
11
|
-
--color-light-text-negative: #
|
|
12
|
-
--color-light-text-primary:
|
|
11
|
+
--color-light-text-negative: #ec2d20;
|
|
12
|
+
--color-light-text-primary: rgba(3, 3, 6, 0.88);
|
|
13
13
|
--color-light-text-secondary: rgba(4, 4, 19, 0.55);
|
|
14
|
-
--color-static-neutral-
|
|
14
|
+
--color-static-neutral-0: #fff; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
15
15
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
16
16
|
} :root {
|
|
17
17
|
} :root {
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
--switch-disabled-checked-bg-color: var(--switch-disabled-bg-color);
|
|
56
56
|
|
|
57
57
|
/* icon */
|
|
58
|
-
--switch-icon-color: var(--color-static-neutral-
|
|
58
|
+
--switch-icon-color: var(--color-static-neutral-0);
|
|
59
59
|
--switch-icon-disabled-color: var(--color-light-neutral-translucent-500);
|
|
60
|
-
} .
|
|
60
|
+
} .switch__component_6y8qd {
|
|
61
61
|
display: inline-flex;
|
|
62
62
|
align-items: flex-start;
|
|
63
63
|
margin: 0;
|
|
@@ -65,20 +65,20 @@
|
|
|
65
65
|
border: 0;
|
|
66
66
|
cursor: pointer;
|
|
67
67
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
68
|
-
} .
|
|
68
|
+
} .switch__component_6y8qd input {
|
|
69
69
|
opacity: 0;
|
|
70
70
|
position: absolute;
|
|
71
|
-
} .
|
|
71
|
+
} .switch__start_6y8qd {
|
|
72
72
|
align-items: flex-start;
|
|
73
|
-
} .
|
|
73
|
+
} .switch__center_6y8qd {
|
|
74
74
|
align-items: center;
|
|
75
|
-
} .
|
|
75
|
+
} .switch__addons_6y8qd {
|
|
76
76
|
margin-left: auto;
|
|
77
77
|
padding-left: var(--gap-m);
|
|
78
78
|
line-height: 24px;
|
|
79
|
-
} .
|
|
79
|
+
} .switch__block_6y8qd {
|
|
80
80
|
width: 100%;
|
|
81
|
-
} .
|
|
81
|
+
} .switch__switch_6y8qd {
|
|
82
82
|
position: relative;
|
|
83
83
|
border-radius: var(--border-radius-xl);
|
|
84
84
|
width: 36px;
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
border: 2px solid var(--switch-border-color);
|
|
90
90
|
transition: background-color 0.2s ease, border-color 0.2s ease;
|
|
91
91
|
box-sizing: border-box
|
|
92
|
-
} .
|
|
92
|
+
} .switch__switch_6y8qd:hover {
|
|
93
93
|
background-color: var(--switch-hover-bg-color);
|
|
94
|
-
} .
|
|
94
|
+
} .switch__switch_6y8qd:before {
|
|
95
95
|
content: '';
|
|
96
96
|
position: absolute;
|
|
97
97
|
top: 0;
|
|
@@ -103,58 +103,58 @@
|
|
|
103
103
|
background-color: var(--switch-icon-color);
|
|
104
104
|
box-sizing: border-box;
|
|
105
105
|
transition: transform 0.2s ease;
|
|
106
|
-
} .
|
|
106
|
+
} .switch__content_6y8qd {
|
|
107
107
|
margin-left: var(--gap-s);
|
|
108
108
|
flex-grow: 1;
|
|
109
|
-
} .
|
|
109
|
+
} .switch__label_6y8qd {
|
|
110
110
|
font-size: 16px;
|
|
111
111
|
line-height: 24px;
|
|
112
112
|
font-weight: 400;
|
|
113
113
|
display: block;
|
|
114
114
|
color: var(--switch-label-color);
|
|
115
|
-
} .
|
|
115
|
+
} .switch__label_6y8qd:not(:only-child) {
|
|
116
116
|
margin-bottom: var(--gap-2xs);
|
|
117
|
-
} .
|
|
117
|
+
} .switch__errorMessage_6y8qd {
|
|
118
118
|
font-size: 14px;
|
|
119
119
|
line-height: 18px;
|
|
120
120
|
font-weight: 400;
|
|
121
121
|
color: var(--switch-error-color);
|
|
122
|
-
} .
|
|
122
|
+
} .switch__hint_6y8qd {
|
|
123
123
|
font-size: 14px;
|
|
124
124
|
line-height: 18px;
|
|
125
125
|
font-weight: 400;
|
|
126
126
|
display: block;
|
|
127
127
|
color: var(--switch-hint-color);
|
|
128
|
-
} /* Reversed state */ .
|
|
128
|
+
} /* Reversed state */ .switch__component_6y8qd.switch__reversed_6y8qd {
|
|
129
129
|
flex-direction: row-reverse;
|
|
130
|
-
} .
|
|
130
|
+
} .switch__reversed_6y8qd .switch__content_6y8qd {
|
|
131
131
|
margin-right: var(--gap-m);
|
|
132
132
|
margin-left: 0;
|
|
133
|
-
} .
|
|
133
|
+
} .switch__reversed_6y8qd .switch__addons_6y8qd {
|
|
134
134
|
margin-left: 0;
|
|
135
135
|
padding-left: 0;
|
|
136
136
|
margin-right: auto;
|
|
137
137
|
padding-right: var(--gap-m);
|
|
138
|
-
} /* Checked state */ .
|
|
138
|
+
} /* Checked state */ .switch__checked_6y8qd .switch__switch_6y8qd {
|
|
139
139
|
background-color: var(--switch-checked-bg-color)
|
|
140
|
-
} .
|
|
140
|
+
} .switch__checked_6y8qd .switch__switch_6y8qd:hover {
|
|
141
141
|
background-color: var(--switch-checked-hover-bg-color);
|
|
142
|
-
} .
|
|
142
|
+
} .switch__checked_6y8qd .switch__switch_6y8qd:before {
|
|
143
143
|
/* ширина компонента(36px + 2*2px) - отступы(2 * 2px) - размер кружка(20px) */
|
|
144
144
|
transform: translateX(16px);
|
|
145
|
-
} /* Disabled state */ .
|
|
145
|
+
} /* Disabled state */ .switch__disabled_6y8qd {
|
|
146
146
|
cursor: var(--disabled-cursor);
|
|
147
|
-
} .
|
|
147
|
+
} .switch__disabled_6y8qd .switch__switch_6y8qd {
|
|
148
148
|
background-color: var(--switch-disabled-bg-color)
|
|
149
|
-
} .
|
|
149
|
+
} .switch__disabled_6y8qd .switch__switch_6y8qd:before {
|
|
150
150
|
background-color: var(--switch-icon-disabled-color);
|
|
151
|
-
} .
|
|
151
|
+
} .switch__disabled_6y8qd.switch__checked_6y8qd .switch__switch_6y8qd {
|
|
152
152
|
background-color: var(--switch-disabled-checked-bg-color);
|
|
153
|
-
} .
|
|
153
|
+
} .switch__disabled_6y8qd .switch__label_6y8qd {
|
|
154
154
|
color: var(--switch-disabled-color);
|
|
155
|
-
} .
|
|
155
|
+
} .switch__disabled_6y8qd .switch__hint_6y8qd {
|
|
156
156
|
color: var(--switch-disabled-color);
|
|
157
|
-
} /* Focused state */ .
|
|
157
|
+
} /* Focused state */ .switch__focused_6y8qd .switch__switch_6y8qd {
|
|
158
158
|
outline: 2px solid var(--focus-color);
|
|
159
159
|
outline-offset: 2px;
|
|
160
160
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-switch",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"gitHead": "f054fef20200664c65e2501ef1f916c555cdf05d",
|
|
6
6
|
"keywords": [],
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@alfalab/hooks": "^1.13.0",
|
|
19
|
-
"@alfalab/core-components-shared": "^0.
|
|
19
|
+
"@alfalab/core-components-shared": "^0.10.0",
|
|
20
20
|
"classnames": "^2.3.1",
|
|
21
21
|
"react-merge-refs": "^1.1.0",
|
|
22
22
|
"tslib": "^2.4.0"
|
package/src/index.module.css
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
--switch-disabled-checked-bg-color: var(--switch-disabled-bg-color);
|
|
23
23
|
|
|
24
24
|
/* icon */
|
|
25
|
-
--switch-icon-color: var(--color-static-neutral-
|
|
25
|
+
--switch-icon-color: var(--color-static-neutral-0);
|
|
26
26
|
--switch-icon-disabled-color: var(--color-light-neutral-translucent-500);
|
|
27
27
|
}
|
|
28
28
|
|