@hh.ru/magritte-ui-switch 3.1.2 → 3.1.3
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,11 +2,11 @@ import './index.css';
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { Skeleton } from '@hh.ru/magritte-ui-skeleton';
|
|
4
4
|
|
|
5
|
-
var styles = {"switch":"magritte-switch___0AZYC_3-1-
|
|
5
|
+
var styles = {"switch":"magritte-switch___0AZYC_3-1-3","slider":"magritte-slider___YN62u_3-1-3","checked":"magritte-checked___QEAn5_3-1-3","switch-skeleton":"magritte-switch-skeleton___g1MEY_3-1-3","switchSkeleton":"magritte-switch-skeleton___g1MEY_3-1-3"};
|
|
6
6
|
|
|
7
7
|
const SwitchSkeleton = ({ Component: Switch,
|
|
8
8
|
// skeleton props
|
|
9
9
|
width, height, borderRadius, inline, additionalClass, loading, ...switchProps }) => (jsx(Skeleton, { loading: loading, additionalClass: styles.switchSkeleton, inline: true, children: jsx(Switch, { ...switchProps }) }));
|
|
10
10
|
|
|
11
11
|
export { SwitchSkeleton as S, styles as s };
|
|
12
|
-
//# sourceMappingURL=Skeleton-
|
|
12
|
+
//# sourceMappingURL=Skeleton-Ccz0REKQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton-
|
|
1
|
+
{"version":3,"file":"Skeleton-Ccz0REKQ.js","sources":["../src/Skeleton.tsx"],"sourcesContent":["import { IncompleteSkeletonComponent, Skeleton } from '@hh.ru/magritte-ui-skeleton';\nimport { SwitchProps } from '@hh.ru/magritte-ui-switch/types';\n\nimport styles from './switch.less';\n\nexport const SwitchSkeleton: IncompleteSkeletonComponent<SwitchProps> = ({\n Component: Switch,\n\n // skeleton props\n width,\n height,\n borderRadius,\n inline,\n additionalClass,\n loading,\n\n ...switchProps\n}) => (\n <Skeleton loading={loading} additionalClass={styles.switchSkeleton} inline>\n <Switch {...switchProps} />\n </Skeleton>\n);\n"],"names":["_jsx"],"mappings":";;;;;MAKa,cAAc,GAA6C,CAAC,EACrE,SAAS,EAAE,MAAM;AAEjB;AACA,KAAK,EACL,MAAM,EACN,YAAY,EACZ,MAAM,EACN,eAAe,EACf,OAAO,EAEP,GAAG,WAAW,EACjB,MACGA,GAAC,CAAA,QAAQ,EAAC,EAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,EAAA,IAAA,EAAA,QAAA,EACtEA,IAAC,MAAM,EAAA,EAAA,GAAK,WAAW,EAAI,CAAA,EAAA,CACpB;;;;"}
|
package/Skeleton.js
CHANGED
package/Switch.js
CHANGED
|
@@ -4,7 +4,7 @@ import classnames from 'classnames';
|
|
|
4
4
|
import { useDisabled } from '@hh.ru/magritte-common-use-disabled';
|
|
5
5
|
import { LockClosedFilledSize16 } from '@hh.ru/magritte-ui-icon/icon';
|
|
6
6
|
import { enrichWithSkeleton } from '@hh.ru/magritte-ui-skeleton';
|
|
7
|
-
import { S as SwitchSkeleton, s as styles } from './Skeleton-
|
|
7
|
+
import { S as SwitchSkeleton, s as styles } from './Skeleton-Ccz0REKQ.js';
|
|
8
8
|
|
|
9
9
|
const SwitchComponent = ({ onClick, 'aria-label': ariaLabel, disabled = false, checked = false, ...props }) => {
|
|
10
10
|
const forceDisabled = useDisabled();
|
package/index.css
CHANGED
|
@@ -1,120 +1,120 @@
|
|
|
1
1
|
:root{
|
|
2
|
-
--magritte-color-component-switch-stroke-state-focused-accessible-v24-
|
|
3
|
-
--magritte-color-component-switch-background-container-checked-v24-
|
|
4
|
-
--magritte-color-component-switch-background-container-unchecked-v24-
|
|
5
|
-
--magritte-color-component-switch-background-toggle-checked-v24-
|
|
6
|
-
--magritte-color-component-switch-background-toggle-unchecked-v24-
|
|
7
|
-
--magritte-color-component-switch-background-state-container-checked-hovered-v24-
|
|
8
|
-
--magritte-color-component-switch-background-state-container-checked-pressed-v24-
|
|
9
|
-
--magritte-color-component-switch-background-state-container-unchecked-hovered-v24-
|
|
10
|
-
--magritte-color-component-switch-background-state-container-unchecked-pressed-v24-
|
|
11
|
-
--magritte-color-component-switch-background-state-toggle-checked-pressed-v24-
|
|
12
|
-
--magritte-color-component-switch-background-state-toggle-unchecked-pressed-v24-
|
|
13
|
-
--magritte-color-component-switch-background-state-container-checked-disabled-v24-
|
|
14
|
-
--magritte-color-component-switch-background-state-container-unchecked-disabled-v24-
|
|
15
|
-
--magritte-color-component-switch-icon-state-toggle-checked-disabled-v24-
|
|
16
|
-
--magritte-color-component-switch-icon-state-toggle-unchecked-disabled-v24-
|
|
17
|
-
--magritte-shadow-level-1-color-v24-
|
|
18
|
-
--magritte-shadow-level-1-x-v24-
|
|
19
|
-
--magritte-shadow-level-1-y-v24-
|
|
20
|
-
--magritte-shadow-level-1-blur-v24-
|
|
21
|
-
--magritte-shadow-level-1-spread-v24-
|
|
2
|
+
--magritte-color-component-switch-stroke-state-focused-accessible-v24-4-0:#0070ff7a;
|
|
3
|
+
--magritte-color-component-switch-background-container-checked-v24-4-0:#0dc267;
|
|
4
|
+
--magritte-color-component-switch-background-container-unchecked-v24-4-0:#DCE3EB;
|
|
5
|
+
--magritte-color-component-switch-background-toggle-checked-v24-4-0:#ffffff;
|
|
6
|
+
--magritte-color-component-switch-background-toggle-unchecked-v24-4-0:#ffffff;
|
|
7
|
+
--magritte-color-component-switch-background-state-container-checked-hovered-v24-4-0:#5bcf83;
|
|
8
|
+
--magritte-color-component-switch-background-state-container-checked-pressed-v24-4-0:#5bcf83;
|
|
9
|
+
--magritte-color-component-switch-background-state-container-unchecked-hovered-v24-4-0:#CCD5DF;
|
|
10
|
+
--magritte-color-component-switch-background-state-container-unchecked-pressed-v24-4-0:#CCD5DF;
|
|
11
|
+
--magritte-color-component-switch-background-state-toggle-checked-pressed-v24-4-0:#ffffff;
|
|
12
|
+
--magritte-color-component-switch-background-state-toggle-unchecked-pressed-v24-4-0:#ffffff;
|
|
13
|
+
--magritte-color-component-switch-background-state-container-checked-disabled-v24-4-0:#0dc2677a;
|
|
14
|
+
--magritte-color-component-switch-background-state-container-unchecked-disabled-v24-4-0:#dce3eb7a;
|
|
15
|
+
--magritte-color-component-switch-icon-state-toggle-checked-disabled-v24-4-0:#0ea6587a;
|
|
16
|
+
--magritte-color-component-switch-icon-state-toggle-unchecked-disabled-v24-4-0:#7686947a;
|
|
17
|
+
--magritte-shadow-level-1-color-v24-4-0:#7090b029;
|
|
18
|
+
--magritte-shadow-level-1-x-v24-4-0:0px;
|
|
19
|
+
--magritte-shadow-level-1-y-v24-4-0:4px;
|
|
20
|
+
--magritte-shadow-level-1-blur-v24-4-0:12px;
|
|
21
|
+
--magritte-shadow-level-1-spread-v24-4-0:0px;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
:root{
|
|
25
|
-
--magritte-semantic-animation-ease-in-out-leopard-300-timing-function-v24-
|
|
26
|
-
--magritte-semantic-animation-ease-in-out-leopard-300-duration-v24-
|
|
25
|
+
--magritte-semantic-animation-ease-in-out-leopard-300-timing-function-v24-4-0:cubic-bezier(0.35, 0.1, 0.1, 1);
|
|
26
|
+
--magritte-semantic-animation-ease-in-out-leopard-300-duration-v24-4-0:300ms;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.magritte-night-theme{
|
|
30
|
-
--magritte-color-component-switch-background-container-unchecked-v24-
|
|
31
|
-
--magritte-color-component-switch-background-state-container-unchecked-hovered-v24-
|
|
32
|
-
--magritte-color-component-switch-background-state-container-unchecked-pressed-v24-
|
|
33
|
-
--magritte-color-component-switch-background-state-container-unchecked-disabled-v24-
|
|
34
|
-
--magritte-shadow-level-1-color-v24-
|
|
30
|
+
--magritte-color-component-switch-background-container-unchecked-v24-4-0:#303030;
|
|
31
|
+
--magritte-color-component-switch-background-state-container-unchecked-hovered-v24-4-0:#3B3B3B;
|
|
32
|
+
--magritte-color-component-switch-background-state-container-unchecked-pressed-v24-4-0:#3B3B3B;
|
|
33
|
+
--magritte-color-component-switch-background-state-container-unchecked-disabled-v24-4-0:#3030307a;
|
|
34
|
+
--magritte-shadow-level-1-color-v24-4-0:#00000029;
|
|
35
35
|
}
|
|
36
|
-
.magritte-switch___0AZYC_3-1-
|
|
36
|
+
.magritte-switch___0AZYC_3-1-3{
|
|
37
37
|
width:52px;
|
|
38
38
|
height:32px;
|
|
39
|
-
background-color:var(--magritte-color-component-switch-background-container-unchecked-v24-
|
|
39
|
+
background-color:var(--magritte-color-component-switch-background-container-unchecked-v24-4-0);
|
|
40
40
|
border-radius:16px;
|
|
41
41
|
cursor:pointer;
|
|
42
42
|
position:relative;
|
|
43
43
|
}
|
|
44
|
-
.magritte-switch___0AZYC_3-1-
|
|
45
|
-
background-color:var(--magritte-color-component-switch-background-state-container-unchecked-pressed-v24-
|
|
44
|
+
.magritte-switch___0AZYC_3-1-3:active:not(:disabled){
|
|
45
|
+
background-color:var(--magritte-color-component-switch-background-state-container-unchecked-pressed-v24-4-0);
|
|
46
46
|
}
|
|
47
|
-
.magritte-switch___0AZYC_3-1-
|
|
47
|
+
.magritte-switch___0AZYC_3-1-3:active:not(:disabled) .magritte-slider___YN62u_3-1-3{
|
|
48
48
|
border-radius:14px;
|
|
49
|
-
background-color:var(--magritte-color-component-switch-background-state-toggle-unchecked-pressed-v24-
|
|
49
|
+
background-color:var(--magritte-color-component-switch-background-state-toggle-unchecked-pressed-v24-4-0);
|
|
50
50
|
width:32px;
|
|
51
51
|
}
|
|
52
|
-
.magritte-switch___0AZYC_3-1-
|
|
52
|
+
.magritte-switch___0AZYC_3-1-3:disabled{
|
|
53
53
|
cursor:not-allowed;
|
|
54
|
-
background-color:var(--magritte-color-component-switch-background-state-container-unchecked-disabled-v24-
|
|
54
|
+
background-color:var(--magritte-color-component-switch-background-state-container-unchecked-disabled-v24-4-0);
|
|
55
55
|
border-radius:20px;
|
|
56
56
|
}
|
|
57
|
-
.magritte-switch___0AZYC_3-1-
|
|
58
|
-
background-color:var(--magritte-color-component-switch-background-state-container-checked-disabled-v24-
|
|
57
|
+
.magritte-switch___0AZYC_3-1-3:disabled.magritte-checked___QEAn5_3-1-3{
|
|
58
|
+
background-color:var(--magritte-color-component-switch-background-state-container-checked-disabled-v24-4-0);
|
|
59
59
|
}
|
|
60
|
-
.magritte-switch___0AZYC_3-1-
|
|
61
|
-
outline:var(--magritte-color-component-switch-stroke-state-focused-accessible-v24-
|
|
60
|
+
.magritte-switch___0AZYC_3-1-3.focus-visible{
|
|
61
|
+
outline:var(--magritte-color-component-switch-stroke-state-focused-accessible-v24-4-0) solid 4px;
|
|
62
62
|
}
|
|
63
63
|
@media (min-width: 1020px){
|
|
64
|
-
body.magritte-old-layout .magritte-switch___0AZYC_3-1-
|
|
65
|
-
background-color:var(--magritte-color-component-switch-background-state-container-unchecked-hovered-v24-
|
|
64
|
+
body.magritte-old-layout .magritte-switch___0AZYC_3-1-3:hover:not(:disabled):not(:active){
|
|
65
|
+
background-color:var(--magritte-color-component-switch-background-state-container-unchecked-hovered-v24-4-0);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
@media (min-width: 1024px){
|
|
69
|
-
body:not(.magritte-old-layout) .magritte-switch___0AZYC_3-1-
|
|
70
|
-
background-color:var(--magritte-color-component-switch-background-state-container-unchecked-hovered-v24-
|
|
69
|
+
body:not(.magritte-old-layout) .magritte-switch___0AZYC_3-1-3:hover:not(:disabled):not(:active){
|
|
70
|
+
background-color:var(--magritte-color-component-switch-background-state-container-unchecked-hovered-v24-4-0);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
.magritte-slider___YN62u_3-1-
|
|
73
|
+
.magritte-slider___YN62u_3-1-3{
|
|
74
74
|
width:24px;
|
|
75
75
|
height:24px;
|
|
76
|
-
background-color:var(--magritte-color-component-switch-background-toggle-unchecked-v24-
|
|
76
|
+
background-color:var(--magritte-color-component-switch-background-toggle-unchecked-v24-4-0);
|
|
77
77
|
border-radius:50%;
|
|
78
78
|
position:absolute;
|
|
79
79
|
left:0;
|
|
80
80
|
right:auto;
|
|
81
81
|
top:0;
|
|
82
|
-
transition-duration:var(--magritte-semantic-animation-ease-in-out-leopard-300-duration-v24-
|
|
83
|
-
transition-timing-function:var(--magritte-semantic-animation-ease-in-out-leopard-300-timing-function-v24-
|
|
82
|
+
transition-duration:var(--magritte-semantic-animation-ease-in-out-leopard-300-duration-v24-4-0);
|
|
83
|
+
transition-timing-function:var(--magritte-semantic-animation-ease-in-out-leopard-300-timing-function-v24-4-0);
|
|
84
84
|
margin:4px;
|
|
85
85
|
display:flex;
|
|
86
86
|
justify-content:center;
|
|
87
87
|
align-items:center;
|
|
88
|
-
--magritte-ui-icon-color-override:var(--magritte-color-component-switch-icon-state-toggle-unchecked-disabled-v24-
|
|
89
|
-
box-shadow:var(--magritte-shadow-level-1-x-v24-
|
|
88
|
+
--magritte-ui-icon-color-override:var(--magritte-color-component-switch-icon-state-toggle-unchecked-disabled-v24-4-0);
|
|
89
|
+
box-shadow:var(--magritte-shadow-level-1-x-v24-4-0) var(--magritte-shadow-level-1-y-v24-4-0) var(--magritte-shadow-level-1-blur-v24-4-0) var(--magritte-shadow-level-1-spread-v24-4-0) var(--magritte-shadow-level-1-color-v24-4-0);
|
|
90
90
|
}
|
|
91
|
-
.magritte-checked___QEAn5_3-1-
|
|
92
|
-
background-color:var(--magritte-color-component-switch-background-container-checked-v24-
|
|
91
|
+
.magritte-checked___QEAn5_3-1-3{
|
|
92
|
+
background-color:var(--magritte-color-component-switch-background-container-checked-v24-4-0);
|
|
93
93
|
}
|
|
94
|
-
.magritte-checked___QEAn5_3-1-
|
|
95
|
-
background-color:var(--magritte-color-component-switch-background-toggle-checked-v24-
|
|
94
|
+
.magritte-checked___QEAn5_3-1-3 .magritte-slider___YN62u_3-1-3{
|
|
95
|
+
background-color:var(--magritte-color-component-switch-background-toggle-checked-v24-4-0);
|
|
96
96
|
left:calc(52px - (24px + 4px*2));
|
|
97
|
-
--magritte-ui-icon-color-override:var(--magritte-color-component-switch-icon-state-toggle-checked-disabled-v24-
|
|
97
|
+
--magritte-ui-icon-color-override:var(--magritte-color-component-switch-icon-state-toggle-checked-disabled-v24-4-0);
|
|
98
98
|
}
|
|
99
|
-
.magritte-checked___QEAn5_3-1-
|
|
100
|
-
background-color:var(--magritte-color-component-switch-background-state-container-checked-pressed-v24-
|
|
99
|
+
.magritte-checked___QEAn5_3-1-3:active:not(:disabled){
|
|
100
|
+
background-color:var(--magritte-color-component-switch-background-state-container-checked-pressed-v24-4-0);
|
|
101
101
|
}
|
|
102
|
-
.magritte-checked___QEAn5_3-1-
|
|
103
|
-
background-color:var(--magritte-color-component-switch-background-state-toggle-checked-pressed-v24-
|
|
102
|
+
.magritte-checked___QEAn5_3-1-3:active:not(:disabled) .magritte-slider___YN62u_3-1-3{
|
|
103
|
+
background-color:var(--magritte-color-component-switch-background-state-toggle-checked-pressed-v24-4-0);
|
|
104
104
|
width:32px;
|
|
105
105
|
left:calc(52px - (32px + 4px*2));
|
|
106
106
|
}
|
|
107
107
|
@media (min-width: 1020px){
|
|
108
|
-
body.magritte-old-layout .magritte-checked___QEAn5_3-1-
|
|
109
|
-
background-color:var(--magritte-color-component-switch-background-state-container-checked-hovered-v24-
|
|
108
|
+
body.magritte-old-layout .magritte-checked___QEAn5_3-1-3:hover:not(:disabled):not(:active){
|
|
109
|
+
background-color:var(--magritte-color-component-switch-background-state-container-checked-hovered-v24-4-0);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
@media (min-width: 1024px){
|
|
113
|
-
body:not(.magritte-old-layout) .magritte-checked___QEAn5_3-1-
|
|
114
|
-
background-color:var(--magritte-color-component-switch-background-state-container-checked-hovered-v24-
|
|
113
|
+
body:not(.magritte-old-layout) .magritte-checked___QEAn5_3-1-3:hover:not(:disabled):not(:active){
|
|
114
|
+
background-color:var(--magritte-color-component-switch-background-state-container-checked-hovered-v24-4-0);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
.magritte-switch-skeleton___g1MEY_3-1-
|
|
117
|
+
.magritte-switch-skeleton___g1MEY_3-1-3{
|
|
118
118
|
width:52px;
|
|
119
119
|
height:32px;
|
|
120
120
|
border-radius:16px;
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hh.ru/magritte-ui-switch",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@hh.ru/magritte-common-use-disabled": "1.0.14",
|
|
23
|
-
"@hh.ru/magritte-design-tokens": "24.
|
|
23
|
+
"@hh.ru/magritte-design-tokens": "24.4.0",
|
|
24
24
|
"@hh.ru/magritte-ui-breakpoint": "6.0.6",
|
|
25
|
-
"@hh.ru/magritte-ui-icon": "13.10.
|
|
26
|
-
"@hh.ru/magritte-ui-skeleton": "3.0.
|
|
25
|
+
"@hh.ru/magritte-ui-icon": "13.10.1",
|
|
26
|
+
"@hh.ru/magritte-ui-skeleton": "3.0.16"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"classnames": ">=2.3.2",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "dbdbcad65f9d7dc14f074ed3e1e83a48d1ef832c"
|
|
36
36
|
}
|