@atlaskit/select 17.11.10 → 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 +9 -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/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/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/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,14 @@
|
|
|
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
|
+
|
|
3
12
|
## 17.11.10
|
|
4
13
|
|
|
5
14
|
### 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"));
|
|
@@ -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';
|
|
@@ -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';
|
|
@@ -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",
|