@khanacademy/wonder-blocks-button 4.1.8 → 4.2.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/CHANGELOG.md +17 -0
- package/dist/es/index.js +201 -66
- package/dist/index.js +201 -68
- package/dist/themes/default.d.ts +112 -0
- package/dist/themes/khanmigo.d.ts +97 -0
- package/dist/themes/themed-button.d.ts +108 -0
- package/package.json +6 -6
- package/src/__tests__/__snapshots__/custom-snapshot.test.tsx.snap +180 -180
- package/src/components/button-core.tsx +126 -71
- package/src/components/button.tsx +6 -3
- package/src/themes/default.ts +133 -0
- package/src/themes/khanmigo.ts +35 -0
- package/src/themes/themed-button.tsx +42 -0
- package/tsconfig-build.json +1 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -6,11 +6,10 @@ var wonderBlocksClickable = require('@khanacademy/wonder-blocks-clickable');
|
|
|
6
6
|
var aphrodite = require('aphrodite');
|
|
7
7
|
var reactRouterDom = require('react-router-dom');
|
|
8
8
|
var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
|
|
9
|
-
var Color = require('@khanacademy/wonder-blocks-color');
|
|
10
9
|
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
11
10
|
var wonderBlocksProgressSpinner = require('@khanacademy/wonder-blocks-progress-spinner');
|
|
12
11
|
var Icon = require('@khanacademy/wonder-blocks-icon');
|
|
13
|
-
var
|
|
12
|
+
var wonderBlocksTheming = require('@khanacademy/wonder-blocks-theming');
|
|
14
13
|
|
|
15
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
15
|
|
|
@@ -33,9 +32,7 @@ function _interopNamespace(e) {
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
36
|
-
var Color__default = /*#__PURE__*/_interopDefaultLegacy(Color);
|
|
37
35
|
var Icon__default = /*#__PURE__*/_interopDefaultLegacy(Icon);
|
|
38
|
-
var Spacing__default = /*#__PURE__*/_interopDefaultLegacy(Spacing);
|
|
39
36
|
|
|
40
37
|
function _extends() {
|
|
41
38
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -65,11 +62,151 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
65
62
|
return target;
|
|
66
63
|
}
|
|
67
64
|
|
|
65
|
+
const theme$1 = {
|
|
66
|
+
color: {
|
|
67
|
+
bg: {
|
|
68
|
+
action: {
|
|
69
|
+
default: wonderBlocksTheming.tokens.color.blue,
|
|
70
|
+
active: wonderBlocksTheming.tokens.color.activeBlue,
|
|
71
|
+
inverse: wonderBlocksTheming.tokens.color.fadedBlue
|
|
72
|
+
},
|
|
73
|
+
critical: {
|
|
74
|
+
default: wonderBlocksTheming.tokens.color.red,
|
|
75
|
+
active: wonderBlocksTheming.tokens.color.activeRed,
|
|
76
|
+
inverse: wonderBlocksTheming.tokens.color.fadedRed
|
|
77
|
+
},
|
|
78
|
+
primary: {
|
|
79
|
+
default: wonderBlocksTheming.tokens.color.white,
|
|
80
|
+
disabled: wonderBlocksTheming.tokens.color.offBlack32,
|
|
81
|
+
inverse: wonderBlocksTheming.tokens.color.darkBlue
|
|
82
|
+
},
|
|
83
|
+
secondary: {
|
|
84
|
+
default: "none",
|
|
85
|
+
inverse: "none",
|
|
86
|
+
focus: wonderBlocksTheming.tokens.color.white,
|
|
87
|
+
active: wonderBlocksTheming.tokens.color.fadedBlue
|
|
88
|
+
},
|
|
89
|
+
tertiary: {
|
|
90
|
+
hover: wonderBlocksTheming.tokens.color.white
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
text: {
|
|
94
|
+
disabled: wonderBlocksTheming.tokens.color.offBlack32,
|
|
95
|
+
inverse: wonderBlocksTheming.tokens.color.white,
|
|
96
|
+
primary: {
|
|
97
|
+
disabled: wonderBlocksTheming.tokens.color.white64
|
|
98
|
+
},
|
|
99
|
+
secondary: {
|
|
100
|
+
inverse: wonderBlocksTheming.tokens.color.white50
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
border: {
|
|
104
|
+
disabled: wonderBlocksTheming.tokens.color.offBlack32,
|
|
105
|
+
primary: {
|
|
106
|
+
inverse: wonderBlocksTheming.tokens.color.white
|
|
107
|
+
},
|
|
108
|
+
secondary: {
|
|
109
|
+
action: wonderBlocksTheming.tokens.color.offBlack50,
|
|
110
|
+
critical: wonderBlocksTheming.tokens.color.offBlack50,
|
|
111
|
+
inverse: wonderBlocksTheming.tokens.color.white50
|
|
112
|
+
},
|
|
113
|
+
tertiary: {
|
|
114
|
+
inverse: wonderBlocksTheming.tokens.color.white
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
border: {
|
|
119
|
+
width: {
|
|
120
|
+
secondary: wonderBlocksTheming.tokens.border.width.hairline,
|
|
121
|
+
focused: wonderBlocksTheming.tokens.border.width.thin,
|
|
122
|
+
disabled: wonderBlocksTheming.tokens.border.width.thin
|
|
123
|
+
},
|
|
124
|
+
radius: {
|
|
125
|
+
default: wonderBlocksTheming.tokens.border.radius.small_3,
|
|
126
|
+
tertiary: wonderBlocksTheming.tokens.border.radius.xSmall_2,
|
|
127
|
+
small: wonderBlocksTheming.tokens.border.radius.small_3,
|
|
128
|
+
large: wonderBlocksTheming.tokens.border.radius.large_6
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
size: {
|
|
132
|
+
width: {
|
|
133
|
+
medium: wonderBlocksTheming.tokens.spacing.large_24,
|
|
134
|
+
large: wonderBlocksTheming.tokens.spacing.xLarge_32
|
|
135
|
+
},
|
|
136
|
+
height: {
|
|
137
|
+
tertiaryHover: wonderBlocksTheming.tokens.spacing.xxxxSmall_2,
|
|
138
|
+
small: wonderBlocksTheming.tokens.spacing.xLarge_32,
|
|
139
|
+
medium: 40,
|
|
140
|
+
large: 56
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
padding: {
|
|
144
|
+
small: wonderBlocksTheming.tokens.spacing.xSmall_8,
|
|
145
|
+
medium: wonderBlocksTheming.tokens.spacing.small_12,
|
|
146
|
+
large: wonderBlocksTheming.tokens.spacing.medium_16,
|
|
147
|
+
xLarge: wonderBlocksTheming.tokens.spacing.xLarge_32
|
|
148
|
+
},
|
|
149
|
+
font: {
|
|
150
|
+
size: {
|
|
151
|
+
large: 18
|
|
152
|
+
},
|
|
153
|
+
lineHeight: {
|
|
154
|
+
large: wonderBlocksTheming.tokens.font.lineHeight.medium
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const theme = wonderBlocksTheming.mergeTheme(theme$1, {
|
|
160
|
+
color: {
|
|
161
|
+
bg: {
|
|
162
|
+
secondary: {
|
|
163
|
+
default: wonderBlocksTheming.tokens.color.offWhite,
|
|
164
|
+
active: wonderBlocksTheming.tokens.color.fadedBlue8,
|
|
165
|
+
focus: wonderBlocksTheming.tokens.color.offWhite
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
border: {
|
|
169
|
+
secondary: {
|
|
170
|
+
action: wonderBlocksTheming.tokens.color.fadedBlue,
|
|
171
|
+
critical: wonderBlocksTheming.tokens.color.fadedRed
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
border: {
|
|
176
|
+
radius: {
|
|
177
|
+
default: wonderBlocksTheming.tokens.border.radius.xLarge_12,
|
|
178
|
+
small: wonderBlocksTheming.tokens.border.radius.large_6,
|
|
179
|
+
large: wonderBlocksTheming.tokens.border.radius.xLarge_12
|
|
180
|
+
},
|
|
181
|
+
width: {
|
|
182
|
+
focused: wonderBlocksTheming.tokens.border.width.hairline
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
const themes = {
|
|
188
|
+
default: theme$1,
|
|
189
|
+
khanmigo: theme
|
|
190
|
+
};
|
|
191
|
+
const ButtonThemeContext = wonderBlocksTheming.createThemeContext(theme$1);
|
|
192
|
+
function ThemedButton(props) {
|
|
193
|
+
const currentTheme = React__namespace.useContext(wonderBlocksTheming.ThemeSwitcherContext);
|
|
194
|
+
const theme = themes[currentTheme] || theme$1;
|
|
195
|
+
return React__namespace.createElement(ButtonThemeContext.Provider, {
|
|
196
|
+
value: theme
|
|
197
|
+
}, props.children);
|
|
198
|
+
}
|
|
199
|
+
|
|
68
200
|
const _excluded$1 = ["children", "skipClientNav", "color", "disabled", "focused", "hovered", "href", "kind", "light", "pressed", "size", "style", "testId", "type", "spinner", "icon", "id", "waiting"];
|
|
69
201
|
const StyledAnchor = wonderBlocksCore.addStyle("a");
|
|
70
202
|
const StyledButton = wonderBlocksCore.addStyle("button");
|
|
71
203
|
const StyledLink = wonderBlocksCore.addStyle(reactRouterDom.Link);
|
|
72
204
|
const ButtonCore = React__namespace.forwardRef(function ButtonCore(props, ref) {
|
|
205
|
+
const {
|
|
206
|
+
theme,
|
|
207
|
+
themeName
|
|
208
|
+
} = wonderBlocksTheming.useScopedTheme(ButtonThemeContext);
|
|
209
|
+
const sharedStyles = wonderBlocksTheming.useStyles(themedSharedStyles, theme);
|
|
73
210
|
const renderInner = router => {
|
|
74
211
|
const {
|
|
75
212
|
children,
|
|
@@ -91,9 +228,8 @@ const ButtonCore = React__namespace.forwardRef(function ButtonCore(props, ref) {
|
|
|
91
228
|
id
|
|
92
229
|
} = props,
|
|
93
230
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
const buttonStyles = _generateStyles(buttonColor, kind, light, iconWidth, size);
|
|
231
|
+
const iconWidth = icon ? size === "small" ? theme.size.width.medium : theme.size.width.large : 0;
|
|
232
|
+
const buttonStyles = _generateStyles(color, kind, light, iconWidth, size, theme, themeName);
|
|
97
233
|
const disabled = spinner || disabledProp;
|
|
98
234
|
const defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, icon && sharedStyles.withIcon, buttonStyles.default, disabled && buttonStyles.disabled, kind !== "tertiary" && !disabled && (pressed ? buttonStyles.active : (hovered || focused) && buttonStyles.focus), kind === "tertiary" && !pressed && focused && [buttonStyles.focus, disabled && buttonStyles.disabledFocus], size === "small" && sharedStyles.small, size === "large" && sharedStyles.large];
|
|
99
235
|
const commonProps = _extends({
|
|
@@ -145,19 +281,19 @@ const ButtonCore = React__namespace.forwardRef(function ButtonCore(props, ref) {
|
|
|
145
281
|
};
|
|
146
282
|
return React__namespace.createElement(reactRouter.__RouterContext.Consumer, null, router => renderInner(router));
|
|
147
283
|
});
|
|
148
|
-
const
|
|
284
|
+
const themedSharedStyles = theme => ({
|
|
149
285
|
shared: {
|
|
150
286
|
position: "relative",
|
|
151
287
|
display: "inline-flex",
|
|
152
288
|
alignItems: "center",
|
|
153
289
|
justifyContent: "center",
|
|
154
|
-
height:
|
|
290
|
+
height: theme.size.height.medium,
|
|
155
291
|
paddingTop: 0,
|
|
156
292
|
paddingBottom: 0,
|
|
157
|
-
paddingLeft:
|
|
158
|
-
paddingRight:
|
|
293
|
+
paddingLeft: theme.padding.large,
|
|
294
|
+
paddingRight: theme.padding.large,
|
|
159
295
|
border: "none",
|
|
160
|
-
borderRadius:
|
|
296
|
+
borderRadius: theme.border.radius.default,
|
|
161
297
|
cursor: "pointer",
|
|
162
298
|
outline: "none",
|
|
163
299
|
textDecoration: "none",
|
|
@@ -169,17 +305,18 @@ const sharedStyles = aphrodite.StyleSheet.create({
|
|
|
169
305
|
}
|
|
170
306
|
},
|
|
171
307
|
withIcon: {
|
|
172
|
-
paddingLeft:
|
|
308
|
+
paddingLeft: theme.padding.medium
|
|
173
309
|
},
|
|
174
310
|
disabled: {
|
|
175
311
|
cursor: "auto"
|
|
176
312
|
},
|
|
177
313
|
small: {
|
|
178
|
-
|
|
314
|
+
borderRadius: theme.border.radius.small,
|
|
315
|
+
height: theme.size.height.small
|
|
179
316
|
},
|
|
180
317
|
large: {
|
|
181
|
-
borderRadius:
|
|
182
|
-
height:
|
|
318
|
+
borderRadius: theme.border.radius.large,
|
|
319
|
+
height: theme.size.height.large
|
|
183
320
|
},
|
|
184
321
|
text: {
|
|
185
322
|
alignItems: "center",
|
|
@@ -191,8 +328,8 @@ const sharedStyles = aphrodite.StyleSheet.create({
|
|
|
191
328
|
pointerEvents: "none"
|
|
192
329
|
},
|
|
193
330
|
largeText: {
|
|
194
|
-
fontSize:
|
|
195
|
-
lineHeight:
|
|
331
|
+
fontSize: theme.font.size.large,
|
|
332
|
+
lineHeight: theme.font.lineHeight.large
|
|
196
333
|
},
|
|
197
334
|
textWithFocus: {
|
|
198
335
|
position: "relative"
|
|
@@ -204,85 +341,81 @@ const sharedStyles = aphrodite.StyleSheet.create({
|
|
|
204
341
|
position: "absolute"
|
|
205
342
|
},
|
|
206
343
|
icon: {
|
|
207
|
-
paddingRight:
|
|
344
|
+
paddingRight: theme.padding.small
|
|
208
345
|
}
|
|
209
346
|
});
|
|
210
347
|
const styles = {};
|
|
211
|
-
const _generateStyles = (
|
|
212
|
-
const
|
|
348
|
+
const _generateStyles = (buttonColor = "default", kind, light, iconWidth, size, theme, themeName) => {
|
|
349
|
+
const color = buttonColor === "destructive" ? theme.color.bg.critical.default : theme.color.bg.action.default;
|
|
350
|
+
const buttonType = `${color}-${kind}-${light}-${iconWidth}-${size}-${themeName}`;
|
|
213
351
|
if (styles[buttonType]) {
|
|
214
352
|
return styles[buttonType];
|
|
215
353
|
}
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
white64,
|
|
220
|
-
offBlack32,
|
|
221
|
-
offBlack50,
|
|
222
|
-
darkBlue
|
|
223
|
-
} = Color__default["default"];
|
|
224
|
-
const fadedColor = Color.mix(Color.fade(color, 0.32), white);
|
|
225
|
-
const activeColor = Color.mix(offBlack32, color);
|
|
226
|
-
const padding = size === "large" ? Spacing__default["default"].xLarge_32 : Spacing__default["default"].medium_16;
|
|
354
|
+
const fadedColor = buttonColor === "destructive" ? theme.color.bg.critical.inverse : theme.color.bg.action.inverse;
|
|
355
|
+
const activeColor = buttonColor === "destructive" ? theme.color.bg.critical.active : theme.color.bg.action.active;
|
|
356
|
+
const padding = size === "large" ? theme.padding.xLarge : theme.padding.large;
|
|
227
357
|
let newStyles = {};
|
|
228
358
|
if (kind === "primary") {
|
|
359
|
+
const boxShadowInnerColor = light ? theme.color.bg.primary.inverse : theme.color.bg.primary.default;
|
|
229
360
|
newStyles = {
|
|
230
361
|
default: {
|
|
231
|
-
background: light ?
|
|
232
|
-
color: light ? color :
|
|
362
|
+
background: light ? theme.color.bg.primary.default : color,
|
|
363
|
+
color: light ? color : theme.color.text.inverse,
|
|
233
364
|
paddingLeft: padding,
|
|
234
365
|
paddingRight: padding
|
|
235
366
|
},
|
|
236
367
|
focus: {
|
|
237
|
-
boxShadow: `0 0 0 1px ${
|
|
368
|
+
boxShadow: `0 0 0 1px ${boxShadowInnerColor}, 0 0 0 3px ${light ? theme.color.bg.primary.default : color}`
|
|
238
369
|
},
|
|
239
370
|
active: {
|
|
240
|
-
boxShadow: `0 0 0 1px ${
|
|
371
|
+
boxShadow: `0 0 0 1px ${boxShadowInnerColor}, 0 0 0 3px ${light ? fadedColor : activeColor}`,
|
|
241
372
|
background: light ? fadedColor : activeColor,
|
|
242
373
|
color: light ? activeColor : fadedColor
|
|
243
374
|
},
|
|
244
375
|
disabled: {
|
|
245
|
-
background: light ? fadedColor :
|
|
246
|
-
color: light ? color :
|
|
376
|
+
background: light ? fadedColor : theme.color.bg.primary.disabled,
|
|
377
|
+
color: light ? color : theme.color.text.primary.disabled,
|
|
247
378
|
cursor: "default",
|
|
248
379
|
":focus": {
|
|
249
|
-
boxShadow: `0 0 0 1px ${light ?
|
|
380
|
+
boxShadow: `0 0 0 1px ${light ? theme.color.bg.primary.disabled : theme.color.bg.primary.default}, 0 0 0 3px ${light ? fadedColor : theme.color.bg.primary.disabled}`
|
|
250
381
|
}
|
|
251
382
|
}
|
|
252
383
|
};
|
|
253
384
|
} else if (kind === "secondary") {
|
|
385
|
+
const horizontalPadding = padding - (theme.border.width.focused - 1);
|
|
386
|
+
const secondaryBorderColor = buttonColor === "destructive" ? theme.color.border.secondary.critical : theme.color.border.secondary.action;
|
|
254
387
|
newStyles = {
|
|
255
388
|
default: {
|
|
256
|
-
background:
|
|
257
|
-
color: light ?
|
|
258
|
-
borderColor: light ?
|
|
389
|
+
background: light ? theme.color.bg.secondary.inverse : theme.color.bg.secondary.default,
|
|
390
|
+
color: light ? theme.color.text.inverse : color,
|
|
391
|
+
borderColor: light ? theme.color.border.secondary.inverse : secondaryBorderColor,
|
|
259
392
|
borderStyle: "solid",
|
|
260
|
-
borderWidth:
|
|
393
|
+
borderWidth: theme.border.width.secondary,
|
|
261
394
|
paddingLeft: padding,
|
|
262
395
|
paddingRight: padding
|
|
263
396
|
},
|
|
264
397
|
focus: {
|
|
265
|
-
background: light ?
|
|
266
|
-
borderColor: light ?
|
|
267
|
-
borderWidth:
|
|
268
|
-
paddingLeft:
|
|
269
|
-
paddingRight:
|
|
398
|
+
background: light ? theme.color.bg.secondary.inverse : theme.color.bg.secondary.focus,
|
|
399
|
+
borderColor: light ? theme.color.border.primary.inverse : color,
|
|
400
|
+
borderWidth: theme.border.width.focused,
|
|
401
|
+
paddingLeft: horizontalPadding,
|
|
402
|
+
paddingRight: horizontalPadding
|
|
270
403
|
},
|
|
271
404
|
active: {
|
|
272
|
-
background: light ? activeColor :
|
|
405
|
+
background: light ? activeColor : theme.color.bg.secondary.active,
|
|
273
406
|
color: light ? fadedColor : activeColor,
|
|
274
407
|
borderColor: light ? fadedColor : activeColor,
|
|
275
|
-
borderWidth:
|
|
276
|
-
paddingLeft:
|
|
277
|
-
paddingRight:
|
|
408
|
+
borderWidth: theme.border.width.focused,
|
|
409
|
+
paddingLeft: horizontalPadding,
|
|
410
|
+
paddingRight: horizontalPadding
|
|
278
411
|
},
|
|
279
412
|
disabled: {
|
|
280
|
-
color: light ?
|
|
281
|
-
borderColor: light ? fadedColor :
|
|
413
|
+
color: light ? theme.color.text.secondary.inverse : theme.color.text.disabled,
|
|
414
|
+
borderColor: light ? fadedColor : theme.color.border.disabled,
|
|
282
415
|
cursor: "default",
|
|
283
416
|
":focus": {
|
|
284
|
-
borderColor: light ?
|
|
285
|
-
borderWidth:
|
|
417
|
+
borderColor: light ? theme.color.border.secondary.inverse : theme.color.border.disabled,
|
|
418
|
+
borderWidth: theme.border.width.disabled,
|
|
286
419
|
paddingLeft: padding - 1,
|
|
287
420
|
paddingRight: padding - 1
|
|
288
421
|
}
|
|
@@ -292,7 +425,7 @@ const _generateStyles = (color, kind, light, iconWidth, size) => {
|
|
|
292
425
|
newStyles = {
|
|
293
426
|
default: {
|
|
294
427
|
background: "none",
|
|
295
|
-
color: light ?
|
|
428
|
+
color: light ? theme.color.text.inverse : color,
|
|
296
429
|
paddingLeft: 0,
|
|
297
430
|
paddingRight: 0
|
|
298
431
|
},
|
|
@@ -300,24 +433,24 @@ const _generateStyles = (color, kind, light, iconWidth, size) => {
|
|
|
300
433
|
":after": {
|
|
301
434
|
content: "''",
|
|
302
435
|
position: "absolute",
|
|
303
|
-
height:
|
|
436
|
+
height: theme.size.height.tertiaryHover,
|
|
304
437
|
width: "100%",
|
|
305
438
|
right: 0,
|
|
306
439
|
bottom: 0,
|
|
307
|
-
background: light ?
|
|
308
|
-
borderRadius:
|
|
440
|
+
background: light ? theme.color.bg.tertiary.hover : color,
|
|
441
|
+
borderRadius: theme.border.radius.tertiary
|
|
309
442
|
}
|
|
310
443
|
},
|
|
311
444
|
focus: {
|
|
312
445
|
":after": {
|
|
313
446
|
content: "''",
|
|
314
447
|
position: "absolute",
|
|
315
|
-
width: `calc(100% + ${
|
|
316
|
-
height: `calc(100% - ${
|
|
448
|
+
width: `calc(100% + ${theme.border.width.focused * 2}px)`,
|
|
449
|
+
height: `calc(100% - ${theme.border.width.focused * 2}px)`,
|
|
317
450
|
borderStyle: "solid",
|
|
318
|
-
borderColor: light ?
|
|
319
|
-
borderWidth:
|
|
320
|
-
borderRadius:
|
|
451
|
+
borderColor: light ? theme.color.border.tertiary.inverse : color,
|
|
452
|
+
borderWidth: theme.border.width.focused,
|
|
453
|
+
borderRadius: theme.border.radius.default
|
|
321
454
|
}
|
|
322
455
|
},
|
|
323
456
|
active: {
|
|
@@ -328,12 +461,12 @@ const _generateStyles = (color, kind, light, iconWidth, size) => {
|
|
|
328
461
|
}
|
|
329
462
|
},
|
|
330
463
|
disabled: {
|
|
331
|
-
color: light ? fadedColor :
|
|
464
|
+
color: light ? fadedColor : theme.color.text.disabled,
|
|
332
465
|
cursor: "default"
|
|
333
466
|
},
|
|
334
467
|
disabledFocus: {
|
|
335
468
|
":after": {
|
|
336
|
-
borderColor: light ?
|
|
469
|
+
borderColor: light ? theme.color.border.tertiary.inverse : theme.color.border.disabled
|
|
337
470
|
}
|
|
338
471
|
}
|
|
339
472
|
};
|
|
@@ -407,7 +540,7 @@ const Button = React__namespace.forwardRef(function Button(props, ref) {
|
|
|
407
540
|
}, renderProp);
|
|
408
541
|
}
|
|
409
542
|
};
|
|
410
|
-
return React__namespace.createElement(reactRouter.__RouterContext.Consumer, null, router => renderClickableBehavior(router));
|
|
543
|
+
return React__namespace.createElement(ThemedButton, null, React__namespace.createElement(reactRouter.__RouterContext.Consumer, null, router => renderClickableBehavior(router)));
|
|
411
544
|
});
|
|
412
545
|
|
|
413
546
|
module.exports = Button;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
declare const theme: {
|
|
2
|
+
color: {
|
|
3
|
+
bg: {
|
|
4
|
+
/**
|
|
5
|
+
* Color
|
|
6
|
+
*/
|
|
7
|
+
action: {
|
|
8
|
+
default: string;
|
|
9
|
+
active: string;
|
|
10
|
+
inverse: string;
|
|
11
|
+
};
|
|
12
|
+
critical: {
|
|
13
|
+
default: string;
|
|
14
|
+
active: string;
|
|
15
|
+
inverse: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Kind
|
|
19
|
+
*/
|
|
20
|
+
primary: {
|
|
21
|
+
default: string;
|
|
22
|
+
disabled: string;
|
|
23
|
+
inverse: string;
|
|
24
|
+
};
|
|
25
|
+
secondary: {
|
|
26
|
+
default: string;
|
|
27
|
+
inverse: string;
|
|
28
|
+
focus: string;
|
|
29
|
+
active: string;
|
|
30
|
+
};
|
|
31
|
+
tertiary: {
|
|
32
|
+
hover: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
text: {
|
|
36
|
+
/**
|
|
37
|
+
* Default
|
|
38
|
+
*/
|
|
39
|
+
disabled: string;
|
|
40
|
+
inverse: string;
|
|
41
|
+
/**
|
|
42
|
+
* Kind
|
|
43
|
+
*/
|
|
44
|
+
primary: {
|
|
45
|
+
disabled: string;
|
|
46
|
+
};
|
|
47
|
+
secondary: {
|
|
48
|
+
inverse: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
border: {
|
|
52
|
+
/**
|
|
53
|
+
* Default
|
|
54
|
+
*/
|
|
55
|
+
disabled: string;
|
|
56
|
+
/**
|
|
57
|
+
* Kind
|
|
58
|
+
*/
|
|
59
|
+
primary: {
|
|
60
|
+
inverse: string;
|
|
61
|
+
};
|
|
62
|
+
secondary: {
|
|
63
|
+
action: string;
|
|
64
|
+
critical: string;
|
|
65
|
+
inverse: string;
|
|
66
|
+
};
|
|
67
|
+
tertiary: {
|
|
68
|
+
inverse: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
border: {
|
|
73
|
+
width: {
|
|
74
|
+
secondary: number;
|
|
75
|
+
focused: number;
|
|
76
|
+
disabled: number;
|
|
77
|
+
};
|
|
78
|
+
radius: {
|
|
79
|
+
default: number;
|
|
80
|
+
tertiary: number;
|
|
81
|
+
small: number;
|
|
82
|
+
large: number;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
size: {
|
|
86
|
+
width: {
|
|
87
|
+
medium: 24;
|
|
88
|
+
large: 32;
|
|
89
|
+
};
|
|
90
|
+
height: {
|
|
91
|
+
tertiaryHover: 2;
|
|
92
|
+
small: 32;
|
|
93
|
+
medium: number;
|
|
94
|
+
large: number;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
padding: {
|
|
98
|
+
small: 8;
|
|
99
|
+
medium: 12;
|
|
100
|
+
large: 16;
|
|
101
|
+
xLarge: 32;
|
|
102
|
+
};
|
|
103
|
+
font: {
|
|
104
|
+
size: {
|
|
105
|
+
large: number;
|
|
106
|
+
};
|
|
107
|
+
lineHeight: {
|
|
108
|
+
large: number;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export default theme;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The overrides for the Khanmigo theme.
|
|
3
|
+
*/
|
|
4
|
+
declare const theme: {
|
|
5
|
+
color: {
|
|
6
|
+
bg: {
|
|
7
|
+
action: {
|
|
8
|
+
default: string;
|
|
9
|
+
active: string;
|
|
10
|
+
inverse: string;
|
|
11
|
+
};
|
|
12
|
+
critical: {
|
|
13
|
+
default: string;
|
|
14
|
+
active: string;
|
|
15
|
+
inverse: string;
|
|
16
|
+
};
|
|
17
|
+
primary: {
|
|
18
|
+
default: string;
|
|
19
|
+
disabled: string;
|
|
20
|
+
inverse: string;
|
|
21
|
+
};
|
|
22
|
+
secondary: {
|
|
23
|
+
default: string;
|
|
24
|
+
inverse: string;
|
|
25
|
+
focus: string;
|
|
26
|
+
active: string;
|
|
27
|
+
};
|
|
28
|
+
tertiary: {
|
|
29
|
+
hover: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
text: {
|
|
33
|
+
disabled: string;
|
|
34
|
+
inverse: string;
|
|
35
|
+
primary: {
|
|
36
|
+
disabled: string;
|
|
37
|
+
};
|
|
38
|
+
secondary: {
|
|
39
|
+
inverse: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
border: {
|
|
43
|
+
disabled: string;
|
|
44
|
+
primary: {
|
|
45
|
+
inverse: string;
|
|
46
|
+
};
|
|
47
|
+
secondary: {
|
|
48
|
+
action: string;
|
|
49
|
+
critical: string;
|
|
50
|
+
inverse: string;
|
|
51
|
+
};
|
|
52
|
+
tertiary: {
|
|
53
|
+
inverse: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
border: {
|
|
58
|
+
width: {
|
|
59
|
+
secondary: number;
|
|
60
|
+
focused: number;
|
|
61
|
+
disabled: number;
|
|
62
|
+
};
|
|
63
|
+
radius: {
|
|
64
|
+
default: number;
|
|
65
|
+
tertiary: number;
|
|
66
|
+
small: number;
|
|
67
|
+
large: number;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
size: {
|
|
71
|
+
width: {
|
|
72
|
+
medium: 24;
|
|
73
|
+
large: 32;
|
|
74
|
+
};
|
|
75
|
+
height: {
|
|
76
|
+
tertiaryHover: 2;
|
|
77
|
+
small: 32;
|
|
78
|
+
medium: number;
|
|
79
|
+
large: number;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
padding: {
|
|
83
|
+
small: 8;
|
|
84
|
+
medium: 12;
|
|
85
|
+
large: 16;
|
|
86
|
+
xLarge: 32;
|
|
87
|
+
};
|
|
88
|
+
font: {
|
|
89
|
+
size: {
|
|
90
|
+
large: number;
|
|
91
|
+
};
|
|
92
|
+
lineHeight: {
|
|
93
|
+
large: number;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export default theme;
|