diff --git a/.changeset/export-get-responsive-attributes.md b/.changeset/export-get-responsive-attributes.md new file mode 100644 index 00000000000..d3444538aa0 --- /dev/null +++ b/.changeset/export-get-responsive-attributes.md @@ -0,0 +1,5 @@ +--- +'@primer/react': minor +--- + +Experimental: Export `getResponsiveAttributes` helper for bridging responsive values to `data-*` attributes. 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