From 6a448a93382d8479b0a5fb40eb134ef79d61e517 Mon Sep 17 00:00:00 2001 From: Ricky Zhang Date: Thu, 9 Jul 2026 14:50:50 -0400 Subject: [PATCH 1/2] Export getResponsiveAttributes from experimental entrypoint Promotes the getResponsiveAttributes helper from an internal util to the public @primer/react/experimental entrypoint (placed next to Hidden). The source file is moved out of src/internal/utils into src/utils to match the precedent set when useMergedRefs was made public, rather than re-exporting from internal. It is the helper referenced by the useResponsiveValue deprecation notice and ADR-018 for bridging responsive prop values to CSS via data-* attributes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .changeset/export-get-responsive-attributes.md | 5 +++++ packages/react/src/PageHeader/PageHeader.tsx | 2 +- packages/react/src/PageLayout/PageLayout.tsx | 2 +- packages/react/src/SegmentedControl/SegmentedControl.tsx | 2 +- packages/react/src/Stack/Stack.tsx | 2 +- .../react/src/__tests__/__snapshots__/exports.test.ts.snap | 1 + packages/react/src/experimental/index.ts | 2 ++ .../utils/__tests__/getResponsiveAttributes.test.ts | 0 .../src/{internal => }/utils/getResponsiveAttributes.ts | 2 +- 9 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 .changeset/export-get-responsive-attributes.md rename packages/react/src/{internal => }/utils/__tests__/getResponsiveAttributes.test.ts (100%) rename packages/react/src/{internal => }/utils/getResponsiveAttributes.ts (95%) diff --git a/.changeset/export-get-responsive-attributes.md b/.changeset/export-get-responsive-attributes.md new file mode 100644 index 00000000000..66f2061c198 --- /dev/null +++ b/.changeset/export-get-responsive-attributes.md @@ -0,0 +1,5 @@ +--- +'@primer/react': minor +--- + +Export `getResponsiveAttributes` from `@primer/react/experimental`. This is the helper referenced by the `useResponsiveValue` deprecation notice and ADR-018 for bridging responsive prop values to CSS via `data-*` attributes, previously only available internally. diff --git a/packages/react/src/PageHeader/PageHeader.tsx b/packages/react/src/PageHeader/PageHeader.tsx index 23217193a15..2acd5ad2d54 100644 --- a/packages/react/src/PageHeader/PageHeader.tsx +++ b/packages/react/src/PageHeader/PageHeader.tsx @@ -5,7 +5,7 @@ import Heading from '../Heading' import {ArrowLeftIcon} from '@primer/octicons-react' import type {LinkProps as BaseLinkProps} from '../Link' import Link from '../Link' -import {getResponsiveAttributes} from '../internal/utils/getResponsiveAttributes' +import {getResponsiveAttributes} from '../utils/getResponsiveAttributes' import type {ForwardRefComponent as PolymorphicForwardRefComponent} from '../utils/polymorphic' import {areAllValuesTheSame, haveRegularAndWideSameValue} from '../utils/getBreakpointDeclarations' diff --git a/packages/react/src/PageLayout/PageLayout.tsx b/packages/react/src/PageLayout/PageLayout.tsx index 17ab7e8ca2f..57d82c54dbe 100644 --- a/packages/react/src/PageLayout/PageLayout.tsx +++ b/packages/react/src/PageLayout/PageLayout.tsx @@ -7,7 +7,7 @@ import {isResponsiveValue} from '../hooks/useResponsiveValue' import {useSlots} from '../hooks/useSlots' import {useOverflow} from '../hooks/useOverflow' import {warning} from '../utils/warning' -import {getResponsiveAttributes} from '../internal/utils/getResponsiveAttributes' +import {getResponsiveAttributes} from '../utils/getResponsiveAttributes' import classes from './PageLayout.module.css' import type {FCWithSlotMarker, WithSlotMarker} from '../utils/types' diff --git a/packages/react/src/SegmentedControl/SegmentedControl.tsx b/packages/react/src/SegmentedControl/SegmentedControl.tsx index 707530b01f8..dea01e01ff6 100644 --- a/packages/react/src/SegmentedControl/SegmentedControl.tsx +++ b/packages/react/src/SegmentedControl/SegmentedControl.tsx @@ -6,7 +6,7 @@ import SegmentedControlIconButton from './SegmentedControlIconButton' import {ActionList} from '../ActionList' import {ActionMenu} from '../ActionMenu' import type {ResponsiveValue} from '../hooks/useResponsiveValue' -import {getResponsiveAttributes} from '../internal/utils/getResponsiveAttributes' +import {getResponsiveAttributes} from '../utils/getResponsiveAttributes' import type {WidthOnlyViewportRangeKeys} from '../utils/types/ViewportRangeKeys' import {isElement} from 'react-is' import classes from './SegmentedControl.module.css' diff --git a/packages/react/src/Stack/Stack.tsx b/packages/react/src/Stack/Stack.tsx index 3d305129df3..edc003dc981 100644 --- a/packages/react/src/Stack/Stack.tsx +++ b/packages/react/src/Stack/Stack.tsx @@ -1,7 +1,7 @@ import type React from 'react' import {forwardRef, type ElementType} from 'react' import type {ResponsiveValue} from '../hooks/useResponsiveValue' -import {getResponsiveAttributes} from '../internal/utils/getResponsiveAttributes' +import {getResponsiveAttributes} from '../utils/getResponsiveAttributes' import classes from './Stack.module.css' import {clsx} from 'clsx' import type {ForwardRefComponent as PolymorphicForwardRefComponent} from '../utils/polymorphic' diff --git a/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap b/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap index 412847b840c..f7246c62af9 100644 --- a/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap +++ b/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap @@ -325,6 +325,7 @@ exports[`@primer/react/experimental > should not update exports without a semver "FilteredActionListLoadingTypes", "type FilteredActionListProps", "getAccessibleKeybindingHintString", + "getResponsiveAttributes", "Hidden", "type HiddenProps", "InlineMessage", diff --git a/packages/react/src/experimental/index.ts b/packages/react/src/experimental/index.ts index 90846e5cb5f..997f1012d7d 100644 --- a/packages/react/src/experimental/index.ts +++ b/packages/react/src/experimental/index.ts @@ -60,6 +60,8 @@ export type { export * from '../Hidden' +export {getResponsiveAttributes} from '../utils/getResponsiveAttributes' + export * from './hooks' export {NavList} from '../NavList' diff --git a/packages/react/src/internal/utils/__tests__/getResponsiveAttributes.test.ts b/packages/react/src/utils/__tests__/getResponsiveAttributes.test.ts similarity index 100% rename from packages/react/src/internal/utils/__tests__/getResponsiveAttributes.test.ts rename to packages/react/src/utils/__tests__/getResponsiveAttributes.test.ts diff --git a/packages/react/src/internal/utils/getResponsiveAttributes.ts b/packages/react/src/utils/getResponsiveAttributes.ts similarity index 95% rename from packages/react/src/internal/utils/getResponsiveAttributes.ts rename to packages/react/src/utils/getResponsiveAttributes.ts index 6089dfe913e..de10983e631 100644 --- a/packages/react/src/internal/utils/getResponsiveAttributes.ts +++ b/packages/react/src/utils/getResponsiveAttributes.ts @@ -1,4 +1,4 @@ -import type {ResponsiveValue} from '../../hooks/useResponsiveValue' +import type {ResponsiveValue} from '../hooks/useResponsiveValue' /** * Transform the given property and values in to corresponding data attributes From 7bf967893368b2d14aa9a51f1b122c4a8dbae49e Mon Sep 17 00:00:00 2001 From: Ricky Zhang Date: Thu, 9 Jul 2026 15:51:42 -0400 Subject: [PATCH 2/2] Export getResponsiveAttributes for responsive values This export is referenced in the `useResponsiveValue` deprecation notice and ADR-018. --- .changeset/export-get-responsive-attributes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/export-get-responsive-attributes.md b/.changeset/export-get-responsive-attributes.md index 66f2061c198..d3444538aa0 100644 --- a/.changeset/export-get-responsive-attributes.md +++ b/.changeset/export-get-responsive-attributes.md @@ -2,4 +2,4 @@ '@primer/react': minor --- -Export `getResponsiveAttributes` from `@primer/react/experimental`. This is the helper referenced by the `useResponsiveValue` deprecation notice and ADR-018 for bridging responsive prop values to CSS via `data-*` attributes, previously only available internally. +Experimental: Export `getResponsiveAttributes` helper for bridging responsive values to `data-*` attributes.