@primer/react 0.0.0-20260302192736 → 0.0.0-20260302220808

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-20260302192736
3
+ ## 0.0.0-20260302220808
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -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,EAAC,MAAM,gBAAgB,CAAA;AAE9C,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAA;AAChF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,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,UAwRD,CAAA"}
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;AAG7G,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAA;AAE9C,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAA;AAChF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,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,UAgRD,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
@@ -215,12 +212,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
215
212
  return child.props['aria-describedby'];
216
213
  }
217
214
 
218
- // When the tooltip is disabled, don't add its ID to aria-describedby
219
- // to avoid an empty string polluting the accessible description
220
- if (_privateDisableTooltip) {
221
- return child.props['aria-describedby'];
222
- }
223
-
224
215
  // If tooltip is a description type, append our tooltipId
225
216
  const existingDescribedBy = child.props['aria-describedby'];
226
217
  if (existingDescribedBy) {
@@ -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-20260302192736",
4
+ "version": "0.0.0-20260302220808",
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",