@primer/react 0.0.0-20260701235500 → 0.0.0-20260702153842
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 +7 -1
- package/dist/ActionList/Heading.js +25 -35
- package/dist/ActionList/List.js +46 -45
- package/dist/AnchoredOverlay/AnchoredOverlay.js +2 -4
- package/dist/Autocomplete/Autocomplete.js +131 -74
- package/dist/Autocomplete/AutocompleteInput.js +7 -10
- package/dist/Autocomplete/AutocompleteMenu.js +277 -119
- package/dist/Autocomplete/AutocompleteOverlay.js +113 -38
- package/dist/Banner/Banner.js +414 -96
- package/dist/Button/Button.js +29 -8
- package/dist/Button/IconButton.js +120 -28
- package/dist/Button/LinkButton.js +34 -8
- package/dist/ButtonGroup/ButtonGroup.js +23 -23
- package/dist/Checkbox/Checkbox.js +4 -5
- package/dist/ConfirmationDialog/ConfirmationDialog.js +86 -24
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/FilteredActionList/FilteredActionList.js +5 -7
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/PageHeader/PageHeader.js +31 -30
- package/dist/PageLayout/PageLayout.js +1274 -478
- package/dist/Pagination/Pagination.js +196 -70
- package/dist/SelectPanel/SelectPanelMessage.js +72 -29
- package/dist/TextInput/TextInput.js +4 -5
- package/dist/TooltipV2/Tooltip.js +5 -15
- package/dist/UnderlineNav/UnderlineNav-964b246d.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-964b246d.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.js +198 -64
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +110 -22
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +15 -16
- package/dist/hooks/useMergedRefs.js +20 -14
- package/dist/hooks/useOpenAndCloseFocus.js +1 -7
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.js +10 -7
- package/dist/hooks/useScrollFlash.js +24 -10
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/package.json +1 -1
- package/dist/UnderlineNav/UnderlineNav-47547980.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-47547980.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260702153842
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- [#8057](https://github.com/primer/react/pull/8057) [`0b9c81e`](https://github.com/primer/react/commit/0b9c81e7e8fef1dfc98f3b86b5a375d4ec7fe204) Thanks [@francinelucca](https://github.com/francinelucca)! - ThemeProvider: Remove `primer_react_theme_provider_remove_ssr_handoff` feature flag.
|
|
8
8
|
|
|
9
|
+
- [#8105](https://github.com/primer/react/pull/8105) [`be2950f`](https://github.com/primer/react/commit/be2950fd1ac268dd4e79258ab2cfe9241dd9e1c6) Thanks [@joshblack](https://github.com/joshblack)! - React Compiler: Enable compiler output for Banner, ConfirmationDialog, PageLayout, Pagination, UnderlineNav, `useMergedRefs`, and `useScrollFlash`
|
|
10
|
+
|
|
9
11
|
### Patch Changes
|
|
10
12
|
|
|
13
|
+
- [#8066](https://github.com/primer/react/pull/8066) [`dd66aa2`](https://github.com/primer/react/commit/dd66aa27611f7ad56adb7429b50813d6af5a01d7) Thanks [@janmaarten-a11y](https://github.com/janmaarten-a11y)! - Fix invalid HTML nesting in `ActionList.Heading` by applying the visually-hidden styles directly to the heading element instead of wrapping it in a `span`.
|
|
14
|
+
|
|
11
15
|
- Fake entry to force publishing
|
|
12
16
|
|
|
17
|
+
- [#8108](https://github.com/primer/react/pull/8108) [`302d679`](https://github.com/primer/react/commit/302d679f2a95c4254b8f6f1e625ac2a2bbf0bc70) Thanks [@iansan5653](https://github.com/iansan5653)! - `UnderlineNav`: Fix icon flickering on some screen sizes before initial render/hydration
|
|
18
|
+
|
|
13
19
|
- [#8054](https://github.com/primer/react/pull/8054) [`1775f2e`](https://github.com/primer/react/commit/1775f2e8b968d59a1189456b14cff15e527937cb) Thanks [@joshblack](https://github.com/joshblack)! - AvatarStack: Improve rendering performance with React Compiler support
|
|
14
20
|
|
|
15
21
|
- [#8053](https://github.com/primer/react/pull/8053) [`b2151ae`](https://github.com/primer/react/commit/b2151ae2d5719f09efb0b89731e52e4ca50e8bf1) Thanks [@joshblack](https://github.com/joshblack)! - Checkbox, CheckboxGroup, and RadioGroup: Improve rendering performance with React Compiler support
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
2
|
import { invariant } from "../utils/invariant.js";
|
|
3
|
-
import
|
|
3
|
+
import _VisuallyHidden_module_css_default from "../_VisuallyHidden.module.css.js";
|
|
4
4
|
import { ActionListContainerContext } from "./ActionListContainerContext.js";
|
|
5
5
|
import Heading$1 from "../Heading/Heading.js";
|
|
6
6
|
import { ListContext } from "./shared.js";
|
|
@@ -12,7 +12,7 @@ import React, { forwardRef } from "react";
|
|
|
12
12
|
//#region src/ActionList/Heading.tsx
|
|
13
13
|
const Heading = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
14
14
|
var _props$id;
|
|
15
|
-
const $ = c(
|
|
15
|
+
const $ = c(19);
|
|
16
16
|
let as;
|
|
17
17
|
let children;
|
|
18
18
|
let className;
|
|
@@ -41,48 +41,38 @@ const Heading = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
|
41
41
|
const { headingId, variant: listVariant } = React.useContext(ListContext);
|
|
42
42
|
const { container } = React.useContext(ActionListContainerContext);
|
|
43
43
|
!(container !== "ActionMenu") && invariant(false, "ActionList.Heading shouldn't be used within an ActionMenu container. Menus are labelled by the menu button's name.");
|
|
44
|
-
const t2 =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
t4 = clsx(className, Heading_module_css_default.ActionListHeader);
|
|
44
|
+
const t2 = (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : headingId;
|
|
45
|
+
let t3;
|
|
46
|
+
if ($[7] !== className || $[8] !== visuallyHidden) {
|
|
47
|
+
t3 = clsx(className, Heading_module_css_default.ActionListHeader, { [_VisuallyHidden_module_css_default.InternalVisuallyHidden]: visuallyHidden });
|
|
49
48
|
$[7] = className;
|
|
50
|
-
$[8] =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
$[8] = visuallyHidden;
|
|
50
|
+
$[9] = t3;
|
|
51
|
+
} else t3 = $[9];
|
|
52
|
+
let t4;
|
|
53
|
+
if ($[10] !== as || $[11] !== children || $[12] !== listVariant || $[13] !== mergedRef || $[14] !== props || $[15] !== size || $[16] !== t2 || $[17] !== t3) {
|
|
54
|
+
t4 = /*#__PURE__*/ jsx(Heading$1, {
|
|
55
55
|
as,
|
|
56
56
|
variant: size,
|
|
57
57
|
ref: mergedRef,
|
|
58
|
-
id:
|
|
59
|
-
className:
|
|
58
|
+
id: t2,
|
|
59
|
+
className: t3,
|
|
60
60
|
"data-component": "ActionList.Heading",
|
|
61
61
|
"data-list-variant": listVariant,
|
|
62
62
|
...props,
|
|
63
63
|
children
|
|
64
64
|
});
|
|
65
|
-
$[
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
} else
|
|
75
|
-
|
|
76
|
-
if ($[18] !== t2 || $[19] !== t5) {
|
|
77
|
-
t6 = /*#__PURE__*/ jsx(VisuallyHidden, {
|
|
78
|
-
isVisible: t2,
|
|
79
|
-
children: t5
|
|
80
|
-
});
|
|
81
|
-
$[18] = t2;
|
|
82
|
-
$[19] = t5;
|
|
83
|
-
$[20] = t6;
|
|
84
|
-
} else t6 = $[20];
|
|
85
|
-
return t6;
|
|
65
|
+
$[10] = as;
|
|
66
|
+
$[11] = children;
|
|
67
|
+
$[12] = listVariant;
|
|
68
|
+
$[13] = mergedRef;
|
|
69
|
+
$[14] = props;
|
|
70
|
+
$[15] = size;
|
|
71
|
+
$[16] = t2;
|
|
72
|
+
$[17] = t3;
|
|
73
|
+
$[18] = t4;
|
|
74
|
+
} else t4 = $[18];
|
|
75
|
+
return t4;
|
|
86
76
|
});
|
|
87
77
|
Heading.displayName = "ActionList.Heading";
|
|
88
78
|
Heading.__SLOT__ = Symbol("ActionList.Heading");
|
package/dist/ActionList/List.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
3
3
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
4
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
@@ -12,11 +12,11 @@ import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
|
12
12
|
import { c } from "react-compiler-runtime";
|
|
13
13
|
import { clsx } from "clsx";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import React
|
|
15
|
+
import React from "react";
|
|
16
16
|
//#region src/ActionList/List.tsx
|
|
17
17
|
const UnwrappedList = (props, forwardedRef) => {
|
|
18
18
|
var _slots$heading$props$;
|
|
19
|
-
const $ = c(
|
|
19
|
+
const $ = c(40);
|
|
20
20
|
let className;
|
|
21
21
|
let restProps;
|
|
22
22
|
let role;
|
|
@@ -60,8 +60,7 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
60
60
|
const { listRole: listRoleFromContainer, listLabelledBy, selectionVariant: containerSelectionVariant, enableFocusZone: enableFocusZoneFromContainer, container } = React.useContext(ActionListContainerContext);
|
|
61
61
|
const ariaLabelledBy = slots.heading ? (_slots$heading$props$ = slots.heading.props.id) !== null && _slots$heading$props$ !== void 0 ? _slots$heading$props$ : headingId : listLabelledBy;
|
|
62
62
|
const listRole = role || listRoleFromContainer;
|
|
63
|
-
const listRef =
|
|
64
|
-
const mergedRef = useMergedRefs(forwardedRef, listRef);
|
|
63
|
+
const listRef = useProvidedRefOrCreate(forwardedRef);
|
|
65
64
|
const itemGapEnabled = useFeatureFlag("primer_react_action_list_item_gap") && container === "NavList";
|
|
66
65
|
let enableFocusZone = false;
|
|
67
66
|
if (enableFocusZoneFromContainer !== void 0) enableFocusZone = enableFocusZoneFromContainer;
|
|
@@ -80,21 +79,22 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
80
79
|
const t5 = !enableFocusZone;
|
|
81
80
|
const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : void 0;
|
|
82
81
|
let t7;
|
|
83
|
-
if ($[11] !==
|
|
82
|
+
if ($[11] !== listRef || $[12] !== t5 || $[13] !== t6) {
|
|
84
83
|
t7 = {
|
|
85
84
|
disabled: t5,
|
|
86
85
|
containerRef: listRef,
|
|
87
86
|
bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
|
|
88
87
|
focusOutBehavior: t6
|
|
89
88
|
};
|
|
90
|
-
$[11] =
|
|
91
|
-
$[12] =
|
|
92
|
-
$[13] =
|
|
93
|
-
|
|
89
|
+
$[11] = listRef;
|
|
90
|
+
$[12] = t5;
|
|
91
|
+
$[13] = t6;
|
|
92
|
+
$[14] = t7;
|
|
93
|
+
} else t7 = $[14];
|
|
94
94
|
useFocusZone(t7);
|
|
95
95
|
const t8 = selectionVariant || containerSelectionVariant;
|
|
96
96
|
let t9;
|
|
97
|
-
if ($[
|
|
97
|
+
if ($[15] !== headingId || $[16] !== listRole || $[17] !== showDividers || $[18] !== t8 || $[19] !== variant) {
|
|
98
98
|
t9 = {
|
|
99
99
|
variant,
|
|
100
100
|
selectionVariant: t8,
|
|
@@ -102,16 +102,16 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
102
102
|
role: listRole,
|
|
103
103
|
headingId
|
|
104
104
|
};
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
} else t9 = $[
|
|
105
|
+
$[15] = headingId;
|
|
106
|
+
$[16] = listRole;
|
|
107
|
+
$[17] = showDividers;
|
|
108
|
+
$[18] = t8;
|
|
109
|
+
$[19] = variant;
|
|
110
|
+
$[20] = t9;
|
|
111
|
+
} else t9 = $[20];
|
|
112
112
|
const listContextValue = t9;
|
|
113
113
|
let t10;
|
|
114
|
-
if ($[
|
|
114
|
+
if ($[21] !== listRef) {
|
|
115
115
|
t10 = () => {
|
|
116
116
|
const list = listRef.current;
|
|
117
117
|
if (!list) return;
|
|
@@ -120,24 +120,25 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
120
120
|
if (hasMixed && current !== "true") list.setAttribute("data-mixed-descriptions", "true");
|
|
121
121
|
else if (!hasMixed && current !== null) list.removeAttribute("data-mixed-descriptions");
|
|
122
122
|
};
|
|
123
|
-
$[
|
|
124
|
-
|
|
123
|
+
$[21] = listRef;
|
|
124
|
+
$[22] = t10;
|
|
125
|
+
} else t10 = $[22];
|
|
125
126
|
useIsomorphicLayoutEffect(t10);
|
|
126
127
|
const t11 = slots.heading;
|
|
127
128
|
let t12;
|
|
128
|
-
if ($[
|
|
129
|
+
if ($[23] !== className) {
|
|
129
130
|
t12 = clsx(ActionList_module_css_default.ActionList, className);
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
} else t12 = $[
|
|
131
|
+
$[23] = className;
|
|
132
|
+
$[24] = t12;
|
|
133
|
+
} else t12 = $[24];
|
|
133
134
|
const t13 = itemGapEnabled ? "" : void 0;
|
|
134
135
|
let t14;
|
|
135
|
-
if ($[
|
|
136
|
+
if ($[25] !== Component || $[26] !== ariaLabelledBy || $[27] !== childrenWithoutSlots || $[28] !== listRef || $[29] !== listRole || $[30] !== restProps || $[31] !== showDividers || $[32] !== t12 || $[33] !== t13 || $[34] !== variant) {
|
|
136
137
|
t14 = /*#__PURE__*/ jsx(Component, {
|
|
137
138
|
className: t12,
|
|
138
139
|
role: listRole,
|
|
139
140
|
"aria-labelledby": ariaLabelledBy,
|
|
140
|
-
ref:
|
|
141
|
+
ref: listRef,
|
|
141
142
|
"data-component": "ActionList",
|
|
142
143
|
"data-dividers": showDividers,
|
|
143
144
|
"data-variant": variant,
|
|
@@ -145,29 +146,29 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
145
146
|
...restProps,
|
|
146
147
|
children: childrenWithoutSlots
|
|
147
148
|
});
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
} else t14 = $[
|
|
149
|
+
$[25] = Component;
|
|
150
|
+
$[26] = ariaLabelledBy;
|
|
151
|
+
$[27] = childrenWithoutSlots;
|
|
152
|
+
$[28] = listRef;
|
|
153
|
+
$[29] = listRole;
|
|
154
|
+
$[30] = restProps;
|
|
155
|
+
$[31] = showDividers;
|
|
156
|
+
$[32] = t12;
|
|
157
|
+
$[33] = t13;
|
|
158
|
+
$[34] = variant;
|
|
159
|
+
$[35] = t14;
|
|
160
|
+
} else t14 = $[35];
|
|
160
161
|
let t15;
|
|
161
|
-
if ($[
|
|
162
|
+
if ($[36] !== listContextValue || $[37] !== slots.heading || $[38] !== t14) {
|
|
162
163
|
t15 = /*#__PURE__*/ jsxs(ListContext.Provider, {
|
|
163
164
|
value: listContextValue,
|
|
164
165
|
children: [t11, t14]
|
|
165
166
|
});
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
} else t15 = $[
|
|
167
|
+
$[36] = listContextValue;
|
|
168
|
+
$[37] = slots.heading;
|
|
169
|
+
$[38] = t14;
|
|
170
|
+
$[39] = t15;
|
|
171
|
+
} else t15 = $[39];
|
|
171
172
|
return t15;
|
|
172
173
|
};
|
|
173
174
|
const List = fixedForwardRef(UnwrappedList);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { reactMajorVersion } from "../utils/environment.js";
|
|
2
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
3
2
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
4
3
|
import { useAnchoredPosition } from "../hooks/useAnchoredPosition.js";
|
|
5
4
|
import { useRenderForcingRef } from "../hooks/useRenderForcingRef.js";
|
|
@@ -34,7 +33,6 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
34
33
|
const [anchorElement, setAnchorElement] = useState(null);
|
|
35
34
|
if (anchorRef.current !== anchorElement) setAnchorElement(anchorRef.current);
|
|
36
35
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
37
|
-
const mergedOverlayRef = useMergedRefs(updateOverlayRef, overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.ref);
|
|
38
36
|
const [overlayElement, setOverlayElement] = useState(null);
|
|
39
37
|
const anchorId = useId$1(externalAnchorId);
|
|
40
38
|
const onClickOutside = useCallback(() => onClose === null || onClose === void 0 ? void 0 : onClose("click-outside"), [onClose]);
|
|
@@ -191,10 +189,10 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
191
189
|
...shouldRenderAsPopover ? { popover: "manual" } : {},
|
|
192
190
|
...restOverlayProps,
|
|
193
191
|
...shouldRenderAsPopover ? { id: popoverId } : {},
|
|
194
|
-
...cssAnchorPositioning ? { id: popoverId } : {},
|
|
195
192
|
ref: (node) => {
|
|
193
|
+
if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) assignRef(overlayProps.ref, node);
|
|
194
|
+
updateOverlayRef(node);
|
|
196
195
|
setOverlayElement(node);
|
|
197
|
-
assignRef(mergedOverlayRef, node);
|
|
198
196
|
},
|
|
199
197
|
"data-anchor-position": cssAnchorPositioning,
|
|
200
198
|
"data-side": cssAnchorPositioning ? side : position === null || position === void 0 ? void 0 : position.anchorSide,
|
|
@@ -3,8 +3,9 @@ import { AutocompleteContext, AutocompleteDeferredInputContext, AutocompleteInpu
|
|
|
3
3
|
import AutocompleteInput from "./AutocompleteInput.js";
|
|
4
4
|
import AutocompleteMenu from "./AutocompleteMenu.js";
|
|
5
5
|
import AutocompleteOverlay from "./AutocompleteOverlay.js";
|
|
6
|
+
import { c } from "react-compiler-runtime";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
+
import { useDeferredValue, useReducer, useRef } from "react";
|
|
8
9
|
//#region src/Autocomplete/Autocomplete.tsx
|
|
9
10
|
const initialState = {
|
|
10
11
|
inputValue: "",
|
|
@@ -39,88 +40,144 @@ const reducer = (state, action) => {
|
|
|
39
40
|
default: return state;
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
|
-
const Autocomplete = (
|
|
43
|
+
const Autocomplete = (t0) => {
|
|
44
|
+
const $ = c(24);
|
|
45
|
+
const { children, id: idProp } = t0;
|
|
43
46
|
const activeDescendantRef = useRef(null);
|
|
44
47
|
const scrollContainerRef = useRef(null);
|
|
45
48
|
const inputRef = useRef(null);
|
|
46
49
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
47
50
|
const { inputValue, showMenu, autocompleteSuggestion, isMenuDirectlyActivated, selectedItemLength } = state;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
51
|
+
let t1;
|
|
52
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
53
|
+
t1 = (value) => {
|
|
54
|
+
dispatch({
|
|
55
|
+
type: "inputValue",
|
|
56
|
+
payload: value
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
$[0] = t1;
|
|
60
|
+
} else t1 = $[0];
|
|
61
|
+
const setInputValue = t1;
|
|
62
|
+
let t2;
|
|
63
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
|
+
t2 = (value_0) => {
|
|
65
|
+
dispatch({
|
|
66
|
+
type: "showMenu",
|
|
67
|
+
payload: value_0
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
$[1] = t2;
|
|
71
|
+
} else t2 = $[1];
|
|
72
|
+
const setShowMenu = t2;
|
|
73
|
+
let t3;
|
|
74
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
75
|
+
t3 = (value_1) => {
|
|
76
|
+
dispatch({
|
|
77
|
+
type: "autocompleteSuggestion",
|
|
78
|
+
payload: value_1
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
$[2] = t3;
|
|
82
|
+
} else t3 = $[2];
|
|
83
|
+
const setAutocompleteSuggestion = t3;
|
|
84
|
+
let t4;
|
|
85
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
86
|
+
t4 = (value_2) => {
|
|
87
|
+
dispatch({
|
|
88
|
+
type: "isMenuDirectlyActivated",
|
|
89
|
+
payload: value_2
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
$[3] = t4;
|
|
93
|
+
} else t4 = $[3];
|
|
94
|
+
const setIsMenuDirectlyActivated = t4;
|
|
95
|
+
let t5;
|
|
96
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
97
|
+
t5 = (value_3) => {
|
|
98
|
+
dispatch({
|
|
99
|
+
type: "selectedItemLength",
|
|
100
|
+
payload: value_3
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
$[4] = t5;
|
|
104
|
+
} else t5 = $[4];
|
|
105
|
+
const setSelectedItemLength = t5;
|
|
78
106
|
const id = useId$1(idProp);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
let t6;
|
|
108
|
+
if ($[5] !== id || $[6] !== selectedItemLength || $[7] !== showMenu) {
|
|
109
|
+
t6 = {
|
|
110
|
+
activeDescendantRef,
|
|
111
|
+
id,
|
|
112
|
+
inputRef,
|
|
113
|
+
scrollContainerRef,
|
|
114
|
+
selectedItemLength,
|
|
115
|
+
setAutocompleteSuggestion,
|
|
116
|
+
setInputValue,
|
|
117
|
+
setIsMenuDirectlyActivated,
|
|
118
|
+
setShowMenu,
|
|
119
|
+
setSelectedItemLength,
|
|
120
|
+
showMenu
|
|
121
|
+
};
|
|
122
|
+
$[5] = id;
|
|
123
|
+
$[6] = selectedItemLength;
|
|
124
|
+
$[7] = showMenu;
|
|
125
|
+
$[8] = t6;
|
|
126
|
+
} else t6 = $[8];
|
|
127
|
+
const autocompleteContextValue = t6;
|
|
128
|
+
let t7;
|
|
129
|
+
if ($[9] !== autocompleteSuggestion || $[10] !== inputValue || $[11] !== isMenuDirectlyActivated) {
|
|
130
|
+
t7 = {
|
|
131
|
+
autocompleteSuggestion,
|
|
132
|
+
inputValue,
|
|
133
|
+
isMenuDirectlyActivated
|
|
134
|
+
};
|
|
135
|
+
$[9] = autocompleteSuggestion;
|
|
136
|
+
$[10] = inputValue;
|
|
137
|
+
$[11] = isMenuDirectlyActivated;
|
|
138
|
+
$[12] = t7;
|
|
139
|
+
} else t7 = $[12];
|
|
140
|
+
const autocompleteInputContextValue = t7;
|
|
110
141
|
const deferredInputValue = useDeferredValue(inputValue);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
142
|
+
let t8;
|
|
143
|
+
if ($[13] !== deferredInputValue) {
|
|
144
|
+
t8 = { deferredInputValue };
|
|
145
|
+
$[13] = deferredInputValue;
|
|
146
|
+
$[14] = t8;
|
|
147
|
+
} else t8 = $[14];
|
|
148
|
+
const autocompleteDeferredInputContextValue = t8;
|
|
149
|
+
let t9;
|
|
150
|
+
if ($[15] !== autocompleteDeferredInputContextValue || $[16] !== children) {
|
|
151
|
+
t9 = /*#__PURE__*/ jsx(AutocompleteDeferredInputContext.Provider, {
|
|
152
|
+
value: autocompleteDeferredInputContextValue,
|
|
153
|
+
children
|
|
154
|
+
});
|
|
155
|
+
$[15] = autocompleteDeferredInputContextValue;
|
|
156
|
+
$[16] = children;
|
|
157
|
+
$[17] = t9;
|
|
158
|
+
} else t9 = $[17];
|
|
159
|
+
let t10;
|
|
160
|
+
if ($[18] !== autocompleteInputContextValue || $[19] !== t9) {
|
|
161
|
+
t10 = /*#__PURE__*/ jsx(AutocompleteInputContext.Provider, {
|
|
115
162
|
value: autocompleteInputContextValue,
|
|
116
|
-
children:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
163
|
+
children: t9
|
|
164
|
+
});
|
|
165
|
+
$[18] = autocompleteInputContextValue;
|
|
166
|
+
$[19] = t9;
|
|
167
|
+
$[20] = t10;
|
|
168
|
+
} else t10 = $[20];
|
|
169
|
+
let t11;
|
|
170
|
+
if ($[21] !== autocompleteContextValue || $[22] !== t10) {
|
|
171
|
+
t11 = /*#__PURE__*/ jsx(AutocompleteContext.Provider, {
|
|
172
|
+
value: autocompleteContextValue,
|
|
173
|
+
children: t10
|
|
174
|
+
});
|
|
175
|
+
$[21] = autocompleteContextValue;
|
|
176
|
+
$[22] = t10;
|
|
177
|
+
$[23] = t11;
|
|
178
|
+
} else t11 = $[23];
|
|
179
|
+
return t11;
|
|
122
180
|
};
|
|
123
|
-
Autocomplete.displayName = "Autocomplete";
|
|
124
181
|
var Autocomplete_default = Object.assign(Autocomplete, {
|
|
125
182
|
__SLOT__: Symbol("Autocomplete"),
|
|
126
183
|
Context: AutocompleteContext,
|
|
@@ -20,11 +20,9 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
20
20
|
if (openOnFocus) setShowMenu(true);
|
|
21
21
|
};
|
|
22
22
|
const handleInputBlur = useCallback((event) => {
|
|
23
|
-
onBlur
|
|
23
|
+
onBlur && onBlur(event);
|
|
24
24
|
safeSetTimeout(() => {
|
|
25
|
-
|
|
26
|
-
const menuElement = document.getElementById(`${id}-listbox`);
|
|
27
|
-
if (!nextFocusedElement || nextFocusedElement !== menuElement && !(menuElement !== null && menuElement !== void 0 && menuElement.contains(nextFocusedElement))) {
|
|
25
|
+
if (document.activeElement !== inputRef.current) {
|
|
28
26
|
setShowMenu(false);
|
|
29
27
|
if (inputRef.current && autocompleteSuggestion && inputRef.current.value !== inputValue) inputRef.current.value = inputValue;
|
|
30
28
|
}
|
|
@@ -35,17 +33,16 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
35
33
|
inputRef,
|
|
36
34
|
safeSetTimeout,
|
|
37
35
|
autocompleteSuggestion,
|
|
38
|
-
inputValue
|
|
39
|
-
id
|
|
36
|
+
inputValue
|
|
40
37
|
]);
|
|
41
38
|
const handleInputChange = (event) => {
|
|
42
|
-
onChange
|
|
39
|
+
onChange && onChange(event);
|
|
43
40
|
setInputValue(event.currentTarget.value);
|
|
44
41
|
if (!showMenu) setShowMenu(true);
|
|
45
42
|
};
|
|
46
43
|
const handleInputKeyDown = useCallback((event) => {
|
|
47
44
|
var _inputRef$current;
|
|
48
|
-
onKeyDown
|
|
45
|
+
onKeyDown && onKeyDown(event);
|
|
49
46
|
if (event.key === "Backspace") setHighlightRemainingText(false);
|
|
50
47
|
if (event.key === "Escape" && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value) {
|
|
51
48
|
setInputValue("");
|
|
@@ -61,11 +58,11 @@ const AutocompleteInput = /*#__PURE__*/ React.forwardRef(({ as: Component = Text
|
|
|
61
58
|
setShowMenu
|
|
62
59
|
]);
|
|
63
60
|
const handleInputKeyUp = useCallback((event) => {
|
|
64
|
-
onKeyUp
|
|
61
|
+
onKeyUp && onKeyUp(event);
|
|
65
62
|
if (event.key === "Backspace") setHighlightRemainingText(true);
|
|
66
63
|
}, [setHighlightRemainingText, onKeyUp]);
|
|
67
64
|
const onInputKeyPress = useCallback((event) => {
|
|
68
|
-
onKeyPress
|
|
65
|
+
onKeyPress && onKeyPress(event);
|
|
69
66
|
if (showMenu && event.key === "Enter" && activeDescendantRef.current) {
|
|
70
67
|
event.preventDefault();
|
|
71
68
|
event.nativeEvent.stopImmediatePropagation();
|