@khanacademy/wonder-blocks-button 4.2.0 → 4.2.2

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @khanacademy/wonder-blocks-button
2
2
 
3
+ ## 4.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 1644f651: Fix borderRadius value for small variant
8
+
9
+ ## 4.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - a194f5e2: - Fix default borderRadius value.
14
+ - Fix secondary pressed background color (to support action and destructive buttons).
15
+ - Change fontWeight for khanmigo theme (bold -> regular).
16
+
3
17
  ## 4.2.0
4
18
 
5
19
  ### Minor Changes
package/dist/es/index.js CHANGED
@@ -59,7 +59,10 @@ const theme$1 = {
59
59
  default: "none",
60
60
  inverse: "none",
61
61
  focus: tokens.color.white,
62
- active: tokens.color.fadedBlue
62
+ active: {
63
+ action: tokens.color.fadedBlue,
64
+ critical: tokens.color.fadedRed
65
+ }
63
66
  },
64
67
  tertiary: {
65
68
  hover: tokens.color.white
@@ -97,9 +100,9 @@ const theme$1 = {
97
100
  disabled: tokens.border.width.thin
98
101
  },
99
102
  radius: {
100
- default: tokens.border.radius.small_3,
103
+ default: tokens.border.radius.medium_4,
101
104
  tertiary: tokens.border.radius.xSmall_2,
102
- small: tokens.border.radius.small_3,
105
+ small: tokens.border.radius.medium_4,
103
106
  large: tokens.border.radius.large_6
104
107
  }
105
108
  },
@@ -127,6 +130,9 @@ const theme$1 = {
127
130
  },
128
131
  lineHeight: {
129
132
  large: tokens.font.lineHeight.medium
133
+ },
134
+ weight: {
135
+ default: tokens.font.weight.bold
130
136
  }
131
137
  }
132
138
  };
