@primer/react 0.0.0-20260226223231 → 0.0.0-20260227020135

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.
Files changed (96) hide show
  1. package/CHANGELOG.md +53 -3
  2. package/dist/ActionList/ActionList-c04a02d6.css +2 -0
  3. package/dist/ActionList/ActionList-c04a02d6.css.map +1 -0
  4. package/dist/ActionList/ActionList.module.css.js +1 -1
  5. package/dist/ActionList/Description.js +113 -35
  6. package/dist/ActionList/Divider.js +30 -11
  7. package/dist/ActionList/Group.js +294 -117
  8. package/dist/ActionList/Heading.js +77 -22
  9. package/dist/ActionList/Item.d.ts.map +1 -1
  10. package/dist/ActionList/Item.js +99 -37
  11. package/dist/ActionList/LinkItem.js +80 -24
  12. package/dist/ActionList/List.js +143 -33
  13. package/dist/ActionList/Selection.js +78 -30
  14. package/dist/ActionList/TrailingAction.js +83 -23
  15. package/dist/ActionList/Visuals.js +162 -64
  16. package/dist/AnchoredOverlay/AnchoredOverlay-6ec278c5.css +2 -0
  17. package/dist/AnchoredOverlay/AnchoredOverlay-6ec278c5.css.map +1 -0
  18. package/dist/AnchoredOverlay/AnchoredOverlay.js +4 -2
  19. package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +2 -2
  20. package/dist/Autocomplete/Autocomplete.js +76 -159
  21. package/dist/Autocomplete/AutocompleteMenu.js +128 -333
  22. package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
  23. package/dist/Banner/Banner.d.ts.map +1 -1
  24. package/dist/Banner/Banner.js +112 -276
  25. package/dist/Blankslate/{Blankslate-f5a9755a.css → Blankslate-a039d79a.css} +2 -2
  26. package/dist/Blankslate/Blankslate-a039d79a.css.map +1 -0
  27. package/dist/Blankslate/Blankslate.module.css.js +1 -1
  28. package/dist/Button/ButtonBase.d.ts.map +1 -1
  29. package/dist/Button/ButtonBase.js +9 -14
  30. package/dist/Checkbox/Checkbox.js +55 -163
  31. package/dist/Dialog/Dialog.js +105 -347
  32. package/dist/FilteredActionList/FilteredActionList-02db90c6.css +2 -0
  33. package/dist/FilteredActionList/FilteredActionList-02db90c6.css.map +1 -0
  34. package/dist/FilteredActionList/FilteredActionList.d.ts +16 -1
  35. package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
  36. package/dist/FilteredActionList/FilteredActionList.js +147 -42
  37. package/dist/FilteredActionList/FilteredActionList.module.css.js +2 -2
  38. package/dist/Overlay/Overlay-390f808a.css +2 -0
  39. package/dist/Overlay/Overlay-390f808a.css.map +1 -0
  40. package/dist/Overlay/Overlay.module.css.js +1 -1
  41. package/dist/PageLayout/PageLayout-3444a142.css +2 -0
  42. package/dist/PageLayout/PageLayout-3444a142.css.map +1 -0
  43. package/dist/PageLayout/PageLayout.d.ts +72 -2
  44. package/dist/PageLayout/PageLayout.d.ts.map +1 -1
  45. package/dist/PageLayout/PageLayout.js +750 -1235
  46. package/dist/PageLayout/PageLayout.module.css.js +2 -2
  47. package/dist/PageLayout/usePaneWidth.d.ts +18 -6
  48. package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
  49. package/dist/PageLayout/usePaneWidth.js +126 -112
  50. package/dist/SelectPanel/SelectPanel.d.ts +1 -1
  51. package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
  52. package/dist/SelectPanel/SelectPanel.js +85 -33
  53. package/dist/SplitPageLayout/SplitPageLayout.d.ts +4 -1
  54. package/dist/SplitPageLayout/SplitPageLayout.d.ts.map +1 -1
  55. package/dist/SplitPageLayout/SplitPageLayout.js +54 -2
  56. package/dist/Text/Text.d.ts +1 -1
  57. package/dist/Text/Text.d.ts.map +1 -1
  58. package/dist/Text/Text.js +10 -13
  59. package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
  60. package/dist/UnderlineNav/UnderlineNav.js +11 -4
  61. package/dist/UnderlineNav/UnderlineNavItem.js +56 -149
  62. package/dist/experimental/SelectPanel2/SelectPanel-f0c4b9ca.css +2 -0
  63. package/dist/experimental/SelectPanel2/{SelectPanel-1f8c23b5.css.map → SelectPanel-f0c4b9ca.css.map} +1 -1
  64. package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
  65. package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
  66. package/dist/hooks/useIsMacOS.d.ts +15 -3
  67. package/dist/hooks/useIsMacOS.d.ts.map +1 -1
  68. package/dist/hooks/useIsMacOS.js +24 -26
  69. package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
  70. package/dist/hooks/useRefObjectAsForwardedRef.js +10 -2
  71. package/dist/hooks/useScrollFlash.d.ts.map +1 -1
  72. package/dist/hooks/useScrollFlash.js +14 -22
  73. package/dist/hooks/useSlots.d.ts +50 -6
  74. package/dist/hooks/useSlots.d.ts.map +1 -1
  75. package/dist/hooks/useSlots.js +114 -36
  76. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +2 -0
  77. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +1 -0
  78. package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
  79. package/dist/live-region/Announce.d.ts.map +1 -1
  80. package/dist/live-region/Announce.js +7 -4
  81. package/generated/components.json +198 -6
  82. package/package.json +4 -4
  83. package/dist/ActionList/ActionList-f4ac3b54.css +0 -2
  84. package/dist/ActionList/ActionList-f4ac3b54.css.map +0 -1
  85. package/dist/AnchoredOverlay/AnchoredOverlay-b7d9fad3.css +0 -2
  86. package/dist/AnchoredOverlay/AnchoredOverlay-b7d9fad3.css.map +0 -1
  87. package/dist/Blankslate/Blankslate-f5a9755a.css.map +0 -1
  88. package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css +0 -2
  89. package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css.map +0 -1
  90. package/dist/Overlay/Overlay-c52b85b7.css +0 -2
  91. package/dist/Overlay/Overlay-c52b85b7.css.map +0 -1
  92. package/dist/PageLayout/PageLayout-cb491b47.css +0 -2
  93. package/dist/PageLayout/PageLayout-cb491b47.css.map +0 -1
  94. package/dist/experimental/SelectPanel2/SelectPanel-1f8c23b5.css +0 -2
  95. package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css +0 -2
  96. package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css.map +0 -1
