@primer/react 0.0.0-20260617130554 → 0.0.0-20260617134638

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
@@ -1,17 +1,17 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260617130554
3
+ ## 0.0.0-20260617134638
4
4
 
5
5
  ### Minor Changes
6
6
 
7
+ - [#7994](https://github.com/primer/react/pull/7994) [`1026d40`](https://github.com/primer/react/commit/1026d4012f4e8960f5c3730f826b1eed77e00b2d) Thanks [@TylerJDev](https://github.com/TylerJDev)! - ActionList: Adds `tooltipDirection` prop to `ActionList.TrailingAction`
8
+
7
9
  - [#7867](https://github.com/primer/react/pull/7867) [`4ec4248`](https://github.com/primer/react/commit/4ec4248b9c1ae662b761385110f1fd7ad7480a2f) Thanks [@llastflowers](https://github.com/llastflowers)! - Add data-component attributes and associated tests for ActionMenu, AnchoredOverlay, Autocomplete, and NavList
8
10
 
9
11
  ### Patch Changes
10
12
 
11
13
  - [#7976](https://github.com/primer/react/pull/7976) [`1fac927`](https://github.com/primer/react/commit/1fac9270c497c1904acbb3eb60805630aab82a97) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - NavList: add a small gap between items for readability, including before expanded sub-navs, behind the `primer_react_action_list_item_gap` feature flag
12
14
 
13
- - [#7935](https://github.com/primer/react/pull/7935) [`2765933`](https://github.com/primer/react/commit/276593387ec84f72aeba02a940b5e0a4d0a026a9) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - ConfirmationDialog: `useConfirm`/`confirm` now removes its host element from `document.body` after the dialog is closed, and uses a fresh host element per call, so the empty container no longer lingers or leaks into other components and tests
14
-
15
15
  - [#7929](https://github.com/primer/react/pull/7929) [`48c34ca`](https://github.com/primer/react/commit/48c34ca452a5449b0ba901783edb169b6a1e1882) Thanks [@joshblack](https://github.com/joshblack)! - FilteredActionList: Make body skeleton widths stable for server rendering
16
16
 
17
17
  - Fake entry to force publishing
@@ -4,18 +4,20 @@ import { IconButton } from '../Button/IconButton.js';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
6
6
  const GroupHeadingTrailingActionImpl = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
7
- const $ = c(13);
7
+ const $ = c(15);
8
8
  let icon;
9
9
  let label;
10
10
  let props;
11
11
  let t1;
12
12
  let t2;
13
+ let t3;
13
14
  if ($[0] !== t0) {
14
15
  ({
15
16
  as: t1,
16
17
  icon,
17
18
  label,
18
19
  href: t2,
20
+ tooltipDirection: t3,
19
21
  ...props
20
22
  } = t0);
21
23
  $[0] = t0;
@@ -24,40 +26,44 @@ const GroupHeadingTrailingActionImpl = /*#__PURE__*/forwardRef((t0, forwardedRef
24
26
  $[3] = props;
25
27
  $[4] = t1;
26
28
  $[5] = t2;
29
+ $[6] = t3;
27
30
  } else {
28
31
  icon = $[1];
29
32
  label = $[2];
30
33
  props = $[3];
31
34
  t1 = $[4];
32
35
  t2 = $[5];
36
+ t3 = $[6];
33
37
  }
34
38
  const as = t1 === undefined ? "button" : t1;
35
39
  const href = t2 === undefined ? null : t2;
36
- let t3;
37
- if ($[6] !== as || $[7] !== forwardedRef || $[8] !== href || $[9] !== icon || $[10] !== label || $[11] !== props) {
38
- t3 = /*#__PURE__*/jsx(IconButton, {
40
+ const tooltipDirection = t3 === undefined ? "w" : t3;
41
+ let t4;
42
+ if ($[7] !== as || $[8] !== forwardedRef || $[9] !== href || $[10] !== icon || $[11] !== label || $[12] !== props || $[13] !== tooltipDirection) {
43
+ t4 = /*#__PURE__*/jsx(IconButton, {
39
44
  as: as,
40
45
  "aria-label": label,
41
46
  icon: icon,
42
47
  variant: "invisible",
43
48
  size: "small",
44
- tooltipDirection: "w",
49
+ tooltipDirection: tooltipDirection,
45
50
  href: href,
46
51
  ref: forwardedRef,
47
52
  "data-component": "ActionList.GroupHeading.TrailingAction",
48
53
  ...props
49
54
  });
50
- $[6] = as;
51
- $[7] = forwardedRef;
52
- $[8] = href;
53
- $[9] = icon;
54
- $[10] = label;
55
- $[11] = props;
56
- $[12] = t3;
55
+ $[7] = as;
56
+ $[8] = forwardedRef;
57
+ $[9] = href;
58
+ $[10] = icon;
59
+ $[11] = label;
60
+ $[12] = props;
61
+ $[13] = tooltipDirection;
62
+ $[14] = t4;
57
63
  } else {
58
- t3 = $[12];
64
+ t4 = $[14];
59
65
  }
60
- return t3;
66
+ return t4;
61
67
  });
62
68
  GroupHeadingTrailingActionImpl.displayName = 'ActionList.GroupHeading.TrailingAction';
63
69
  GroupHeadingTrailingActionImpl.__SLOT__ = Symbol('ActionList.GroupHeading.TrailingAction');
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ import type { IconButtonProps } from '../Button/types';
2
3
  import type { ForwardRefComponent as PolymorphicForwardRefComponent } from '../utils/polymorphic';
3
4
  type ElementProps = {
4
5
  as?: 'button';
@@ -18,7 +19,7 @@ export type ActionListTrailingActionProps = ElementProps & {
18
19
  label: string;
19
20
  className?: string;
20
21
  style?: React.CSSProperties;
21
- };
22
+ } & Pick<IconButtonProps, 'tooltipDirection'>;
22
23
  export declare const TrailingAction: PolymorphicForwardRefComponent<"button" | "a", ActionListTrailingActionProps>;
23
24
  export {};
24
25
  //# sourceMappingURL=TrailingAction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TrailingAction.d.ts","sourceRoot":"","sources":["../../src/ActionList/TrailingAction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAI/F,KAAK,YAAY,GACb;IACE,EAAE,CAAC,EAAE,QAAQ,CAAA;IACb,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,GACD;IACE,EAAE,EAAE,GAAG,CAAA;IACP,IAAI,EAAE,MAAM,C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AAC,CAAA"}
@@ -7,7 +7,7 @@ import classes from './ActionList.module.css.js';
7
7
  import { jsx } from 'react/jsx-runtime';
8
8
 
9
9
  const TrailingAction = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
10
- const $ = c(23);
10
+ const $ = c(25);
11
11
  let className;
12
12
  let icon;
13
13
  let label;
@@ -16,6 +16,7 @@ const TrailingAction = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
16
16
  let style;
17
17
  let t1;
18
18
  let t2;
19
+ let t3;
19
20
  if ($[0] !== t0) {
20
21
  ({
21
22
  as: t1,
@@ -25,6 +26,7 @@ const TrailingAction = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
25
26
  className,
26
27
  style,
27
28
  loading,
29
+ tooltipDirection: t3,
28
30
  ...props
29
31
  } = t0);
30
32
  $[0] = t0;
@@ -36,6 +38,7 @@ const TrailingAction = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
36
38
  $[6] = style;
37
39
  $[7] = t1;
38
40
  $[8] = t2;
41
+ $[9] = t3;
39
42
  } else {
40
43
  className = $[1];
41
44
  icon = $[2];
@@ -45,25 +48,27 @@ const TrailingAction = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
45
48
  style = $[6];
46
49
  t1 = $[7];
47
50
  t2 = $[8];
51
+ t3 = $[9];
48
52
  }
49
53
  const as = t1 === undefined ? "button" : t1;
50
54
  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;
55
+ const tooltipDirection = t3 === undefined ? "w" : t3;
56
+ let t4;
57
+ if ($[10] !== className) {
58
+ t4 = clsx(className, classes.TrailingAction);
59
+ $[10] = className;
60
+ $[11] = t4;
56
61
  } else {
57
- t3 = $[10];
62
+ t4 = $[11];
58
63
  }
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, {
64
+ let t5;
65
+ if ($[12] !== as || $[13] !== forwardedRef || $[14] !== href || $[15] !== icon || $[16] !== label || $[17] !== loading || $[18] !== props || $[19] !== tooltipDirection) {
66
+ t5 = icon ? /*#__PURE__*/jsx(IconButton, {
62
67
  as: as,
63
68
  "aria-label": label,
64
69
  icon: icon,
65
70
  variant: "invisible",
66
- tooltipDirection: "w",
71
+ tooltipDirection: tooltipDirection,
67
72
  href: href,
68
73
  loading: loading,
69
74
  "data-loading": Boolean(loading),
@@ -82,33 +87,34 @@ const TrailingAction = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
82
87
  ...props,
83
88
  children: label
84
89
  });
85
- $[11] = as;
86
- $[12] = forwardedRef;
87
- $[13] = href;
88
- $[14] = icon;
89
- $[15] = label;
90
- $[16] = loading;
91
- $[17] = props;
92
- $[18] = t4;
90
+ $[12] = as;
91
+ $[13] = forwardedRef;
92
+ $[14] = href;
93
+ $[15] = icon;
94
+ $[16] = label;
95
+ $[17] = loading;
96
+ $[18] = props;
97
+ $[19] = tooltipDirection;
98
+ $[20] = t5;
93
99
  } else {
94
- t4 = $[18];
100
+ t5 = $[20];
95
101
  }
96
- let t5;
97
- if ($[19] !== style || $[20] !== t3 || $[21] !== t4) {
98
- t5 = /*#__PURE__*/jsx("span", {
99
- className: t3,
102
+ let t6;
103
+ if ($[21] !== style || $[22] !== t4 || $[23] !== t5) {
104
+ t6 = /*#__PURE__*/jsx("span", {
105
+ className: t4,
100
106
  "data-component": "ActionList.TrailingAction",
101
107
  style: style,
102
- children: t4
108
+ children: t5
103
109
  });
104
- $[19] = style;
105
- $[20] = t3;
106
- $[21] = t4;
107
- $[22] = t5;
110
+ $[21] = style;
111
+ $[22] = t4;
112
+ $[23] = t5;
113
+ $[24] = t6;
108
114
  } else {
109
- t5 = $[22];
115
+ t6 = $[24];
110
116
  }
111
- return t5;
117
+ return t6;
112
118
  });
113
119
  TrailingAction.__SLOT__ = Symbol('ActionList.TrailingAction');
114
120
 
@@ -1 +1 @@
1
- {"version":3,"file":"useConfirm.d.ts","sourceRoot":"","sources":["../../src/ConfirmationDialog/useConfirm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAGxC,OAAO,EAAqB,KAAK,uBAAuB,EAAC,MAAM,sBAAsB,CAAA;AAErF,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,uBAAuB,EAAE,SAAS,CAAC,GAAG;IAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;CAAC,CAAA;AAuBlG;;;;GAIG;AACH,wBAAgB,UAAU,cACa,cAAc,sBAIpD"}
1
+ {"version":3,"file":"useConfirm.d.ts","sourceRoot":"","sources":["../../src/ConfirmationDialog/useConfirm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAGxC,OAAO,EAAqB,KAAK,uBAAuB,EAAC,MAAM,sBAAsB,CAAA;AAIrF,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,uBAAuB,EAAE,SAAS,CAAC,GAAG;IAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;CAAC,CAAA;AA0BlG;;;;GAIG;AACH,wBAAgB,UAAU,cACa,cAAc,sBAIpD"}
@@ -3,19 +3,23 @@ import { createRoot } from 'react-dom/client';
3
3
  import BaseStyles from '../BaseStyles.js';
4
4
  import { ConfirmationDialog } from './ConfirmationDialog.js';
5
5
 
6
+ let hostElement = null;
6
7
  async function confirm(options) {
7
8
  const {
8
9
  content,
9
10
  ...confirmationDialogProps
10
11
  } = options;
11
12
  return new Promise(resolve => {
12
- const hostElement = document.createElement('div');
13
- document.body.append(hostElement);
13
+ hostElement ||= document.createElement('div');
14
+ if (!hostElement.isConnected) document.body.append(hostElement);
14
15
  const root = createRoot(hostElement);
15
16
  const onClose = gesture => {
16
17
  root.unmount();
17
- hostElement.remove();
18
- resolve(gesture === 'confirm');
18
+ if (gesture === 'confirm') {
19
+ resolve(true);
20
+ } else {
21
+ resolve(false);
22
+ }
19
23
  };
20
24
  root.render(/*#__PURE__*/React.createElement(BaseStyles, null, /*#__PURE__*/React.createElement(ConfirmationDialog, {
21
25
  ...confirmationDialogProps,
@@ -534,6 +534,12 @@
534
534
  "type": "boolean",
535
535
  "defaultValue": "false",
536
536
  "description": "Whether the TrailingAction is in a loading state. When true, the TrailingAction will render a spinner instead of an icon. Only available when `as` is 'button'."
537
+ },
538
+ {
539
+ "name": "tooltipDirection",
540
+ "type": "'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw'",
541
+ "defaultValue": "'w'",
542
+ "description": "Direction of the tooltip shown when hovering over the TrailingAction. Only applies when `icon` is set."
537
543
  }
538
544
  ]
539
545
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260617130554",
4
+ "version": "0.0.0-20260617134638",
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",