@khanacademy/wonder-blocks-dropdown 5.1.3 → 5.1.4
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 +19 -0
- package/dist/es/index.js +59 -62
- package/dist/index.js +91 -96
- package/package.json +8 -9
- package/src/components/action-item.tsx +8 -9
- package/src/components/action-menu-opener-core.tsx +10 -11
- package/src/components/check.tsx +4 -4
- package/src/components/checkbox.tsx +8 -9
- package/src/components/dropdown-core.tsx +11 -11
- package/src/components/option-item.tsx +16 -18
- package/src/components/select-opener.tsx +1 -1
- package/src/components/separator-item.tsx +4 -5
- package/src/util/constants.ts +3 -3
- package/tsconfig-build.json +1 -2
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-dropdown
|
|
2
2
|
|
|
3
|
+
## 5.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 60aba5b8: Update internal spacing references (from wb-spacing to wb-tokens)
|
|
8
|
+
- 7cd7f6cc: Replace theming.tokens with wb-tokens and update callsites to use the new export
|
|
9
|
+
- 7c51f377: Migrate wb-color imports to use tokens.color
|
|
10
|
+
- Updated dependencies [60aba5b8]
|
|
11
|
+
- Updated dependencies [7cd7f6cc]
|
|
12
|
+
- Updated dependencies [7c51f377]
|
|
13
|
+
- Updated dependencies [7cd7f6cc]
|
|
14
|
+
- Updated dependencies [7c51f377]
|
|
15
|
+
- @khanacademy/wonder-blocks-search-field@2.2.1
|
|
16
|
+
- @khanacademy/wonder-blocks-layout@2.0.26
|
|
17
|
+
- @khanacademy/wonder-blocks-modal@4.2.2
|
|
18
|
+
- @khanacademy/wonder-blocks-cell@3.2.1
|
|
19
|
+
- @khanacademy/wonder-blocks-tokens@0.2.0
|
|
20
|
+
- @khanacademy/wonder-blocks-clickable@4.0.13
|
|
21
|
+
|
|
3
22
|
## 5.1.3
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/es/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { StyleSheet } from 'aphrodite';
|
|
3
3
|
import { CompactCell, DetailCell } from '@khanacademy/wonder-blocks-cell';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import * as tokens from '@khanacademy/wonder-blocks-tokens';
|
|
5
|
+
import { spacing, color } from '@khanacademy/wonder-blocks-tokens';
|
|
6
6
|
import { LabelMedium, LabelSmall, LabelLarge } from '@khanacademy/wonder-blocks-typography';
|
|
7
|
-
import {
|
|
7
|
+
import { mix, fade } from '@khanacademy/wonder-blocks-color';
|
|
8
8
|
import { View, addStyle } from '@khanacademy/wonder-blocks-core';
|
|
9
9
|
import { Strut } from '@khanacademy/wonder-blocks-layout';
|
|
10
10
|
import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
@@ -44,8 +44,8 @@ const keyCodes = {
|
|
|
44
44
|
down: 40
|
|
45
45
|
};
|
|
46
46
|
const selectDropdownStyle = {
|
|
47
|
-
marginTop:
|
|
48
|
-
marginBottom:
|
|
47
|
+
marginTop: spacing.xSmall_8,
|
|
48
|
+
marginBottom: spacing.xSmall_8
|
|
49
49
|
};
|
|
50
50
|
const filterableDropdownStyle = {
|
|
51
51
|
minHeight: 100
|
|
@@ -67,9 +67,8 @@ const defaultLabels = {
|
|
|
67
67
|
const {
|
|
68
68
|
blue: blue$1,
|
|
69
69
|
white: white$1,
|
|
70
|
-
offBlack: offBlack$1
|
|
71
|
-
|
|
72
|
-
} = Color;
|
|
70
|
+
offBlack: offBlack$1
|
|
71
|
+
} = color;
|
|
73
72
|
class ActionItem extends React.Component {
|
|
74
73
|
static isClassOf(instance) {
|
|
75
74
|
return instance && instance.type && instance.type.__IS_ACTION_ITEM__;
|
|
@@ -126,9 +125,9 @@ const styles$8 = StyleSheet.create({
|
|
|
126
125
|
minHeight: DROPDOWN_ITEM_HEIGHT,
|
|
127
126
|
touchAction: "manipulation",
|
|
128
127
|
":focus": {
|
|
129
|
-
borderRadius:
|
|
130
|
-
outline: `${
|
|
131
|
-
outlineOffset: -
|
|
128
|
+
borderRadius: spacing.xxxSmall_4,
|
|
129
|
+
outline: `${spacing.xxxxSmall_2}px solid ${color.blue}`,
|
|
130
|
+
outlineOffset: -spacing.xxxxSmall_2
|
|
132
131
|
},
|
|
133
132
|
[":hover[aria-disabled=false]"]: {
|
|
134
133
|
color: white$1,
|
|
@@ -141,8 +140,8 @@ const styles$8 = StyleSheet.create({
|
|
|
141
140
|
}
|
|
142
141
|
},
|
|
143
142
|
[":active[aria-disabled=false]"]: {
|
|
144
|
-
color:
|
|
145
|
-
background:
|
|
143
|
+
color: color.fadedBlue,
|
|
144
|
+
background: color.activeBlue
|
|
146
145
|
}
|
|
147
146
|
},
|
|
148
147
|
shared: {
|
|
@@ -154,7 +153,7 @@ const styles$8 = StyleSheet.create({
|
|
|
154
153
|
userSelect: "none"
|
|
155
154
|
},
|
|
156
155
|
indent: {
|
|
157
|
-
paddingLeft:
|
|
156
|
+
paddingLeft: spacing.medium_16 * 2
|
|
158
157
|
}
|
|
159
158
|
});
|
|
160
159
|
|
|
@@ -184,9 +183,9 @@ const Check = function Check(props) {
|
|
|
184
183
|
const styles$7 = StyleSheet.create({
|
|
185
184
|
bounds: {
|
|
186
185
|
alignSelf: "center",
|
|
187
|
-
height:
|
|
188
|
-
minHeight:
|
|
189
|
-
minWidth:
|
|
186
|
+
height: spacing.medium_16,
|
|
187
|
+
minHeight: spacing.medium_16,
|
|
188
|
+
minWidth: spacing.medium_16
|
|
190
189
|
},
|
|
191
190
|
hide: {
|
|
192
191
|
visibility: "hidden"
|
|
@@ -197,7 +196,7 @@ const {
|
|
|
197
196
|
offBlack16,
|
|
198
197
|
offBlack50,
|
|
199
198
|
offWhite
|
|
200
|
-
} =
|
|
199
|
+
} = color;
|
|
201
200
|
const Checkbox = function Checkbox(props) {
|
|
202
201
|
const {
|
|
203
202
|
disabled,
|
|
@@ -211,18 +210,18 @@ const Checkbox = function Checkbox(props) {
|
|
|
211
210
|
size: "small",
|
|
212
211
|
className: "check",
|
|
213
212
|
style: [{
|
|
214
|
-
width:
|
|
215
|
-
height:
|
|
216
|
-
margin:
|
|
213
|
+
width: spacing.small_12,
|
|
214
|
+
height: spacing.small_12,
|
|
215
|
+
margin: spacing.xxxxSmall_2
|
|
217
216
|
}, disabled && selected && styles$6.disabledCheckFormatting]
|
|
218
217
|
}));
|
|
219
218
|
};
|
|
220
219
|
const styles$6 = StyleSheet.create({
|
|
221
220
|
checkbox: {
|
|
222
221
|
alignSelf: "center",
|
|
223
|
-
minHeight:
|
|
224
|
-
minWidth:
|
|
225
|
-
height:
|
|
222
|
+
minHeight: spacing.medium_16,
|
|
223
|
+
minWidth: spacing.medium_16,
|
|
224
|
+
height: spacing.medium_16,
|
|
226
225
|
borderRadius: 3,
|
|
227
226
|
borderWidth: 1,
|
|
228
227
|
borderStyle: "solid",
|
|
@@ -302,7 +301,7 @@ class OptionItem extends React.Component {
|
|
|
302
301
|
disabled: disabled,
|
|
303
302
|
selected: selected
|
|
304
303
|
}), React.createElement(Strut, {
|
|
305
|
-
size:
|
|
304
|
+
size: spacing.xSmall_8
|
|
306
305
|
}), leftAccessory) : React.createElement(CheckComponent, {
|
|
307
306
|
disabled: disabled,
|
|
308
307
|
selected: selected
|
|
@@ -332,18 +331,16 @@ OptionItem.__IS_OPTION_ITEM__ = true;
|
|
|
332
331
|
const {
|
|
333
332
|
blue,
|
|
334
333
|
white,
|
|
335
|
-
offBlack
|
|
336
|
-
|
|
337
|
-
} = Color;
|
|
338
|
-
const activeBlue = mix(offBlack32, blue);
|
|
334
|
+
offBlack
|
|
335
|
+
} = color;
|
|
339
336
|
const styles$5 = StyleSheet.create({
|
|
340
337
|
item: {
|
|
341
338
|
minHeight: "unset",
|
|
342
|
-
paddingBlock:
|
|
339
|
+
paddingBlock: spacing.xxxxSmall_2,
|
|
343
340
|
":focus": {
|
|
344
|
-
borderRadius:
|
|
345
|
-
outline: `${
|
|
346
|
-
outlineOffset: -
|
|
341
|
+
borderRadius: spacing.xxxSmall_4,
|
|
342
|
+
outline: `${spacing.xxxxSmall_2}px solid ${color.blue}`,
|
|
343
|
+
outlineOffset: -spacing.xxxxSmall_2
|
|
347
344
|
},
|
|
348
345
|
":focus-visible": {
|
|
349
346
|
overflow: "visible"
|
|
@@ -359,8 +356,8 @@ const styles$5 = StyleSheet.create({
|
|
|
359
356
|
}
|
|
360
357
|
},
|
|
361
358
|
[":active[aria-disabled=false]"]: {
|
|
362
|
-
color:
|
|
363
|
-
background: activeBlue
|
|
359
|
+
color: color.fadedBlue,
|
|
360
|
+
background: color.activeBlue
|
|
364
361
|
},
|
|
365
362
|
[":hover[aria-disabled=false] .checkbox"]: {
|
|
366
363
|
background: white
|
|
@@ -369,7 +366,7 @@ const styles$5 = StyleSheet.create({
|
|
|
369
366
|
color: blue
|
|
370
367
|
},
|
|
371
368
|
[":active[aria-disabled=false] .check"]: {
|
|
372
|
-
color: activeBlue
|
|
369
|
+
color: color.activeBlue
|
|
373
370
|
},
|
|
374
371
|
[":is([aria-selected=true]) .checkbox"]: {
|
|
375
372
|
background: blue
|
|
@@ -378,19 +375,19 @@ const styles$5 = StyleSheet.create({
|
|
|
378
375
|
color: white
|
|
379
376
|
},
|
|
380
377
|
[":is([aria-disabled=false]) .subtitle"]: {
|
|
381
|
-
color:
|
|
378
|
+
color: color.offBlack64
|
|
382
379
|
},
|
|
383
380
|
[":hover[aria-disabled=false] .subtitle"]: {
|
|
384
|
-
color:
|
|
381
|
+
color: color.offWhite
|
|
385
382
|
},
|
|
386
383
|
[":active[aria-disabled=false] .subtitle"]: {
|
|
387
|
-
color: mix(
|
|
384
|
+
color: mix(color.fadedBlue16, white)
|
|
388
385
|
}
|
|
389
386
|
},
|
|
390
387
|
itemContainer: {
|
|
391
388
|
minHeight: "unset",
|
|
392
|
-
padding:
|
|
393
|
-
paddingRight:
|
|
389
|
+
padding: spacing.xSmall_8,
|
|
390
|
+
paddingRight: spacing.medium_16,
|
|
394
391
|
whiteSpace: "nowrap"
|
|
395
392
|
},
|
|
396
393
|
label: {
|
|
@@ -418,11 +415,11 @@ class SeparatorItem extends React.Component {
|
|
|
418
415
|
SeparatorItem.__IS_SEPARATOR_ITEM__ = true;
|
|
419
416
|
const styles$4 = StyleSheet.create({
|
|
420
417
|
separator: {
|
|
421
|
-
boxShadow: `0 -1px ${
|
|
418
|
+
boxShadow: `0 -1px ${color.offBlack16}`,
|
|
422
419
|
height: 1,
|
|
423
420
|
minHeight: 1,
|
|
424
|
-
marginTop:
|
|
425
|
-
marginBottom:
|
|
421
|
+
marginTop: spacing.xxxSmall_4,
|
|
422
|
+
marginBottom: spacing.xxxSmall_4
|
|
426
423
|
}
|
|
427
424
|
});
|
|
428
425
|
|
|
@@ -1247,12 +1244,12 @@ const styles$3 = StyleSheet.create({
|
|
|
1247
1244
|
width: "fit-content"
|
|
1248
1245
|
},
|
|
1249
1246
|
dropdown: {
|
|
1250
|
-
backgroundColor:
|
|
1247
|
+
backgroundColor: color.white,
|
|
1251
1248
|
borderRadius: 4,
|
|
1252
|
-
paddingTop:
|
|
1253
|
-
paddingBottom:
|
|
1254
|
-
border: `solid 1px ${
|
|
1255
|
-
boxShadow: `0px 8px 8px 0px ${fade(
|
|
1249
|
+
paddingTop: spacing.xxxSmall_4,
|
|
1250
|
+
paddingBottom: spacing.xxxSmall_4,
|
|
1251
|
+
border: `solid 1px ${color.offBlack16}`,
|
|
1252
|
+
boxShadow: `0px 8px 8px 0px ${fade(color.offBlack, 0.1)}`,
|
|
1256
1253
|
maxHeight: "var(--popper-max-height)"
|
|
1257
1254
|
},
|
|
1258
1255
|
light: {
|
|
@@ -1266,13 +1263,13 @@ const styles$3 = StyleSheet.create({
|
|
|
1266
1263
|
visibility: "hidden"
|
|
1267
1264
|
},
|
|
1268
1265
|
noResult: {
|
|
1269
|
-
color:
|
|
1266
|
+
color: color.offBlack64,
|
|
1270
1267
|
alignSelf: "center",
|
|
1271
|
-
marginTop:
|
|
1268
|
+
marginTop: spacing.xxSmall_6
|
|
1272
1269
|
},
|
|
1273
1270
|
searchInputStyle: {
|
|
1274
|
-
margin:
|
|
1275
|
-
marginTop:
|
|
1271
|
+
margin: spacing.xSmall_8,
|
|
1272
|
+
marginTop: spacing.xxxSmall_4,
|
|
1276
1273
|
minHeight: "auto",
|
|
1277
1274
|
position: "sticky"
|
|
1278
1275
|
},
|
|
@@ -1305,7 +1302,7 @@ class ActionMenuOpenerCore extends React.Component {
|
|
|
1305
1302
|
"aria-label": ariaLabel
|
|
1306
1303
|
} = _this$props,
|
|
1307
1304
|
restProps = _objectWithoutPropertiesLoose(_this$props, _excluded$4);
|
|
1308
|
-
const buttonColor =
|
|
1305
|
+
const buttonColor = color.blue;
|
|
1309
1306
|
const buttonStyles = _generateStyles$1(buttonColor);
|
|
1310
1307
|
const disabled = disabledProp;
|
|
1311
1308
|
const defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, buttonStyles.default, disabled && buttonStyles.disabled, !disabled && pressed && buttonStyles.active];
|
|
@@ -1324,7 +1321,7 @@ class ActionMenuOpenerCore extends React.Component {
|
|
|
1324
1321
|
}), React.createElement(View, {
|
|
1325
1322
|
style: !disabled && (hovered || focused) && buttonStyles.focus
|
|
1326
1323
|
}, label), React.createElement(Strut, {
|
|
1327
|
-
size:
|
|
1324
|
+
size: spacing.xxxSmall_4
|
|
1328
1325
|
}), React.createElement(PhosphorIcon, {
|
|
1329
1326
|
size: "small",
|
|
1330
1327
|
color: "currentColor",
|
|
@@ -1341,7 +1338,7 @@ const sharedStyles = StyleSheet.create({
|
|
|
1341
1338
|
justifyContent: "center",
|
|
1342
1339
|
height: DROPDOWN_ITEM_HEIGHT,
|
|
1343
1340
|
border: "none",
|
|
1344
|
-
borderRadius:
|
|
1341
|
+
borderRadius: spacing.xxxSmall_4,
|
|
1345
1342
|
cursor: "pointer",
|
|
1346
1343
|
outline: "none",
|
|
1347
1344
|
textDecoration: "none",
|
|
@@ -1355,7 +1352,7 @@ const sharedStyles = StyleSheet.create({
|
|
|
1355
1352
|
cursor: "auto"
|
|
1356
1353
|
},
|
|
1357
1354
|
small: {
|
|
1358
|
-
height:
|
|
1355
|
+
height: spacing.xLarge_32
|
|
1359
1356
|
},
|
|
1360
1357
|
text: {
|
|
1361
1358
|
textAlign: "left",
|
|
@@ -1376,20 +1373,20 @@ const sharedStyles = StyleSheet.create({
|
|
|
1376
1373
|
}
|
|
1377
1374
|
});
|
|
1378
1375
|
const styles$2 = {};
|
|
1379
|
-
const _generateStyles$1 =
|
|
1380
|
-
const buttonType =
|
|
1376
|
+
const _generateStyles$1 = localColor => {
|
|
1377
|
+
const buttonType = localColor;
|
|
1381
1378
|
if (styles$2[buttonType]) {
|
|
1382
1379
|
return styles$2[buttonType];
|
|
1383
1380
|
}
|
|
1384
1381
|
const {
|
|
1385
1382
|
offBlack32
|
|
1386
|
-
} =
|
|
1387
|
-
const activeColor =
|
|
1383
|
+
} = color;
|
|
1384
|
+
const activeColor = color.activeBlue;
|
|
1388
1385
|
let newStyles = {};
|
|
1389
1386
|
newStyles = {
|
|
1390
1387
|
default: {
|
|
1391
1388
|
background: "none",
|
|
1392
|
-
color:
|
|
1389
|
+
color: localColor
|
|
1393
1390
|
},
|
|
1394
1391
|
focus: {
|
|
1395
1392
|
":after": {
|