@@ -1,3 +1,4 @@
1
+ import { c } from 'react-compiler-runtime';
1
2
  import { forwardRef } from 'react';
2
3
  import { IconButton } from '../Button/IconButton.js';
3
4
  import { ButtonComponent } from '../Button/Button.js';
@@ -5,20 +6,59 @@ import { clsx } from 'clsx';
5
6
  import classes from './ActionList.module.css.js';
6
7
  import { jsx } from 'react/jsx-runtime';
7
8
 
8
- const TrailingAction = /*#__PURE__*/forwardRef(({
9
- as = 'button',
10
- icon,
11
- label,
12
- href = null,
13
- className,
14
- style,
15
- loading,
16
- ...props
17
- }, forwardedRef) => {
18
- return /*#__PURE__*/jsx("span", {
19
- className: clsx(className, classes.TrailingAction),
20
- style: style,
21
- children: icon ? /*#__PURE__*/jsx(IconButton, {
9
+ const TrailingAction = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
10
+ const $ = c(23);
11
+ let className;
12
+ let icon;
13
+ let label;
14
+ let loading;
15
+ let props;
16
+ let style;
17
+ let t1;
18
+ let t2;
19
+ if ($[0] !== t0) {
20
+ ({
21
+ as: t1,
22
+ icon,
23
+ label,
24
+ href: t2,
25
+ className,
26
+ style,
27
+ loading,
28
+ ...props
29
+ } = t0);
30
+ $[0] = t0;
31
+ $[1] = className;
32
+ $[2] = icon;
33
+ $[3] = label;
34
+ $[4] = loading;
35
+ $[5] = props;
36
+ $[6] = style;
37
+ $[7] = t1;
38
+ $[8] = t2;
39
+ } else {
40
+ className = $[1];
41
+ icon = $[2];
42
+ label = $[3];
43
+ loading = $[4];
44
+ props = $[5];
45
+ style = $[6];
46
+ t1 = $[7];
47
+ t2 = $[8];
48
+ }
49
+ const as = t1 === undefined ? "button" : t1;
50
+ const href = t2 === undefined ? null : t2;
51
+ let t3;
52
+ if ($[9] !== className) {
53
+ t3 = clsx(className, classes.TrailingAction);
54
+ $[9] = className;
55
+ $[10] = t3;
56
+ } else {
57
+ t3 = $[10];
58
+ }
59
+ let t4;
60
+ if ($[11] !== as || $[12] !== forwardedRef || $[13] !== href || $[14] !== icon || $[15] !== label || $[16] !== loading || $[17] !== props) {
61
+ t4 = icon ? /*#__PURE__*/jsx(IconButton, {
22
62
  as: as,
23
63
  "aria-label": label,
24
64
  icon: icon,
@@ -26,16 +66,11 @@ const TrailingAction = /*#__PURE__*/forwardRef(({
26
66
  tooltipDirection: "w",
27
67
  href: href,
28
68
  loading: loading,
29
- "data-loading": Boolean(loading)
30
- // @ts-expect-error StyledButton wants both Anchor and Button refs
31
- ,
69
+ "data-loading": Boolean(loading),
32
70
  ref: forwardedRef,
33
71
  className: classes.TrailingActionButton,
34
72
  ...props
35
- }) :
36
- /*#__PURE__*/
37
- // @ts-expect-error shhh
38
- jsx(ButtonComponent, {
73
+ }) : /*#__PURE__*/jsx(ButtonComponent, {
39
74
  variant: "invisible",
40
75
  as: as,
41
76
  href: href,
@@ -45,8 +80,33 @@ const TrailingAction = /*#__PURE__*/forwardRef(({
45
80
  className: classes.TrailingActionButton,
46
81
  ...props,
47
82
  children: label
48
- })
49
- });
83
+ });
84
+ $[11] = as;
85
+ $[12] = forwardedRef;
86
+ $[13] = href;
87
+ $[14] = icon;
88
+ $[15] = label;
89
+ $[16] = loading;
90
+ $[17] = props;
91
+ $[18] = t4;
92
+ } else {
93
+ t4 = $[18];
94
+ }
95
+ let t5;
96
+ if ($[19] !== style || $[20] !== t3 || $[21] !== t4) {
97
+ t5 = /*#__PURE__*/jsx("span", {
98
+ className: t3,
99
+ style: style,
100
+ children: t4
101
+ });
102
+ $[19] = style;
103
+ $[20] = t3;
104
+ $[21] = t4;
105
+ $[22] = t5;
106
+ } else {
107
+ t5 = $[22];
108
+ }
109
+ return t5;
50
110
  });
51
111
  TrailingAction.__SLOT__ = Symbol('ActionList.TrailingAction');
52
112
 
@@ -1,3 +1,4 @@
1
+ import { c } from 'react-compiler-runtime';
1
2
  import React from 'react';
2
3
  import { AlertIcon } from '@primer/octicons-react';
3
4
  import { ItemContext } from './shared.js';
@@ -7,86 +8,183 @@ import { jsx } from 'react/jsx-runtime';
7
8
  import { Tooltip } from '../TooltipV2/Tooltip.js';
8
9
  import Spinner from '../Spinner/Spinner.js';
9
10
 
10
- const VisualContainer = ({
11
- className,
12
- ...props
13
- }) => {
14
- return /*#__PURE__*/jsx("span", {
15
- className: clsx(className, classes.VisualWrap),
16
- ...props
17
- });
11
+ const VisualContainer = t0 => {
12
+ const $ = c(8);
13
+ let className;
14
+ let props;
15
+ if ($[0] !== t0) {
16
+ ({
17
+ className,
18
+ ...props
19
+ } = t0);
20
+ $[0] = t0;
21
+ $[1] = className;
22
+ $[2] = props;
23
+ } else {
24
+ className = $[1];
25
+ props = $[2];
26
+ }
27
+ let t1;
28
+ if ($[3] !== className) {
29
+ t1 = clsx(className, classes.VisualWrap);
30
+ $[3] = className;
31
+ $[4] = t1;
32
+ } else {
33
+ t1 = $[4];
34
+ }
35
+ let t2;
36
+ if ($[5] !== props || $[6] !== t1) {
37
+ t2 = /*#__PURE__*/jsx("span", {
38
+ className: t1,
39
+ ...props
40
+ });
41
+ $[5] = props;
42
+ $[6] = t1;
43
+ $[7] = t2;
44
+ } else {
45
+ t2 = $[7];
46
+ }
47
+ return t2;
18
48
  };
19
- VisualContainer.displayName = "VisualContainer";
20
- const LeadingVisual = ({
21
- className,
22
- ...props
23
- }) => {
24
- return /*#__PURE__*/jsx(VisualContainer, {
25
- className: clsx(className, classes.LeadingVisual),
26
- ...props,
27
- children: props.children
28
- });
49
+ const LeadingVisual = t0 => {
50
+ const $ = c(8);
51
+ let className;
52
+ let props;
53
+ if ($[0] !== t0) {
54
+ ({
55
+ className,
56
+ ...props
57
+ } = t0);
58
+ $[0] = t0;
59
+ $[1] = className;
60
+ $[2] = props;
61
+ } else {
62
+ className = $[1];
63
+ props = $[2];
64
+ }
65
+ let t1;
66
+ if ($[3] !== className) {
67
+ t1 = clsx(className, classes.LeadingVisual);
68
+ $[3] = className;
69
+ $[4] = t1;
70
+ } else {
71
+ t1 = $[4];
72
+ }
73
+ let t2;
74
+ if ($[5] !== props || $[6] !== t1) {
75
+ t2 = /*#__PURE__*/jsx(VisualContainer, {
76
+ className: t1,
77
+ ...props,
78
+ children: props.children
79
+ });
80
+ $[5] = props;
81
+ $[6] = t1;
82
+ $[7] = t2;
83
+ } else {
84
+ t2 = $[7];
85
+ }
86
+ return t2;
29
87
  };
30
- LeadingVisual.displayName = "LeadingVisual";
31
- const TrailingVisual = ({
32
- className,
33
- ...props
34
- }) => {
88
+ const TrailingVisual = t0 => {
89
+ const $ = c(9);
90
+ let className;
91
+ let props;
92
+ if ($[0] !== t0) {
93
+ ({
94
+ className,
95
+ ...props
96
+ } = t0);
97
+ $[0] = t0;
98
+ $[1] = className;
99
+ $[2] = props;
100
+ } else {
101
+ className = $[1];
102
+ props = $[2];
103
+ }
35
104
  const {
36
105
  trailingVisualId
37
106
  } = React.useContext(ItemContext);
38
- return /*#__PURE__*/jsx(VisualContainer, {
39
- className: clsx(className, classes.TrailingVisual),
40
- id: trailingVisualId,
41
- ...props,
42
- children: props.children
43
- });
107
+ let t1;
108
+ if ($[3] !== className) {
109
+ t1 = clsx(className, classes.TrailingVisual);
110
+ $[3] = className;
111
+ $[4] = t1;
112
+ } else {
113
+ t1 = $[4];
114
+ }
115
+ let t2;
116
+ if ($[5] !== props || $[6] !== t1 || $[7] !== trailingVisualId) {
117
+ t2 = /*#__PURE__*/jsx(VisualContainer, {
118
+ className: t1,
119
+ id: trailingVisualId,
120
+ ...props,
121
+ children: props.children
122
+ });
123
+ $[5] = props;
124
+ $[6] = t1;
125
+ $[7] = trailingVisualId;
126
+ $[8] = t2;
127
+ } else {
128
+ t2 = $[8];
129
+ }
130
+ return t2;
44
131
  };
45
- TrailingVisual.displayName = "TrailingVisual";
132
+
46
133
  // VisualOrIndicator handles the positioning of indicators and determines whether to show a visual or an indicator.
47
134
  //
48
135
  // If we're showing an *inactive* or *loading* indicator and a leading visual has NOT been passed,
49
136
  // replace the trailing visual with the inactive indicator.
50
137
  //
51
138
  // This preserves the left alignment of item text.
52
- const VisualOrIndicator = ({
53
- children,
54
- labelId,
55
- loading,
56
- inactiveText,
57
- itemHasLeadingVisual,
58
- position,
59
- className
60
- }) => {
61
- const VisualComponent = position === 'leading' ? LeadingVisual : TrailingVisual;
62
- if (!loading && !inactiveText) return children;
63
- if (itemHasLeadingVisual && position === 'trailing' ||
64
- // has a leading visual, and it's in the trailing position, or
65
- !itemHasLeadingVisual && position === 'leading' // it doesn't have a leading visual, and it's in the leading position
66
- ) {
67
- // => so we don't render the indicator here
139
+ const VisualOrIndicator = t0 => {
140
+ const $ = c(5);
141
+ const {
142
+ children,
143
+ labelId,
144
+ loading,
145
+ inactiveText,
146
+ itemHasLeadingVisual,
147
+ position,
148
+ className
149
+ } = t0;
150
+ const VisualComponent = position === "leading" ? LeadingVisual : TrailingVisual;
151
+ if (!loading && !inactiveText) {
68
152
  return children;
69
153
  }
70
- return inactiveText ? /*#__PURE__*/jsx("span", {
71
- className: classes.InactiveButtonWrap,
72
- children: /*#__PURE__*/jsx(Tooltip, {
73
- text: inactiveText,
74
- type: "description",
75
- children: /*#__PURE__*/jsx("button", {
76
- type: "button",
77
- className: classes.InactiveButtonReset,
78
- "aria-labelledby": labelId,
79
- children: /*#__PURE__*/jsx(VisualComponent, {
80
- children: /*#__PURE__*/jsx(AlertIcon, {})
154
+ if (itemHasLeadingVisual && position === "trailing" || !itemHasLeadingVisual && position === "leading") {
155
+ return children;
156
+ }
157
+ let t1;
158
+ if ($[0] !== VisualComponent || $[1] !== className || $[2] !== inactiveText || $[3] !== labelId) {
159
+ t1 = inactiveText ? /*#__PURE__*/jsx("span", {
160
+ className: classes.InactiveButtonWrap,
161
+ children: /*#__PURE__*/jsx(Tooltip, {
162
+ text: inactiveText,
163
+ type: "description",
164
+ children: /*#__PURE__*/jsx("button", {
165
+ type: "button",
166
+ className: classes.InactiveButtonReset,
167
+ "aria-labelledby": labelId,
168
+ children: /*#__PURE__*/jsx(VisualComponent, {
169
+ children: /*#__PURE__*/jsx(AlertIcon, {})
170
+ })
81
171
  })
82
172
  })
83
- })
84
- }) : /*#__PURE__*/jsx(VisualComponent, {
85
- className: className,
86
- children: /*#__PURE__*/jsx(Spinner, {
87
- size: "small"
88
- })
89
- });
173
+ }) : /*#__PURE__*/jsx(VisualComponent, {
174
+ className: className,
175
+ children: /*#__PURE__*/jsx(Spinner, {
176
+ size: "small"
177
+ })
178
+ });
179
+ $[0] = VisualComponent;
180
+ $[1] = className;
181
+ $[2] = inactiveText;
182
+ $[3] = labelId;
183
+ $[4] = t1;
184
+ } else {
185
+ t1 = $[4];
186
+ }
187
+ return t1;
90
188
  };
91
189
  LeadingVisual.displayName = 'ActionList.LeadingVisual';
92
190
  TrailingVisual.displayName = 'ActionList.TrailingVisual';
@@ -0,0 +1,2 @@
1
+ .prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium{position:relative}.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:none;position:absolute;right:var(--base-size-8,.5rem);top:var(--base-size-8,.5rem)}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:inline-grid}}.prc-AnchoredOverlay-Wrapper-w6jU3{anchor-scope:--anchored-overlay}.prc-AnchoredOverlay-Anchor-DWRfK{anchor-name:--anchored-overlay-anchor}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z{position-anchor:--anchored-overlay-anchor;position-try-fallbacks:flip-block,flip-inline,flip-block flip-inline;position-visibility:anchors-visible;position:fixed;z-index:100}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom]{left:anchor(left);top:calc(anchor(bottom) + var(--base-size-4,.25rem))}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top]{bottom:anchor(top);margin-bottom:var(--base-size-4,.25rem)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-left]{margin-right:var(--base-size-4,.25rem);right:anchor(left);top:anchor(top)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-right]{left:anchor(right);margin-left:var(--base-size-4,.25rem);top:anchor(top)}
2
+ /*# sourceMappingURL=AnchoredOverlay-6ec278c5.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/AnchoredOverlay/AnchoredOverlay.module.css.js"],"names":[],"mappings":"AAAA,0DACE,iBACF,CAEA,iDAIE,YAAa,CAHb,iBAAkB,CAElB,8BAAyB,CADzB,4BAOF,CAHE,mDANF,iDAOI,mBAEJ,CADE,CAGF,mCACE,+BACF,CAEA,kCAEE,qCACF,CAGA,2CAEE,yCAA0C,CAC1C,oEAGwB,CACxB,mCAAoC,CAEpC,cAAe,CADf,WAwBF,CArBE,qEAEE,iBAAkB,CADlB,oDAEF,CAEA,kEAEE,kBAAmB,CADnB,uCAEF,CAEA,mEAGE,sCAAgC,CAFhC,kBAAmB,CACnB,eAEF,CAEA,oEACE,kBAAmB,CAEnB,qCAA+B,CAD/B,eAEF","file":"AnchoredOverlay-6ec278c5.css","sourcesContent":[".ResponsiveCloseButtonContainer {\n position: relative;\n}\n\n.ResponsiveCloseButton {\n position: absolute;\n top: var(--base-size-8);\n right: var(--base-size-8);\n display: none;\n\n @media screen and (--viewportRange-narrow) {\n display: inline-grid;\n }\n}\n\n.Wrapper {\n anchor-scope: --anchored-overlay\n}\n\n.Anchor {\n /* Anchor name, this is currently tied to `renderAnchor` */\n anchor-name: --anchored-overlay-anchor;\n}\n\n\n.AnchoredOverlay {\n /* Anchor position, this is currently tied to `<Overlay>` */\n position-anchor: --anchored-overlay-anchor;\n position-try-fallbacks:\n flip-block,\n flip-inline,\n flip-block flip-inline;\n position-visibility: anchors-visible;\n z-index: 100;\n position: fixed;\n\n &[data-side='outside-bottom'] {\n top: calc(anchor(bottom) + var(--base-size-4));\n left: anchor(left);\n }\n\n &[data-side='outside-top'] {\n margin-bottom: var(--base-size-4);\n bottom: anchor(top);\n }\n\n &[data-side='outside-left'] {\n right: anchor(left);\n top: anchor(top);\n margin-right: var(--base-size-4);\n }\n\n &[data-side='outside-right'] {\n left: anchor(right);\n top: anchor(top);\n margin-left: var(--base-size-4);\n }\n}\n"]}
@@ -6,7 +6,7 @@ import { IconButton } from '../Button/IconButton.js';
6
6
  import { XIcon } from '@primer/octicons-react';
7
7
  import classes from './AnchoredOverlay.module.css.js';
8
8
  import { clsx } from 'clsx';
9
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
9
+ import { jsxs, jsx } from 'react/jsx-runtime';
10
10
  import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
11
11
  import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
12
12
  import { useRenderForcingRef } from '../hooks/useRenderForcingRef.js';
@@ -112,7 +112,8 @@ const AnchoredOverlay = ({
112
112
  const showXIcon = onClose && variant.narrow === 'fullscreen' && displayCloseButton;
113
113
  const XButtonAriaLabelledBy = closeButtonProps['aria-labelledby'];
114
114
  const XButtonAriaLabel = closeButtonProps['aria-label'];
115
- return /*#__PURE__*/jsxs(Fragment, {
115
+ return /*#__PURE__*/jsxs("div", {
116
+ className: classes.Wrapper,
116
117
  children: [renderAnchor && renderAnchor({
117
118
  ref: anchorRef,
118
119
  id: anchorId,
@@ -170,6 +171,7 @@ const AnchoredOverlay = ({
170
171
  }) : null]
171
172
  });
172
173
  };
174
+ AnchoredOverlay.displayName = "AnchoredOverlay";
173
175
  function assignRef(ref, value) {
174
176
  if (typeof ref === 'function') {
175
177
  ref(value);
@@ -1,5 +1,5 @@
1
- import './AnchoredOverlay-b7d9fad3.css';
1
+ import './AnchoredOverlay-6ec278c5.css';
2
2
 
3
- var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx","Anchor":"prc-AnchoredOverlay-Anchor-DWRfK","AnchoredOverlay":"prc-AnchoredOverlay-AnchoredOverlay-fYg9Z"};
3
+ var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx","Wrapper":"prc-AnchoredOverlay-Wrapper-w6jU3","Anchor":"prc-AnchoredOverlay-Anchor-DWRfK","AnchoredOverlay":"prc-AnchoredOverlay-AnchoredOverlay-fYg9Z"};
4
4
 
5
5
  export { classes as default };
@@ -1,6 +1,5 @@
1
- import { c } from 'react-compiler-runtime';
2
- import { useRef, useReducer, useDeferredValue } from 'react';
3
- import { AutocompleteContext, AutocompleteDeferredInputContext, AutocompleteInputContext } from './AutocompleteContext.js';
1
+ import { useRef, useReducer, useCallback, useMemo, useDeferredValue } from 'react';
2
+ import { AutocompleteContext, AutocompleteInputContext, AutocompleteDeferredInputContext } from './AutocompleteContext.js';
4
3
  import AutocompleteInput from './AutocompleteInput.js';
5
4
  import AutocompleteMenu from './AutocompleteMenu.js';
6
5
  import AutocompleteOverlay from './AutocompleteOverlay.js';
@@ -49,12 +48,10 @@ const reducer = (state, action) => {
49
48
  return state;
50
49
  }
51
50
  };
52
- const Autocomplete = t0 => {
53
- const $ = c(24);
54
- const {
55
- children,
56
- id: idProp
57
- } = t0;
51
+ const Autocomplete = ({
52
+ children,
53
+ id: idProp
54
+ }) => {
58
55
  const activeDescendantRef = useRef(null);
59
56
  const scrollContainerRef = useRef(null);
60
57
  const inputRef = useRef(null);
@@ -66,160 +63,80 @@ const Autocomplete = t0 => {
66
63
  isMenuDirectlyActivated,
67
64
  selectedItemLength
68
65
  } = state;
69
- let t1;
70
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
71
- t1 = value => {
72
- dispatch({
73
- type: "inputValue",
74
- payload: value
75
- });
76
- };
77
- $[0] = t1;
78
- } else {
79
- t1 = $[0];
80
- }
81
- const setInputValue = t1;
82
- let t2;
83
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
84
- t2 = value_0 => {
85
- dispatch({
86
- type: "showMenu",
87
- payload: value_0
88
- });
89
- };
90
- $[1] = t2;
91
- } else {
92
- t2 = $[1];
93
- }
94
- const setShowMenu = t2;
95
- let t3;
96
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
97
- t3 = value_1 => {
98
- dispatch({
99
- type: "autocompleteSuggestion",
100
- payload: value_1
101
- });
102
- };
103
- $[2] = t3;
104
- } else {
105
- t3 = $[2];
106
- }
107
- const setAutocompleteSuggestion = t3;
108
- let t4;
109
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
110
- t4 = value_2 => {
111
- dispatch({
112
- type: "isMenuDirectlyActivated",
113
- payload: value_2
114
- });
115
- };
116
- $[3] = t4;
117
- } else {
118
- t4 = $[3];
119
- }
120
- const setIsMenuDirectlyActivated = t4;
121
- let t5;
122
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
123
- t5 = value_3 => {
124
- dispatch({
125
- type: "selectedItemLength",
126
- payload: value_3
127
- });
128
- };
129
- $[4] = t5;
130
- } else {
131
- t5 = $[4];
132
- }
133
- const setSelectedItemLength = t5;
134
- const id = useId(idProp);
135
- let t6;
136
- if ($[5] !== id || $[6] !== selectedItemLength || $[7] !== showMenu) {
137
- t6 = {
138
- activeDescendantRef,
139
- id,
140
- inputRef,
141
- scrollContainerRef,
142
- selectedItemLength,
143
- setAutocompleteSuggestion,
144
- setInputValue,
145
- setIsMenuDirectlyActivated,
146
- setShowMenu,
147
- setSelectedItemLength,
148
- showMenu
149
- };
150
- $[5] = id;
151
- $[6] = selectedItemLength;
152
- $[7] = showMenu;
153
- $[8] = t6;
154
- } else {
155
- t6 = $[8];
156
- }
157
- const autocompleteContextValue = t6;
158
- let t7;
159
- if ($[9] !== autocompleteSuggestion || $[10] !== inputValue || $[11] !== isMenuDirectlyActivated) {
160
- t7 = {
161
- autocompleteSuggestion,
162
- inputValue,
163
- isMenuDirectlyActivated
164
- };
165
- $[9] = autocompleteSuggestion;
166
- $[10] = inputValue;
167
- $[11] = isMenuDirectlyActivated;
168
- $[12] = t7;
169
- } else {
170
- t7 = $[12];
171
- }
172
- const autocompleteInputContextValue = t7;
173
- const deferredInputValue = useDeferredValue(inputValue);
174
- let t8;
175
- if ($[13] !== deferredInputValue) {
176
- t8 = {
177
- deferredInputValue
178
- };
179
- $[13] = deferredInputValue;
180
- $[14] = t8;
181
- } else {
182
- t8 = $[14];
183
- }
184
- const autocompleteDeferredInputContextValue = t8;
185
- let t9;
186
- if ($[15] !== autocompleteDeferredInputContextValue || $[16] !== children) {
187
- t9 = /*#__PURE__*/jsx(AutocompleteDeferredInputContext.Provider, {
188
- value: autocompleteDeferredInputContextValue,
189
- children: children
66
+ const setInputValue = useCallback(value => {
67
+ dispatch({
68
+ type: 'inputValue',
69
+ payload: value
190
70
  });
191
- $[15] = autocompleteDeferredInputContextValue;
192
- $[16] = children;
193
- $[17] = t9;
194
- } else {
195
- t9 = $[17];
196
- }
197
- let t10;
198
- if ($[18] !== autocompleteInputContextValue || $[19] !== t9) {
199
- t10 = /*#__PURE__*/jsx(AutocompleteInputContext.Provider, {
200
- value: autocompleteInputContextValue,
201
- children: t9
71
+ }, []);
72
+ const setShowMenu = useCallback(value => {
73
+ dispatch({
74
+ type: 'showMenu',
75
+ payload: value
202
76
  });
203
- $[18] = autocompleteInputContextValue;
204
- $[19] = t9;
205
- $[20] = t10;
206
- } else {
207
- t10 = $[20];
208
- }
209
- let t11;
210
- if ($[21] !== autocompleteContextValue || $[22] !== t10) {
211
- t11 = /*#__PURE__*/jsx(AutocompleteContext.Provider, {
212
- value: autocompleteContextValue,
213
- children: t10
77
+ }, []);
78
+ const setAutocompleteSuggestion = useCallback(value => {
79
+ dispatch({
80
+ type: 'autocompleteSuggestion',
81
+ payload: value
214
82
  });
215
- $[21] = autocompleteContextValue;
216
- $[22] = t10;
217
- $[23] = t11;
218
- } else {
219
- t11 = $[23];
220
- }
221
- return t11;
83
+ }, []);
84
+ const setIsMenuDirectlyActivated = useCallback(value => {
85
+ dispatch({
86
+ type: 'isMenuDirectlyActivated',
87
+ payload: value
88
+ });
89
+ }, []);
90
+ const setSelectedItemLength = useCallback(value => {
91
+ dispatch({
92
+ type: 'selectedItemLength',
93
+ payload: value
94
+ });
95
+ }, []);
96
+ const id = useId(idProp);
97
+
98
+ // Base context: refs, IDs, menu visibility, and callbacks
99
+ // Changes when menu opens/closes or selection changes, but NOT on every keystroke
100
+ const autocompleteContextValue = useMemo(() => ({
101
+ activeDescendantRef,
102
+ id,
103
+ inputRef,
104
+ scrollContainerRef,
105
+ selectedItemLength,
106
+ setAutocompleteSuggestion,
107
+ setInputValue,
108
+ setIsMenuDirectlyActivated,
109
+ setShowMenu,
110
+ setSelectedItemLength,
111
+ showMenu
112
+ }), [id, selectedItemLength, setAutocompleteSuggestion, setInputValue, setIsMenuDirectlyActivated, setShowMenu, setSelectedItemLength, showMenu]);
113
+
114
+ // Input state context: values that change on every keystroke
115
+ // Split to prevent Overlay from re-rendering during typing
116
+ const autocompleteInputContextValue = useMemo(() => ({
117
+ autocompleteSuggestion,
118
+ inputValue,
119
+ isMenuDirectlyActivated
120
+ }), [autocompleteSuggestion, inputValue, isMenuDirectlyActivated]);
121
+
122
+ // Deferred input value for expensive operations like filtering
123
+ // Menu subscribes to this instead of inputValue to avoid re-rendering on every keystroke
124
+ const deferredInputValue = useDeferredValue(inputValue);
125
+ const autocompleteDeferredInputContextValue = useMemo(() => ({
126
+ deferredInputValue
127
+ }), [deferredInputValue]);
128
+ return /*#__PURE__*/jsx(AutocompleteContext.Provider, {
129
+ value: autocompleteContextValue,
130
+ children: /*#__PURE__*/jsx(AutocompleteInputContext.Provider, {
131
+ value: autocompleteInputContextValue,
132
+ children: /*#__PURE__*/jsx(AutocompleteDeferredInputContext.Provider, {
133
+ value: autocompleteDeferredInputContextValue,
134
+ children: children
135
+ })
136
+ })
137
+ });
222
138
  };
139
+ Autocomplete.displayName = "Autocomplete";
223
140
  var Autocomplete$1 = Object.assign(Autocomplete, {
224
141
  __SLOT__: Symbol('Autocomplete'),
225
142
  Context: AutocompleteContext,