@sprinklrjs/spaceweb 14.13.2 → 14.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/accessibilityIsolation.d.ts +5 -0
- package/a11y/accessibilityIsolation.js +12 -0
- package/asyncSelect/hooks/useAsyncSelect.d.ts +54 -0
- package/asyncSelect/hooks/useGroupedAsyncSelect.d.ts +54 -0
- package/baseui/modal/modal.d.ts +4 -0
- package/baseui/modal/modal.js +24 -2
- package/baseui/select/default-props.d.ts +1 -0
- package/baseui/select/default-props.js +2 -0
- package/baseui/select/select-component.d.ts +4 -0
- package/baseui/select/select-component.js +14 -3
- package/baseui/select/stateful-select.d.ts +1 -0
- package/baseui/select/types.d.ts +5 -0
- package/esm/a11y/accessibilityIsolation.d.ts +5 -0
- package/esm/a11y/accessibilityIsolation.js +8 -0
- package/esm/asyncSelect/hooks/useAsyncSelect.d.ts +54 -0
- package/esm/asyncSelect/hooks/useGroupedAsyncSelect.d.ts +54 -0
- package/esm/baseui/modal/modal.d.ts +4 -0
- package/esm/baseui/modal/modal.js +24 -2
- package/esm/baseui/select/default-props.d.ts +1 -0
- package/esm/baseui/select/default-props.js +2 -0
- package/esm/baseui/select/select-component.d.ts +4 -0
- package/esm/baseui/select/select-component.js +12 -2
- package/esm/baseui/select/stateful-select.d.ts +1 -0
- package/esm/baseui/select/types.d.ts +5 -0
- package/esm/menu/menu-item.js +2 -2
- package/esm/select/index.d.ts +1 -1
- package/esm/select/index.js +1 -1
- package/esm/select/multi-value.d.ts +1 -0
- package/esm/select/multi-value.js +4 -3
- package/esm/select/selectMenuAdapter/CollapsibleSelectMenu.js +28 -7
- package/esm/select/selectMenuAdapter/SelectMenuItem.d.ts +1 -1
- package/esm/select/selectMenuAdapter/SelectMenuItem.js +13 -6
- package/esm/select/selectMenuAdapter/hooks/useRootSelectAllKeyboardNav.d.ts +22 -0
- package/esm/select/selectMenuAdapter/hooks/useRootSelectAllKeyboardNav.js +113 -0
- package/esm/select/types.d.ts +1 -0
- package/menu/menu-item.js +2 -2
- package/package.json +3 -2
- package/select/index.d.ts +1 -1
- package/select/index.js +2 -1
- package/select/multi-value.d.ts +1 -0
- package/select/multi-value.js +4 -3
- package/select/selectMenuAdapter/CollapsibleSelectMenu.js +27 -6
- package/select/selectMenuAdapter/SelectMenuItem.d.ts +1 -1
- package/select/selectMenuAdapter/SelectMenuItem.js +13 -6
- package/select/selectMenuAdapter/hooks/useRootSelectAllKeyboardNav.d.ts +22 -0
- package/select/selectMenuAdapter/hooks/useRootSelectAllKeyboardNav.js +117 -0
- package/select/types.d.ts +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isolateAccessibilityTree = void 0;
|
|
4
|
+
var aria_hidden_1 = require("aria-hidden");
|
|
5
|
+
/**
|
|
6
|
+
* Hide all content outside `keepNode` from assistive technology while a modal
|
|
7
|
+
* `[aria-live]` descendants of `document.body` visible.
|
|
8
|
+
*/
|
|
9
|
+
function isolateAccessibilityTree(keepNode) {
|
|
10
|
+
return (0, aria_hidden_1.hideOthers)(keepNode);
|
|
11
|
+
}
|
|
12
|
+
exports.isolateAccessibilityTree = isolateAccessibilityTree;
|
|
@@ -127,6 +127,24 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
|
|
|
127
127
|
}>;
|
|
128
128
|
index?: number | undefined;
|
|
129
129
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
130
|
+
getValueAriaLabel?: ((a: {
|
|
131
|
+
option: Readonly<{
|
|
132
|
+
[x: string]: any;
|
|
133
|
+
id?: import("../types").Id | undefined;
|
|
134
|
+
label?: import("react").ReactNode;
|
|
135
|
+
disabled?: boolean | undefined;
|
|
136
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
137
|
+
clearableValue?: boolean | undefined;
|
|
138
|
+
isCreatable?: boolean | undefined;
|
|
139
|
+
__optgroup?: string | undefined;
|
|
140
|
+
searchTags?: string[] | undefined;
|
|
141
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
142
|
+
__closeOnSelect?: boolean | undefined;
|
|
143
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
144
|
+
__groupSelectAll?: boolean | undefined;
|
|
145
|
+
}>;
|
|
146
|
+
index?: number | undefined;
|
|
147
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
130
148
|
ignoreCase?: boolean | undefined;
|
|
131
149
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
132
150
|
labelKey?: string | undefined;
|
|
@@ -305,6 +323,24 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
|
|
|
305
323
|
}>;
|
|
306
324
|
index?: number | undefined;
|
|
307
325
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
326
|
+
getValueAriaLabel?: ((a: {
|
|
327
|
+
option: Readonly<{
|
|
328
|
+
[x: string]: any;
|
|
329
|
+
id?: import("../types").Id | undefined;
|
|
330
|
+
label?: import("react").ReactNode;
|
|
331
|
+
disabled?: boolean | undefined;
|
|
332
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
333
|
+
clearableValue?: boolean | undefined;
|
|
334
|
+
isCreatable?: boolean | undefined;
|
|
335
|
+
__optgroup?: string | undefined;
|
|
336
|
+
searchTags?: string[] | undefined;
|
|
337
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
338
|
+
__closeOnSelect?: boolean | undefined;
|
|
339
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
340
|
+
__groupSelectAll?: boolean | undefined;
|
|
341
|
+
}>;
|
|
342
|
+
index?: number | undefined;
|
|
343
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
308
344
|
ignoreCase?: boolean | undefined;
|
|
309
345
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
310
346
|
labelKey?: string | undefined;
|
|
@@ -486,6 +522,24 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
|
|
|
486
522
|
}>;
|
|
487
523
|
index?: number | undefined;
|
|
488
524
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
525
|
+
getValueAriaLabel?: ((a: {
|
|
526
|
+
option: Readonly<{
|
|
527
|
+
[x: string]: any;
|
|
528
|
+
id?: import("../types").Id | undefined;
|
|
529
|
+
label?: import("react").ReactNode;
|
|
530
|
+
disabled?: boolean | undefined;
|
|
531
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
532
|
+
clearableValue?: boolean | undefined;
|
|
533
|
+
isCreatable?: boolean | undefined;
|
|
534
|
+
__optgroup?: string | undefined;
|
|
535
|
+
searchTags?: string[] | undefined;
|
|
536
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
537
|
+
__closeOnSelect?: boolean | undefined;
|
|
538
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
539
|
+
__groupSelectAll?: boolean | undefined;
|
|
540
|
+
}>;
|
|
541
|
+
index?: number | undefined;
|
|
542
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
489
543
|
ignoreCase?: boolean | undefined;
|
|
490
544
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
491
545
|
labelKey?: string | undefined;
|
|
@@ -95,6 +95,24 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
|
|
|
95
95
|
}>;
|
|
96
96
|
index?: number | undefined;
|
|
97
97
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
98
|
+
getValueAriaLabel?: ((a: {
|
|
99
|
+
option: Readonly<{
|
|
100
|
+
[x: string]: any;
|
|
101
|
+
id?: import("../types").Id | undefined;
|
|
102
|
+
label?: import("react").ReactNode;
|
|
103
|
+
disabled?: boolean | undefined;
|
|
104
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
105
|
+
clearableValue?: boolean | undefined;
|
|
106
|
+
isCreatable?: boolean | undefined;
|
|
107
|
+
__optgroup?: string | undefined;
|
|
108
|
+
searchTags?: string[] | undefined;
|
|
109
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
110
|
+
__closeOnSelect?: boolean | undefined;
|
|
111
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
112
|
+
__groupSelectAll?: boolean | undefined;
|
|
113
|
+
}>;
|
|
114
|
+
index?: number | undefined;
|
|
115
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
98
116
|
ignoreCase?: boolean | undefined;
|
|
99
117
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
100
118
|
labelKey?: string | undefined;
|
|
@@ -241,6 +259,24 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
|
|
|
241
259
|
}>;
|
|
242
260
|
index?: number | undefined;
|
|
243
261
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
262
|
+
getValueAriaLabel?: ((a: {
|
|
263
|
+
option: Readonly<{
|
|
264
|
+
[x: string]: any;
|
|
265
|
+
id?: import("../types").Id | undefined;
|
|
266
|
+
label?: import("react").ReactNode;
|
|
267
|
+
disabled?: boolean | undefined;
|
|
268
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
269
|
+
clearableValue?: boolean | undefined;
|
|
270
|
+
isCreatable?: boolean | undefined;
|
|
271
|
+
__optgroup?: string | undefined;
|
|
272
|
+
searchTags?: string[] | undefined;
|
|
273
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
274
|
+
__closeOnSelect?: boolean | undefined;
|
|
275
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
276
|
+
__groupSelectAll?: boolean | undefined;
|
|
277
|
+
}>;
|
|
278
|
+
index?: number | undefined;
|
|
279
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
244
280
|
ignoreCase?: boolean | undefined;
|
|
245
281
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
246
282
|
labelKey?: string | undefined;
|
|
@@ -389,6 +425,24 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
|
|
|
389
425
|
}>;
|
|
390
426
|
index?: number | undefined;
|
|
391
427
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
428
|
+
getValueAriaLabel?: ((a: {
|
|
429
|
+
option: Readonly<{
|
|
430
|
+
[x: string]: any;
|
|
431
|
+
id?: import("../types").Id | undefined;
|
|
432
|
+
label?: import("react").ReactNode;
|
|
433
|
+
disabled?: boolean | undefined;
|
|
434
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
435
|
+
clearableValue?: boolean | undefined;
|
|
436
|
+
isCreatable?: boolean | undefined;
|
|
437
|
+
__optgroup?: string | undefined;
|
|
438
|
+
searchTags?: string[] | undefined;
|
|
439
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
440
|
+
__closeOnSelect?: boolean | undefined;
|
|
441
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
442
|
+
__groupSelectAll?: boolean | undefined;
|
|
443
|
+
}>;
|
|
444
|
+
index?: number | undefined;
|
|
445
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
392
446
|
ignoreCase?: boolean | undefined;
|
|
393
447
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
394
448
|
labelKey?: string | undefined;
|
package/baseui/modal/modal.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ declare class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
10
10
|
dialogContainerRef: React.RefObject<HTMLElement>;
|
|
11
11
|
lastFocus: HTMLElement | undefined | null;
|
|
12
12
|
lastMountNodeOverflowStyle: string | undefined | null;
|
|
13
|
+
releaseModalAccessibilityIsolation: (() => void) | undefined;
|
|
13
14
|
rootRef: React.RefObject<HTMLElement>;
|
|
14
15
|
state: {
|
|
15
16
|
isVisible: boolean;
|
|
@@ -23,10 +24,13 @@ declare class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
23
24
|
handleBlur: (_event: SyntheticEvent) => void;
|
|
24
25
|
disableMountNodeScroll(): void;
|
|
25
26
|
resetMountNodeScroll(): void;
|
|
27
|
+
enableModalAccessibilityIsolation(): void;
|
|
28
|
+
disableModalAccessibilityIsolation(): void;
|
|
26
29
|
onEscape: () => void;
|
|
27
30
|
onDocumentClick: (e: MouseEvent) => void;
|
|
28
31
|
onBackdropClick: () => void;
|
|
29
32
|
onCloseClick: () => void;
|
|
33
|
+
onLayerMount: () => void;
|
|
30
34
|
clearTimers(): void;
|
|
31
35
|
didOpen(): void;
|
|
32
36
|
didClose(): void;
|
package/baseui/modal/modal.js
CHANGED
|
@@ -17,6 +17,7 @@ var constants_1 = require("./constants");
|
|
|
17
17
|
var styled_components_1 = require("./styled-components");
|
|
18
18
|
var close_icon_1 = require("./close-icon");
|
|
19
19
|
var focusVisible_1 = require("../utils/focusVisible");
|
|
20
|
+
var accessibilityIsolation_1 = require("../../a11y/accessibilityIsolation");
|
|
20
21
|
var Modal = /** @class */ (function (_super) {
|
|
21
22
|
tslib_1.__extends(Modal, _super);
|
|
22
23
|
function Modal() {
|
|
@@ -63,6 +64,11 @@ var Modal = /** @class */ (function (_super) {
|
|
|
63
64
|
_this.onCloseClick = function () {
|
|
64
65
|
_this.triggerClose(constants_1.CLOSE_SOURCE.closeButton);
|
|
65
66
|
};
|
|
67
|
+
_this.onLayerMount = function () {
|
|
68
|
+
if (_this.props.isOpen) {
|
|
69
|
+
_this.enableModalAccessibilityIsolation();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
66
72
|
_this.animateOutComplete = function () {
|
|
67
73
|
_this.setState({
|
|
68
74
|
isVisible: false,
|
|
@@ -84,6 +90,7 @@ var Modal = /** @class */ (function (_super) {
|
|
|
84
90
|
}
|
|
85
91
|
};
|
|
86
92
|
Modal.prototype.componentWillUnmount = function () {
|
|
93
|
+
this.disableModalAccessibilityIsolation();
|
|
87
94
|
this.resetMountNodeScroll();
|
|
88
95
|
this.clearTimers();
|
|
89
96
|
this.prevMounted = this.mounted;
|
|
@@ -123,6 +130,19 @@ var Modal = /** @class */ (function (_super) {
|
|
|
123
130
|
this.lastMountNodeOverflowStyle = null;
|
|
124
131
|
}
|
|
125
132
|
};
|
|
133
|
+
Modal.prototype.enableModalAccessibilityIsolation = function () {
|
|
134
|
+
if (this.releaseModalAccessibilityIsolation || !this.rootRef.current) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
this.releaseModalAccessibilityIsolation = (0, accessibilityIsolation_1.isolateAccessibilityTree)(this.rootRef.current);
|
|
138
|
+
};
|
|
139
|
+
Modal.prototype.disableModalAccessibilityIsolation = function () {
|
|
140
|
+
if (!this.releaseModalAccessibilityIsolation) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
this.releaseModalAccessibilityIsolation();
|
|
144
|
+
this.releaseModalAccessibilityIsolation = undefined;
|
|
145
|
+
};
|
|
126
146
|
Modal.prototype.clearTimers = function () {
|
|
127
147
|
if (this.animateOutTimer) {
|
|
128
148
|
clearTimeout(this.animateOutTimer);
|
|
@@ -142,6 +162,7 @@ var Modal = /** @class */ (function (_super) {
|
|
|
142
162
|
// Clear any existing timers (like previous animateOutTimer)
|
|
143
163
|
this.clearTimers();
|
|
144
164
|
this.disableMountNodeScroll();
|
|
165
|
+
this.enableModalAccessibilityIsolation();
|
|
145
166
|
if (this.props.animate) {
|
|
146
167
|
this.animateStartTimer = requestAnimationFrame(function () {
|
|
147
168
|
_this.setState({ isVisible: true });
|
|
@@ -152,6 +173,7 @@ var Modal = /** @class */ (function (_super) {
|
|
|
152
173
|
}
|
|
153
174
|
};
|
|
154
175
|
Modal.prototype.didClose = function () {
|
|
176
|
+
this.disableModalAccessibilityIsolation();
|
|
155
177
|
this.resetMountNodeScroll();
|
|
156
178
|
this.animateOutTimer = setTimeout(this.animateOutComplete, 500);
|
|
157
179
|
};
|
|
@@ -208,7 +230,7 @@ var Modal = /** @class */ (function (_super) {
|
|
|
208
230
|
}
|
|
209
231
|
return ((0, jsx_runtime_1.jsx)(react_focus_lock_1.default, tslib_1.__assign({ disabled: !focusLock,
|
|
210
232
|
// Allow focus to escape when UI is within an iframe
|
|
211
|
-
crossFrame: false, returnFocus: returnFocus, autoFocus: autoFocus }, { children: (0, jsx_runtime_1.jsx)(Root, tslib_1.__assign({ "data-baseweb": constants_1.BASEWEB_NAME, ref: this.rootRef }, sharedProps, rootProps, { children: (0, jsx_runtime_1.jsx)(DialogContainer, tslib_1.__assign({ "data-testid": "spaceweb-modal-dialog-container", ref: this.dialogContainerRef }, sharedProps, dialogContainerProps, { children: (0, jsx_runtime_1.jsxs)(Dialog, tslib_1.__assign({ tabIndex: -1,
|
|
233
|
+
crossFrame: false, returnFocus: returnFocus, autoFocus: autoFocus }, { children: (0, jsx_runtime_1.jsx)(Root, tslib_1.__assign({ "data-baseweb": constants_1.BASEWEB_NAME, ref: this.rootRef }, sharedProps, rootProps, { children: (0, jsx_runtime_1.jsx)(DialogContainer, tslib_1.__assign({ "data-testid": "spaceweb-modal-dialog-container", ref: this.dialogContainerRef }, sharedProps, dialogContainerProps, { children: (0, jsx_runtime_1.jsxs)(Dialog, tslib_1.__assign({ tabIndex: -1, role: role }, sharedProps, dialogProps, { style: [dialogueWidth ? { '--sw-width': dialogueWidth } : {}, dialogProps === null || dialogProps === void 0 ? void 0 : dialogProps.style] }, { children: [renderedContent, closeable ? ((0, jsx_runtime_1.jsx)(Close, tslib_1.__assign({ onClick: this.onCloseClick }, sharedProps, closeProps, { onFocus: (0, focusVisible_1.forkFocus)(closeProps, this.handleFocus), onBlur: (0, focusVisible_1.forkBlur)(closeProps, this.handleBlur) }, { children: (0, jsx_runtime_1.jsx)(close_icon_1.CloseIcon, {}) }))) : null] })) })) })) })));
|
|
212
234
|
};
|
|
213
235
|
Modal.prototype.render = function () {
|
|
214
236
|
// Only render an open and non-renderAll modal on the browser (portals aren't supported server-side)
|
|
@@ -216,7 +238,7 @@ var Modal = /** @class */ (function (_super) {
|
|
|
216
238
|
var renderedContent = mountedAndOpen || this.props.renderAll ? this.getChildren() : null;
|
|
217
239
|
if (renderedContent) {
|
|
218
240
|
if (mountedAndOpen) {
|
|
219
|
-
return ((0, jsx_runtime_1.jsx)(layer_1.Layer, tslib_1.__assign({ onEscape: this.onEscape, onDocumentClick: this.onDocumentClick, mountNode: this.props.mountNode }, { children: this.renderModal(renderedContent) })));
|
|
241
|
+
return ((0, jsx_runtime_1.jsx)(layer_1.Layer, tslib_1.__assign({ onEscape: this.onEscape, onDocumentClick: this.onDocumentClick, onMount: this.onLayerMount, mountNode: this.props.mountNode }, { children: this.renderModal(renderedContent) })));
|
|
220
242
|
}
|
|
221
243
|
return (0, jsx_runtime_1.jsx)(styled_components_1.Hidden, { children: renderedContent });
|
|
222
244
|
}
|
|
@@ -5,6 +5,8 @@ type GetOptionLabel = NonNullable<SelectProps['getOptionLabel']>;
|
|
|
5
5
|
export declare function getOptionLabel({ option }: Parameters<GetOptionLabel>[0], { selectLocale, labelKey }: SelectProps): ReactNode;
|
|
6
6
|
type GetValueLabel = NonNullable<SelectProps['getValueLabel']>;
|
|
7
7
|
export declare function getValueLabel({ option }: Parameters<GetValueLabel>[0], { labelKey }: SelectProps): ReactNode;
|
|
8
|
+
type GetValueAriaLabel = NonNullable<SelectProps['getValueAriaLabel']>;
|
|
9
|
+
export declare function getValueAriaLabel({ option }: Parameters<GetValueAriaLabel>[0], { labelKey }: SelectProps): string | undefined;
|
|
8
10
|
declare class Select extends Component<SelectProps, SelectState> {
|
|
9
11
|
static defaultProps: {
|
|
10
12
|
'aria-label': null;
|
|
@@ -39,6 +41,7 @@ declare class Select extends Component<SelectProps, SelectState> {
|
|
|
39
41
|
filterOutSelected: boolean;
|
|
40
42
|
getOptionLabel: null;
|
|
41
43
|
getValueLabel: null;
|
|
44
|
+
getValueAriaLabel: null;
|
|
42
45
|
ignoreCase: boolean;
|
|
43
46
|
isLoading: boolean;
|
|
44
47
|
labelKey: string;
|
|
@@ -108,6 +111,7 @@ declare class Select extends Component<SelectProps, SelectState> {
|
|
|
108
111
|
handleKeyDown: (event: KeyboardEvent) => void;
|
|
109
112
|
getOptionLabel: GetOptionLabel;
|
|
110
113
|
getValueLabel: GetValueLabel;
|
|
114
|
+
getValueAriaLabel: GetValueAriaLabel;
|
|
111
115
|
getMemoizedOptionsMap: (options: Options, valueKey: string) => Map<string, Option>;
|
|
112
116
|
/**
|
|
113
117
|
* Extends the value into an array from the given options
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getValueLabel = exports.getOptionLabel = void 0;
|
|
3
|
+
exports.getValueAriaLabel = exports.getValueLabel = exports.getOptionLabel = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
/*
|
|
@@ -54,6 +54,13 @@ function getValueLabel(_a, _b) {
|
|
|
54
54
|
return labelKey && option[labelKey];
|
|
55
55
|
}
|
|
56
56
|
exports.getValueLabel = getValueLabel;
|
|
57
|
+
function getValueAriaLabel(_a, _b) {
|
|
58
|
+
var option = _a.option;
|
|
59
|
+
var labelKey = _b.labelKey;
|
|
60
|
+
var label = labelKey && option[labelKey];
|
|
61
|
+
return typeof label === 'string' ? label : undefined;
|
|
62
|
+
}
|
|
63
|
+
exports.getValueAriaLabel = getValueAriaLabel;
|
|
57
64
|
var Select = /** @class */ (function (_super) {
|
|
58
65
|
tslib_1.__extends(Select, _super);
|
|
59
66
|
function Select() {
|
|
@@ -406,6 +413,8 @@ var Select = /** @class */ (function (_super) {
|
|
|
406
413
|
_this.getOptionLabel = function (optionData, props) { return getOptionLabel(optionData, props); };
|
|
407
414
|
// eslint-disable-next-line class-methods-use-this -- delegates to module-level helper
|
|
408
415
|
_this.getValueLabel = function (optionData, props) { return getValueLabel(optionData, props); };
|
|
416
|
+
// eslint-disable-next-line class-methods-use-this -- delegates to module-level helper
|
|
417
|
+
_this.getValueAriaLabel = function (optionData, props) { return getValueAriaLabel(optionData, props); };
|
|
409
418
|
_this.getMemoizedOptionsMap = (0, memoize_one_1.default)(function (options, valueKey) {
|
|
410
419
|
var normalizedOptions = _this.getMemoizedNormalizedOptions(options);
|
|
411
420
|
return new Map(normalizedOptions.map(function (option) { return [String(option[valueKey]), option]; }));
|
|
@@ -773,6 +782,7 @@ var Select = /** @class */ (function (_super) {
|
|
|
773
782
|
var _a = this.props.overrides, overrides = _a === void 0 ? {} : _a;
|
|
774
783
|
var sharedProps = this.getSharedProps();
|
|
775
784
|
var renderLabel = this.props.getValueLabel || this.getValueLabel;
|
|
785
|
+
var renderAriaLabel = this.props.getValueAriaLabel || this.getValueAriaLabel;
|
|
776
786
|
var Value = this.props.valueComponent || Noop;
|
|
777
787
|
var _b = tslib_1.__read((0, overrides_1.getOverrides)(overrides.ExtraTagPopover, popover_2.StatefulPopover), 2), ExtraTagPopover = _b[0], extraTagPopoverProps = _b[1];
|
|
778
788
|
var _c = tslib_1.__read((0, overrides_1.getOverrides)(overrides.ExtraTagPopoverList, list_1.List), 2), ExtraTagPopoverList = _c[0], extraTagPopoverListProps = _c[1];
|
|
@@ -801,7 +811,7 @@ var Select = /** @class */ (function (_super) {
|
|
|
801
811
|
// if not stopped, backspace event will be handled by select as well.
|
|
802
812
|
// which might remove pop last item from select.
|
|
803
813
|
e.stopPropagation();
|
|
804
|
-
}, disabled: disabled, overrides: { Tag: overrides.Tag, MultiValue: overrides.MultiValue }, tabIndex: 0 }, sharedProps, { "$disabled": disabled, ref: i === _this.state.focusedExtraValueTagIdx
|
|
814
|
+
}, disabled: disabled, overrides: { Tag: overrides.Tag, MultiValue: overrides.MultiValue }, tabIndex: 0 }, sharedProps, { "$disabled": disabled, ariaLabel: renderAriaLabel({ option: value, index: i }, _this.props), ref: i === _this.state.focusedExtraValueTagIdx
|
|
805
815
|
? function (valueEl) {
|
|
806
816
|
valueEl === null || valueEl === void 0 ? void 0 : valueEl.focus();
|
|
807
817
|
}
|
|
@@ -818,6 +828,7 @@ var Select = /** @class */ (function (_super) {
|
|
|
818
828
|
var _b = this.props.overrides, overrides = _b === void 0 ? {} : _b;
|
|
819
829
|
var sharedProps = this.getSharedProps();
|
|
820
830
|
var renderLabel = this.props.getValueLabel || this.getValueLabel;
|
|
831
|
+
var renderAriaLabel = this.props.getValueAriaLabel || this.getValueAriaLabel;
|
|
821
832
|
var Value = this.props.valueComponent || Noop;
|
|
822
833
|
if (!valueArray.length) {
|
|
823
834
|
return null;
|
|
@@ -828,7 +839,7 @@ var Select = /** @class */ (function (_super) {
|
|
|
828
839
|
var remainingTagsCount = valueArray.length - _limitTag;
|
|
829
840
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [valueArray.slice(0, _limitTag).map(function (value, i) {
|
|
830
841
|
var disabled = sharedProps.$disabled || value.clearableValue === false;
|
|
831
|
-
return ((0, jsx_runtime_1.jsx)(Value, tslib_1.__assign({ value: value, removeValue: function () { return _this.removeValueAndFocus(value); }, disabled: disabled, overrides: { Tag: overrides.Tag, MultiValue: overrides.MultiValue } }, sharedProps, { "$disabled": disabled, noTooltipOnTruncation: _this.props.noTooltipOnTruncation,
|
|
842
|
+
return ((0, jsx_runtime_1.jsx)(Value, tslib_1.__assign({ value: value, removeValue: function () { return _this.removeValueAndFocus(value); }, disabled: disabled, overrides: { Tag: overrides.Tag, MultiValue: overrides.MultiValue } }, sharedProps, { "$disabled": disabled, noTooltipOnTruncation: _this.props.noTooltipOnTruncation, ariaLabel: renderAriaLabel({ option: value, index: i }, _this.props),
|
|
832
843
|
//react calls ref function whenever we pass it and not just on mount
|
|
833
844
|
ref: i === _this.state.currentValueTagIdx
|
|
834
845
|
? function (valueEl) {
|
package/baseui/select/types.d.ts
CHANGED
|
@@ -153,6 +153,11 @@ export type SelectProps = {
|
|
|
153
153
|
option: Option;
|
|
154
154
|
index?: number;
|
|
155
155
|
}, props: SelectProps) => React.ReactNode) | null;
|
|
156
|
+
/** A custom method to get an aria-label for a selected option tag. */
|
|
157
|
+
getValueAriaLabel?: ((a: {
|
|
158
|
+
option: Option;
|
|
159
|
+
index?: number;
|
|
160
|
+
}, props: SelectProps) => string | undefined) | null;
|
|
156
161
|
/** Sets the id attribute of the internal input element. Allows for usage with labels. */
|
|
157
162
|
id?: string;
|
|
158
163
|
/** Defines if the comparison for a new creatable value should be case-insensitive. */
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { hideOthers } from 'aria-hidden';
|
|
2
|
+
/**
|
|
3
|
+
* Hide all content outside `keepNode` from assistive technology while a modal
|
|
4
|
+
* `[aria-live]` descendants of `document.body` visible.
|
|
5
|
+
*/
|
|
6
|
+
export function isolateAccessibilityTree(keepNode) {
|
|
7
|
+
return hideOthers(keepNode);
|
|
8
|
+
}
|
|
@@ -127,6 +127,24 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
|
|
|
127
127
|
}>;
|
|
128
128
|
index?: number | undefined;
|
|
129
129
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
130
|
+
getValueAriaLabel?: ((a: {
|
|
131
|
+
option: Readonly<{
|
|
132
|
+
[x: string]: any;
|
|
133
|
+
id?: import("../types").Id | undefined;
|
|
134
|
+
label?: import("react").ReactNode;
|
|
135
|
+
disabled?: boolean | undefined;
|
|
136
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
137
|
+
clearableValue?: boolean | undefined;
|
|
138
|
+
isCreatable?: boolean | undefined;
|
|
139
|
+
__optgroup?: string | undefined;
|
|
140
|
+
searchTags?: string[] | undefined;
|
|
141
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
142
|
+
__closeOnSelect?: boolean | undefined;
|
|
143
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
144
|
+
__groupSelectAll?: boolean | undefined;
|
|
145
|
+
}>;
|
|
146
|
+
index?: number | undefined;
|
|
147
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
130
148
|
ignoreCase?: boolean | undefined;
|
|
131
149
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
132
150
|
labelKey?: string | undefined;
|
|
@@ -305,6 +323,24 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
|
|
|
305
323
|
}>;
|
|
306
324
|
index?: number | undefined;
|
|
307
325
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
326
|
+
getValueAriaLabel?: ((a: {
|
|
327
|
+
option: Readonly<{
|
|
328
|
+
[x: string]: any;
|
|
329
|
+
id?: import("../types").Id | undefined;
|
|
330
|
+
label?: import("react").ReactNode;
|
|
331
|
+
disabled?: boolean | undefined;
|
|
332
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
333
|
+
clearableValue?: boolean | undefined;
|
|
334
|
+
isCreatable?: boolean | undefined;
|
|
335
|
+
__optgroup?: string | undefined;
|
|
336
|
+
searchTags?: string[] | undefined;
|
|
337
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
338
|
+
__closeOnSelect?: boolean | undefined;
|
|
339
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
340
|
+
__groupSelectAll?: boolean | undefined;
|
|
341
|
+
}>;
|
|
342
|
+
index?: number | undefined;
|
|
343
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
308
344
|
ignoreCase?: boolean | undefined;
|
|
309
345
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
310
346
|
labelKey?: string | undefined;
|
|
@@ -486,6 +522,24 @@ export declare const useAsyncSelect: ({ loadOptions, initialOptions, resolveSele
|
|
|
486
522
|
}>;
|
|
487
523
|
index?: number | undefined;
|
|
488
524
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
525
|
+
getValueAriaLabel?: ((a: {
|
|
526
|
+
option: Readonly<{
|
|
527
|
+
[x: string]: any;
|
|
528
|
+
id?: import("../types").Id | undefined;
|
|
529
|
+
label?: import("react").ReactNode;
|
|
530
|
+
disabled?: boolean | undefined;
|
|
531
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
532
|
+
clearableValue?: boolean | undefined;
|
|
533
|
+
isCreatable?: boolean | undefined;
|
|
534
|
+
__optgroup?: string | undefined;
|
|
535
|
+
searchTags?: string[] | undefined;
|
|
536
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
537
|
+
__closeOnSelect?: boolean | undefined;
|
|
538
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
539
|
+
__groupSelectAll?: boolean | undefined;
|
|
540
|
+
}>;
|
|
541
|
+
index?: number | undefined;
|
|
542
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
489
543
|
ignoreCase?: boolean | undefined;
|
|
490
544
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
491
545
|
labelKey?: string | undefined;
|
|
@@ -95,6 +95,24 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
|
|
|
95
95
|
}>;
|
|
96
96
|
index?: number | undefined;
|
|
97
97
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
98
|
+
getValueAriaLabel?: ((a: {
|
|
99
|
+
option: Readonly<{
|
|
100
|
+
[x: string]: any;
|
|
101
|
+
id?: import("../types").Id | undefined;
|
|
102
|
+
label?: import("react").ReactNode;
|
|
103
|
+
disabled?: boolean | undefined;
|
|
104
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
105
|
+
clearableValue?: boolean | undefined;
|
|
106
|
+
isCreatable?: boolean | undefined;
|
|
107
|
+
__optgroup?: string | undefined;
|
|
108
|
+
searchTags?: string[] | undefined;
|
|
109
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
110
|
+
__closeOnSelect?: boolean | undefined;
|
|
111
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
112
|
+
__groupSelectAll?: boolean | undefined;
|
|
113
|
+
}>;
|
|
114
|
+
index?: number | undefined;
|
|
115
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
98
116
|
ignoreCase?: boolean | undefined;
|
|
99
117
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
100
118
|
labelKey?: string | undefined;
|
|
@@ -241,6 +259,24 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
|
|
|
241
259
|
}>;
|
|
242
260
|
index?: number | undefined;
|
|
243
261
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
262
|
+
getValueAriaLabel?: ((a: {
|
|
263
|
+
option: Readonly<{
|
|
264
|
+
[x: string]: any;
|
|
265
|
+
id?: import("../types").Id | undefined;
|
|
266
|
+
label?: import("react").ReactNode;
|
|
267
|
+
disabled?: boolean | undefined;
|
|
268
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
269
|
+
clearableValue?: boolean | undefined;
|
|
270
|
+
isCreatable?: boolean | undefined;
|
|
271
|
+
__optgroup?: string | undefined;
|
|
272
|
+
searchTags?: string[] | undefined;
|
|
273
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
274
|
+
__closeOnSelect?: boolean | undefined;
|
|
275
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
276
|
+
__groupSelectAll?: boolean | undefined;
|
|
277
|
+
}>;
|
|
278
|
+
index?: number | undefined;
|
|
279
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
244
280
|
ignoreCase?: boolean | undefined;
|
|
245
281
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
246
282
|
labelKey?: string | undefined;
|
|
@@ -389,6 +425,24 @@ export declare const useGroupedAsyncSelect: ({ onChange, showSelectAll, selectAl
|
|
|
389
425
|
}>;
|
|
390
426
|
index?: number | undefined;
|
|
391
427
|
}, props: import("../../baseui/select").SelectProps) => import("react").ReactNode) | null | undefined;
|
|
428
|
+
getValueAriaLabel?: ((a: {
|
|
429
|
+
option: Readonly<{
|
|
430
|
+
[x: string]: any;
|
|
431
|
+
id?: import("../types").Id | undefined;
|
|
432
|
+
label?: import("react").ReactNode;
|
|
433
|
+
disabled?: boolean | undefined;
|
|
434
|
+
disabledTooltipConfig?: Omit<import("../../tooltip").ActionableTooltipProps, "children"> | undefined;
|
|
435
|
+
clearableValue?: boolean | undefined;
|
|
436
|
+
isCreatable?: boolean | undefined;
|
|
437
|
+
__optgroup?: string | undefined;
|
|
438
|
+
searchTags?: string[] | undefined;
|
|
439
|
+
tooltipContent?: import("react").ReactNode | import("../../baseui/popover").ContentRenderProp;
|
|
440
|
+
__closeOnSelect?: boolean | undefined;
|
|
441
|
+
__onSelectResetsInput?: boolean | undefined;
|
|
442
|
+
__groupSelectAll?: boolean | undefined;
|
|
443
|
+
}>;
|
|
444
|
+
index?: number | undefined;
|
|
445
|
+
}, props: import("../../baseui/select").SelectProps) => string | undefined) | null | undefined;
|
|
392
446
|
ignoreCase?: boolean | undefined;
|
|
393
447
|
controlRef?: import("../../select").ControlRef | undefined;
|
|
394
448
|
labelKey?: string | undefined;
|
|
@@ -10,6 +10,7 @@ declare class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
10
10
|
dialogContainerRef: React.RefObject<HTMLElement>;
|
|
11
11
|
lastFocus: HTMLElement | undefined | null;
|
|
12
12
|
lastMountNodeOverflowStyle: string | undefined | null;
|
|
13
|
+
releaseModalAccessibilityIsolation: (() => void) | undefined;
|
|
13
14
|
rootRef: React.RefObject<HTMLElement>;
|
|
14
15
|
state: {
|
|
15
16
|
isVisible: boolean;
|
|
@@ -23,10 +24,13 @@ declare class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
23
24
|
handleBlur: (_event: SyntheticEvent) => void;
|
|
24
25
|
disableMountNodeScroll(): void;
|
|
25
26
|
resetMountNodeScroll(): void;
|
|
27
|
+
enableModalAccessibilityIsolation(): void;
|
|
28
|
+
disableModalAccessibilityIsolation(): void;
|
|
26
29
|
onEscape: () => void;
|
|
27
30
|
onDocumentClick: (e: MouseEvent) => void;
|
|
28
31
|
onBackdropClick: () => void;
|
|
29
32
|
onCloseClick: () => void;
|
|
33
|
+
onLayerMount: () => void;
|
|
30
34
|
clearTimers(): void;
|
|
31
35
|
didOpen(): void;
|
|
32
36
|
didClose(): void;
|