@rescui/toggle 0.5.5-RUI-308-Fix-select-issues-405b9fa40.12 → 0.6.1
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/lib/index.css +22 -22
- package/lib/toggle-control.js +138 -33
- package/lib/toggle.js +124 -31
- package/lib/toggle.p.module.css.js +10 -10
- package/package.json +10 -9
package/lib/index.css
CHANGED
|
@@ -3,36 +3,36 @@
|
|
|
3
3
|
inherits:true;
|
|
4
4
|
initial-value:0;
|
|
5
5
|
}
|
|
6
|
-
.
|
|
6
|
+
._themeLight_1iv0967_6{
|
|
7
7
|
--rs-theme-dark:0;
|
|
8
8
|
}
|
|
9
|
-
.
|
|
9
|
+
._themeDark_1iv0967_9{
|
|
10
10
|
--rs-theme-dark:1;
|
|
11
11
|
}
|
|
12
|
-
.
|
|
12
|
+
._sizeS_1iv0967_13{
|
|
13
13
|
--_rs-toggle-width:20px;
|
|
14
14
|
--_rs-toggle-height:12px;
|
|
15
15
|
--_rs-toggle-shadow:3px;
|
|
16
16
|
}
|
|
17
|
-
.
|
|
17
|
+
._sizeM_1iv0967_16{
|
|
18
18
|
--_rs-toggle-width:28px;
|
|
19
19
|
--_rs-toggle-height:16px;
|
|
20
20
|
--_rs-toggle-shadow:3px;
|
|
21
21
|
}
|
|
22
|
-
.
|
|
22
|
+
._sizeL_1iv0967_19{
|
|
23
23
|
--_rs-toggle-width:32px;
|
|
24
24
|
--_rs-toggle-height:18px;
|
|
25
25
|
--_rs-toggle-shadow:4px;
|
|
26
26
|
}
|
|
27
|
-
.
|
|
27
|
+
._classic_1iv0967_23{
|
|
28
28
|
--_rs-toggle-hover-slider-box-shadow-color:var(--_rs-color-primary-t-fog);
|
|
29
29
|
--_rs-toggle-checked-slider-background-color:var(--_rs-color-primary);
|
|
30
30
|
}
|
|
31
|
-
.
|
|
31
|
+
._rock_1iv0967_26{
|
|
32
32
|
--_rs-toggle-hover-slider-box-shadow-color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 0.2);
|
|
33
33
|
--_rs-toggle-checked-slider-background-color:rgb(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
|
|
34
34
|
}
|
|
35
|
-
.
|
|
35
|
+
._main_1iv0967_30{
|
|
36
36
|
--_rs-toggle-circle-border:2px;
|
|
37
37
|
|
|
38
38
|
--_rs-theme-dark:var(
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
--_rs-theme-light-coefficient:calc(1 - var(--_rs-theme-dark-coefficient));
|
|
48
48
|
}
|
|
49
49
|
@supports (color: color-mix(in srgb, #fff 50%, #000 50%)){
|
|
50
|
-
.
|
|
50
|
+
._main_1iv0967_30{
|
|
51
51
|
--_rs-color-primary:color-mix(in srgb, var(--rs-color-primary-light-theme, #6B57FF) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dark-theme, #8473FF) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
52
52
|
--_rs-color-primary-dim:color-mix(in srgb, var(--rs-color-primary-dim-light-theme, #8979ff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dim-dark-theme, #6f61d2) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
53
53
|
--_rs-color-primary-fog:color-mix(in srgb, var(--rs-color-primary-fog-light-theme, #e1ddff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-fog-dark-theme, #2e2b49) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
@supports not (color: color-mix(in srgb, #fff 50%, #000 50%)){
|
|
59
|
-
.
|
|
59
|
+
._main_1iv0967_30{
|
|
60
60
|
--_rs-color-primary:rgb(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255);
|
|
61
61
|
--_rs-color-primary-dim:rgb(calc(var(--_rs-theme-light-coefficient, 1)*137 + var(--_rs-theme-dark-coefficient, 0)*111), calc(var(--_rs-theme-light-coefficient, 1)*121 + var(--_rs-theme-dark-coefficient, 0)*97), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*210));
|
|
62
62
|
--_rs-color-primary-fog:rgb(calc(var(--_rs-theme-light-coefficient, 1)*225 + var(--_rs-theme-dark-coefficient, 0)*46), calc(var(--_rs-theme-light-coefficient, 1)*221 + var(--_rs-theme-dark-coefficient, 0)*43), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*73));
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
--_rs-color-primary-t-fog:rgba(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255, calc(var(--_rs-theme-light-coefficient, 1)*0.2 + var(--_rs-theme-dark-coefficient, 0)*0.3));
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
.
|
|
67
|
+
._main_1iv0967_30 {
|
|
68
68
|
|
|
69
69
|
position:relative;
|
|
70
70
|
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
|
|
77
77
|
cursor:pointer;
|
|
78
78
|
}
|
|
79
|
-
.
|
|
79
|
+
._main_1iv0967_30 input{
|
|
80
80
|
position:absolute;
|
|
81
81
|
z-index:-1;
|
|
82
82
|
|
|
@@ -86,11 +86,11 @@
|
|
|
86
86
|
|
|
87
87
|
pointer-events:none;
|
|
88
88
|
}
|
|
89
|
-
.
|
|
89
|
+
._main_1iv0967_30._disabled_1iv0967_57{
|
|
90
90
|
cursor:default;
|
|
91
91
|
pointer-events:none;
|
|
92
92
|
}
|
|
93
|
-
.
|
|
93
|
+
._slider_1iv0967_63{
|
|
94
94
|
position:absolute;
|
|
95
95
|
top:var(--_rs-toggle-shadow);
|
|
96
96
|
left:var(--_rs-toggle-shadow);
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
|
|
105
105
|
transition:background-color 200ms var(--rs-transition-function, ease);
|
|
106
106
|
}
|
|
107
|
-
.
|
|
107
|
+
._slider_1iv0967_63:after{
|
|
108
108
|
position:absolute;
|
|
109
109
|
top:0;
|
|
110
110
|
left:0;
|
|
@@ -123,15 +123,15 @@
|
|
|
123
123
|
transition:transform 200ms var(--rs-transition-function, ease), height 200ms var(--rs-transition-function, ease), width 200ms var(--rs-transition-function, ease), border-color 200ms var(--rs-transition-function, ease);
|
|
124
124
|
transform:translate(0);
|
|
125
125
|
}
|
|
126
|
-
.
|
|
126
|
+
._disabled_1iv0967_57 ._slider_1iv0967_63{
|
|
127
127
|
background:rgb(calc(209 - var(--_rs-theme-dark-coefficient, 0)*138), calc(209 - var(--_rs-theme-dark-coefficient, 0)*138), calc(210 - var(--_rs-theme-dark-coefficient, 0)*137));
|
|
128
128
|
}
|
|
129
|
-
.
|
|
129
|
+
._disabled_1iv0967_57 ._slider_1iv0967_63:after{
|
|
130
130
|
border-color:rgb(calc(209 - var(--_rs-theme-dark-coefficient, 0)*138), calc(209 - var(--_rs-theme-dark-coefficient, 0)*138), calc(210 - var(--_rs-theme-dark-coefficient, 0)*137));
|
|
131
131
|
|
|
132
132
|
background:rgb(calc(232 - var(--_rs-theme-dark-coefficient, 0)*184), calc(232 - var(--_rs-theme-dark-coefficient, 0)*184), calc(232 - var(--_rs-theme-dark-coefficient, 0)*181));
|
|
133
133
|
}
|
|
134
|
-
input:checked + .
|
|
134
|
+
input:checked + ._slider_1iv0967_63:after{
|
|
135
135
|
width:calc(var(--_rs-toggle-height) + var(--_rs-toggle-circle-border));
|
|
136
136
|
height:calc(var(--_rs-toggle-height) + var(--_rs-toggle-circle-border));
|
|
137
137
|
|
|
@@ -140,15 +140,15 @@ input:checked + ._slider_1yhv4j_63:after{
|
|
|
140
140
|
calc(var(--_rs-toggle-circle-border)/-2)
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
|
-
.
|
|
143
|
+
._main_1iv0967_30:not(._disabled_1iv0967_57) input:hover + ._slider_1iv0967_63{
|
|
144
144
|
box-shadow:var(--_rs-toggle-hover-slider-box-shadow-color) 0 0 0 var(--_rs-toggle-shadow);
|
|
145
145
|
}
|
|
146
|
-
.
|
|
146
|
+
._main_1iv0967_30:not(._disabled_1iv0967_57) input:checked + ._slider_1iv0967_63{
|
|
147
147
|
background-color:var(--_rs-toggle-checked-slider-background-color);
|
|
148
148
|
}
|
|
149
|
-
.
|
|
149
|
+
._main_1iv0967_30:not(._disabled_1iv0967_57) input:checked + ._slider_1iv0967_63:after{
|
|
150
150
|
border-color:var(--_rs-toggle-checked-slider-background-color);
|
|
151
151
|
}
|
|
152
|
-
.
|
|
152
|
+
._main_1iv0967_30:not(._disabled_1iv0967_57) input:focus[data-focus-method='key'] + ._slider_1iv0967_63{
|
|
153
153
|
box-shadow:0 0 0 var(--_rs-toggle-shadow) var(--_rs-color-primary-t-dim);
|
|
154
154
|
}
|
package/lib/toggle-control.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
|
|
3
|
+
import { c } from 'react-compiler-runtime';
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import cn from 'classnames';
|
|
@@ -17,40 +19,143 @@ const THEME_STYLES = {
|
|
|
17
19
|
light: styles.themeLight,
|
|
18
20
|
dark: styles.themeDark
|
|
19
21
|
};
|
|
20
|
-
const ToggleControl = /*#__PURE__*/React.forwardRef((
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
const ToggleControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
23
|
+
const $ = c(33);
|
|
24
|
+
let checked;
|
|
25
|
+
let className;
|
|
26
|
+
let defaultChecked;
|
|
27
|
+
let notUseLabelTag;
|
|
28
|
+
let onChange;
|
|
29
|
+
let restProps;
|
|
30
|
+
let t1;
|
|
31
|
+
let t2;
|
|
32
|
+
let t3;
|
|
33
|
+
let t4;
|
|
34
|
+
let themeFromProps;
|
|
35
|
+
let value;
|
|
36
|
+
|
|
37
|
+
if ($[0] !== t0) {
|
|
38
|
+
({
|
|
39
|
+
className,
|
|
40
|
+
value,
|
|
41
|
+
defaultChecked,
|
|
42
|
+
checked,
|
|
43
|
+
onChange,
|
|
44
|
+
size: t1,
|
|
45
|
+
mode: t2,
|
|
46
|
+
disabled: t3,
|
|
47
|
+
theme: themeFromProps,
|
|
48
|
+
notUseLabelTag,
|
|
49
|
+
tabIndex: t4,
|
|
50
|
+
...restProps
|
|
51
|
+
} = t0);
|
|
52
|
+
$[0] = t0;
|
|
53
|
+
$[1] = checked;
|
|
54
|
+
$[2] = className;
|
|
55
|
+
$[3] = defaultChecked;
|
|
56
|
+
$[4] = notUseLabelTag;
|
|
57
|
+
$[5] = onChange;
|
|
58
|
+
$[6] = restProps;
|
|
59
|
+
$[7] = t1;
|
|
60
|
+
$[8] = t2;
|
|
61
|
+
$[9] = t3;
|
|
62
|
+
$[10] = t4;
|
|
63
|
+
$[11] = themeFromProps;
|
|
64
|
+
$[12] = value;
|
|
65
|
+
} else {
|
|
66
|
+
checked = $[1];
|
|
67
|
+
className = $[2];
|
|
68
|
+
defaultChecked = $[3];
|
|
69
|
+
notUseLabelTag = $[4];
|
|
70
|
+
onChange = $[5];
|
|
71
|
+
restProps = $[6];
|
|
72
|
+
t1 = $[7];
|
|
73
|
+
t2 = $[8];
|
|
74
|
+
t3 = $[9];
|
|
75
|
+
t4 = $[10];
|
|
76
|
+
themeFromProps = $[11];
|
|
77
|
+
value = $[12];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const size = t1 === undefined ? "m" : t1;
|
|
81
|
+
const mode = t2 === undefined ? "classic" : t2;
|
|
82
|
+
const disabled = t3 === undefined ? false : t3;
|
|
83
|
+
const tabIndex = t4 === undefined ? 0 : t4;
|
|
35
84
|
const theme = useThemeWithUndefined(themeFromProps);
|
|
36
|
-
const RootTag = notUseLabelTag ?
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}
|
|
85
|
+
const RootTag = notUseLabelTag ? "span" : "label";
|
|
86
|
+
const t5 = SIZE_STYLES[size];
|
|
87
|
+
const t6 = MODE_STYLES[mode];
|
|
88
|
+
const t7 = THEME_STYLES[theme];
|
|
89
|
+
const t8 = disabled && styles.disabled;
|
|
90
|
+
let t9;
|
|
91
|
+
|
|
92
|
+
if ($[13] !== className || $[14] !== t5 || $[15] !== t6 || $[16] !== t7 || $[17] !== t8) {
|
|
93
|
+
t9 = cn(className, styles.main, t5, t6, t7, t8);
|
|
94
|
+
$[13] = className;
|
|
95
|
+
$[14] = t5;
|
|
96
|
+
$[15] = t6;
|
|
97
|
+
$[16] = t7;
|
|
98
|
+
$[17] = t8;
|
|
99
|
+
$[18] = t9;
|
|
100
|
+
} else {
|
|
101
|
+
t9 = $[18];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const t10 = disabled ? -1 : tabIndex;
|
|
105
|
+
let t11;
|
|
106
|
+
|
|
107
|
+
if ($[19] !== checked || $[20] !== defaultChecked || $[21] !== disabled || $[22] !== onChange || $[23] !== ref || $[24] !== restProps || $[25] !== t10 || $[26] !== value) {
|
|
108
|
+
t11 = /*#__PURE__*/React.createElement("input", _extends({
|
|
109
|
+
type: "checkbox",
|
|
110
|
+
"data-test": "toggle__input",
|
|
111
|
+
ref: ref,
|
|
112
|
+
defaultChecked: defaultChecked,
|
|
113
|
+
onChange: onChange,
|
|
114
|
+
value: value,
|
|
115
|
+
disabled: disabled,
|
|
116
|
+
checked: checked,
|
|
117
|
+
tabIndex: t10
|
|
118
|
+
}, restProps));
|
|
119
|
+
$[19] = checked;
|
|
120
|
+
$[20] = defaultChecked;
|
|
121
|
+
$[21] = disabled;
|
|
122
|
+
$[22] = onChange;
|
|
123
|
+
$[23] = ref;
|
|
124
|
+
$[24] = restProps;
|
|
125
|
+
$[25] = t10;
|
|
126
|
+
$[26] = value;
|
|
127
|
+
$[27] = t11;
|
|
128
|
+
} else {
|
|
129
|
+
t11 = $[27];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let t12;
|
|
133
|
+
|
|
134
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
135
|
+
t12 = /*#__PURE__*/React.createElement("span", {
|
|
136
|
+
className: styles.slider
|
|
137
|
+
});
|
|
138
|
+
$[28] = t12;
|
|
139
|
+
} else {
|
|
140
|
+
t12 = $[28];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let t13;
|
|
144
|
+
|
|
145
|
+
if ($[29] !== RootTag || $[30] !== t11 || $[31] !== t9) {
|
|
146
|
+
t13 = /*#__PURE__*/React.createElement(RootTag, {
|
|
147
|
+
className: t9,
|
|
148
|
+
"data-rs-internal": "toggle"
|
|
149
|
+
}, t11, t12);
|
|
150
|
+
$[29] = RootTag;
|
|
151
|
+
$[30] = t11;
|
|
152
|
+
$[31] = t9;
|
|
153
|
+
$[32] = t13;
|
|
154
|
+
} else {
|
|
155
|
+
t13 = $[32];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return t13;
|
|
54
159
|
});
|
|
55
160
|
ToggleControl.displayName = 'ToggleControl';
|
|
56
161
|
ToggleControl.propTypes = {
|
package/lib/toggle.js
CHANGED
|
@@ -1,36 +1,90 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
|
|
3
|
+
import { c } from 'react-compiler-runtime';
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import cn from 'classnames';
|
|
5
7
|
import { useThemeWithUndefined } from '@rescui/ui-contexts';
|
|
6
8
|
import { MenuItem } from '@rescui/menu';
|
|
7
9
|
import { ToggleControl } from './toggle-control.js';
|
|
8
|
-
const Toggle = /*#__PURE__*/React.forwardRef(function Toggle(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
const Toggle = /*#__PURE__*/React.forwardRef(function Toggle(t0, ref) {
|
|
11
|
+
const $ = c(34);
|
|
12
|
+
let checked;
|
|
13
|
+
let children;
|
|
14
|
+
let className;
|
|
15
|
+
let defaultChecked;
|
|
16
|
+
let onChange;
|
|
17
|
+
let restProps;
|
|
18
|
+
let t1;
|
|
19
|
+
let t2;
|
|
20
|
+
let t3;
|
|
21
|
+
let t4;
|
|
22
|
+
let themeFromProps;
|
|
23
|
+
let value;
|
|
24
|
+
|
|
25
|
+
if ($[0] !== t0) {
|
|
26
|
+
({
|
|
27
|
+
className,
|
|
28
|
+
checked,
|
|
29
|
+
defaultChecked,
|
|
30
|
+
onChange,
|
|
31
|
+
size: t1,
|
|
32
|
+
mode: t2,
|
|
33
|
+
disabled: t3,
|
|
34
|
+
theme: themeFromProps,
|
|
35
|
+
value,
|
|
36
|
+
children,
|
|
37
|
+
labelPlacement: t4,
|
|
38
|
+
...restProps
|
|
39
|
+
} = t0);
|
|
40
|
+
$[0] = t0;
|
|
41
|
+
$[1] = checked;
|
|
42
|
+
$[2] = children;
|
|
43
|
+
$[3] = className;
|
|
44
|
+
$[4] = defaultChecked;
|
|
45
|
+
$[5] = onChange;
|
|
46
|
+
$[6] = restProps;
|
|
47
|
+
$[7] = t1;
|
|
48
|
+
$[8] = t2;
|
|
49
|
+
$[9] = t3;
|
|
50
|
+
$[10] = t4;
|
|
51
|
+
$[11] = themeFromProps;
|
|
52
|
+
$[12] = value;
|
|
53
|
+
} else {
|
|
54
|
+
checked = $[1];
|
|
55
|
+
children = $[2];
|
|
56
|
+
className = $[3];
|
|
57
|
+
defaultChecked = $[4];
|
|
58
|
+
onChange = $[5];
|
|
59
|
+
restProps = $[6];
|
|
60
|
+
t1 = $[7];
|
|
61
|
+
t2 = $[8];
|
|
62
|
+
t3 = $[9];
|
|
63
|
+
t4 = $[10];
|
|
64
|
+
themeFromProps = $[11];
|
|
65
|
+
value = $[12];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const size = t1 === undefined ? "m" : t1;
|
|
69
|
+
const mode = t2 === undefined ? "classic" : t2;
|
|
70
|
+
const disabled = t3 === undefined ? false : t3;
|
|
71
|
+
const labelPlacement = t4 === undefined ? "right" : t4;
|
|
23
72
|
const theme = useThemeWithUndefined(themeFromProps);
|
|
24
|
-
const iconPlacement = labelPlacement ===
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
73
|
+
const iconPlacement = labelPlacement === "right" ? "left" : "right";
|
|
74
|
+
let t5;
|
|
75
|
+
|
|
76
|
+
if ($[13] !== className) {
|
|
77
|
+
t5 = cn(className);
|
|
78
|
+
$[13] = className;
|
|
79
|
+
$[14] = t5;
|
|
80
|
+
} else {
|
|
81
|
+
t5 = $[14];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
let t6;
|
|
85
|
+
|
|
86
|
+
if ($[15] !== checked || $[16] !== defaultChecked || $[17] !== disabled || $[18] !== mode || $[19] !== onChange || $[20] !== ref || $[21] !== restProps || $[22] !== size || $[23] !== theme || $[24] !== value) {
|
|
87
|
+
t6 = /*#__PURE__*/React.createElement(ToggleControl, _extends({
|
|
34
88
|
value: value,
|
|
35
89
|
checked: checked,
|
|
36
90
|
defaultChecked: defaultChecked,
|
|
@@ -40,12 +94,51 @@ const Toggle = /*#__PURE__*/React.forwardRef(function Toggle(_ref, ref) {
|
|
|
40
94
|
mode: mode,
|
|
41
95
|
disabled: disabled,
|
|
42
96
|
ref: ref,
|
|
43
|
-
notUseLabelTag: true
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
97
|
+
notUseLabelTag: true
|
|
98
|
+
}, restProps));
|
|
99
|
+
$[15] = checked;
|
|
100
|
+
$[16] = defaultChecked;
|
|
101
|
+
$[17] = disabled;
|
|
102
|
+
$[18] = mode;
|
|
103
|
+
$[19] = onChange;
|
|
104
|
+
$[20] = ref;
|
|
105
|
+
$[21] = restProps;
|
|
106
|
+
$[22] = size;
|
|
107
|
+
$[23] = theme;
|
|
108
|
+
$[24] = value;
|
|
109
|
+
$[25] = t6;
|
|
110
|
+
} else {
|
|
111
|
+
t6 = $[25];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
let t7;
|
|
115
|
+
|
|
116
|
+
if ($[26] !== children || $[27] !== disabled || $[28] !== iconPlacement || $[29] !== size || $[30] !== t5 || $[31] !== t6 || $[32] !== theme) {
|
|
117
|
+
t7 = /*#__PURE__*/React.createElement(MenuItem, {
|
|
118
|
+
className: t5,
|
|
119
|
+
tag: "label",
|
|
120
|
+
mode: "clear",
|
|
121
|
+
size: size,
|
|
122
|
+
theme: theme,
|
|
123
|
+
disabled: disabled,
|
|
124
|
+
tabIndex: null,
|
|
125
|
+
icon: t6,
|
|
126
|
+
iconPlacement: iconPlacement,
|
|
127
|
+
"data-test": "toggle"
|
|
128
|
+
}, children);
|
|
129
|
+
$[26] = children;
|
|
130
|
+
$[27] = disabled;
|
|
131
|
+
$[28] = iconPlacement;
|
|
132
|
+
$[29] = size;
|
|
133
|
+
$[30] = t5;
|
|
134
|
+
$[31] = t6;
|
|
135
|
+
$[32] = theme;
|
|
136
|
+
$[33] = t7;
|
|
137
|
+
} else {
|
|
138
|
+
t7 = $[33];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return t7;
|
|
49
142
|
});
|
|
50
143
|
Toggle.propTypes = {
|
|
51
144
|
children: PropTypes.node,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var styles = {
|
|
2
|
-
"themeLight": "
|
|
3
|
-
"themeDark": "
|
|
4
|
-
"sizeS": "
|
|
5
|
-
"sizeM": "
|
|
6
|
-
"sizeL": "
|
|
7
|
-
"classic": "
|
|
8
|
-
"rock": "
|
|
9
|
-
"main": "
|
|
10
|
-
"disabled": "
|
|
11
|
-
"slider": "
|
|
2
|
+
"themeLight": "_themeLight_1iv0967_6",
|
|
3
|
+
"themeDark": "_themeDark_1iv0967_9",
|
|
4
|
+
"sizeS": "_sizeS_1iv0967_13",
|
|
5
|
+
"sizeM": "_sizeM_1iv0967_16",
|
|
6
|
+
"sizeL": "_sizeL_1iv0967_19",
|
|
7
|
+
"classic": "_classic_1iv0967_23",
|
|
8
|
+
"rock": "_rock_1iv0967_26",
|
|
9
|
+
"main": "_main_1iv0967_30",
|
|
10
|
+
"disabled": "_disabled_1iv0967_57",
|
|
11
|
+
"slider": "_slider_1iv0967_63"
|
|
12
12
|
};
|
|
13
13
|
export { styles as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rescui/toggle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Toggle is a control that allows you to turn elements on and off instantly",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
@@ -17,18 +17,19 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime-corejs3": "^7.26.0",
|
|
20
|
-
"@rescui/menu": "0.
|
|
21
|
-
"classnames": "^2.2.6"
|
|
20
|
+
"@rescui/menu": "^0.15.1",
|
|
21
|
+
"classnames": "^2.2.6",
|
|
22
|
+
"react-compiler-runtime": "^1.0.0"
|
|
22
23
|
},
|
|
23
24
|
"peerDependencies": {
|
|
24
|
-
"@rescui/ui-contexts": "^0.
|
|
25
|
+
"@rescui/ui-contexts": "^0.7.0",
|
|
25
26
|
"prop-types": "^15",
|
|
26
|
-
"react": ">=
|
|
27
|
+
"react": ">=17.0.0 <20"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@rescui/colors": "0.3.4
|
|
30
|
-
"@rescui/scripts": "0.5.
|
|
31
|
-
"@rescui/visual-regression": "0.1.4",
|
|
30
|
+
"@rescui/colors": "^0.3.4",
|
|
31
|
+
"@rescui/scripts": "^0.5.3",
|
|
32
|
+
"@rescui/visual-regression": "^0.1.4",
|
|
32
33
|
"@types/classnames": "^2.2.11"
|
|
33
34
|
},
|
|
34
35
|
"scripts": {
|
|
@@ -36,5 +37,5 @@
|
|
|
36
37
|
"build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
|
|
37
38
|
},
|
|
38
39
|
"nx": {},
|
|
39
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "ce4c6c5e3fd5aede0006f6ef8e655fc0ab394c0f"
|
|
40
41
|
}
|