@atlaskit/react-select 1.4.0 → 1.4.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 +8 -0
- 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/menu.js +4 -5
- package/dist/cjs/components/multi-value.js +86 -30
- package/dist/cjs/components/option.js +31 -10
- package/dist/cjs/components/placeholder.js +3 -6
- package/dist/cjs/components/single-value.js +3 -6
- package/dist/cjs/select.js +57 -37
- 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/menu.js +6 -11
- package/dist/es2019/components/multi-value.js +89 -30
- package/dist/es2019/components/option.js +41 -19
- package/dist/es2019/components/placeholder.js +3 -7
- package/dist/es2019/components/single-value.js +3 -5
- package/dist/es2019/select.js +26 -9
- 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/menu.js +4 -5
- package/dist/esm/components/multi-value.js +86 -30
- package/dist/esm/components/option.js +31 -10
- package/dist/esm/components/placeholder.js +3 -6
- package/dist/esm/components/single-value.js +3 -6
- package/dist/esm/select.js +57 -37
- 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 +5 -0
- 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 +5 -0
- package/package.json +5 -1
package/dist/cjs/select.js
CHANGED
|
@@ -1381,7 +1381,8 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1381
1381
|
var _this$props10 = this.props,
|
|
1382
1382
|
clearControlLabel = _this$props10.clearControlLabel,
|
|
1383
1383
|
isDisabled = _this$props10.isDisabled,
|
|
1384
|
-
isLoading = _this$props10.isLoading
|
|
1384
|
+
isLoading = _this$props10.isLoading,
|
|
1385
|
+
spacing = _this$props10.spacing;
|
|
1385
1386
|
var isFocused = this.state.isFocused;
|
|
1386
1387
|
if (!this.isClearable() || !ClearIndicator || isDisabled || !this.hasValue() || isLoading) {
|
|
1387
1388
|
return null;
|
|
@@ -1391,11 +1392,13 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1391
1392
|
onTouchEnd: this.onClearIndicatorTouchEnd,
|
|
1392
1393
|
'aria-hidden': 'true'
|
|
1393
1394
|
};
|
|
1395
|
+
var isCompact = spacing === 'compact';
|
|
1394
1396
|
return /*#__PURE__*/_react.default.createElement(ClearIndicator, (0, _extends2.default)({
|
|
1395
1397
|
clearControlLabel: clearControlLabel
|
|
1396
1398
|
}, commonProps, {
|
|
1397
1399
|
innerProps: innerProps,
|
|
1398
|
-
isFocused: isFocused
|
|
1400
|
+
isFocused: isFocused,
|
|
1401
|
+
isCompact: isCompact
|
|
1399
1402
|
}));
|
|
1400
1403
|
}
|
|
1401
1404
|
}, {
|
|
@@ -1406,18 +1409,21 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1406
1409
|
var commonProps = this.commonProps;
|
|
1407
1410
|
var _this$props11 = this.props,
|
|
1408
1411
|
isDisabled = _this$props11.isDisabled,
|
|
1409
|
-
isLoading = _this$props11.isLoading
|
|
1412
|
+
isLoading = _this$props11.isLoading,
|
|
1413
|
+
spacing = _this$props11.spacing;
|
|
1410
1414
|
var isFocused = this.state.isFocused;
|
|
1411
1415
|
if (!LoadingIndicator || !isLoading) {
|
|
1412
1416
|
return null;
|
|
1413
1417
|
}
|
|
1418
|
+
var isCompact = spacing === 'compact';
|
|
1414
1419
|
var innerProps = {
|
|
1415
1420
|
'aria-hidden': 'true'
|
|
1416
1421
|
};
|
|
1417
1422
|
return /*#__PURE__*/_react.default.createElement(LoadingIndicator, (0, _extends2.default)({}, commonProps, {
|
|
1418
1423
|
innerProps: innerProps,
|
|
1419
1424
|
isDisabled: isDisabled,
|
|
1420
|
-
isFocused: isFocused
|
|
1425
|
+
isFocused: isFocused,
|
|
1426
|
+
isCompact: isCompact
|
|
1421
1427
|
}));
|
|
1422
1428
|
}
|
|
1423
1429
|
}, {
|
|
@@ -1448,8 +1454,11 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1448
1454
|
return null;
|
|
1449
1455
|
}
|
|
1450
1456
|
var commonProps = this.commonProps;
|
|
1451
|
-
var
|
|
1457
|
+
var _this$props12 = this.props,
|
|
1458
|
+
isDisabled = _this$props12.isDisabled,
|
|
1459
|
+
spacing = _this$props12.spacing;
|
|
1452
1460
|
var isFocused = this.state.isFocused;
|
|
1461
|
+
var isCompact = spacing === 'compact';
|
|
1453
1462
|
var innerProps = {
|
|
1454
1463
|
onMouseDown: this.onDropdownIndicatorMouseDown,
|
|
1455
1464
|
onTouchEnd: this.onDropdownIndicatorTouchEnd,
|
|
@@ -1458,7 +1467,8 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1458
1467
|
return /*#__PURE__*/_react.default.createElement(DropdownIndicator, (0, _extends2.default)({}, commonProps, {
|
|
1459
1468
|
innerProps: innerProps,
|
|
1460
1469
|
isDisabled: isDisabled,
|
|
1461
|
-
isFocused: isFocused
|
|
1470
|
+
isFocused: isFocused,
|
|
1471
|
+
isCompact: isCompact
|
|
1462
1472
|
}));
|
|
1463
1473
|
}
|
|
1464
1474
|
}, {
|
|
@@ -1476,24 +1486,24 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1476
1486
|
Option = _this$getComponents7.Option;
|
|
1477
1487
|
var commonProps = this.commonProps;
|
|
1478
1488
|
var focusedOption = this.state.focusedOption;
|
|
1479
|
-
var _this$
|
|
1480
|
-
captureMenuScroll = _this$
|
|
1481
|
-
inputValue = _this$
|
|
1482
|
-
isLoading = _this$
|
|
1483
|
-
loadingMessage = _this$
|
|
1484
|
-
minMenuHeight = _this$
|
|
1485
|
-
maxMenuHeight = _this$
|
|
1486
|
-
menuIsOpen = _this$
|
|
1487
|
-
menuPlacement = _this$
|
|
1488
|
-
menuPosition = _this$
|
|
1489
|
-
menuPortalTarget = _this$
|
|
1490
|
-
menuShouldBlockScroll = _this$
|
|
1491
|
-
menuShouldScrollIntoView = _this$
|
|
1492
|
-
noOptionsMessage = _this$
|
|
1493
|
-
onMenuScrollToTop = _this$
|
|
1494
|
-
onMenuScrollToBottom = _this$
|
|
1495
|
-
labelId = _this$
|
|
1496
|
-
label = _this$
|
|
1489
|
+
var _this$props13 = this.props,
|
|
1490
|
+
captureMenuScroll = _this$props13.captureMenuScroll,
|
|
1491
|
+
inputValue = _this$props13.inputValue,
|
|
1492
|
+
isLoading = _this$props13.isLoading,
|
|
1493
|
+
loadingMessage = _this$props13.loadingMessage,
|
|
1494
|
+
minMenuHeight = _this$props13.minMenuHeight,
|
|
1495
|
+
maxMenuHeight = _this$props13.maxMenuHeight,
|
|
1496
|
+
menuIsOpen = _this$props13.menuIsOpen,
|
|
1497
|
+
menuPlacement = _this$props13.menuPlacement,
|
|
1498
|
+
menuPosition = _this$props13.menuPosition,
|
|
1499
|
+
menuPortalTarget = _this$props13.menuPortalTarget,
|
|
1500
|
+
menuShouldBlockScroll = _this$props13.menuShouldBlockScroll,
|
|
1501
|
+
menuShouldScrollIntoView = _this$props13.menuShouldScrollIntoView,
|
|
1502
|
+
noOptionsMessage = _this$props13.noOptionsMessage,
|
|
1503
|
+
onMenuScrollToTop = _this$props13.onMenuScrollToTop,
|
|
1504
|
+
onMenuScrollToBottom = _this$props13.onMenuScrollToBottom,
|
|
1505
|
+
labelId = _this$props13.labelId,
|
|
1506
|
+
label = _this$props13.label;
|
|
1497
1507
|
if (!menuIsOpen) {
|
|
1498
1508
|
return null;
|
|
1499
1509
|
}
|
|
@@ -1642,12 +1652,12 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1642
1652
|
key: "renderFormField",
|
|
1643
1653
|
value: function renderFormField() {
|
|
1644
1654
|
var _this5 = this;
|
|
1645
|
-
var _this$
|
|
1646
|
-
delimiter = _this$
|
|
1647
|
-
isDisabled = _this$
|
|
1648
|
-
isMulti = _this$
|
|
1649
|
-
required = _this$
|
|
1650
|
-
name = _this$
|
|
1655
|
+
var _this$props14 = this.props,
|
|
1656
|
+
delimiter = _this$props14.delimiter,
|
|
1657
|
+
isDisabled = _this$props14.isDisabled,
|
|
1658
|
+
isMulti = _this$props14.isMulti,
|
|
1659
|
+
required = _this$props14.required,
|
|
1660
|
+
name = _this$props14.name;
|
|
1651
1661
|
var selectValue = this.state.selectValue;
|
|
1652
1662
|
if (required && !this.hasValue() && !isDisabled) {
|
|
1653
1663
|
return /*#__PURE__*/_react.default.createElement(_internal.RequiredInput, {
|
|
@@ -1722,13 +1732,19 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1722
1732
|
IndicatorsContainer = _this$getComponents8.IndicatorsContainer,
|
|
1723
1733
|
SelectContainer = _this$getComponents8.SelectContainer,
|
|
1724
1734
|
ValueContainer = _this$getComponents8.ValueContainer;
|
|
1725
|
-
var _this$
|
|
1726
|
-
className = _this$
|
|
1727
|
-
id = _this$
|
|
1728
|
-
isDisabled = _this$
|
|
1729
|
-
menuIsOpen = _this$
|
|
1735
|
+
var _this$props15 = this.props,
|
|
1736
|
+
className = _this$props15.className,
|
|
1737
|
+
id = _this$props15.id,
|
|
1738
|
+
isDisabled = _this$props15.isDisabled,
|
|
1739
|
+
menuIsOpen = _this$props15.menuIsOpen,
|
|
1740
|
+
isInvalid = _this$props15.isInvalid,
|
|
1741
|
+
_this$props15$appeara = _this$props15.appearance,
|
|
1742
|
+
appearance = _this$props15$appeara === void 0 ? 'default' : _this$props15$appeara,
|
|
1743
|
+
_this$props15$spacing = _this$props15.spacing,
|
|
1744
|
+
spacing = _this$props15$spacing === void 0 ? 'default' : _this$props15$spacing;
|
|
1730
1745
|
var isFocused = this.state.isFocused;
|
|
1731
1746
|
var commonProps = this.commonProps = this.getCommonProps();
|
|
1747
|
+
var isCompact = spacing === 'compact';
|
|
1732
1748
|
return /*#__PURE__*/_react.default.createElement(SelectContainer, (0, _extends2.default)({}, commonProps, {
|
|
1733
1749
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
1734
1750
|
className: className,
|
|
@@ -1744,11 +1760,15 @@ var Select = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
1744
1760
|
onMouseDown: this.onControlMouseDown,
|
|
1745
1761
|
onTouchEnd: this.onControlTouchEnd
|
|
1746
1762
|
},
|
|
1763
|
+
appearance: appearance,
|
|
1764
|
+
isInvalid: isInvalid,
|
|
1747
1765
|
isDisabled: isDisabled,
|
|
1748
1766
|
isFocused: isFocused,
|
|
1749
|
-
menuIsOpen: menuIsOpen
|
|
1767
|
+
menuIsOpen: menuIsOpen,
|
|
1768
|
+
isCompact: isCompact
|
|
1750
1769
|
}), /*#__PURE__*/_react.default.createElement(ValueContainer, (0, _extends2.default)({}, commonProps, {
|
|
1751
|
-
isDisabled: isDisabled
|
|
1770
|
+
isDisabled: isDisabled,
|
|
1771
|
+
isCompact: isCompact
|
|
1752
1772
|
}), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/_react.default.createElement(IndicatorsContainer, (0, _extends2.default)({}, commonProps, {
|
|
1753
1773
|
isDisabled: isDisabled
|
|
1754
1774
|
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
|
|
@@ -17,9 +17,10 @@ export const containerCSS = ({
|
|
|
17
17
|
}) => ({
|
|
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
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -41,11 +42,9 @@ export const SelectContainer = props => {
|
|
|
41
42
|
// ==============================
|
|
42
43
|
|
|
43
44
|
export const valueContainerCSS = ({
|
|
44
|
-
theme: {
|
|
45
|
-
spacing
|
|
46
|
-
},
|
|
47
45
|
isMulti,
|
|
48
46
|
hasValue,
|
|
47
|
+
isCompact,
|
|
49
48
|
selectProps: {
|
|
50
49
|
controlShouldRenderValue
|
|
51
50
|
}
|
|
@@ -57,7 +56,7 @@ export const valueContainerCSS = ({
|
|
|
57
56
|
WebkitOverflowScrolling: 'touch',
|
|
58
57
|
position: 'relative',
|
|
59
58
|
overflow: 'hidden',
|
|
60
|
-
padding: `${
|
|
59
|
+
padding: `${isCompact ? 0 : "var(--ds-space-025, 2px)"} ${"var(--ds-space-075, 6px)"}`
|
|
61
60
|
});
|
|
62
61
|
|
|
63
62
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -89,7 +88,8 @@ export const indicatorsContainerCSS = () => ({
|
|
|
89
88
|
alignItems: 'center',
|
|
90
89
|
alignSelf: 'stretch',
|
|
91
90
|
display: 'flex',
|
|
92
|
-
flexShrink: 0
|
|
91
|
+
flexShrink: 0,
|
|
92
|
+
paddingRight: "var(--ds-space-050, 4px)"
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -9,32 +9,79 @@ import { getStyleProps } from '../utils';
|
|
|
9
9
|
export const css = ({
|
|
10
10
|
isDisabled,
|
|
11
11
|
isFocused,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
isInvalid,
|
|
13
|
+
isCompact,
|
|
14
|
+
appearance
|
|
15
|
+
}) => {
|
|
16
|
+
let borderColor = isFocused ? "var(--ds-border-focused, #388BFF)" : "var(--ds-border-input, #8590A2)";
|
|
17
|
+
let backgroundColor = isFocused ? "var(--ds-background-input-pressed, #FFFFFF)" : "var(--ds-background-input, #FFFFFF)";
|
|
18
|
+
let backgroundColorHover = isFocused ? "var(--ds-background-input-pressed, #FFFFFF)" : "var(--ds-background-input-hovered, #F7F8F9)";
|
|
19
|
+
let borderColorHover = isFocused ? "var(--ds-border-focused, #388BFF)" : "var(--ds-border-input, #8590A2)";
|
|
20
|
+
if (isDisabled) {
|
|
21
|
+
backgroundColor = "var(--ds-background-disabled, #091E4208)";
|
|
22
|
+
borderColor = "var(--ds-background-disabled, #091E4208)";
|
|
16
23
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
cursor: 'default',
|
|
21
|
-
display: 'flex',
|
|
22
|
-
flexWrap: 'wrap',
|
|
23
|
-
justifyContent: 'space-between',
|
|
24
|
-
minHeight: spacing.controlHeight,
|
|
25
|
-
outline: '0 !important',
|
|
26
|
-
position: 'relative',
|
|
27
|
-
transition: 'all 100ms',
|
|
28
|
-
backgroundColor: isDisabled ? colors.neutral5 : colors.neutral0,
|
|
29
|
-
borderColor: isDisabled ? colors.neutral10 : isFocused ? colors.primary : colors.neutral20,
|
|
30
|
-
borderRadius: borderRadius,
|
|
31
|
-
borderStyle: 'solid',
|
|
32
|
-
borderWidth: 1,
|
|
33
|
-
boxShadow: isFocused ? `0 0 0 1px ${colors.primary}` : undefined,
|
|
34
|
-
'&:hover': {
|
|
35
|
-
borderColor: isFocused ? colors.primary : colors.neutral30
|
|
24
|
+
if (isInvalid) {
|
|
25
|
+
borderColor = "var(--ds-border-danger, #E2483D)";
|
|
26
|
+
borderColorHover = "var(--ds-border-danger, #E2483D)";
|
|
36
27
|
}
|
|
37
|
-
|
|
28
|
+
const transitionDuration = '200ms';
|
|
29
|
+
if (appearance === 'subtle') {
|
|
30
|
+
borderColor = isFocused ? "var(--ds-border-focused, #388BFF)" : 'transparent';
|
|
31
|
+
backgroundColor = isFocused ? "var(--ds-surface, #FFFFFF)" : 'transparent';
|
|
32
|
+
backgroundColorHover = isFocused ? "var(--ds-background-input-pressed, #FFFFFF)" : "var(--ds-background-input-hovered, #F7F8F9)";
|
|
33
|
+
}
|
|
34
|
+
if (appearance === 'none') {
|
|
35
|
+
borderColor = 'transparent';
|
|
36
|
+
backgroundColor = 'transparent';
|
|
37
|
+
backgroundColorHover = 'transparent';
|
|
38
|
+
borderColorHover = 'transparent';
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
label: 'control',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
cursor: 'default',
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexWrap: 'wrap',
|
|
46
|
+
justifyContent: 'space-between',
|
|
47
|
+
outline: '0 !important',
|
|
48
|
+
position: 'relative',
|
|
49
|
+
// Turn pointer events off when disabled - this makes it so hover etc don't work.
|
|
50
|
+
pointerEvents: isDisabled ? 'none' : undefined,
|
|
51
|
+
backgroundColor,
|
|
52
|
+
borderColor,
|
|
53
|
+
borderStyle: 'solid',
|
|
54
|
+
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
55
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
56
|
+
boxShadow: isInvalid ? `inset 0 0 0 ${"var(--ds-border-width, 1px)"} ${borderColor}` : 'none',
|
|
57
|
+
'&:focus-within': {
|
|
58
|
+
boxShadow: `inset 0 0 0 ${"var(--ds-border-width, 1px)"} ${borderColor}`
|
|
59
|
+
},
|
|
60
|
+
minHeight: isCompact ? 32 : 40,
|
|
61
|
+
padding: 0,
|
|
62
|
+
transition: `background-color ${transitionDuration} ease-in-out,
|
|
63
|
+
border-color ${transitionDuration} ease-in-out`,
|
|
64
|
+
'::-webkit-scrollbar': {
|
|
65
|
+
height: 8,
|
|
66
|
+
width: 8
|
|
67
|
+
},
|
|
68
|
+
'::-webkit-scrollbar-corner': {
|
|
69
|
+
display: 'none'
|
|
70
|
+
},
|
|
71
|
+
':hover': {
|
|
72
|
+
'::-webkit-scrollbar-thumb': {
|
|
73
|
+
// scrollbars occur only if the user passes in a custom component with overflow: scroll
|
|
74
|
+
backgroundColor: 'rgba(0,0,0,0.2)'
|
|
75
|
+
},
|
|
76
|
+
cursor: 'pointer',
|
|
77
|
+
backgroundColor: backgroundColorHover,
|
|
78
|
+
borderColor: borderColorHover
|
|
79
|
+
},
|
|
80
|
+
'::-webkit-scrollbar-thumb:hover': {
|
|
81
|
+
backgroundColor: 'rgba(0,0,0,0.4)'
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
};
|
|
38
85
|
const Control = props => {
|
|
39
86
|
const {
|
|
40
87
|
children,
|
|
@@ -6,13 +6,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
6
6
|
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { cleanCommonProps, getStyleProps } from '../utils';
|
|
9
|
-
export const groupCSS = ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
}) => ({
|
|
14
|
-
paddingBottom: spacing.baseUnit * 2,
|
|
15
|
-
paddingTop: spacing.baseUnit * 2
|
|
9
|
+
export const groupCSS = ({}) => ({
|
|
10
|
+
paddingBottom: "var(--ds-space-100, 8px)",
|
|
11
|
+
paddingTop: "var(--ds-space-100, 8px)"
|
|
16
12
|
});
|
|
17
13
|
const Group = props => {
|
|
18
14
|
const {
|
|
@@ -39,22 +35,18 @@ const Group = props => {
|
|
|
39
35
|
cx: cx
|
|
40
36
|
}), label), jsx("div", null, children));
|
|
41
37
|
};
|
|
42
|
-
export const groupHeadingCSS = ({
|
|
43
|
-
theme: {
|
|
44
|
-
colors,
|
|
45
|
-
spacing
|
|
46
|
-
}
|
|
47
|
-
}) => ({
|
|
38
|
+
export const groupHeadingCSS = ({}) => ({
|
|
48
39
|
label: 'group',
|
|
49
40
|
cursor: 'default',
|
|
50
41
|
display: 'block',
|
|
51
|
-
color: colors.neutral40,
|
|
52
42
|
fontSize: '75%',
|
|
53
|
-
fontWeight: 500,
|
|
54
43
|
marginBottom: '0.25em',
|
|
55
|
-
paddingLeft:
|
|
56
|
-
paddingRight:
|
|
57
|
-
|
|
44
|
+
paddingLeft: "var(--ds-space-150, 12px)",
|
|
45
|
+
paddingRight: "var(--ds-space-150, 12px)",
|
|
46
|
+
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)",
|
|
47
|
+
color: "var(--ds-text-subtle, #44546F)",
|
|
48
|
+
fontWeight: `${"var(--ds-font-weight-bold, 700)"} !important`,
|
|
49
|
+
textTransform: 'none'
|
|
58
50
|
});
|
|
59
51
|
|
|
60
52
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -51,25 +51,19 @@ jsx(Svg, _extends({
|
|
|
51
51
|
// Dropdown & Clear Buttons
|
|
52
52
|
// ==============================
|
|
53
53
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
spacing: {
|
|
58
|
-
baseUnit
|
|
59
|
-
},
|
|
60
|
-
colors
|
|
61
|
-
}
|
|
54
|
+
export const dropdownIndicatorCSS = ({
|
|
55
|
+
isCompact,
|
|
56
|
+
isDisabled
|
|
62
57
|
}) => ({
|
|
63
58
|
label: 'indicatorContainer',
|
|
64
59
|
display: 'flex',
|
|
65
60
|
transition: 'color 150ms',
|
|
66
|
-
color:
|
|
67
|
-
padding:
|
|
61
|
+
color: isDisabled ? "var(--ds-text-disabled, #091E424F)" : "var(--ds-text-subtle, #44546F)",
|
|
62
|
+
padding: `${isCompact ? 0 : "var(--ds-space-075, 6px)"} ${"var(--ds-space-025, 2px)"}`,
|
|
68
63
|
':hover': {
|
|
69
|
-
color:
|
|
64
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
70
65
|
}
|
|
71
66
|
});
|
|
72
|
-
export const dropdownIndicatorCSS = baseCSS;
|
|
73
67
|
|
|
74
68
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
75
69
|
export const DropdownIndicator = props => {
|
|
@@ -82,7 +76,18 @@ export const DropdownIndicator = props => {
|
|
|
82
76
|
'dropdown-indicator': true
|
|
83
77
|
}), innerProps), children || jsx(DownChevron, null));
|
|
84
78
|
};
|
|
85
|
-
export const clearIndicatorCSS =
|
|
79
|
+
export const clearIndicatorCSS = ({
|
|
80
|
+
isCompact
|
|
81
|
+
}) => ({
|
|
82
|
+
label: 'indicatorContainer',
|
|
83
|
+
display: 'flex',
|
|
84
|
+
transition: 'color 150ms',
|
|
85
|
+
color: "var(--ds-text-subtlest, #626F86)",
|
|
86
|
+
padding: `${isCompact ? 0 : "var(--ds-space-075, 6px)"} ${"var(--ds-space-025, 2px)"}`,
|
|
87
|
+
':hover': {
|
|
88
|
+
color: "var(--ds-text-subtle, #44546F)"
|
|
89
|
+
}
|
|
90
|
+
});
|
|
86
91
|
|
|
87
92
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
88
93
|
export const ClearIndicator = props => {
|
|
@@ -101,20 +106,14 @@ export const ClearIndicator = props => {
|
|
|
101
106
|
// ==============================
|
|
102
107
|
|
|
103
108
|
export const indicatorSeparatorCSS = ({
|
|
104
|
-
isDisabled
|
|
105
|
-
theme: {
|
|
106
|
-
spacing: {
|
|
107
|
-
baseUnit
|
|
108
|
-
},
|
|
109
|
-
colors
|
|
110
|
-
}
|
|
109
|
+
isDisabled
|
|
111
110
|
}) => ({
|
|
112
111
|
label: 'indicatorSeparator',
|
|
113
112
|
alignSelf: 'stretch',
|
|
114
113
|
width: 1,
|
|
115
|
-
backgroundColor: isDisabled ?
|
|
116
|
-
marginBottom:
|
|
117
|
-
marginTop:
|
|
114
|
+
backgroundColor: isDisabled ? "var(--ds-border-disabled, #091E420F)" : "var(--ds-border, #091E4224)",
|
|
115
|
+
marginBottom: "var(--ds-space-100, 8px)",
|
|
116
|
+
marginTop: "var(--ds-space-100, 8px)"
|
|
118
117
|
});
|
|
119
118
|
|
|
120
119
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -142,11 +141,9 @@ const loadingDotAnimations = keyframes({
|
|
|
142
141
|
export const loadingIndicatorCSS = ({
|
|
143
142
|
isFocused,
|
|
144
143
|
size,
|
|
144
|
+
isCompact,
|
|
145
145
|
theme: {
|
|
146
|
-
colors
|
|
147
|
-
spacing: {
|
|
148
|
-
baseUnit
|
|
149
|
-
}
|
|
146
|
+
colors
|
|
150
147
|
}
|
|
151
148
|
}) => ({
|
|
152
149
|
label: 'loadingIndicator',
|
|
@@ -159,7 +156,7 @@ export const loadingIndicatorCSS = ({
|
|
|
159
156
|
textAlign: 'center',
|
|
160
157
|
verticalAlign: 'middle',
|
|
161
158
|
color: isFocused ? colors.neutral60 : colors.neutral20,
|
|
162
|
-
padding:
|
|
159
|
+
padding: `${isCompact ? 0 : "var(--ds-space-075, 6px)"} ${"var(--ds-space-100, 8px)"}`
|
|
163
160
|
});
|
|
164
161
|
const LoadingDot = ({
|
|
165
162
|
delay,
|
|
@@ -22,7 +22,7 @@ export const inputCSS = ({
|
|
|
22
22
|
margin: spacing.baseUnit / 2,
|
|
23
23
|
paddingBottom: spacing.baseUnit / 2,
|
|
24
24
|
paddingTop: spacing.baseUnit / 2,
|
|
25
|
-
color:
|
|
25
|
+
color: "var(--ds-text, hsl(0, 0%, 20%))"
|
|
26
26
|
});
|
|
27
27
|
const spacingStyle = {
|
|
28
28
|
gridArea: '1 / 2',
|
|
@@ -200,11 +200,11 @@ export const menuCSS = ({
|
|
|
200
200
|
position: 'absolute',
|
|
201
201
|
width: '100%',
|
|
202
202
|
zIndex: 1,
|
|
203
|
-
backgroundColor: colors.neutral0,
|
|
204
203
|
borderRadius: borderRadius,
|
|
205
|
-
boxShadow: '0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)',
|
|
206
204
|
marginBottom: spacing.menuGutter,
|
|
207
|
-
marginTop: spacing.menuGutter
|
|
205
|
+
marginTop: spacing.menuGutter,
|
|
206
|
+
backgroundColor: "var(--ds-surface-overlay, white)",
|
|
207
|
+
boxShadow: "var(--ds-shadow-overlay, 0 0 0 1px hsl(0deg 0% 0% / 10%), 0 4px 11px hsl(0deg 0% 0% / 10%))"
|
|
208
208
|
});
|
|
209
209
|
const PortalPlacementContext = /*#__PURE__*/createContext(null);
|
|
210
210
|
|
|
@@ -281,20 +281,15 @@ export default Menu;
|
|
|
281
281
|
// ==============================
|
|
282
282
|
|
|
283
283
|
export const menuListCSS = ({
|
|
284
|
-
maxHeight
|
|
285
|
-
theme: {
|
|
286
|
-
spacing: {
|
|
287
|
-
baseUnit
|
|
288
|
-
}
|
|
289
|
-
}
|
|
284
|
+
maxHeight
|
|
290
285
|
}) => ({
|
|
291
286
|
maxHeight,
|
|
292
287
|
overflowY: 'auto',
|
|
293
288
|
position: 'relative',
|
|
294
289
|
// required for offset[Height, Top] > keyboard scroll
|
|
295
290
|
WebkitOverflowScrolling: 'touch',
|
|
296
|
-
|
|
297
|
-
|
|
291
|
+
paddingTop: "var(--ds-space-100, 8px)",
|
|
292
|
+
paddingBottom: "var(--ds-space-100, 8px)"
|
|
298
293
|
});
|
|
299
294
|
|
|
300
295
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -5,57 +5,116 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { getStyleProps } from '../utils';
|
|
9
10
|
import { CrossIcon } from './indicators';
|
|
10
11
|
export const multiValueCSS = ({
|
|
12
|
+
isDisabled,
|
|
13
|
+
isFocused,
|
|
11
14
|
theme: {
|
|
12
15
|
spacing,
|
|
13
16
|
borderRadius,
|
|
14
17
|
colors
|
|
15
18
|
}
|
|
16
|
-
}) =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
19
|
+
}) => {
|
|
20
|
+
let backgroundColor;
|
|
21
|
+
let color;
|
|
22
|
+
if (isDisabled) {
|
|
23
|
+
// Use the basic neutral background so it is slightly separate from the
|
|
24
|
+
// field's background
|
|
25
|
+
backgroundColor = "var(--ds-background-neutral, #091E420F)";
|
|
26
|
+
color = "var(--ds-text-disabled, #091E424F)";
|
|
27
|
+
} else if (isFocused) {
|
|
28
|
+
backgroundColor = "var(--ds-background-selected, #E9F2FF)";
|
|
29
|
+
color = "var(--ds-text-selected, hsl(0, 0%, 20%))";
|
|
30
|
+
} else {
|
|
31
|
+
backgroundColor = fg('platform-component-visual-refresh') ? "var(--ds-background-neutral-subtle-hovered, #091E420F)" : "var(--ds-background-neutral, #091E420F)";
|
|
32
|
+
color = "var(--ds-text, hsl(0, 0%, 20%))";
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
label: 'multiValue',
|
|
36
|
+
display: 'flex',
|
|
37
|
+
minWidth: 0,
|
|
38
|
+
// resolves flex/text-overflow bug
|
|
39
|
+
margin: "var(--ds-space-025, 2px)",
|
|
40
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
41
|
+
backgroundColor,
|
|
42
|
+
boxShadow: isFocused ? `0 0 0 2px ${"var(--ds-surface, transparent)"}, 0 0 0 4px ${"var(--ds-border-focused, transparent)"}` : 'none',
|
|
43
|
+
maxWidth: '100%',
|
|
44
|
+
'@media screen and (-ms-high-contrast: active)': {
|
|
45
|
+
border: isFocused ? '1px solid transparent' : 'none'
|
|
46
|
+
},
|
|
47
|
+
color,
|
|
48
|
+
...(fg('platform-component-visual-refresh') && {
|
|
49
|
+
borderRadius: "var(--ds-border-radius-100, 4px)",
|
|
50
|
+
// Hardcode this color for visual refresh as there is no token color yet
|
|
51
|
+
borderColor: '#B7B9BE',
|
|
52
|
+
borderWidth: "var(--ds-border-width, 1px)",
|
|
53
|
+
borderStyle: 'solid',
|
|
54
|
+
backgroundColor: "var(--ds-background-input, #FFFFFF)"
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
};
|
|
25
58
|
export const multiValueLabelCSS = ({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
colors
|
|
29
|
-
},
|
|
30
|
-
cropWithEllipsis
|
|
59
|
+
cropWithEllipsis,
|
|
60
|
+
isDisabled
|
|
31
61
|
}) => ({
|
|
32
62
|
overflow: 'hidden',
|
|
33
63
|
textOverflow: cropWithEllipsis || cropWithEllipsis === undefined ? 'ellipsis' : undefined,
|
|
34
64
|
whiteSpace: 'nowrap',
|
|
35
|
-
borderRadius:
|
|
36
|
-
color: colors.neutral80,
|
|
65
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
37
66
|
fontSize: '85%',
|
|
38
|
-
|
|
39
|
-
|
|
67
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
68
|
+
padding: "var(--ds-space-025, 2px)",
|
|
69
|
+
color: isDisabled ? "var(--ds-text-disabled, #091E424F)" : 'inherit',
|
|
70
|
+
paddingLeft: "var(--ds-space-075, 6px)",
|
|
71
|
+
...(fg('platform-component-visual-refresh') && {
|
|
72
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
73
|
+
paddingTop: 0,
|
|
74
|
+
paddingBottom: 0,
|
|
75
|
+
paddingLeft: "var(--ds-space-050, 4px)"
|
|
76
|
+
})
|
|
40
77
|
});
|
|
41
78
|
export const multiValueRemoveCSS = ({
|
|
42
|
-
theme: {
|
|
43
|
-
spacing,
|
|
44
|
-
borderRadius,
|
|
45
|
-
colors
|
|
46
|
-
},
|
|
47
79
|
isFocused
|
|
48
80
|
}) => ({
|
|
49
81
|
alignItems: 'center',
|
|
50
82
|
display: 'flex',
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
paddingLeft:
|
|
54
|
-
paddingRight:
|
|
83
|
+
backgroundColor: isFocused ? "var(--ds-UNSAFE-transparent, transparent)" : undefined,
|
|
84
|
+
fill: isFocused ? "var(--ds-text-selected, #000)" : "var(--ds-text, #000)",
|
|
85
|
+
paddingLeft: "var(--ds-space-025, 2px)",
|
|
86
|
+
paddingRight: "var(--ds-space-025, 2px)",
|
|
87
|
+
borderRadius: '0px 2px 2px 0px',
|
|
88
|
+
// DSP-6470 we should style like Tag once we have the :has selector
|
|
55
89
|
':hover': {
|
|
56
|
-
backgroundColor:
|
|
57
|
-
|
|
58
|
-
}
|
|
90
|
+
backgroundColor: "var(--ds-background-danger-hovered, #FFD5D2)",
|
|
91
|
+
fill: "var(--ds-text-danger, #000)"
|
|
92
|
+
},
|
|
93
|
+
':active': {
|
|
94
|
+
backgroundColor: "var(--ds-background-danger-pressed, #FD9891)",
|
|
95
|
+
fill: "var(--ds-text-danger, #000)"
|
|
96
|
+
},
|
|
97
|
+
...(fg('platform-component-visual-refresh') && {
|
|
98
|
+
backgroundColor: "var(--ds-background-neutral-subtle, #00000000)",
|
|
99
|
+
border: 'none',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
justifyContent: 'center',
|
|
102
|
+
alignSelf: 'center',
|
|
103
|
+
appearance: 'none',
|
|
104
|
+
borderRadius: "var(--ds-border-radius, 4px)",
|
|
105
|
+
color: "var(--ds-text, #172B4D)",
|
|
106
|
+
padding: "var(--ds-space-025, 2px)",
|
|
107
|
+
marginRight: "var(--ds-space-025, 2px)",
|
|
108
|
+
':focus-visible': {
|
|
109
|
+
outlineOffset: "var(--ds-space-negative-025, -2px)"
|
|
110
|
+
},
|
|
111
|
+
':hover': {
|
|
112
|
+
backgroundColor: "var(--ds-background-neutral-subtle-hovered, #091E420F)"
|
|
113
|
+
},
|
|
114
|
+
':active': {
|
|
115
|
+
backgroundColor: "var(--ds-background-neutral-subtle-pressed, #091E4224)"
|
|
116
|
+
}
|
|
117
|
+
})
|
|
59
118
|
});
|
|
60
119
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
61
120
|
export const MultiValueGeneric = ({
|