@@ -136,7 +142,10 @@ const theme = mergeTheme(theme$1, {
136
142
  bg: {
137
143
  secondary: {
138
144
  default: tokens.color.offWhite,
139
- active: tokens.color.fadedBlue8,
145
+ active: {
146
+ action: tokens.color.fadedBlue8,
147
+ critical: tokens.color.fadedRed8
148
+ },
140
149
  focus: tokens.color.offWhite
141
150
  }
142
151
  },
@@ -156,6 +165,11 @@ const theme = mergeTheme(theme$1, {
156
165
  width: {
157
166
  focused: tokens.border.width.hairline
158
167
  }
168
+ },
169
+ font: {
170
+ weight: {
171
+ default: tokens.font.weight.regular
172
+ }
159
173
  }
160
174
  });
161
175
 
@@ -295,7 +309,7 @@ const themedSharedStyles = theme => ({
295
309
  },
296
310
  text: {
297
311
  alignItems: "center",
298
- fontWeight: "bold",
312
+ fontWeight: theme.font.weight.default,
299
313
  whiteSpace: "nowrap",
300
314
  overflow: "hidden",
301
315
  textOverflow: "ellipsis",
@@ -359,6 +373,7 @@ const _generateStyles = (buttonColor = "default", kind, light, iconWidth, size,
359
373
  } else if (kind === "secondary") {
360
374
  const horizontalPadding = padding - (theme.border.width.focused - 1);
361
375
  const secondaryBorderColor = buttonColor === "destructive" ? theme.color.border.secondary.critical : theme.color.border.secondary.action;
376
+ const secondaryActiveColor = buttonColor === "destructive" ? theme.color.bg.secondary.active.critical : theme.color.bg.secondary.active.action;
362
377
  newStyles = {
363
378
  default: {
364
379
  background: light ? theme.color.bg.secondary.inverse : theme.color.bg.secondary.default,
@@ -377,7 +392,7 @@ const _generateStyles = (buttonColor = "default", kind, light, iconWidth, size,
377
392
  paddingRight: horizontalPadding
378
393
  },
379
394
  active: {
380
- background: light ? activeColor : theme.color.bg.secondary.active,
395
+ background: light ? activeColor : secondaryActiveColor,
381
396
  color: light ? fadedColor : activeColor,
382
397
  borderColor: light ? fadedColor : activeColor,
383
398
  borderWidth: theme.border.width.focused,
package/dist/index.js CHANGED
@@ -84,7 +84,10 @@ const theme$1 = {
84
84
  default: "none",
85
85
  inverse: "none",
86
86
  focus: wonderBlocksTheming.tokens.color.white,
87
- active: wonderBlocksTheming.tokens.color.fadedBlue
87
+ active: {
88
+ action: wonderBlocksTheming.tokens.color.fadedBlue,
89
+ critical: wonderBlocksTheming.tokens.color.fadedRed
90
+ }
88
91
  },
89
92
  tertiary: {
90
93
  hover: wonderBlocksTheming.tokens.color.white
@@ -122,9 +125,9 @@ const theme$1 = {
122
125
  disabled: wonderBlocksTheming.tokens.border.width.thin
123
126
  },
124
127
  radius: {
125
- default: wonderBlocksTheming.tokens.border.radius.small_3,
128
+ default: wonderBlocksTheming.tokens.border.radius.medium_4,
126
129
  tertiary: wonderBlocksTheming.tokens.border.radius.xSmall_2,
127
- small: wonderBlocksTheming.tokens.border.radius.small_3,
130
+ small: wonderBlocksTheming.tokens.border.radius.medium_4,
128
131
  large: wonderBlocksTheming.tokens.border.radius.large_6
129
132
  }
130
133
  },
@@ -152,6 +155,9 @@ const theme$1 = {
152
155
  },
153
156
  lineHeight: {
154
157
  large: wonderBlocksTheming.tokens.font.lineHeight.medium
158
+ },
159
+ weight: {
160
+ default: wonderBlocksTheming.tokens.font.weight.bold
155
161
  }
156
162
  }
157
163
  };
@@ -161,7 +167,10 @@ const theme = wonderBlocksTheming.mergeTheme(theme$1, {
161
167
  bg: {
162
168
  secondary: {
163
169
  default: wonderBlocksTheming.tokens.color.offWhite,
164
- active: wonderBlocksTheming.tokens.color.fadedBlue8,
170
+ active: {
171
+ action: wonderBlocksTheming.tokens.color.fadedBlue8,
172
+ critical: wonderBlocksTheming.tokens.color.fadedRed8
173
+ },
165
174
  focus: wonderBlocksTheming.tokens.color.offWhite
166
175
  }
167
176
  },
@@ -181,6 +190,11 @@ const theme = wonderBlocksTheming.mergeTheme(theme$1, {
181
190
  width: {
182
191
  focused: wonderBlocksTheming.tokens.border.width.hairline
183
192
  }
193
+ },
194
+ font: {
195
+ weight: {
196
+ default: wonderBlocksTheming.tokens.font.weight.regular
197
+ }
184
198
  }
185
199
  });
186
200
 
@@ -320,7 +334,7 @@ const themedSharedStyles = theme => ({
320
334
  },
321
335
  text: {
322
336
  alignItems: "center",
323
- fontWeight: "bold",
337
+ fontWeight: theme.font.weight.default,
324
338
  whiteSpace: "nowrap",
325
339
  overflow: "hidden",
326
340
  textOverflow: "ellipsis",
@@ -384,6 +398,7 @@ const _generateStyles = (buttonColor = "default", kind, light, iconWidth, size,
384
398
  } else if (kind === "secondary") {
385
399
  const horizontalPadding = padding - (theme.border.width.focused - 1);
386
400
  const secondaryBorderColor = buttonColor === "destructive" ? theme.color.border.secondary.critical : theme.color.border.secondary.action;
401
+ const secondaryActiveColor = buttonColor === "destructive" ? theme.color.bg.secondary.active.critical : theme.color.bg.secondary.active.action;
387
402
  newStyles = {
388
403
  default: {
389
404
  background: light ? theme.color.bg.secondary.inverse : theme.color.bg.secondary.default,
@@ -402,7 +417,7 @@ const _generateStyles = (buttonColor = "default", kind, light, iconWidth, size,
402
417
  paddingRight: horizontalPadding
403
418
  },
404
419
  active: {
405
- background: light ? activeColor : theme.color.bg.secondary.active,
420
+ background: light ? activeColor : secondaryActiveColor,
406
421
  color: light ? fadedColor : activeColor,
407
422
  borderColor: light ? fadedColor : activeColor,
408
423
  borderWidth: theme.border.width.focused,
@@ -26,7 +26,10 @@ declare const theme: {
26
26
  default: string;
27
27
  inverse: string;
28
28
  focus: string;
29
- active: string;
29
+ active: {
30
+ action: string;
31
+ critical: string;
32
+ };
30
33
  };
31
34
  tertiary: {
32
35
  hover: string;
@@ -107,6 +110,9 @@ declare const theme: {
107
110
  lineHeight: {
108
111
  large: number;
109
112
  };
113
+ weight: {
114
+ default: number;
115
+ };
110
116
  };
111
117
  };
112
118
  export default theme;
@@ -23,7 +23,10 @@ declare const theme: {
23
23
  default: string;
24
24
  inverse: string;
25
25
  focus: string;
26
- active: string;
26
+ active: {
27
+ action: string;
28
+ critical: string;
29
+ };
27
30
  };
28
31
  tertiary: {
29
32
  hover: string;
@@ -92,6 +95,9 @@ declare const theme: {
92
95
  lineHeight: {
93
96
  large: number;
94
97
  };
98
+ weight: {
99
+ default: number;
100
+ };
95
101
  };
96
102
  };
97
103
  export default theme;
@@ -30,7 +30,10 @@ export declare const ButtonThemeContext: React.Context<{
30
30
  default: string;
31
31
  inverse: string;
32
32
  focus: string;
33
- active: string;
33
+ active: {
34
+ action: string;
35
+ critical: string;
36
+ };
34
37
  };
35
38
  tertiary: {
36
39
  hover: string;
@@ -99,6 +102,9 @@ export declare const ButtonThemeContext: React.Context<{
99
102
  lineHeight: {
100
103
  large: number;
101
104
  };
105
+ weight: {
106
+ default: number;
107
+ };
102
108
  };
103
109
  }>;
104
110
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-button",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"