@atlaskit/select 17.11.9 → 17.11.11
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 +18 -0
- package/dist/cjs/CountrySelect.js +26 -7
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/styles.js +7 -5
- package/dist/cjs/utils/country-groups-announcement.js +29 -0
- package/dist/es2019/CountrySelect.js +36 -11
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/styles.js +7 -4
- package/dist/es2019/utils/country-groups-announcement.js +22 -0
- package/dist/esm/CountrySelect.js +27 -4
- package/dist/esm/Select.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/styles.js +7 -5
- package/dist/esm/utils/country-groups-announcement.js +22 -0
- package/dist/types/CountrySelect.d.ts +13 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/country-groups-announcement.d.ts +15 -0
- package/dist/types-ts4.5/CountrySelect.d.ts +13 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/utils/country-groups-announcement.d.ts +15 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 17.11.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#125980](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/125980)
|
|
8
|
+
[`d908d9c41ed27`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d908d9c41ed27) -
|
|
9
|
+
The parent group label in `CountrySelect` must be announced with options.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 17.11.10
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#123901](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/123901)
|
|
17
|
+
[`19b70fe0c7efc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/19b70fe0c7efc) -
|
|
18
|
+
[ux] Updating multi value labels font size using composite font token. If successful, these
|
|
19
|
+
changes will be made available in a later release.
|
|
20
|
+
|
|
3
21
|
## 17.11.9
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -6,20 +6,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _react = require("@emotion/react");
|
|
10
11
|
var _countries = require("./data/countries");
|
|
11
12
|
var _Select = _interopRequireDefault(require("./Select"));
|
|
12
|
-
|
|
13
|
+
var _countryGroupsAnnouncement = require("./utils/country-groups-announcement");
|
|
14
|
+
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; }
|
|
15
|
+
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) { (0, _defineProperty2.default)(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; } /**
|
|
13
16
|
* @jsxRuntime classic
|
|
14
17
|
* @jsx jsx
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
|
-
|
|
18
|
+
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
19
19
|
// custom option renderer
|
|
20
20
|
var labelStyles = (0, _react.css)({
|
|
21
|
-
alignItems: 'center',
|
|
22
21
|
display: 'flex',
|
|
22
|
+
alignItems: 'center',
|
|
23
23
|
lineHeight: 1.2
|
|
24
24
|
});
|
|
25
25
|
var flagStyles = (0, _react.css)({
|
|
@@ -78,14 +78,33 @@ var formatOptionLabel = function formatOptionLabel(opt, _ref4) {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
// put it all together
|
|
81
|
+
// TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
|
|
82
|
+
// Remove links that the component does not have (such as usage). If there are no links remove them all.
|
|
83
|
+
/**
|
|
84
|
+
* __Country select__
|
|
85
|
+
*
|
|
86
|
+
* A country select {description}.
|
|
87
|
+
*
|
|
88
|
+
* - [Examples](https://atlassian.design/components/{packageName}/examples)
|
|
89
|
+
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
90
|
+
* - [Usage](https://atlassian.design/components/{packageName}/usage)
|
|
91
|
+
*/
|
|
81
92
|
var CountrySelect = function CountrySelect(props) {
|
|
93
|
+
var ariaLiveMessages = props.ariaLiveMessages,
|
|
94
|
+
options = props.options;
|
|
95
|
+
var countryOptions = options || _countries.groupedCountries;
|
|
82
96
|
return (0, _react.jsx)(_Select.default, (0, _extends2.default)({
|
|
83
97
|
isClearable: false,
|
|
84
98
|
formatOptionLabel: formatOptionLabel,
|
|
85
99
|
getOptionLabel: getOptionLabel,
|
|
86
100
|
getOptionValue: getOptionValue,
|
|
87
101
|
isMulti: false,
|
|
88
|
-
options:
|
|
102
|
+
options: countryOptions,
|
|
103
|
+
ariaLiveMessages: (0, _countryGroupsAnnouncement.isCountryOptionsGrouped)(countryOptions) ? _objectSpread({
|
|
104
|
+
onFocus: function onFocus(data) {
|
|
105
|
+
return (0, _countryGroupsAnnouncement.onCountryOptionFocus)(data, countryOptions);
|
|
106
|
+
}
|
|
107
|
+
}, ariaLiveMessages) : _objectSpread({}, ariaLiveMessages)
|
|
89
108
|
}, props));
|
|
90
109
|
};
|
|
91
110
|
var _default = exports.default = CountrySelect;
|
package/dist/cjs/Select.js
CHANGED
|
@@ -9,7 +9,7 @@ var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
|
9
9
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
10
10
|
var _createSelect = _interopRequireDefault(require("./createSelect"));
|
|
11
11
|
var packageName = "@atlaskit/select";
|
|
12
|
-
var packageVersion = "17.11.
|
|
12
|
+
var packageVersion = "17.11.11";
|
|
13
13
|
var SelectWithoutAnalytics = exports.SelectWithoutAnalytics = (0, _createSelect.default)(_reactSelect.default);
|
|
14
14
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
15
15
|
var Select = (0, _analyticsNext.withAnalyticsContext)({
|
package/dist/cjs/index.js
CHANGED
|
@@ -83,6 +83,12 @@ Object.defineProperty(exports, "default", {
|
|
|
83
83
|
return _select.default;
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
+
Object.defineProperty(exports, "isCountryOptionsGrouped", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function get() {
|
|
89
|
+
return _countryGroupsAnnouncement.isCountryOptionsGrouped;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
86
92
|
Object.defineProperty(exports, "isOptionsGrouped", {
|
|
87
93
|
enumerable: true,
|
|
88
94
|
get: function get() {
|
|
@@ -95,6 +101,12 @@ Object.defineProperty(exports, "mergeStyles", {
|
|
|
95
101
|
return _reactSelect.mergeStyles;
|
|
96
102
|
}
|
|
97
103
|
});
|
|
104
|
+
Object.defineProperty(exports, "onCountryOptionFocus", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function get() {
|
|
107
|
+
return _countryGroupsAnnouncement.onCountryOptionFocus;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
98
110
|
Object.defineProperty(exports, "useAsync", {
|
|
99
111
|
enumerable: true,
|
|
100
112
|
get: function get() {
|
|
@@ -116,6 +128,7 @@ var _asyncSelect = _interopRequireDefault(require("./entry-points/async-select")
|
|
|
116
128
|
var _creatableSelect = _interopRequireDefault(require("./entry-points/creatable-select"));
|
|
117
129
|
var _asyncCreatableSelect = _interopRequireDefault(require("./entry-points/async-creatable-select"));
|
|
118
130
|
var _groupedOptionsAnnouncement = require("./utils/grouped-options-announcement");
|
|
131
|
+
var _countryGroupsAnnouncement = require("./utils/country-groups-announcement");
|
|
119
132
|
var _CheckboxSelect = _interopRequireDefault(require("./CheckboxSelect"));
|
|
120
133
|
var _CountrySelect = _interopRequireDefault(require("./CountrySelect"));
|
|
121
134
|
var _RadioSelect = _interopRequireDefault(require("./RadioSelect"));
|
package/dist/cjs/styles.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = baseStyles;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
10
9
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
11
11
|
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; }
|
|
12
12
|
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) { (0, _defineProperty2.default)(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; }
|
|
13
13
|
function baseStyles(validationState) {
|
|
@@ -16,7 +16,7 @@ function baseStyles(validationState) {
|
|
|
16
16
|
return {
|
|
17
17
|
container: function container(css, _ref) {
|
|
18
18
|
var isDisabled = _ref.isDisabled;
|
|
19
|
-
return _objectSpread(_objectSpread(_objectSpread({}, css), (0, _platformFeatureFlags.
|
|
19
|
+
return _objectSpread(_objectSpread(_objectSpread({}, css), (0, _platformFeatureFlags.fg)('platform.design-system-team.select-new-typography_7m89c') ? {
|
|
20
20
|
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
21
21
|
} : {
|
|
22
22
|
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
@@ -200,7 +200,7 @@ function baseStyles(validationState) {
|
|
|
200
200
|
var isDisabled = _ref6.isDisabled;
|
|
201
201
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
202
202
|
color: isDisabled ? "var(--ds-text-disabled, ".concat(_colors.N70, ")") : "var(--ds-text, ".concat(_colors.N800, ")")
|
|
203
|
-
}, !(0, _platformFeatureFlags.
|
|
203
|
+
}, !(0, _platformFeatureFlags.fg)('platform.design-system-team.select-new-typography_7m89c') && {
|
|
204
204
|
lineHeight: '1rem'
|
|
205
205
|
});
|
|
206
206
|
},
|
|
@@ -246,7 +246,9 @@ function baseStyles(validationState) {
|
|
|
246
246
|
},
|
|
247
247
|
multiValueLabel: function multiValueLabel(css, _ref8) {
|
|
248
248
|
var isDisabled = _ref8.isDisabled;
|
|
249
|
-
return _objectSpread(_objectSpread({}, css),
|
|
249
|
+
return _objectSpread(_objectSpread(_objectSpread({}, css), (0, _platformFeatureFlags.fg)('platform.design-system-team.select-new-typography_7m89c') && {
|
|
250
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
251
|
+
}), {}, {
|
|
250
252
|
padding: "var(--ds-space-025, 2px)",
|
|
251
253
|
color: isDisabled ? "var(--ds-text-disabled, ".concat(_colors.N70, ")") : 'inherit',
|
|
252
254
|
paddingRight: "var(--ds-space-025, 2px)"
|
|
@@ -272,7 +274,7 @@ function baseStyles(validationState) {
|
|
|
272
274
|
});
|
|
273
275
|
},
|
|
274
276
|
groupHeading: function groupHeading(css) {
|
|
275
|
-
return _objectSpread(_objectSpread(_objectSpread({}, css), (0, _platformFeatureFlags.
|
|
277
|
+
return _objectSpread(_objectSpread(_objectSpread({}, css), (0, _platformFeatureFlags.fg)('platform.design-system-team.select-new-typography_7m89c') && {
|
|
276
278
|
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
277
279
|
}), {}, {
|
|
278
280
|
color: "var(--ds-text-subtle, ".concat(_colors.N200, ")")
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isCountryOptionsGrouped = void 0;
|
|
7
|
+
exports.onCountryOptionFocus = onCountryOptionFocus;
|
|
8
|
+
// Used for overwriting ariaLiveMessages builtin onFocus method.
|
|
9
|
+
// Returns custom built string while focusing each group option. This string is used for screen reader announcement.
|
|
10
|
+
function onCountryOptionFocus(onFocusProps, defaultOptions) {
|
|
11
|
+
var _groupData$options$fi;
|
|
12
|
+
var focused = onFocusProps.focused;
|
|
13
|
+
var isOptionFocused = function isOptionFocused(option) {
|
|
14
|
+
return option.name === focused.name;
|
|
15
|
+
};
|
|
16
|
+
var groupData = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.find(function (option) {
|
|
17
|
+
var _option$options;
|
|
18
|
+
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
19
|
+
});
|
|
20
|
+
var groupOptionIndex = (_groupData$options$fi = groupData === null || groupData === void 0 ? void 0 : groupData.options.findIndex(isOptionFocused)) !== null && _groupData$options$fi !== void 0 ? _groupData$options$fi : 0;
|
|
21
|
+
return "Option ".concat(focused.name, " (").concat(focused.abbr.toUpperCase(), ") +").concat(focused.code, ", ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.label, " group, item ").concat(groupOptionIndex + 1, " out of ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.options.length, ". All in all ");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Helper function which identifies if options are grouped.
|
|
25
|
+
var isCountryOptionsGrouped = exports.isCountryOptionsGrouped = function isCountryOptionsGrouped(arr) {
|
|
26
|
+
return arr === null || arr === void 0 ? void 0 : arr.every(function (obj) {
|
|
27
|
+
return obj.hasOwnProperty('options');
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -3,15 +3,16 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
import { css, jsx } from '@emotion/react';
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
import { groupedCountries } from './data/countries';
|
|
10
10
|
import Select from './Select';
|
|
11
|
+
import { isCountryOptionsGrouped, onCountryOptionFocus } from './utils/country-groups-announcement';
|
|
11
12
|
// custom option renderer
|
|
12
13
|
const labelStyles = css({
|
|
13
|
-
alignItems: 'center',
|
|
14
14
|
display: 'flex',
|
|
15
|
+
alignItems: 'center',
|
|
15
16
|
lineHeight: 1.2
|
|
16
17
|
});
|
|
17
18
|
const flagStyles = css({
|
|
@@ -62,12 +63,36 @@ const formatOptionLabel = (opt, {
|
|
|
62
63
|
}) => context === 'value' ? controlLabel(opt) : optionLabel(opt);
|
|
63
64
|
|
|
64
65
|
// put it all together
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
66
|
+
// TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
|
|
67
|
+
// Remove links that the component does not have (such as usage). If there are no links remove them all.
|
|
68
|
+
/**
|
|
69
|
+
* __Country select__
|
|
70
|
+
*
|
|
71
|
+
* A country select {description}.
|
|
72
|
+
*
|
|
73
|
+
* - [Examples](https://atlassian.design/components/{packageName}/examples)
|
|
74
|
+
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
75
|
+
* - [Usage](https://atlassian.design/components/{packageName}/usage)
|
|
76
|
+
*/
|
|
77
|
+
const CountrySelect = props => {
|
|
78
|
+
const {
|
|
79
|
+
ariaLiveMessages,
|
|
80
|
+
options
|
|
81
|
+
} = props;
|
|
82
|
+
const countryOptions = options || groupedCountries;
|
|
83
|
+
return jsx(Select, _extends({
|
|
84
|
+
isClearable: false,
|
|
85
|
+
formatOptionLabel: formatOptionLabel,
|
|
86
|
+
getOptionLabel: getOptionLabel,
|
|
87
|
+
getOptionValue: getOptionValue,
|
|
88
|
+
isMulti: false,
|
|
89
|
+
options: countryOptions,
|
|
90
|
+
ariaLiveMessages: isCountryOptionsGrouped(countryOptions) ? {
|
|
91
|
+
onFocus: data => onCountryOptionFocus(data, countryOptions),
|
|
92
|
+
...ariaLiveMessages
|
|
93
|
+
} : {
|
|
94
|
+
...ariaLiveMessages
|
|
95
|
+
}
|
|
96
|
+
}, props));
|
|
97
|
+
};
|
|
73
98
|
export default CountrySelect;
|
package/dist/es2019/Select.js
CHANGED
|
@@ -2,7 +2,7 @@ import ReactSelect from 'react-select';
|
|
|
2
2
|
import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import createSelect from './createSelect';
|
|
4
4
|
const packageName = "@atlaskit/select";
|
|
5
|
-
const packageVersion = "17.11.
|
|
5
|
+
const packageVersion = "17.11.11";
|
|
6
6
|
export const SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
const Select = withAnalyticsContext({
|
package/dist/es2019/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { default as AsyncSelect } from './entry-points/async-select';
|
|
|
7
7
|
export { default as CreatableSelect } from './entry-points/creatable-select';
|
|
8
8
|
export { default as AsyncCreatableSelect } from './entry-points/async-creatable-select';
|
|
9
9
|
export { isOptionsGrouped } from './utils/grouped-options-announcement';
|
|
10
|
+
export { isCountryOptionsGrouped, onCountryOptionFocus } from './utils/country-groups-announcement';
|
|
10
11
|
export { default as CheckboxSelect } from './CheckboxSelect';
|
|
11
12
|
export { default as CountrySelect } from './CountrySelect';
|
|
12
13
|
export { default as RadioSelect } from './RadioSelect';
|
package/dist/es2019/styles.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { B100, B400, B50, G400, N0, N100, N20, N200, N30, N300, N40, N500, N70, N800, R400, R75 } from '@atlaskit/theme/colors';
|
|
2
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
export default function baseStyles(validationState, isCompact = false, appearance) {
|
|
4
4
|
return {
|
|
5
5
|
container: (css, {
|
|
6
6
|
isDisabled
|
|
7
7
|
}) => ({
|
|
8
8
|
...css,
|
|
9
|
-
...(
|
|
9
|
+
...(fg('platform.design-system-team.select-new-typography_7m89c') ? {
|
|
10
10
|
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
11
11
|
} : {
|
|
12
12
|
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
@@ -192,7 +192,7 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
192
192
|
}) => ({
|
|
193
193
|
...css,
|
|
194
194
|
color: isDisabled ? `var(--ds-text-disabled, ${N70})` : `var(--ds-text, ${N800})`,
|
|
195
|
-
...(!
|
|
195
|
+
...(!fg('platform.design-system-team.select-new-typography_7m89c') && {
|
|
196
196
|
lineHeight: '1rem'
|
|
197
197
|
})
|
|
198
198
|
}),
|
|
@@ -240,6 +240,9 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
240
240
|
isDisabled
|
|
241
241
|
}) => ({
|
|
242
242
|
...css,
|
|
243
|
+
...(fg('platform.design-system-team.select-new-typography_7m89c') && {
|
|
244
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
245
|
+
}),
|
|
243
246
|
padding: "var(--ds-space-025, 2px)",
|
|
244
247
|
color: isDisabled ? `var(--ds-text-disabled, ${N70})` : 'inherit',
|
|
245
248
|
paddingRight: "var(--ds-space-025, 2px)"
|
|
@@ -265,7 +268,7 @@ export default function baseStyles(validationState, isCompact = false, appearanc
|
|
|
265
268
|
}),
|
|
266
269
|
groupHeading: css => ({
|
|
267
270
|
...css,
|
|
268
|
-
...(
|
|
271
|
+
...(fg('platform.design-system-team.select-new-typography_7m89c') && {
|
|
269
272
|
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
270
273
|
}),
|
|
271
274
|
color: `var(--ds-text-subtle, ${N200})`
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Used for overwriting ariaLiveMessages builtin onFocus method.
|
|
2
|
+
// Returns custom built string while focusing each group option. This string is used for screen reader announcement.
|
|
3
|
+
export function onCountryOptionFocus(onFocusProps, defaultOptions) {
|
|
4
|
+
var _groupData$options$fi;
|
|
5
|
+
const {
|
|
6
|
+
focused
|
|
7
|
+
} = onFocusProps;
|
|
8
|
+
const isOptionFocused = option => {
|
|
9
|
+
return option.name === focused.name;
|
|
10
|
+
};
|
|
11
|
+
const groupData = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.find(option => {
|
|
12
|
+
var _option$options;
|
|
13
|
+
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
14
|
+
});
|
|
15
|
+
const groupOptionIndex = (_groupData$options$fi = groupData === null || groupData === void 0 ? void 0 : groupData.options.findIndex(isOptionFocused)) !== null && _groupData$options$fi !== void 0 ? _groupData$options$fi : 0;
|
|
16
|
+
return `Option ${focused.name} (${focused.abbr.toUpperCase()}) +${focused.code}, ${groupData === null || groupData === void 0 ? void 0 : groupData.label} group, item ${groupOptionIndex + 1} out of ${groupData === null || groupData === void 0 ? void 0 : groupData.options.length}. All in all `;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Helper function which identifies if options are grouped.
|
|
20
|
+
export const isCountryOptionsGrouped = arr => {
|
|
21
|
+
return arr === null || arr === void 0 ? void 0 : arr.every(obj => obj.hasOwnProperty('options'));
|
|
22
|
+
};
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
2
5
|
/**
|
|
3
6
|
* @jsxRuntime classic
|
|
4
7
|
* @jsx jsx
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
import { css, jsx } from '@emotion/react';
|
|
7
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
|
|
11
|
+
|
|
9
12
|
import { groupedCountries } from './data/countries';
|
|
10
13
|
import Select from './Select';
|
|
14
|
+
import { isCountryOptionsGrouped, onCountryOptionFocus } from './utils/country-groups-announcement';
|
|
11
15
|
// custom option renderer
|
|
12
16
|
var labelStyles = css({
|
|
13
|
-
alignItems: 'center',
|
|
14
17
|
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
15
19
|
lineHeight: 1.2
|
|
16
20
|
});
|
|
17
21
|
var flagStyles = css({
|
|
@@ -70,14 +74,33 @@ var formatOptionLabel = function formatOptionLabel(opt, _ref4) {
|
|
|
70
74
|
};
|
|
71
75
|
|
|
72
76
|
// put it all together
|
|
77
|
+
// TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
|
|
78
|
+
// Remove links that the component does not have (such as usage). If there are no links remove them all.
|
|
79
|
+
/**
|
|
80
|
+
* __Country select__
|
|
81
|
+
*
|
|
82
|
+
* A country select {description}.
|
|
83
|
+
*
|
|
84
|
+
* - [Examples](https://atlassian.design/components/{packageName}/examples)
|
|
85
|
+
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
86
|
+
* - [Usage](https://atlassian.design/components/{packageName}/usage)
|
|
87
|
+
*/
|
|
73
88
|
var CountrySelect = function CountrySelect(props) {
|
|
89
|
+
var ariaLiveMessages = props.ariaLiveMessages,
|
|
90
|
+
options = props.options;
|
|
91
|
+
var countryOptions = options || groupedCountries;
|
|
74
92
|
return jsx(Select, _extends({
|
|
75
93
|
isClearable: false,
|
|
76
94
|
formatOptionLabel: formatOptionLabel,
|
|
77
95
|
getOptionLabel: getOptionLabel,
|
|
78
96
|
getOptionValue: getOptionValue,
|
|
79
97
|
isMulti: false,
|
|
80
|
-
options:
|
|
98
|
+
options: countryOptions,
|
|
99
|
+
ariaLiveMessages: isCountryOptionsGrouped(countryOptions) ? _objectSpread({
|
|
100
|
+
onFocus: function onFocus(data) {
|
|
101
|
+
return onCountryOptionFocus(data, countryOptions);
|
|
102
|
+
}
|
|
103
|
+
}, ariaLiveMessages) : _objectSpread({}, ariaLiveMessages)
|
|
81
104
|
}, props));
|
|
82
105
|
};
|
|
83
106
|
export default CountrySelect;
|
package/dist/esm/Select.js
CHANGED
|
@@ -2,7 +2,7 @@ import ReactSelect from 'react-select';
|
|
|
2
2
|
import { withAnalyticsEvents, withAnalyticsContext, createAndFireEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import createSelect from './createSelect';
|
|
4
4
|
var packageName = "@atlaskit/select";
|
|
5
|
-
var packageVersion = "17.11.
|
|
5
|
+
var packageVersion = "17.11.11";
|
|
6
6
|
export var SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
7
7
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
8
8
|
var Select = withAnalyticsContext({
|
package/dist/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { default as AsyncSelect } from './entry-points/async-select';
|
|
|
7
7
|
export { default as CreatableSelect } from './entry-points/creatable-select';
|
|
8
8
|
export { default as AsyncCreatableSelect } from './entry-points/async-creatable-select';
|
|
9
9
|
export { isOptionsGrouped } from './utils/grouped-options-announcement';
|
|
10
|
+
export { isCountryOptionsGrouped, onCountryOptionFocus } from './utils/country-groups-announcement';
|
|
10
11
|
export { default as CheckboxSelect } from './CheckboxSelect';
|
|
11
12
|
export { default as CountrySelect } from './CountrySelect';
|
|
12
13
|
export { default as RadioSelect } from './RadioSelect';
|
package/dist/esm/styles.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { B100, B400, B50, G400, N0, N100, N20, N200, N30, N300, N40, N500, N70, N800, R400, R75 } from '@atlaskit/theme/colors';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
export default function baseStyles(validationState) {
|
|
7
7
|
var isCompact = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
8
8
|
var appearance = arguments.length > 2 ? arguments[2] : undefined;
|
|
9
9
|
return {
|
|
10
10
|
container: function container(css, _ref) {
|
|
11
11
|
var isDisabled = _ref.isDisabled;
|
|
12
|
-
return _objectSpread(_objectSpread(_objectSpread({}, css),
|
|
12
|
+
return _objectSpread(_objectSpread(_objectSpread({}, css), fg('platform.design-system-team.select-new-typography_7m89c') ? {
|
|
13
13
|
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
14
14
|
} : {
|
|
15
15
|
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
@@ -193,7 +193,7 @@ export default function baseStyles(validationState) {
|
|
|
193
193
|
var isDisabled = _ref6.isDisabled;
|
|
194
194
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
195
195
|
color: isDisabled ? "var(--ds-text-disabled, ".concat(N70, ")") : "var(--ds-text, ".concat(N800, ")")
|
|
196
|
-
}, !
|
|
196
|
+
}, !fg('platform.design-system-team.select-new-typography_7m89c') && {
|
|
197
197
|
lineHeight: '1rem'
|
|
198
198
|
});
|
|
199
199
|
},
|
|
@@ -239,7 +239,9 @@ export default function baseStyles(validationState) {
|
|
|
239
239
|
},
|
|
240
240
|
multiValueLabel: function multiValueLabel(css, _ref8) {
|
|
241
241
|
var isDisabled = _ref8.isDisabled;
|
|
242
|
-
return _objectSpread(_objectSpread({}, css),
|
|
242
|
+
return _objectSpread(_objectSpread(_objectSpread({}, css), fg('platform.design-system-team.select-new-typography_7m89c') && {
|
|
243
|
+
font: "var(--ds-font-body-UNSAFE_small, normal 400 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
244
|
+
}), {}, {
|
|
243
245
|
padding: "var(--ds-space-025, 2px)",
|
|
244
246
|
color: isDisabled ? "var(--ds-text-disabled, ".concat(N70, ")") : 'inherit',
|
|
245
247
|
paddingRight: "var(--ds-space-025, 2px)"
|
|
@@ -265,7 +267,7 @@ export default function baseStyles(validationState) {
|
|
|
265
267
|
});
|
|
266
268
|
},
|
|
267
269
|
groupHeading: function groupHeading(css) {
|
|
268
|
-
return _objectSpread(_objectSpread(_objectSpread({}, css),
|
|
270
|
+
return _objectSpread(_objectSpread(_objectSpread({}, css), fg('platform.design-system-team.select-new-typography_7m89c') && {
|
|
269
271
|
font: "var(--ds-font-body-small, normal 400 11px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
270
272
|
}), {}, {
|
|
271
273
|
color: "var(--ds-text-subtle, ".concat(N200, ")")
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Used for overwriting ariaLiveMessages builtin onFocus method.
|
|
2
|
+
// Returns custom built string while focusing each group option. This string is used for screen reader announcement.
|
|
3
|
+
export function onCountryOptionFocus(onFocusProps, defaultOptions) {
|
|
4
|
+
var _groupData$options$fi;
|
|
5
|
+
var focused = onFocusProps.focused;
|
|
6
|
+
var isOptionFocused = function isOptionFocused(option) {
|
|
7
|
+
return option.name === focused.name;
|
|
8
|
+
};
|
|
9
|
+
var groupData = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.find(function (option) {
|
|
10
|
+
var _option$options;
|
|
11
|
+
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
12
|
+
});
|
|
13
|
+
var groupOptionIndex = (_groupData$options$fi = groupData === null || groupData === void 0 ? void 0 : groupData.options.findIndex(isOptionFocused)) !== null && _groupData$options$fi !== void 0 ? _groupData$options$fi : 0;
|
|
14
|
+
return "Option ".concat(focused.name, " (").concat(focused.abbr.toUpperCase(), ") +").concat(focused.code, ", ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.label, " group, item ").concat(groupOptionIndex + 1, " out of ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.options.length, ". All in all ");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Helper function which identifies if options are grouped.
|
|
18
|
+
export var isCountryOptionsGrouped = function isCountryOptionsGrouped(arr) {
|
|
19
|
+
return arr === null || arr === void 0 ? void 0 : arr.every(function (obj) {
|
|
20
|
+
return obj.hasOwnProperty('options');
|
|
21
|
+
});
|
|
22
|
+
};
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
1
5
|
import { jsx } from '@emotion/react';
|
|
2
6
|
import { groupedCountries } from './data/countries';
|
|
3
7
|
import { type SelectProps } from './types';
|
|
4
8
|
type Country = (typeof groupedCountries)[number]['options'][number];
|
|
9
|
+
/**
|
|
10
|
+
* __Country select__
|
|
11
|
+
*
|
|
12
|
+
* A country select {description}.
|
|
13
|
+
*
|
|
14
|
+
* - [Examples](https://atlassian.design/components/{packageName}/examples)
|
|
15
|
+
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
16
|
+
* - [Usage](https://atlassian.design/components/{packageName}/usage)
|
|
17
|
+
*/
|
|
5
18
|
declare const CountrySelect: (props: SelectProps<Country>) => jsx.JSX.Element;
|
|
6
19
|
export default CountrySelect;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { default as AsyncSelect } from './entry-points/async-select';
|
|
|
7
7
|
export { default as CreatableSelect } from './entry-points/creatable-select';
|
|
8
8
|
export { default as AsyncCreatableSelect } from './entry-points/async-creatable-select';
|
|
9
9
|
export { isOptionsGrouped } from './utils/grouped-options-announcement';
|
|
10
|
+
export { isCountryOptionsGrouped, onCountryOptionFocus, type CountyGroupOptions, } from './utils/country-groups-announcement';
|
|
10
11
|
export { default as CheckboxSelect } from './CheckboxSelect';
|
|
11
12
|
export { default as CountrySelect } from './CountrySelect';
|
|
12
13
|
export { default as RadioSelect } from './RadioSelect';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AriaOnFocusProps, type OptionsOrGroups } from 'react-select';
|
|
2
|
+
import { type GroupType } from '../types';
|
|
3
|
+
type Country = {
|
|
4
|
+
icon: string;
|
|
5
|
+
name: string;
|
|
6
|
+
abbr: string;
|
|
7
|
+
code: string | number;
|
|
8
|
+
};
|
|
9
|
+
export type CountyGroupOptions = {
|
|
10
|
+
label: string;
|
|
11
|
+
options: Country[];
|
|
12
|
+
};
|
|
13
|
+
export declare function onCountryOptionFocus(onFocusProps: AriaOnFocusProps<Country, GroupType<Country>>, defaultOptions?: CountyGroupOptions[]): string;
|
|
14
|
+
export declare const isCountryOptionsGrouped: (arr?: OptionsOrGroups<Country, GroupType<Country>>) => boolean | undefined;
|
|
15
|
+
export {};
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
1
5
|
import { jsx } from '@emotion/react';
|
|
2
6
|
import { groupedCountries } from './data/countries';
|
|
3
7
|
import { type SelectProps } from './types';
|
|
4
8
|
type Country = (typeof groupedCountries)[number]['options'][number];
|
|
9
|
+
/**
|
|
10
|
+
* __Country select__
|
|
11
|
+
*
|
|
12
|
+
* A country select {description}.
|
|
13
|
+
*
|
|
14
|
+
* - [Examples](https://atlassian.design/components/{packageName}/examples)
|
|
15
|
+
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
16
|
+
* - [Usage](https://atlassian.design/components/{packageName}/usage)
|
|
17
|
+
*/
|
|
5
18
|
declare const CountrySelect: (props: SelectProps<Country>) => jsx.JSX.Element;
|
|
6
19
|
export default CountrySelect;
|
|
@@ -7,6 +7,7 @@ export { default as AsyncSelect } from './entry-points/async-select';
|
|
|
7
7
|
export { default as CreatableSelect } from './entry-points/creatable-select';
|
|
8
8
|
export { default as AsyncCreatableSelect } from './entry-points/async-creatable-select';
|
|
9
9
|
export { isOptionsGrouped } from './utils/grouped-options-announcement';
|
|
10
|
+
export { isCountryOptionsGrouped, onCountryOptionFocus, type CountyGroupOptions, } from './utils/country-groups-announcement';
|
|
10
11
|
export { default as CheckboxSelect } from './CheckboxSelect';
|
|
11
12
|
export { default as CountrySelect } from './CountrySelect';
|
|
12
13
|
export { default as RadioSelect } from './RadioSelect';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AriaOnFocusProps, type OptionsOrGroups } from 'react-select';
|
|
2
|
+
import { type GroupType } from '../types';
|
|
3
|
+
type Country = {
|
|
4
|
+
icon: string;
|
|
5
|
+
name: string;
|
|
6
|
+
abbr: string;
|
|
7
|
+
code: string | number;
|
|
8
|
+
};
|
|
9
|
+
export type CountyGroupOptions = {
|
|
10
|
+
label: string;
|
|
11
|
+
options: Country[];
|
|
12
|
+
};
|
|
13
|
+
export declare function onCountryOptionFocus(onFocusProps: AriaOnFocusProps<Country, GroupType<Country>>, defaultOptions?: CountyGroupOptions[]): string;
|
|
14
|
+
export declare const isCountryOptionsGrouped: (arr?: OptionsOrGroups<Country, GroupType<Country>>) => boolean | undefined;
|
|
15
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/select",
|
|
3
|
-
"version": "17.11.
|
|
3
|
+
"version": "17.11.11",
|
|
4
4
|
"description": "Select allows users to make a single selection or multiple selections from a list of options.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
46
|
-
"@atlaskit/icon": "^22.
|
|
46
|
+
"@atlaskit/icon": "^22.9.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
48
48
|
"@atlaskit/primitives": "^11.1.0",
|
|
49
49
|
"@atlaskit/spinner": "^16.2.0",
|