@atlaskit/react-select 3.16.0 → 3.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/async.js +1 -6
- package/dist/cjs/compiled/components/indicators-container.compiled.css +5 -0
- package/dist/cjs/compiled/components/indicators-container.js +40 -0
- package/dist/cjs/compiled/components/select-container.compiled.css +6 -0
- package/dist/cjs/compiled/components/select-container.js +52 -0
- package/dist/cjs/compiled/components/value-container.compiled.css +20 -0
- package/dist/cjs/compiled/components/{containers.js → value-container.js} +7 -69
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/components/multi-value.js +13 -2
- package/dist/cjs/creatable.js +1 -6
- package/dist/cjs/entry-points/async.js +4 -4
- package/dist/cjs/entry-points/creatable.js +4 -4
- package/dist/cjs/internal/select-get-styles-context.js +20 -0
- package/dist/cjs/internal/use-select-get-styles.js +18 -0
- package/dist/cjs/select.js +6 -3
- package/dist/cjs/theme.js +1 -7
- package/dist/es2019/async.js +0 -1
- package/dist/es2019/compiled/components/indicators-container.compiled.css +5 -0
- package/dist/es2019/compiled/components/indicators-container.js +35 -0
- package/dist/es2019/compiled/components/select-container.compiled.css +6 -0
- package/dist/es2019/compiled/components/select-container.js +47 -0
- package/dist/es2019/compiled/components/value-container.compiled.css +20 -0
- package/dist/es2019/compiled/components/{containers.js → value-container.js} +2 -70
- package/dist/es2019/components/index.js +1 -0
- package/dist/es2019/components/multi-value.js +13 -2
- package/dist/es2019/creatable.js +1 -1
- package/dist/es2019/entry-points/async.js +1 -1
- package/dist/es2019/entry-points/creatable.js +1 -1
- package/dist/es2019/internal/select-get-styles-context.js +14 -0
- package/dist/es2019/internal/use-select-get-styles.js +10 -0
- package/dist/es2019/select.js +6 -3
- package/dist/es2019/theme.js +0 -7
- package/dist/esm/async.js +0 -1
- package/dist/esm/compiled/components/indicators-container.compiled.css +5 -0
- package/dist/esm/compiled/components/indicators-container.js +32 -0
- package/dist/esm/compiled/components/select-container.compiled.css +6 -0
- package/dist/esm/compiled/components/select-container.js +44 -0
- package/dist/esm/compiled/components/value-container.compiled.css +20 -0
- package/dist/esm/compiled/components/value-container.js +50 -0
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/multi-value.js +13 -2
- package/dist/esm/creatable.js +1 -1
- package/dist/esm/entry-points/async.js +1 -1
- package/dist/esm/entry-points/creatable.js +1 -1
- package/dist/esm/internal/select-get-styles-context.js +14 -0
- package/dist/esm/internal/use-select-get-styles.js +12 -0
- package/dist/esm/select.js +6 -3
- package/dist/esm/theme.js +0 -7
- package/dist/types/async.d.ts +1 -2
- package/dist/types/compiled/components/indicators-container.d.ts +18 -0
- package/dist/types/compiled/components/select-container.d.ts +22 -0
- package/dist/types/compiled/components/value-container.d.ts +22 -0
- package/dist/types/creatable.d.ts +1 -2
- package/dist/types/entry-points/async.d.ts +1 -1
- package/dist/types/entry-points/creatable.d.ts +1 -1
- package/dist/types/internal/select-get-styles-context.d.ts +12 -0
- package/dist/types/internal/use-select-get-styles.d.ts +1 -0
- package/dist/types/theme.d.ts +0 -2
- package/dist/types-ts4.5/async.d.ts +1 -2
- package/dist/types-ts4.5/compiled/components/indicators-container.d.ts +18 -0
- package/dist/types-ts4.5/compiled/components/select-container.d.ts +22 -0
- package/dist/types-ts4.5/compiled/components/value-container.d.ts +22 -0
- package/dist/types-ts4.5/creatable.d.ts +1 -2
- package/dist/types-ts4.5/entry-points/async.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/creatable.d.ts +1 -1
- package/dist/types-ts4.5/internal/select-get-styles-context.d.ts +12 -0
- package/dist/types-ts4.5/internal/use-select-get-styles.d.ts +1 -0
- package/dist/types-ts4.5/theme.d.ts +0 -2
- package/package.json +7 -5
- package/dist/cjs/compiled/components/containers.compiled.css +0 -28
- package/dist/es2019/compiled/components/containers.compiled.css +0 -28
- package/dist/esm/compiled/components/containers.compiled.css +0 -28
- package/dist/esm/compiled/components/containers.js +0 -112
- package/dist/types/compiled/components/containers.d.ts +0 -50
- package/dist/types-ts4.5/compiled/components/containers.d.ts +0 -50
|
@@ -1,52 +1,12 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* value-container.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
import "./
|
|
3
|
+
import "./value-container.compiled.css";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { cx } from '@compiled/react';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import { getStyleProps } from '../../get-style-props';
|
|
9
9
|
|
|
10
|
-
// ==============================
|
|
11
|
-
// Root Container
|
|
12
|
-
// ==============================
|
|
13
|
-
|
|
14
|
-
// iOS Safari automatically zooms into form inputs on focus when the font size is less than 16px.
|
|
15
|
-
// To prevent this zoom behaviour on mobile devices, the select container uses font.body.large (16px) by default,
|
|
16
|
-
// then switches to the smaller font.body on screens wider than 30rem (desktop).
|
|
17
|
-
// @see: https://medium.com/@rares.popescu/2-ways-to-avoid-the-automatic-zoom-in-on-input-fields-8a71479e542e
|
|
18
|
-
|
|
19
|
-
const containerStyles = {
|
|
20
|
-
default: "_11c81d4k _kqswh2mm _lcxv1rj4 _1tn2fhey",
|
|
21
|
-
rtl: "_1eim1xrj",
|
|
22
|
-
disabled: "_80om13gf"
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
26
|
-
export const SelectContainer = props => {
|
|
27
|
-
const {
|
|
28
|
-
children,
|
|
29
|
-
innerProps,
|
|
30
|
-
isDisabled,
|
|
31
|
-
isRtl,
|
|
32
|
-
xcss
|
|
33
|
-
} = props;
|
|
34
|
-
const {
|
|
35
|
-
className,
|
|
36
|
-
css
|
|
37
|
-
} = getStyleProps(props, 'container', {
|
|
38
|
-
'--is-disabled': isDisabled,
|
|
39
|
-
'--is-rtl': isRtl
|
|
40
|
-
});
|
|
41
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
42
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
43
|
-
className: ax([containerStyles.default, isRtl && containerStyles.rtl, isDisabled && containerStyles.disabled, cx(className, xcss, '-container')])
|
|
44
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
45
|
-
,
|
|
46
|
-
style: css
|
|
47
|
-
}, innerProps), children);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
10
|
// ==============================
|
|
51
11
|
// Value Container
|
|
52
12
|
// ==============================
|
|
@@ -92,32 +52,4 @@ export const ValueContainer = props => {
|
|
|
92
52
|
,
|
|
93
53
|
style: css
|
|
94
54
|
}, innerProps), children);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// ==============================
|
|
98
|
-
// Indicator Container
|
|
99
|
-
// ==============================
|
|
100
|
-
|
|
101
|
-
const indicatorContainerStyles = null;
|
|
102
|
-
|
|
103
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
104
|
-
export const IndicatorsContainer = props => {
|
|
105
|
-
const {
|
|
106
|
-
children,
|
|
107
|
-
innerProps,
|
|
108
|
-
xcss
|
|
109
|
-
} = props;
|
|
110
|
-
const {
|
|
111
|
-
css,
|
|
112
|
-
className
|
|
113
|
-
} = getStyleProps(props, 'indicatorsContainer', {
|
|
114
|
-
indicators: true
|
|
115
|
-
});
|
|
116
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
117
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
118
|
-
style: css
|
|
119
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
120
|
-
,
|
|
121
|
-
className: ax(["_1e0c1txw _4cvr1h6o _1o9zidpf _1wpz1fhb _y4ti1b66", cx(className, xcss, '-IndicatorsContainer')])
|
|
122
|
-
}, innerProps), children);
|
|
123
55
|
};
|
|
@@ -47,6 +47,7 @@ export const components = {
|
|
|
47
47
|
SingleValue: SingleValue,
|
|
48
48
|
ValueContainer: ValueContainer
|
|
49
49
|
};
|
|
50
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
50
51
|
export const defaultComponents = props => ({
|
|
51
52
|
...components,
|
|
52
53
|
...props.components
|
|
@@ -7,6 +7,7 @@ import { cx } from '@compiled/react';
|
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import Tag from '@atlaskit/tag';
|
|
9
9
|
import { getStyleProps } from '../get-style-props';
|
|
10
|
+
import { useSelectGetStyles } from '../internal/use-select-get-styles';
|
|
10
11
|
import { MultiValueLabel } from './multi-value-label';
|
|
11
12
|
const multiValueTagWrapperStyles = {
|
|
12
13
|
root: "_16jlidpf _1o9zkb7n _i0dl1wug _1mouze3t _195gze3t _4cvr1h6o _1e0c1txw _1ul9ze3t _zdxokb7n _v5ynkb7n _13lsf1ug _3pxh1h6o _d0dz1txw _1ouwze3t"
|
|
@@ -86,8 +87,18 @@ const MultiValue = props => {
|
|
|
86
87
|
'multi-value__remove': true
|
|
87
88
|
});
|
|
88
89
|
const hasCustomLabel = Label !== MultiValueLabel;
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
const selectStyles = selectProps.styles;
|
|
91
|
+
const hasCustomMultiValueStyles = Boolean((selectStyles === null || selectStyles === void 0 ? void 0 : selectStyles.multiValue) || (selectStyles === null || selectStyles === void 0 ? void 0 : selectStyles.multiValueLabel) || (selectStyles === null || selectStyles === void 0 ? void 0 : selectStyles.multiValueRemove));
|
|
92
|
+
const selectClassNames = selectProps.classNames;
|
|
93
|
+
const hasCustomMultiValueClassNames = Boolean((selectClassNames === null || selectClassNames === void 0 ? void 0 : selectClassNames.multiValue) || (selectClassNames === null || selectClassNames === void 0 ? void 0 : selectClassNames.multiValueLabel) || (selectClassNames === null || selectClassNames === void 0 ? void 0 : selectClassNames.multiValueRemove));
|
|
94
|
+
// Detect if getStyles was overridden directly on this component instance (e.g. via the
|
|
95
|
+
// components prop wrapper passing a custom getStyles). The context holds the original
|
|
96
|
+
// Select instance's getStyles — a reference inequality means a custom override was passed.
|
|
97
|
+
// When context is absent (e.g. in mocked/test contexts), assume no override.
|
|
98
|
+
const selectGetStyles = useSelectGetStyles();
|
|
99
|
+
const hasOverriddenGetStyles = selectGetStyles !== undefined && props.getStyles !== selectGetStyles;
|
|
100
|
+
const hasCustomContainerStyles = hasCustomMultiValueStyles || hasCustomMultiValueClassNames || hasOverriddenGetStyles;
|
|
101
|
+
if (ffTagUplifts && isPlainLabel && !hasCustomLabel && !hasCustomContainerStyles) {
|
|
91
102
|
const {
|
|
92
103
|
elemBefore,
|
|
93
104
|
color: tagColor
|
package/dist/es2019/creatable.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { useAsync } from '../async';
|
|
1
|
+
export { default as useAsync } from '../use-async';
|
|
2
2
|
export { default } from '../async';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { useCreatable } from '../creatable';
|
|
1
|
+
export { default as useCreatable } from '../use-creatable';
|
|
2
2
|
export { default } from '../creatable';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal context used to pass the original Select instance's getStyles function
|
|
3
|
+
* down to components like MultiValue, without polluting the public CommonProps API.
|
|
4
|
+
*
|
|
5
|
+
* This allows MultiValue to detect whether getStyles has been overridden on a
|
|
6
|
+
* component instance (e.g. via a custom component wrapper passing a different
|
|
7
|
+
* getStyles prop), by comparing props.getStyles against the original.
|
|
8
|
+
*
|
|
9
|
+
* @internal — not part of the public API
|
|
10
|
+
*/
|
|
11
|
+
import { createContext } from 'react';
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
14
|
+
export const SelectGetStylesContext = /*#__PURE__*/createContext(undefined);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to consume the SelectGetStylesContext.
|
|
3
|
+
*
|
|
4
|
+
* @internal — not part of the public API
|
|
5
|
+
*/
|
|
6
|
+
import { useContext } from 'react';
|
|
7
|
+
import { SelectGetStylesContext } from './select-get-styles-context';
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
10
|
+
export const useSelectGetStyles = () => useContext(SelectGetStylesContext);
|
package/dist/es2019/select.js
CHANGED
|
@@ -22,6 +22,7 @@ import { NotifyOpenLayerObserver } from './internal/notify-open-layer-observer';
|
|
|
22
22
|
import RequiredInput from './internal/required-input';
|
|
23
23
|
import ScrollManager from './internal/scroll-manager';
|
|
24
24
|
import { scrollTo } from './internal/scroll-to';
|
|
25
|
+
import { SelectGetStylesContext } from './internal/select-get-styles-context';
|
|
25
26
|
import { singleValueAsValue } from './internal/single-value-as-value';
|
|
26
27
|
import { valueTernary } from './internal/value-ternary';
|
|
27
28
|
const noop = __noop;
|
|
@@ -281,7 +282,7 @@ const shouldHideSelectedOptions = props => {
|
|
|
281
282
|
};
|
|
282
283
|
let instanceId = 1;
|
|
283
284
|
|
|
284
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
285
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components, @atlaskit/volt-strict-mode/no-multiple-exports
|
|
285
286
|
export default class Select extends Component {
|
|
286
287
|
// Lifecycle
|
|
287
288
|
// ------------------------------
|
|
@@ -1989,7 +1990,9 @@ export default class Select extends Component {
|
|
|
1989
1990
|
} = this.state;
|
|
1990
1991
|
const commonProps = this.commonProps = this.getCommonProps();
|
|
1991
1992
|
const isCompact = spacing === 'compact';
|
|
1992
|
-
return /*#__PURE__*/React.createElement(
|
|
1993
|
+
return /*#__PURE__*/React.createElement(SelectGetStylesContext.Provider, {
|
|
1994
|
+
value: this.getStyles
|
|
1995
|
+
}, /*#__PURE__*/React.createElement(SelectContainer, _extends({}, commonProps, {
|
|
1993
1996
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
1994
1997
|
className: className,
|
|
1995
1998
|
innerProps: {
|
|
@@ -2040,7 +2043,7 @@ export default class Select extends Component {
|
|
|
2040
2043
|
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField(), /*#__PURE__*/React.createElement(NotifyOpenLayerObserver, {
|
|
2041
2044
|
isOpen: this.props.menuIsOpen,
|
|
2042
2045
|
onClose: this.handleOpenLayerObserverCloseSignal
|
|
2043
|
-
}));
|
|
2046
|
+
})));
|
|
2044
2047
|
}
|
|
2045
2048
|
}
|
|
2046
2049
|
_defineProperty(Select, "defaultProps", defaultProps);
|
package/dist/es2019/theme.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { colors } from './colors';
|
|
2
|
-
const borderRadius = 4;
|
|
3
1
|
// Used to calculate consistent margin/padding on elements
|
|
4
2
|
const baseUnit = 4;
|
|
5
3
|
// The minimum height of the control
|
|
@@ -11,9 +9,4 @@ export const spacing = {
|
|
|
11
9
|
controlHeight,
|
|
12
10
|
menuGutter
|
|
13
11
|
};
|
|
14
|
-
export const defaultTheme = {
|
|
15
|
-
borderRadius,
|
|
16
|
-
colors,
|
|
17
|
-
spacing
|
|
18
|
-
};
|
|
19
12
|
export { colors } from './colors';
|
package/dist/esm/async.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* indicators-container.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./indicators-container.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { cx } from '@compiled/react';
|
|
7
|
+
import { getStyleProps } from '../../get-style-props';
|
|
8
|
+
|
|
9
|
+
// ==============================
|
|
10
|
+
// Indicator Container
|
|
11
|
+
// ==============================
|
|
12
|
+
|
|
13
|
+
var indicatorContainerStyles = null;
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
16
|
+
export var IndicatorsContainer = function IndicatorsContainer(props) {
|
|
17
|
+
var children = props.children,
|
|
18
|
+
innerProps = props.innerProps,
|
|
19
|
+
xcss = props.xcss;
|
|
20
|
+
var _getStyleProps = getStyleProps(props, 'indicatorsContainer', {
|
|
21
|
+
indicators: true
|
|
22
|
+
}),
|
|
23
|
+
css = _getStyleProps.css,
|
|
24
|
+
className = _getStyleProps.className;
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
26
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
27
|
+
style: css
|
|
28
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
29
|
+
,
|
|
30
|
+
className: ax(["_1e0c1txw _4cvr1h6o _1o9zidpf _1wpz1fhb _y4ti1b66", cx(className, xcss, '-IndicatorsContainer')])
|
|
31
|
+
}, innerProps), children);
|
|
32
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
._11c81d4k{font:var(--ds-font-body-large,normal 400 1pc/24px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._1eim1xrj{direction:rtl}
|
|
3
|
+
._80om13gf{cursor:not-allowed}
|
|
4
|
+
._kqswh2mm{position:relative}
|
|
5
|
+
._lcxv1rj4{pointer-events:all}
|
|
6
|
+
@media (min-width:30rem){._1tn2fhey{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* select-container.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./select-container.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { cx } from '@compiled/react';
|
|
7
|
+
import { getStyleProps } from '../../get-style-props';
|
|
8
|
+
|
|
9
|
+
// ==============================
|
|
10
|
+
// Root Container
|
|
11
|
+
// ==============================
|
|
12
|
+
|
|
13
|
+
// iOS Safari automatically zooms into form inputs on focus when the font size is less than 16px.
|
|
14
|
+
// To prevent this zoom behaviour on mobile devices, the select container uses font.body.large (16px) by default,
|
|
15
|
+
// then switches to the smaller font.body on screens wider than 30rem (desktop).
|
|
16
|
+
// @see: https://medium.com/@rares.popescu/2-ways-to-avoid-the-automatic-zoom-in-on-input-fields-8a71479e542e
|
|
17
|
+
|
|
18
|
+
var containerStyles = {
|
|
19
|
+
default: "_11c81d4k _kqswh2mm _lcxv1rj4 _1tn2fhey",
|
|
20
|
+
rtl: "_1eim1xrj",
|
|
21
|
+
disabled: "_80om13gf"
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
25
|
+
export var SelectContainer = function SelectContainer(props) {
|
|
26
|
+
var children = props.children,
|
|
27
|
+
innerProps = props.innerProps,
|
|
28
|
+
isDisabled = props.isDisabled,
|
|
29
|
+
isRtl = props.isRtl,
|
|
30
|
+
xcss = props.xcss;
|
|
31
|
+
var _getStyleProps = getStyleProps(props, 'container', {
|
|
32
|
+
'--is-disabled': isDisabled,
|
|
33
|
+
'--is-rtl': isRtl
|
|
34
|
+
}),
|
|
35
|
+
className = _getStyleProps.className,
|
|
36
|
+
css = _getStyleProps.css;
|
|
37
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
38
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
39
|
+
className: ax([containerStyles.default, isRtl && containerStyles.rtl, isDisabled && containerStyles.disabled, cx(className, xcss, '-container')])
|
|
40
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
41
|
+
,
|
|
42
|
+
style: css
|
|
43
|
+
}, innerProps), children);
|
|
44
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
._zulp1b66{gap:var(--ds-space-050,4px)}._16jlkb7n{flex-grow:1}
|
|
3
|
+
._18m915vq{overflow-y:hidden}
|
|
4
|
+
._1e0c11p5{display:grid}
|
|
5
|
+
._1e0c1txw{display:flex}
|
|
6
|
+
._1n261g80{flex-wrap:wrap}
|
|
7
|
+
._1o9zkb7n{flex-shrink:1}
|
|
8
|
+
._1q511b66{padding-block-start:var(--ds-space-050,4px)}
|
|
9
|
+
._1q51v77o{padding-block-start:var(--ds-space-025,2px)}
|
|
10
|
+
._1q51ze3t{padding-block-start:var(--ds-space-0,0)}
|
|
11
|
+
._1reo15vq{overflow-x:hidden}
|
|
12
|
+
._4cvr1h6o{align-items:center}
|
|
13
|
+
._85i51b66{padding-block-end:var(--ds-space-050,4px)}
|
|
14
|
+
._85i5v77o{padding-block-end:var(--ds-space-025,2px)}
|
|
15
|
+
._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
|
|
16
|
+
._8am5i4x0{-webkit-overflow-scrolling:touch}
|
|
17
|
+
._bozg12x7{padding-inline-start:var(--ds-space-075,6px)}
|
|
18
|
+
._i0dlf1ug{flex-basis:0%}
|
|
19
|
+
._kqswh2mm{position:relative}
|
|
20
|
+
._y4ti12x7{padding-inline-end:var(--ds-space-075,6px)}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* value-container.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./value-container.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { cx } from '@compiled/react';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { getStyleProps } from '../../get-style-props';
|
|
9
|
+
|
|
10
|
+
// ==============================
|
|
11
|
+
// Value Container
|
|
12
|
+
// ==============================
|
|
13
|
+
|
|
14
|
+
var valueContainerStyles = {
|
|
15
|
+
default: "_16jlkb7n _1o9zkb7n _i0dlf1ug _1reo15vq _18m915vq _4cvr1h6o _1e0c11p5 _1n261g80 _8am5i4x0 _kqswh2mm _y4ti12x7 _bozg12x7",
|
|
16
|
+
verticalPaddingStandard: "_1q51v77o _85i5v77o",
|
|
17
|
+
verticalPaddingTagUpliftMulti: "_1q511b66 _85i51b66",
|
|
18
|
+
verticalPaddingTagUpliftCompactMulti: "_1q51v77o _85i5v77o",
|
|
19
|
+
verticalPaddingCompactNonUplift: "_1q51ze3t _85i5ze3t",
|
|
20
|
+
flex: "_1e0c1txw",
|
|
21
|
+
flexWithGap: "_zulp1b66 _1e0c1txw _1n261g80"
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
25
|
+
export var ValueContainer = function ValueContainer(props) {
|
|
26
|
+
var children = props.children,
|
|
27
|
+
innerProps = props.innerProps,
|
|
28
|
+
isMulti = props.isMulti,
|
|
29
|
+
hasValue = props.hasValue,
|
|
30
|
+
isCompact = props.isCompact,
|
|
31
|
+
xcss = props.xcss,
|
|
32
|
+
controlShouldRenderValue = props.selectProps.controlShouldRenderValue;
|
|
33
|
+
var _getStyleProps = getStyleProps(props, 'valueContainer', {
|
|
34
|
+
'value-container': true,
|
|
35
|
+
'value-container--is-multi': isMulti,
|
|
36
|
+
'value-container--has-value': hasValue
|
|
37
|
+
}),
|
|
38
|
+
css = _getStyleProps.css,
|
|
39
|
+
className = _getStyleProps.className;
|
|
40
|
+
var ffTagUplifts = fg('platform-dst-lozenge-tag-badge-visual-uplifts');
|
|
41
|
+
var tagUpliftMultiVertical = ffTagUplifts && isMulti;
|
|
42
|
+
var tagUpliftChipRow = ffTagUplifts && isMulti && hasValue && controlShouldRenderValue;
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
45
|
+
className: ax([valueContainerStyles.default, tagUpliftMultiVertical && isCompact && valueContainerStyles.verticalPaddingTagUpliftCompactMulti, tagUpliftMultiVertical && !isCompact && valueContainerStyles.verticalPaddingTagUpliftMulti, !tagUpliftMultiVertical && !isCompact && valueContainerStyles.verticalPaddingStandard, !tagUpliftMultiVertical && isCompact && valueContainerStyles.verticalPaddingCompactNonUplift, isMulti && hasValue && controlShouldRenderValue && valueContainerStyles.flex, tagUpliftChipRow && valueContainerStyles.flexWithGap, cx(className, xcss, '-ValueContainer')])
|
|
46
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
47
|
+
,
|
|
48
|
+
style: css
|
|
49
|
+
}, innerProps), children);
|
|
50
|
+
};
|
|
@@ -50,6 +50,7 @@ export var components = {
|
|
|
50
50
|
SingleValue: SingleValue,
|
|
51
51
|
ValueContainer: ValueContainer
|
|
52
52
|
};
|
|
53
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
53
54
|
export var defaultComponents = function defaultComponents(props) {
|
|
54
55
|
return _objectSpread(_objectSpread({}, components), props.components);
|
|
55
56
|
};
|
|
@@ -10,6 +10,7 @@ import { cx } from '@compiled/react';
|
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
11
|
import Tag from '@atlaskit/tag';
|
|
12
12
|
import { getStyleProps } from '../get-style-props';
|
|
13
|
+
import { useSelectGetStyles } from '../internal/use-select-get-styles';
|
|
13
14
|
import { MultiValueLabel } from './multi-value-label';
|
|
14
15
|
var multiValueTagWrapperStyles = {
|
|
15
16
|
root: "_16jlidpf _1o9zkb7n _i0dl1wug _1mouze3t _195gze3t _4cvr1h6o _1e0c1txw _1ul9ze3t _zdxokb7n _v5ynkb7n _13lsf1ug _3pxh1h6o _d0dz1txw _1ouwze3t"
|
|
@@ -82,8 +83,18 @@ var MultiValue = function MultiValue(props) {
|
|
|
82
83
|
removeCss = _getStyleProps3.css,
|
|
83
84
|
removeClassName = _getStyleProps3.className;
|
|
84
85
|
var hasCustomLabel = Label !== MultiValueLabel;
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
var selectStyles = selectProps.styles;
|
|
87
|
+
var hasCustomMultiValueStyles = Boolean((selectStyles === null || selectStyles === void 0 ? void 0 : selectStyles.multiValue) || (selectStyles === null || selectStyles === void 0 ? void 0 : selectStyles.multiValueLabel) || (selectStyles === null || selectStyles === void 0 ? void 0 : selectStyles.multiValueRemove));
|
|
88
|
+
var selectClassNames = selectProps.classNames;
|
|
89
|
+
var hasCustomMultiValueClassNames = Boolean((selectClassNames === null || selectClassNames === void 0 ? void 0 : selectClassNames.multiValue) || (selectClassNames === null || selectClassNames === void 0 ? void 0 : selectClassNames.multiValueLabel) || (selectClassNames === null || selectClassNames === void 0 ? void 0 : selectClassNames.multiValueRemove));
|
|
90
|
+
// Detect if getStyles was overridden directly on this component instance (e.g. via the
|
|
91
|
+
// components prop wrapper passing a custom getStyles). The context holds the original
|
|
92
|
+
// Select instance's getStyles — a reference inequality means a custom override was passed.
|
|
93
|
+
// When context is absent (e.g. in mocked/test contexts), assume no override.
|
|
94
|
+
var selectGetStyles = useSelectGetStyles();
|
|
95
|
+
var hasOverriddenGetStyles = selectGetStyles !== undefined && props.getStyles !== selectGetStyles;
|
|
96
|
+
var hasCustomContainerStyles = hasCustomMultiValueStyles || hasCustomMultiValueClassNames || hasOverriddenGetStyles;
|
|
97
|
+
if (ffTagUplifts && isPlainLabel && !hasCustomLabel && !hasCustomContainerStyles) {
|
|
87
98
|
var _ref = data !== null && data !== void 0 ? data : {},
|
|
88
99
|
elemBefore = _ref.elemBefore,
|
|
89
100
|
tagColor = _ref.color;
|
package/dist/esm/creatable.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { useAsync } from '../async';
|
|
1
|
+
export { default as useAsync } from '../use-async';
|
|
2
2
|
export { default } from '../async';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { useCreatable } from '../creatable';
|
|
1
|
+
export { default as useCreatable } from '../use-creatable';
|
|
2
2
|
export { default } from '../creatable';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal context used to pass the original Select instance's getStyles function
|
|
3
|
+
* down to components like MultiValue, without polluting the public CommonProps API.
|
|
4
|
+
*
|
|
5
|
+
* This allows MultiValue to detect whether getStyles has been overridden on a
|
|
6
|
+
* component instance (e.g. via a custom component wrapper passing a different
|
|
7
|
+
* getStyles prop), by comparing props.getStyles against the original.
|
|
8
|
+
*
|
|
9
|
+
* @internal — not part of the public API
|
|
10
|
+
*/
|
|
11
|
+
import { createContext } from 'react';
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
14
|
+
export var SelectGetStylesContext = /*#__PURE__*/createContext(undefined);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to consume the SelectGetStylesContext.
|
|
3
|
+
*
|
|
4
|
+
* @internal — not part of the public API
|
|
5
|
+
*/
|
|
6
|
+
import { useContext } from 'react';
|
|
7
|
+
import { SelectGetStylesContext } from './select-get-styles-context';
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
10
|
+
export var useSelectGetStyles = function useSelectGetStyles() {
|
|
11
|
+
return useContext(SelectGetStylesContext);
|
|
12
|
+
};
|
package/dist/esm/select.js
CHANGED
|
@@ -34,6 +34,7 @@ import { NotifyOpenLayerObserver } from './internal/notify-open-layer-observer';
|
|
|
34
34
|
import RequiredInput from './internal/required-input';
|
|
35
35
|
import ScrollManager from './internal/scroll-manager';
|
|
36
36
|
import { scrollTo } from './internal/scroll-to';
|
|
37
|
+
import { SelectGetStylesContext } from './internal/select-get-styles-context';
|
|
37
38
|
import { singleValueAsValue } from './internal/single-value-as-value';
|
|
38
39
|
import { valueTernary } from './internal/value-ternary';
|
|
39
40
|
var noop = __noop;
|
|
@@ -303,7 +304,7 @@ var shouldHideSelectedOptions = function shouldHideSelectedOptions(props) {
|
|
|
303
304
|
};
|
|
304
305
|
var instanceId = 1;
|
|
305
306
|
|
|
306
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
307
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components, @atlaskit/volt-strict-mode/no-multiple-exports
|
|
307
308
|
var Select = /*#__PURE__*/function (_Component) {
|
|
308
309
|
// Lifecycle
|
|
309
310
|
// ------------------------------
|
|
@@ -1957,7 +1958,9 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
1957
1958
|
var isFocused = this.state.isFocused;
|
|
1958
1959
|
var commonProps = this.commonProps = this.getCommonProps();
|
|
1959
1960
|
var isCompact = spacing === 'compact';
|
|
1960
|
-
return /*#__PURE__*/React.createElement(
|
|
1961
|
+
return /*#__PURE__*/React.createElement(SelectGetStylesContext.Provider, {
|
|
1962
|
+
value: this.getStyles
|
|
1963
|
+
}, /*#__PURE__*/React.createElement(SelectContainer, _extends({}, commonProps, {
|
|
1961
1964
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
1962
1965
|
className: className,
|
|
1963
1966
|
innerProps: _objectSpread({
|
|
@@ -2001,7 +2004,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
2001
2004
|
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField(), /*#__PURE__*/React.createElement(NotifyOpenLayerObserver, {
|
|
2002
2005
|
isOpen: this.props.menuIsOpen,
|
|
2003
2006
|
onClose: this.handleOpenLayerObserverCloseSignal
|
|
2004
|
-
}));
|
|
2007
|
+
})));
|
|
2005
2008
|
}
|
|
2006
2009
|
}], [{
|
|
2007
2010
|
key: "getDerivedStateFromProps",
|
package/dist/esm/theme.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { colors } from './colors';
|
|
2
|
-
var borderRadius = 4;
|
|
3
1
|
// Used to calculate consistent margin/padding on elements
|
|
4
2
|
var baseUnit = 4;
|
|
5
3
|
// The minimum height of the control
|
|
@@ -11,9 +9,4 @@ export var spacing = {
|
|
|
11
9
|
controlHeight: controlHeight,
|
|
12
10
|
menuGutter: menuGutter
|
|
13
11
|
};
|
|
14
|
-
export var defaultTheme = {
|
|
15
|
-
borderRadius: borderRadius,
|
|
16
|
-
colors: colors,
|
|
17
|
-
spacing: spacing
|
|
18
|
-
};
|
|
19
12
|
export { colors } from './colors';
|
package/dist/types/async.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type ReactElement, type RefAttributes } from 'react';
|
|
2
2
|
import Select from './select';
|
|
3
3
|
import type { GroupBase } from './types';
|
|
4
|
-
import
|
|
4
|
+
import { type AsyncProps } from './use-async';
|
|
5
5
|
export type { AsyncProps };
|
|
6
6
|
type AsyncSelect = <Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: AsyncProps<Option, IsMulti, Group> & RefAttributes<Select<Option, IsMulti, Group>>) => ReactElement;
|
|
7
7
|
declare const AsyncSelect: AsyncSelect;
|
|
8
|
-
export { useAsync };
|
|
9
8
|
export default AsyncSelect;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
6
|
+
import { type CommonPropsAndClassName, type GroupBase } from '../../types';
|
|
7
|
+
export interface IndicatorsContainerProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> extends CommonPropsAndClassName<Option, IsMulti, Group> {
|
|
8
|
+
isDisabled: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The children to be rendered.
|
|
11
|
+
*/
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Props to be passed to the indicators container element.
|
|
15
|
+
*/
|
|
16
|
+
innerProps?: {};
|
|
17
|
+
}
|
|
18
|
+
export declare const IndicatorsContainer: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: IndicatorsContainerProps<Option, IsMulti, Group>) => JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
6
|
+
import { type CommonPropsAndClassName, type GroupBase } from '../../types';
|
|
7
|
+
export interface ContainerProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> extends CommonPropsAndClassName<Option, IsMulti, Group> {
|
|
8
|
+
/**
|
|
9
|
+
* Whether the select is disabled.
|
|
10
|
+
*/
|
|
11
|
+
isDisabled: boolean;
|
|
12
|
+
isFocused: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The children to be rendered.
|
|
15
|
+
*/
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Inner props to be passed down to the container.
|
|
19
|
+
*/
|
|
20
|
+
innerProps: {};
|
|
21
|
+
}
|
|
22
|
+
export declare const SelectContainer: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: ContainerProps<Option, IsMulti, Group>) => JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
6
|
+
import { type CommonPropsAndClassName, type GroupBase } from '../../types';
|
|
7
|
+
export interface ValueContainerProps<Option = unknown, IsMulti extends boolean = boolean, Group extends GroupBase<Option> = GroupBase<Option>> extends CommonPropsAndClassName<Option, IsMulti, Group> {
|
|
8
|
+
/**
|
|
9
|
+
* Props to be passed to the value container element.
|
|
10
|
+
*/
|
|
11
|
+
innerProps?: {};
|
|
12
|
+
/**
|
|
13
|
+
* The children to be rendered.
|
|
14
|
+
*/
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
isDisabled: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the select is compact.
|
|
19
|
+
*/
|
|
20
|
+
isCompact?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const ValueContainer: <Option, IsMulti extends boolean, Group extends GroupBase<Option>>(props: ValueContainerProps<Option, IsMulti, Group>) => JSX.Element;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type ReactElement, type RefAttributes } from 'react';
|
|
2
2
|
import Select from './select';
|
|
3
3
|
import type { GroupBase } from './types';
|
|
4
|
-
import
|
|
4
|
+
import { type CreatableAdditionalProps } from './use-creatable';
|
|
5
5
|
import { type StateManagerProps } from './use-state-manager';
|
|
6
6
|
export type CreatableProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = StateManagerProps<Option, IsMulti, Group> & CreatableAdditionalProps<Option, Group>;
|
|
7
7
|
type CreatableSelect = <Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: CreatableProps<Option, IsMulti, Group> & RefAttributes<Select<Option, IsMulti, Group>>) => ReactElement;
|
|
8
8
|
declare const CreatableSelect: CreatableSelect;
|
|
9
|
-
export { useCreatable };
|
|
10
9
|
export default CreatableSelect;
|