@primer/react 0.0.0-20260312192556 → 0.0.0-20260312204752

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 (54) hide show
  1. package/CHANGELOG.md +22 -2
  2. package/dist/ActionBar/ActionBar-a41224b2.css +2 -0
  3. package/dist/ActionBar/ActionBar-a41224b2.css.map +1 -0
  4. package/dist/ActionBar/ActionBar.d.ts +1 -1
  5. package/dist/ActionBar/ActionBar.d.ts.map +1 -1
  6. package/dist/ActionBar/ActionBar.js +390 -389
  7. package/dist/ActionBar/ActionBar.module.css.js +2 -2
  8. package/dist/ActionBar/index.d.ts +1 -1
  9. package/dist/ActionList/Item.d.ts.map +1 -1
  10. package/dist/ActionList/Item.js +628 -192
  11. package/dist/ActionList/LinkItem.d.ts +6 -3
  12. package/dist/ActionList/LinkItem.d.ts.map +1 -1
  13. package/dist/ActionList/LinkItem.js +42 -87
  14. package/dist/ActionList/List.d.ts.map +1 -1
  15. package/dist/ActionList/List.js +6 -5
  16. package/dist/ActionList/index.d.ts +25 -1
  17. package/dist/ActionList/index.d.ts.map +1 -1
  18. package/dist/Banner/{Banner-b3871000.css → Banner-41040ab7.css} +2 -2
  19. package/dist/Banner/{Banner-b3871000.css.map → Banner-41040ab7.css.map} +1 -1
  20. package/dist/Banner/Banner.d.ts.map +1 -1
  21. package/dist/Banner/Banner.js +1 -0
  22. package/dist/Banner/Banner.module.css.js +1 -1
  23. package/dist/Breadcrumbs/Breadcrumbs.d.ts +23 -8
  24. package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  25. package/dist/Breadcrumbs/Breadcrumbs.js +19 -62
  26. package/dist/Button/{ButtonBase-781fba8b.css → ButtonBase-6659abcf.css} +2 -2
  27. package/dist/Button/{ButtonBase-781fba8b.css.map → ButtonBase-6659abcf.css.map} +1 -1
  28. package/dist/Button/ButtonBase.module.css.js +1 -1
  29. package/dist/Dialog/{Dialog-2d417a89.css → Dialog-2de477b3.css} +2 -2
  30. package/dist/Dialog/{Dialog-2d417a89.css.map → Dialog-2de477b3.css.map} +1 -1
  31. package/dist/Dialog/Dialog.d.ts.map +1 -1
  32. package/dist/Dialog/Dialog.js +3 -1
  33. package/dist/Dialog/Dialog.module.css.js +2 -2
  34. package/dist/Overlay/{Overlay-15519c09.css → Overlay-dbaa6b8c.css} +2 -2
  35. package/dist/Overlay/Overlay-dbaa6b8c.css.map +1 -0
  36. package/dist/Overlay/Overlay.module.css.js +1 -1
  37. package/dist/PageLayout/PageLayout.d.ts +4 -20
  38. package/dist/PageLayout/PageLayout.d.ts.map +1 -1
  39. package/dist/PageLayout/PageLayout.js +12 -0
  40. package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
  41. package/dist/SelectPanel/SelectPanel.js +30 -29
  42. package/dist/TextInput/TextInput.d.ts.map +1 -1
  43. package/dist/TextInput/TextInput.js +31 -5
  44. package/dist/TreeView/TreeView.d.ts.map +1 -1
  45. package/dist/TreeView/TreeView.js +101 -59
  46. package/dist/TreeView/useRovingTabIndex.d.ts +14 -0
  47. package/dist/TreeView/useRovingTabIndex.d.ts.map +1 -1
  48. package/dist/TreeView/useRovingTabIndex.js +94 -16
  49. package/dist/utils/character-counter.d.ts.map +1 -1
  50. package/dist/utils/character-counter.js +1 -0
  51. package/package.json +1 -1
  52. package/dist/ActionBar/ActionBar-f2b70d1d.css +0 -2
  53. package/dist/ActionBar/ActionBar-f2b70d1d.css.map +0 -1
  54. package/dist/Overlay/Overlay-15519c09.css.map +0 -1
@@ -56,6 +56,9 @@ const focusZoneSettings = {
56
56
  // Let FilteredActionList handle focus zone
57
57
  disabled: true
58
58
  };
59
+ const closeButtonProps = {
60
+ 'aria-label': 'Cancel and close'
61
+ };
59
62
  const areItemsEqual = (itemA, itemB) => {
60
63
  // prefer checking equivality by item.id
61
64
  if (typeof itemA.id !== 'undefined') return itemA.id === itemB.id;else return itemA === itemB;
@@ -537,9 +540,9 @@ function Panel({
537
540
  prevOpenRef.current = open;
538
541
  }
539
542
  }, [open, resetSort]);
