@atlaskit/select 21.8.1 → 21.8.3
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/select.js +1 -1
- package/dist/cjs/utils/grouped-options-announcement.js +0 -28
- package/dist/es2019/select.js +1 -1
- package/dist/es2019/utils/grouped-options-announcement.js +0 -28
- package/dist/esm/select.js +1 -1
- package/dist/esm/utils/grouped-options-announcement.js +0 -26
- package/dist/types/utils/grouped-options-announcement.d.ts +1 -3
- package/dist/types-ts4.5/utils/grouped-options-announcement.d.ts +1 -3
- package/package.json +5 -4
- package/select.docs.tsx +51 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 21.8.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f31216f23df61`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f31216f23df61) -
|
|
8
|
+
Removes internally exported API from files which will soon be exported as top-level API
|
|
9
|
+
|
|
10
|
+
## 21.8.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 21.8.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/cjs/select.js
CHANGED
|
@@ -11,7 +11,7 @@ var _createSelect = _interopRequireDefault(require("./create-select"));
|
|
|
11
11
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
12
12
|
|
|
13
13
|
var packageName = "@atlaskit/select";
|
|
14
|
-
var packageVersion = "
|
|
14
|
+
var packageVersion = "21.8.2";
|
|
15
15
|
var SelectWithoutAnalytics = exports.SelectWithoutAnalytics = (0, _createSelect.default)(_async.default);
|
|
16
16
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
17
17
|
var Select = (0, _analyticsNext.withAnalyticsContext)({
|
|
@@ -3,38 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.countAllOptions = void 0;
|
|
7
|
-
exports.generateGroupLabel = generateGroupLabel;
|
|
8
6
|
exports.isOptionsGrouped = void 0;
|
|
9
|
-
function generateGroupLabel(onFocusProps, defaultOptions) {
|
|
10
|
-
var _groupData$options$fi;
|
|
11
|
-
var focused = onFocusProps.focused;
|
|
12
|
-
var isOptionFocused = function isOptionFocused(option) {
|
|
13
|
-
return option.label === focused.label;
|
|
14
|
-
};
|
|
15
|
-
var groupData = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.find(function (option) {
|
|
16
|
-
var _option$options;
|
|
17
|
-
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
18
|
-
});
|
|
19
|
-
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;
|
|
20
|
-
var totalLength = countAllOptions(defaultOptions);
|
|
21
|
-
return "".concat(focused.label, ", ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.label, " (").concat(groupOptionIndex + 1, " of ").concat(totalLength, ")");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
7
|
// Helper function which identifies if options are grouped.
|
|
25
8
|
var isOptionsGrouped = exports.isOptionsGrouped = function isOptionsGrouped(arr) {
|
|
26
9
|
return arr === null || arr === void 0 ? void 0 : arr.every(function (obj) {
|
|
27
10
|
return obj.hasOwnProperty('options');
|
|
28
11
|
});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// Helper function which calculates how many options are in total in all groups.
|
|
32
|
-
var countAllOptions = exports.countAllOptions = function countAllOptions(groupsArray) {
|
|
33
|
-
var totalLength = groupsArray === null || groupsArray === void 0 ? void 0 : groupsArray.reduce(function (acc, currentGroup) {
|
|
34
|
-
var _group$options;
|
|
35
|
-
var group = currentGroup;
|
|
36
|
-
acc += group === null || group === void 0 || (_group$options = group.options) === null || _group$options === void 0 ? void 0 : _group$options.length;
|
|
37
|
-
return acc;
|
|
38
|
-
}, 0);
|
|
39
|
-
return totalLength;
|
|
40
12
|
};
|
package/dist/es2019/select.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
3
3
|
import AsyncSelect from '@atlaskit/react-select/async';
|
|
4
4
|
import createSelect from './create-select';
|
|
5
5
|
const packageName = "@atlaskit/select";
|
|
6
|
-
const packageVersion = "
|
|
6
|
+
const packageVersion = "21.8.2";
|
|
7
7
|
export const SelectWithoutAnalytics = createSelect(AsyncSelect);
|
|
8
8
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
9
9
|
const Select = withAnalyticsContext({
|
|
@@ -1,32 +1,4 @@
|
|
|
1
|
-
export function generateGroupLabel(onFocusProps, defaultOptions) {
|
|
2
|
-
var _groupData$options$fi;
|
|
3
|
-
const {
|
|
4
|
-
focused
|
|
5
|
-
} = onFocusProps;
|
|
6
|
-
const isOptionFocused = option => {
|
|
7
|
-
return option.label === focused.label;
|
|
8
|
-
};
|
|
9
|
-
const groupData = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.find(option => {
|
|
10
|
-
var _option$options;
|
|
11
|
-
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
12
|
-
});
|
|
13
|
-
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;
|
|
14
|
-
const totalLength = countAllOptions(defaultOptions);
|
|
15
|
-
return `${focused.label}, ${groupData === null || groupData === void 0 ? void 0 : groupData.label} (${groupOptionIndex + 1} of ${totalLength})`;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
1
|
// Helper function which identifies if options are grouped.
|
|
19
2
|
export const isOptionsGrouped = arr => {
|
|
20
3
|
return arr === null || arr === void 0 ? void 0 : arr.every(obj => obj.hasOwnProperty('options'));
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// Helper function which calculates how many options are in total in all groups.
|
|
24
|
-
export const countAllOptions = groupsArray => {
|
|
25
|
-
const totalLength = groupsArray === null || groupsArray === void 0 ? void 0 : groupsArray.reduce((acc, currentGroup) => {
|
|
26
|
-
var _group$options;
|
|
27
|
-
const group = currentGroup;
|
|
28
|
-
acc += group === null || group === void 0 ? void 0 : (_group$options = group.options) === null || _group$options === void 0 ? void 0 : _group$options.length;
|
|
29
|
-
return acc;
|
|
30
|
-
}, 0);
|
|
31
|
-
return totalLength;
|
|
32
4
|
};
|
package/dist/esm/select.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
3
3
|
import AsyncSelect from '@atlaskit/react-select/async';
|
|
4
4
|
import createSelect from './create-select';
|
|
5
5
|
var packageName = "@atlaskit/select";
|
|
6
|
-
var packageVersion = "
|
|
6
|
+
var packageVersion = "21.8.2";
|
|
7
7
|
export var SelectWithoutAnalytics = createSelect(AsyncSelect);
|
|
8
8
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
9
9
|
var Select = withAnalyticsContext({
|
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
export function generateGroupLabel(onFocusProps, defaultOptions) {
|
|
2
|
-
var _groupData$options$fi;
|
|
3
|
-
var focused = onFocusProps.focused;
|
|
4
|
-
var isOptionFocused = function isOptionFocused(option) {
|
|
5
|
-
return option.label === focused.label;
|
|
6
|
-
};
|
|
7
|
-
var groupData = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.find(function (option) {
|
|
8
|
-
var _option$options;
|
|
9
|
-
return (_option$options = option.options) === null || _option$options === void 0 ? void 0 : _option$options.some(isOptionFocused);
|
|
10
|
-
});
|
|
11
|
-
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;
|
|
12
|
-
var totalLength = countAllOptions(defaultOptions);
|
|
13
|
-
return "".concat(focused.label, ", ").concat(groupData === null || groupData === void 0 ? void 0 : groupData.label, " (").concat(groupOptionIndex + 1, " of ").concat(totalLength, ")");
|
|
14
|
-
}
|
|
15
|
-
|
|
16
1
|
// Helper function which identifies if options are grouped.
|
|
17
2
|
export var isOptionsGrouped = function isOptionsGrouped(arr) {
|
|
18
3
|
return arr === null || arr === void 0 ? void 0 : arr.every(function (obj) {
|
|
19
4
|
return obj.hasOwnProperty('options');
|
|
20
5
|
});
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// Helper function which calculates how many options are in total in all groups.
|
|
24
|
-
export var countAllOptions = function countAllOptions(groupsArray) {
|
|
25
|
-
var totalLength = groupsArray === null || groupsArray === void 0 ? void 0 : groupsArray.reduce(function (acc, currentGroup) {
|
|
26
|
-
var _group$options;
|
|
27
|
-
var group = currentGroup;
|
|
28
|
-
acc += group === null || group === void 0 || (_group$options = group.options) === null || _group$options === void 0 ? void 0 : _group$options.length;
|
|
29
|
-
return acc;
|
|
30
|
-
}, 0);
|
|
31
|
-
return totalLength;
|
|
32
6
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type OptionsOrGroups } from '@atlaskit/react-select';
|
|
2
2
|
import { type GroupType, type OptionType } from '../types';
|
|
3
|
-
export declare function generateGroupLabel(onFocusProps: AriaOnFocusProps<OptionType, GroupBase<OptionType>>, defaultOptions?: OptionsOrGroups<OptionType, GroupType<OptionType>>): string;
|
|
4
3
|
export declare const isOptionsGrouped: (arr: OptionsOrGroups<OptionType, GroupType<OptionType>> | undefined) => boolean | undefined;
|
|
5
|
-
export declare const countAllOptions: (groupsArray: readonly GroupType<OptionType>[]) => number;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type OptionsOrGroups } from '@atlaskit/react-select';
|
|
2
2
|
import { type GroupType, type OptionType } from '../types';
|
|
3
|
-
export declare function generateGroupLabel(onFocusProps: AriaOnFocusProps<OptionType, GroupBase<OptionType>>, defaultOptions?: OptionsOrGroups<OptionType, GroupType<OptionType>>): string;
|
|
4
3
|
export declare const isOptionsGrouped: (arr: OptionsOrGroups<OptionType, GroupType<OptionType>> | undefined) => boolean | undefined;
|
|
5
|
-
export declare const countAllOptions: (groupsArray: readonly GroupType<OptionType>[]) => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/select",
|
|
3
|
-
"version": "21.8.
|
|
3
|
+
"version": "21.8.3",
|
|
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/"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
36
36
|
"@atlaskit/ds-lib": "^6.0.0",
|
|
37
|
-
"@atlaskit/icon": "^
|
|
37
|
+
"@atlaskit/icon": "^33.0.0",
|
|
38
38
|
"@atlaskit/layering": "^3.6.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
40
40
|
"@atlaskit/primitives": "^18.0.0",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@af/visual-regression": "workspace:^",
|
|
61
61
|
"@atlaskit/button": "^23.10.0",
|
|
62
62
|
"@atlaskit/checkbox": "^17.3.0",
|
|
63
|
-
"@atlaskit/docs": "^11.
|
|
64
|
-
"@atlaskit/drawer": "^
|
|
63
|
+
"@atlaskit/docs": "^11.7.0",
|
|
64
|
+
"@atlaskit/drawer": "^12.0.0",
|
|
65
65
|
"@atlaskit/form": "^15.4.0",
|
|
66
66
|
"@atlaskit/link": "^3.3.0",
|
|
67
67
|
"@atlaskit/logo": "^19.10.0",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"@atlaskit/section-message": "^8.12.0",
|
|
71
71
|
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
72
72
|
"@atlassian/ssr-tests": "workspace:^",
|
|
73
|
+
"@atlassian/structured-docs-types": "workspace:^",
|
|
73
74
|
"@testing-library/react": "^16.3.0",
|
|
74
75
|
"@testing-library/user-event": "^14.4.3",
|
|
75
76
|
"ast-types": "^0.13.3",
|
package/select.docs.tsx
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
import type { ComponentStructuredContentSource } from '@atlassian/structured-docs-types';
|
|
4
|
+
|
|
5
|
+
const documentation: ComponentStructuredContentSource[] = [
|
|
6
|
+
{
|
|
7
|
+
name: 'Select',
|
|
8
|
+
description: 'A flexible select component for single and multi-selection.',
|
|
9
|
+
status: 'general-availability',
|
|
10
|
+
import: {
|
|
11
|
+
name: 'Select',
|
|
12
|
+
package: '@atlaskit/select',
|
|
13
|
+
type: 'default',
|
|
14
|
+
packagePath: path.resolve(__dirname),
|
|
15
|
+
packageJson: require('./package.json'),
|
|
16
|
+
},
|
|
17
|
+
usageGuidelines: [
|
|
18
|
+
'Use for choosing one or more from a list; common in forms and inline edit',
|
|
19
|
+
'Use a visible label for the field—do not use placeholder as the only label (placeholder disappears and is not accessible)',
|
|
20
|
+
'Use logical order (e.g. most selected first, numeric)',
|
|
21
|
+
'Do not overwhelm with too many options',
|
|
22
|
+
'Enable search for long option lists',
|
|
23
|
+
'Consider loading states for async data',
|
|
24
|
+
'Avoid alphabetical ordering (not localizable); use logical order for translatable option lists',
|
|
25
|
+
],
|
|
26
|
+
contentGuidelines: [
|
|
27
|
+
'Write clear, descriptive option labels',
|
|
28
|
+
'Use consistent terminology across options',
|
|
29
|
+
'Keep option text concise but meaningful',
|
|
30
|
+
'Group related options only when all items are groupable; use well-known categories or for disambiguation (e.g. Portland ME vs OR); no group of one',
|
|
31
|
+
],
|
|
32
|
+
accessibilityGuidelines: [
|
|
33
|
+
'Use labels and helper text for the field—do not use placeholder as label (disappears on focus, not accessible)',
|
|
34
|
+
'Clear control is removed from tab order; keyboard users clear selection via Delete',
|
|
35
|
+
'Provide clear labels for all selects',
|
|
36
|
+
'Ensure keyboard navigation with arrow keys',
|
|
37
|
+
'Support screen reader announcements',
|
|
38
|
+
],
|
|
39
|
+
examples: [
|
|
40
|
+
{
|
|
41
|
+
name: 'Default',
|
|
42
|
+
description: 'The default select appearance.',
|
|
43
|
+
source: path.resolve(__dirname, './examples/constellation/select-appearance-default.tsx'),
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
keywords: ['select', 'dropdown', 'form', 'input', 'options', 'choice', 'picker'],
|
|
47
|
+
categories: ['form'],
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
export default documentation;
|