@primer/react 38.36.0-rc.3fb350b1f → 38.36.0-rc.4403803d9

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.
@@ -133,15 +133,14 @@ const ActionBarIconButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...pr
133
133
  disabled,
134
134
  onClick
135
135
  ]));
136
- const clickHandler = useCallback((event) => {
137
- if (disabled) return;
138
- onClick === null || onClick === void 0 || onClick(event);
139
- }, [disabled, onClick]);
140
136
  return /*#__PURE__*/ jsx(IconButton, {
141
137
  "aria-disabled": disabled,
142
138
  ref: mergedRef,
143
139
  size,
144
- onClick: clickHandler,
140
+ onClick: useCallback((event) => {
141
+ if (disabled) return;
142
+ onClick === null || onClick === void 0 || onClick(event);
143
+ }, [disabled, onClick]),
145
144
  ...props,
146
145
  variant: "invisible",
147
146
  "data-overflowing": dataOverflowingAttr
@@ -164,15 +163,14 @@ const ActionBarButton = /*#__PURE__*/ forwardRef(({ disabled, onClick, ...props
164
163
  disabled,
165
164
  onClick
166
165
  ]));
167
- const clickHandler = useCallback((event) => {
168
- if (disabled) return;
169
- onClick === null || onClick === void 0 || onClick(event);
170
- }, [disabled, onClick]);
171
166
  return /*#__PURE__*/ jsx(ButtonComponent, {
172
167
  "aria-disabled": disabled,
173
168
  ref: mergedRef,
174
169
  size,
175
- onClick: clickHandler,
170
+ onClick: useCallback((event) => {
171
+ if (disabled) return;
172
+ onClick === null || onClick === void 0 || onClick(event);
173
+ }, [disabled, onClick]),
176
174
  ...props,
177
175
  variant: "invisible",
178
176
  "data-overflowing": dataOverflowingAttr
@@ -37,8 +37,7 @@ const Heading = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
37
37
  t1 = $[6];
38
38
  }
39
39
  const visuallyHidden = t1 === void 0 ? false : t1;
40
- const innerRef = React.useRef(null);
41
- const mergedRef = useMergedRefs(forwardedRef, innerRef);
40
+ const mergedRef = useMergedRefs(forwardedRef, React.useRef(null));
42
41
  const { headingId, variant: listVariant } = React.useContext(ListContext);
43
42
  const { container } = React.useContext(ActionListContainerContext);
44
43
  !(container !== "ActionMenu") && invariant(false, "ActionList.Heading shouldn't be used within an ActionMenu container. Menus are labelled by the menu button's name.");
@@ -11,14 +11,11 @@ const CounterLabel = /*#__PURE__*/ forwardRef(({ variant, scheme, className, chi
11
11
  ")"
12
12
  ] });
13
13
  const inferredVariant = variant || scheme || "secondary";
14
- const counterProps = {
14
+ return /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ jsx("span", {
15
15
  ref: forwardedRef,
16
16
  ["aria-hidden"]: "true",
17
17
  ["data-variant"]: inferredVariant,
18
- ...rest
19
- };
20
- return /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ jsx("span", {
21
- ...counterProps,
18
+ ...rest,
22
19
  "data-component": dataComponent !== null && dataComponent !== void 0 ? dataComponent : "CounterLabel",
23
20
  className: clsx(className, CounterLabel_module_css_default.CounterLabel),
24
21
  children
@@ -34,8 +34,7 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardRef) => {
34
34
  t1 = () => {
35
35
  const { current: details } = detailsRef;
36
36
  if (!details) return;
37
- const summary = details.querySelector("summary:not([data-default-summary])");
38
- warning(summary === null, "The <Details> component must have a <summary> child component. You can either use <Details.Summary> or a native <summary> element.");
37
+ warning(details.querySelector("summary:not([data-default-summary])") === null, "The <Details> component must have a <summary> child component. You can either use <Details.Summary> or a native <summary> element.");
39
38
  };
40
39
  t2 = [];
41
40
  $[5] = t1;
@@ -140,7 +140,7 @@ const _Dialog = /*#__PURE__*/ React.forwardRef((props, forwardedRef) => {
140
140
  });
141
141
  const footer = (_slots$footer = slots.footer) !== null && _slots$footer !== void 0 ? _slots$footer : (renderFooter !== null && renderFooter !== void 0 ? renderFooter : DefaultFooter)(defaultedProps);
142
142
  const hasFooter = footer != null;
143
- const updateFooterButtonLayout = useCallback(() => {
143
+ useResizeObserver(useCallback(() => {
144
144
  if (!hasFooter) return;
145
145
  const dialogElement = dialogRef.current;
146
146
  if (!(dialogElement instanceof HTMLElement)) return;
@@ -150,8 +150,7 @@ const _Dialog = /*#__PURE__*/ React.forwardRef((props, forwardedRef) => {
150
150
  const newLayout = bodyWrapper.clientHeight >= MIN_BODY_HEIGHT ? "wrap" : "scroll";
151
151
  dialogElement.setAttribute("data-footer-button-layout", newLayout);
152
152
  setFooterButtonLayout(newLayout);
153
- }, [hasFooter]);
154
- useResizeObserver(updateFooterButtonLayout, backdropRef);
153
+ }, [hasFooter]), backdropRef);
155
154
  const positionDataAttributes = typeof position === "string" ? { "data-position-regular": position } : Object.fromEntries(Object.entries(position).map(([key, value]) => {
156
155
  return [`data-position-${key}`, value];
157
156
  }));
@@ -72,8 +72,7 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
72
72
  if (/*#__PURE__*/ React.isValidElement(child_1) && (child_1.type === ContextArea || isSlot(child_1, ContextArea))) hasContextArea = true;
73
73
  if (/*#__PURE__*/ React.isValidElement(child_1) && (child_1.type === LeadingAction || isSlot(child_1, LeadingAction))) hasLeadingAction = true;
74
74
  }
75
- const hasInteractiveContent = Array.from(titleArea.childNodes).some((child_2) => child_2 instanceof HTMLElement && isInteractive(child_2) || Array.from(child_2.childNodes).some((child_3) => child_3 instanceof HTMLElement && isInteractive(child_3)));
76
- warning(hasInteractiveContent && (hasContextArea || hasLeadingAction), "When PageHeader.ContextArea or PageHeader.LeadingAction is present, we recommended not to include any interactive items in the PageHeader.TitleArea to make sure the focus order is logical.");
75
+ warning(Array.from(titleArea.childNodes).some((child_2) => child_2 instanceof HTMLElement && isInteractive(child_2) || Array.from(child_2.childNodes).some((child_3) => child_3 instanceof HTMLElement && isInteractive(child_3))) && (hasContextArea || hasLeadingAction), "When PageHeader.ContextArea or PageHeader.LeadingAction is present, we recommended not to include any interactive items in the PageHeader.TitleArea to make sure the focus order is logical.");
77
76
  };
78
77
  t3 = [children, readRef];
79
78
  $[0] = children;
@@ -435,31 +435,6 @@ function Panel({ open, onOpenChange, renderAnchor = defaultRenderAnchor, anchorR
435
435
  if (event.key !== "/" && !isAlphabetKey(event.nativeEvent)) return;
436
436
  event.stopPropagation();
437
437
  }, [overlayProps]);
438
- const mergedOverlayProps = useMemo(() => ({
439
- role: "dialog",
440
- "aria-labelledby": titleId,
441
- "aria-describedby": subtitle ? subtitleId : void 0,
442
- ...overlayProps,
443
- ...variant === "modal" ? {
444
- top: "50vh",
445
- left: "50vw",
446
- anchorSide: void 0
447
- } : {},
448
- style: {
449
- transform: variant === "modal" ? "translate(-50%, -50%)" : void 0,
450
- ...isKeyboardVisible ? { maxHeight: availablePanelHeight !== void 0 ? `${availablePanelHeight}px` : "auto" } : {}
451
- },
452
- onKeyDown: preventBubbling
453
- }), [
454
- titleId,
455
- subtitle,
456
- subtitleId,
457
- overlayProps,
458
- variant,
459
- isKeyboardVisible,
460
- availablePanelHeight,
461
- preventBubbling
462
- ]);
463
438
  return /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ jsx(AnchoredOverlay, {
464
439
  renderAnchor: renderMenuAnchor,
465
440
  anchorRef,
@@ -467,7 +442,31 @@ function Panel({ open, onOpenChange, renderAnchor = defaultRenderAnchor, anchorR
467
442
  open,
468
443
  onOpen,
469
444
  onClose,
470
- overlayProps: mergedOverlayProps,
445
+ overlayProps: useMemo(() => ({
446
+ role: "dialog",
447
+ "aria-labelledby": titleId,
448
+ "aria-describedby": subtitle ? subtitleId : void 0,
449
+ ...overlayProps,
450
+ ...variant === "modal" ? {
451
+ top: "50vh",
452
+ left: "50vw",
453
+ anchorSide: void 0
454
+ } : {},
455
+ style: {
456
+ transform: variant === "modal" ? "translate(-50%, -50%)" : void 0,
457
+ ...isKeyboardVisible ? { maxHeight: availablePanelHeight !== void 0 ? `${availablePanelHeight}px` : "auto" } : {}
458
+ },
459
+ onKeyDown: preventBubbling
460
+ }), [
461
+ titleId,
462
+ subtitle,
463
+ subtitleId,
464
+ overlayProps,
465
+ variant,
466
+ isKeyboardVisible,
467
+ availablePanelHeight,
468
+ preventBubbling
469
+ ]),
471
470
  focusTrapSettings,
472
471
  focusZoneSettings,
473
472
  height,
@@ -100,11 +100,10 @@ const Tooltip = /*#__PURE__*/ React.forwardRef(({ direction = "s", text, type =
100
100
  const trigger = readTriggerRef.current;
101
101
  tooltip.showPopover();
102
102
  setIsPopoverOpen(true);
103
- const settings = {
103
+ const { top, left, anchorAlign, anchorSide } = getAnchoredPosition(tooltip, trigger, {
104
104
  side: directionToPosition[direction].side,
105
105
  align: directionToPosition[direction].align
106
- };
107
- const { top, left, anchorAlign, anchorSide } = getAnchoredPosition(tooltip, trigger, settings);
106
+ });
108
107
  const calculatedDirection = positionToDirection[`${anchorSide}-${anchorAlign}`];
109
108
  setCalculatedDirection(calculatedDirection);
110
109
  tooltip.style.top = `${top}px`;
@@ -193,6 +193,7 @@ const ItemImpl = fixedForwardRef(({ id: itemId, containIntrinsicSize, current: i
193
193
  case "u":
194
194
  if (!(event.shiftKey && (event.metaKey || event.ctrlKey))) return;
195
195
  activateActionsDialog();
196
+ break;
196
197
  }
197
198
  }, [
198
199
  onSelect,
@@ -59,8 +59,7 @@ const List = /*#__PURE__*/ React.forwardRef((props, forwardedRef) => {
59
59
  const { firstGroupStyle, lastGroupStyle, headerStyle, itemStyle } = useListVariant(restProps.variant);
60
60
  const renderGroup = (groupProps) => {
61
61
  var _ref;
62
- const GroupComponent = ((_ref = "renderGroup" in groupProps && groupProps.renderGroup) !== null && _ref !== void 0 ? _ref : restProps.renderGroup) || Group;
63
- return /*#__PURE__*/ createElement(GroupComponent, {
62
+ return /*#__PURE__*/ createElement(((_ref = "renderGroup" in groupProps && groupProps.renderGroup) !== null && _ref !== void 0 ? _ref : restProps.renderGroup) || Group, {
64
63
  ...groupProps,
65
64
  key: groupProps.groupId
66
65
  });
@@ -43,11 +43,10 @@ const responsiveButtonSizes = {
43
43
  const Panel = ({ title, description, variant: propsVariant, selectionVariant = "multiple", id, defaultOpen = false, open: propsOpen, anchorRef: providedAnchorRef, anchoredPositionSettings, onCancel: propsOnCancel, onClearSelection: propsOnClearSelection, onSubmit: propsOnSubmit, width = "medium", maxHeight = "large", className, ...props }) => {
44
44
  var _position$top, _position$left, _slots$header;
45
45
  const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
46
- const responsiveVariants = Object.assign({
46
+ const currentVariant = useResponsiveValue(Object.assign({
47
47
  regular: "anchored",
48
48
  narrow: "full-screen"
49
- }, typeof propsVariant === "string" ? { regular: propsVariant } : propsVariant);
50
- const currentVariant = useResponsiveValue(responsiveVariants, "anchored");
49
+ }, typeof propsVariant === "string" ? { regular: propsVariant } : propsVariant), "anchored");
51
50
  if (propsOpen !== void 0 && internalOpen !== propsOpen) setInternalOpen(propsOpen);
52
51
  let Anchor;
53
52
  const anchorRef = useProvidedRefOrCreate(providedAnchorRef);
@@ -349,20 +348,18 @@ const SelectPanelFooter = ({ ...props }) => {
349
348
  SelectPanelFooter.displayName = "SelectPanelFooter";
350
349
  SelectPanelFooter.__SLOT__ = Symbol("SelectPanel.Footer");
351
350
  const SecondaryButton = (props) => {
352
- const size = useResponsiveValue(responsiveButtonSizes, "small");
353
351
  return /*#__PURE__*/ jsx(ButtonComponent, {
354
352
  type: "button",
355
- size,
353
+ size: useResponsiveValue(responsiveButtonSizes, "small"),
356
354
  block: true,
357
355
  ...props
358
356
  });
359
357
  };
360
358
  SecondaryButton.displayName = "SecondaryButton";
361
359
  const SecondaryLink = ({ className, ...props }) => {
362
- const size = useResponsiveValue(responsiveButtonSizes, "small");
363
360
  return /*#__PURE__*/ jsx(ButtonComponent, {
364
361
  as: Link,
365
- size,
362
+ size: useResponsiveValue(responsiveButtonSizes, "small"),
366
363
  variant: "invisible",
367
364
  block: true,
368
365
  ...props,
@@ -5,8 +5,7 @@ import { FocusKeys as FocusKeys$1, focusZone } from "@primer/behaviors";
5
5
  function useFocusZone(settings = {}, dependencies = []) {
6
6
  const containerRef = useProvidedRefOrCreate(settings.containerRef);
7
7
  const useActiveDescendant = !!settings.activeDescendantFocus;
8
- const passedActiveDescendantRef = typeof settings.activeDescendantFocus === "boolean" || !settings.activeDescendantFocus ? void 0 : settings.activeDescendantFocus;
9
- const activeDescendantControlRef = useProvidedRefOrCreate(passedActiveDescendantRef);
8
+ const activeDescendantControlRef = useProvidedRefOrCreate(typeof settings.activeDescendantFocus === "boolean" || !settings.activeDescendantFocus ? void 0 : settings.activeDescendantFocus);
10
9
  const disabled = settings.disabled;
11
10
  const abortController = React.useRef();
12
11
  useEffect(() => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.36.0-rc.3fb350b1f",
4
+ "version": "38.36.0-rc.4403803d9",
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",
@@ -166,7 +166,7 @@
166
166
  "react-is": "18.3.1",
167
167
  "recast": "0.23.7",
168
168
  "rimraf": "5.0.5",
169
- "rolldown": "^1.2.2",
169
+ "rolldown": "^1.2.0",
170
170
  "rolldown-plugin-dts": "^0.26.0",
171
171
  "rolldown-plugin-import-css": "^0.0.0",
172
172
  "rolldown-plugin-preserve-directives": "^0.0.0",