@khanacademy/wonder-blocks-dropdown 7.0.6 → 8.0.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 +33 -0
- package/dist/components/combobox.d.ts +0 -7
- package/dist/components/dropdown-core-virtualized.d.ts +3 -3
- package/dist/components/dropdown-core.d.ts +17 -21
- package/dist/components/multi-select.d.ts +0 -5
- package/dist/components/select-opener.d.ts +0 -6
- package/dist/components/single-select.d.ts +0 -5
- package/dist/es/index.js +75 -118
- package/dist/hooks/use-listbox.d.ts +14 -14
- package/dist/index.js +156 -199
- package/dist/util/helpers.d.ts +0 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var _extends = require('@babel/runtime/helpers/extends');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var aphrodite = require('aphrodite');
|
|
8
8
|
var wonderBlocksCell = require('@khanacademy/wonder-blocks-cell');
|
|
9
|
-
var
|
|
9
|
+
var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
|
|
10
10
|
var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
|
|
11
11
|
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
|
|
12
12
|
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
@@ -50,7 +50,6 @@ function _interopNamespace(e) {
|
|
|
50
50
|
|
|
51
51
|
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
52
52
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
53
|
-
var tokens__namespace = /*#__PURE__*/_interopNamespace(tokens);
|
|
54
53
|
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
55
54
|
var checkIcon__default = /*#__PURE__*/_interopDefaultLegacy(checkIcon);
|
|
56
55
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
@@ -69,8 +68,8 @@ const keys = {
|
|
|
69
68
|
down: "ArrowDown"
|
|
70
69
|
};
|
|
71
70
|
const selectDropdownStyle = {
|
|
72
|
-
marginTop:
|
|
73
|
-
marginBottom:
|
|
71
|
+
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
72
|
+
marginBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
74
73
|
};
|
|
75
74
|
const filterableDropdownStyle = {
|
|
76
75
|
minHeight: 100
|
|
@@ -114,7 +113,7 @@ const {
|
|
|
114
113
|
blue: blue$1,
|
|
115
114
|
white: white$1,
|
|
116
115
|
offBlack: offBlack$1
|
|
117
|
-
} =
|
|
116
|
+
} = wonderBlocksTokens.color;
|
|
118
117
|
class ActionItem extends React__namespace.Component {
|
|
119
118
|
static isClassOf(instance) {
|
|
120
119
|
return instance && instance.type && instance.type.__IS_ACTION_ITEM__;
|
|
@@ -171,9 +170,9 @@ const styles$c = aphrodite.StyleSheet.create({
|
|
|
171
170
|
minHeight: DROPDOWN_ITEM_HEIGHT,
|
|
172
171
|
touchAction: "manipulation",
|
|
173
172
|
":focus": {
|
|
174
|
-
borderRadius:
|
|
175
|
-
outline: `${
|
|
176
|
-
outlineOffset: -
|
|
173
|
+
borderRadius: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
174
|
+
outline: `${wonderBlocksTokens.spacing.xxxxSmall_2}px solid ${wonderBlocksTokens.color.blue}`,
|
|
175
|
+
outlineOffset: -wonderBlocksTokens.spacing.xxxxSmall_2
|
|
177
176
|
},
|
|
178
177
|
[":hover[aria-disabled=false]"]: {
|
|
179
178
|
color: white$1,
|
|
@@ -186,8 +185,8 @@ const styles$c = aphrodite.StyleSheet.create({
|
|
|
186
185
|
}
|
|
187
186
|
},
|
|
188
187
|
[":active[aria-disabled=false]"]: {
|
|
189
|
-
color:
|
|
190
|
-
background:
|
|
188
|
+
color: wonderBlocksTokens.color.fadedBlue,
|
|
189
|
+
background: wonderBlocksTokens.color.activeBlue
|
|
191
190
|
}
|
|
192
191
|
},
|
|
193
192
|
shared: {
|
|
@@ -199,7 +198,7 @@ const styles$c = aphrodite.StyleSheet.create({
|
|
|
199
198
|
userSelect: "none"
|
|
200
199
|
},
|
|
201
200
|
indent: {
|
|
202
|
-
paddingLeft:
|
|
201
|
+
paddingLeft: wonderBlocksTokens.spacing.medium_16 * 2
|
|
203
202
|
}
|
|
204
203
|
});
|
|
205
204
|
|
|
@@ -216,9 +215,9 @@ const Check = function Check(props) {
|
|
|
216
215
|
const styles$b = aphrodite.StyleSheet.create({
|
|
217
216
|
bounds: {
|
|
218
217
|
alignSelf: "center",
|
|
219
|
-
height:
|
|
220
|
-
minHeight:
|
|
221
|
-
minWidth:
|
|
218
|
+
height: wonderBlocksTokens.spacing.medium_16,
|
|
219
|
+
minHeight: wonderBlocksTokens.spacing.medium_16,
|
|
220
|
+
minWidth: wonderBlocksTokens.spacing.medium_16
|
|
222
221
|
},
|
|
223
222
|
hide: {
|
|
224
223
|
visibility: "hidden"
|
|
@@ -229,7 +228,7 @@ const {
|
|
|
229
228
|
offBlack16,
|
|
230
229
|
offBlack50,
|
|
231
230
|
offWhite
|
|
232
|
-
} =
|
|
231
|
+
} = wonderBlocksTokens.color;
|
|
233
232
|
const Checkbox = function Checkbox(props) {
|
|
234
233
|
const {
|
|
235
234
|
disabled,
|
|
@@ -243,18 +242,18 @@ const Checkbox = function Checkbox(props) {
|
|
|
243
242
|
size: "small",
|
|
244
243
|
className: "check",
|
|
245
244
|
style: [{
|
|
246
|
-
width:
|
|
247
|
-
height:
|
|
248
|
-
margin:
|
|
245
|
+
width: wonderBlocksTokens.spacing.small_12,
|
|
246
|
+
height: wonderBlocksTokens.spacing.small_12,
|
|
247
|
+
margin: wonderBlocksTokens.spacing.xxxxSmall_2
|
|
249
248
|
}, disabled && selected && styles$a.disabledCheckFormatting]
|
|
250
249
|
}));
|
|
251
250
|
};
|
|
252
251
|
const styles$a = aphrodite.StyleSheet.create({
|
|
253
252
|
checkbox: {
|
|
254
253
|
alignSelf: "center",
|
|
255
|
-
minHeight:
|
|
256
|
-
minWidth:
|
|
257
|
-
height:
|
|
254
|
+
minHeight: wonderBlocksTokens.spacing.medium_16,
|
|
255
|
+
minWidth: wonderBlocksTokens.spacing.medium_16,
|
|
256
|
+
height: wonderBlocksTokens.spacing.medium_16,
|
|
258
257
|
borderRadius: 3,
|
|
259
258
|
borderWidth: 1,
|
|
260
259
|
borderStyle: "solid",
|
|
@@ -336,7 +335,7 @@ class OptionItem extends React__namespace.Component {
|
|
|
336
335
|
disabled: disabled,
|
|
337
336
|
selected: selected
|
|
338
337
|
}), React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
339
|
-
size:
|
|
338
|
+
size: wonderBlocksTokens.spacing.xSmall_8
|
|
340
339
|
}), leftAccessory) : React__namespace.createElement(CheckComponent, {
|
|
341
340
|
disabled: disabled,
|
|
342
341
|
selected: selected
|
|
@@ -392,11 +391,11 @@ const {
|
|
|
392
391
|
blue,
|
|
393
392
|
white,
|
|
394
393
|
offBlack
|
|
395
|
-
} =
|
|
394
|
+
} = wonderBlocksTokens.color;
|
|
396
395
|
const focusedStyle = {
|
|
397
|
-
borderRadius:
|
|
398
|
-
outline: `${
|
|
399
|
-
outlineOffset: -
|
|
396
|
+
borderRadius: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
397
|
+
outline: `${wonderBlocksTokens.spacing.xxxxSmall_2}px solid ${wonderBlocksTokens.color.blue}`,
|
|
398
|
+
outlineOffset: -wonderBlocksTokens.spacing.xxxxSmall_2
|
|
400
399
|
};
|
|
401
400
|
const styles$9 = aphrodite.StyleSheet.create({
|
|
402
401
|
reset: {
|
|
@@ -417,7 +416,7 @@ const styles$9 = aphrodite.StyleSheet.create({
|
|
|
417
416
|
color: "inherit"
|
|
418
417
|
},
|
|
419
418
|
item: {
|
|
420
|
-
backgroundColor:
|
|
419
|
+
backgroundColor: wonderBlocksTokens.color.white,
|
|
421
420
|
minHeight: "unset",
|
|
422
421
|
":focus": focusedStyle,
|
|
423
422
|
":focus-visible": {
|
|
@@ -432,7 +431,7 @@ const styles$9 = aphrodite.StyleSheet.create({
|
|
|
432
431
|
cursor: "not-allowed"
|
|
433
432
|
},
|
|
434
433
|
[":is([aria-disabled=true])"]: {
|
|
435
|
-
color:
|
|
434
|
+
color: wonderBlocksTokens.color.offBlack32,
|
|
436
435
|
":focus-visible": {
|
|
437
436
|
outline: "none"
|
|
438
437
|
}
|
|
@@ -444,8 +443,8 @@ const styles$9 = aphrodite.StyleSheet.create({
|
|
|
444
443
|
}
|
|
445
444
|
},
|
|
446
445
|
[":active[aria-disabled=false]"]: {
|
|
447
|
-
color:
|
|
448
|
-
background:
|
|
446
|
+
color: wonderBlocksTokens.color.fadedBlue,
|
|
447
|
+
background: wonderBlocksTokens.color.activeBlue
|
|
449
448
|
},
|
|
450
449
|
[":hover[aria-disabled=false] .checkbox"]: {
|
|
451
450
|
background: white
|
|
@@ -454,7 +453,7 @@ const styles$9 = aphrodite.StyleSheet.create({
|
|
|
454
453
|
color: blue
|
|
455
454
|
},
|
|
456
455
|
[":active[aria-disabled=false] .check"]: {
|
|
457
|
-
color:
|
|
456
|
+
color: wonderBlocksTokens.color.activeBlue
|
|
458
457
|
},
|
|
459
458
|
[":is([aria-selected=true]) .checkbox"]: {
|
|
460
459
|
background: blue
|
|
@@ -463,23 +462,23 @@ const styles$9 = aphrodite.StyleSheet.create({
|
|
|
463
462
|
color: white
|
|
464
463
|
},
|
|
465
464
|
[":is([aria-disabled=false]) .subtitle"]: {
|
|
466
|
-
color:
|
|
465
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
467
466
|
},
|
|
468
467
|
[":hover[aria-disabled=false] .subtitle"]: {
|
|
469
|
-
color:
|
|
468
|
+
color: wonderBlocksTokens.color.offWhite
|
|
470
469
|
},
|
|
471
470
|
[":active[aria-disabled=false] .subtitle"]: {
|
|
472
|
-
color:
|
|
471
|
+
color: wonderBlocksTokens.mix(wonderBlocksTokens.color.fadedBlue16, white)
|
|
473
472
|
}
|
|
474
473
|
},
|
|
475
474
|
itemFocused: focusedStyle,
|
|
476
475
|
itemDisabled: {
|
|
477
|
-
outlineColor:
|
|
476
|
+
outlineColor: wonderBlocksTokens.color.offBlack32
|
|
478
477
|
},
|
|
479
478
|
itemContainer: {
|
|
480
479
|
minHeight: "unset",
|
|
481
|
-
padding: `${
|
|
482
|
-
paddingRight:
|
|
480
|
+
padding: `${wonderBlocksTokens.spacing.xSmall_8 + wonderBlocksTokens.spacing.xxxxSmall_2}px ${wonderBlocksTokens.spacing.xSmall_8}px`,
|
|
481
|
+
paddingRight: wonderBlocksTokens.spacing.medium_16,
|
|
483
482
|
whiteSpace: "nowrap"
|
|
484
483
|
},
|
|
485
484
|
label: {
|
|
@@ -507,11 +506,11 @@ class SeparatorItem extends React__namespace.Component {
|
|
|
507
506
|
SeparatorItem.__IS_SEPARATOR_ITEM__ = true;
|
|
508
507
|
const styles$8 = aphrodite.StyleSheet.create({
|
|
509
508
|
separator: {
|
|
510
|
-
boxShadow: `0 -1px ${
|
|
509
|
+
boxShadow: `0 -1px ${wonderBlocksTokens.color.offBlack16}`,
|
|
511
510
|
height: 1,
|
|
512
511
|
minHeight: 1,
|
|
513
|
-
marginTop:
|
|
514
|
-
marginBottom:
|
|
512
|
+
marginTop: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
513
|
+
marginBottom: wonderBlocksTokens.spacing.xxxSmall_4
|
|
515
514
|
}
|
|
516
515
|
});
|
|
517
516
|
|
|
@@ -1294,7 +1293,6 @@ class DropdownCore extends React__namespace.Component {
|
|
|
1294
1293
|
"aria-required": ariaRequired,
|
|
1295
1294
|
dropdownStyle,
|
|
1296
1295
|
isFilterable,
|
|
1297
|
-
light,
|
|
1298
1296
|
openerElement,
|
|
1299
1297
|
role,
|
|
1300
1298
|
id
|
|
@@ -1303,7 +1301,7 @@ class DropdownCore extends React__namespace.Component {
|
|
|
1303
1301
|
const minDropdownWidth = openerStyle ? openerStyle.getPropertyValue("width") : 0;
|
|
1304
1302
|
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
1305
1303
|
onMouseUp: this.handleDropdownMouseUp,
|
|
1306
|
-
style: [styles$7.dropdown,
|
|
1304
|
+
style: [styles$7.dropdown, isReferenceHidden && styles$7.hidden, dropdownStyle],
|
|
1307
1305
|
testId: "dropdown-core-container"
|
|
1308
1306
|
}, isFilterable && this.renderSearchField(), React__namespace.createElement(wonderBlocksCore.View, {
|
|
1309
1307
|
id: id,
|
|
@@ -1372,7 +1370,6 @@ DropdownCore.defaultProps = {
|
|
|
1372
1370
|
noResults: defaultLabels.noResults,
|
|
1373
1371
|
someResults: defaultLabels.someSelected
|
|
1374
1372
|
},
|
|
1375
|
-
light: false,
|
|
1376
1373
|
selectionType: "single"
|
|
1377
1374
|
};
|
|
1378
1375
|
const styles$7 = aphrodite.StyleSheet.create({
|
|
@@ -1380,17 +1377,14 @@ const styles$7 = aphrodite.StyleSheet.create({
|
|
|
1380
1377
|
width: "fit-content"
|
|
1381
1378
|
},
|
|
1382
1379
|
dropdown: {
|
|
1383
|
-
backgroundColor:
|
|
1380
|
+
backgroundColor: wonderBlocksTokens.color.white,
|
|
1384
1381
|
borderRadius: 4,
|
|
1385
|
-
paddingTop:
|
|
1386
|
-
paddingBottom:
|
|
1387
|
-
border: `solid 1px ${
|
|
1388
|
-
boxShadow: `0px 8px 8px 0px ${
|
|
1382
|
+
paddingTop: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
1383
|
+
paddingBottom: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
1384
|
+
border: `solid 1px ${wonderBlocksTokens.color.offBlack16}`,
|
|
1385
|
+
boxShadow: `0px 8px 8px 0px ${wonderBlocksTokens.fade(wonderBlocksTokens.color.offBlack, 0.1)}`,
|
|
1389
1386
|
maxHeight: "var(--popper-max-height)"
|
|
1390
1387
|
},
|
|
1391
|
-
light: {
|
|
1392
|
-
border: "none"
|
|
1393
|
-
},
|
|
1394
1388
|
listboxOrMenu: {
|
|
1395
1389
|
overflowY: "auto"
|
|
1396
1390
|
},
|
|
@@ -1399,13 +1393,13 @@ const styles$7 = aphrodite.StyleSheet.create({
|
|
|
1399
1393
|
visibility: "hidden"
|
|
1400
1394
|
},
|
|
1401
1395
|
noResult: {
|
|
1402
|
-
color:
|
|
1396
|
+
color: wonderBlocksTokens.color.offBlack64,
|
|
1403
1397
|
alignSelf: "center",
|
|
1404
|
-
marginTop:
|
|
1398
|
+
marginTop: wonderBlocksTokens.spacing.xxSmall_6
|
|
1405
1399
|
},
|
|
1406
1400
|
searchInputStyle: {
|
|
1407
|
-
margin:
|
|
1408
|
-
marginTop:
|
|
1401
|
+
margin: wonderBlocksTokens.spacing.xSmall_8,
|
|
1402
|
+
marginTop: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
1409
1403
|
minHeight: "auto",
|
|
1410
1404
|
position: "sticky"
|
|
1411
1405
|
},
|
|
@@ -1438,7 +1432,7 @@ class ActionMenuOpenerCore extends React__namespace.Component {
|
|
|
1438
1432
|
"aria-label": ariaLabel
|
|
1439
1433
|
} = _this$props,
|
|
1440
1434
|
restProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded$4);
|
|
1441
|
-
const buttonColor =
|
|
1435
|
+
const buttonColor = wonderBlocksTokens.color.blue;
|
|
1442
1436
|
const buttonStyles = _generateStyles$1(buttonColor);
|
|
1443
1437
|
const disabled = disabledProp;
|
|
1444
1438
|
const defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, buttonStyles.default, disabled && buttonStyles.disabled, !disabled && pressed && buttonStyles.active];
|
|
@@ -1457,7 +1451,7 @@ class ActionMenuOpenerCore extends React__namespace.Component {
|
|
|
1457
1451
|
}), React__namespace.createElement(wonderBlocksCore.View, {
|
|
1458
1452
|
style: !disabled && (hovered || focused) && buttonStyles.focus
|
|
1459
1453
|
}, label), React__namespace.createElement(wonderBlocksLayout.Strut, {
|
|
1460
|
-
size:
|
|
1454
|
+
size: wonderBlocksTokens.spacing.xxxSmall_4
|
|
1461
1455
|
}), React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
1462
1456
|
size: "small",
|
|
1463
1457
|
color: "currentColor",
|
|
@@ -1474,7 +1468,7 @@ const sharedStyles = aphrodite.StyleSheet.create({
|
|
|
1474
1468
|
justifyContent: "center",
|
|
1475
1469
|
height: DROPDOWN_ITEM_HEIGHT,
|
|
1476
1470
|
border: "none",
|
|
1477
|
-
borderRadius:
|
|
1471
|
+
borderRadius: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
1478
1472
|
cursor: "pointer",
|
|
1479
1473
|
outline: "none",
|
|
1480
1474
|
textDecoration: "none",
|
|
@@ -1488,7 +1482,7 @@ const sharedStyles = aphrodite.StyleSheet.create({
|
|
|
1488
1482
|
cursor: "auto"
|
|
1489
1483
|
},
|
|
1490
1484
|
small: {
|
|
1491
|
-
height:
|
|
1485
|
+
height: wonderBlocksTokens.spacing.xLarge_32
|
|
1492
1486
|
},
|
|
1493
1487
|
text: {
|
|
1494
1488
|
textAlign: "left",
|
|
@@ -1516,8 +1510,8 @@ const _generateStyles$1 = localColor => {
|
|
|
1516
1510
|
}
|
|
1517
1511
|
const {
|
|
1518
1512
|
offBlack32
|
|
1519
|
-
} =
|
|
1520
|
-
const activeColor =
|
|
1513
|
+
} = wonderBlocksTokens.color;
|
|
1514
|
+
const activeColor = wonderBlocksTokens.color.activeBlue;
|
|
1521
1515
|
let newStyles = {};
|
|
1522
1516
|
newStyles = {
|
|
1523
1517
|
default: {
|
|
@@ -1717,7 +1711,7 @@ const styles$5 = aphrodite.StyleSheet.create({
|
|
|
1717
1711
|
}
|
|
1718
1712
|
});
|
|
1719
1713
|
|
|
1720
|
-
const _excluded$2 = ["children", "disabled", "error", "id", "isPlaceholder", "
|
|
1714
|
+
const _excluded$2 = ["children", "disabled", "error", "id", "isPlaceholder", "open", "testId", "aria-required", "onBlur", "onOpenChanged"];
|
|
1721
1715
|
const StyledButton = wonderBlocksCore.addStyle("button");
|
|
1722
1716
|
class SelectOpener extends React__namespace.Component {
|
|
1723
1717
|
constructor(props) {
|
|
@@ -1758,16 +1752,15 @@ class SelectOpener extends React__namespace.Component {
|
|
|
1758
1752
|
error,
|
|
1759
1753
|
id,
|
|
1760
1754
|
isPlaceholder,
|
|
1761
|
-
light,
|
|
1762
1755
|
open,
|
|
1763
1756
|
testId,
|
|
1764
1757
|
"aria-required": ariaRequired,
|
|
1765
1758
|
onBlur
|
|
1766
1759
|
} = _this$props,
|
|
1767
1760
|
sharedProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded$2);
|
|
1768
|
-
const stateStyles = _generateStyles(
|
|
1769
|
-
const iconColor =
|
|
1770
|
-
const style = [styles$4.shared, stateStyles.default, disabled && stateStyles.disabled, !disabled && this.state.pressed && stateStyles.
|
|
1761
|
+
const stateStyles = _generateStyles(isPlaceholder, error);
|
|
1762
|
+
const iconColor = disabled ? wonderBlocksTokens.semanticColor.action.disabled.default : wonderBlocksTokens.semanticColor.icon.primary;
|
|
1763
|
+
const style = [styles$4.shared, stateStyles.default, disabled && stateStyles.disabled, !disabled && this.state.pressed && stateStyles.press];
|
|
1771
1764
|
return React__namespace.createElement(StyledButton, _extends__default["default"]({}, sharedProps, {
|
|
1772
1765
|
"aria-disabled": disabled,
|
|
1773
1766
|
"aria-expanded": open ? "true" : "false",
|
|
@@ -1796,7 +1789,6 @@ class SelectOpener extends React__namespace.Component {
|
|
|
1796
1789
|
SelectOpener.defaultProps = {
|
|
1797
1790
|
disabled: false,
|
|
1798
1791
|
error: false,
|
|
1799
|
-
light: false,
|
|
1800
1792
|
isPlaceholder: false
|
|
1801
1793
|
};
|
|
1802
1794
|
const styles$4 = aphrodite.StyleSheet.create({
|
|
@@ -1805,12 +1797,12 @@ const styles$4 = aphrodite.StyleSheet.create({
|
|
|
1805
1797
|
display: "inline-flex",
|
|
1806
1798
|
alignItems: "center",
|
|
1807
1799
|
justifyContent: "space-between",
|
|
1808
|
-
color:
|
|
1800
|
+
color: wonderBlocksTokens.semanticColor.text.primary,
|
|
1809
1801
|
height: DROPDOWN_ITEM_HEIGHT,
|
|
1810
|
-
paddingLeft:
|
|
1811
|
-
paddingRight:
|
|
1802
|
+
paddingLeft: wonderBlocksTokens.spacing.medium_16,
|
|
1803
|
+
paddingRight: wonderBlocksTokens.spacing.small_12,
|
|
1812
1804
|
borderWidth: 0,
|
|
1813
|
-
borderRadius:
|
|
1805
|
+
borderRadius: wonderBlocksTokens.border.radius.medium_4,
|
|
1814
1806
|
borderStyle: "solid",
|
|
1815
1807
|
outline: "none",
|
|
1816
1808
|
textDecoration: "none",
|
|
@@ -1819,7 +1811,7 @@ const styles$4 = aphrodite.StyleSheet.create({
|
|
|
1819
1811
|
touchAction: "manipulation"
|
|
1820
1812
|
},
|
|
1821
1813
|
text: {
|
|
1822
|
-
marginRight:
|
|
1814
|
+
marginRight: wonderBlocksTokens.spacing.xSmall_8,
|
|
1823
1815
|
whiteSpace: "nowrap",
|
|
1824
1816
|
userSelect: "none",
|
|
1825
1817
|
overflow: "hidden",
|
|
@@ -1829,103 +1821,74 @@ const styles$4 = aphrodite.StyleSheet.create({
|
|
|
1829
1821
|
minWidth: 16
|
|
1830
1822
|
}
|
|
1831
1823
|
});
|
|
1832
|
-
const adjustedPaddingLeft = tokens__namespace.spacing.medium_16 - 1;
|
|
1833
|
-
const adjustedPaddingRight = tokens__namespace.spacing.small_12 - 1;
|
|
1834
1824
|
const stateStyles = {};
|
|
1835
|
-
const _generateStyles = (
|
|
1836
|
-
const styleKey = `${
|
|
1825
|
+
const _generateStyles = (placeholder, error) => {
|
|
1826
|
+
const styleKey = `${placeholder}-${error}`;
|
|
1837
1827
|
if (stateStyles[styleKey]) {
|
|
1838
1828
|
return stateStyles[styleKey];
|
|
1839
1829
|
}
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
const focusHoverStyling = {
|
|
1887
|
-
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.blue,
|
|
1888
|
-
borderWidth: tokens__namespace.border.width.thin,
|
|
1889
|
-
paddingLeft: adjustedPaddingLeft,
|
|
1890
|
-
paddingRight: adjustedPaddingRight
|
|
1891
|
-
};
|
|
1892
|
-
const activePressedStyling = {
|
|
1893
|
-
background: error ? tokens__namespace.color.fadedRed : tokens__namespace.color.fadedBlue,
|
|
1894
|
-
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.activeBlue,
|
|
1895
|
-
borderWidth: tokens__namespace.border.width.thin,
|
|
1896
|
-
paddingLeft: adjustedPaddingLeft,
|
|
1897
|
-
paddingRight: adjustedPaddingRight
|
|
1898
|
-
};
|
|
1899
|
-
newStyles = {
|
|
1900
|
-
default: {
|
|
1901
|
-
background: error ? tokens__namespace.color.fadedRed8 : tokens__namespace.color.white,
|
|
1902
|
-
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.offBlack50,
|
|
1903
|
-
borderWidth: tokens__namespace.border.width.hairline,
|
|
1904
|
-
color: placeholder ? tokens__namespace.color.offBlack64 : tokens__namespace.color.offBlack,
|
|
1905
|
-
":hover:not([aria-disabled=true])": focusHoverStyling,
|
|
1906
|
-
["@media not (hover: hover)"]: {
|
|
1907
|
-
":hover:not([aria-disabled=true])": {
|
|
1908
|
-
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.offBlack50,
|
|
1909
|
-
borderWidth: tokens__namespace.border.width.hairline,
|
|
1910
|
-
paddingLeft: tokens__namespace.spacing.medium_16,
|
|
1911
|
-
paddingRight: tokens__namespace.spacing.small_12
|
|
1912
|
-
}
|
|
1913
|
-
},
|
|
1914
|
-
":focus-visible:not([aria-disabled=true])": focusHoverStyling,
|
|
1915
|
-
":active:not([aria-disabled=true])": activePressedStyling
|
|
1916
|
-
},
|
|
1917
|
-
disabled: {
|
|
1918
|
-
background: tokens__namespace.color.offWhite,
|
|
1919
|
-
borderColor: tokens__namespace.color.offBlack16,
|
|
1920
|
-
color: tokens__namespace.color.offBlack64,
|
|
1921
|
-
cursor: "not-allowed",
|
|
1922
|
-
":focus-visible": {
|
|
1923
|
-
boxShadow: `0 0 0 1px ${tokens__namespace.color.white}, 0 0 0 3px ${tokens__namespace.color.offBlack32}`
|
|
1830
|
+
const states = {
|
|
1831
|
+
default: {
|
|
1832
|
+
border: wonderBlocksTokens.semanticColor.border.strong,
|
|
1833
|
+
background: wonderBlocksTokens.semanticColor.surface.primary,
|
|
1834
|
+
foreground: wonderBlocksTokens.semanticColor.text.primary
|
|
1835
|
+
},
|
|
1836
|
+
disabled: {
|
|
1837
|
+
border: wonderBlocksTokens.semanticColor.border.primary,
|
|
1838
|
+
background: wonderBlocksTokens.semanticColor.action.disabled.secondary,
|
|
1839
|
+
foreground: wonderBlocksTokens.semanticColor.text.secondary
|
|
1840
|
+
},
|
|
1841
|
+
error: {
|
|
1842
|
+
border: wonderBlocksTokens.semanticColor.status.critical.foreground,
|
|
1843
|
+
background: wonderBlocksTokens.semanticColor.status.critical.background,
|
|
1844
|
+
foreground: wonderBlocksTokens.semanticColor.text.primary
|
|
1845
|
+
}
|
|
1846
|
+
};
|
|
1847
|
+
const actionType = error ? "destructive" : "progressive";
|
|
1848
|
+
const action = wonderBlocksTokens.semanticColor.action.outlined[actionType];
|
|
1849
|
+
const sharedOutlineStyling = {
|
|
1850
|
+
outlineOffset: -wonderBlocksTokens.border.width.thin,
|
|
1851
|
+
outlineStyle: "solid",
|
|
1852
|
+
outlineWidth: wonderBlocksTokens.border.width.thin
|
|
1853
|
+
};
|
|
1854
|
+
const focusHoverStyling = _extends__default["default"]({
|
|
1855
|
+
outlineColor: action.hover.border
|
|
1856
|
+
}, sharedOutlineStyling);
|
|
1857
|
+
const pressStyling = _extends__default["default"]({
|
|
1858
|
+
background: action.press.background,
|
|
1859
|
+
color: placeholder ? error ? wonderBlocksTokens.semanticColor.text.secondary : wonderBlocksTokens.semanticColor.action.outlined.progressive.press.foreground : wonderBlocksTokens.semanticColor.text.primary,
|
|
1860
|
+
outlineColor: action.press.border
|
|
1861
|
+
}, sharedOutlineStyling);
|
|
1862
|
+
const currentState = error ? states.error : states.default;
|
|
1863
|
+
const newStyles = {
|
|
1864
|
+
default: {
|
|
1865
|
+
background: currentState.background,
|
|
1866
|
+
borderColor: currentState.border,
|
|
1867
|
+
borderWidth: wonderBlocksTokens.border.width.hairline,
|
|
1868
|
+
color: placeholder ? wonderBlocksTokens.semanticColor.text.secondary : currentState.foreground,
|
|
1869
|
+
":hover:not([aria-disabled=true])": focusHoverStyling,
|
|
1870
|
+
["@media not (hover: hover)"]: {
|
|
1871
|
+
":hover:not([aria-disabled=true])": {
|
|
1872
|
+
borderColor: currentState.border,
|
|
1873
|
+
borderWidth: wonderBlocksTokens.border.width.hairline,
|
|
1874
|
+
paddingLeft: wonderBlocksTokens.spacing.medium_16,
|
|
1875
|
+
paddingRight: wonderBlocksTokens.spacing.small_12
|
|
1924
1876
|
}
|
|
1925
1877
|
},
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1878
|
+
":focus-visible:not([aria-disabled=true])": focusHoverStyling,
|
|
1879
|
+
":active:not([aria-disabled=true])": pressStyling
|
|
1880
|
+
},
|
|
1881
|
+
disabled: {
|
|
1882
|
+
background: states.disabled.background,
|
|
1883
|
+
borderColor: states.disabled.border,
|
|
1884
|
+
color: states.disabled.foreground,
|
|
1885
|
+
cursor: "not-allowed",
|
|
1886
|
+
":focus-visible": _extends__default["default"]({
|
|
1887
|
+
outlineColor: wonderBlocksTokens.semanticColor.action.disabled.default
|
|
1888
|
+
}, sharedOutlineStyling)
|
|
1889
|
+
},
|
|
1890
|
+
press: pressStyling
|
|
1891
|
+
};
|
|
1929
1892
|
stateStyles[styleKey] = aphrodite.StyleSheet.create(newStyles);
|
|
1930
1893
|
return stateStyles[styleKey];
|
|
1931
1894
|
};
|
|
@@ -1999,7 +1962,7 @@ function useSelectValidation({
|
|
|
1999
1962
|
};
|
|
2000
1963
|
}
|
|
2001
1964
|
|
|
2002
|
-
const _excluded$1 = ["children", "error", "id", "opener", "
|
|
1965
|
+
const _excluded$1 = ["children", "error", "id", "opener", "placeholder", "selectedValue", "testId", "alignment", "autoFocus", "dropdownStyle", "enableTypeAhead", "isFilterable", "labels", "onChange", "onToggle", "opened", "style", "className", "aria-invalid", "aria-required", "disabled", "dropdownId", "validate", "onValidate", "required", "showOpenerLabelAsText"];
|
|
2003
1966
|
const SingleSelect = props => {
|
|
2004
1967
|
const selectedIndex = React__namespace.useRef(0);
|
|
2005
1968
|
const {
|
|
@@ -2007,7 +1970,6 @@ const SingleSelect = props => {
|
|
|
2007
1970
|
error = false,
|
|
2008
1971
|
id,
|
|
2009
1972
|
opener,
|
|
2010
|
-
light = false,
|
|
2011
1973
|
placeholder,
|
|
2012
1974
|
selectedValue,
|
|
2013
1975
|
testId,
|
|
@@ -2153,7 +2115,6 @@ const SingleSelect = props => {
|
|
|
2153
2115
|
id: uniqueOpenerId,
|
|
2154
2116
|
error: hasError,
|
|
2155
2117
|
isPlaceholder: !selectedItem,
|
|
2156
|
-
light: light,
|
|
2157
2118
|
onOpenChanged: handleOpenChanged,
|
|
2158
2119
|
open: open,
|
|
2159
2120
|
ref: handleOpenerRef,
|
|
@@ -2179,7 +2140,6 @@ const SingleSelect = props => {
|
|
|
2179
2140
|
dropdownStyle: [isFilterable && filterableDropdownStyle, selectDropdownStyle, dropdownStyle],
|
|
2180
2141
|
initialFocusedIndex: selectedIndex.current,
|
|
2181
2142
|
items: items,
|
|
2182
|
-
light: light,
|
|
2183
2143
|
onOpenChanged: handleOpenChanged,
|
|
2184
2144
|
open: open,
|
|
2185
2145
|
opener: renderOpener(isDisabled, uniqueDropdownId),
|
|
@@ -2196,11 +2156,10 @@ const SingleSelect = props => {
|
|
|
2196
2156
|
}));
|
|
2197
2157
|
};
|
|
2198
2158
|
|
|
2199
|
-
const _excluded = ["id", "
|
|
2159
|
+
const _excluded = ["id", "opener", "testId", "alignment", "dropdownStyle", "implicitAllEnabled", "isFilterable", "labels", "onChange", "onToggle", "opened", "selectedValues", "shortcuts", "style", "className", "aria-invalid", "aria-required", "disabled", "error", "children", "dropdownId", "showOpenerLabelAsText", "validate", "onValidate", "required"];
|
|
2200
2160
|
const MultiSelect = props => {
|
|
2201
2161
|
const {
|
|
2202
2162
|
id,
|
|
2203
|
-
light = false,
|
|
2204
2163
|
opener,
|
|
2205
2164
|
testId,
|
|
2206
2165
|
alignment = "left",
|
|
@@ -2436,7 +2395,6 @@ const MultiSelect = props => {
|
|
|
2436
2395
|
id: uniqueOpenerId,
|
|
2437
2396
|
"aria-controls": dropdownId,
|
|
2438
2397
|
isPlaceholder: menuText === noneSelected,
|
|
2439
|
-
light: light,
|
|
2440
2398
|
onOpenChanged: handleOpenChanged,
|
|
2441
2399
|
onBlur: onOpenerBlurValidation,
|
|
2442
2400
|
open: open,
|
|
@@ -2465,7 +2423,6 @@ const MultiSelect = props => {
|
|
|
2465
2423
|
dropdownStyle: [isFilterable && filterableDropdownStyle, selectDropdownStyle, dropdownStyle],
|
|
2466
2424
|
isFilterable: isFilterable,
|
|
2467
2425
|
items: [...getShortcuts(numEnabledOptions), ...filteredItems],
|
|
2468
|
-
light: light,
|
|
2469
2426
|
onOpenChanged: handleOpenChanged,
|
|
2470
2427
|
open: open,
|
|
2471
2428
|
opener: renderOpener(allChildren, isDisabled, uniqueDropdownId),
|
|
@@ -2830,15 +2787,15 @@ const styles$2 = aphrodite.StyleSheet.create({
|
|
|
2830
2787
|
flexWrap: "wrap"
|
|
2831
2788
|
},
|
|
2832
2789
|
pill: {
|
|
2833
|
-
fontSize:
|
|
2790
|
+
fontSize: wonderBlocksTokens.font.size.small,
|
|
2834
2791
|
justifyContent: "space-between",
|
|
2835
2792
|
alignItems: "center",
|
|
2836
|
-
marginBlockStart:
|
|
2837
|
-
marginInlineEnd:
|
|
2838
|
-
paddingInlineEnd:
|
|
2793
|
+
marginBlockStart: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
2794
|
+
marginInlineEnd: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
2795
|
+
paddingInlineEnd: wonderBlocksTokens.spacing.xxxSmall_4
|
|
2839
2796
|
},
|
|
2840
2797
|
pillFocused: {
|
|
2841
|
-
outline: `1px solid ${
|
|
2798
|
+
outline: `1px solid ${wonderBlocksTokens.color.blue}`
|
|
2842
2799
|
}
|
|
2843
2800
|
});
|
|
2844
2801
|
|
|
@@ -2928,7 +2885,7 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
2928
2885
|
outline: "none"
|
|
2929
2886
|
},
|
|
2930
2887
|
disabled: {
|
|
2931
|
-
color:
|
|
2888
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
2932
2889
|
}
|
|
2933
2890
|
});
|
|
2934
2891
|
|
|
@@ -3096,7 +3053,7 @@ function Combobox({
|
|
|
3096
3053
|
const startIconElement = React__namespace.cloneElement(startIcon, _extends__default["default"]({
|
|
3097
3054
|
size: "small"
|
|
3098
3055
|
}, startIcon.props, {
|
|
3099
|
-
color: disabled ?
|
|
3056
|
+
color: disabled ? wonderBlocksTokens.color.offBlack32 : (_startIcon$props$colo = startIcon.props.color) != null ? _startIcon$props$colo : wonderBlocksTokens.semanticColor.icon.primary
|
|
3100
3057
|
}));
|
|
3101
3058
|
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
3102
3059
|
style: styles.iconWrapper
|
|
@@ -3212,24 +3169,24 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
3212
3169
|
width: "100%",
|
|
3213
3170
|
maxWidth: "100%",
|
|
3214
3171
|
flexWrap: "wrap",
|
|
3215
|
-
background:
|
|
3216
|
-
borderRadius:
|
|
3217
|
-
border: `solid 1px ${
|
|
3218
|
-
paddingInline:
|
|
3172
|
+
background: wonderBlocksTokens.color.white,
|
|
3173
|
+
borderRadius: wonderBlocksTokens.border.radius.medium_4,
|
|
3174
|
+
border: `solid 1px ${wonderBlocksTokens.color.offBlack50}`,
|
|
3175
|
+
paddingInline: wonderBlocksTokens.spacing.xSmall_8
|
|
3219
3176
|
},
|
|
3220
3177
|
focused: {
|
|
3221
|
-
background:
|
|
3222
|
-
border: `1px solid ${
|
|
3178
|
+
background: wonderBlocksTokens.color.white,
|
|
3179
|
+
border: `1px solid ${wonderBlocksTokens.color.blue}`
|
|
3223
3180
|
},
|
|
3224
3181
|
disabled: {
|
|
3225
|
-
background:
|
|
3226
|
-
border: `1px solid ${
|
|
3227
|
-
color:
|
|
3182
|
+
background: wonderBlocksTokens.color.offWhite,
|
|
3183
|
+
border: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
|
|
3184
|
+
color: wonderBlocksTokens.color.offBlack64
|
|
3228
3185
|
},
|
|
3229
3186
|
error: {
|
|
3230
|
-
background:
|
|
3231
|
-
border: `1px solid ${
|
|
3232
|
-
color:
|
|
3187
|
+
background: wonderBlocksTokens.color.fadedRed8,
|
|
3188
|
+
border: `1px solid ${wonderBlocksTokens.color.red}`,
|
|
3189
|
+
color: wonderBlocksTokens.color.offBlack
|
|
3233
3190
|
},
|
|
3234
3191
|
combobox: {
|
|
3235
3192
|
appearance: "none",
|
|
@@ -3237,7 +3194,7 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
3237
3194
|
border: "none",
|
|
3238
3195
|
outline: "none",
|
|
3239
3196
|
padding: 0,
|
|
3240
|
-
minWidth:
|
|
3197
|
+
minWidth: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
3241
3198
|
width: "auto",
|
|
3242
3199
|
display: "inline-grid",
|
|
3243
3200
|
gridArea: "1 / 2",
|
|
@@ -3247,10 +3204,10 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
3247
3204
|
}
|
|
3248
3205
|
},
|
|
3249
3206
|
listbox: {
|
|
3250
|
-
backgroundColor:
|
|
3251
|
-
borderRadius:
|
|
3252
|
-
border: `solid 1px ${
|
|
3253
|
-
boxShadow: `0px ${
|
|
3207
|
+
backgroundColor: wonderBlocksTokens.color.white,
|
|
3208
|
+
borderRadius: wonderBlocksTokens.border.radius.medium_4,
|
|
3209
|
+
border: `solid 1px ${wonderBlocksTokens.color.offBlack16}`,
|
|
3210
|
+
boxShadow: `0px ${wonderBlocksTokens.spacing.xSmall_8}px ${wonderBlocksTokens.spacing.xSmall_8}px 0px ${wonderBlocksTokens.color.offBlack8}`,
|
|
3254
3211
|
maxHeight: "var(--popper-max-height)",
|
|
3255
3212
|
overflowY: "auto"
|
|
3256
3213
|
},
|
|
@@ -3260,18 +3217,18 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
3260
3217
|
},
|
|
3261
3218
|
button: {
|
|
3262
3219
|
position: "absolute",
|
|
3263
|
-
right:
|
|
3264
|
-
top:
|
|
3220
|
+
right: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
3221
|
+
top: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
3265
3222
|
margin: 0
|
|
3266
3223
|
},
|
|
3267
3224
|
buttonOpen: {
|
|
3268
3225
|
transform: "rotate(180deg)"
|
|
3269
3226
|
},
|
|
3270
3227
|
clearButton: {
|
|
3271
|
-
right:
|
|
3228
|
+
right: wonderBlocksTokens.spacing.xLarge_32 + wonderBlocksTokens.spacing.xSmall_8
|
|
3272
3229
|
},
|
|
3273
3230
|
iconWrapper: {
|
|
3274
|
-
padding:
|
|
3231
|
+
padding: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
3275
3232
|
minWidth: "auto"
|
|
3276
3233
|
}
|
|
3277
3234
|
});
|