diff --git a/.changeset/hero-button-group.md b/.changeset/hero-button-group.md new file mode 100644 index 0000000000..14fdbbf604 --- /dev/null +++ b/.changeset/hero-button-group.md @@ -0,0 +1,22 @@ +--- +'@primer/react-brand': patch +--- + +Added `Hero.ButtonGroup` for rendering `Button` and `ActionMenu` children. `Hero.ButtonGroup` is now the de facto way to display buttons in the `Hero`. + +⚠️ `Hero.PrimaryAction` and `Hero.SecondaryAction` are now deprecated. Please migrate over to `Hero.ButtonGroup` as they will be removed in a future release. + +Migrate using the following approach: + +```diff +-Primary action +-Secondary action ++ ++ ++ ++ +``` diff --git a/.changeset/hero-media-position-padding.md b/.changeset/hero-media-position-padding.md new file mode 100644 index 0000000000..82c1124fa3 --- /dev/null +++ b/.changeset/hero-media-position-padding.md @@ -0,0 +1,15 @@ +--- +'@primer/react-brand': minor +'@primer/brand-css': minor +--- + +⚠️ Breaking change to `Hero.Image` and `Hero.Video` ⚠️ + +Previously combined `padding` and `position` semantics have been separated. + +The `position` prop will now only control layout and positioning relative to the content. It accepts `block-end`, `inline-start`, or `inline-end`. + +```diff +- ++ +``` diff --git a/.changeset/quiet-otters-dance.md b/.changeset/quiet-otters-dance.md index 08400cdf21..0ef072e2b1 100644 --- a/.changeset/quiet-otters-dance.md +++ b/.changeset/quiet-otters-dance.md @@ -4,10 +4,10 @@ ⚠️ Breaking change: Removed the `imageBackgroundColor` prop from `River.Visual`, `RiverBreakout.Visual`, and `RiverBreakoutTabs.Visual`. -The `gridline` variant now applies the full-bleed visual background layout by default. Remove `imageBackgroundColor="subtle"` from `River.Visual` and `RiverBreakout.Visual` when using the `gridline` variant. +The `River` `gridline` variant now applies the full-bleed visual background layout by default. Remove `imageBackgroundColor="subtle"` from `River.Visual` when using the `gridline` variant. -Remove `imageBackgroundColor` from `RiverBreakoutTabs.Visual` without replacement. Its default visual treatment is unchanged. +Remove `imageBackgroundColor` from `RiverBreakout.Visual` and `RiverBreakoutTabs.Visual` without replacement. Their default visual treatments are unchanged. -The background treatment is not applied to the default `River` or `RiverBreakout` variants. +The background treatment is not applied to the default `River` variant or either `RiverBreakout` variant. Updated the River `gridline` variant tablet layout with a `618px` max-width and lateral gridlines. diff --git a/.changeset/river-visual-layout.md b/.changeset/river-visual-layout.md new file mode 100644 index 0000000000..76a149c548 --- /dev/null +++ b/.changeset/river-visual-layout.md @@ -0,0 +1,16 @@ +--- +'@primer/react-brand': minor +'@primer/brand-css': minor +'@primer/brand-primitives': minor +--- + +Added opt-in `position` and `padding` controls to `River.Visual` media in the `gridline` variant. + +🔗 Storybook examples: + +- [Center position](https://stunning-chainsaw-j82glqz.pages.github.io/brand/storybook/?path=/story/components-river-features-gridline-variants--grid-line-visual-position-center) +- [Block-end position](https://stunning-chainsaw-j82glqz.pages.github.io/brand/storybook/?path=/story/components-river-features-gridline-variants--grid-line-visual-position-block-end) +- [Block-end inline-start position](https://stunning-chainsaw-j82glqz.pages.github.io/brand/storybook/?path=/story/components-river-features-gridline-variants--grid-line-visual-position-block-end-inline-start) +- [Block-end inline-end position](https://stunning-chainsaw-j82glqz.pages.github.io/brand/storybook/?path=/story/components-river-features-gridline-variants--grid-line-visual-position-block-end-inline-end) +- [No padding](https://stunning-chainsaw-j82glqz.pages.github.io/brand/storybook/?path=/story/components-river-features-gridline-variants--grid-line-visual-padding-none) +- [Padding on all sides](https://stunning-chainsaw-j82glqz.pages.github.io/brand/storybook/?path=/story/components-river-features-gridline-variants--grid-line-visual-padding-all) diff --git a/.changeset/soft-banners-sparkle.md b/.changeset/soft-banners-sparkle.md index 9fdcebfe45..c940835479 100644 --- a/.changeset/soft-banners-sparkle.md +++ b/.changeset/soft-banners-sparkle.md @@ -4,3 +4,4 @@ - Restored rounded corners to `CTABanner` while preserving square edges when grid lines are enabled. - Improved `ButtonGroup` to forward custom class names alongside its default styles. +- Added native `ActionMenu` child support to `ButtonGroup`, including automatic sizes and positional variants, and the `CTABanner.ButtonGroup` wrapper. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93b98f712b..e5289d3e74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: run: npm run check - name: Run unit tests - run: npm run test + run: npm run test --workspaces --if-present - name: Run MCP server smoke tests run: npm run smoke --workspace=packages/mcp diff --git a/.gitignore b/.gitignore index 90b24199f7..9566ade37a 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ npm-debug.log* yarn-debug.log* yarn-error.log* debug-storybook.log +.playwright-mcp/ # local env files .env diff --git a/apps/next-docs/content/components/ButtonGroup/react.mdx b/apps/next-docs/content/components/ButtonGroup/react.mdx index 9d5c253c8f..4b2f4759dc 100644 --- a/apps/next-docs/content/components/ButtonGroup/react.mdx +++ b/apps/next-docs/content/components/ButtonGroup/react.mdx @@ -1,6 +1,6 @@ --- title: Button group -description: Use the button group component to group related buttons together. +description: Use the button group component to group related buttons and action menus together. keywords: ['buttons', 'control', 'action', 'group', 'paired'] show-tabs: true tab-label: React @@ -12,14 +12,14 @@ storybook: '/brand/storybook/?path=/story/components-buttongroup--playground' import {ButtonGroupSizesProp, ButtonGroupAsProp} from './react' ```js -import {ButtonGroup, Button} from '@primer/react-brand' +import {ActionMenu, Button, ButtonGroup} from '@primer/react-brand' ``` ## Examples ### Default -This is the default variant for the ButtonGroup component. The first button in the group is the primary button and the second button is the secondary button. +This is the default variant for the ButtonGroup component. The first item in the group uses the primary button variant and the second uses the secondary button variant. ```jsx live @@ -28,9 +28,30 @@ This is the default variant for the ButtonGroup component. The first button in t ``` +### Action menus + +`ButtonGroup` supports up to two `Button` or `ActionMenu` children and applies a default `variant` to each one. + +Explicit `variant` overrides to `Button` or `ActionMenu.Button` will override the default values. + +`buttonSize` applies to both child types. Because `ActionMenu` supports only `small` and `medium`, it remains `medium` when `buttonSize="large"`. Set `size` on `ActionMenu` to override the inherited size. + +```jsx live + + + + More actions + + Contact sales + View pricing + + + +``` + ### Sizes -The ButtonGroup component can be rendered in different sizes in `medium` and `large` sizes. The default size is `medium`. +The ButtonGroup component supports `small`, `medium`, and `large` buttons. The default size is `medium`. ActionMenu children support `small` and `medium`. ```jsx live diff --git a/apps/next-docs/content/components/ButtonGroup/react.tsx b/apps/next-docs/content/components/ButtonGroup/react.tsx index 6b3d481fae..47ebed9e48 100644 --- a/apps/next-docs/content/components/ButtonGroup/react.tsx +++ b/apps/next-docs/content/components/ButtonGroup/react.tsx @@ -1,5 +1,5 @@ 'use client' import {PropTableValues} from '@primer/doctocat-nextjs/components' -export const ButtonGroupSizesProp = () => +export const ButtonGroupSizesProp = () => export const ButtonGroupAsProp = () => diff --git a/apps/next-docs/content/components/Hero/react.mdx b/apps/next-docs/content/components/Hero/react.mdx index e5dc329b30..76797dc1bf 100644 --- a/apps/next-docs/content/components/Hero/react.mdx +++ b/apps/next-docs/content/components/Hero/react.mdx @@ -18,7 +18,7 @@ import { } from './react' ```js -import {Hero} from '@primer/react-brand' +import {ActionMenu, Button, Hero} from '@primer/react-brand' ``` ## Examples @@ -33,8 +33,36 @@ import {Hero} from '@primer/react-brand' Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sapien sit ullamcorper id. Aliquam luctus sed turpis felis nam pulvinar risus elementum. - Primary action - Secondary action + + + + + +``` + +### Action menus + +`Hero.ButtonGroup` accepts up to two `Button` or `ActionMenu` children and applies the primary variant to the first item and the secondary variant to the second. Set `variant` on `Button` or `ActionMenu.Button` to override it. + +```jsx live + + This is my super sweet hero heading + + + + More actions + + Contact sales + View pricing + + + ``` @@ -47,14 +75,22 @@ import {Hero} from '@primer/react-brand' Actions Automate your workflow from idea to production - Get started with Actions + + +
Actions Automate your workflow from idea to production - Get started with Actions + + + - Primary action + + + ``` @@ -96,7 +136,11 @@ The `GridLine` variants all feature a trailing border by default. Use `Box` if y Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sapien sit ullamcorper id. Aliquam luctus sed turpis felis nam pulvinar risus elementum. - Primary action + + + ``` @@ -115,7 +159,11 @@ Use [VideoPlayer](/components/VideoPlayer), a native `