@atlaskit/react-select 2.2.1 → 2.4.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 +29 -0
- package/dist/cjs/compiled/components/containers.compiled.css +26 -0
- package/dist/cjs/compiled/components/containers.js +119 -0
- package/dist/cjs/compiled/components/control.compiled.css +51 -0
- package/dist/cjs/compiled/components/control.js +66 -0
- package/dist/cjs/compiled/components/group.compiled.css +12 -0
- package/dist/cjs/compiled/components/group.js +81 -0
- package/dist/cjs/compiled/components/indicators.compiled.css +24 -0
- package/dist/cjs/compiled/components/indicators.js +157 -0
- package/dist/cjs/compiled/components/input.compiled.css +49 -0
- package/dist/cjs/compiled/components/input.js +69 -0
- package/dist/cjs/compiled/components/internal/a11y-text.compiled.css +15 -0
- package/dist/cjs/compiled/components/internal/a11y-text.js +23 -0
- package/dist/cjs/compiled/components/internal/dummy-input.compiled.css +17 -0
- package/dist/cjs/compiled/components/internal/dummy-input.js +30 -0
- package/dist/cjs/compiled/components/internal/required-input.compiled.css +8 -0
- package/dist/cjs/compiled/components/internal/required-input.js +34 -0
- package/dist/cjs/compiled/components/live-region.js +177 -0
- package/dist/cjs/compiled/components/menu.compiled.css +19 -0
- package/dist/cjs/compiled/components/menu.js +491 -0
- package/dist/cjs/compiled/components/multi-value.compiled.css +56 -0
- package/dist/cjs/compiled/components/multi-value.js +199 -0
- package/dist/cjs/compiled/components/option.compiled.css +22 -0
- package/dist/cjs/compiled/components/option.js +57 -0
- package/dist/cjs/compiled/components/placeholder.compiled.css +7 -0
- package/dist/cjs/compiled/components/placeholder.js +45 -0
- package/dist/cjs/compiled/components/single-value.compiled.css +13 -0
- package/dist/cjs/compiled/components/single-value.js +46 -0
- package/dist/cjs/components/containers.js +12 -72
- package/dist/cjs/components/control.js +11 -96
- package/dist/cjs/components/group.js +15 -53
- package/dist/cjs/components/indicators.js +15 -107
- package/dist/cjs/components/input.js +12 -81
- package/dist/cjs/components/internal/a11y-text.js +6 -25
- package/dist/cjs/components/internal/dummy-input.js +8 -36
- package/dist/cjs/components/internal/notify-open-layer-observer.js +1 -0
- package/dist/cjs/components/internal/required-input.js +7 -31
- package/dist/cjs/components/internal/scroll-manager.js +19 -17
- package/dist/cjs/components/live-region.js +6 -164
- package/dist/cjs/components/menu.js +24 -399
- package/dist/cjs/components/multi-value.js +21 -197
- package/dist/cjs/components/option.js +11 -68
- package/dist/cjs/components/placeholder.js +11 -20
- package/dist/cjs/components/single-value.js +11 -26
- package/dist/cjs/emotion/components/containers.js +2 -0
- package/dist/cjs/emotion/components/control.js +2 -0
- package/dist/cjs/emotion/components/group.js +1 -0
- package/dist/cjs/emotion/components/indicators.js +1 -0
- package/dist/cjs/emotion/components/input.js +1 -1
- package/dist/cjs/emotion/components/internal/a11y-text.js +1 -0
- package/dist/cjs/emotion/components/internal/dummy-input.js +1 -0
- package/dist/cjs/emotion/components/internal/required-input.js +2 -0
- package/dist/cjs/emotion/components/internal/scroll-manager.js +2 -0
- package/dist/cjs/emotion/components/live-region.js +1 -1
- package/dist/cjs/emotion/components/menu.js +1 -1
- package/dist/cjs/emotion/components/multi-value.js +1 -1
- package/dist/cjs/emotion/components/option.js +2 -0
- package/dist/cjs/emotion/components/placeholder.js +2 -0
- package/dist/cjs/emotion/components/single-value.js +2 -0
- package/dist/cjs/utils.js +2 -1
- package/dist/es2019/compiled/components/containers.compiled.css +26 -0
- package/dist/es2019/compiled/components/containers.js +115 -0
- package/dist/es2019/compiled/components/control.compiled.css +51 -0
- package/dist/es2019/compiled/components/control.js +58 -0
- package/dist/es2019/compiled/components/group.compiled.css +12 -0
- package/dist/es2019/compiled/components/group.js +72 -0
- package/dist/es2019/compiled/components/indicators.compiled.css +24 -0
- package/dist/es2019/compiled/components/indicators.js +144 -0
- package/dist/es2019/compiled/components/input.compiled.css +49 -0
- package/dist/es2019/compiled/components/input.js +59 -0
- package/dist/es2019/compiled/components/internal/a11y-text.compiled.css +15 -0
- package/dist/es2019/compiled/components/internal/a11y-text.js +11 -0
- package/dist/es2019/compiled/components/internal/dummy-input.compiled.css +17 -0
- package/dist/es2019/compiled/components/internal/dummy-input.js +19 -0
- package/dist/es2019/compiled/components/internal/required-input.compiled.css +8 -0
- package/dist/es2019/compiled/components/internal/required-input.js +23 -0
- package/dist/es2019/compiled/components/live-region.js +171 -0
- package/dist/es2019/compiled/components/menu.compiled.css +19 -0
- package/dist/es2019/compiled/components/menu.js +478 -0
- package/dist/es2019/compiled/components/multi-value.compiled.css +56 -0
- package/dist/es2019/compiled/components/multi-value.js +190 -0
- package/dist/es2019/compiled/components/option.compiled.css +22 -0
- package/dist/es2019/compiled/components/option.js +48 -0
- package/dist/es2019/compiled/components/placeholder.compiled.css +7 -0
- package/dist/es2019/compiled/components/placeholder.js +36 -0
- package/dist/es2019/compiled/components/single-value.compiled.css +13 -0
- package/dist/es2019/compiled/components/single-value.js +37 -0
- package/dist/es2019/components/containers.js +10 -87
- package/dist/es2019/components/control.js +8 -103
- package/dist/es2019/components/group.js +9 -54
- package/dist/es2019/components/indicators.js +11 -113
- package/dist/es2019/components/input.js +7 -83
- package/dist/es2019/components/internal/a11y-text.js +6 -26
- package/dist/es2019/components/internal/dummy-input.js +7 -36
- package/dist/es2019/components/internal/notify-open-layer-observer.js +1 -0
- package/dist/es2019/components/internal/required-input.js +6 -32
- package/dist/es2019/components/internal/scroll-manager.js +16 -16
- package/dist/es2019/components/live-region.js +5 -168
- package/dist/es2019/components/menu.js +14 -412
- package/dist/es2019/components/multi-value.js +12 -216
- package/dist/es2019/components/option.js +7 -75
- package/dist/es2019/components/placeholder.js +7 -25
- package/dist/es2019/components/single-value.js +7 -31
- package/dist/es2019/emotion/components/containers.js +1 -0
- package/dist/es2019/emotion/components/control.js +1 -0
- package/dist/es2019/emotion/components/group.js +1 -0
- package/dist/es2019/emotion/components/indicators.js +1 -0
- package/dist/es2019/emotion/components/input.js +1 -0
- package/dist/es2019/emotion/components/internal/a11y-text.js +1 -0
- package/dist/es2019/emotion/components/internal/dummy-input.js +1 -0
- package/dist/es2019/emotion/components/internal/required-input.js +1 -0
- package/dist/es2019/emotion/components/internal/scroll-manager.js +2 -0
- package/dist/es2019/emotion/components/live-region.js +2 -0
- package/dist/es2019/emotion/components/menu.js +2 -0
- package/dist/es2019/emotion/components/multi-value.js +1 -0
- package/dist/es2019/emotion/components/option.js +1 -0
- package/dist/es2019/emotion/components/placeholder.js +1 -0
- package/dist/es2019/emotion/components/single-value.js +1 -0
- package/dist/es2019/utils.js +1 -0
- package/dist/esm/compiled/components/containers.compiled.css +26 -0
- package/dist/esm/compiled/components/containers.js +110 -0
- package/dist/esm/compiled/components/control.compiled.css +51 -0
- package/dist/esm/compiled/components/control.js +57 -0
- package/dist/esm/compiled/components/group.compiled.css +12 -0
- package/dist/esm/compiled/components/group.js +71 -0
- package/dist/esm/compiled/components/indicators.compiled.css +24 -0
- package/dist/esm/compiled/components/indicators.js +148 -0
- package/dist/esm/compiled/components/input.compiled.css +49 -0
- package/dist/esm/compiled/components/input.js +59 -0
- package/dist/esm/compiled/components/internal/a11y-text.compiled.css +15 -0
- package/dist/esm/compiled/components/internal/a11y-text.js +13 -0
- package/dist/esm/compiled/components/internal/dummy-input.compiled.css +17 -0
- package/dist/esm/compiled/components/internal/dummy-input.js +20 -0
- package/dist/esm/compiled/components/internal/required-input.compiled.css +8 -0
- package/dist/esm/compiled/components/internal/required-input.js +24 -0
- package/dist/esm/compiled/components/live-region.js +168 -0
- package/dist/esm/compiled/components/menu.compiled.css +19 -0
- package/dist/esm/compiled/components/menu.js +485 -0
- package/dist/esm/compiled/components/multi-value.compiled.css +56 -0
- package/dist/esm/compiled/components/multi-value.js +187 -0
- package/dist/esm/compiled/components/option.compiled.css +22 -0
- package/dist/esm/compiled/components/option.js +47 -0
- package/dist/esm/compiled/components/placeholder.compiled.css +7 -0
- package/dist/esm/compiled/components/placeholder.js +35 -0
- package/dist/esm/compiled/components/single-value.compiled.css +13 -0
- package/dist/esm/compiled/components/single-value.js +36 -0
- package/dist/esm/components/containers.js +12 -73
- package/dist/esm/components/control.js +8 -97
- package/dist/esm/components/group.js +11 -54
- package/dist/esm/components/indicators.js +15 -109
- package/dist/esm/components/input.js +8 -83
- package/dist/esm/components/internal/a11y-text.js +6 -26
- package/dist/esm/components/internal/dummy-input.js +7 -37
- package/dist/esm/components/internal/notify-open-layer-observer.js +1 -0
- package/dist/esm/components/internal/required-input.js +7 -32
- package/dist/esm/components/internal/scroll-manager.js +16 -16
- package/dist/esm/components/live-region.js +5 -163
- package/dist/esm/components/menu.js +21 -401
- package/dist/esm/components/multi-value.js +17 -199
- package/dist/esm/components/option.js +8 -69
- package/dist/esm/components/placeholder.js +8 -21
- package/dist/esm/components/single-value.js +8 -27
- package/dist/esm/emotion/components/containers.js +1 -0
- package/dist/esm/emotion/components/control.js +1 -0
- package/dist/esm/emotion/components/group.js +1 -0
- package/dist/esm/emotion/components/indicators.js +1 -0
- package/dist/esm/emotion/components/input.js +1 -0
- package/dist/esm/emotion/components/internal/a11y-text.js +1 -0
- package/dist/esm/emotion/components/internal/dummy-input.js +1 -0
- package/dist/esm/emotion/components/internal/required-input.js +1 -0
- package/dist/esm/emotion/components/internal/scroll-manager.js +2 -0
- package/dist/esm/emotion/components/live-region.js +2 -0
- package/dist/esm/emotion/components/menu.js +2 -0
- package/dist/esm/emotion/components/multi-value.js +1 -0
- package/dist/esm/emotion/components/option.js +1 -0
- package/dist/esm/emotion/components/placeholder.js +1 -0
- package/dist/esm/emotion/components/single-value.js +1 -0
- package/dist/esm/utils.js +2 -1
- package/dist/types/compiled/components/containers.d.ts +53 -0
- package/dist/types/compiled/components/control.d.ts +41 -0
- package/dist/types/compiled/components/group.d.ts +54 -0
- package/dist/types/compiled/components/indicators.d.ts +72 -0
- package/dist/types/compiled/components/input.d.ts +36 -0
- package/dist/types/compiled/components/internal/a11y-text.d.ts +3 -0
- package/dist/types/compiled/components/internal/dummy-input.d.ts +8 -0
- package/dist/types/compiled/components/internal/required-input.d.ts +10 -0
- package/dist/types/compiled/components/live-region.d.ts +19 -0
- package/dist/types/compiled/components/menu.d.ts +115 -0
- package/dist/types/compiled/components/multi-value.d.ts +57 -0
- package/dist/types/compiled/components/option.d.ts +48 -0
- package/dist/types/compiled/components/placeholder.d.ts +21 -0
- package/dist/types/compiled/components/single-value.d.ts +27 -0
- package/dist/types/components/containers.d.ts +6 -11
- package/dist/types/components/control.d.ts +4 -9
- package/dist/types/components/group.d.ts +8 -10
- package/dist/types/components/index.d.ts +21 -21
- package/dist/types/components/indicators.d.ts +7 -12
- package/dist/types/components/input.d.ts +3 -8
- package/dist/types/components/internal/a11y-text.d.ts +2 -7
- package/dist/types/components/internal/dummy-input.d.ts +3 -8
- package/dist/types/components/internal/required-input.d.ts +0 -4
- package/dist/types/components/internal/scroll-manager.d.ts +2 -7
- package/dist/types/components/live-region.d.ts +2 -8
- package/dist/types/components/menu.d.ts +10 -15
- package/dist/types/components/multi-value.d.ts +19 -13
- package/dist/types/components/option.d.ts +3 -8
- package/dist/types/components/placeholder.d.ts +3 -8
- package/dist/types/components/single-value.d.ts +3 -8
- package/dist/types/select.d.ts +21 -21
- package/dist/types/types.d.ts +3 -0
- package/dist/types-ts4.5/compiled/components/containers.d.ts +53 -0
- package/dist/types-ts4.5/compiled/components/control.d.ts +41 -0
- package/dist/types-ts4.5/compiled/components/group.d.ts +54 -0
- package/dist/types-ts4.5/compiled/components/indicators.d.ts +72 -0
- package/dist/types-ts4.5/compiled/components/input.d.ts +36 -0
- package/dist/types-ts4.5/compiled/components/internal/a11y-text.d.ts +3 -0
- package/dist/types-ts4.5/compiled/components/internal/dummy-input.d.ts +8 -0
- package/dist/types-ts4.5/compiled/components/internal/required-input.d.ts +10 -0
- package/dist/types-ts4.5/compiled/components/live-region.d.ts +19 -0
- package/dist/types-ts4.5/compiled/components/menu.d.ts +115 -0
- package/dist/types-ts4.5/compiled/components/multi-value.d.ts +57 -0
- package/dist/types-ts4.5/compiled/components/option.d.ts +48 -0
- package/dist/types-ts4.5/compiled/components/placeholder.d.ts +21 -0
- package/dist/types-ts4.5/compiled/components/single-value.d.ts +27 -0
- package/dist/types-ts4.5/components/containers.d.ts +6 -11
- package/dist/types-ts4.5/components/control.d.ts +4 -9
- package/dist/types-ts4.5/components/group.d.ts +8 -10
- package/dist/types-ts4.5/components/index.d.ts +21 -21
- package/dist/types-ts4.5/components/indicators.d.ts +7 -12
- package/dist/types-ts4.5/components/input.d.ts +3 -8
- package/dist/types-ts4.5/components/internal/a11y-text.d.ts +2 -7
- package/dist/types-ts4.5/components/internal/dummy-input.d.ts +3 -8
- package/dist/types-ts4.5/components/internal/required-input.d.ts +0 -4
- package/dist/types-ts4.5/components/internal/scroll-manager.d.ts +2 -7
- package/dist/types-ts4.5/components/live-region.d.ts +2 -8
- package/dist/types-ts4.5/components/menu.d.ts +10 -15
- package/dist/types-ts4.5/components/multi-value.d.ts +19 -13
- package/dist/types-ts4.5/components/option.d.ts +3 -8
- package/dist/types-ts4.5/components/placeholder.d.ts +3 -8
- package/dist/types-ts4.5/components/single-value.d.ts +3 -8
- package/dist/types-ts4.5/select.d.ts +21 -21
- package/dist/types-ts4.5/types.d.ts +3 -0
- package/package.json +11 -3
- package/dist/cjs/emotion/components/index.js +0 -52
- package/dist/cjs/emotion/components/internal/notify-open-layer-observer.js +0 -21
- package/dist/es2019/emotion/components/index.js +0 -41
- package/dist/es2019/emotion/components/internal/notify-open-layer-observer.js +0 -16
- package/dist/esm/emotion/components/index.js +0 -43
- package/dist/esm/emotion/components/internal/notify-open-layer-observer.js +0 -15
- package/dist/types/emotion/components/index.d.ts +0 -67
- package/dist/types/emotion/components/internal/notify-open-layer-observer.d.ts +0 -11
- package/dist/types-ts4.5/emotion/components/index.d.ts +0 -67
- package/dist/types-ts4.5/emotion/components/internal/notify-open-layer-observer.d.ts +0 -11
|
@@ -1,59 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const groupCSS = ({}) => ({
|
|
10
|
-
paddingBottom: "var(--ds-space-100, 8px)",
|
|
11
|
-
paddingTop: "var(--ds-space-100, 8px)"
|
|
12
|
-
});
|
|
13
|
-
const Group = props => {
|
|
14
|
-
const {
|
|
15
|
-
children,
|
|
16
|
-
cx,
|
|
17
|
-
getStyles,
|
|
18
|
-
getClassNames,
|
|
19
|
-
Heading,
|
|
20
|
-
headingProps,
|
|
21
|
-
innerProps,
|
|
22
|
-
label,
|
|
23
|
-
selectProps
|
|
24
|
-
} = props;
|
|
25
|
-
return jsx("div", _extends({}, getStyleProps(props, 'group', {
|
|
26
|
-
group: true
|
|
27
|
-
}), innerProps), jsx(Heading, _extends({}, headingProps, {
|
|
28
|
-
selectProps: selectProps,
|
|
29
|
-
getStyles: getStyles,
|
|
30
|
-
getClassNames: getClassNames,
|
|
31
|
-
cx: cx
|
|
32
|
-
}), label), jsx("div", null, children));
|
|
33
|
-
};
|
|
34
|
-
export const groupHeadingCSS = ({}) => ({
|
|
35
|
-
label: 'group',
|
|
36
|
-
cursor: 'default',
|
|
37
|
-
display: 'block',
|
|
38
|
-
marginBottom: '0.25em',
|
|
39
|
-
paddingLeft: "var(--ds-space-150, 12px)",
|
|
40
|
-
paddingRight: "var(--ds-space-150, 12px)",
|
|
41
|
-
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
42
|
-
color: "var(--ds-text-subtle, #44546F)",
|
|
43
|
-
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
44
|
-
textTransform: 'none'
|
|
45
|
-
});
|
|
1
|
+
/* eslint-disable @repo/internal/react/no-unsafe-spread-props */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import Compiled, { groupCSS as compiledGroupCSS, GroupHeading as CompiledGroupHeading, groupHeadingCSS as compiledGroupHeadingCSS } from '../compiled/components/group';
|
|
5
|
+
import Emotion, { groupCSS as emotionGroupCSS, GroupHeading as EmotionGroupHeading, groupHeadingCSS as emotionGroupHeadingCSS } from '../emotion/components/group';
|
|
6
|
+
export const groupCSS = props => fg('compiled-react-select') ? compiledGroupCSS() : emotionGroupCSS(props);
|
|
7
|
+
const Group = props => fg('compiled-react-select') ? /*#__PURE__*/React.createElement(Compiled, props) : /*#__PURE__*/React.createElement(Emotion, props);
|
|
8
|
+
export const groupHeadingCSS = props => fg('compiled-react-select') ? compiledGroupHeadingCSS() : emotionGroupHeadingCSS(props);
|
|
46
9
|
|
|
47
10
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
48
|
-
export const GroupHeading = props =>
|
|
49
|
-
const {
|
|
50
|
-
data,
|
|
51
|
-
...innerProps
|
|
52
|
-
} = cleanCommonProps(props);
|
|
53
|
-
return jsx("div", _extends({}, getStyleProps(props, 'groupHeading', {
|
|
54
|
-
'group-heading': true
|
|
55
|
-
}), innerProps));
|
|
56
|
-
};
|
|
11
|
+
export const GroupHeading = props => fg('compiled-react-select') ? /*#__PURE__*/React.createElement(CompiledGroupHeading, props) : /*#__PURE__*/React.createElement(EmotionGroupHeading, props);
|
|
57
12
|
|
|
58
13
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
59
14
|
export default Group;
|
|
@@ -1,128 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
8
|
-
import DownIcon from '@atlaskit/icon/utility/migration/chevron-down';
|
|
9
|
-
import CrossIcon from '@atlaskit/icon/utility/migration/cross-circle--select-clear';
|
|
10
|
-
import { Inline, Pressable, xcss } from '@atlaskit/primitives';
|
|
11
|
-
import Spinner from '@atlaskit/spinner';
|
|
12
|
-
import { getStyleProps } from '../utils';
|
|
13
|
-
|
|
14
|
-
// ==============================
|
|
15
|
-
// Dropdown & Clear Icons
|
|
16
|
-
// ==============================
|
|
17
|
-
|
|
18
|
-
const iconContainerStyles = xcss({
|
|
19
|
-
all: 'unset',
|
|
20
|
-
outline: 'revert',
|
|
21
|
-
display: 'flex',
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
justifyContent: 'center',
|
|
24
|
-
padding: 'space.025'
|
|
25
|
-
});
|
|
26
|
-
const dropdownWrapperStyles = xcss({
|
|
27
|
-
padding: 'space.075'
|
|
28
|
-
});
|
|
1
|
+
/* eslint-disable @repo/internal/react/no-unsafe-spread-props */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { ClearIndicator as CompiledClearIndicator, clearIndicatorCSS as compiledClearIndicatorCSS, DropdownIndicator as CompiledDropdownIndicator, dropdownIndicatorCSS as compiledDropdownIndicatorCSS, LoadingIndicator as CompiledLoadingIndicator, loadingIndicatorCSS as compiledLoadingIndicatorCSS } from '../compiled/components/indicators';
|
|
5
|
+
import { ClearIndicator as EmotionClearIndicator, clearIndicatorCSS as emotionClearIndicatorCSS, DropdownIndicator as EmotionDropdownIndicator, dropdownIndicatorCSS as emotionDropdownIndicatorCSS, LoadingIndicator as EmotionLoadingIndicator, loadingIndicatorCSS as emotionLoadingIndicatorCSS } from '../emotion/components/indicators';
|
|
29
6
|
|
|
30
7
|
// ==============================
|
|
31
8
|
// Dropdown & Clear Buttons
|
|
32
9
|
// ==============================
|
|
33
10
|
|
|
34
|
-
export const dropdownIndicatorCSS = (
|
|
35
|
-
isCompact,
|
|
36
|
-
isDisabled
|
|
37
|
-
}) => ({
|
|
38
|
-
label: 'indicatorContainer',
|
|
39
|
-
display: 'flex',
|
|
40
|
-
transition: 'color 150ms',
|
|
41
|
-
color: isDisabled ? "var(--ds-text-disabled, #091E424F)" : "var(--ds-text-subtle, #44546F)",
|
|
42
|
-
padding: `${isCompact ? 0 : "var(--ds-space-075, 6px)"} ${"var(--ds-space-025, 2px)"}`,
|
|
43
|
-
':hover': {
|
|
44
|
-
color: "var(--ds-text-subtle, #44546F)"
|
|
45
|
-
}
|
|
46
|
-
});
|
|
11
|
+
export const dropdownIndicatorCSS = props => fg('compiled-react-select') ? compiledDropdownIndicatorCSS() : emotionDropdownIndicatorCSS(props);
|
|
47
12
|
|
|
48
13
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
49
|
-
export const DropdownIndicator = props =>
|
|
50
|
-
|
|
51
|
-
innerProps,
|
|
52
|
-
children
|
|
53
|
-
} = props;
|
|
54
|
-
return jsx("div", _extends({}, getStyleProps(props, 'dropdownIndicator', {
|
|
55
|
-
indicator: true,
|
|
56
|
-
'dropdown-indicator': true
|
|
57
|
-
}), innerProps), children ? children : jsx(Inline, {
|
|
58
|
-
as: "span",
|
|
59
|
-
xcss: dropdownWrapperStyles
|
|
60
|
-
}, jsx(DownIcon, {
|
|
61
|
-
color: "currentColor",
|
|
62
|
-
label: "open",
|
|
63
|
-
LEGACY_margin: "var(--ds-space-negative-075, -0.375rem)"
|
|
64
|
-
})));
|
|
65
|
-
};
|
|
66
|
-
export const clearIndicatorCSS = ({
|
|
67
|
-
isCompact
|
|
68
|
-
}) => ({
|
|
69
|
-
label: 'indicatorContainer',
|
|
70
|
-
display: 'flex',
|
|
71
|
-
transition: 'color 150ms',
|
|
72
|
-
color: "var(--ds-text-subtlest, #626F86)",
|
|
73
|
-
padding: `${isCompact ? 0 : "var(--ds-space-075, 6px)"} ${"var(--ds-space-025, 2px)"}`,
|
|
74
|
-
':hover': {
|
|
75
|
-
color: "var(--ds-text-subtle, #44546F)"
|
|
76
|
-
}
|
|
77
|
-
});
|
|
14
|
+
export const DropdownIndicator = props => fg('compiled-react-select') ? /*#__PURE__*/React.createElement(CompiledDropdownIndicator, props) : /*#__PURE__*/React.createElement(EmotionDropdownIndicator, props);
|
|
15
|
+
export const clearIndicatorCSS = props => fg('compiled-react-select') ? compiledClearIndicatorCSS() : emotionClearIndicatorCSS(props);
|
|
78
16
|
|
|
79
17
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
80
|
-
export const ClearIndicator = props =>
|
|
81
|
-
const {
|
|
82
|
-
innerProps,
|
|
83
|
-
clearControlLabel = 'clear'
|
|
84
|
-
} = props;
|
|
85
|
-
return jsx("div", _extends({}, getStyleProps(props, 'clearIndicator', {
|
|
86
|
-
indicator: true,
|
|
87
|
-
'clear-indicator': true
|
|
88
|
-
}), innerProps), jsx(Pressable, {
|
|
89
|
-
xcss: iconContainerStyles,
|
|
90
|
-
tabIndex: -1,
|
|
91
|
-
"aria-label": clearControlLabel
|
|
92
|
-
}, jsx(CrossIcon, {
|
|
93
|
-
label: "",
|
|
94
|
-
color: "currentColor",
|
|
95
|
-
LEGACY_size: "small",
|
|
96
|
-
LEGACY_margin: "var(--ds-space-negative-025, -0.125rem)"
|
|
97
|
-
})));
|
|
98
|
-
};
|
|
18
|
+
export const ClearIndicator = props => fg('compiled-react-select') ? /*#__PURE__*/React.createElement(CompiledClearIndicator, props) : /*#__PURE__*/React.createElement(EmotionClearIndicator, props);
|
|
99
19
|
|
|
100
20
|
// ==============================
|
|
101
21
|
// Loading
|
|
102
22
|
// ==============================
|
|
103
23
|
|
|
104
|
-
export const loadingIndicatorCSS = (
|
|
105
|
-
isCompact
|
|
106
|
-
}) => ({
|
|
107
|
-
label: 'loadingIndicator',
|
|
108
|
-
padding: `${isCompact ? 0 : "var(--ds-space-075, 6px)"} ${"var(--ds-space-100, 8px)"}`
|
|
109
|
-
});
|
|
24
|
+
export const loadingIndicatorCSS = props => fg('compiled-react-select') ? compiledLoadingIndicatorCSS() : emotionLoadingIndicatorCSS(props);
|
|
110
25
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
111
|
-
export const LoadingIndicator = (
|
|
112
|
-
innerProps,
|
|
113
|
-
isRtl,
|
|
114
|
-
size = 4,
|
|
115
|
-
...restProps
|
|
116
|
-
}) => {
|
|
117
|
-
return jsx("div", _extends({}, getStyleProps({
|
|
118
|
-
...restProps,
|
|
119
|
-
innerProps,
|
|
120
|
-
isRtl,
|
|
121
|
-
size
|
|
122
|
-
}, 'loadingIndicator', {
|
|
123
|
-
indicator: true,
|
|
124
|
-
'loading-indicator': true
|
|
125
|
-
}), innerProps), jsx(Spinner, {
|
|
126
|
-
size: "small"
|
|
127
|
-
}));
|
|
128
|
-
};
|
|
26
|
+
export const LoadingIndicator = props => fg('compiled-react-select') ? /*#__PURE__*/React.createElement(CompiledLoadingIndicator, props) : /*#__PURE__*/React.createElement(EmotionLoadingIndicator, props);
|
|
@@ -1,86 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { cleanCommonProps, getStyleProps } from '../utils';
|
|
9
|
-
export const inputCSS = ({
|
|
10
|
-
isDisabled,
|
|
11
|
-
value
|
|
12
|
-
}) => ({
|
|
13
|
-
visibility: isDisabled ? 'hidden' : 'visible',
|
|
14
|
-
// force css to recompute when value change due to @emotion bug.
|
|
15
|
-
// We can remove it whenever the bug is fixed.
|
|
16
|
-
transform: value ? 'translateZ(0)' : '',
|
|
17
|
-
...containerStyle,
|
|
18
|
-
margin: "var(--ds-space-025, 2px)",
|
|
19
|
-
paddingBottom: "var(--ds-space-025, 2px)",
|
|
20
|
-
paddingTop: "var(--ds-space-025, 2px)",
|
|
21
|
-
color: "var(--ds-text, #172B4D)"
|
|
22
|
-
});
|
|
23
|
-
const spacingStyle = {
|
|
24
|
-
gridArea: '1 / 2',
|
|
25
|
-
font: 'inherit',
|
|
26
|
-
minWidth: '2px',
|
|
27
|
-
border: 0,
|
|
28
|
-
margin: 0,
|
|
29
|
-
outline: 0,
|
|
30
|
-
padding: 0
|
|
31
|
-
};
|
|
32
|
-
const containerStyle = {
|
|
33
|
-
flex: '1 1 auto',
|
|
34
|
-
display: 'inline-grid',
|
|
35
|
-
gridArea: '1 / 1 / 2 / 3',
|
|
36
|
-
gridTemplateColumns: '0 min-content',
|
|
37
|
-
'&:after': {
|
|
38
|
-
content: 'attr(data-value) " "',
|
|
39
|
-
visibility: 'hidden',
|
|
40
|
-
whiteSpace: 'pre',
|
|
41
|
-
...spacingStyle
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const inputStyle = isHidden => ({
|
|
45
|
-
label: 'input',
|
|
46
|
-
color: 'inherit',
|
|
47
|
-
background: 0,
|
|
48
|
-
opacity: isHidden ? 0 : 1,
|
|
49
|
-
width: '100%',
|
|
50
|
-
...spacingStyle
|
|
51
|
-
});
|
|
52
|
-
const Input = props => {
|
|
53
|
-
const {
|
|
54
|
-
cx,
|
|
55
|
-
value
|
|
56
|
-
} = props;
|
|
57
|
-
const {
|
|
58
|
-
innerRef,
|
|
59
|
-
isDisabled,
|
|
60
|
-
isHidden,
|
|
61
|
-
inputClassName,
|
|
62
|
-
testId,
|
|
63
|
-
...innerProps
|
|
64
|
-
} = cleanCommonProps(props);
|
|
65
|
-
const dataId = testId ? `${testId}-select--input` : null;
|
|
66
|
-
return jsx("div", _extends({}, getStyleProps(props, 'input', {
|
|
67
|
-
'input-container': true
|
|
68
|
-
}), {
|
|
69
|
-
"data-value": value || '',
|
|
70
|
-
"data-testid": dataId && `${dataId}-container`
|
|
71
|
-
}), jsx("input", _extends({
|
|
72
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
73
|
-
className: cx({
|
|
74
|
-
input: true
|
|
75
|
-
}, inputClassName),
|
|
76
|
-
ref: innerRef
|
|
77
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
78
|
-
,
|
|
79
|
-
style: inputStyle(isHidden),
|
|
80
|
-
disabled: isDisabled,
|
|
81
|
-
"data-testid": dataId
|
|
82
|
-
}, innerProps)));
|
|
83
|
-
};
|
|
1
|
+
/* eslint-disable @repo/internal/react/no-unsafe-spread-props */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import Compiled, { inputCSS as compiledInputCSS } from '../compiled/components/input';
|
|
5
|
+
import Emotion, { inputCSS as emotionInputCSS } from '../emotion/components/input';
|
|
6
|
+
export const inputCSS = props => fg('compiled-react-select') ? compiledInputCSS() : emotionInputCSS(props);
|
|
7
|
+
const Input = props => fg('compiled-react-select') ? /*#__PURE__*/React.createElement(Compiled, props) : /*#__PURE__*/React.createElement(Emotion, props);
|
|
84
8
|
|
|
85
9
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
86
10
|
export default Input;
|
|
@@ -1,27 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// Assistive text to describe visual elements. Hidden for sighted users.
|
|
9
|
-
const styles = css({
|
|
10
|
-
width: 1,
|
|
11
|
-
height: 1,
|
|
12
|
-
padding: 0,
|
|
13
|
-
position: 'absolute',
|
|
14
|
-
zIndex: 9999,
|
|
15
|
-
border: 0,
|
|
16
|
-
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
17
|
-
label: 'a11yText',
|
|
18
|
-
overflow: 'hidden',
|
|
19
|
-
userSelect: 'none',
|
|
20
|
-
// while hidden text is sitting in the DOM, it should not be selectable
|
|
21
|
-
whiteSpace: 'nowrap'
|
|
22
|
-
});
|
|
23
|
-
const A11yText = props => jsx("span", _extends({
|
|
24
|
-
css: styles
|
|
25
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
26
|
-
}, props));
|
|
1
|
+
/* eslint-disable @repo/internal/react/no-unsafe-spread-props */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import Compiled from '../../compiled/components/internal/a11y-text';
|
|
5
|
+
import Emotion from '../../emotion/components/internal/a11y-text';
|
|
6
|
+
const A11yText = props => fg('compiled-react-select') ? /*#__PURE__*/React.createElement(Compiled, props) : /*#__PURE__*/React.createElement(Emotion, props);
|
|
27
7
|
export default A11yText;
|
|
@@ -1,37 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { removeProps } from '../../utils';
|
|
9
|
-
const dummyInputStyles = css({
|
|
10
|
-
width: 1,
|
|
11
|
-
padding: 0,
|
|
12
|
-
position: 'relative',
|
|
13
|
-
background: 0,
|
|
14
|
-
border: 0,
|
|
15
|
-
caretColor: 'transparent',
|
|
16
|
-
color: 'transparent',
|
|
17
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
18
|
-
fontSize: 'inherit',
|
|
19
|
-
gridArea: '1 / 1 / 2 / 3',
|
|
20
|
-
insetInlineStart: -100,
|
|
21
|
-
label: 'dummyInput',
|
|
22
|
-
opacity: 0,
|
|
23
|
-
outline: 0,
|
|
24
|
-
transform: 'scale(.01)'
|
|
25
|
-
});
|
|
26
|
-
export default function DummyInput({
|
|
27
|
-
innerRef,
|
|
28
|
-
...props
|
|
29
|
-
}) {
|
|
30
|
-
// Remove animation props not meant for HTML elements
|
|
31
|
-
const filteredProps = removeProps(props, 'onExited', 'in', 'enter', 'exit', 'appear');
|
|
32
|
-
return jsx("input", _extends({
|
|
33
|
-
ref: innerRef
|
|
34
|
-
}, filteredProps, {
|
|
35
|
-
css: dummyInputStyles
|
|
36
|
-
}));
|
|
1
|
+
/* eslint-disable @repo/internal/react/no-unsafe-spread-props */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import Compiled from '../../compiled/components/internal/dummy-input';
|
|
5
|
+
import Emotion from '../../emotion/components/internal/dummy-input';
|
|
6
|
+
export default function DummyInput(props) {
|
|
7
|
+
return fg('compiled-react-select') ? /*#__PURE__*/React.createElement(Compiled, props) : /*#__PURE__*/React.createElement(Emotion, props);
|
|
37
8
|
}
|
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import __noop from '@atlaskit/ds-lib/noop';
|
|
8
|
-
const styles = css({
|
|
9
|
-
width: '100%',
|
|
10
|
-
position: 'absolute',
|
|
11
|
-
insetBlockEnd: 0,
|
|
12
|
-
insetInlineEnd: 0,
|
|
13
|
-
insetInlineStart: 0,
|
|
14
|
-
label: 'requiredInput',
|
|
15
|
-
opacity: 0,
|
|
16
|
-
pointerEvents: 'none'
|
|
17
|
-
});
|
|
18
|
-
const RequiredInput = ({
|
|
19
|
-
name,
|
|
20
|
-
onFocus
|
|
21
|
-
}) => jsx("input", {
|
|
22
|
-
required: true,
|
|
23
|
-
name: name,
|
|
24
|
-
tabIndex: -1,
|
|
25
|
-
"aria-hidden": "true",
|
|
26
|
-
onFocus: onFocus,
|
|
27
|
-
css: styles
|
|
28
|
-
// Prevent `Switching from uncontrolled to controlled` error
|
|
29
|
-
,
|
|
30
|
-
value: "",
|
|
31
|
-
onChange: __noop
|
|
32
|
-
});
|
|
1
|
+
/* eslint-disable @repo/internal/react/no-unsafe-spread-props */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import Compiled from '../../compiled/components/internal/required-input';
|
|
5
|
+
import Emotion from '../../emotion/components/internal/required-input';
|
|
6
|
+
const RequiredInput = props => fg('compiled-react-select') ? /*#__PURE__*/React.createElement(Compiled, props) : /*#__PURE__*/React.createElement(Emotion, props);
|
|
33
7
|
|
|
34
8
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
35
9
|
export default RequiredInput;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { Fragment } from 'react';
|
|
6
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
7
2
|
import useScrollCapture from './use-scroll-capture';
|
|
8
3
|
import useScrollLock from './use-scroll-lock';
|
|
9
|
-
const styles = css({
|
|
10
|
-
position: 'fixed',
|
|
11
|
-
insetBlockEnd: 0,
|
|
12
|
-
insetBlockStart: 0,
|
|
13
|
-
insetInlineEnd: 0,
|
|
14
|
-
insetInlineStart: 0
|
|
15
|
-
});
|
|
16
4
|
const blurSelectInput = event => {
|
|
17
5
|
const element = event.target;
|
|
18
6
|
return element.ownerDocument.activeElement && element.ownerDocument.activeElement.blur();
|
|
@@ -40,10 +28,22 @@ export default function ScrollManager({
|
|
|
40
28
|
setScrollCaptureTarget(element);
|
|
41
29
|
setScrollLockTarget(element);
|
|
42
30
|
};
|
|
43
|
-
return
|
|
31
|
+
return /*#__PURE__*/React.createElement(Fragment, null, lockEnabled &&
|
|
32
|
+
/*#__PURE__*/
|
|
44
33
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
45
|
-
|
|
34
|
+
React.createElement("div", {
|
|
46
35
|
onClick: blurSelectInput,
|
|
47
|
-
|
|
36
|
+
style: {
|
|
37
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
38
|
+
position: 'fixed',
|
|
39
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
40
|
+
insetBlockEnd: 0,
|
|
41
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
42
|
+
insetBlockStart: 0,
|
|
43
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
44
|
+
insetInlineEnd: 0,
|
|
45
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
46
|
+
insetInlineStart: 0
|
|
47
|
+
}
|
|
48
48
|
}), children(targetRef));
|
|
49
49
|
}
|
|
@@ -1,178 +1,15 @@
|
|
|
1
|
-
/* eslint-disable @
|
|
2
|
-
|
|
3
|
-
* @jsxRuntime classic
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
* @jsxFrag React.Fragment
|
|
6
|
-
*/
|
|
7
|
-
import React, { Fragment, useMemo, useRef } from 'react';
|
|
8
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
/* eslint-disable @repo/internal/react/no-unsafe-spread-props */
|
|
2
|
+
import React from 'react';
|
|
9
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
4
|
+
import Compiled from '../compiled/components/live-region';
|
|
5
|
+
import Emotion from '../emotion/components/live-region';
|
|
12
6
|
|
|
13
7
|
// ==============================
|
|
14
8
|
// Root Container
|
|
15
9
|
// ==============================
|
|
16
10
|
|
|
17
11
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
18
|
-
const LiveRegion = props =>
|
|
19
|
-
const {
|
|
20
|
-
ariaSelection,
|
|
21
|
-
focusedOption,
|
|
22
|
-
focusedValue,
|
|
23
|
-
focusableOptions,
|
|
24
|
-
isFocused,
|
|
25
|
-
selectValue,
|
|
26
|
-
selectProps,
|
|
27
|
-
id,
|
|
28
|
-
isAppleDevice
|
|
29
|
-
} = props;
|
|
30
|
-
const {
|
|
31
|
-
ariaLiveMessages,
|
|
32
|
-
getOptionLabel,
|
|
33
|
-
inputValue,
|
|
34
|
-
isMulti,
|
|
35
|
-
isOptionDisabled,
|
|
36
|
-
isSearchable,
|
|
37
|
-
label,
|
|
38
|
-
menuIsOpen,
|
|
39
|
-
options,
|
|
40
|
-
screenReaderStatus,
|
|
41
|
-
tabSelectsValue,
|
|
42
|
-
isLoading
|
|
43
|
-
} = selectProps;
|
|
44
|
-
const ariaLabel = selectProps['aria-label'] || label;
|
|
45
|
-
const ariaLive = selectProps['aria-live'];
|
|
46
|
-
|
|
47
|
-
// for safari, we will use minimum support from aria-live region
|
|
48
|
-
const isA11yImprovementEnabled = fg('design_system_select-a11y-improvement') && !isAppleDevice;
|
|
49
|
-
|
|
50
|
-
// Update aria live message configuration when prop changes
|
|
51
|
-
const messages = useMemo(() => ({
|
|
52
|
-
...defaultAriaLiveMessages,
|
|
53
|
-
...(ariaLiveMessages || {})
|
|
54
|
-
}), [ariaLiveMessages]);
|
|
55
|
-
|
|
56
|
-
// Update aria live selected option when prop changes
|
|
57
|
-
const ariaSelected = useMemo(() => {
|
|
58
|
-
let message = '';
|
|
59
|
-
if (isA11yImprovementEnabled && menuIsOpen) {
|
|
60
|
-
// we don't need to have selected message when the menu is open
|
|
61
|
-
return '';
|
|
62
|
-
}
|
|
63
|
-
if (ariaSelection && messages.onChange) {
|
|
64
|
-
const {
|
|
65
|
-
option,
|
|
66
|
-
options: selectedOptions,
|
|
67
|
-
removedValue,
|
|
68
|
-
removedValues,
|
|
69
|
-
value
|
|
70
|
-
} = ariaSelection;
|
|
71
|
-
// select-option when !isMulti does not return option so we assume selected option is value
|
|
72
|
-
const asOption = val => !Array.isArray(val) ? val : null;
|
|
73
|
-
|
|
74
|
-
// If there is just one item from the action then get its label
|
|
75
|
-
const selected = removedValue || option || asOption(value);
|
|
76
|
-
const label = selected ? getOptionLabel(selected) : '';
|
|
77
|
-
|
|
78
|
-
// If there are multiple items from the action then return an array of labels
|
|
79
|
-
const multiSelected = selectedOptions || removedValues || undefined;
|
|
80
|
-
const labels = multiSelected ? multiSelected.map(getOptionLabel) : [];
|
|
81
|
-
if (isA11yImprovementEnabled && !label && !labels.length) {
|
|
82
|
-
// return empty string if no labels provided
|
|
83
|
-
return '';
|
|
84
|
-
}
|
|
85
|
-
const onChangeProps = {
|
|
86
|
-
// multiSelected items are usually items that have already been selected
|
|
87
|
-
// or set by the user as a default value so we assume they are not disabled
|
|
88
|
-
isDisabled: selected && isOptionDisabled(selected, selectValue),
|
|
89
|
-
label,
|
|
90
|
-
labels,
|
|
91
|
-
...ariaSelection
|
|
92
|
-
};
|
|
93
|
-
message = messages.onChange(onChangeProps);
|
|
94
|
-
}
|
|
95
|
-
return message;
|
|
96
|
-
}, [ariaSelection, messages, isOptionDisabled, selectValue, getOptionLabel, isA11yImprovementEnabled, menuIsOpen]);
|
|
97
|
-
const prevInputValue = useRef('');
|
|
98
|
-
const ariaFocused = useMemo(() => {
|
|
99
|
-
let focusMsg = '';
|
|
100
|
-
const focused = focusedOption || focusedValue;
|
|
101
|
-
const isSelected = !!(focusedOption && selectValue && selectValue.includes(focusedOption));
|
|
102
|
-
if (inputValue === prevInputValue.current && isA11yImprovementEnabled) {
|
|
103
|
-
// only announce focus option when searching when ff is on and the input value changed
|
|
104
|
-
// for safari, we will announce for all
|
|
105
|
-
return '';
|
|
106
|
-
}
|
|
107
|
-
if (focused && messages.onFocus) {
|
|
108
|
-
const onFocusProps = {
|
|
109
|
-
focused,
|
|
110
|
-
label: getOptionLabel(focused),
|
|
111
|
-
isDisabled: isOptionDisabled(focused, selectValue),
|
|
112
|
-
isSelected,
|
|
113
|
-
options: focusableOptions,
|
|
114
|
-
context: focused === focusedOption ? 'menu' : 'value',
|
|
115
|
-
selectValue,
|
|
116
|
-
isMulti
|
|
117
|
-
};
|
|
118
|
-
focusMsg = messages.onFocus(onFocusProps);
|
|
119
|
-
}
|
|
120
|
-
prevInputValue.current = inputValue;
|
|
121
|
-
return focusMsg;
|
|
122
|
-
}, [inputValue, focusedOption, focusedValue, getOptionLabel, isOptionDisabled, messages, focusableOptions, selectValue, isA11yImprovementEnabled, isMulti]);
|
|
123
|
-
const ariaResults = useMemo(() => {
|
|
124
|
-
let resultsMsg = '';
|
|
125
|
-
if (menuIsOpen && options.length && !isLoading && messages.onFilter) {
|
|
126
|
-
const resultsMessage = screenReaderStatus({
|
|
127
|
-
count: focusableOptions.length
|
|
128
|
-
});
|
|
129
|
-
resultsMsg = messages.onFilter({
|
|
130
|
-
inputValue,
|
|
131
|
-
resultsMessage
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
return resultsMsg;
|
|
135
|
-
}, [focusableOptions, inputValue, menuIsOpen, messages, options, screenReaderStatus, isLoading]);
|
|
136
|
-
const isInitialFocus = (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === 'initial-input-focus';
|
|
137
|
-
const ariaGuidance = useMemo(() => {
|
|
138
|
-
if (fg('design_system_select-a11y-improvement')) {
|
|
139
|
-
// don't announce guidance at all when ff is on
|
|
140
|
-
return '';
|
|
141
|
-
}
|
|
142
|
-
let guidanceMsg = '';
|
|
143
|
-
if (messages.guidance) {
|
|
144
|
-
const context = focusedValue ? 'value' : menuIsOpen ? 'menu' : 'input';
|
|
145
|
-
guidanceMsg = messages.guidance({
|
|
146
|
-
'aria-label': ariaLabel,
|
|
147
|
-
context,
|
|
148
|
-
isDisabled: focusedOption && isOptionDisabled(focusedOption, selectValue),
|
|
149
|
-
isMulti,
|
|
150
|
-
isSearchable,
|
|
151
|
-
tabSelectsValue,
|
|
152
|
-
isInitialFocus
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
return guidanceMsg;
|
|
156
|
-
}, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
|
|
157
|
-
const ScreenReaderText = jsx(Fragment, null, jsx("span", {
|
|
158
|
-
id: "aria-selection"
|
|
159
|
-
}, ariaSelected), jsx("span", {
|
|
160
|
-
id: "aria-results"
|
|
161
|
-
}, ariaResults), !fg('design_system_select-a11y-improvement') && jsx(React.Fragment, null, jsx("span", {
|
|
162
|
-
id: "aria-focused"
|
|
163
|
-
}, ariaFocused), jsx("span", {
|
|
164
|
-
id: "aria-guidance"
|
|
165
|
-
}, ariaGuidance)));
|
|
166
|
-
return jsx(Fragment, null, jsx(A11yText, {
|
|
167
|
-
id: id
|
|
168
|
-
}, isInitialFocus && ScreenReaderText), jsx(A11yText, {
|
|
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'
|
|
174
|
-
}, isFocused && !isInitialFocus && ScreenReaderText));
|
|
175
|
-
};
|
|
12
|
+
const LiveRegion = props => fg('compiled-react-select') ? /*#__PURE__*/React.createElement(Compiled, props) : /*#__PURE__*/React.createElement(Emotion, props);
|
|
176
13
|
|
|
177
14
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
178
15
|
export default LiveRegion;
|