@kaizen/components 1.79.1 → 1.79.2
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/dist/cjs/src/__next__/Select/Select.cjs +2 -1
- package/dist/cjs/src/__next__/Select/subcomponents/Overlay/Overlay.cjs +3 -3
- package/dist/cjs/src/__next__/Select/subcomponents/SelectPopoverContents/SelectPopoverContents.cjs +5 -2
- package/dist/esm/src/__next__/Select/Select.mjs +2 -1
- package/dist/esm/src/__next__/Select/subcomponents/Overlay/Overlay.mjs +3 -3
- package/dist/esm/src/__next__/Select/subcomponents/SelectPopoverContents/SelectPopoverContents.mjs +5 -2
- package/dist/types/__next__/Select/subcomponents/Overlay/Overlay.d.ts +2 -1
- package/dist/types/__next__/Select/subcomponents/SelectPopoverContents/SelectPopoverContents.d.ts +2 -1
- package/package.json +1 -1
- package/src/__next__/Select/Select.tsx +3 -1
- package/src/__next__/Select/subcomponents/Overlay/Overlay.tsx +4 -2
- package/src/__next__/Select/subcomponents/SelectPopoverContents/SelectPopoverContents.tsx +3 -1
|
@@ -132,7 +132,8 @@ var Select = function (_a) {
|
|
|
132
132
|
}, React__default.default.createElement(SelectContext.SelectProvider, {
|
|
133
133
|
state: state
|
|
134
134
|
}, React__default.default.createElement(SelectPopoverContents.SelectPopoverContents, {
|
|
135
|
-
menuProps: menuProps
|
|
135
|
+
menuProps: menuProps,
|
|
136
|
+
popoverRef: refs.floating
|
|
136
137
|
}, children)))), validationMessage && React__default.default.createElement(FieldMessage.FieldMessage, tslib.__assign({}, errorMessageProps, {
|
|
137
138
|
id: validationId,
|
|
138
139
|
message: validationMessage,
|
|
@@ -14,7 +14,8 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
14
14
|
var Overlay = function (_a) {
|
|
15
15
|
var children = _a.children,
|
|
16
16
|
classNameOverride = _a.classNameOverride,
|
|
17
|
-
|
|
17
|
+
popoverRef = _a.popoverRef,
|
|
18
|
+
restProps = tslib.__rest(_a, ["children", "classNameOverride", "popoverRef"]);
|
|
18
19
|
var state = SelectContext.useSelectContext().state;
|
|
19
20
|
// Handle events that should cause the menu to close,
|
|
20
21
|
// e.g. blur, clicking outside, or pressing the escape key.
|
|
@@ -23,13 +24,12 @@ var Overlay = function (_a) {
|
|
|
23
24
|
isDismissable: true,
|
|
24
25
|
isOpen: state.isOpen,
|
|
25
26
|
onClose: state.close
|
|
26
|
-
}, overlayRef).overlayProps;
|
|
27
|
+
}, popoverRef !== null && popoverRef !== void 0 ? popoverRef : overlayRef).overlayProps;
|
|
27
28
|
// Wrap in <FocusScope> so that focus is restored back to the trigger when the menu is closed
|
|
28
29
|
// and auto focus on the first focusable item after loading. (disable eslint no-autofocus error for it)
|
|
29
30
|
// In addition, add hidden <DismissButton> components at the start and end of the list
|
|
30
31
|
// to allow screen reader users to dismiss the popup easily.
|
|
31
32
|
return React__default.default.createElement("div", tslib.__assign({
|
|
32
|
-
ref: overlayRef,
|
|
33
33
|
className: classNameOverride
|
|
34
34
|
}, overlayProps, restProps), React__default.default.createElement(focus.FocusScope, {
|
|
35
35
|
autoFocus: false,
|
package/dist/cjs/src/__next__/Select/subcomponents/SelectPopoverContents/SelectPopoverContents.cjs
CHANGED
|
@@ -14,7 +14,8 @@ function _interopDefault(e) {
|
|
|
14
14
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
15
15
|
var SelectPopoverContents = function (_a) {
|
|
16
16
|
var children = _a.children,
|
|
17
|
-
menuProps = _a.menuProps
|
|
17
|
+
menuProps = _a.menuProps,
|
|
18
|
+
popoverRef = _a.popoverRef;
|
|
18
19
|
var state = SelectContext.useSelectContext().state;
|
|
19
20
|
// The collection structure is set by useSelectState's `children`
|
|
20
21
|
// which we have used a util to ensure the following structure
|
|
@@ -23,7 +24,9 @@ var SelectPopoverContents = function (_a) {
|
|
|
23
24
|
var itemNodes = Array.from(state.collection);
|
|
24
25
|
return React__default.default.createElement("div", {
|
|
25
26
|
className: SelectPopoverContents_module.selectPopoverContents
|
|
26
|
-
}, React__default.default.createElement(Overlay.Overlay,
|
|
27
|
+
}, React__default.default.createElement(Overlay.Overlay, {
|
|
28
|
+
popoverRef: popoverRef
|
|
29
|
+
}, React__default.default.createElement(ListBox.ListBox, {
|
|
27
30
|
menuProps: menuProps
|
|
28
31
|
}, children ? children({
|
|
29
32
|
items: itemNodes
|
|
@@ -124,7 +124,8 @@ const Select = /*#__PURE__*/function () {
|
|
|
124
124
|
}, /*#__PURE__*/React.createElement(SelectProvider, {
|
|
125
125
|
state: state
|
|
126
126
|
}, /*#__PURE__*/React.createElement(SelectPopoverContents, {
|
|
127
|
-
menuProps: menuProps
|
|
127
|
+
menuProps: menuProps,
|
|
128
|
+
popoverRef: refs.floating
|
|
128
129
|
}, children))))), validationMessage && (/*#__PURE__*/React.createElement(FieldMessage, __assign({}, errorMessageProps, {
|
|
129
130
|
id: validationId,
|
|
130
131
|
message: validationMessage,
|
|
@@ -7,7 +7,8 @@ const Overlay = /*#__PURE__*/function () {
|
|
|
7
7
|
const Overlay = function (_a) {
|
|
8
8
|
var children = _a.children,
|
|
9
9
|
classNameOverride = _a.classNameOverride,
|
|
10
|
-
|
|
10
|
+
popoverRef = _a.popoverRef,
|
|
11
|
+
restProps = __rest(_a, ["children", "classNameOverride", "popoverRef"]);
|
|
11
12
|
var state = useSelectContext().state;
|
|
12
13
|
// Handle events that should cause the menu to close,
|
|
13
14
|
// e.g. blur, clicking outside, or pressing the escape key.
|
|
@@ -16,13 +17,12 @@ const Overlay = /*#__PURE__*/function () {
|
|
|
16
17
|
isDismissable: true,
|
|
17
18
|
isOpen: state.isOpen,
|
|
18
19
|
onClose: state.close
|
|
19
|
-
}, overlayRef).overlayProps;
|
|
20
|
+
}, popoverRef !== null && popoverRef !== void 0 ? popoverRef : overlayRef).overlayProps;
|
|
20
21
|
// Wrap in <FocusScope> so that focus is restored back to the trigger when the menu is closed
|
|
21
22
|
// and auto focus on the first focusable item after loading. (disable eslint no-autofocus error for it)
|
|
22
23
|
// In addition, add hidden <DismissButton> components at the start and end of the list
|
|
23
24
|
// to allow screen reader users to dismiss the popup easily.
|
|
24
25
|
return /*#__PURE__*/React.createElement("div", __assign({
|
|
25
|
-
ref: overlayRef,
|
|
26
26
|
className: classNameOverride
|
|
27
27
|
}, overlayProps, restProps), /*#__PURE__*/React.createElement(FocusScope, {
|
|
28
28
|
autoFocus: false,
|
package/dist/esm/src/__next__/Select/subcomponents/SelectPopoverContents/SelectPopoverContents.mjs
CHANGED
|
@@ -7,7 +7,8 @@ import styles from './SelectPopoverContents.module.scss.mjs';
|
|
|
7
7
|
const SelectPopoverContents = /*#__PURE__*/function () {
|
|
8
8
|
const SelectPopoverContents = function (_a) {
|
|
9
9
|
var children = _a.children,
|
|
10
|
-
menuProps = _a.menuProps
|
|
10
|
+
menuProps = _a.menuProps,
|
|
11
|
+
popoverRef = _a.popoverRef;
|
|
11
12
|
var state = useSelectContext().state;
|
|
12
13
|
// The collection structure is set by useSelectState's `children`
|
|
13
14
|
// which we have used a util to ensure the following structure
|
|
@@ -16,7 +17,9 @@ const SelectPopoverContents = /*#__PURE__*/function () {
|
|
|
16
17
|
var itemNodes = Array.from(state.collection);
|
|
17
18
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
19
|
className: styles.selectPopoverContents
|
|
19
|
-
}, /*#__PURE__*/React.createElement(Overlay,
|
|
20
|
+
}, /*#__PURE__*/React.createElement(Overlay, {
|
|
21
|
+
popoverRef: popoverRef
|
|
22
|
+
}, /*#__PURE__*/React.createElement(ListBox, {
|
|
20
23
|
menuProps: menuProps
|
|
21
24
|
}, children ? children({
|
|
22
25
|
items: itemNodes
|
|
@@ -3,8 +3,9 @@ import { type OverrideClassName } from "../../../../types/OverrideClassName";
|
|
|
3
3
|
import { type SelectOption } from '../../types';
|
|
4
4
|
export type OverlayProps = OverrideClassName<HTMLAttributes<HTMLDivElement>> & {
|
|
5
5
|
children: React.ReactNode;
|
|
6
|
+
popoverRef?: React.RefObject<Element | null>;
|
|
6
7
|
};
|
|
7
8
|
export declare const Overlay: {
|
|
8
|
-
<Option extends SelectOption>({ children, classNameOverride, ...restProps }: OverlayProps): JSX.Element;
|
|
9
|
+
<Option extends SelectOption>({ children, classNameOverride, popoverRef, ...restProps }: OverlayProps): JSX.Element;
|
|
9
10
|
displayName: string;
|
|
10
11
|
};
|
package/dist/types/__next__/Select/subcomponents/SelectPopoverContents/SelectPopoverContents.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ export type SelectPopoverContentsProps<Option extends SelectOption> = {
|
|
|
6
6
|
items: SelectItemNode<Option>[];
|
|
7
7
|
}) => React.ReactNode;
|
|
8
8
|
menuProps: AriaListBoxOptions<SelectItem<Option>>;
|
|
9
|
+
popoverRef?: React.RefObject<Element | null>;
|
|
9
10
|
};
|
|
10
11
|
export declare const SelectPopoverContents: {
|
|
11
|
-
<Option extends SelectOption>({ children, menuProps, }: SelectPopoverContentsProps<Option>): JSX.Element;
|
|
12
|
+
<Option extends SelectOption>({ children, menuProps, popoverRef, }: SelectPopoverContentsProps<Option>): JSX.Element;
|
|
12
13
|
displayName: string;
|
|
13
14
|
};
|
package/package.json
CHANGED
|
@@ -183,7 +183,9 @@ export const Select = <Option extends SelectOption = SelectOption>({
|
|
|
183
183
|
{state.isOpen && (
|
|
184
184
|
<Popover id={popoverId} portalContainer={portalContainer} refs={refs}>
|
|
185
185
|
<SelectProvider<Option> state={state}>
|
|
186
|
-
<SelectPopoverContents menuProps={menuProps}
|
|
186
|
+
<SelectPopoverContents menuProps={menuProps} popoverRef={refs.floating}>
|
|
187
|
+
{children}
|
|
188
|
+
</SelectPopoverContents>
|
|
187
189
|
</SelectProvider>
|
|
188
190
|
</Popover>
|
|
189
191
|
)}
|
|
@@ -7,11 +7,13 @@ import { type SelectOption } from '../../types'
|
|
|
7
7
|
|
|
8
8
|
export type OverlayProps = OverrideClassName<HTMLAttributes<HTMLDivElement>> & {
|
|
9
9
|
children: React.ReactNode
|
|
10
|
+
popoverRef?: React.RefObject<Element | null>
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const Overlay = <Option extends SelectOption>({
|
|
13
14
|
children,
|
|
14
15
|
classNameOverride,
|
|
16
|
+
popoverRef,
|
|
15
17
|
...restProps
|
|
16
18
|
}: OverlayProps): JSX.Element => {
|
|
17
19
|
const { state } = useSelectContext<Option>()
|
|
@@ -21,7 +23,7 @@ export const Overlay = <Option extends SelectOption>({
|
|
|
21
23
|
const overlayRef = React.useRef<HTMLDivElement>(null)
|
|
22
24
|
const { overlayProps } = useOverlay(
|
|
23
25
|
{ isDismissable: true, isOpen: state.isOpen, onClose: state.close },
|
|
24
|
-
overlayRef,
|
|
26
|
+
popoverRef ?? overlayRef,
|
|
25
27
|
)
|
|
26
28
|
|
|
27
29
|
// Wrap in <FocusScope> so that focus is restored back to the trigger when the menu is closed
|
|
@@ -29,7 +31,7 @@ export const Overlay = <Option extends SelectOption>({
|
|
|
29
31
|
// In addition, add hidden <DismissButton> components at the start and end of the list
|
|
30
32
|
// to allow screen reader users to dismiss the popup easily.
|
|
31
33
|
return (
|
|
32
|
-
<div
|
|
34
|
+
<div className={classNameOverride} {...overlayProps} {...restProps}>
|
|
33
35
|
{/* eslint-disable-next-line jsx-a11y/no-autofocus */}
|
|
34
36
|
<FocusScope autoFocus={false} restoreFocus>
|
|
35
37
|
<DismissButton onDismiss={state.close} />
|
|
@@ -10,11 +10,13 @@ import styles from './SelectPopoverContents.module.scss'
|
|
|
10
10
|
export type SelectPopoverContentsProps<Option extends SelectOption> = {
|
|
11
11
|
children?: (args: { items: SelectItemNode<Option>[] }) => React.ReactNode
|
|
12
12
|
menuProps: AriaListBoxOptions<SelectItem<Option>>
|
|
13
|
+
popoverRef?: React.RefObject<Element | null>
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export const SelectPopoverContents = <Option extends SelectOption>({
|
|
16
17
|
children,
|
|
17
18
|
menuProps,
|
|
19
|
+
popoverRef,
|
|
18
20
|
}: SelectPopoverContentsProps<Option>): JSX.Element => {
|
|
19
21
|
const { state } = useSelectContext<Option>()
|
|
20
22
|
|
|
@@ -26,7 +28,7 @@ export const SelectPopoverContents = <Option extends SelectOption>({
|
|
|
26
28
|
|
|
27
29
|
return (
|
|
28
30
|
<div className={styles.selectPopoverContents}>
|
|
29
|
-
<Overlay<Option
|
|
31
|
+
<Overlay<Option> popoverRef={popoverRef}>
|
|
30
32
|
<ListBox<Option> menuProps={menuProps}>
|
|
31
33
|
{children ? children({ items: itemNodes }) : <ListItems<Option> items={itemNodes} />}
|
|
32
34
|
</ListBox>
|