@primer/react 0.0.0-20260302193121 → 0.0.0-20260303012527

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,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260302193121
3
+ ## 0.0.0-20260303012527
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -24,34 +24,31 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
24
24
  * For non-button-semantic items, renders children directly.
25
25
  */
26
26
  function ConditionalTooltip(t0) {
27
- const $ = c(4);
27
+ const $ = c(3);
28
28
  const {
29
29
  text,
30
30
  enabled,
31
31
  children
32
32
  } = t0;
33
- if (!enabled) {
33
+ if (!enabled || !text) {
34
34
  return children;
35
35
  }
36
36
  const t1 = text || "";
37
- const t2 = !text;
38
- let t3;
39
- if ($[0] !== children || $[1] !== t1 || $[2] !== t2) {
40
- t3 = /*#__PURE__*/jsx(Tooltip, {
37
+ let t2;
38
+ if ($[0] !== children || $[1] !== t1) {
39
+ t2 = /*#__PURE__*/jsx(Tooltip, {
41
40
  text: t1,
42
41
  direction: "e",
43
42
  delay: "medium",
44
- _privateDisableTooltip: t2,
45
43
  children: children
46
44
  });
47
45
  $[0] = children;
48
46
  $[1] = t1;
49
47
  $[2] = t2;
50
- $[3] = t3;
51
48
  } else {
52
- t3 = $[3];
49
+ t2 = $[2];
53
50
  }
54
- return t3;
51
+ return t2;
55
52
  }
56
53
  const SubItem = t0 => {
57
54
  const $ = c(2);
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/TooltipV2/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiD,KAAK,yBAAyB,EAAC,MAAM,OAAO,CAAA;AAS3G,OAAO,EAAoD,KAAK,mBAAmB,EAAC,MAAM,mBAAmB,CAAA;AAI7G,OAAO,KAAK,EAAC,UAAU,E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,iBAAiB,CAAC;IACjD,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,GAAG,aAAa,CAAA;IAC9B,cAAc,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAC5C;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IACnC;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAC,GACA,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAiEnC,eAAO,MAAM,cAAc;gBAAoC,MAAM;EAAM,CAAA;AAE3E,eAAO,MAAM,OAAO,EAAE,yBAAyB,CAC7C,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CACvE,GACC,UAsRD,CAAA"}
@@ -7,7 +7,6 @@ import { clsx } from 'clsx';
7
7
  import classes from './Tooltip.module.css.js';
8
8
  import VisuallyHidden from '../_VisuallyHidden.js';
9
9
  import useSafeTimeout from '../hooks/useSafeTimeout.js';
10
- import { useMergedRefs } from '../internal/hooks/useMergedRefs.js';
11
10
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
12
11
  import { useId } from '../hooks/useId.js';
13
12
  import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
@@ -89,7 +88,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
89
88
  _privateDisableTooltip = false,
90
89
  ...rest
91
90
  }, forwardedRef) => {
92
- var _props$ref;
93
91
  const tooltipId = useId(id);
94
92
  const child = Children.only(children);
95
93
  const triggerRef = useProvidedRefOrCreate(forwardedRef);
@@ -198,8 +196,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
198
196
  }, [isPopoverOpen]);
199
197
  const isMacOS = useIsMacOS();
200
198
  const hasAriaLabel = 'aria-label' in rest;
201
- const childRef = (_props$ref = child.props.ref) !== null && _props$ref !== void 0 ? _props$ref : null;
202
- const setTriggerRef = useMergedRefs(triggerRef, childRef, forwardedRef);
203
199
  return /*#__PURE__*/jsx(TooltipContext.Provider, {
204
200
  value: value,
205
201
  children: /*#__PURE__*/jsxs(Fragment, {
@@ -207,7 +203,8 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
207
203
  /*#__PURE__*/
208
204
  // eslint-disable-next-line react-hooks/refs
209
205
  React.cloneElement(child, {
210
- ref: setTriggerRef,
206
+ // @ts-expect-error it needs a non nullable ref
207
+ ref: triggerRef,
211
208
  // If it is a type description, we use tooltip to describe the trigger
212
209
  'aria-describedby': (() => {
213
210
  // If tooltip is not a description type, keep the original aria-describedby
@@ -299,6 +299,10 @@
299
299
  {
300
300
  "id": "components-actionlist-features--large-item",
301
301
  "code": "() => (\n <ActionList>\n <ActionList.Item size=\"large\">Large item</ActionList.Item>\n <ActionList.Item size=\"large\">\n Large item\n <ActionList.Description>With inline description</ActionList.Description>\n </ActionList.Item>\n <ActionList.Item size=\"large\">\n Large item\n <ActionList.Description variant=\"block\">\n With block description\n </ActionList.Description>\n </ActionList.Item>\n </ActionList>\n)"
302
+ },
303
+ {
304
+ "id": "components-actionlist-features--with-item-tooltip",
305
+ "code": "() => {\n const convertToIssueRef = React.useRef<HTMLLIElement>(null)\n const [dropdownOpen, setDropdownOpen] = React.useState(false)\n return (\n <>\n <ActionList aria-label=\"Actions\">\n <ActionList.Item\n onSelect={() => {\n setDropdownOpen(!dropdownOpen)\n }}\n ref={convertToIssueRef}\n >\n Convert to issue\n </ActionList.Item>\n </ActionList>\n <AnchoredOverlay\n open={dropdownOpen}\n renderAnchor={null}\n anchorRef={convertToIssueRef}\n onClose={() => {\n setDropdownOpen(false)\n }}\n >\n <ActionList role=\"menu\" aria-label=\"Convert to issue menu\">\n <ActionList.Item role=\"menuitem\">Choose repository</ActionList.Item>\n <ActionList.Item role=\"menuitem\">Create issue</ActionList.Item>\n </ActionList>\n </AnchoredOverlay>\n </>\n )\n}"
302
306
  }
303
307
  ],
304
308
  "importPath": "@primer/react",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260302193121",
4
+ "version": "0.0.0-20260303012527",
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",