@alfalab/core-components-switch 4.3.2 → 4.5.0
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.d.ts +11 -0
- package/Component.js +17 -5
- package/cssm/Component.d.ts +11 -0
- package/cssm/Component.js +14 -4
- package/cssm/default.module.css +73 -0
- package/cssm/index.module.css +5 -40
- package/cssm/inverted.module.css +73 -0
- package/cssm/types/colors.d.ts +2 -0
- package/cssm/types/colors.js +2 -0
- package/cssm/vars.css +14 -0
- package/default.css +74 -0
- package/esm/Component.d.ts +11 -0
- package/esm/Component.js +17 -5
- package/esm/default.css +74 -0
- package/esm/index.css +23 -58
- package/esm/inverted.css +74 -0
- package/esm/types/colors.d.ts +2 -0
- package/esm/types/colors.js +1 -0
- package/index.css +23 -58
- package/inverted.css +74 -0
- package/modern/Component.d.ts +11 -0
- package/modern/Component.js +17 -5
- package/modern/default.css +74 -0
- package/modern/index.css +23 -58
- package/modern/inverted.css +74 -0
- package/modern/types/colors.d.ts +2 -0
- package/modern/types/colors.js +1 -0
- package/moderncssm/Component.d.ts +11 -0
- package/moderncssm/Component.js +12 -4
- package/moderncssm/default.module.css +58 -0
- package/moderncssm/index.module.css +3 -70
- package/moderncssm/inverted.module.css +58 -0
- package/moderncssm/types/colors.d.ts +2 -0
- package/moderncssm/types/colors.js +1 -0
- package/moderncssm/vars.css +14 -0
- package/package.json +3 -3
- package/src/Component.tsx +31 -3
- package/src/default.module.css +46 -0
- package/src/index.module.css +1 -61
- package/src/inverted.module.css +46 -0
- package/src/types/colors.ts +1 -0
- package/src/vars.css +37 -0
- package/types/colors.d.ts +2 -0
- package/types/colors.js +2 -0
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
/* */
|
|
2
|
-
|
|
3
2
|
:root {
|
|
4
|
-
--switch-label-color: var(--color-light-text-primary);
|
|
5
|
-
--switch-hint-color: var(--color-light-text-secondary);
|
|
6
|
-
--switch-bg-color: var(--color-light-neutral-translucent-700);
|
|
7
3
|
--switch-border-color: transparent;
|
|
8
4
|
--switch-error-color: var(--color-light-text-negative);
|
|
9
5
|
|
|
6
|
+
/* inverted */
|
|
7
|
+
|
|
10
8
|
/* hover */
|
|
11
|
-
--switch-hover-bg-color: var(--color-light-neutral-translucent-700-hover);
|
|
12
9
|
|
|
13
10
|
/* checked */
|
|
14
|
-
--switch-checked-bg-color: var(--color-light-status-positive);
|
|
15
|
-
--switch-checked-hover-bg-color: var(--color-light-status-positive-hover);
|
|
16
11
|
|
|
17
12
|
/* disabled */
|
|
18
|
-
--switch-disabled-color: var(--color-light-text-secondary);
|
|
19
|
-
--switch-disabled-bg-color: var(--color-light-neutral-translucent-200);
|
|
20
13
|
|
|
21
14
|
/* disabled checked */
|
|
22
|
-
--switch-disabled-checked-bg-color: var(--switch-disabled-bg-color);
|
|
23
15
|
|
|
24
16
|
/* icon */
|
|
25
17
|
--switch-icon-color: var(--color-static-neutral-0);
|
|
26
|
-
--switch-icon-disabled-color: var(--color-light-neutral-translucent-500);
|
|
27
18
|
}
|
|
28
|
-
|
|
29
19
|
.component {
|
|
30
20
|
display: inline-flex;
|
|
31
21
|
align-items: flex-start;
|
|
@@ -35,30 +25,24 @@
|
|
|
35
25
|
cursor: pointer;
|
|
36
26
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
37
27
|
}
|
|
38
|
-
|
|
39
28
|
.component input {
|
|
40
29
|
opacity: 0;
|
|
41
30
|
position: absolute;
|
|
42
31
|
}
|
|
43
|
-
|
|
44
32
|
.start {
|
|
45
33
|
align-items: flex-start;
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
.center {
|
|
49
36
|
align-items: center;
|
|
50
37
|
}
|
|
51
|
-
|
|
52
38
|
.addons {
|
|
53
39
|
margin-left: auto;
|
|
54
40
|
padding-left: var(--gap-16);
|
|
55
41
|
line-height: 24px;
|
|
56
42
|
}
|
|
57
|
-
|
|
58
43
|
.block {
|
|
59
44
|
width: 100%;
|
|
60
45
|
}
|
|
61
|
-
|
|
62
46
|
.switch {
|
|
63
47
|
position: relative;
|
|
64
48
|
border-radius: var(--border-radius-16);
|
|
@@ -66,16 +50,10 @@
|
|
|
66
50
|
height: 20px;
|
|
67
51
|
margin: var(--gap-2);
|
|
68
52
|
flex-shrink: 0;
|
|
69
|
-
background-color: var(--switch-bg-color);
|
|
70
53
|
border: 2px solid var(--switch-border-color);
|
|
71
54
|
transition: background-color 0.2s ease, border-color 0.2s ease;
|
|
72
|
-
box-sizing: border-box
|
|
55
|
+
box-sizing: border-box;
|
|
73
56
|
}
|
|
74
|
-
|
|
75
|
-
.switch:hover {
|
|
76
|
-
background-color: var(--switch-hover-bg-color);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
57
|
.switch:before {
|
|
80
58
|
content: '';
|
|
81
59
|
position: absolute;
|
|
@@ -89,100 +67,55 @@
|
|
|
89
67
|
box-sizing: border-box;
|
|
90
68
|
transition: transform 0.2s ease;
|
|
91
69
|
}
|
|
92
|
-
|
|
93
70
|
.content {
|
|
94
71
|
margin-left: var(--gap-12);
|
|
95
72
|
flex-grow: 1;
|
|
96
73
|
}
|
|
97
|
-
|
|
98
74
|
.label {
|
|
99
75
|
font-size: 16px;
|
|
100
76
|
line-height: 24px;
|
|
101
77
|
font-weight: 400;
|
|
102
78
|
display: block;
|
|
103
|
-
color: var(--switch-label-color);
|
|
104
79
|
}
|
|
105
|
-
|
|
106
80
|
.label:not(:only-child) {
|
|
107
81
|
margin-bottom: var(--gap-4);
|
|
108
82
|
}
|
|
109
|
-
|
|
110
83
|
.errorMessage {
|
|
111
84
|
font-size: 14px;
|
|
112
85
|
line-height: 18px;
|
|
113
86
|
font-weight: 400;
|
|
114
87
|
color: var(--switch-error-color);
|
|
115
88
|
}
|
|
116
|
-
|
|
117
89
|
.hint {
|
|
118
90
|
font-size: 14px;
|
|
119
91
|
line-height: 18px;
|
|
120
92
|
font-weight: 400;
|
|
121
93
|
display: block;
|
|
122
|
-
color: var(--switch-hint-color);
|
|
123
94
|
}
|
|
124
|
-
|
|
125
95
|
/* Reversed state */
|
|
126
|
-
|
|
127
96
|
.component.reversed {
|
|
128
97
|
flex-direction: row-reverse;
|
|
129
98
|
}
|
|
130
|
-
|
|
131
99
|
.reversed .content {
|
|
132
100
|
margin-right: var(--gap-16);
|
|
133
101
|
margin-left: var(--gap-0);
|
|
134
102
|
}
|
|
135
|
-
|
|
136
103
|
.reversed .addons {
|
|
137
104
|
margin-left: var(--gap-0);
|
|
138
105
|
padding-left: var(--gap-0);
|
|
139
106
|
margin-right: auto;
|
|
140
107
|
padding-right: var(--gap-16);
|
|
141
108
|
}
|
|
142
|
-
|
|
143
109
|
/* Checked state */
|
|
144
|
-
|
|
145
|
-
.checked .switch {
|
|
146
|
-
background-color: var(--switch-checked-bg-color)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.checked .switch:hover {
|
|
150
|
-
background-color: var(--switch-checked-hover-bg-color);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
110
|
.checked .switch:before {
|
|
154
111
|
/* ширина компонента(36px + 2*2px) - отступы(2 * 2px) - размер кружка(20px) */
|
|
155
112
|
transform: translateX(16px);
|
|
156
113
|
}
|
|
157
|
-
|
|
158
114
|
/* Disabled state */
|
|
159
|
-
|
|
160
115
|
.disabled {
|
|
161
116
|
cursor: var(--disabled-cursor);
|
|
162
117
|
}
|
|
163
|
-
|
|
164
|
-
.disabled .switch {
|
|
165
|
-
background-color: var(--switch-disabled-bg-color)
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.disabled .switch:before {
|
|
169
|
-
background-color: var(--switch-icon-disabled-color);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.disabled.checked .switch {
|
|
173
|
-
background-color: var(--switch-disabled-checked-bg-color);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.disabled .label {
|
|
177
|
-
color: var(--switch-disabled-color);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.disabled .hint {
|
|
181
|
-
color: var(--switch-disabled-color);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
118
|
/* Focused state */
|
|
185
|
-
|
|
186
119
|
.focused .switch {
|
|
187
120
|
outline: 2px solid var(--focus-color);
|
|
188
121
|
outline-offset: 2px;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
:root {
|
|
3
|
+
|
|
4
|
+
/* inverted */
|
|
5
|
+
--switch-label-inverted-color: var(--color-light-text-primary-inverted);
|
|
6
|
+
--switch-hint-inverted-color: var(--color-light-text-secondary-inverted);
|
|
7
|
+
--switch-checked-bg-inverted-color: var(--color-light-status-positive-inverted);
|
|
8
|
+
--switch-checked-hover-bg-inverted-color: var(--color-light-status-positive-inverted-hover);
|
|
9
|
+
--switch-bg-inverted-color: var(--color-light-neutral-translucent-700-inverted);
|
|
10
|
+
|
|
11
|
+
/* hover */
|
|
12
|
+
--switch-hover-bg-inverted-color: var(--color-light-neutral-translucent-700-inverted-hover);
|
|
13
|
+
|
|
14
|
+
/* checked */
|
|
15
|
+
|
|
16
|
+
/* disabled */
|
|
17
|
+
--switch-disabled-inverted-color: var(--color-light-text-secondary-inverted);
|
|
18
|
+
--switch-disabled-bg-inverted-color: var(--color-light-neutral-translucent-200-inverted);
|
|
19
|
+
|
|
20
|
+
/* disabled checked */
|
|
21
|
+
--switch-disabled-checked-bg-inverted-color: var(--switch-disabled-bg-inverted-color);
|
|
22
|
+
|
|
23
|
+
/* icon */
|
|
24
|
+
--switch-icon-disabled-inverted-color: var(--color-light-neutral-translucent-500-inverted);
|
|
25
|
+
}
|
|
26
|
+
.switch {
|
|
27
|
+
background-color: var(--switch-bg-inverted-color)
|
|
28
|
+
}
|
|
29
|
+
.switch:hover {
|
|
30
|
+
background-color: var(--switch-hover-bg-inverted-color);
|
|
31
|
+
}
|
|
32
|
+
.label {
|
|
33
|
+
color: var(--switch-label-inverted-color);
|
|
34
|
+
}
|
|
35
|
+
.hint {
|
|
36
|
+
color: var(--switch-hint-inverted-color);
|
|
37
|
+
}
|
|
38
|
+
.checked .switch {
|
|
39
|
+
background-color: var(--switch-checked-bg-inverted-color)
|
|
40
|
+
}
|
|
41
|
+
.checked .switch:hover {
|
|
42
|
+
background-color: var(--switch-checked-hover-bg-inverted-color);
|
|
43
|
+
}
|
|
44
|
+
.disabled .label {
|
|
45
|
+
color: var(--switch-disabled-inverted-color);
|
|
46
|
+
}
|
|
47
|
+
.disabled .hint {
|
|
48
|
+
color: var(--switch-disabled-inverted-color);
|
|
49
|
+
}
|
|
50
|
+
.disabled .switch {
|
|
51
|
+
background-color: var(--switch-disabled-bg-inverted-color)
|
|
52
|
+
}
|
|
53
|
+
.disabled .switch:before {
|
|
54
|
+
background-color: var(--switch-icon-disabled-inverted-color);
|
|
55
|
+
}
|
|
56
|
+
.disabled.checked .switch {
|
|
57
|
+
background-color: var(--switch-disabled-checked-bg-inverted-color);
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-switch",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"gitHead": "f054fef20200664c65e2501ef1f916c555cdf05d",
|
|
6
6
|
"keywords": [],
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
"react-merge-refs": "^1.1.0",
|
|
22
22
|
"tslib": "^2.4.0"
|
|
23
23
|
},
|
|
24
|
-
"themesVersion": "13.
|
|
25
|
-
"varsVersion": "9.
|
|
24
|
+
"themesVersion": "13.5.0",
|
|
25
|
+
"varsVersion": "9.15.0"
|
|
26
26
|
}
|
package/src/Component.tsx
CHANGED
|
@@ -5,7 +5,16 @@ import cn from 'classnames';
|
|
|
5
5
|
import { dom } from '@alfalab/core-components-shared';
|
|
6
6
|
import { useFocus } from '@alfalab/hooks';
|
|
7
7
|
|
|
8
|
+
import { Colors } from './types/colors';
|
|
9
|
+
|
|
10
|
+
import defaultStyles from './default.module.css';
|
|
8
11
|
import styles from './index.module.css';
|
|
12
|
+
import invertedStyles from './inverted.module.css';
|
|
13
|
+
|
|
14
|
+
const colorStyles = {
|
|
15
|
+
default: defaultStyles,
|
|
16
|
+
inverted: invertedStyles,
|
|
17
|
+
};
|
|
9
18
|
|
|
10
19
|
type Align = 'start' | 'center';
|
|
11
20
|
|
|
@@ -80,6 +89,12 @@ export type SwitchProps = Omit<
|
|
|
80
89
|
* Идентификатор для систем автоматизированного тестирования
|
|
81
90
|
*/
|
|
82
91
|
dataTestId?: string;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Набор цветов для компонента
|
|
95
|
+
* @default default
|
|
96
|
+
*/
|
|
97
|
+
colors?: Colors;
|
|
83
98
|
};
|
|
84
99
|
|
|
85
100
|
export const Switch = forwardRef<HTMLLabelElement, SwitchProps>(
|
|
@@ -100,6 +115,7 @@ export const Switch = forwardRef<HTMLLabelElement, SwitchProps>(
|
|
|
100
115
|
className,
|
|
101
116
|
onChange,
|
|
102
117
|
dataTestId,
|
|
118
|
+
colors = 'default',
|
|
103
119
|
...restProps
|
|
104
120
|
},
|
|
105
121
|
ref,
|
|
@@ -120,7 +136,11 @@ export const Switch = forwardRef<HTMLLabelElement, SwitchProps>(
|
|
|
120
136
|
<label
|
|
121
137
|
className={cn(styles.component, styles[align], className, {
|
|
122
138
|
[styles.disabled]: disabled || inactive,
|
|
139
|
+
[colorStyles[colors].disabled]: disabled || inactive,
|
|
140
|
+
|
|
123
141
|
[styles.checked]: checked,
|
|
142
|
+
[colorStyles[colors].checked]: checked,
|
|
143
|
+
|
|
124
144
|
[styles.reversed]: reversed,
|
|
125
145
|
[styles.focused]: focused,
|
|
126
146
|
[styles.block]: block,
|
|
@@ -138,12 +158,20 @@ export const Switch = forwardRef<HTMLLabelElement, SwitchProps>(
|
|
|
138
158
|
{...restProps}
|
|
139
159
|
/>
|
|
140
160
|
|
|
141
|
-
<span className={styles.switch} />
|
|
161
|
+
<span className={cn(styles.switch, colorStyles[colors].switch)} />
|
|
142
162
|
|
|
143
163
|
{(label || hint || errorMessage) && (
|
|
144
164
|
<span className={styles.content}>
|
|
145
|
-
{label &&
|
|
146
|
-
|
|
165
|
+
{label && (
|
|
166
|
+
<span className={cn(styles.label, colorStyles[colors].label)}>
|
|
167
|
+
{label}
|
|
168
|
+
</span>
|
|
169
|
+
)}
|
|
170
|
+
{hint && !errorMessage && (
|
|
171
|
+
<span className={cn(styles.hint, colorStyles[colors].hint)}>
|
|
172
|
+
{hint}
|
|
173
|
+
</span>
|
|
174
|
+
)}
|
|
147
175
|
|
|
148
176
|
{errorMessage && (
|
|
149
177
|
<span className={styles.errorMessage} role='alert'>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@import '@alfalab/core-components-vars/src/index.css';
|
|
2
|
+
@import './vars.css';
|
|
3
|
+
|
|
4
|
+
.switch {
|
|
5
|
+
background-color: var(--switch-bg-color);
|
|
6
|
+
|
|
7
|
+
&:hover {
|
|
8
|
+
background-color: var(--switch-hover-bg-color);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.label {
|
|
13
|
+
color: var(--switch-label-color);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.hint {
|
|
17
|
+
color: var(--switch-hint-color);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.checked .switch {
|
|
21
|
+
background-color: var(--switch-checked-bg-color);
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
background-color: var(--switch-checked-hover-bg-color);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.disabled .label {
|
|
29
|
+
color: var(--switch-disabled-color);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.disabled .hint {
|
|
33
|
+
color: var(--switch-disabled-color);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.disabled .switch {
|
|
37
|
+
background-color: var(--switch-disabled-bg-color);
|
|
38
|
+
|
|
39
|
+
&:before {
|
|
40
|
+
background-color: var(--switch-icon-disabled-color);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.disabled.checked .switch {
|
|
45
|
+
background-color: var(--switch-disabled-checked-bg-color);
|
|
46
|
+
}
|
package/src/index.module.css
CHANGED
|
@@ -1,30 +1,5 @@
|
|
|
1
1
|
@import '@alfalab/core-components-vars/src/index.css';
|
|
2
|
-
|
|
3
|
-
:root {
|
|
4
|
-
--switch-label-color: var(--color-light-text-primary);
|
|
5
|
-
--switch-hint-color: var(--color-light-text-secondary);
|
|
6
|
-
--switch-bg-color: var(--color-light-neutral-translucent-700);
|
|
7
|
-
--switch-border-color: transparent;
|
|
8
|
-
--switch-error-color: var(--color-light-text-negative);
|
|
9
|
-
|
|
10
|
-
/* hover */
|
|
11
|
-
--switch-hover-bg-color: var(--color-light-neutral-translucent-700-hover);
|
|
12
|
-
|
|
13
|
-
/* checked */
|
|
14
|
-
--switch-checked-bg-color: var(--color-light-status-positive);
|
|
15
|
-
--switch-checked-hover-bg-color: var(--color-light-status-positive-hover);
|
|
16
|
-
|
|
17
|
-
/* disabled */
|
|
18
|
-
--switch-disabled-color: var(--color-light-text-secondary);
|
|
19
|
-
--switch-disabled-bg-color: var(--color-light-neutral-translucent-200);
|
|
20
|
-
|
|
21
|
-
/* disabled checked */
|
|
22
|
-
--switch-disabled-checked-bg-color: var(--switch-disabled-bg-color);
|
|
23
|
-
|
|
24
|
-
/* icon */
|
|
25
|
-
--switch-icon-color: var(--color-static-neutral-0);
|
|
26
|
-
--switch-icon-disabled-color: var(--color-light-neutral-translucent-500);
|
|
27
|
-
}
|
|
2
|
+
@import './vars.css';
|
|
28
3
|
|
|
29
4
|
.component {
|
|
30
5
|
display: inline-flex;
|
|
@@ -66,14 +41,9 @@
|
|
|
66
41
|
height: 20px;
|
|
67
42
|
margin: var(--gap-2);
|
|
68
43
|
flex-shrink: 0;
|
|
69
|
-
background-color: var(--switch-bg-color);
|
|
70
44
|
border: 2px solid var(--switch-border-color);
|
|
71
45
|
transition: background-color 0.2s ease, border-color 0.2s ease;
|
|
72
46
|
box-sizing: border-box;
|
|
73
|
-
|
|
74
|
-
&:hover {
|
|
75
|
-
background-color: var(--switch-hover-bg-color);
|
|
76
|
-
}
|
|
77
47
|
}
|
|
78
48
|
|
|
79
49
|
.switch:before {
|
|
@@ -98,7 +68,6 @@
|
|
|
98
68
|
.label {
|
|
99
69
|
@mixin paragraph_primary_medium;
|
|
100
70
|
display: block;
|
|
101
|
-
color: var(--switch-label-color);
|
|
102
71
|
}
|
|
103
72
|
|
|
104
73
|
.label:not(:only-child) {
|
|
@@ -113,7 +82,6 @@
|
|
|
113
82
|
.hint {
|
|
114
83
|
@mixin paragraph_component_secondary;
|
|
115
84
|
display: block;
|
|
116
|
-
color: var(--switch-hint-color);
|
|
117
85
|
}
|
|
118
86
|
|
|
119
87
|
/* Reversed state */
|
|
@@ -136,14 +104,6 @@
|
|
|
136
104
|
|
|
137
105
|
/* Checked state */
|
|
138
106
|
|
|
139
|
-
.checked .switch {
|
|
140
|
-
background-color: var(--switch-checked-bg-color);
|
|
141
|
-
|
|
142
|
-
&:hover {
|
|
143
|
-
background-color: var(--switch-checked-hover-bg-color);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
107
|
.checked .switch:before {
|
|
148
108
|
/* ширина компонента(36px + 2*2px) - отступы(2 * 2px) - размер кружка(20px) */
|
|
149
109
|
transform: translateX(16px);
|
|
@@ -155,26 +115,6 @@
|
|
|
155
115
|
cursor: var(--disabled-cursor);
|
|
156
116
|
}
|
|
157
117
|
|
|
158
|
-
.disabled .switch {
|
|
159
|
-
background-color: var(--switch-disabled-bg-color);
|
|
160
|
-
|
|
161
|
-
&:before {
|
|
162
|
-
background-color: var(--switch-icon-disabled-color);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.disabled.checked .switch {
|
|
167
|
-
background-color: var(--switch-disabled-checked-bg-color);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.disabled .label {
|
|
171
|
-
color: var(--switch-disabled-color);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.disabled .hint {
|
|
175
|
-
color: var(--switch-disabled-color);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
118
|
/* Focused state */
|
|
179
119
|
|
|
180
120
|
.focused .switch {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@import '@alfalab/core-components-vars/src/index.css';
|
|
2
|
+
@import './vars.css';
|
|
3
|
+
|
|
4
|
+
.switch {
|
|
5
|
+
background-color: var(--switch-bg-inverted-color);
|
|
6
|
+
|
|
7
|
+
&:hover {
|
|
8
|
+
background-color: var(--switch-hover-bg-inverted-color);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.label {
|
|
13
|
+
color: var(--switch-label-inverted-color);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.hint {
|
|
17
|
+
color: var(--switch-hint-inverted-color);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.checked .switch {
|
|
21
|
+
background-color: var(--switch-checked-bg-inverted-color);
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
background-color: var(--switch-checked-hover-bg-inverted-color);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.disabled .label {
|
|
29
|
+
color: var(--switch-disabled-inverted-color);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.disabled .hint {
|
|
33
|
+
color: var(--switch-disabled-inverted-color);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.disabled .switch {
|
|
37
|
+
background-color: var(--switch-disabled-bg-inverted-color);
|
|
38
|
+
|
|
39
|
+
&:before {
|
|
40
|
+
background-color: var(--switch-icon-disabled-inverted-color);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.disabled.checked .switch {
|
|
45
|
+
background-color: var(--switch-disabled-checked-bg-inverted-color);
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Colors = 'default' | 'inverted';
|
package/src/vars.css
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--switch-label-color: var(--color-light-text-primary);
|
|
3
|
+
--switch-hint-color: var(--color-light-text-secondary);
|
|
4
|
+
--switch-bg-color: var(--color-light-neutral-translucent-700);
|
|
5
|
+
--switch-border-color: transparent;
|
|
6
|
+
--switch-error-color: var(--color-light-text-negative);
|
|
7
|
+
|
|
8
|
+
/* inverted */
|
|
9
|
+
--switch-label-inverted-color: var(--color-light-text-primary-inverted);
|
|
10
|
+
--switch-hint-inverted-color: var(--color-light-text-secondary-inverted);
|
|
11
|
+
--switch-checked-bg-inverted-color: var(--color-light-status-positive-inverted);
|
|
12
|
+
--switch-checked-hover-bg-inverted-color: var(--color-light-status-positive-inverted-hover);
|
|
13
|
+
--switch-bg-inverted-color: var(--color-light-neutral-translucent-700-inverted);
|
|
14
|
+
|
|
15
|
+
/* hover */
|
|
16
|
+
--switch-hover-bg-color: var(--color-light-neutral-translucent-700-hover);
|
|
17
|
+
--switch-hover-bg-inverted-color: var(--color-light-neutral-translucent-700-inverted-hover);
|
|
18
|
+
|
|
19
|
+
/* checked */
|
|
20
|
+
--switch-checked-bg-color: var(--color-light-status-positive);
|
|
21
|
+
--switch-checked-hover-bg-color: var(--color-light-status-positive-hover);
|
|
22
|
+
|
|
23
|
+
/* disabled */
|
|
24
|
+
--switch-disabled-color: var(--color-light-text-secondary);
|
|
25
|
+
--switch-disabled-inverted-color: var(--color-light-text-secondary-inverted);
|
|
26
|
+
--switch-disabled-bg-color: var(--color-light-neutral-translucent-200);
|
|
27
|
+
--switch-disabled-bg-inverted-color: var(--color-light-neutral-translucent-200-inverted);
|
|
28
|
+
|
|
29
|
+
/* disabled checked */
|
|
30
|
+
--switch-disabled-checked-bg-color: var(--switch-disabled-bg-color);
|
|
31
|
+
--switch-disabled-checked-bg-inverted-color: var(--switch-disabled-bg-inverted-color);
|
|
32
|
+
|
|
33
|
+
/* icon */
|
|
34
|
+
--switch-icon-color: var(--color-static-neutral-0);
|
|
35
|
+
--switch-icon-disabled-color: var(--color-light-neutral-translucent-500);
|
|
36
|
+
--switch-icon-disabled-inverted-color: var(--color-light-neutral-translucent-500-inverted);
|
|
37
|
+
}
|
package/types/colors.js
ADDED