@khanacademy/wonder-blocks-switch 3.1.8 → 3.2.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/CHANGELOG.md +22 -0
- package/dist/components/switch.d.ts +4 -0
- package/dist/es/index.js +26 -60
- package/dist/index.js +39 -73
- package/dist/themes/default.d.ts +0 -6
- package/dist/themes/themed-switch.d.ts +0 -6
- package/package.json +4 -3
- package/dist/themes/khanmigo.d.ts +0 -69
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-switch
|
|
2
2
|
|
|
3
|
+
## 3.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [2656fd4]
|
|
8
|
+
- Updated dependencies [6018552]
|
|
9
|
+
- Updated dependencies [7bbf311]
|
|
10
|
+
- Updated dependencies [7f79943]
|
|
11
|
+
- Updated dependencies [7bbf311]
|
|
12
|
+
- Updated dependencies [7f79943]
|
|
13
|
+
- @khanacademy/wonder-blocks-tokens@9.0.0
|
|
14
|
+
- @khanacademy/wonder-blocks-theming@3.3.0
|
|
15
|
+
- @khanacademy/wonder-blocks-styles@0.2.5
|
|
16
|
+
|
|
17
|
+
## 3.2.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- fab761d: - Removes `khanmigo` theme as it is no longer used.
|
|
22
|
+
- Adds `className` prop to `Switch` component to allow custom styling of the switch in Storybook (Chromatic), and to prepare for a future CSS modules integration.
|
|
23
|
+
- Modifies the focus outline to use the global `focusStyles.focus` style from `wonder-blocks-styles`.
|
|
24
|
+
|
|
3
25
|
## 3.1.8
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -28,5 +28,9 @@ declare const Switch: React.ForwardRefExoticComponent<Pick<AriaProps, "aria-labe
|
|
|
28
28
|
* Test ID used for e2e testing.
|
|
29
29
|
*/
|
|
30
30
|
testId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Adds CSS classes to the component.
|
|
33
|
+
*/
|
|
34
|
+
className?: string;
|
|
31
35
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
32
36
|
export default Switch;
|
package/dist/es/index.js
CHANGED
|
@@ -3,12 +3,12 @@ import * as React from 'react';
|
|
|
3
3
|
import { useId } from 'react';
|
|
4
4
|
import { StyleSheet } from 'aphrodite';
|
|
5
5
|
import { addStyle, View } from '@khanacademy/wonder-blocks-core';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
6
|
+
import { createThemeContext, ThemeSwitcherContext, useScopedTheme, useStyles } from '@khanacademy/wonder-blocks-theming';
|
|
7
|
+
import { focusStyles } from '@khanacademy/wonder-blocks-styles';
|
|
8
8
|
import { semanticColor, color, border, spacing } from '@khanacademy/wonder-blocks-tokens';
|
|
9
9
|
|
|
10
10
|
const action = semanticColor.action.secondary.progressive;
|
|
11
|
-
const theme
|
|
11
|
+
const theme = {
|
|
12
12
|
color: {
|
|
13
13
|
bg: {
|
|
14
14
|
switch: {
|
|
@@ -29,9 +29,6 @@ const theme$1 = {
|
|
|
29
29
|
off: action.default.border,
|
|
30
30
|
disabledOff: semanticColor.icon.disabled
|
|
31
31
|
}
|
|
32
|
-
},
|
|
33
|
-
outline: {
|
|
34
|
-
default: semanticColor.focus.outer
|
|
35
32
|
}
|
|
36
33
|
},
|
|
37
34
|
border: {
|
|
@@ -51,9 +48,6 @@ const theme$1 = {
|
|
|
51
48
|
small: spacing.xxxxSmall_2,
|
|
52
49
|
medium: 20,
|
|
53
50
|
large: 40
|
|
54
|
-
},
|
|
55
|
-
offset: {
|
|
56
|
-
default: 1
|
|
57
51
|
}
|
|
58
52
|
},
|
|
59
53
|
spacing: {
|
|
@@ -70,44 +64,15 @@ const theme$1 = {
|
|
|
70
64
|
}
|
|
71
65
|
};
|
|
72
66
|
|
|
73
|
-
const theme = mergeTheme(theme$1, {
|
|
74
|
-
color: {
|
|
75
|
-
bg: {
|
|
76
|
-
switch: {
|
|
77
|
-
off: tokens.color.white50,
|
|
78
|
-
disabledOff: tokens.color.white32,
|
|
79
|
-
activeOff: tokens.color.white64,
|
|
80
|
-
disabledOn: tokens.color.white32,
|
|
81
|
-
on: tokens.color.white,
|
|
82
|
-
activeOn: tokens.color.offWhite
|
|
83
|
-
},
|
|
84
|
-
slider: {
|
|
85
|
-
off: tokens.color.eggplant,
|
|
86
|
-
on: tokens.color.eggplant
|
|
87
|
-
},
|
|
88
|
-
icon: {
|
|
89
|
-
on: tokens.color.white,
|
|
90
|
-
off: tokens.color.white,
|
|
91
|
-
disabledOff: tokens.color.white50,
|
|
92
|
-
disabledOn: tokens.color.white50
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
outline: {
|
|
96
|
-
default: tokens.color.white
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
67
|
const themes = {
|
|
102
|
-
default: theme
|
|
103
|
-
khanmigo: theme
|
|
68
|
+
default: theme
|
|
104
69
|
};
|
|
105
|
-
const SwitchThemeContext = createThemeContext(theme
|
|
70
|
+
const SwitchThemeContext = createThemeContext(theme);
|
|
106
71
|
function ThemedSwitch(props) {
|
|
107
72
|
const currentTheme = React.useContext(ThemeSwitcherContext);
|
|
108
|
-
const theme = themes[currentTheme] || theme
|
|
73
|
+
const theme$1 = themes[currentTheme] || theme;
|
|
109
74
|
return React.createElement(SwitchThemeContext.Provider, {
|
|
110
|
-
value: theme
|
|
75
|
+
value: theme$1
|
|
111
76
|
}, props.children);
|
|
112
77
|
}
|
|
113
78
|
|
|
@@ -119,6 +84,7 @@ const SwitchCore = React.forwardRef(function SwitchCore(props, ref) {
|
|
|
119
84
|
"aria-labelledby": ariaLabelledBy,
|
|
120
85
|
"aria-describedby": ariaDescribedBy,
|
|
121
86
|
checked,
|
|
87
|
+
className,
|
|
122
88
|
disabled = false,
|
|
123
89
|
icon,
|
|
124
90
|
id,
|
|
@@ -150,6 +116,7 @@ const SwitchCore = React.forwardRef(function SwitchCore(props, ref) {
|
|
|
150
116
|
return React.createElement(View, {
|
|
151
117
|
onClick: handleClick,
|
|
152
118
|
style: [sharedStyles.switch, stateStyles.switch, disabled && sharedStyles.disabled],
|
|
119
|
+
className: className,
|
|
153
120
|
testId: testId
|
|
154
121
|
}, React.createElement(StyledInput, {
|
|
155
122
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -179,23 +146,17 @@ const themedSharedStyles = theme => ({
|
|
|
179
146
|
width: theme.size.width.large,
|
|
180
147
|
borderRadius: theme.border.radius.small,
|
|
181
148
|
flexShrink: 0,
|
|
182
|
-
":
|
|
183
|
-
outlineOffset: theme.size.offset.default
|
|
184
|
-
},
|
|
185
|
-
":focus-within": {
|
|
186
|
-
outline: `solid ${theme.size.width.small}px ${theme.color.outline.default}`,
|
|
187
|
-
outlineOffset: theme.size.offset.default
|
|
188
|
-
}
|
|
149
|
+
":focus-within": focusStyles.focus[":focus-visible"]
|
|
189
150
|
},
|
|
190
151
|
disabled: {
|
|
191
152
|
cursor: "not-allowed",
|
|
192
153
|
":hover": {
|
|
193
154
|
outline: "none"
|
|
194
155
|
},
|
|
195
|
-
":
|
|
196
|
-
outline:
|
|
197
|
-
|
|
198
|
-
|
|
156
|
+
":active": {
|
|
157
|
+
outline: "none"
|
|
158
|
+
},
|
|
159
|
+
":focus-within": focusStyles.focus[":focus-visible"]
|
|
199
160
|
},
|
|
200
161
|
slider: {
|
|
201
162
|
position: "absolute",
|
|
@@ -215,6 +176,7 @@ const themedSharedStyles = theme => ({
|
|
|
215
176
|
transition: theme.spacing.transform.transition
|
|
216
177
|
}
|
|
217
178
|
});
|
|
179
|
+
const focusStylesObject = focusStyles.focus[":focus-visible"];
|
|
218
180
|
const styles = {};
|
|
219
181
|
const _generateStyles = (checked, clickable, disabled, theme, themeName) => {
|
|
220
182
|
const checkedStyle = `${checked}-${clickable}-${disabled}-${themeName}`;
|
|
@@ -224,17 +186,19 @@ const _generateStyles = (checked, clickable, disabled, theme, themeName) => {
|
|
|
224
186
|
let newStyles = {};
|
|
225
187
|
const sharedSwitchStyles = {
|
|
226
188
|
cursor: clickable ? "pointer" : "auto",
|
|
227
|
-
":hover": {
|
|
228
|
-
outline: clickable ?
|
|
229
|
-
}
|
|
189
|
+
":hover": _extends({}, focusStylesObject, {
|
|
190
|
+
outline: clickable ? focusStylesObject.outline : "none"
|
|
191
|
+
})
|
|
230
192
|
};
|
|
231
193
|
if (checked) {
|
|
232
194
|
newStyles = {
|
|
233
195
|
switch: _extends({
|
|
234
196
|
backgroundColor: disabled ? theme.color.bg.switch.disabledOn : theme.color.bg.switch.on,
|
|
235
|
-
":active": {
|
|
197
|
+
":active": _extends({
|
|
236
198
|
backgroundColor: !disabled && clickable ? theme.color.bg.switch.activeOn : undefined
|
|
237
|
-
}
|
|
199
|
+
}, focusStylesObject, {
|
|
200
|
+
outline: clickable ? focusStylesObject.outline : "none"
|
|
201
|
+
})
|
|
238
202
|
}, sharedSwitchStyles),
|
|
239
203
|
slider: {
|
|
240
204
|
transform: theme.spacing.transform.default
|
|
@@ -248,9 +212,11 @@ const _generateStyles = (checked, clickable, disabled, theme, themeName) => {
|
|
|
248
212
|
newStyles = {
|
|
249
213
|
switch: _extends({
|
|
250
214
|
backgroundColor: disabled ? theme.color.bg.switch.disabledOff : theme.color.bg.switch.off,
|
|
251
|
-
":active": {
|
|
215
|
+
":active": _extends({
|
|
252
216
|
backgroundColor: !disabled && clickable ? theme.color.bg.switch.activeOff : undefined
|
|
253
|
-
}
|
|
217
|
+
}, focusStylesObject, {
|
|
218
|
+
outline: clickable ? focusStylesObject.outline : "none"
|
|
219
|
+
})
|
|
254
220
|
}, sharedSwitchStyles),
|
|
255
221
|
slider: {
|
|
256
222
|
backgroundColor: theme.color.bg.slider.off
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,8 @@ var React = require('react');
|
|
|
5
5
|
var aphrodite = require('aphrodite');
|
|
6
6
|
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
7
7
|
var wonderBlocksTheming = require('@khanacademy/wonder-blocks-theming');
|
|
8
|
-
var
|
|
8
|
+
var wonderBlocksStyles = require('@khanacademy/wonder-blocks-styles');
|
|
9
|
+
var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
12
|
|
|
@@ -29,109 +30,73 @@ function _interopNamespace(e) {
|
|
|
29
30
|
|
|
30
31
|
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
31
32
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
32
|
-
var tokens__namespace = /*#__PURE__*/_interopNamespace(tokens);
|
|
33
33
|
|
|
34
|
-
const action =
|
|
35
|
-
const theme
|
|
34
|
+
const action = wonderBlocksTokens.semanticColor.action.secondary.progressive;
|
|
35
|
+
const theme = {
|
|
36
36
|
color: {
|
|
37
37
|
bg: {
|
|
38
38
|
switch: {
|
|
39
39
|
off: action.default.border,
|
|
40
|
-
disabledOff:
|
|
41
|
-
activeOff:
|
|
40
|
+
disabledOff: wonderBlocksTokens.semanticColor.action.primary.disabled.background,
|
|
41
|
+
activeOff: wonderBlocksTokens.color.fadedOffBlack64,
|
|
42
42
|
on: action.default.foreground,
|
|
43
43
|
disabledOn: action.press.background,
|
|
44
44
|
activeOn: action.press.foreground
|
|
45
45
|
},
|
|
46
46
|
slider: {
|
|
47
|
-
on:
|
|
48
|
-
off:
|
|
47
|
+
on: wonderBlocksTokens.semanticColor.icon.inverse,
|
|
48
|
+
off: wonderBlocksTokens.semanticColor.icon.inverse
|
|
49
49
|
},
|
|
50
50
|
icon: {
|
|
51
51
|
on: action.default.foreground,
|
|
52
52
|
disabledOn: action.press.background,
|
|
53
53
|
off: action.default.border,
|
|
54
|
-
disabledOff:
|
|
54
|
+
disabledOff: wonderBlocksTokens.semanticColor.icon.disabled
|
|
55
55
|
}
|
|
56
|
-
},
|
|
57
|
-
outline: {
|
|
58
|
-
default: tokens.semanticColor.focus.outer
|
|
59
56
|
}
|
|
60
57
|
},
|
|
61
58
|
border: {
|
|
62
59
|
radius: {
|
|
63
|
-
small:
|
|
64
|
-
full:
|
|
60
|
+
small: wonderBlocksTokens.border.radius.radius_120,
|
|
61
|
+
full: wonderBlocksTokens.border.radius.radius_full
|
|
65
62
|
}
|
|
66
63
|
},
|
|
67
64
|
size: {
|
|
68
65
|
height: {
|
|
69
66
|
none: 0,
|
|
70
67
|
medium: 20,
|
|
71
|
-
large:
|
|
68
|
+
large: wonderBlocksTokens.spacing.large_24
|
|
72
69
|
},
|
|
73
70
|
width: {
|
|
74
71
|
none: 0,
|
|
75
|
-
small:
|
|
72
|
+
small: wonderBlocksTokens.spacing.xxxxSmall_2,
|
|
76
73
|
medium: 20,
|
|
77
74
|
large: 40
|
|
78
|
-
},
|
|
79
|
-
offset: {
|
|
80
|
-
default: 1
|
|
81
75
|
}
|
|
82
76
|
},
|
|
83
77
|
spacing: {
|
|
84
78
|
slider: {
|
|
85
|
-
position:
|
|
79
|
+
position: wonderBlocksTokens.spacing.xxxxSmall_2
|
|
86
80
|
},
|
|
87
81
|
icon: {
|
|
88
|
-
position:
|
|
82
|
+
position: wonderBlocksTokens.spacing.xxxSmall_4
|
|
89
83
|
},
|
|
90
84
|
transform: {
|
|
91
|
-
default: `translateX(${
|
|
85
|
+
default: `translateX(${wonderBlocksTokens.spacing.medium_16}px)`,
|
|
92
86
|
transition: "transform 0.15s ease-in-out"
|
|
93
87
|
}
|
|
94
88
|
}
|
|
95
89
|
};
|
|
96
90
|
|
|
97
|
-
const theme = wonderBlocksTheming.mergeTheme(theme$1, {
|
|
98
|
-
color: {
|
|
99
|
-
bg: {
|
|
100
|
-
switch: {
|
|
101
|
-
off: tokens__namespace.color.white50,
|
|
102
|
-
disabledOff: tokens__namespace.color.white32,
|
|
103
|
-
activeOff: tokens__namespace.color.white64,
|
|
104
|
-
disabledOn: tokens__namespace.color.white32,
|
|
105
|
-
on: tokens__namespace.color.white,
|
|
106
|
-
activeOn: tokens__namespace.color.offWhite
|
|
107
|
-
},
|
|
108
|
-
slider: {
|
|
109
|
-
off: tokens__namespace.color.eggplant,
|
|
110
|
-
on: tokens__namespace.color.eggplant
|
|
111
|
-
},
|
|
112
|
-
icon: {
|
|
113
|
-
on: tokens__namespace.color.white,
|
|
114
|
-
off: tokens__namespace.color.white,
|
|
115
|
-
disabledOff: tokens__namespace.color.white50,
|
|
116
|
-
disabledOn: tokens__namespace.color.white50
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
outline: {
|
|
120
|
-
default: tokens__namespace.color.white
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
91
|
const themes = {
|
|
126
|
-
default: theme
|
|
127
|
-
khanmigo: theme
|
|
92
|
+
default: theme
|
|
128
93
|
};
|
|
129
|
-
const SwitchThemeContext = wonderBlocksTheming.createThemeContext(theme
|
|
94
|
+
const SwitchThemeContext = wonderBlocksTheming.createThemeContext(theme);
|
|
130
95
|
function ThemedSwitch(props) {
|
|
131
96
|
const currentTheme = React__namespace.useContext(wonderBlocksTheming.ThemeSwitcherContext);
|
|
132
|
-
const theme = themes[currentTheme] || theme
|
|
97
|
+
const theme$1 = themes[currentTheme] || theme;
|
|
133
98
|
return React__namespace.createElement(SwitchThemeContext.Provider, {
|
|
134
|
-
value: theme
|
|
99
|
+
value: theme$1
|
|
135
100
|
}, props.children);
|
|
136
101
|
}
|
|
137
102
|
|
|
@@ -143,6 +108,7 @@ const SwitchCore = React__namespace.forwardRef(function SwitchCore(props, ref) {
|
|
|
143
108
|
"aria-labelledby": ariaLabelledBy,
|
|
144
109
|
"aria-describedby": ariaDescribedBy,
|
|
145
110
|
checked,
|
|
111
|
+
className,
|
|
146
112
|
disabled = false,
|
|
147
113
|
icon,
|
|
148
114
|
id,
|
|
@@ -174,6 +140,7 @@ const SwitchCore = React__namespace.forwardRef(function SwitchCore(props, ref) {
|
|
|
174
140
|
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
175
141
|
onClick: handleClick,
|
|
176
142
|
style: [sharedStyles.switch, stateStyles.switch, disabled && sharedStyles.disabled],
|
|
143
|
+
className: className,
|
|
177
144
|
testId: testId
|
|
178
145
|
}, React__namespace.createElement(StyledInput, {
|
|
179
146
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -203,23 +170,17 @@ const themedSharedStyles = theme => ({
|
|
|
203
170
|
width: theme.size.width.large,
|
|
204
171
|
borderRadius: theme.border.radius.small,
|
|
205
172
|
flexShrink: 0,
|
|
206
|
-
":
|
|
207
|
-
outlineOffset: theme.size.offset.default
|
|
208
|
-
},
|
|
209
|
-
":focus-within": {
|
|
210
|
-
outline: `solid ${theme.size.width.small}px ${theme.color.outline.default}`,
|
|
211
|
-
outlineOffset: theme.size.offset.default
|
|
212
|
-
}
|
|
173
|
+
":focus-within": wonderBlocksStyles.focusStyles.focus[":focus-visible"]
|
|
213
174
|
},
|
|
214
175
|
disabled: {
|
|
215
176
|
cursor: "not-allowed",
|
|
216
177
|
":hover": {
|
|
217
178
|
outline: "none"
|
|
218
179
|
},
|
|
219
|
-
":
|
|
220
|
-
outline:
|
|
221
|
-
|
|
222
|
-
|
|
180
|
+
":active": {
|
|
181
|
+
outline: "none"
|
|
182
|
+
},
|
|
183
|
+
":focus-within": wonderBlocksStyles.focusStyles.focus[":focus-visible"]
|
|
223
184
|
},
|
|
224
185
|
slider: {
|
|
225
186
|
position: "absolute",
|
|
@@ -239,6 +200,7 @@ const themedSharedStyles = theme => ({
|
|
|
239
200
|
transition: theme.spacing.transform.transition
|
|
240
201
|
}
|
|
241
202
|
});
|
|
203
|
+
const focusStylesObject = wonderBlocksStyles.focusStyles.focus[":focus-visible"];
|
|
242
204
|
const styles = {};
|
|
243
205
|
const _generateStyles = (checked, clickable, disabled, theme, themeName) => {
|
|
244
206
|
const checkedStyle = `${checked}-${clickable}-${disabled}-${themeName}`;
|
|
@@ -248,17 +210,19 @@ const _generateStyles = (checked, clickable, disabled, theme, themeName) => {
|
|
|
248
210
|
let newStyles = {};
|
|
249
211
|
const sharedSwitchStyles = {
|
|
250
212
|
cursor: clickable ? "pointer" : "auto",
|
|
251
|
-
":hover": {
|
|
252
|
-
outline: clickable ?
|
|
253
|
-
}
|
|
213
|
+
":hover": _extends__default["default"]({}, focusStylesObject, {
|
|
214
|
+
outline: clickable ? focusStylesObject.outline : "none"
|
|
215
|
+
})
|
|
254
216
|
};
|
|
255
217
|
if (checked) {
|
|
256
218
|
newStyles = {
|
|
257
219
|
switch: _extends__default["default"]({
|
|
258
220
|
backgroundColor: disabled ? theme.color.bg.switch.disabledOn : theme.color.bg.switch.on,
|
|
259
|
-
":active": {
|
|
221
|
+
":active": _extends__default["default"]({
|
|
260
222
|
backgroundColor: !disabled && clickable ? theme.color.bg.switch.activeOn : undefined
|
|
261
|
-
}
|
|
223
|
+
}, focusStylesObject, {
|
|
224
|
+
outline: clickable ? focusStylesObject.outline : "none"
|
|
225
|
+
})
|
|
262
226
|
}, sharedSwitchStyles),
|
|
263
227
|
slider: {
|
|
264
228
|
transform: theme.spacing.transform.default
|
|
@@ -272,9 +236,11 @@ const _generateStyles = (checked, clickable, disabled, theme, themeName) => {
|
|
|
272
236
|
newStyles = {
|
|
273
237
|
switch: _extends__default["default"]({
|
|
274
238
|
backgroundColor: disabled ? theme.color.bg.switch.disabledOff : theme.color.bg.switch.off,
|
|
275
|
-
":active": {
|
|
239
|
+
":active": _extends__default["default"]({
|
|
276
240
|
backgroundColor: !disabled && clickable ? theme.color.bg.switch.activeOff : undefined
|
|
277
|
-
}
|
|
241
|
+
}, focusStylesObject, {
|
|
242
|
+
outline: clickable ? focusStylesObject.outline : "none"
|
|
243
|
+
})
|
|
278
244
|
}, sharedSwitchStyles),
|
|
279
245
|
slider: {
|
|
280
246
|
backgroundColor: theme.color.bg.slider.off
|
package/dist/themes/default.d.ts
CHANGED
|
@@ -20,9 +20,6 @@ declare const theme: {
|
|
|
20
20
|
disabledOff: string;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
outline: {
|
|
24
|
-
default: string;
|
|
25
|
-
};
|
|
26
23
|
};
|
|
27
24
|
border: {
|
|
28
25
|
radius: {
|
|
@@ -42,9 +39,6 @@ declare const theme: {
|
|
|
42
39
|
medium: number;
|
|
43
40
|
large: number;
|
|
44
41
|
};
|
|
45
|
-
offset: {
|
|
46
|
-
default: number;
|
|
47
|
-
};
|
|
48
42
|
};
|
|
49
43
|
spacing: {
|
|
50
44
|
slider: {
|
|
@@ -30,9 +30,6 @@ export declare const SwitchThemeContext: React.Context<{
|
|
|
30
30
|
disabledOff: string;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
outline: {
|
|
34
|
-
default: string;
|
|
35
|
-
};
|
|
36
33
|
};
|
|
37
34
|
border: {
|
|
38
35
|
radius: {
|
|
@@ -52,9 +49,6 @@ export declare const SwitchThemeContext: React.Context<{
|
|
|
52
49
|
medium: number;
|
|
53
50
|
large: number;
|
|
54
51
|
};
|
|
55
|
-
offset: {
|
|
56
|
-
default: number;
|
|
57
|
-
};
|
|
58
52
|
};
|
|
59
53
|
spacing: {
|
|
60
54
|
slider: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-switch",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"description": "Switch components for Wonder Blocks.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
"@babel/runtime": "^7.24.5",
|
|
16
16
|
"@khanacademy/wonder-blocks-core": "12.2.1",
|
|
17
17
|
"@khanacademy/wonder-blocks-icon": "5.1.3",
|
|
18
|
-
"@khanacademy/wonder-blocks-
|
|
19
|
-
"@khanacademy/wonder-blocks-
|
|
18
|
+
"@khanacademy/wonder-blocks-styles": "0.2.5",
|
|
19
|
+
"@khanacademy/wonder-blocks-theming": "3.3.0",
|
|
20
|
+
"@khanacademy/wonder-blocks-tokens": "9.0.0"
|
|
20
21
|
},
|
|
21
22
|
"peerDependencies": {
|
|
22
23
|
"aphrodite": "^1.2.5",
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The overrides for khanmigo theme for a switch.
|
|
3
|
-
*
|
|
4
|
-
* NOTE: Leaving `color` tokens as is for now, as this theme is not currently
|
|
5
|
-
* used in webapp. Also, this most likely change once we migrate to the new
|
|
6
|
-
* theme.
|
|
7
|
-
*/
|
|
8
|
-
declare const theme: {
|
|
9
|
-
color: {
|
|
10
|
-
bg: {
|
|
11
|
-
switch: {
|
|
12
|
-
off: string;
|
|
13
|
-
disabledOff: string;
|
|
14
|
-
activeOff: string;
|
|
15
|
-
on: string;
|
|
16
|
-
disabledOn: string;
|
|
17
|
-
activeOn: string;
|
|
18
|
-
};
|
|
19
|
-
slider: {
|
|
20
|
-
on: string;
|
|
21
|
-
off: string;
|
|
22
|
-
};
|
|
23
|
-
icon: {
|
|
24
|
-
on: string;
|
|
25
|
-
disabledOn: string;
|
|
26
|
-
off: string;
|
|
27
|
-
disabledOff: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
outline: {
|
|
31
|
-
default: string;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
border: {
|
|
35
|
-
radius: {
|
|
36
|
-
small: string;
|
|
37
|
-
full: string;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
size: {
|
|
41
|
-
height: {
|
|
42
|
-
none: number;
|
|
43
|
-
medium: number;
|
|
44
|
-
large: 24;
|
|
45
|
-
};
|
|
46
|
-
width: {
|
|
47
|
-
none: number;
|
|
48
|
-
small: 2;
|
|
49
|
-
medium: number;
|
|
50
|
-
large: number;
|
|
51
|
-
};
|
|
52
|
-
offset: {
|
|
53
|
-
default: number;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
spacing: {
|
|
57
|
-
slider: {
|
|
58
|
-
position: 2;
|
|
59
|
-
};
|
|
60
|
-
icon: {
|
|
61
|
-
position: 4;
|
|
62
|
-
};
|
|
63
|
-
transform: {
|
|
64
|
-
default: string;
|
|
65
|
-
transition: string;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
export default theme;
|