baseui 0.0.0-next-6cf31f1 → 0.0.0-next-aed3abd
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/combobox/combobox.js +5 -1
- package/combobox/combobox.js.flow +4 -0
- package/es/combobox/combobox.js +5 -1
- package/es/popover/popover.js +3 -2
- package/es/popover/stateful-container.js +4 -2
- package/esm/combobox/combobox.js +5 -1
- package/esm/popover/popover.js +3 -2
- package/esm/popover/stateful-container.js +4 -2
- package/modal/index.d.ts +1 -1
- package/modal/types.js.flow +4 -1
- package/package.json +2 -2
- package/popover/index.d.ts +2 -1
- package/popover/popover.js +3 -2
- package/popover/popover.js.flow +2 -1
- package/popover/stateful-container.js +4 -2
- package/popover/stateful-container.js.flow +2 -0
- package/popover/types.js.flow +6 -1
package/combobox/combobox.js
CHANGED
|
@@ -306,7 +306,11 @@ function Combobox(props) {
|
|
|
306
306
|
return /*#__PURE__*/React.createElement(Root // eslint-disable-next-line flowtype/no-weak-types
|
|
307
307
|
, _extends({
|
|
308
308
|
ref: rootRef
|
|
309
|
-
}, rootProps), /*#__PURE__*/React.createElement(OverriddenPopover,
|
|
309
|
+
}, rootProps), /*#__PURE__*/React.createElement(OverriddenPopover // React-focus-lock used in Popover used to skip non-tabbable elements (`tabIndex=-1`) elements for focus, we had ListBox with tabIndex to disable focus on
|
|
310
|
+
// the ListBox, but we can just disable autoFocus (as ListBox / ListItem should not be focusable) (and input is also not autoFocused).
|
|
311
|
+
// Select Component does the same thing
|
|
312
|
+
, _extends({
|
|
313
|
+
autoFocus: false,
|
|
310
314
|
isOpen: isOpen,
|
|
311
315
|
overrides: popoverOverrides,
|
|
312
316
|
placement: _index2.PLACEMENT.bottomLeft,
|
|
@@ -258,6 +258,10 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
|
|
|
258
258
|
{...rootProps}
|
|
259
259
|
>
|
|
260
260
|
<OverriddenPopover
|
|
261
|
+
// React-focus-lock used in Popover used to skip non-tabbable elements (`tabIndex=-1`) elements for focus, we had ListBox with tabIndex to disable focus on
|
|
262
|
+
// the ListBox, but we can just disable autoFocus (as ListBox / ListItem should not be focusable) (and input is also not autoFocused).
|
|
263
|
+
// Select Component does the same thing
|
|
264
|
+
autoFocus={false}
|
|
261
265
|
isOpen={isOpen}
|
|
262
266
|
overrides={popoverOverrides}
|
|
263
267
|
placement={PLACEMENT.bottomLeft}
|
package/es/combobox/combobox.js
CHANGED
|
@@ -235,7 +235,11 @@ function Combobox(props) {
|
|
|
235
235
|
return /*#__PURE__*/React.createElement(Root // eslint-disable-next-line flowtype/no-weak-types
|
|
236
236
|
, _extends({
|
|
237
237
|
ref: rootRef
|
|
238
|
-
}, rootProps), /*#__PURE__*/React.createElement(OverriddenPopover,
|
|
238
|
+
}, rootProps), /*#__PURE__*/React.createElement(OverriddenPopover // React-focus-lock used in Popover used to skip non-tabbable elements (`tabIndex=-1`) elements for focus, we had ListBox with tabIndex to disable focus on
|
|
239
|
+
// the ListBox, but we can just disable autoFocus (as ListBox / ListItem should not be focusable) (and input is also not autoFocused).
|
|
240
|
+
// Select Component does the same thing
|
|
241
|
+
, _extends({
|
|
242
|
+
autoFocus: false,
|
|
239
243
|
isOpen: isOpen,
|
|
240
244
|
overrides: popoverOverrides,
|
|
241
245
|
placement: PLACEMENT.bottomLeft,
|
package/es/popover/popover.js
CHANGED
|
@@ -451,8 +451,9 @@ class PopoverInner extends React.Component {
|
|
|
451
451
|
disabled: !this.props.focusLock,
|
|
452
452
|
noFocusGuards: false // see popover-focus-loop.scenario.js for why hover cannot return focus
|
|
453
453
|
,
|
|
454
|
-
returnFocus: this.
|
|
455
|
-
autoFocus: this.state.autoFocusAfterPositioning
|
|
454
|
+
returnFocus: !this.isHoverTrigger() && this.props.returnFocus,
|
|
455
|
+
autoFocus: this.state.autoFocusAfterPositioning,
|
|
456
|
+
focusOptions: this.props.focusOptions
|
|
456
457
|
}, !this.props.focusLock && this.state.autoFocusAfterPositioning ? /*#__PURE__*/React.createElement(MoveFocusInside, null, this.renderPopover(renderedContent)) : this.renderPopover(renderedContent)))));
|
|
457
458
|
} else {
|
|
458
459
|
rendered.push( /*#__PURE__*/React.createElement(Hidden, {
|
|
@@ -162,7 +162,8 @@ class StatefulContainer extends React.Component {
|
|
|
162
162
|
returnFocus,
|
|
163
163
|
showArrow,
|
|
164
164
|
triggerType,
|
|
165
|
-
popoverMargin
|
|
165
|
+
popoverMargin,
|
|
166
|
+
focusOptions
|
|
166
167
|
} = this.props;
|
|
167
168
|
const popoverProps = {
|
|
168
169
|
accessibilityType,
|
|
@@ -186,7 +187,8 @@ class StatefulContainer extends React.Component {
|
|
|
186
187
|
returnFocus,
|
|
187
188
|
showArrow,
|
|
188
189
|
triggerType,
|
|
189
|
-
popoverMargin
|
|
190
|
+
popoverMargin,
|
|
191
|
+
focusOptions
|
|
190
192
|
};
|
|
191
193
|
|
|
192
194
|
if (dismissOnClickOutside) {
|
package/esm/combobox/combobox.js
CHANGED
|
@@ -292,7 +292,11 @@ function Combobox(props) {
|
|
|
292
292
|
return /*#__PURE__*/React.createElement(Root // eslint-disable-next-line flowtype/no-weak-types
|
|
293
293
|
, _extends({
|
|
294
294
|
ref: rootRef
|
|
295
|
-
}, rootProps), /*#__PURE__*/React.createElement(OverriddenPopover,
|
|
295
|
+
}, rootProps), /*#__PURE__*/React.createElement(OverriddenPopover // React-focus-lock used in Popover used to skip non-tabbable elements (`tabIndex=-1`) elements for focus, we had ListBox with tabIndex to disable focus on
|
|
296
|
+
// the ListBox, but we can just disable autoFocus (as ListBox / ListItem should not be focusable) (and input is also not autoFocused).
|
|
297
|
+
// Select Component does the same thing
|
|
298
|
+
, _extends({
|
|
299
|
+
autoFocus: false,
|
|
296
300
|
isOpen: isOpen,
|
|
297
301
|
overrides: popoverOverrides,
|
|
298
302
|
placement: PLACEMENT.bottomLeft,
|
package/esm/popover/popover.js
CHANGED
|
@@ -514,8 +514,9 @@ var PopoverInner = /*#__PURE__*/function (_React$Component) {
|
|
|
514
514
|
disabled: !this.props.focusLock,
|
|
515
515
|
noFocusGuards: false // see popover-focus-loop.scenario.js for why hover cannot return focus
|
|
516
516
|
,
|
|
517
|
-
returnFocus: this.
|
|
518
|
-
autoFocus: this.state.autoFocusAfterPositioning
|
|
517
|
+
returnFocus: !this.isHoverTrigger() && this.props.returnFocus,
|
|
518
|
+
autoFocus: this.state.autoFocusAfterPositioning,
|
|
519
|
+
focusOptions: this.props.focusOptions
|
|
519
520
|
}, !this.props.focusLock && this.state.autoFocusAfterPositioning ? /*#__PURE__*/React.createElement(MoveFocusInside, null, this.renderPopover(renderedContent)) : this.renderPopover(renderedContent)))));
|
|
520
521
|
} else {
|
|
521
522
|
rendered.push( /*#__PURE__*/React.createElement(Hidden, {
|
|
@@ -206,7 +206,8 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
206
206
|
returnFocus = _this$props.returnFocus,
|
|
207
207
|
showArrow = _this$props.showArrow,
|
|
208
208
|
triggerType = _this$props.triggerType,
|
|
209
|
-
popoverMargin = _this$props.popoverMargin
|
|
209
|
+
popoverMargin = _this$props.popoverMargin,
|
|
210
|
+
focusOptions = _this$props.focusOptions;
|
|
210
211
|
var popoverProps = {
|
|
211
212
|
accessibilityType: accessibilityType,
|
|
212
213
|
autoFocus: autoFocus,
|
|
@@ -229,7 +230,8 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
229
230
|
returnFocus: returnFocus,
|
|
230
231
|
showArrow: showArrow,
|
|
231
232
|
triggerType: triggerType,
|
|
232
|
-
popoverMargin: popoverMargin
|
|
233
|
+
popoverMargin: popoverMargin,
|
|
234
|
+
focusOptions: focusOptions
|
|
233
235
|
};
|
|
234
236
|
|
|
235
237
|
if (dismissOnClickOutside) {
|
package/modal/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export interface ModalProps {
|
|
|
47
47
|
autofocus?: boolean;
|
|
48
48
|
autoFocus?: boolean;
|
|
49
49
|
focusLock?: boolean;
|
|
50
|
-
returnFocus?: boolean | FocusOptions;
|
|
50
|
+
returnFocus?: boolean | FocusOptions | ((returnTo: Element) => boolean | FocusOptions);
|
|
51
51
|
children?: React.ReactNode;
|
|
52
52
|
closeable?: boolean;
|
|
53
53
|
isOpen?: boolean;
|
package/modal/types.js.flow
CHANGED
|
@@ -48,7 +48,10 @@ export type ModalPropsT = {
|
|
|
48
48
|
* Optionally, can pass focus options instead of `true` to control the focus
|
|
49
49
|
* more precisely (ie. `{ preventScroll: true }`)
|
|
50
50
|
*/
|
|
51
|
-
returnFocus?:
|
|
51
|
+
returnFocus?:
|
|
52
|
+
| boolean
|
|
53
|
+
| FocusOptions
|
|
54
|
+
| ((returnTo: Element) => boolean | FocusOptions),
|
|
52
55
|
/** Modal content. The children-as-function API may be preferable
|
|
53
56
|
* for performance reasons (wont render until opened) */
|
|
54
57
|
children?: React.Node | (() => React.Node),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baseui",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-aed3abd",
|
|
4
4
|
"description": "A React Component library implementing the Base design language",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
"polished": "^3.2.0",
|
|
202
202
|
"popper.js": "^1.16.0",
|
|
203
203
|
"react-dropzone": "^9.0.0",
|
|
204
|
-
"react-focus-lock": "^2.
|
|
204
|
+
"react-focus-lock": "^2.7.1",
|
|
205
205
|
"react-input-mask": "^2.0.4",
|
|
206
206
|
"react-is": "^16.8.6",
|
|
207
207
|
"react-movable": "^2.5.4",
|
package/popover/index.d.ts
CHANGED
|
@@ -96,7 +96,8 @@ export interface BasePopoverProps {
|
|
|
96
96
|
accessibilityType?: ACCESSIBILITY_TYPE[keyof ACCESSIBILITY_TYPE];
|
|
97
97
|
focusLock?: boolean;
|
|
98
98
|
autoFocus?: boolean;
|
|
99
|
-
|
|
99
|
+
focusOptions?: FocusOptions;
|
|
100
|
+
returnFocus?: boolean | FocusOptions | ((returnTo: Element) => (boolean | FocusOptions));
|
|
100
101
|
'data-baseweb'?: string;
|
|
101
102
|
id?: string;
|
|
102
103
|
ignoreBoundary?: boolean;
|
package/popover/popover.js
CHANGED
|
@@ -529,8 +529,9 @@ var PopoverInner = /*#__PURE__*/function (_React$Component) {
|
|
|
529
529
|
disabled: !this.props.focusLock,
|
|
530
530
|
noFocusGuards: false // see popover-focus-loop.scenario.js for why hover cannot return focus
|
|
531
531
|
,
|
|
532
|
-
returnFocus: this.
|
|
533
|
-
autoFocus: this.state.autoFocusAfterPositioning
|
|
532
|
+
returnFocus: !this.isHoverTrigger() && this.props.returnFocus,
|
|
533
|
+
autoFocus: this.state.autoFocusAfterPositioning,
|
|
534
|
+
focusOptions: this.props.focusOptions
|
|
534
535
|
}, !this.props.focusLock && this.state.autoFocusAfterPositioning ? /*#__PURE__*/React.createElement(_reactFocusLock.MoveFocusInside, null, this.renderPopover(renderedContent)) : this.renderPopover(renderedContent)))));
|
|
535
536
|
} else {
|
|
536
537
|
rendered.push( /*#__PURE__*/React.createElement(_styledComponents.Hidden, {
|
package/popover/popover.js.flow
CHANGED
|
@@ -474,8 +474,9 @@ class PopoverInner extends React.Component<
|
|
|
474
474
|
disabled={!this.props.focusLock}
|
|
475
475
|
noFocusGuards={false}
|
|
476
476
|
// see popover-focus-loop.scenario.js for why hover cannot return focus
|
|
477
|
-
returnFocus={this.
|
|
477
|
+
returnFocus={!this.isHoverTrigger() && this.props.returnFocus}
|
|
478
478
|
autoFocus={this.state.autoFocusAfterPositioning}
|
|
479
|
+
focusOptions={this.props.focusOptions}
|
|
479
480
|
>
|
|
480
481
|
{!this.props.focusLock &&
|
|
481
482
|
this.state.autoFocusAfterPositioning ? (
|
|
@@ -212,7 +212,8 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
212
212
|
returnFocus = _this$props.returnFocus,
|
|
213
213
|
showArrow = _this$props.showArrow,
|
|
214
214
|
triggerType = _this$props.triggerType,
|
|
215
|
-
popoverMargin = _this$props.popoverMargin
|
|
215
|
+
popoverMargin = _this$props.popoverMargin,
|
|
216
|
+
focusOptions = _this$props.focusOptions;
|
|
216
217
|
var popoverProps = {
|
|
217
218
|
accessibilityType: accessibilityType,
|
|
218
219
|
autoFocus: autoFocus,
|
|
@@ -235,7 +236,8 @@ var StatefulContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
235
236
|
returnFocus: returnFocus,
|
|
236
237
|
showArrow: showArrow,
|
|
237
238
|
triggerType: triggerType,
|
|
238
|
-
popoverMargin: popoverMargin
|
|
239
|
+
popoverMargin: popoverMargin,
|
|
240
|
+
focusOptions: focusOptions
|
|
239
241
|
};
|
|
240
242
|
|
|
241
243
|
if (dismissOnClickOutside) {
|
|
@@ -171,6 +171,7 @@ class StatefulContainer extends React.Component<
|
|
|
171
171
|
showArrow,
|
|
172
172
|
triggerType,
|
|
173
173
|
popoverMargin,
|
|
174
|
+
focusOptions,
|
|
174
175
|
} = this.props;
|
|
175
176
|
|
|
176
177
|
const popoverProps: PopoverPropsWithoutChildrenT = {
|
|
@@ -196,6 +197,7 @@ class StatefulContainer extends React.Component<
|
|
|
196
197
|
showArrow,
|
|
197
198
|
triggerType,
|
|
198
199
|
popoverMargin,
|
|
200
|
+
focusOptions,
|
|
199
201
|
};
|
|
200
202
|
|
|
201
203
|
if (dismissOnClickOutside) {
|
package/popover/types.js.flow
CHANGED
|
@@ -83,6 +83,8 @@ export type BasePopoverPropsT = {
|
|
|
83
83
|
onClick?: (e: Event) => mixed,
|
|
84
84
|
/** Handler for 'Esc' keypress events */
|
|
85
85
|
onFocus?: (e: Event) => mixed,
|
|
86
|
+
/** Pass FocusOptions for focusing (used as `HtmlElement.focus(focusOptions)`) */
|
|
87
|
+
focusOptions?: FocusOptions,
|
|
86
88
|
/** Handler for mouseenter events on trigger element. */
|
|
87
89
|
onMouseEnter?: (e: Event) => mixed,
|
|
88
90
|
/** Number of milliseconds to wait before showing the popover after mouse enters the trigger element (for triggerType `hover`). */
|
|
@@ -104,7 +106,10 @@ export type BasePopoverPropsT = {
|
|
|
104
106
|
/** If true, focus will shift back to the original element that triggered the popover
|
|
105
107
|
* Be careful with elements that open the popover on focus (e.g. input) this will cause the popover to reopen on close!
|
|
106
108
|
*/
|
|
107
|
-
returnFocus?:
|
|
109
|
+
returnFocus?:
|
|
110
|
+
| boolean
|
|
111
|
+
| FocusOptions
|
|
112
|
+
| ((returnTo: Element) => boolean | FocusOptions),
|
|
108
113
|
/** Whether or not to show the arrow pointing from the popover to the trigger. */
|
|
109
114
|
showArrow?: boolean,
|
|
110
115
|
/** Whether to toggle the popover when trigger is clicked or hovered. */
|