@atlaskit/react-select 1.5.1 → 1.6.0
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/components/group.js +2 -7
- package/dist/cjs/components/index.js +0 -3
- package/dist/cjs/components/indicators.js +54 -133
- package/dist/cjs/components/input.js +5 -8
- package/dist/cjs/components/menu.js +23 -21
- package/dist/cjs/components/multi-value.js +47 -10
- package/dist/cjs/components/single-value.js +1 -2
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/select.js +88 -131
- package/dist/cjs/styles.js +0 -1
- package/dist/cjs/utils.js +1 -2
- package/dist/es2019/components/group.js +2 -7
- package/dist/es2019/components/index.js +1 -4
- package/dist/es2019/components/indicators.js +39 -113
- package/dist/es2019/components/input.js +5 -9
- package/dist/es2019/components/menu.js +23 -29
- package/dist/es2019/components/multi-value.js +48 -12
- package/dist/es2019/components/single-value.js +1 -4
- package/dist/es2019/index.js +0 -1
- package/dist/es2019/select.js +7 -52
- package/dist/es2019/styles.js +1 -2
- package/dist/es2019/utils.js +0 -2
- package/dist/esm/components/group.js +2 -7
- package/dist/esm/components/index.js +1 -4
- package/dist/esm/components/indicators.js +54 -133
- package/dist/esm/components/input.js +5 -8
- package/dist/esm/components/menu.js +23 -21
- package/dist/esm/components/multi-value.js +48 -11
- package/dist/esm/components/single-value.js +1 -2
- package/dist/esm/index.js +0 -1
- package/dist/esm/select.js +88 -131
- package/dist/esm/styles.js +1 -2
- package/dist/esm/utils.js +1 -2
- package/dist/types/components/group.d.ts +1 -2
- package/dist/types/components/index.d.ts +16 -22
- package/dist/types/components/indicators.d.ts +1 -16
- package/dist/types/components/input.d.ts +1 -1
- package/dist/types/components/menu.d.ts +3 -3
- package/dist/types/components/multi-value.d.ts +3 -2
- package/dist/types/components/single-value.d.ts +1 -1
- package/dist/types/index.d.ts +1 -3
- package/dist/types/select.d.ts +15 -28
- package/dist/types/styles.d.ts +1 -3
- package/dist/types/theme.d.ts +0 -1
- package/dist/types/types.d.ts +0 -1
- package/dist/types-ts4.5/components/group.d.ts +1 -2
- package/dist/types-ts4.5/components/index.d.ts +16 -22
- package/dist/types-ts4.5/components/indicators.d.ts +1 -16
- package/dist/types-ts4.5/components/input.d.ts +1 -1
- package/dist/types-ts4.5/components/menu.d.ts +3 -3
- package/dist/types-ts4.5/components/multi-value.d.ts +3 -2
- package/dist/types-ts4.5/components/single-value.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -3
- package/dist/types-ts4.5/select.d.ts +15 -28
- package/dist/types-ts4.5/styles.d.ts +1 -3
- package/dist/types-ts4.5/theme.d.ts +0 -1
- package/dist/types-ts4.5/types.d.ts +0 -1
- package/package.json +11 -2
- package/types/package.json +17 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
+
var _excluded = ["innerProps", "isRtl", "size"];
|
|
6
5
|
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; }
|
|
7
6
|
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; }
|
|
8
7
|
/**
|
|
@@ -10,63 +9,36 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
10
9
|
* @jsx jsx
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
|
-
import {
|
|
12
|
+
import { jsx } from '@emotion/react';
|
|
13
|
+
import DownIcon from '@atlaskit/icon/utility/migration/chevron-down';
|
|
14
|
+
import CrossIcon from '@atlaskit/icon/utility/migration/cross-circle--select-clear';
|
|
15
|
+
import { Inline, Pressable, xcss } from '@atlaskit/primitives';
|
|
16
|
+
import Spinner from '@atlaskit/spinner';
|
|
14
17
|
import { getStyleProps } from '../utils';
|
|
15
18
|
|
|
16
19
|
// ==============================
|
|
17
20
|
// Dropdown & Clear Icons
|
|
18
21
|
// ==============================
|
|
19
22
|
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
var iconContainerStyles = xcss({
|
|
24
|
+
all: 'unset',
|
|
25
|
+
outline: 'revert',
|
|
26
|
+
display: 'flex',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
padding: 'space.025'
|
|
30
|
+
});
|
|
31
|
+
var dropdownWrapperStyles = xcss({
|
|
32
|
+
padding: 'space.075'
|
|
26
33
|
});
|
|
27
|
-
var Svg = function Svg(_ref) {
|
|
28
|
-
var size = _ref.size,
|
|
29
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
-
return jsx("svg", _extends({
|
|
31
|
-
height: size,
|
|
32
|
-
width: size,
|
|
33
|
-
viewBox: "0 0 20 20",
|
|
34
|
-
"aria-hidden": "true",
|
|
35
|
-
focusable: "false",
|
|
36
|
-
css: styles
|
|
37
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
38
|
-
}, props));
|
|
39
|
-
};
|
|
40
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
41
|
-
export var CrossIcon = function CrossIcon(props) {
|
|
42
|
-
return (
|
|
43
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
44
|
-
jsx(Svg, _extends({
|
|
45
|
-
size: 20
|
|
46
|
-
}, props), jsx("path", {
|
|
47
|
-
d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"
|
|
48
|
-
}))
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
52
|
-
export var DownChevron = function DownChevron(props) {
|
|
53
|
-
return (
|
|
54
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
55
|
-
jsx(Svg, _extends({
|
|
56
|
-
size: 20
|
|
57
|
-
}, props), jsx("path", {
|
|
58
|
-
d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
|
|
59
|
-
}))
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
34
|
|
|
63
35
|
// ==============================
|
|
64
36
|
// Dropdown & Clear Buttons
|
|
65
37
|
// ==============================
|
|
66
38
|
|
|
67
|
-
export var dropdownIndicatorCSS = function dropdownIndicatorCSS(
|
|
68
|
-
var isCompact =
|
|
69
|
-
isDisabled =
|
|
39
|
+
export var dropdownIndicatorCSS = function dropdownIndicatorCSS(_ref) {
|
|
40
|
+
var isCompact = _ref.isCompact,
|
|
41
|
+
isDisabled = _ref.isDisabled;
|
|
70
42
|
return {
|
|
71
43
|
label: 'indicatorContainer',
|
|
72
44
|
display: 'flex',
|
|
@@ -81,15 +53,22 @@ export var dropdownIndicatorCSS = function dropdownIndicatorCSS(_ref2) {
|
|
|
81
53
|
|
|
82
54
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
83
55
|
export var DropdownIndicator = function DropdownIndicator(props) {
|
|
84
|
-
var
|
|
85
|
-
|
|
56
|
+
var innerProps = props.innerProps,
|
|
57
|
+
children = props.children;
|
|
86
58
|
return jsx("div", _extends({}, getStyleProps(props, 'dropdownIndicator', {
|
|
87
59
|
indicator: true,
|
|
88
60
|
'dropdown-indicator': true
|
|
89
|
-
}), innerProps), children
|
|
61
|
+
}), innerProps), children ? children : jsx(Inline, {
|
|
62
|
+
as: "span",
|
|
63
|
+
xcss: dropdownWrapperStyles
|
|
64
|
+
}, jsx(DownIcon, {
|
|
65
|
+
color: "currentColor",
|
|
66
|
+
label: "open",
|
|
67
|
+
LEGACY_margin: "var(--ds-space-negative-075, -0.375rem)"
|
|
68
|
+
})));
|
|
90
69
|
};
|
|
91
|
-
export var clearIndicatorCSS = function clearIndicatorCSS(
|
|
92
|
-
var isCompact =
|
|
70
|
+
export var clearIndicatorCSS = function clearIndicatorCSS(_ref2) {
|
|
71
|
+
var isCompact = _ref2.isCompact;
|
|
93
72
|
return {
|
|
94
73
|
label: 'indicatorContainer',
|
|
95
74
|
display: 'flex',
|
|
@@ -104,35 +83,21 @@ export var clearIndicatorCSS = function clearIndicatorCSS(_ref3) {
|
|
|
104
83
|
|
|
105
84
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
106
85
|
export var ClearIndicator = function ClearIndicator(props) {
|
|
107
|
-
var
|
|
108
|
-
|
|
86
|
+
var innerProps = props.innerProps,
|
|
87
|
+
_props$clearControlLa = props.clearControlLabel,
|
|
88
|
+
clearControlLabel = _props$clearControlLa === void 0 ? 'clear' : _props$clearControlLa;
|
|
109
89
|
return jsx("div", _extends({}, getStyleProps(props, 'clearIndicator', {
|
|
110
90
|
indicator: true,
|
|
111
91
|
'clear-indicator': true
|
|
112
|
-
}), innerProps),
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return {
|
|
122
|
-
label: 'indicatorSeparator',
|
|
123
|
-
alignSelf: 'stretch',
|
|
124
|
-
width: 1,
|
|
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)"
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
132
|
-
export var IndicatorSeparator = function IndicatorSeparator(props) {
|
|
133
|
-
var innerProps = props.innerProps;
|
|
134
|
-
return jsx("span", _extends({}, innerProps, getStyleProps(props, 'indicatorSeparator', {
|
|
135
|
-
'indicator-separator': true
|
|
92
|
+
}), innerProps), jsx(Pressable, {
|
|
93
|
+
xcss: iconContainerStyles,
|
|
94
|
+
tabIndex: -1,
|
|
95
|
+
"aria-label": clearControlLabel
|
|
96
|
+
}, jsx(CrossIcon, {
|
|
97
|
+
label: "",
|
|
98
|
+
color: "currentColor",
|
|
99
|
+
LEGACY_size: "small",
|
|
100
|
+
LEGACY_margin: "var(--ds-space-negative-025, -0.125rem)"
|
|
136
101
|
})));
|
|
137
102
|
};
|
|
138
103
|
|
|
@@ -140,57 +105,20 @@ export var IndicatorSeparator = function IndicatorSeparator(props) {
|
|
|
140
105
|
// Loading
|
|
141
106
|
// ==============================
|
|
142
107
|
|
|
143
|
-
var
|
|
144
|
-
|
|
145
|
-
opacity: 0
|
|
146
|
-
},
|
|
147
|
-
'40%': {
|
|
148
|
-
opacity: 1
|
|
149
|
-
}
|
|
150
|
-
});
|
|
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;
|
|
108
|
+
export var loadingIndicatorCSS = function loadingIndicatorCSS(_ref3) {
|
|
109
|
+
var isCompact = _ref3.isCompact;
|
|
156
110
|
return {
|
|
157
111
|
label: 'loadingIndicator',
|
|
158
|
-
display: 'flex',
|
|
159
|
-
transition: 'color 150ms',
|
|
160
|
-
alignSelf: 'center',
|
|
161
|
-
fontSize: size,
|
|
162
|
-
lineHeight: 1,
|
|
163
|
-
marginRight: size,
|
|
164
|
-
textAlign: 'center',
|
|
165
|
-
verticalAlign: 'middle',
|
|
166
|
-
color: isFocused ? colors.neutral60 : colors.neutral20,
|
|
167
112
|
padding: "".concat(isCompact ? 0 : "var(--ds-space-075, 6px)", " ", "var(--ds-space-100, 8px)")
|
|
168
113
|
};
|
|
169
114
|
};
|
|
170
|
-
var LoadingDot = function LoadingDot(_ref6) {
|
|
171
|
-
var delay = _ref6.delay,
|
|
172
|
-
offset = _ref6.offset;
|
|
173
|
-
return jsx("span", {
|
|
174
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
175
|
-
css: {
|
|
176
|
-
animation: "".concat(loadingDotAnimations, " 1s ease-in-out ").concat(delay, "ms infinite;"),
|
|
177
|
-
backgroundColor: 'currentColor',
|
|
178
|
-
borderRadius: '1em',
|
|
179
|
-
display: 'inline-block',
|
|
180
|
-
marginLeft: offset ? '1em' : undefined,
|
|
181
|
-
height: '1em',
|
|
182
|
-
verticalAlign: 'top',
|
|
183
|
-
width: '1em'
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
};
|
|
187
115
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
188
|
-
export var LoadingIndicator = function LoadingIndicator(
|
|
189
|
-
var innerProps =
|
|
190
|
-
isRtl =
|
|
191
|
-
|
|
192
|
-
size =
|
|
193
|
-
restProps = _objectWithoutProperties(
|
|
116
|
+
export var LoadingIndicator = function LoadingIndicator(_ref4) {
|
|
117
|
+
var innerProps = _ref4.innerProps,
|
|
118
|
+
isRtl = _ref4.isRtl,
|
|
119
|
+
_ref4$size = _ref4.size,
|
|
120
|
+
size = _ref4$size === void 0 ? 4 : _ref4$size,
|
|
121
|
+
restProps = _objectWithoutProperties(_ref4, _excluded);
|
|
194
122
|
return jsx("div", _extends({}, getStyleProps(_objectSpread(_objectSpread({}, restProps), {}, {
|
|
195
123
|
innerProps: innerProps,
|
|
196
124
|
isRtl: isRtl,
|
|
@@ -198,14 +126,7 @@ export var LoadingIndicator = function LoadingIndicator(_ref7) {
|
|
|
198
126
|
}), 'loadingIndicator', {
|
|
199
127
|
indicator: true,
|
|
200
128
|
'loading-indicator': true
|
|
201
|
-
}), innerProps), jsx(
|
|
202
|
-
|
|
203
|
-
offset: isRtl
|
|
204
|
-
}), jsx(LoadingDot, {
|
|
205
|
-
delay: 160,
|
|
206
|
-
offset: true
|
|
207
|
-
}), jsx(LoadingDot, {
|
|
208
|
-
delay: 320,
|
|
209
|
-
offset: !isRtl
|
|
129
|
+
}), innerProps), jsx(Spinner, {
|
|
130
|
+
size: "small"
|
|
210
131
|
}));
|
|
211
132
|
};
|
|
@@ -13,20 +13,17 @@ import { jsx } from '@emotion/react';
|
|
|
13
13
|
import { cleanCommonProps, getStyleProps } from '../utils';
|
|
14
14
|
export var inputCSS = function inputCSS(_ref) {
|
|
15
15
|
var isDisabled = _ref.isDisabled,
|
|
16
|
-
value = _ref.value
|
|
17
|
-
_ref$theme = _ref.theme,
|
|
18
|
-
spacing = _ref$theme.spacing,
|
|
19
|
-
colors = _ref$theme.colors;
|
|
16
|
+
value = _ref.value;
|
|
20
17
|
return _objectSpread(_objectSpread({
|
|
21
18
|
visibility: isDisabled ? 'hidden' : 'visible',
|
|
22
19
|
// force css to recompute when value change due to @emotion bug.
|
|
23
20
|
// We can remove it whenever the bug is fixed.
|
|
24
21
|
transform: value ? 'translateZ(0)' : ''
|
|
25
22
|
}, containerStyle), {}, {
|
|
26
|
-
margin:
|
|
27
|
-
paddingBottom:
|
|
28
|
-
paddingTop:
|
|
29
|
-
color: "var(--ds-text,
|
|
23
|
+
margin: "var(--ds-space-025, 2px)",
|
|
24
|
+
paddingBottom: "var(--ds-space-025, 2px)",
|
|
25
|
+
paddingTop: "var(--ds-space-025, 2px)",
|
|
26
|
+
color: "var(--ds-text, #172B4D)"
|
|
30
27
|
});
|
|
31
28
|
};
|
|
32
29
|
var spacingStyle = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
2
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
@@ -15,6 +16,8 @@ import { jsx } from '@emotion/react';
|
|
|
15
16
|
import { autoUpdate } from '@floating-ui/dom';
|
|
16
17
|
import { createPortal } from 'react-dom';
|
|
17
18
|
import useLayoutEffect from 'use-isomorphic-layout-effect';
|
|
19
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
|
+
import { Text } from '@atlaskit/primitives';
|
|
18
21
|
import { animatedScrollTo, getBoundingClientObj, getScrollParent, getScrollTop, getStyleProps, normalizedHeight, scrollTo } from '../utils';
|
|
19
22
|
|
|
20
23
|
// ==============================
|
|
@@ -46,7 +49,8 @@ export function getMenuPlacement(_ref) {
|
|
|
46
49
|
// we can't trust `scrollParent.scrollHeight` --> it may increase when
|
|
47
50
|
// the menu is rendered
|
|
48
51
|
var _scrollParent$getBoun = scrollParent.getBoundingClientRect(),
|
|
49
|
-
scrollHeight = _scrollParent$getBoun.height
|
|
52
|
+
scrollHeight = _scrollParent$getBoun.height,
|
|
53
|
+
scrollParentTop = _scrollParent$getBoun.top;
|
|
50
54
|
var _menuEl$getBoundingCl = menuEl.getBoundingClientRect(),
|
|
51
55
|
menuBottom = _menuEl$getBoundingCl.bottom,
|
|
52
56
|
menuHeight = _menuEl$getBoundingCl.height,
|
|
@@ -55,12 +59,14 @@ export function getMenuPlacement(_ref) {
|
|
|
55
59
|
containerTop = _menuEl$offsetParent$.top;
|
|
56
60
|
var viewHeight = isFixedPosition ? window.innerHeight : normalizedHeight(scrollParent);
|
|
57
61
|
var scrollTop = getScrollTop(scrollParent);
|
|
62
|
+
// use menuTop - scrollParentTop for the actual top space of menu in the scroll container
|
|
63
|
+
var menuTopFromParent = fg('design-system-select-fix-placement') ? menuTop - scrollParentTop : menuTop;
|
|
58
64
|
var marginBottom = parseInt(getComputedStyle(menuEl).marginBottom, 10);
|
|
59
65
|
var marginTop = parseInt(getComputedStyle(menuEl).marginTop, 10);
|
|
60
66
|
var viewSpaceAbove = containerTop - marginTop;
|
|
61
|
-
var viewSpaceBelow = viewHeight -
|
|
67
|
+
var viewSpaceBelow = viewHeight - menuTopFromParent;
|
|
62
68
|
var scrollSpaceAbove = viewSpaceAbove + scrollTop;
|
|
63
|
-
var scrollSpaceBelow = scrollHeight - scrollTop -
|
|
69
|
+
var scrollSpaceBelow = scrollHeight - scrollTop - menuTopFromParent;
|
|
64
70
|
var scrollDown = menuBottom - viewHeight + scrollTop + marginBottom;
|
|
65
71
|
var scrollUp = scrollTop + menuTop - marginTop;
|
|
66
72
|
var scrollDuration = 160;
|
|
@@ -193,15 +199,10 @@ var coercePlacement = function coercePlacement(p) {
|
|
|
193
199
|
return p === 'auto' ? 'bottom' : p;
|
|
194
200
|
};
|
|
195
201
|
export var menuCSS = function menuCSS(_ref2) {
|
|
196
|
-
var
|
|
197
|
-
|
|
198
|
-
_ref2$theme = _ref2.theme,
|
|
199
|
-
borderRadius = _ref2$theme.borderRadius,
|
|
200
|
-
spacing = _ref2$theme.spacing,
|
|
201
|
-
colors = _ref2$theme.colors;
|
|
202
|
-
return _ref3 = {
|
|
202
|
+
var placement = _ref2.placement;
|
|
203
|
+
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
203
204
|
label: 'menu'
|
|
204
|
-
},
|
|
205
|
+
}, alignToControl(placement), '100%'), "position", 'absolute'), "width", '100%'), "zIndex", 1), "borderRadius", "var(--ds-border-radius, 4px)"), "marginBottom", "var(--ds-space-100, 8px)"), "marginTop", "var(--ds-space-100, 8px)"), "backgroundColor", "var(--ds-surface-overlay, white)"), "boxShadow", "var(--ds-shadow-overlay, 0 0 0 1px hsl(0deg 0% 0% / 10%), 0 4px 11px hsl(0deg 0% 0% / 10%))");
|
|
205
206
|
};
|
|
206
207
|
var PortalPlacementContext = /*#__PURE__*/createContext(null);
|
|
207
208
|
|
|
@@ -213,8 +214,7 @@ export var MenuPlacer = function MenuPlacer(props) {
|
|
|
213
214
|
maxMenuHeight = props.maxMenuHeight,
|
|
214
215
|
menuPlacement = props.menuPlacement,
|
|
215
216
|
menuPosition = props.menuPosition,
|
|
216
|
-
menuShouldScrollIntoView = props.menuShouldScrollIntoView
|
|
217
|
-
theme = props.theme;
|
|
217
|
+
menuShouldScrollIntoView = props.menuShouldScrollIntoView;
|
|
218
218
|
var _ref4 = useContext(PortalPlacementContext) || {},
|
|
219
219
|
setPortalPlacement = _ref4.setPortalPlacement;
|
|
220
220
|
var ref = useRef(null);
|
|
@@ -226,7 +226,8 @@ export var MenuPlacer = function MenuPlacer(props) {
|
|
|
226
226
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
227
227
|
placement = _useState4[0],
|
|
228
228
|
setPlacement = _useState4[1];
|
|
229
|
-
|
|
229
|
+
// The minimum height of the control
|
|
230
|
+
var controlHeight = 38;
|
|
230
231
|
useLayoutEffect(function () {
|
|
231
232
|
var menuEl = ref.current;
|
|
232
233
|
if (!menuEl) {
|
|
@@ -309,13 +310,10 @@ export var MenuList = function MenuList(props) {
|
|
|
309
310
|
// ==============================
|
|
310
311
|
|
|
311
312
|
var noticeCSS = function noticeCSS(_ref6) {
|
|
312
|
-
|
|
313
|
-
baseUnit = _ref6$theme.spacing.baseUnit,
|
|
314
|
-
colors = _ref6$theme.colors;
|
|
313
|
+
_objectDestructuringEmpty(_ref6);
|
|
315
314
|
return {
|
|
316
315
|
textAlign: 'center',
|
|
317
|
-
|
|
318
|
-
padding: "".concat(baseUnit * 2, "px ").concat(baseUnit * 3, "px")
|
|
316
|
+
padding: "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-150, 12px)")
|
|
319
317
|
};
|
|
320
318
|
};
|
|
321
319
|
export var noOptionsMessageCSS = noticeCSS;
|
|
@@ -335,7 +333,9 @@ export var NoOptionsMessage = function NoOptionsMessage(_ref7) {
|
|
|
335
333
|
}), {
|
|
336
334
|
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
337
335
|
role: "option"
|
|
338
|
-
}, innerProps),
|
|
336
|
+
}, innerProps), jsx(Text, {
|
|
337
|
+
color: "color.text.subtle"
|
|
338
|
+
}, children));
|
|
339
339
|
};
|
|
340
340
|
|
|
341
341
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -353,7 +353,9 @@ export var LoadingMessage = function LoadingMessage(_ref8) {
|
|
|
353
353
|
}), innerProps, {
|
|
354
354
|
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
355
355
|
role: "option"
|
|
356
|
-
}),
|
|
356
|
+
}), jsx(Text, {
|
|
357
|
+
color: "color.text.subtle"
|
|
358
|
+
}, children));
|
|
357
359
|
};
|
|
358
360
|
|
|
359
361
|
// ==============================
|
|
@@ -7,17 +7,15 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
* @jsx jsx
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { jsx } from '@emotion/react';
|
|
10
|
+
import { css, jsx } from '@emotion/react';
|
|
11
|
+
import LegacySelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
12
|
+
import CrossIcon from '@atlaskit/icon/utility/cross';
|
|
11
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { Inline, xcss } from '@atlaskit/primitives';
|
|
12
15
|
import { getStyleProps } from '../utils';
|
|
13
|
-
import { CrossIcon } from './indicators';
|
|
14
16
|
export var multiValueCSS = function multiValueCSS(_ref) {
|
|
15
17
|
var isDisabled = _ref.isDisabled,
|
|
16
|
-
isFocused = _ref.isFocused
|
|
17
|
-
_ref$theme = _ref.theme,
|
|
18
|
-
spacing = _ref$theme.spacing,
|
|
19
|
-
borderRadius = _ref$theme.borderRadius,
|
|
20
|
-
colors = _ref$theme.colors;
|
|
18
|
+
isFocused = _ref.isFocused;
|
|
21
19
|
var backgroundColor;
|
|
22
20
|
var color;
|
|
23
21
|
if (isDisabled) {
|
|
@@ -128,14 +126,52 @@ export var MultiValueContainer = MultiValueGeneric;
|
|
|
128
126
|
|
|
129
127
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
130
128
|
export var MultiValueLabel = MultiValueGeneric;
|
|
129
|
+
var disabledStyles = css({
|
|
130
|
+
display: 'none'
|
|
131
|
+
});
|
|
132
|
+
var enabledStyles = css({
|
|
133
|
+
display: 'inherit'
|
|
134
|
+
});
|
|
135
|
+
var iconWrapperStyles = xcss({
|
|
136
|
+
padding: 'space.025'
|
|
137
|
+
});
|
|
138
|
+
var renderIcon = function renderIcon() {
|
|
139
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
140
|
+
if (fg('platform-component-visual-refresh')) {
|
|
141
|
+
return jsx(CrossIcon, {
|
|
142
|
+
label: "Clear",
|
|
143
|
+
color: "currentColor"
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
148
|
+
if (fg('platform-visual-refresh-icons-legacy-facade')) {
|
|
149
|
+
return jsx(Inline, {
|
|
150
|
+
xcss: iconWrapperStyles
|
|
151
|
+
}, jsx(CrossIcon, {
|
|
152
|
+
label: "Clear",
|
|
153
|
+
color: "currentColor"
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
return (
|
|
157
|
+
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
158
|
+
jsx(LegacySelectClearIcon, {
|
|
159
|
+
label: "Clear",
|
|
160
|
+
primaryColor: "transparent",
|
|
161
|
+
size: "small",
|
|
162
|
+
secondaryColor: "inherit"
|
|
163
|
+
})
|
|
164
|
+
);
|
|
165
|
+
};
|
|
131
166
|
export function MultiValueRemove(_ref5) {
|
|
132
|
-
var
|
|
167
|
+
var isDisabled = _ref5.isDisabled,
|
|
133
168
|
innerProps = _ref5.innerProps;
|
|
134
169
|
return jsx("div", _extends({
|
|
135
170
|
role: "button"
|
|
136
|
-
}, innerProps),
|
|
137
|
-
|
|
138
|
-
|
|
171
|
+
}, innerProps), jsx("div", {
|
|
172
|
+
css: isDisabled ? disabledStyles : enabledStyles,
|
|
173
|
+
"data-testid": isDisabled ? 'hide-clear-icon' : 'show-clear-icon'
|
|
174
|
+
}, renderIcon()));
|
|
139
175
|
}
|
|
140
176
|
var MultiValue = function MultiValue(props) {
|
|
141
177
|
var children = props.children,
|
|
@@ -168,6 +204,7 @@ var MultiValue = function MultiValue(props) {
|
|
|
168
204
|
})), {}, {
|
|
169
205
|
'aria-label': "Remove ".concat(children || 'option')
|
|
170
206
|
}, removeProps),
|
|
207
|
+
isDisabled: isDisabled,
|
|
171
208
|
selectProps: selectProps
|
|
172
209
|
}));
|
|
173
210
|
};
|
|
@@ -7,8 +7,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
8
|
import { getStyleProps } from '../utils';
|
|
9
9
|
export var css = function css(_ref) {
|
|
10
|
-
var isDisabled = _ref.isDisabled
|
|
11
|
-
spacing = _ref.theme.spacing;
|
|
10
|
+
var isDisabled = _ref.isDisabled;
|
|
12
11
|
return {
|
|
13
12
|
label: 'singleValue',
|
|
14
13
|
gridArea: '1 / 1 / 2 / 3',
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import useStateManager from './use-state-manager';
|
|
2
2
|
export { default } from './state-manager';
|
|
3
3
|
export { mergeStyles } from './styles';
|
|
4
|
-
export { defaultTheme } from './theme';
|
|
5
4
|
export { createFilter } from './filters';
|
|
6
5
|
export { components } from './components';
|
|
7
6
|
export { useStateManager };
|