540
- const focusTrapSettings = {
543
+ const focusTrapSettings = useMemo(() => ({
541
544
  initialFocusRef: inputRef || undefined
542
- };
545
+ }), [inputRef]);
543
546
  const extendedTextInputProps = useMemo(() => {
544
547
  return {
545
548
  className: classes.TextInput,
@@ -615,9 +618,11 @@ function Panel({
615
618
  regular: 'anchored',
616
619
  narrow: 'fullscreen'
617
620
  } : undefined, 'anchored');
618
- const preventBubbling = customOnKeyDown => event => {
621
+ const preventBubbling = useCallback(event => {
622
+ var _overlayProps$onKeyDo;
623
+ overlayProps === null || overlayProps === void 0 ? void 0 : (_overlayProps$onKeyDo = overlayProps.onKeyDown) === null || _overlayProps$onKeyDo === void 0 ? void 0 : _overlayProps$onKeyDo.call(overlayProps, event);
624
+
619
625
  // skip if a TextInput has focus
620
- customOnKeyDown === null || customOnKeyDown === void 0 ? void 0 : customOnKeyDown(event);
621
626
  const activeElement = document.activeElement;
622
627
  if (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA') return;
623
628
 
@@ -632,7 +637,25 @@ function Panel({
632
637
 
633
638
  // if this is a typeahead event, don't propagate outside of menu
634
639
  event.stopPropagation();
635
- };
640
+ }, [overlayProps]);
641
+ const mergedOverlayProps = useMemo(() => ({
642
+ role: 'dialog',
643
+ 'aria-labelledby': titleId,
644
+ 'aria-describedby': subtitle ? subtitleId : undefined,
645
+ ...overlayProps,
646
+ ...(variant === 'modal' ? {
647
+ top: '50vh',
648
+ left: '50vw',
649
+ anchorSide: undefined
650
+ } : {}),
651
+ style: {
652
+ transform: variant === 'modal' ? 'translate(-50%, -50%)' : undefined,
653
+ ...(isKeyboardVisible ? {
654
+ maxHeight: availablePanelHeight !== undefined ? `${availablePanelHeight}px` : 'auto'
655
+ } : {})
656
+ },
657
+ onKeyDown: preventBubbling
658
+ }), [titleId, subtitle, subtitleId, overlayProps, variant, isKeyboardVisible, availablePanelHeight, preventBubbling]);
636
659
  return /*#__PURE__*/jsxs(Fragment, {
637
660
  children: [/*#__PURE__*/jsx(AnchoredOverlay, {
638
661
  renderAnchor: renderMenuAnchor,
@@ -641,27 +664,7 @@ function Panel({
641
664
  open: open,
642
665
  onOpen: onOpen,
643
666
  onClose: onClose,
644
- overlayProps: {
645
- role: 'dialog',
646
- 'aria-labelledby': titleId,
647
- 'aria-describedby': subtitle ? subtitleId : undefined,
648
- ...overlayProps,
649
- ...(variant === 'modal' ? {
650
- /* override AnchoredOverlay position */
651
- top: '50vh',
652
- left: '50vw',
653
- anchorSide: undefined
654
- } : {}),
655
- style: {
656
- /* override AnchoredOverlay position */
657
- transform: variant === 'modal' ? 'translate(-50%, -50%)' : undefined,
658
- // set maxHeight based on calculated availablePanelHeight when keyboard is visible
659
- ...(isKeyboardVisible ? {
660
- maxHeight: availablePanelHeight !== undefined ? `${availablePanelHeight}px` : 'auto'
661
- } : {})
662
- },
663
- onKeyDown: preventBubbling(overlayProps === null || overlayProps === void 0 ? void 0 : overlayProps.onKeyDown)
664
- },
667
+ overlayProps: mergedOverlayProps,
665
668
  focusTrapSettings: focusTrapSettings,
666
669
  focusZoneSettings: focusZoneSettings,
667
670
  height: height,
@@ -674,9 +677,7 @@ function Panel({
674
677
  pinPosition: !height,
675
678
  className: classes.Overlay,
676
679
  displayCloseButton: showXCloseIcon,
677
- closeButtonProps: {
678
- 'aria-label': 'Cancel and close'
679
- },
680
+ closeButtonProps: closeButtonProps,
680
681
  children: /*#__PURE__*/jsxs("div", {
681
682
  className: classes.Wrapper,
682
683
  "data-variant": variant,
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwD,MAAM,OAAO,CAAA;AAE5E,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAO/F,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAA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EAAC,MAAM,yCAAyC,CAAA;AAQ/E,MAAM,MAAM,4BAA4B,GAAG;IACzC,uEAAuE;IACvE,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACxB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;QAKI;IACJ,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;IAChD,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;IACnD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;IACpD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAA;IACvE;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,GAAG,OAAO,CACT,IAAI,CACF,kBAAkB,EAChB,OAAO,GACP,UAAU,GACV,UAAU,GACV,WAAW,GACX,OAAO,GACP,UAAU,GACV,UAAU,GACV,SAAS,GACT,MAAM,GACN,kBAAkB,CACrB,CACF,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,4BAA4B,CAAC,CAAA;;;;;;;;;;;AA+PzG,wBAGE"}
@@ -51,6 +51,10 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
51
51
  const [isOverLimit, setIsOverLimit] = useState(false);
52
52
  const [screenReaderMessage, setScreenReaderMessage] = useState('');
53
53
  const characterCounterRef = useRef(null);
54
+ const lastCountedLengthRef = useRef(null);
55
+ const lastCharacterCountRef = useRef('');
56
+ const lastIsOverLimitRef = useRef(false);
57
+ const lastScreenReaderMessageRef = useRef('');
54
58
 
55
59
  // this class is necessary to style FilterSearch, plz no touchy!
56
60
  const wrapperClasses = clsx(className, 'TextInput-wrapper');
@@ -84,17 +88,31 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
84
88
  if (characterLimit) {
85
89
  characterCounterRef.current = new CharacterCounter({
86
90
  onCountUpdate: (count, overLimit, message) => {
87
- setCharacterCount(message);
88
- setIsOverLimit(overLimit);
91
+ if (message !== lastCharacterCountRef.current) {
92
+ lastCharacterCountRef.current = message;
93
+ setCharacterCount(message);
94
+ }
95
+ if (overLimit !== lastIsOverLimitRef.current) {
96
+ lastIsOverLimitRef.current = overLimit;
97
+ setIsOverLimit(overLimit);
98
+ }
89
99
  },
90
100
  onScreenReaderAnnounce: message_0 => {
91
- setScreenReaderMessage(message_0);
101
+ if (message_0 !== lastScreenReaderMessageRef.current) {
102
+ lastScreenReaderMessageRef.current = message_0;
103
+ setScreenReaderMessage(message_0);
104
+ }
92
105
  }
93
106
  });
107
+ lastCountedLengthRef.current = null;
94
108
  return () => {
95
109
  var _characterCounterRef$;
96
110
  (_characterCounterRef$ = characterCounterRef.current) === null || _characterCounterRef$ === void 0 ? void 0 : _characterCounterRef$.cleanup();
97
111
  characterCounterRef.current = null;
112
+ lastCountedLengthRef.current = null;
113
+ lastCharacterCountRef.current = '';
114
+ lastIsOverLimitRef.current = false;
115
+ lastScreenReaderMessageRef.current = '';
98
116
  };
99
117
  }
100
118
  }, [characterLimit]);
@@ -103,14 +121,22 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
103
121
  useEffect(() => {
104
122
  if (characterLimit && characterCounterRef.current) {
105
123
  const currentValue = value !== undefined ? String(value) : defaultValue !== undefined ? String(defaultValue) : '';
106
- characterCounterRef.current.updateCharacterCount(currentValue.length, characterLimit);
124
+ const currentLength = currentValue.length;
125
+ if (currentLength !== lastCountedLengthRef.current) {
126
+ lastCountedLengthRef.current = currentLength;
127
+ characterCounterRef.current.updateCharacterCount(currentLength, characterLimit);
128
+ }
107
129
  }
108
130
  }, [value, defaultValue, characterLimit]);
109
131
 
110
132
  // Handle input change with character counter
111
133
  const handleInputChange = useCallback(e_2 => {
112
134
  if (characterLimit && characterCounterRef.current) {
113
- characterCounterRef.current.updateCharacterCount(e_2.target.value.length, characterLimit);
135
+ const currentLength_0 = e_2.target.value.length;
136
+ if (currentLength_0 !== lastCountedLengthRef.current) {
137
+ lastCountedLengthRef.current = currentLength_0;
138
+ characterCounterRef.current.updateCharacterCount(currentLength_0, characterLimit);
139
+ }
114
140
  }
115
141
  onChange === null || onChange === void 0 ? void 0 : onChange(e_2);
116
142
  }, [onChange, characterLimit]);
@@ -1 +1 @@
1
- {"version":3,"file":"TreeView.d.ts","sourceRoot":"","sources":["../../src/TreeView/TreeView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAA+B,MAAM,OAAO,CAAA;AAsBnD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAA;AA0CpD,MAAM,MAAM,aAAa,GAAG;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,iBAAiB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAC3D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAqFD,MAAM,MAAM,i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KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;IAG/E,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAqED,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,wBAAwB,EAAE,CAAA;IACjC,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AA0ED,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,wBAAwB,EAAE,CAAA;IACjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAwED,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AA4CD,eAAO,MAAM,QAAQ;;;;;;;;CAQnB,CAAA"}
@@ -31,7 +31,8 @@ const RootContext = /*#__PURE__*/React.createContext({
31
31
  announceUpdate: () => {},
32
32
  expandedStateCache: {
33
33
  current: new Map()
34
- }
34
+ },
35
+ scrollElementIntoView: () => {}
35
36
  });
36
37
  const ItemContext = /*#__PURE__*/React.createContext({
37
38
  itemId: '',
@@ -51,7 +52,7 @@ const ItemContext = /*#__PURE__*/React.createContext({
51
52
  /* Size of toggle icon in pixels. */
52
53
  const TOGGLE_ICON_SIZE = 12;
53
54
  const Root = t0 => {
54
- const $ = c(23);
55
+ const $ = c(26);
55
56
  const {
56
57
  "aria-label": ariaLabel,
57
58
  "aria-labelledby": ariaLabelledby,
@@ -127,89 +128,132 @@ const Root = t0 => {
127
128
  t7 = $[5];
128
129
  }
129
130
  useTypeahead(t7);
131
+ const pendingScrollRef = React.useRef(null);
132
+ let t8;
133
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
134
+ t8 = element_0 => {
135
+ if (!element_0) {
136
+ return;
137
+ }
138
+ if (pendingScrollRef.current !== null) {
139
+ cancelAnimationFrame(pendingScrollRef.current);
140
+ }
141
+ pendingScrollRef.current = requestAnimationFrame(() => {
142
+ pendingScrollRef.current = null;
143
+ if (!element_0.isConnected) {
144
+ return;
145
+ }
146
+ element_0.scrollIntoView({
147
+ block: "nearest",
148
+ inline: "nearest"
149
+ });
150
+ });
151
+ };
152
+ $[6] = t8;
153
+ } else {
154
+ t8 = $[6];
155
+ }
156
+ const scrollElementIntoView = t8;
157
+ let t10;
158
+ let t9;
159
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
160
+ t9 = () => () => {
161
+ if (pendingScrollRef.current !== null) {
162
+ cancelAnimationFrame(pendingScrollRef.current);
163
+ }
164
+ };
165
+ t10 = [];
166
+ $[7] = t10;
167
+ $[8] = t9;
168
+ } else {
169
+ t10 = $[7];
170
+ t9 = $[8];
171
+ }
172
+ useEffect(t9, t10);
130
173
  const expandedStateCache = React.useRef(null);
131
174
  if (expandedStateCache.current === null) {
132
- let t8;
133
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
134
- t8 = new Map();
135
- $[6] = t8;
175
+ let t11;
176
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
177
+ t11 = new Map();
178
+ $[9] = t11;
136
179
  } else {
137
- t8 = $[6];
180
+ t11 = $[9];
138
181
  }
139
- expandedStateCache.current = t8;
182
+ expandedStateCache.current = t11;
140
183
  }
141
- let t8;
142
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
143
- t8 = {
184
+ let t11;
185
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
186
+ t11 = {
144
187
  announceUpdate,
145
- expandedStateCache
188
+ expandedStateCache,
189
+ scrollElementIntoView
146
190
  };
147
- $[7] = t8;
191
+ $[10] = t11;
148
192
  } else {
149
- t8 = $[7];
193
+ t11 = $[10];
150
194
  }
151
- let t9;
152
- if ($[8] !== ariaLiveMessage) {
153
- t9 = /*#__PURE__*/jsx(VisuallyHidden, {
195
+ let t12;
196
+ if ($[11] !== ariaLiveMessage) {
197
+ t12 = /*#__PURE__*/jsx(VisuallyHidden, {
154
198
  children: /*#__PURE__*/jsx(AriaStatus, {
155
199
  announceOnShow: true,
156
200
  children: ariaLiveMessage
157
201
  })
158
202
  });
159
- $[8] = ariaLiveMessage;
160
- $[9] = t9;
203
+ $[11] = ariaLiveMessage;
204
+ $[12] = t12;
161
205
  } else {
162
- t9 = $[9];
163
- }
164
- const t10 = truncate || false;
165
- let t11;
166
- if ($[10] !== className) {
167
- t11 = clsx(className, classes.TreeViewRootUlStyles);
168
- $[10] = className;
169
- $[11] = t11;
206
+ t12 = $[12];
207
+ }
208
+ const t13 = truncate || false;
209
+ let t14;
210
+ if ($[13] !== className) {
211
+ t14 = clsx(className, classes.TreeViewRootUlStyles);
212
+ $[13] = className;
213
+ $[14] = t14;
170
214
  } else {
171
- t11 = $[11];
215
+ t14 = $[14];
172
216
  }
173
- let t12;
174
- if ($[12] !== ariaLabel || $[13] !== ariaLabelledby || $[14] !== children || $[15] !== flat || $[16] !== style || $[17] !== t10 || $[18] !== t11) {
175
- t12 = /*#__PURE__*/jsx("ul", {
217
+ let t15;
218
+ if ($[15] !== ariaLabel || $[16] !== ariaLabelledby || $[17] !== children || $[18] !== flat || $[19] !== style || $[20] !== t13 || $[21] !== t14) {
219
+ t15 = /*#__PURE__*/jsx("ul", {
176
220
  ref: containerRef,
177
221
  role: "tree",
178
222
  "aria-label": ariaLabel,
179
223
  "aria-labelledby": ariaLabelledby,
180
224
  "data-omit-spacer": flat,
181
- "data-truncate-text": t10,
225
+ "data-truncate-text": t13,
182
226
  onMouseDown: onMouseDown,
183
- className: t11,
227
+ className: t14,
184
228
  style: style,
185
229
  children: children
186
230
  });
187
- $[12] = ariaLabel;
188
- $[13] = ariaLabelledby;
189
- $[14] = children;
190
- $[15] = flat;
191
- $[16] = style;
192
- $[17] = t10;
193
- $[18] = t11;
194
- $[19] = t12;
231
+ $[15] = ariaLabel;
232
+ $[16] = ariaLabelledby;
233
+ $[17] = children;
234
+ $[18] = flat;
235
+ $[19] = style;
236
+ $[20] = t13;
237
+ $[21] = t14;
238
+ $[22] = t15;
195
239
  } else {
196
- t12 = $[19];
240
+ t15 = $[22];
197
241
  }
198
- let t13;
199
- if ($[20] !== t12 || $[21] !== t9) {
200
- t13 = /*#__PURE__*/jsx(RootContext.Provider, {
201
- value: t8,
242
+ let t16;
243
+ if ($[23] !== t12 || $[24] !== t15) {
244
+ t16 = /*#__PURE__*/jsx(RootContext.Provider, {
245
+ value: t11,
202
246
  children: /*#__PURE__*/jsxs(Fragment, {
203
- children: [t9, t12]
247
+ children: [t12, t15]
204
248
  })
205
249
  });
206
- $[20] = t12;
207
- $[21] = t9;
208
- $[22] = t13;
250
+ $[23] = t12;
251
+ $[24] = t15;
252
+ $[25] = t16;
209
253
  } else {
210
- t13 = $[22];
254
+ t16 = $[25];
211
255
  }
212
- return t13;
256
+ return t16;
213
257
  };
214
258
  Root.displayName = 'TreeView';
215
259
 
@@ -236,7 +280,8 @@ const Item = /*#__PURE__*/React.forwardRef(({
236
280
  trailingVisual: TrailingVisual
237
281
  });
238
282
  const {
239
- expandedStateCache
283
+ expandedStateCache,
284
+ scrollElementIntoView
240
285
  } = React.useContext(RootContext);
241
286
  const labelId = useId();
242
287
  const leadingVisualId = useId();
@@ -357,12 +402,9 @@ const Item = /*#__PURE__*/React.forwardRef(({
357
402
  "data-has-leading-action": slots.leadingAction ? true : undefined,
358
403
  onKeyDown: handleKeyDown,
359
404
  onFocus: event_1 => {
360
- var _event_1$currentTarge;
361
- // Scroll the first child into view when the item receives focus
362
- (_event_1$currentTarge = event_1.currentTarget.firstElementChild) === null || _event_1$currentTarge === void 0 ? void 0 : _event_1$currentTarge.scrollIntoView({
363
- block: 'nearest',
364
- inline: 'nearest'
365
- });
405
+ // Defer scroll to the next animation frame so that rapid keyboard
406
+ // navigation (held key) coalesces into a single reflow per frame
407
+ scrollElementIntoView(event_1.currentTarget.firstElementChild);
366
408
 
367
409
  // Set the focused state
368
410
  setIsFocused(true);
@@ -5,6 +5,20 @@ export declare function useRovingTabIndex({ containerRef, mouseDownRef, }: {
5
5
  }): void;
6
6
  export declare function getNextFocusableElement(activeElement: HTMLElement, event: KeyboardEvent): HTMLElement | undefined;
7
7
  export declare function getElementState(element: HTMLElement): 'open' | 'closed' | 'end';
8
+ /**
9
+ * Find the next or previous visible treeitem using direct DOM traversal.
10
+ *
11
+ * PERFORMANCE: This is O(tree depth) instead of O(n) because it walks
12
+ * siblings and parent/child edges directly, rather than creating a TreeWalker
13
+ * that scans from the root to find the current element on every keystroke.
14
+ *
15
+ * NOTE: This relies on TreeView.SubTree unmounting its children when collapsed
16
+ * (returning null when !isExpanded). Because collapsed subtree children are
17
+ * never in the DOM, we can safely skip them by only entering children of nodes
18
+ * with aria-expanded="true". If SubTree ever changes to keep collapsed children
19
+ * mounted (e.g. via CSS display:none), this logic would need to add filtering
20
+ * for items inside collapsed parents.
21
+ */
8
22
  export declare function getVisibleElement(element: HTMLElement, direction: 'next' | 'previous'): HTMLElement | undefined;
9
23
  export declare function getFirstChildElement(element: HTMLElement): HTMLElement | undefined;
10
24
  export declare function getParentElement(element: HTMLElement): HTMLElement | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useRovingTabIndex.d.ts","sourceRoot":"","sources":["../../src/TreeView/useRovingTabIndex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,wBAAgB,iBAAiB,CAAC,EAChC,YAAY,EACZ,YAAY,GACb,EAAE;IACD,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;IAC1C,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;CACvC,QAwDA;AAID,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,GAAG,WAAW,GAAG,SAAS,CAyDjH;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,QAAQ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G,WAAW,GAAG,SAAS,CAI9E;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAI7E;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAuB5E"}
@@ -123,25 +123,103 @@ function getElementState(element) {
123
123
  return 'end';
124
124
  }
125
125
  }
126
+
127
+ /**
128
+ * Find the next or previous visible treeitem using direct DOM traversal.
129
+ *
130
+ * PERFORMANCE: This is O(tree depth) instead of O(n) because it walks
131
+ * siblings and parent/child edges directly, rather than creating a TreeWalker
132
+ * that scans from the root to find the current element on every keystroke.
133
+ *
134
+ * NOTE: This relies on TreeView.SubTree unmounting its children when collapsed
135
+ * (returning null when !isExpanded). Because collapsed subtree children are
136
+ * never in the DOM, we can safely skip them by only entering children of nodes
137
+ * with aria-expanded="true". If SubTree ever changes to keep collapsed children
138
+ * mounted (e.g. via CSS display:none), this logic would need to add filtering
139
+ * for items inside collapsed parents.
140
+ */
126
141
  function getVisibleElement(element, direction) {
127
- const root = element.closest('[role=tree]');
128
- if (!root) return;
129
- const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, node => {
130
- if (!(node instanceof HTMLElement)) return NodeFilter.FILTER_SKIP;
131
- return node.getAttribute('role') === 'treeitem' ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
132
- });
133
- let current = walker.firstChild();
134
- while (current !== element) {
135
- current = walker.nextNode();
136
- }
137
- let next = direction === 'next' ? walker.nextNode() : walker.previousNode();
142
+ if (direction === 'next') {
143
+ return getNextVisibleElement(element);
144
+ }
145
+ return getPreviousVisibleElement(element);
146
+ }
147
+ function getNextVisibleElement(element) {
148
+ // If the current item is expanded, the next visible item is its first child
149
+ if (element.getAttribute('aria-expanded') === 'true') {
150
+ const firstChild = getFirstChildElement(element);
151
+ if (firstChild) return firstChild;
152
+ }
153
+
154
+ // Otherwise, walk up the tree looking for a next sibling
155
+ let current = element;
156
+ while (current) {
157
+ const next = getNextSiblingTreeItem(current);
158
+ if (next) return next;
138
159
 
139
- // If next element is nested inside a collapsed subtree, continue iterating
140
- while (next instanceof HTMLElement && (_next$parentElement = next.parentElement) !== null && _next$parentElement !== void 0 && _next$parentElement.closest('[role=treeitem][aria-expanded=false]')) {
141
- var _next$parentElement;
142
- next = direction === 'next' ? walker.nextNode() : walker.previousNode();
160
+ // No next sibling at this level, try the parent's next sibling
161
+ current = getParentElement(current);
162
+ }
163
+ return undefined;
164
+ }
165
+ function getPreviousVisibleElement(element) {
166
+ const prev = getPreviousSiblingTreeItem(element);
167
+ if (prev) {
168
+ // Navigate to the deepest last visible descendant of the previous sibling
169
+ return getDeepestLastDescendant(prev);
170
+ }
171
+
172
+ // No previous sibling, the parent is the previous visible element
173
+ return getParentElement(element);
174
+ }
175
+
176
+ /**
177
+ * Walk into expanded subtrees to find the deepest last visible descendant.
178
+ * For example, if the last sibling is an expanded directory whose last child
179
+ * is also an expanded directory, we drill all the way down.
180
+ */
181
+ function getDeepestLastDescendant(element) {
182
+ let current = element;
183
+ while (current.getAttribute('aria-expanded') === 'true') {
184
+ const lastChild = getLastChildTreeItem(current);
185
+ if (!lastChild) break;
186
+ current = lastChild;
187
+ }
188
+ return current;
189
+ }
190
+ function getNextSiblingTreeItem(element) {
191
+ let sibling = element.nextElementSibling;
192
+ while (sibling) {
193
+ if (sibling instanceof HTMLElement && sibling.getAttribute('role') === 'treeitem') {
194
+ return sibling;
195
+ }
196
+ sibling = sibling.nextElementSibling;
197
+ }
198
+ return undefined;
199
+ }
200
+ function getPreviousSiblingTreeItem(element) {
201
+ let sibling = element.previousElementSibling;
202
+ while (sibling) {
203
+ if (sibling instanceof HTMLElement && sibling.getAttribute('role') === 'treeitem') {
204
+ return sibling;
205
+ }
206
+ sibling = sibling.previousElementSibling;
207
+ }
208
+ return undefined;
209
+ }
210
+ function getLastChildTreeItem(element) {
211
+ // Find the [role=group] child (the subtree container), then get its last treeitem
212
+ for (let i = element.children.length - 1; i >= 0; i--) {
213
+ const child = element.children[i];
214
+ if (child instanceof HTMLElement && child.getAttribute('role') === 'group') {
215
+ let lastChild = child.lastElementChild;
216
+ while (lastChild && !(lastChild instanceof HTMLElement && lastChild.getAttribute('role') === 'treeitem')) {
217
+ lastChild = lastChild.previousElementSibling;
218
+ }
219
+ return lastChild instanceof HTMLElement ? lastChild : undefined;
220
+ }
143
221
  }
144
- return next instanceof HTMLElement ? next : undefined;
222
+ return undefined;
145
223
  }
146
224
  function getFirstChildElement(element) {
147
225
  const firstChild = element.querySelector('[role=treeitem]');
@@ -1 +1 @@
1
- {"version":3,"file":"character-counter.d.ts","sourceRoot":"","sources":["../../src/utils/character-counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7E,sBAAsB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAClD;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,aAAa,CAAgB;gBAEzB,SAAS,EAAE,yBAAyB;IAIhD;;OAEG;IACH,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAyBpE;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAc9B;;OAEG;IACH,OAAO,IAAI,IAAI;CAKhB"}
1
+ {"version":3,"file":"character-counter.d.ts","sourceRoot":"","sources":["../../src/utils/character-counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7E,sBAAsB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAClD;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,aAAa,CAAgB;gBAEzB,SAAS,EAAE,yBAAyB;IAIhD;;OAEG;IACH,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IA0BpE;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAc9B;;OAEG;IACH,OAAO,IAAI,IAAI;CAKhB"}
@@ -16,6 +16,7 @@ class CharacterCounter {
16
16
  */
17
17
  updateCharacterCount(currentLength, maxLength) {
18
18
  const charactersRemaining = maxLength - currentLength;
19
+ // eslint-disable-next-line no-useless-assignment
19
20
  let message = '';
20
21
  if (charactersRemaining >= 0) {
21
22
  const characterText = charactersRemaining === 1 ? 'character' : 'characters';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260312192556",
4
+ "version": "0.0.0-20260312204752",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -1,2 +0,0 @@
1
- .prc-ActionBar-List-9uz46{align-items:flex-start;animation:prc-ActionBar-detect-overflow-mAuJu linear;display:flex;gap:var(--actionbar-gap,var(--stack-gap-condensed,.5rem));height:var(--actionbar-height);list-style:none;margin-bottom:-1px;min-width:0;overflow:hidden;position:relative;white-space:nowrap;animation-timeline:scroll(self block);--actionbar-height:var(--control-small-size,1.75rem);--morebutton-display:none}.prc-ActionBar-List-9uz46[data-has-overflow=true]{--morebutton-display:block}.prc-ActionBar-List-9uz46:where([data-size=medium]){--actionbar-height:var(--control-medium-size,2rem)}.prc-ActionBar-List-9uz46:where([data-size=large]){--actionbar-height:var(--control-large-size,2.5rem)}.prc-ActionBar-List-9uz46:where([data-gap=none]){--actionbar-gap:0}.prc-ActionBar-List-9uz46:where([data-gap=none]) .prc-ActionBar-Divider-6V8yH{padding:0 var(--base-size-8,.5rem)}.prc-ActionBar-List-9uz46:where([data-gap=condensed]){--actionbar-gap:var(--stack-gap-condensed,0.5rem)}.prc-ActionBar-List-9uz46 [data-overflowing]{visibility:hidden!important}@keyframes prc-ActionBar-detect-overflow-mAuJu{0%,to{--morebutton-display:block}}.prc-ActionBar-Nav-9spON{align-items:center;display:flex;justify-content:flex-end;padding-inline:var(--base-size-16,1rem)}.prc-ActionBar-Nav-9spON:where([data-flush=true]){padding-inline:0}.prc-ActionBar-Divider-6V8yH:before{background:var(--borderColor-muted,var(--color-border-muted));content:"";display:block;height:var(--base-size-20,1.25rem);margin-top:calc((var(--actionbar-height) - var(--base-size-20,1.25rem))/2);width:var(--borderWidth-thin,.0625rem)}.prc-ActionBar-Group-peNCk,.prc-ActionBar-OverflowContainer-AkYZs{display:flex;gap:inherit}.prc-ActionBar-OverflowContainer-AkYZs{flex-wrap:wrap;justify-content:flex-end}.prc-ActionBar-MoreButton-RHqpx{display:var(--morebutton-display)}
2
- /*# sourceMappingURL=ActionBar-f2b70d1d.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/ActionBar/ActionBar.module.css.js"],"names":[],"mappings":"AAAA,0BAUE,sBAAuB,CAUvB,oDAAiC,CAlBjC,YAAa,CASb,yDAAqD,CAErD,8BAA+B,CAJ/B,eAAgB,CAFhB,kBAAmB,CAJnB,WAAY,CASZ,eAAgB,CAXhB,iBAAkB,CAOlB,kBAAmB,CAanB,qCAAsC,CAEtC,oDAA6C,CAC7C,yBAkCF,CAhCE,kDAEE,0BACF,CAEA,oDACE,kDACF,CAEA,mDACE,mDACF,CAGA,iDACE,iBAKF,CAHE,8EACE,kCACF,CAGF,sDACE,iDACF,CAEA,6CAIE,2BACF,CAGF,+CACE,MAEE,0BACF,CACF,CAEA,yBAIE,kBAAmB,CAHnB,YAAa,CAEb,wBAAyB,CADzB,uCAOF,CAHE,kDACE,gBACF,CAIA,oCAME,6DAAoC,CAFpC,UAAW,CAHX,aAAc,CAEd,kCAA2B,CAK3B,0EAAqE,CANrE,sCAOF,CAQF,kEAJE,YAAa,CACb,WAQF,CALA,uCAEE,cAAe,CAEf,wBACF,CAEA,gCACE,iCACF","file":"ActionBar-f2b70d1d.css","sourcesContent":[".List {\n position: relative;\n display: flex;\n min-width: 0;\n\n /* wonder why this is here */\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: -1px;\n white-space: nowrap;\n list-style: none;\n align-items: flex-start;\n gap: var(--actionbar-gap, var(--stack-gap-condensed));\n overflow: hidden;\n height: var(--actionbar-height);\n\n /* Scroll-based animations have no effect unless the container is scrollable (has overflow, even with overflow:hidden)\n so we can use them to detect overflow. This allows us to use pure CSS to show/hide the menu button on suported\n browsers, reducing layout shift and improving performance. On unsupported browsers we still rely on just JS via\n `data-overflowing`. It would be cleaner to use scroll-state container queries for this, but browser support for\n scroll-driven animations is slightly better. */\n animation: detect-overflow linear;\n animation-timeline: scroll(self block);\n\n --actionbar-height: var(--control-small-size);\n --morebutton-display: none;\n\n &[data-has-overflow='true'] {\n /* Progressive enhancement: show overflow button on browsers that don't support scroll-driven animations */\n --morebutton-display: block;\n }\n\n &:where([data-size='medium']) {\n --actionbar-height: var(--control-medium-size);\n }\n\n &:where([data-size='large']) {\n --actionbar-height: var(--control-large-size);\n }\n\n /* Gap scale (mirrors Stack) */\n &:where([data-gap='none']) {\n --actionbar-gap: 0;\n\n .Divider {\n padding: 0 var(--base-size-8);\n }\n }\n\n &:where([data-gap='condensed']) {\n --actionbar-gap: var(--stack-gap-condensed);\n }\n\n [data-overflowing] {\n /* Hide overflowing items. Even though they are clipped by `overflow: hidden`, setting `visibility: hidden` ensures\n they can't accidentally be shown and also hides them from screen readers / keyboard nav. `!important` prevents\n consumers from unintentionally overriding this and breaking accessibility. */\n visibility: hidden !important;\n }\n}\n\n@keyframes detect-overflow {\n 0%,\n 100% {\n --morebutton-display: block;\n }\n}\n\n.Nav {\n display: flex;\n padding-inline: var(--base-size-16);\n justify-content: flex-end;\n align-items: center;\n\n &:where([data-flush='true']) {\n padding-inline: 0;\n }\n}\n\n.Divider {\n &::before {\n display: block;\n width: var(--borderWidth-thin);\n height: var(--base-size-20);\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background: var(--borderColor-muted);\n /* stylelint-disable-next-line primer/spacing */\n margin-top: calc((var(--actionbar-height) - var(--base-size-20)) / 2);\n }\n}\n\n.Group {\n display: flex;\n gap: inherit;\n}\n\n.OverflowContainer {\n display: flex;\n flex-wrap: wrap;\n gap: inherit;\n justify-content: flex-end;\n}\n\n.MoreButton {\n display: var(--morebutton-display);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/Overlay/Overlay.module.css.js"],"names":[],"mappings":"AAAA,4CACE,GACE,SACF,CAEA,GACE,SACF,CACF,CAEA,2BAQE,mEAAwC,CACxC,8CAAwC,CASxC,yBAA2B,CAR3B,mEAAwC,CALxC,WAAY,CASZ,qBAAuB,CARvB,gBAAiB,CAJjB,4BAA6B,CAE7B,eAAgB,CAGhB,aAAc,CANd,iBAAkB,CAelB,uBAAyB,CAJzB,mBAAqB,CATrB,UA8KF,CA7JE,iCACE,YACF,CAEA,8BAxBF,2BA0BI,6BAuJJ,CAtJE,CAEA,+DACE,4BACF,CAEA,uDACE,aACF,CAEA,yDACE,eACF,CAEA,yDACE,eACF,CAEA,0DACE,gBACF,CAEA,uDACE,YACF,CAEA,sDACE,YACF,CAEA,uDACE,YACF,CAEA,sDACE,YACF,CAEA,uDACE,YACF,CAEA,6GAEE,WACF,CAEA,4DACE,uBAAmB,CAAnB,kBACF,CAEA,2DACE,gBACF,CAEA,0DACE,gBACF,CAEA,2DACE,gBACF,CAEA,0DACE,gBACF,CAEA,2DACE,gBACF,CAEA,gEACE,2BAAuB,CAAvB,sBACF,CAEA,qDACE,WACF,CAEA,sDACE,WACF,CAEA,qDAEE,WACF,CAEA,sDAEE,WACF,CAEA,uDAEE,WACF,CAEA,oDACE,UACF,CAEA,yDACE,eACF,CAEA,0DACE,eACF,CAEA,yDACE,eACF,CAEA,0DACE,eACF,CAEA,2DACE,eACF,CAEA,4DACE,kBACF,CAEA,2DACE,iBACF,CAGE,mDADF,+DAUI,mBAAoB,CAHpB,YAAa,CAHb,MAAO,CAKP,QAAS,CADT,eAAgB,CAFhB,cAAe,CAJf,cAAe,CACf,KAAM,CAEN,WAOJ,CADE,CAGF,0BAEE,4DACE,aACF,CACF,CAGF,8CACE,2BACE,wEACF,CACF","file":"Overlay-15519c09.css","sourcesContent":["@keyframes overlay-appear {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.Overlay {\n position: absolute;\n max-width: calc(100vw - 2rem);\n width: auto;\n min-width: 192px;\n height: auto;\n max-height: 100vh;\n overflow: auto;\n background-color: var(--overlay-bgColor);\n border-radius: var(--borderRadius-large);\n box-shadow: var(--shadow-floating-small);\n /* stylelint-disable-next-line primer/spacing */\n top: var(--top, auto);\n /* stylelint-disable-next-line primer/spacing */\n left: var(--left, auto);\n /* stylelint-disable-next-line primer/spacing */\n right: var(--right, auto);\n /* stylelint-disable-next-line primer/spacing */\n bottom: var(--bottom, auto);\n\n &:focus {\n outline: none;\n }\n\n @media (forced-colors: active) {\n /* Support for Windows high contrast https://sarahmhigley.com/writing/whcm-quick-tips */\n outline: solid 1px transparent;\n }\n\n &:where([data-reflow-container='true']) {\n max-width: calc(100vw - 2rem);\n }\n\n &:where([data-overflow-auto]) {\n overflow: auto;\n }\n\n &:where([data-overflow-hidden]) {\n overflow: hidden;\n }\n\n &:where([data-overflow-scroll]) {\n overflow: scroll;\n }\n\n &:where([data-overflow-visible]) {\n overflow: visible;\n }\n\n &:where([data-height-xsmall]) {\n height: 192px;\n }\n\n &:where([data-height-small]) {\n height: 256px;\n }\n\n &:where([data-height-medium]) {\n height: 320px;\n }\n\n &:where([data-height-large]) {\n height: 432px;\n }\n\n &:where([data-height-xlarge]) {\n height: 600px;\n }\n\n &:where([data-height-auto]),\n &:where([data-height-initial]) {\n height: auto;\n }\n\n &:where([data-height-fit-content]) {\n height: fit-content;\n }\n\n &:where([data-max-height-xsmall]) {\n max-height: 192px;\n }\n\n &:where([data-max-height-small]) {\n max-height: 256px;\n }\n\n &:where([data-max-height-medium]) {\n max-height: 320px;\n }\n\n &:where([data-max-height-large]) {\n max-height: 432px;\n }\n\n &:where([data-max-height-xlarge]) {\n max-height: 600px;\n }\n\n &:where([data-max-height-fit-content]) {\n max-height: fit-content;\n }\n\n &:where([data-width-small]) {\n width: 256px;\n }\n\n &:where([data-width-medium]) {\n width: 320px;\n }\n\n &:where([data-width-large]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 480px;\n }\n\n &:where([data-width-xlarge]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 640px;\n }\n\n &:where([data-width-xxlarge]) {\n /* stylelint-disable-next-line primer/responsive-widths */\n width: 960px;\n }\n\n &:where([data-width-auto]) {\n width: auto;\n }\n\n &:where([data-max-width-small]) {\n max-width: 256px;\n }\n\n &:where([data-max-width-medium]) {\n max-width: 320px;\n }\n\n &:where([data-max-width-large]) {\n max-width: 480px;\n }\n\n &:where([data-max-width-xlarge]) {\n max-width: 640px;\n }\n\n &:where([data-max-width-xxlarge]) {\n max-width: 960px;\n }\n\n &:where([data-visibility-visible]) {\n visibility: visible;\n }\n\n &:where([data-visibility-hidden]) {\n visibility: hidden;\n }\n\n &:where([data-responsive='fullscreen']) {\n @media screen and (--viewportRange-narrow) {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n max-width: none;\n height: 100vh;\n max-height: none;\n margin: 0;\n border-radius: unset;\n }\n }\n\n @supports (height: 100dvh) {\n /* fix for mobile safari (100vh clips the screen with the toolbar) */\n &:where([data-variant='fullscreen']) {\n height: 100dvh;\n }\n }\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .Overlay {\n animation: overlay-appear 200ms cubic-bezier(0.33, 1, 0.68, 1);\n }\n}\n"]}