@atlaskit/react-select 1.4.0 → 1.4.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 +16 -0
- package/dist/cjs/accessibility/index.js +9 -7
- package/dist/cjs/components/containers.js +9 -7
- package/dist/cjs/components/control.js +58 -13
- package/dist/cjs/components/group.js +11 -11
- package/dist/cjs/components/indicators.js +39 -34
- package/dist/cjs/components/input.js +1 -1
- package/dist/cjs/components/internal/a11y-text.js +2 -0
- package/dist/cjs/components/live-region.js +6 -3
- package/dist/cjs/components/menu.js +4 -5
- package/dist/cjs/components/multi-value.js +86 -30
- package/dist/cjs/components/option.js +38 -13
- package/dist/cjs/components/placeholder.js +3 -6
- package/dist/cjs/components/single-value.js +3 -6
- package/dist/cjs/select.js +105 -54
- package/dist/es2019/accessibility/index.js +9 -7
- package/dist/es2019/components/containers.js +8 -8
- package/dist/es2019/components/control.js +71 -24
- package/dist/es2019/components/group.js +10 -18
- package/dist/es2019/components/indicators.js +25 -28
- package/dist/es2019/components/input.js +1 -1
- package/dist/es2019/components/internal/a11y-text.js +2 -0
- package/dist/es2019/components/live-region.js +6 -2
- package/dist/es2019/components/menu.js +6 -11
- package/dist/es2019/components/multi-value.js +89 -30
- package/dist/es2019/components/option.js +48 -22
- package/dist/es2019/components/placeholder.js +3 -7
- package/dist/es2019/components/single-value.js +3 -5
- package/dist/es2019/select.js +74 -24
- package/dist/esm/accessibility/index.js +9 -7
- package/dist/esm/components/containers.js +9 -7
- package/dist/esm/components/control.js +58 -13
- package/dist/esm/components/group.js +11 -11
- package/dist/esm/components/indicators.js +39 -34
- package/dist/esm/components/input.js +1 -1
- package/dist/esm/components/internal/a11y-text.js +2 -0
- package/dist/esm/components/live-region.js +6 -2
- package/dist/esm/components/menu.js +4 -5
- package/dist/esm/components/multi-value.js +86 -30
- package/dist/esm/components/option.js +38 -13
- package/dist/esm/components/placeholder.js +3 -6
- package/dist/esm/components/single-value.js +3 -6
- package/dist/esm/select.js +105 -53
- package/dist/types/components/containers.d.ts +5 -1
- package/dist/types/components/control.d.ts +10 -1
- package/dist/types/components/group.d.ts +2 -2
- package/dist/types/components/indicators.d.ts +16 -4
- package/dist/types/components/menu.d.ts +1 -1
- package/dist/types/components/multi-value.d.ts +3 -3
- package/dist/types/components/option.d.ts +1 -1
- package/dist/types/components/placeholder.d.ts +1 -1
- package/dist/types/components/single-value.d.ts +1 -1
- package/dist/types/select.d.ts +13 -4
- package/dist/types-ts4.5/components/containers.d.ts +5 -1
- package/dist/types-ts4.5/components/control.d.ts +10 -1
- package/dist/types-ts4.5/components/group.d.ts +2 -2
- package/dist/types-ts4.5/components/indicators.d.ts +16 -4
- package/dist/types-ts4.5/components/menu.d.ts +1 -1
- package/dist/types-ts4.5/components/multi-value.d.ts +3 -3
- package/dist/types-ts4.5/components/option.d.ts +1 -1
- package/dist/types-ts4.5/components/placeholder.d.ts +1 -1
- package/dist/types-ts4.5/components/single-value.d.ts +1 -1
- package/dist/types-ts4.5/select.d.ts +13 -4
- package/package.json +6 -2
package/dist/es2019/select.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
3
4
|
import React, { Component } from 'react';
|
|
4
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { isAppleDevice, isSafari } from './accessibility/helpers';
|
|
@@ -13,7 +14,8 @@ import { defaultStyles } from './styles';
|
|
|
13
14
|
import { defaultTheme } from './theme';
|
|
14
15
|
import { classNames, cleanValue, isDocumentElement, isMobileDevice, isTouchCapable, multiValueAsValue, noop, notNullish, scrollIntoView, singleValueAsValue, valueTernary } from './utils';
|
|
15
16
|
export const defaultProps = {
|
|
16
|
-
|
|
17
|
+
// aria-live is by default with the live region so we don't need it
|
|
18
|
+
'aria-live': fg('design_system_select-a11y-improvement') ? undefined : 'polite',
|
|
17
19
|
backspaceRemovesValue: true,
|
|
18
20
|
blurInputOnSelect: isTouchCapable(),
|
|
19
21
|
captureMenuScroll: !isTouchCapable(),
|
|
@@ -225,7 +227,7 @@ export default class Select extends Component {
|
|
|
225
227
|
_defineProperty(this, "initialTouchY", 0);
|
|
226
228
|
_defineProperty(this, "openAfterFocus", false);
|
|
227
229
|
_defineProperty(this, "scrollToFocusedOptionOnUpdate", false);
|
|
228
|
-
_defineProperty(this, "
|
|
230
|
+
_defineProperty(this, "isVoiceOver", fg('design_system_select-a11y-improvement') && isAppleDevice());
|
|
229
231
|
// Refs
|
|
230
232
|
// ------------------------------
|
|
231
233
|
_defineProperty(this, "controlRef", null);
|
|
@@ -732,6 +734,7 @@ export default class Select extends Component {
|
|
|
732
734
|
prevInputValue: inputValue
|
|
733
735
|
});
|
|
734
736
|
this.onMenuClose();
|
|
737
|
+
fg('design_system_select-a11y-improvement') && event.stopPropagation(); // keep ESC on select from dismissing parent layers
|
|
735
738
|
} else if (isClearable && escapeClearsValue) {
|
|
736
739
|
this.clearValue();
|
|
737
740
|
}
|
|
@@ -1177,6 +1180,29 @@ export default class Select extends Component {
|
|
|
1177
1180
|
formatGroupLabel(data) {
|
|
1178
1181
|
return this.props.formatGroupLabel(data);
|
|
1179
1182
|
}
|
|
1183
|
+
calculateDescription(action) {
|
|
1184
|
+
const descriptionProp = this.props['aria-describedby'] || this.props['descriptionId'];
|
|
1185
|
+
const {
|
|
1186
|
+
isMulti
|
|
1187
|
+
} = this.props;
|
|
1188
|
+
const {
|
|
1189
|
+
selectValue
|
|
1190
|
+
} = this.state;
|
|
1191
|
+
const defaultDescription = selectValue.length ? this.getElementId('live-region') : this.getElementId('placeholder');
|
|
1192
|
+
if (selectValue.length && action !== 'initial-input-focus') {
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
if (isMulti && isAppleDevice() && !isSafari()) {
|
|
1196
|
+
// chrome only friends
|
|
1197
|
+
return {
|
|
1198
|
+
'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription, this.getElementId('multi-message')].join(' ') : [defaultDescription, this.getElementId('multi-message')].join(' ')
|
|
1199
|
+
};
|
|
1200
|
+
} else {
|
|
1201
|
+
return {
|
|
1202
|
+
'aria-describedby': descriptionProp ? [descriptionProp, defaultDescription].join(' ') : defaultDescription
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1180
1206
|
// ==============================
|
|
1181
1207
|
// Composition Handlers
|
|
1182
1208
|
// ==============================
|
|
@@ -1251,32 +1277,31 @@ export default class Select extends Component {
|
|
|
1251
1277
|
commonProps
|
|
1252
1278
|
} = this;
|
|
1253
1279
|
const id = inputId || this.getElementId('input');
|
|
1254
|
-
const description = this.props['aria-describedby'] || descriptionId;
|
|
1255
1280
|
|
|
1256
1281
|
// aria attributes makes the JSX "noisy", separated for clarity
|
|
1257
1282
|
const ariaAttributes = {
|
|
1258
1283
|
'aria-autocomplete': 'both',
|
|
1259
1284
|
'aria-errormessage': this.props['aria-errormessage'],
|
|
1260
1285
|
'aria-expanded': menuIsOpen,
|
|
1286
|
+
// TODO: aria-haspopup is implied as listbox with role="combobox" and was deprecated for aria 1.2, we still might need to keep it for back compat
|
|
1261
1287
|
'aria-haspopup': 'listbox',
|
|
1262
|
-
'aria-describedby':
|
|
1288
|
+
'aria-describedby': this.props['aria-describedby'] || descriptionId,
|
|
1263
1289
|
'aria-invalid': this.props['aria-invalid'] || isInvalid,
|
|
1264
1290
|
'aria-label': this.props['aria-label'] || label,
|
|
1265
1291
|
'aria-labelledby': this.props['aria-labelledby'] || labelId,
|
|
1266
1292
|
'aria-required': required || isRequired,
|
|
1267
1293
|
role: 'combobox',
|
|
1268
1294
|
'aria-activedescendant': this.state.focusedOptionId || undefined,
|
|
1295
|
+
// Safari needs aria-owns in order for aria-activedescendant to work properly
|
|
1296
|
+
'aria-owns': isSafari() && fg('design_system_select-a11y-improvement') ? this.getElementId('listbox') : undefined,
|
|
1269
1297
|
...(menuIsOpen && {
|
|
1270
1298
|
'aria-controls': this.getElementId('listbox')
|
|
1271
1299
|
}),
|
|
1300
|
+
// TODO: Might need to remove this
|
|
1272
1301
|
...(!isSearchable && {
|
|
1273
1302
|
'aria-readonly': true
|
|
1274
1303
|
}),
|
|
1275
|
-
...
|
|
1276
|
-
'aria-describedby': description ? [description, this.getElementId('live-region')].join(' ') : this.getElementId('live-region')
|
|
1277
|
-
} : {
|
|
1278
|
-
'aria-describedby': description ? [description, this.getElementId('placeholder')].join(' ') : this.getElementId('placeholder')
|
|
1279
|
-
})
|
|
1304
|
+
...this.calculateDescription(ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action)
|
|
1280
1305
|
};
|
|
1281
1306
|
if (!isSearchable) {
|
|
1282
1307
|
// use a dummy input to maintain focus/blur functionality
|
|
@@ -1389,7 +1414,8 @@ export default class Select extends Component {
|
|
|
1389
1414
|
const {
|
|
1390
1415
|
clearControlLabel,
|
|
1391
1416
|
isDisabled,
|
|
1392
|
-
isLoading
|
|
1417
|
+
isLoading,
|
|
1418
|
+
spacing
|
|
1393
1419
|
} = this.props;
|
|
1394
1420
|
const {
|
|
1395
1421
|
isFocused
|
|
@@ -1402,11 +1428,13 @@ export default class Select extends Component {
|
|
|
1402
1428
|
onTouchEnd: this.onClearIndicatorTouchEnd,
|
|
1403
1429
|
'aria-hidden': 'true'
|
|
1404
1430
|
};
|
|
1431
|
+
const isCompact = spacing === 'compact';
|
|
1405
1432
|
return /*#__PURE__*/React.createElement(ClearIndicator, _extends({
|
|
1406
1433
|
clearControlLabel: clearControlLabel
|
|
1407
1434
|
}, commonProps, {
|
|
1408
1435
|
innerProps: innerProps,
|
|
1409
|
-
isFocused: isFocused
|
|
1436
|
+
isFocused: isFocused,
|
|
1437
|
+
isCompact: isCompact
|
|
1410
1438
|
}));
|
|
1411
1439
|
}
|
|
1412
1440
|
renderLoadingIndicator() {
|
|
@@ -1418,7 +1446,8 @@ export default class Select extends Component {
|
|
|
1418
1446
|
} = this;
|
|
1419
1447
|
const {
|
|
1420
1448
|
isDisabled,
|
|
1421
|
-
isLoading
|
|
1449
|
+
isLoading,
|
|
1450
|
+
spacing
|
|
1422
1451
|
} = this.props;
|
|
1423
1452
|
const {
|
|
1424
1453
|
isFocused
|
|
@@ -1426,13 +1455,15 @@ export default class Select extends Component {
|
|
|
1426
1455
|
if (!LoadingIndicator || !isLoading) {
|
|
1427
1456
|
return null;
|
|
1428
1457
|
}
|
|
1458
|
+
const isCompact = spacing === 'compact';
|
|
1429
1459
|
const innerProps = {
|
|
1430
1460
|
'aria-hidden': 'true'
|
|
1431
1461
|
};
|
|
1432
1462
|
return /*#__PURE__*/React.createElement(LoadingIndicator, _extends({}, commonProps, {
|
|
1433
1463
|
innerProps: innerProps,
|
|
1434
1464
|
isDisabled: isDisabled,
|
|
1435
|
-
isFocused: isFocused
|
|
1465
|
+
isFocused: isFocused,
|
|
1466
|
+
isCompact: isCompact
|
|
1436
1467
|
}));
|
|
1437
1468
|
}
|
|
1438
1469
|
renderIndicatorSeparator() {
|
|
@@ -1470,11 +1501,13 @@ export default class Select extends Component {
|
|
|
1470
1501
|
commonProps
|
|
1471
1502
|
} = this;
|
|
1472
1503
|
const {
|
|
1473
|
-
isDisabled
|
|
1504
|
+
isDisabled,
|
|
1505
|
+
spacing
|
|
1474
1506
|
} = this.props;
|
|
1475
1507
|
const {
|
|
1476
1508
|
isFocused
|
|
1477
1509
|
} = this.state;
|
|
1510
|
+
const isCompact = spacing === 'compact';
|
|
1478
1511
|
const innerProps = {
|
|
1479
1512
|
onMouseDown: this.onDropdownIndicatorMouseDown,
|
|
1480
1513
|
onTouchEnd: this.onDropdownIndicatorTouchEnd,
|
|
@@ -1483,7 +1516,8 @@ export default class Select extends Component {
|
|
|
1483
1516
|
return /*#__PURE__*/React.createElement(DropdownIndicator, _extends({}, commonProps, {
|
|
1484
1517
|
innerProps: innerProps,
|
|
1485
1518
|
isDisabled: isDisabled,
|
|
1486
|
-
isFocused: isFocused
|
|
1519
|
+
isFocused: isFocused,
|
|
1520
|
+
isCompact: isCompact
|
|
1487
1521
|
}));
|
|
1488
1522
|
}
|
|
1489
1523
|
renderMenu() {
|
|
@@ -1546,7 +1580,10 @@ export default class Select extends Component {
|
|
|
1546
1580
|
onMouseMove: onHover,
|
|
1547
1581
|
onMouseOver: onHover,
|
|
1548
1582
|
role: 'option',
|
|
1549
|
-
'aria-selected
|
|
1583
|
+
// We don't want aria-selected on Apple devices or if it's false. It does nasty things.
|
|
1584
|
+
'aria-selected': (!commonProps.isMulti || this.isVoiceOver || !isSelected) && fg('design_system_select-a11y-improvement') ? undefined : isSelected,
|
|
1585
|
+
// We don't want aria-disabled on Apple devices or if it's false. It's just noisy.
|
|
1586
|
+
'aria-disabled': (isAppleDevice() || !isDisabled) && fg('design_system_select-a11y-improvement') ? undefined : isDisabled,
|
|
1550
1587
|
'aria-describedby': fg('design_system_select-a11y-improvement') ? headingId : undefined
|
|
1551
1588
|
};
|
|
1552
1589
|
return /*#__PURE__*/React.createElement(Option, _extends({}, commonProps, {
|
|
@@ -1640,13 +1677,12 @@ export default class Select extends Component {
|
|
|
1640
1677
|
},
|
|
1641
1678
|
innerProps: {
|
|
1642
1679
|
role: 'listbox',
|
|
1643
|
-
|
|
1644
|
-
'aria-multiselectable': fg('design_system_select-a11y-improvement') ? commonProps.isMulti || undefined : commonProps.isMulti,
|
|
1680
|
+
'aria-multiselectable': (this.isVoiceOver || !commonProps.isMulti) && fg('design_system_select-a11y-improvement') ? undefined : commonProps.isMulti,
|
|
1645
1681
|
id: this.getElementId('listbox'),
|
|
1646
1682
|
// add aditional label on listbox when ff is on
|
|
1647
1683
|
...(fg('design_system_select-a11y-improvement') && {
|
|
1648
1684
|
'aria-label': label,
|
|
1649
|
-
'aria-labelledby': labelId
|
|
1685
|
+
'aria-labelledby': `${labelId || this.getElementId('input')} ${commonProps.isMulti && isSafari() ? this.getElementId('multi-message') : ''}`
|
|
1650
1686
|
})
|
|
1651
1687
|
},
|
|
1652
1688
|
isLoading: isLoading,
|
|
@@ -1734,9 +1770,15 @@ export default class Select extends Component {
|
|
|
1734
1770
|
isFocused: isFocused,
|
|
1735
1771
|
selectValue: selectValue,
|
|
1736
1772
|
focusableOptions: focusableOptions,
|
|
1737
|
-
isAppleDevice: this.
|
|
1773
|
+
isAppleDevice: this.isVoiceOver
|
|
1738
1774
|
}));
|
|
1739
1775
|
}
|
|
1776
|
+
renderMultiselectMessage() {
|
|
1777
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
1778
|
+
id: this.getElementId('multi-message'),
|
|
1779
|
+
hidden: true
|
|
1780
|
+
}, ", multiple selections available,");
|
|
1781
|
+
}
|
|
1740
1782
|
render() {
|
|
1741
1783
|
const {
|
|
1742
1784
|
Control,
|
|
@@ -1748,12 +1790,16 @@ export default class Select extends Component {
|
|
|
1748
1790
|
className,
|
|
1749
1791
|
id,
|
|
1750
1792
|
isDisabled,
|
|
1751
|
-
menuIsOpen
|
|
1793
|
+
menuIsOpen,
|
|
1794
|
+
isInvalid,
|
|
1795
|
+
appearance = 'default',
|
|
1796
|
+
spacing = 'default'
|
|
1752
1797
|
} = this.props;
|
|
1753
1798
|
const {
|
|
1754
1799
|
isFocused
|
|
1755
1800
|
} = this.state;
|
|
1756
1801
|
const commonProps = this.commonProps = this.getCommonProps();
|
|
1802
|
+
const isCompact = spacing === 'compact';
|
|
1757
1803
|
return /*#__PURE__*/React.createElement(SelectContainer, _extends({}, commonProps, {
|
|
1758
1804
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
1759
1805
|
className: className,
|
|
@@ -1763,17 +1809,21 @@ export default class Select extends Component {
|
|
|
1763
1809
|
},
|
|
1764
1810
|
isDisabled: isDisabled,
|
|
1765
1811
|
isFocused: isFocused
|
|
1766
|
-
}), this.renderLiveRegion(), /*#__PURE__*/React.createElement(Control, _extends({}, commonProps, {
|
|
1812
|
+
}), this.renderLiveRegion(), commonProps.isMulti && this.isVoiceOver && this.renderMultiselectMessage(), /*#__PURE__*/React.createElement(Control, _extends({}, commonProps, {
|
|
1767
1813
|
innerRef: this.getControlRef,
|
|
1768
1814
|
innerProps: {
|
|
1769
1815
|
onMouseDown: this.onControlMouseDown,
|
|
1770
1816
|
onTouchEnd: this.onControlTouchEnd
|
|
1771
1817
|
},
|
|
1818
|
+
appearance: appearance,
|
|
1819
|
+
isInvalid: isInvalid,
|
|
1772
1820
|
isDisabled: isDisabled,
|
|
1773
1821
|
isFocused: isFocused,
|
|
1774
|
-
menuIsOpen: menuIsOpen
|
|
1822
|
+
menuIsOpen: menuIsOpen,
|
|
1823
|
+
isCompact: isCompact
|
|
1775
1824
|
}), /*#__PURE__*/React.createElement(ValueContainer, _extends({}, commonProps, {
|
|
1776
|
-
isDisabled: isDisabled
|
|
1825
|
+
isDisabled: isDisabled,
|
|
1826
|
+
isCompact: isCompact
|
|
1777
1827
|
}), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/React.createElement(IndicatorsContainer, _extends({}, commonProps, {
|
|
1778
1828
|
isDisabled: isDisabled
|
|
1779
1829
|
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
2
|
+
|
|
1
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
4
|
export var defaultAriaLiveMessages = {
|
|
3
5
|
guidance: function guidance(props) {
|
|
@@ -27,11 +29,12 @@ export var defaultAriaLiveMessages = {
|
|
|
27
29
|
case 'deselect-option':
|
|
28
30
|
case 'pop-value':
|
|
29
31
|
case 'remove-value':
|
|
30
|
-
return "option ".concat(label, ", deselected
|
|
32
|
+
return label.length && fg('design_system_select-a11y-improvement') || !fg('design_system_select-a11y-improvement') ? "option ".concat(label, ", deselected") : '';
|
|
33
|
+
// TODO: this should be handled on backspace|delete if no value, but doing it here first
|
|
31
34
|
case 'clear':
|
|
32
35
|
return 'All selected options have been cleared.';
|
|
33
36
|
case 'initial-input-focus':
|
|
34
|
-
return "option".concat(labels.length > 1 ? 's' : '', " ").concat(labels.join(','), ", selected.");
|
|
37
|
+
return label.length && fg('design_system_select-a11y-improvement') || !fg('design_system_select-a11y-improvement') ? "option".concat(labels.length > 1 ? 's' : '', " ").concat(labels.join(','), ", selected.") : '';
|
|
35
38
|
case 'select-option':
|
|
36
39
|
return isDisabled ? "option ".concat(label, " is disabled. Select another option.") : "option ".concat(label, ", selected.");
|
|
37
40
|
default:
|
|
@@ -45,7 +48,6 @@ export var defaultAriaLiveMessages = {
|
|
|
45
48
|
_props$label2 = props.label,
|
|
46
49
|
label = _props$label2 === void 0 ? '' : _props$label2,
|
|
47
50
|
selectValue = props.selectValue,
|
|
48
|
-
isMulti = props.isMulti,
|
|
49
51
|
isDisabled = props.isDisabled,
|
|
50
52
|
isSelected = props.isSelected;
|
|
51
53
|
var getArrayIndex = function getArrayIndex(arr, item) {
|
|
@@ -54,11 +56,11 @@ export var defaultAriaLiveMessages = {
|
|
|
54
56
|
if (context === 'value' && selectValue) {
|
|
55
57
|
return "value ".concat(label, " focused, ").concat(getArrayIndex(selectValue, focused), ".");
|
|
56
58
|
}
|
|
57
|
-
|
|
59
|
+
|
|
60
|
+
// No longer needed after fg('design_system_select-a11y-improvement') is cleaned up
|
|
61
|
+
if (context === 'menu' && !fg('design_system_select-a11y-improvement')) {
|
|
58
62
|
var disabled = isDisabled ? ' disabled' : '';
|
|
59
|
-
|
|
60
|
-
var notSelectedStatus = !isMulti && fg('design_system_select-a11y-improvement') ? '' : ' not selected';
|
|
61
|
-
var status = "".concat(isSelected ? ' selected' : notSelectedStatus).concat(disabled);
|
|
63
|
+
var status = "".concat(isSelected ? ' selected' : ' not selected').concat(disabled);
|
|
62
64
|
return "".concat(label).concat(status, ", ").concat(getArrayIndex(options, focused), ", completion selected");
|
|
63
65
|
}
|
|
64
66
|
return '';
|
|
@@ -17,9 +17,10 @@ export var containerCSS = function containerCSS(_ref) {
|
|
|
17
17
|
return {
|
|
18
18
|
label: 'container',
|
|
19
19
|
direction: isRtl ? 'rtl' : undefined,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
position: 'relative',
|
|
21
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
22
|
+
pointerEvents: 'all',
|
|
23
|
+
cursor: isDisabled ? 'not-allowed' : undefined
|
|
23
24
|
};
|
|
24
25
|
};
|
|
25
26
|
|
|
@@ -40,9 +41,9 @@ export var SelectContainer = function SelectContainer(props) {
|
|
|
40
41
|
// ==============================
|
|
41
42
|
|
|
42
43
|
export var valueContainerCSS = function valueContainerCSS(_ref2) {
|
|
43
|
-
var
|
|
44
|
-
isMulti = _ref2.isMulti,
|
|
44
|
+
var isMulti = _ref2.isMulti,
|
|
45
45
|
hasValue = _ref2.hasValue,
|
|
46
|
+
isCompact = _ref2.isCompact,
|
|
46
47
|
controlShouldRenderValue = _ref2.selectProps.controlShouldRenderValue;
|
|
47
48
|
return {
|
|
48
49
|
alignItems: 'center',
|
|
@@ -52,7 +53,7 @@ export var valueContainerCSS = function valueContainerCSS(_ref2) {
|
|
|
52
53
|
WebkitOverflowScrolling: 'touch',
|
|
53
54
|
position: 'relative',
|
|
54
55
|
overflow: 'hidden',
|
|
55
|
-
padding: "".concat(
|
|
56
|
+
padding: "".concat(isCompact ? 0 : "var(--ds-space-025, 2px)", " ", "var(--ds-space-075, 6px)")
|
|
56
57
|
};
|
|
57
58
|
};
|
|
58
59
|
|
|
@@ -84,7 +85,8 @@ export var indicatorsContainerCSS = function indicatorsContainerCSS() {
|
|
|
84
85
|
alignItems: 'center',
|
|
85
86
|
alignSelf: 'stretch',
|
|
86
87
|
display: 'flex',
|
|
87
|
-
flexShrink: 0
|
|
88
|
+
flexShrink: 0,
|
|
89
|
+
paddingRight: "var(--ds-space-050, 4px)"
|
|
88
90
|
};
|
|
89
91
|
};
|
|
90
92
|
|
|
@@ -9,10 +9,33 @@ import { getStyleProps } from '../utils';
|
|
|
9
9
|
export var css = function css(_ref) {
|
|
10
10
|
var isDisabled = _ref.isDisabled,
|
|
11
11
|
isFocused = _ref.isFocused,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
isInvalid = _ref.isInvalid,
|
|
13
|
+
isCompact = _ref.isCompact,
|
|
14
|
+
appearance = _ref.appearance;
|
|
15
|
+
var borderColor = isFocused ? "var(--ds-border-focused, #388BFF)" : "var(--ds-border-input, #8590A2)";
|
|
16
|
+
var backgroundColor = isFocused ? "var(--ds-background-input-pressed, #FFFFFF)" : "var(--ds-background-input, #FFFFFF)";
|
|
17
|
+
var backgroundColorHover = isFocused ? "var(--ds-background-input-pressed, #FFFFFF)" : "var(--ds-background-input-hovered, #F7F8F9)";
|
|
18
|
+
var borderColorHover = isFocused ? "var(--ds-border-focused, #388BFF)" : "var(--ds-border-input, #8590A2)";
|
|
19
|
+
if (isDisabled) {
|
|
20
|
+
backgroundColor = "var(--ds-background-disabled, #091E4208)";
|
|
21
|
+
borderColor = "var(--ds-background-disabled, #091E4208)";
|
|
22
|
+
}
|
|
23
|
+
if (isInvalid) {
|
|
24
|
+
borderColor = "var(--ds-border-danger, #E2483D)";
|
|
25
|
+
borderColorHover = "var(--ds-border-danger, #E2483D)";
|
|
26
|
+
}
|
|
27
|
+
var transitionDuration = '200ms';
|
|
28
|
+
if (appearance === 'subtle') {
|
|
29
|
+
borderColor = isFocused ? "var(--ds-border-focused, #388BFF)" : 'transparent';
|
|
30
|
+
backgroundColor = isFocused ? "var(--ds-surface, #FFFFFF)" : 'transparent';
|
|
31
|
+
backgroundColorHover = isFocused ? "var(--ds-background-input-pressed, #FFFFFF)" : "var(--ds-background-input-hovered, #F7F8F9)";
|
|
32
|
+
}
|
|
33
|
+
if (appearance === 'none') {
|
|
34
|
+
borderColor = 'transparent';
|
|
35
|
+
backgroundColor = 'transparent';
|
|
36
|
+
backgroundColorHover = 'transparent';
|
|
37
|
+
borderColorHover = 'transparent';
|
|
38
|
+
}
|
|
16
39
|
return {
|
|
17
40
|
label: 'control',
|
|
18
41
|
alignItems: 'center',
|
|
@@ -20,18 +43,40 @@ export var css = function css(_ref) {
|
|
|
20
43
|
display: 'flex',
|
|
21
44
|
flexWrap: 'wrap',
|
|
22
45
|
justifyContent: 'space-between',
|
|
23
|
-
minHeight: spacing.controlHeight,
|
|
24
46
|
outline: '0 !important',
|
|
25
47
|
position: 'relative',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
48
|
+
// Turn pointer events off when disabled - this makes it so hover etc don't work.
|
|
49
|
+
pointerEvents: isDisabled ? 'none' : undefined,
|
|
50
|
+
backgroundColor: backgroundColor,
|
|
51
|
+
borderColor: borderColor,
|
|
30
52
|
borderStyle: 'solid',
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
'
|
|
34
|
-
|
|
53
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
54
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
55
|
+
boxShadow: isInvalid ? "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", borderColor) : 'none',
|
|
56
|
+
'&:focus-within': {
|
|
57
|
+
boxShadow: "inset 0 0 0 ".concat("var(--ds-border-width, 1px)", " ", borderColor)
|
|
58
|
+
},
|
|
59
|
+
minHeight: isCompact ? 32 : 40,
|
|
60
|
+
padding: 0,
|
|
61
|
+
transition: "background-color ".concat(transitionDuration, " ease-in-out,\nborder-color ").concat(transitionDuration, " ease-in-out"),
|
|
62
|
+
'::-webkit-scrollbar': {
|
|
63
|
+
height: 8,
|
|
64
|
+
width: 8
|
|
65
|
+
},
|
|
66
|
+
'::-webkit-scrollbar-corner': {
|
|
67
|
+
display: 'none'
|
|
68
|
+
},
|
|
69
|
+
':hover': {
|
|
70
|
+
'::-webkit-scrollbar-thumb': {
|
|
71
|
+
// scrollbars occur only if the user passes in a custom component with overflow: scroll
|
|
72
|
+
backgroundColor: 'rgba(0,0,0,0.2)'
|
|
73
|
+
},
|
|
74
|
+
cursor: 'pointer',
|
|
75
|
+
backgroundColor: backgroundColorHover,
|
|
76
|
+
borderColor: borderColorHover
|
|
77
|
+
},
|
|
78
|
+
'::-webkit-scrollbar-thumb:hover': {
|
|
79
|
+
backgroundColor: 'rgba(0,0,0,0.4)'
|
|
35
80
|
}
|
|
36
81
|
};
|
|
37
82
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
3
4
|
var _excluded = ["data"];
|
|
4
5
|
/**
|
|
5
6
|
* @jsxRuntime classic
|
|
@@ -9,10 +10,10 @@ var _excluded = ["data"];
|
|
|
9
10
|
import { jsx } from '@emotion/react';
|
|
10
11
|
import { cleanCommonProps, getStyleProps } from '../utils';
|
|
11
12
|
export var groupCSS = function groupCSS(_ref) {
|
|
12
|
-
|
|
13
|
+
_objectDestructuringEmpty(_ref);
|
|
13
14
|
return {
|
|
14
|
-
paddingBottom:
|
|
15
|
-
paddingTop:
|
|
15
|
+
paddingBottom: "var(--ds-space-100, 8px)",
|
|
16
|
+
paddingTop: "var(--ds-space-100, 8px)"
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
var Group = function Group(props) {
|
|
@@ -39,20 +40,19 @@ var Group = function Group(props) {
|
|
|
39
40
|
}), label), jsx("div", null, children));
|
|
40
41
|
};
|
|
41
42
|
export var groupHeadingCSS = function groupHeadingCSS(_ref2) {
|
|
42
|
-
|
|
43
|
-
colors = _ref2$theme.colors,
|
|
44
|
-
spacing = _ref2$theme.spacing;
|
|
43
|
+
_objectDestructuringEmpty(_ref2);
|
|
45
44
|
return {
|
|
46
45
|
label: 'group',
|
|
47
46
|
cursor: 'default',
|
|
48
47
|
display: 'block',
|
|
49
|
-
color: colors.neutral40,
|
|
50
48
|
fontSize: '75%',
|
|
51
|
-
fontWeight: 500,
|
|
52
49
|
marginBottom: '0.25em',
|
|
53
|
-
paddingLeft:
|
|
54
|
-
paddingRight:
|
|
55
|
-
|
|
50
|
+
paddingLeft: "var(--ds-space-150, 12px)",
|
|
51
|
+
paddingRight: "var(--ds-space-150, 12px)",
|
|
52
|
+
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
53
|
+
color: "var(--ds-text-subtle, #44546F)",
|
|
54
|
+
fontWeight: "var(--ds-font-weight-bold, 700)".concat(" !important"),
|
|
55
|
+
textTransform: 'none'
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
|
|
@@ -64,23 +64,20 @@ export var DownChevron = function DownChevron(props) {
|
|
|
64
64
|
// Dropdown & Clear Buttons
|
|
65
65
|
// ==============================
|
|
66
66
|
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
baseUnit = _ref2$theme.spacing.baseUnit,
|
|
71
|
-
colors = _ref2$theme.colors;
|
|
67
|
+
export var dropdownIndicatorCSS = function dropdownIndicatorCSS(_ref2) {
|
|
68
|
+
var isCompact = _ref2.isCompact,
|
|
69
|
+
isDisabled = _ref2.isDisabled;
|
|
72
70
|
return {
|
|
73
71
|
label: 'indicatorContainer',
|
|
74
72
|
display: 'flex',
|
|
75
73
|
transition: 'color 150ms',
|
|
76
|
-
color:
|
|
77
|
-
padding:
|
|
74
|
+
color: isDisabled ? "var(--ds-text-disabled, #091E424F)" : "var(--ds-text-subtle, #44546F)",
|
|
75
|
+
padding: "".concat(isCompact ? 0 : "var(--ds-space-075, 6px)", " ", "var(--ds-space-025, 2px)"),
|
|
78
76
|
':hover': {
|
|
79
|
-
color:
|
|
77
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
80
78
|
}
|
|
81
79
|
};
|
|
82
80
|
};
|
|
83
|
-
export var dropdownIndicatorCSS = baseCSS;
|
|
84
81
|
|
|
85
82
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
86
83
|
export var DropdownIndicator = function DropdownIndicator(props) {
|
|
@@ -91,7 +88,19 @@ export var DropdownIndicator = function DropdownIndicator(props) {
|
|
|
91
88
|
'dropdown-indicator': true
|
|
92
89
|
}), innerProps), children || jsx(DownChevron, null));
|
|
93
90
|
};
|
|
94
|
-
export var clearIndicatorCSS =
|
|
91
|
+
export var clearIndicatorCSS = function clearIndicatorCSS(_ref3) {
|
|
92
|
+
var isCompact = _ref3.isCompact;
|
|
93
|
+
return {
|
|
94
|
+
label: 'indicatorContainer',
|
|
95
|
+
display: 'flex',
|
|
96
|
+
transition: 'color 150ms',
|
|
97
|
+
color: "var(--ds-text-subtlest, #626F86)",
|
|
98
|
+
padding: "".concat(isCompact ? 0 : "var(--ds-space-075, 6px)", " ", "var(--ds-space-025, 2px)"),
|
|
99
|
+
':hover': {
|
|
100
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
};
|
|
95
104
|
|
|
96
105
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
97
106
|
export var ClearIndicator = function ClearIndicator(props) {
|
|
@@ -107,18 +116,15 @@ export var ClearIndicator = function ClearIndicator(props) {
|
|
|
107
116
|
// Separator
|
|
108
117
|
// ==============================
|
|
109
118
|
|
|
110
|
-
export var indicatorSeparatorCSS = function indicatorSeparatorCSS(
|
|
111
|
-
var isDisabled =
|
|
112
|
-
_ref3$theme = _ref3.theme,
|
|
113
|
-
baseUnit = _ref3$theme.spacing.baseUnit,
|
|
114
|
-
colors = _ref3$theme.colors;
|
|
119
|
+
export var indicatorSeparatorCSS = function indicatorSeparatorCSS(_ref4) {
|
|
120
|
+
var isDisabled = _ref4.isDisabled;
|
|
115
121
|
return {
|
|
116
122
|
label: 'indicatorSeparator',
|
|
117
123
|
alignSelf: 'stretch',
|
|
118
124
|
width: 1,
|
|
119
|
-
backgroundColor: isDisabled ?
|
|
120
|
-
marginBottom:
|
|
121
|
-
marginTop:
|
|
125
|
+
backgroundColor: isDisabled ? "var(--ds-border-disabled, #091E420F)" : "var(--ds-border, #091E4224)",
|
|
126
|
+
marginBottom: "var(--ds-space-100, 8px)",
|
|
127
|
+
marginTop: "var(--ds-space-100, 8px)"
|
|
122
128
|
};
|
|
123
129
|
};
|
|
124
130
|
|
|
@@ -142,12 +148,11 @@ var loadingDotAnimations = keyframes({
|
|
|
142
148
|
opacity: 1
|
|
143
149
|
}
|
|
144
150
|
});
|
|
145
|
-
export var loadingIndicatorCSS = function loadingIndicatorCSS(
|
|
146
|
-
var isFocused =
|
|
147
|
-
size =
|
|
148
|
-
|
|
149
|
-
colors =
|
|
150
|
-
baseUnit = _ref4$theme.spacing.baseUnit;
|
|
151
|
+
export var loadingIndicatorCSS = function loadingIndicatorCSS(_ref5) {
|
|
152
|
+
var isFocused = _ref5.isFocused,
|
|
153
|
+
size = _ref5.size,
|
|
154
|
+
isCompact = _ref5.isCompact,
|
|
155
|
+
colors = _ref5.theme.colors;
|
|
151
156
|
return {
|
|
152
157
|
label: 'loadingIndicator',
|
|
153
158
|
display: 'flex',
|
|
@@ -159,12 +164,12 @@ export var loadingIndicatorCSS = function loadingIndicatorCSS(_ref4) {
|
|
|
159
164
|
textAlign: 'center',
|
|
160
165
|
verticalAlign: 'middle',
|
|
161
166
|
color: isFocused ? colors.neutral60 : colors.neutral20,
|
|
162
|
-
padding:
|
|
167
|
+
padding: "".concat(isCompact ? 0 : "var(--ds-space-075, 6px)", " ", "var(--ds-space-100, 8px)")
|
|
163
168
|
};
|
|
164
169
|
};
|
|
165
|
-
var LoadingDot = function LoadingDot(
|
|
166
|
-
var delay =
|
|
167
|
-
offset =
|
|
170
|
+
var LoadingDot = function LoadingDot(_ref6) {
|
|
171
|
+
var delay = _ref6.delay,
|
|
172
|
+
offset = _ref6.offset;
|
|
168
173
|
return jsx("span", {
|
|
169
174
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
170
175
|
css: {
|
|
@@ -180,12 +185,12 @@ var LoadingDot = function LoadingDot(_ref5) {
|
|
|
180
185
|
});
|
|
181
186
|
};
|
|
182
187
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
183
|
-
export var LoadingIndicator = function LoadingIndicator(
|
|
184
|
-
var innerProps =
|
|
185
|
-
isRtl =
|
|
186
|
-
|
|
187
|
-
size =
|
|
188
|
-
restProps = _objectWithoutProperties(
|
|
188
|
+
export var LoadingIndicator = function LoadingIndicator(_ref7) {
|
|
189
|
+
var innerProps = _ref7.innerProps,
|
|
190
|
+
isRtl = _ref7.isRtl,
|
|
191
|
+
_ref7$size = _ref7.size,
|
|
192
|
+
size = _ref7$size === void 0 ? 4 : _ref7$size,
|
|
193
|
+
restProps = _objectWithoutProperties(_ref7, _excluded2);
|
|
189
194
|
return jsx("div", _extends({}, getStyleProps(_objectSpread(_objectSpread({}, restProps), {}, {
|
|
190
195
|
innerProps: innerProps,
|
|
191
196
|
isRtl: isRtl,
|
|
@@ -26,7 +26,7 @@ export var inputCSS = function inputCSS(_ref) {
|
|
|
26
26
|
margin: spacing.baseUnit / 2,
|
|
27
27
|
paddingBottom: spacing.baseUnit / 2,
|
|
28
28
|
paddingTop: spacing.baseUnit / 2,
|
|
29
|
-
color:
|
|
29
|
+
color: "var(--ds-text, hsl(0, 0%, 20%))"
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
var spacingStyle = {
|
|
@@ -16,6 +16,8 @@ var styles = css({
|
|
|
16
16
|
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
17
17
|
label: 'a11yText',
|
|
18
18
|
overflow: 'hidden',
|
|
19
|
+
userSelect: 'none',
|
|
20
|
+
// while hidden text is sitting in the DOM, it should not be selectable
|
|
19
21
|
whiteSpace: 'nowrap'
|
|
20
22
|
});
|
|
21
23
|
var A11yText = function A11yText(props) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
4
5
|
/**
|
|
5
6
|
* @jsxRuntime classic
|
|
6
7
|
* @jsx jsx
|
|
@@ -165,8 +166,11 @@ var LiveRegion = function LiveRegion(props) {
|
|
|
165
166
|
return jsx(Fragment, null, jsx(A11yText, {
|
|
166
167
|
id: id
|
|
167
168
|
}, isInitialFocus && ScreenReaderText), jsx(A11yText, {
|
|
168
|
-
"aria-live":
|
|
169
|
-
|
|
169
|
+
"aria-live": ariaLive // Should be undefined by default unless a specific use case requires it
|
|
170
|
+
,
|
|
171
|
+
"aria-atomic": fg('design_system_select-a11y-improvement') ? undefined : 'false',
|
|
172
|
+
"aria-relevant": fg('design_system_select-a11y-improvement') ? undefined : 'additions text',
|
|
173
|
+
role: fg('design_system_select-a11y-improvement') ? 'status' : 'log'
|
|
170
174
|
}, isFocused && !isInitialFocus && ScreenReaderText));
|
|
171
175
|
};
|
|
172
176
|
|