@primer/react 38.20.0-rc.8b2ab1a0a → 38.20.0-rc.b9447348d

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 CHANGED
@@ -8,8 +8,6 @@
8
8
 
9
9
  - [#7725](https://github.com/primer/react/pull/7725) [`d7b9313`](https://github.com/primer/react/commit/d7b9313b53e370e258c152084ac1f0402d64b77f) Thanks [@TylerJDev](https://github.com/TylerJDev)! - AnchoredOverlay: Remove polyfill for CSS Anchor Positioning, use primer/behaviors as fallback. Ensure overlays take available space.
10
10
 
11
- - [#7752](https://github.com/primer/react/pull/7752) [`d7380a7`](https://github.com/primer/react/commit/d7380a7616a6c0cf861b5fe3dd9bd8d76470ca2e) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Breadcrumbs: Graduate `primer_react_breadcrumbs_overflow_menu` feature flag, making the overflow menu behavior always-on.
12
-
13
11
  - [#7733](https://github.com/primer/react/pull/7733) [`b9211db`](https://github.com/primer/react/commit/b9211db173841c9d9a531c777c5ce2c0cd8af60f) Thanks [@francinelucca](https://github.com/francinelucca)! - Overlay: Graduate `primer_react_overlay_max_height_clamp_to_viewport` feature flag
14
12
 
15
13
  The max-height of overlays is now clamped to the viewport height by default using `min(size, 100dvh)`. This prevents overlays from extending beyond the viewport on smaller screens.
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,SAAS,CAAA;AAC/B,OAAO,KAA6E,MAAM,OAAO,CAAA;AAUjG,OAAO,EAAC,KAAK,gBAAgB,EAAkB,MAAM,6BAA6B,CAAA;AAElF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,QAA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MAAM,mBAAmB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,IAAI,oBAAoB,CAAC,EAAE,CAAC,CAAA"}
@@ -10,6 +10,7 @@ import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
10
10
  import { useOnOutsideClick } from '../hooks/useOnOutsideClick.js';
11
11
  import { fixedForwardRef } from '../utils/modern-polymorphic.js';
12
12
  import { jsx, jsxs } from 'react/jsx-runtime';
13
+ import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
13
14
  import Details from '../Details/Details.js';
14
15
 
15
16
  const BreadcrumbsList = t0 => {
@@ -212,6 +213,11 @@ function Breadcrumbs({
212
213
  overflow = 'wrap',
213
214
  variant = 'normal'
214
215
  }) {
216
+ const overflowMenuEnabled = useFeatureFlag('primer_react_breadcrumbs_overflow_menu');
217
+ const wrappedChildren = React.Children.map(children, child => /*#__PURE__*/jsx("li", {
218
+ className: classes.ItemWrapper,
219
+ children: child
220
+ }));
215
221
  const containerRef = useRef(null);
216
222
  const measureMenuButton = useCallback(element => {
217
223
  if (element) {
@@ -240,13 +246,13 @@ function Breadcrumbs({
240
246
  useEffect(() => {
241
247
  var _containerRef$current;
242
248
  const listElement = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector('ol');
243
- if (listElement && listElement.children.length > 0 && listElement.children.length === childArray.length) {
249
+ if (overflowMenuEnabled && listElement && listElement.children.length > 0 && listElement.children.length === childArray.length) {
244
250
  const listElementArray = Array.from(listElement.children);
245
- const widths = listElementArray.map(child => child.offsetWidth);
251
+ const widths = listElementArray.map(child_0 => child_0.offsetWidth);
246
252
  setChildArrayWidths(widths);
247
253
  setRootItemWidth(listElementArray[0].offsetWidth);
248
254
  }
249
- }, [childArray]);
255
+ }, [childArray, overflowMenuEnabled]);
250
256
  const calculateOverflow = useCallback(availableWidth => {
251
257
  let eHideRoot = effectiveHideRoot;
252
258
  const MENU_BUTTON_WIDTH = menuButtonWidth;
@@ -291,7 +297,7 @@ function Breadcrumbs({
291
297
  };
292
298
  }, [childArray, childArrayWidths, effectiveHideRoot, hideRoot, overflow, rootItemWidth, menuButtonWidth]);
293
299
  const handleResize = useCallback(entries => {
294
- if (entries[0]) {
300
+ if (overflowMenuEnabled && entries[0]) {
295
301
  const containerWidth = entries[0].contentRect.width;
296
302
  const result = calculateOverflow(containerWidth);
297
303
  if (visibleItems.length !== result.visibleItems.length && menuItems.length !== result.menuItems.length || result.effectiveHideRoot !== effectiveHideRoot) {
@@ -300,10 +306,10 @@ function Breadcrumbs({
300
306
  setEffectiveHideRoot(result.effectiveHideRoot);
301
307
  }
302
308
  }
303
- }, [calculateOverflow, effectiveHideRoot, menuItems.length, visibleItems.length]);
309
+ }, [calculateOverflow, effectiveHideRoot, menuItems.length, overflowMenuEnabled, visibleItems.length]);
304
310
  useResizeObserver(handleResize, containerRef);
305
311
  useEffect(() => {
306
- if ((overflow === 'menu' || overflow === 'menu-with-root') && childArray.length > 5 && menuItems.length === 0) {
312
+ if (overflowMenuEnabled && (overflow === 'menu' || overflow === 'menu-with-root') && childArray.length > 5 && menuItems.length === 0) {
307
313
  var _containerRef$current2;
308
314
  const containerWidth_0 = ((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetWidth) || 800;
309
315
  const result_0 = calculateOverflow(containerWidth_0);
@@ -311,44 +317,46 @@ function Breadcrumbs({
311
317
  setMenuItems(result_0.menuItems);
312
318
  setEffectiveHideRoot(result_0.effectiveHideRoot);
313
319
  }
314
- }, [overflow, childArray, calculateOverflow, menuItems.length]);
320
+ }, [overflow, childArray, calculateOverflow, menuItems.length, overflowMenuEnabled]);
315
321
  const finalChildren = React.useMemo(() => {
316
- if (overflow === 'wrap' || menuItems.length === 0) {
317
- return React.Children.map(children, child_0 => /*#__PURE__*/jsx("li", {
318
- className: classes.ItemWrapper,
319
- children: child_0
320
- }));
321
- }
322
- let effectiveMenuItems = [...menuItems];
323
- // In 'menu-with-root' mode, include the root item inside the menu even if it's visible in the breadcrumbs
324
- if (!effectiveHideRoot) {
325
- effectiveMenuItems = [...menuItems.slice(1)];
326
- }
327
- const menuElement = /*#__PURE__*/jsxs("li", {
328
- className: classes.BreadcrumbsItem,
329
- children: [/*#__PURE__*/jsx(BreadcrumbsMenuItem, {
330
- ref: measureMenuButton,
331
- items: effectiveMenuItems,
332
- "aria-label": `${effectiveMenuItems.length} more breadcrumb items`
333
- }), /*#__PURE__*/jsx(ItemSeparator, {})]
334
- }, "breadcrumbs-menu");
335
- const visibleElements = visibleItems.map((child_1, index) => /*#__PURE__*/jsxs("li", {
336
- className: classes.BreadcrumbsItem,
337
- children: [child_1, /*#__PURE__*/jsx(ItemSeparator, {})]
338
- }, `visible + ${index}`));
339
- const rootElement = /*#__PURE__*/jsxs("li", {
340
- className: classes.BreadcrumbsItem,
341
- children: [rootItem, /*#__PURE__*/jsx(ItemSeparator, {})]
342
- }, `rootElement`);
343
- if (effectiveHideRoot) {
344
- // Show: [overflow menu, leaf breadcrumb]
345
- return [menuElement, ...visibleElements];
346
- } else {
347
- // Show: [root breadcrumb, overflow menu, leaf breadcrumb]
348
- return [rootElement, menuElement, ...visibleElements];
322
+ if (overflowMenuEnabled) {
323
+ if (overflow === 'wrap' || menuItems.length === 0) {
324
+ return React.Children.map(children, child_1 => /*#__PURE__*/jsx("li", {
325
+ className: classes.ItemWrapper,
326
+ children: child_1
327
+ }));
328
+ }
329
+ let effectiveMenuItems = [...menuItems];
330
+ // In 'menu-with-root' mode, include the root item inside the menu even if it's visible in the breadcrumbs
331
+ if (!effectiveHideRoot) {
332
+ effectiveMenuItems = [...menuItems.slice(1)];
333
+ }
334
+ const menuElement = /*#__PURE__*/jsxs("li", {
335
+ className: classes.BreadcrumbsItem,
336
+ children: [/*#__PURE__*/jsx(BreadcrumbsMenuItem, {
337
+ ref: measureMenuButton,
338
+ items: effectiveMenuItems,
339
+ "aria-label": `${effectiveMenuItems.length} more breadcrumb items`
340
+ }), /*#__PURE__*/jsx(ItemSeparator, {})]
341
+ }, "breadcrumbs-menu");
342
+ const visibleElements = visibleItems.map((child_2, index) => /*#__PURE__*/jsxs("li", {
343
+ className: classes.BreadcrumbsItem,
344
+ children: [child_2, /*#__PURE__*/jsx(ItemSeparator, {})]
345
+ }, `visible + ${index}`));
346
+ const rootElement = /*#__PURE__*/jsxs("li", {
347
+ className: classes.BreadcrumbsItem,
348
+ children: [rootItem, /*#__PURE__*/jsx(ItemSeparator, {})]
349
+ }, `rootElement`);
350
+ if (effectiveHideRoot) {
351
+ // Show: [overflow menu, leaf breadcrumb]
352
+ return [menuElement, ...visibleElements];
353
+ } else {
354
+ // Show: [root breadcrumb, overflow menu, leaf breadcrumb]
355
+ return [rootElement, menuElement, ...visibleElements];
356
+ }
349
357
  }
350
- }, [overflow, menuItems, effectiveHideRoot, measureMenuButton, visibleItems, rootItem, children]);
351
- return /*#__PURE__*/jsx("nav", {
358
+ }, [overflowMenuEnabled, overflow, menuItems, effectiveHideRoot, measureMenuButton, visibleItems, rootItem, children]);
359
+ return overflowMenuEnabled ? /*#__PURE__*/jsx("nav", {
352
360
  className: clsx(className, classes.BreadcrumbsBase),
353
361
  "aria-label": "Breadcrumbs",
354
362
  style: style,
@@ -358,9 +366,16 @@ function Breadcrumbs({
358
366
  children: /*#__PURE__*/jsx(BreadcrumbsList, {
359
367
  children: finalChildren
360
368
  })
369
+ }) : /*#__PURE__*/jsx("nav", {
370
+ className: clsx(className, classes.BreadcrumbsBase),
371
+ "aria-label": "Breadcrumbs",
372
+ style: style,
373
+ "data-variant": variant,
374
+ children: /*#__PURE__*/jsx(BreadcrumbsList, {
375
+ children: wrappedChildren
376
+ })
361
377
  });
362
378
  }
363
- Breadcrumbs.displayName = "Breadcrumbs";
364
379
  const ItemSeparator = () => {
365
380
  const $ = c(1);
366
381
  let t0;
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,kBAK9B,CAAA"}
1
+ {"version":3,"file":"DefaultFeatureFlags.d.ts","sourceRoot":"","sources":["../../src/FeatureFlags/DefaultFeatureFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAEnD,eAAO,MAAM,mBAAmB,kBAM9B,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import { FeatureFlagScope } from './FeatureFlagScope.js';
2
2
 
3
3
  const DefaultFeatureFlags = FeatureFlagScope.create({
4
+ primer_react_breadcrumbs_overflow_menu: false,
4
5
  primer_react_css_anchor_positioning: false,
5
6
  primer_react_select_panel_fullscreen_on_narrow: false,
6
7
  primer_react_select_panel_order_selected_at_top: false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.20.0-rc.8b2ab1a0a",
4
+ "version": "38.20.0-rc.b9447348d",
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",