@primer/react-brand 0.74.0-rc.ad4a6851 → 0.74.0-rc.bca63c2e
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/docs/components/Card/index.md +2 -2
- package/docs/components/Card/react.md +2 -3
- package/docs/components/Label/index.md +14 -46
- package/docs/components/Label/react.md +23 -20
- package/docs/components/River/react.md +11 -8
- package/docs/components/Token/index.md +4 -3
- package/docs/components/index.md +2 -2
- package/docs/index.md +4 -4
- package/docs/introduction/mcp.md +10 -10
- package/esm/Bento/Bento.d.ts.map +1 -1
- package/esm/Bento/Bento.js +3 -3
- package/esm/Bento/Bento.js.map +1 -1
- package/esm/Card/Card.d.ts +1 -1
- package/esm/Card/Card.js.map +1 -1
- package/esm/Label/Label.d.ts +3 -1
- package/esm/Label/Label.d.ts.map +1 -1
- package/esm/Label/Label.js.map +1 -1
- package/esm/Pillar/Pillar.d.ts +1 -1
- package/esm/Pillar/Pillar.js.map +1 -1
- package/esm/Token/Token.d.ts +2 -2
- package/esm/Token/Token.js.map +1 -1
- package/esm/river/River/River.d.ts +7 -2
- package/esm/river/River/River.d.ts.map +1 -1
- package/esm/river/River/River.js +3 -3
- package/esm/river/River/River.js.map +1 -1
- package/lib/Card/Card.d.ts +1 -1
- package/lib/Label/Label.d.ts +3 -1
- package/lib/Pillar/Pillar.d.ts +1 -1
- package/lib/Token/Token.d.ts +2 -2
- package/lib/css/main.css +70 -70
- package/lib/design-tokens/css/tokens/base/colors/color-scales-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/base/colors/light.css +1 -1
- package/lib/design-tokens/css/tokens/base/size/size.css +1 -1
- package/lib/design-tokens/css/tokens/base/typography/typography.css +1 -1
- package/lib/design-tokens/css/tokens/functional/animation/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/colors/global-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/colors/global.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/accordion/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/action-menu/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/anchor-nav/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/bento/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/blinking-cursor/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/breadcrumbs/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/button/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/card/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/card/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/card/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/comparison-table/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/comparison-table/comparison-table.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/control/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/cta-banner/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/eyebrow-banner/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/eyebrow-banner/eyebrow-banner.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/faq/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/faq/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/faq/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/faq/faq.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/footer/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/footer/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/footer/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/frosted-glass-vfx/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/frosted-glass-vfx/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/grid/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/grid/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/grid/grid.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/hero/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/icon/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/icon/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/ide/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/ide/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/image/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/inline-code/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/inline-code/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/inline-link/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/inline-link/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/inline-link/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/label/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/label/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/link/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/link/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/logosuite/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/logosuite/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/logosuite/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/media-playlist/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/media-playlist/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/nav-list/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/pricing-options/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/pricing-options/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/pricing-options/pricing-options.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/prose/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/prose/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/river/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/river/river.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/river-story-scroll/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/section/section.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/statistic/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/sub-nav/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/sub-nav/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/subdomain-nav-bar/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/tabs/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/tabs/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/tabs/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/testimonial/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/testimonial/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/testimonial/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/tiles/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/timeline/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/timeline/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/timeline/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/token/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/token/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/tooltip/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/tooltip/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/video-player/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/video-player/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/size/border.css +1 -1
- package/lib/design-tokens/css/tokens/functional/size/breakpoints.css +1 -1
- package/lib/design-tokens/css/tokens/functional/size/size-coarse.css +1 -1
- package/lib/design-tokens/css/tokens/functional/size/size-fine.css +1 -1
- package/lib/design-tokens/css/tokens/functional/size/size.css +1 -1
- package/lib/design-tokens/css/tokens/functional/size/viewport.css +1 -1
- package/lib/design-tokens/css/tokens/functional/typography/typography-responsive.css +1 -1
- package/lib/design-tokens/css/tokens/functional/typography/typography.css +1 -1
- package/lib/design-tokens/js/module/tokens/base/colors/light.js +1 -1
- package/lib/design-tokens/js/module/tokens/base/size/size.js +1 -1
- package/lib/design-tokens/js/module/tokens/base/typography/typography.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/animation/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/colors/global.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/bento/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/card/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/card/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/comparison-table/comparison-table.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/eyebrow-banner/eyebrow-banner.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/faq/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/faq/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/faq/faq.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/footer/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/footer/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/frosted-glass-vfx/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/grid/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/grid/grid.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/hero/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/icon/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/ide/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/image/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/inline-code/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/inline-link/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/inline-link/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/label/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/link/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/logosuite/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/logosuite/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/media-playlist/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/pricing-options/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/pricing-options/pricing-options.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/prose/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/river/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/river/river.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/section/section.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/statistic/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/sub-nav/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/tabs/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/tabs/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/testimonial/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/testimonial/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/text-cursor-animation/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/timeline/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/timeline/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/token/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/tooltip/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/video-player/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/size/border.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/size/breakpoints.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/size/size-coarse.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/size/size-fine.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/size/size.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/size/viewport.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/typography/typography-responsive.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/typography/typography.js +1 -1
- package/lib/design-tokens/js/tokens/base/colors/light.js +1 -1
- package/lib/design-tokens/js/tokens/base/size/size.js +1 -1
- package/lib/design-tokens/js/tokens/base/typography/typography.js +1 -1
- package/lib/design-tokens/js/tokens/functional/animation/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/colors/global.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/bento/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/card/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/card/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/comparison-table/comparison-table.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/eyebrow-banner/eyebrow-banner.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/faq/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/faq/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/faq/faq.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/footer/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/footer/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/frosted-glass-vfx/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/grid/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/grid/grid.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/hero/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/icon/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/ide/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/image/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/inline-code/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/inline-link/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/inline-link/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/label/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/link/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/logosuite/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/logosuite/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/media-playlist/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/pricing-options/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/pricing-options/pricing-options.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/prose/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/river/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/river/river.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/section/section.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/statistic/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/sub-nav/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/tabs/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/tabs/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/testimonial/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/testimonial/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/text-cursor-animation/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/timeline/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/timeline/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/token/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/tooltip/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/video-player/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/size/border.js +1 -1
- package/lib/design-tokens/js/tokens/functional/size/breakpoints.js +1 -1
- package/lib/design-tokens/js/tokens/functional/size/size-coarse.js +1 -1
- package/lib/design-tokens/js/tokens/functional/size/size-fine.js +1 -1
- package/lib/design-tokens/js/tokens/functional/size/size.js +1 -1
- package/lib/design-tokens/js/tokens/functional/size/viewport.js +1 -1
- package/lib/design-tokens/js/tokens/functional/typography/typography-responsive.js +1 -1
- package/lib/design-tokens/js/tokens/functional/typography/typography.js +1 -1
- package/lib/design-tokens/scss/tokens/base/colors/light.scss +1 -1
- package/lib/design-tokens/scss/tokens/base/size/size.scss +1 -1
- package/lib/design-tokens/scss/tokens/base/typography/typography.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/animation/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/colors/global.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/bento/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/card/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/card/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/comparison-table/comparison-table.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/eyebrow-banner/eyebrow-banner.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/faq/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/faq/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/faq/faq.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/footer/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/footer/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/frosted-glass-vfx/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/grid/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/grid/grid.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/hero/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/icon/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/ide/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/image/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/inline-code/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/inline-link/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/inline-link/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/label/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/link/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/logosuite/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/logosuite/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/media-playlist/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/pricing-options/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/pricing-options/pricing-options.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/prose/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/river/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/river/river.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/section/section.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/statistic/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/sub-nav/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/tabs/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/tabs/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/testimonial/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/testimonial/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/text-cursor-animation/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/timeline/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/timeline/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/token/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/tooltip/colors.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/components/video-player/base.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/size/border.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/size/breakpoints.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/size/size-coarse.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/size/size-fine.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/size/size.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/size/viewport.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/typography/typography-responsive.scss +1 -1
- package/lib/design-tokens/scss/tokens/functional/typography/typography.scss +1 -1
- package/lib/design-tokens/ts/tokens/base/colors/light.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/base/colors/light.js +1 -1
- package/lib/design-tokens/ts/tokens/base/size/size.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/base/size/size.js +1 -1
- package/lib/design-tokens/ts/tokens/base/typography/typography.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/base/typography/typography.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/animation/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/animation/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/colors/global.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/colors/global.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/bento/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/bento/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/card/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/card/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/card/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/card/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/comparison-table/comparison-table.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/comparison-table/comparison-table.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/eyebrow-banner/eyebrow-banner.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/eyebrow-banner/eyebrow-banner.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/faq/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/faq/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/faq/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/faq/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/faq/faq.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/faq/faq.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/footer/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/footer/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/footer/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/footer/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/frosted-glass-vfx/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/frosted-glass-vfx/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/grid/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/grid/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/grid/grid.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/grid/grid.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/hero/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/hero/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/icon/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/icon/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/ide/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/ide/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/image/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/image/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/inline-code/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/inline-code/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/inline-link/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/inline-link/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/inline-link/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/inline-link/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/label/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/label/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/link/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/link/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/logosuite/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/logosuite/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/logosuite/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/logosuite/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/media-playlist/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/media-playlist/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/pricing-options/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/pricing-options/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/pricing-options/pricing-options.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/pricing-options/pricing-options.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/prose/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/prose/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/river/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/river/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/river/river.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/river/river.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/section/section.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/section/section.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/statistic/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/statistic/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/sub-nav/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/sub-nav/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/tabs/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/tabs/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/tabs/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/tabs/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/testimonial/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/testimonial/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/testimonial/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/testimonial/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/text-cursor-animation/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/text-cursor-animation/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/timeline/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/timeline/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/timeline/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/timeline/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/token/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/token/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/tooltip/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/tooltip/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/video-player/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/video-player/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/border.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/border.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/breakpoints.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/breakpoints.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/size-coarse.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/size-coarse.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/size-fine.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/size-fine.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/size.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/size.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/viewport.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/viewport.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/typography/typography-responsive.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/typography/typography-responsive.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/typography/typography.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/typography/typography.js +1 -1
- package/lib/index.js +1 -1
- package/lib/river/River/River.d.ts +7 -2
- package/llms.txt +4 -4
- package/package.json +1 -1
|
@@ -96,9 +96,9 @@ _Don't use both icon and image as the visual asset._
|
|
|
96
96
|
|
|
97
97
|
### Label
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
Use `Card.Label` for displaying one short label above the heading. It renders a [Token](../Token/index.md) by default.
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
Prefer `Card.Tokens` for showing groups of metadata. Both are optional. Never place the standalone [Label](../Label/index.md) component inside or alongside a Card.
|
|
102
102
|
|
|
103
103
|
### Heading
|
|
104
104
|
|
|
@@ -101,8 +101,7 @@ Use `Card.Tokens` to display one or more [Token](../Token/index.md) components b
|
|
|
101
101
|
|
|
102
102
|
### Label
|
|
103
103
|
|
|
104
|
-
Use `Card.Label`
|
|
105
|
-
`variant="accent-text"` for eyebrow-style copy.
|
|
104
|
+
Use `Card.Label` for displaying one short label above the heading.
|
|
106
105
|
|
|
107
106
|
```jsx
|
|
108
107
|
<Card href="https://github.com" ctaVariant="arrow">
|
|
@@ -197,7 +196,7 @@ When an image should stretch to fill the card width, set `padding="none"` on `Ca
|
|
|
197
196
|
|
|
198
197
|
### Tokens
|
|
199
198
|
|
|
200
|
-
Use `Card.Tokens` to display
|
|
199
|
+
Use `Card.Tokens` to display one or more [Token](../Token/index.md) components.
|
|
201
200
|
|
|
202
201
|
```jsx
|
|
203
202
|
<>
|
|
@@ -1,76 +1,44 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Label
|
|
3
|
-
description: Use
|
|
4
|
-
keywords: ['
|
|
3
|
+
description: Use label to display short status or metadata attached to an object in product-like UI.
|
|
4
|
+
keywords: ['product UI', 'data table', 'issue metadata', 'status', 'indicator']
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
|
-
Use
|
|
11
|
+
Use Label to display short status or metadata attached to an object in product-like UI, such as a data-table row,
|
|
12
|
+
dashboard item, application workflow, or GitHub issue. Keep it visually attached to the object it describes. Label is
|
|
13
|
+
not interactive and should not be used as an isolated eyebrow or pre-heading marker.
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-

|
|
16
|
-
|
|
17
|
-
_Use labels to categorize an item._
|
|
18
|
-
|
|
19
|
-
**❌ Don't**
|
|
20
|
-
|
|
21
|
-

|
|
22
|
-
|
|
23
|
-
_Don't use labels as an interactive or navigational element. Use a button or a link component._
|
|
24
|
-
|
|
25
|
-
Position the labels to clearly identify the object they’re informing.
|
|
26
|
-
|
|
27
|
-
**✅ Do**
|
|
28
|
-
|
|
29
|
-

|
|
30
|
-
|
|
31
|
-
_Give labels enough space to be clearly identified. Use size or color to differentiate them if needed._
|
|
32
|
-
|
|
33
|
-
**❌ Don't**
|
|
34
|
-
|
|
35
|
-

|
|
36
|
-
|
|
37
|
-
_When used along with other items, don't place the label too close to them._
|
|
15
|
+
Choose a size and color that fit the surrounding product UI without relying on color alone to communicate meaning.
|
|
38
16
|
|
|
39
17
|
### Content
|
|
40
18
|
|
|
41
|
-
Use Label with
|
|
19
|
+
Use Label with short, scannable text. A single word is ideal. Use two or more words only when a record's status needs more context, such as “Limited availability" or “Enterprise only".
|
|
42
20
|
|
|
43
21
|
## Options
|
|
44
22
|
|
|
45
23
|
### Size
|
|
46
24
|
|
|
47
|
-
Labels come in
|
|
48
|
-
|
|
49
|
-
### Medium
|
|
25
|
+
Labels come in three sizes: `small`, `medium`, and `large`. Prefer the smallest size that remains legible in the product UI context.
|
|
50
26
|
|
|
51
|
-
|
|
27
|
+
### Small
|
|
52
28
|
|
|
53
|
-
|
|
29
|
+
Use the `small` size for compact data rows and issue-style metadata.
|
|
54
30
|
|
|
55
|
-
|
|
56
|
-
the label helps to quickly scan certain items._
|
|
57
|
-
|
|
58
|
-

|
|
31
|
+
### Medium
|
|
59
32
|
|
|
60
|
-
|
|
61
|
-
visual break._
|
|
33
|
+
Use the `medium` size when record metadata needs more emphasis than the small treatment.
|
|
62
34
|
|
|
63
35
|
### Large
|
|
64
36
|
|
|
65
|
-
Use the `large` size when
|
|
66
|
-
|
|
67
|
-

|
|
68
|
-
|
|
69
|
-
_Use large labels with headings that introduce a page. Use it to introduce the main topic or application._
|
|
37
|
+
Use the `large` size only when product-like UI needs a particularly prominent status treatment.
|
|
70
38
|
|
|
71
39
|
### Color
|
|
72
40
|
|
|
73
|
-
|
|
41
|
+
Label offers color options from the [Primer Brand color palette](../../primitives/color.md). Choose a color that helps distinguish record metadata without relying on color alone to communicate status.
|
|
74
42
|
|
|
75
43
|

|
|
76
44
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Label
|
|
3
|
-
description: Use
|
|
4
|
-
keywords: ['
|
|
3
|
+
description: Use label to display short status or metadata attached to an object in product-like UI.
|
|
4
|
+
keywords: ['product UI', 'data table', 'issue metadata', 'status', 'indicator']
|
|
5
5
|
ready: true
|
|
6
6
|
figma: 'https://www.figma.com/file/BJ95AjraesmRCWsKA013GS/Primer-Brand?node-id=6084-28401'
|
|
7
7
|
source: https://github.com/primer/brand/blob/main/packages/react/src/Label/Label.tsx
|
|
@@ -10,25 +10,32 @@ a11yReviewed: true
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
```js
|
|
13
|
-
import {Label} from '@primer/react-brand'
|
|
13
|
+
import {Label, Stack, Text} from '@primer/react-brand'
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
Use Label to display short status or metadata attached to an object in product-like UI, such as a data-table row,
|
|
17
|
+
dashboard item, application workflow, or GitHub issue. Keep it visually attached to the object it describes. Never use
|
|
18
|
+
Label as an isolated eyebrow or pre-heading marker.
|
|
19
|
+
|
|
16
20
|
## Examples
|
|
17
21
|
|
|
18
22
|
### Default
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
The default Label uses the `medium` size and `default` color. Keep it visually attached to the record it describes.
|
|
21
25
|
|
|
22
26
|
```jsx
|
|
23
|
-
<
|
|
27
|
+
<Stack direction="horizontal" alignItems="center" padding="none">
|
|
28
|
+
<Label>In progress</Label>
|
|
29
|
+
</Stack>
|
|
24
30
|
```
|
|
25
31
|
|
|
26
32
|
### Sizes
|
|
27
33
|
|
|
28
|
-
Use the `size` prop to
|
|
34
|
+
Use the `size` prop to fit the density and emphasis of product UI metadata. Prefer the smallest size that remains
|
|
35
|
+
legible. Do not choose a size based on a nearby heading.
|
|
29
36
|
|
|
30
37
|
```jsx
|
|
31
|
-
<Stack direction="horizontal" alignItems="
|
|
38
|
+
<Stack direction="horizontal" alignItems="center" padding="none">
|
|
32
39
|
<Label size="small">Small</Label>
|
|
33
40
|
<Label size="medium">Medium</Label>
|
|
34
41
|
<Label size="large">Large</Label>
|
|
@@ -37,31 +44,27 @@ Use the `size` prop to adjust the size of the `Label` component. The `small` siz
|
|
|
37
44
|
|
|
38
45
|
### Color
|
|
39
46
|
|
|
40
|
-
Use the `color` prop to
|
|
47
|
+
Use the `color` prop to distinguish metadata attached to the same record. Do not rely on color alone to communicate
|
|
48
|
+
status.
|
|
41
49
|
|
|
42
50
|
```jsx
|
|
43
|
-
<Stack direction="horizontal" alignItems="
|
|
44
|
-
<Label color="
|
|
45
|
-
<Label color="
|
|
46
|
-
<Label color="
|
|
47
|
-
<Label color="red">Red</Label>
|
|
48
|
-
<Label color="pink-blue">Pink blue</Label>
|
|
49
|
-
<Label color="orange">Orange</Label>
|
|
51
|
+
<Stack direction="horizontal" alignItems="center" padding="none" flexWrap="wrap">
|
|
52
|
+
<Label color="red">Bug</Label>
|
|
53
|
+
<Label color="orange">High priority</Label>
|
|
54
|
+
<Label color="blue">Needs review</Label>
|
|
50
55
|
</Stack>
|
|
51
56
|
```
|
|
52
57
|
|
|
53
58
|
### Leading visual
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
Add a leading icon only when it makes product UI metadata easier to scan. Use an [Octicon](https://primer.style/octicons)
|
|
61
|
+
that reinforces the metadata meaning.
|
|
56
62
|
|
|
57
63
|
```jsx
|
|
58
|
-
<Stack direction="horizontal" alignItems="
|
|
64
|
+
<Stack direction="horizontal" alignItems="center" padding="none">
|
|
59
65
|
<Label color="yellow" leadingVisual={<StarIcon />}>
|
|
60
66
|
Starred
|
|
61
67
|
</Label>
|
|
62
|
-
<Label color="blue-purple" leadingVisual={<CopilotIcon />}>
|
|
63
|
-
Copilot
|
|
64
|
-
</Label>
|
|
65
68
|
</Stack>
|
|
66
69
|
```
|
|
67
70
|
|
|
@@ -49,7 +49,6 @@ import {River, RiverBreakout} from '@primer/react-brand'
|
|
|
49
49
|
<img src="/images/placeholder.png" alt="placeholder, blank area with a gray background color" />
|
|
50
50
|
</River.Visual>
|
|
51
51
|
<River.Content>
|
|
52
|
-
<Label>Label</Label>
|
|
53
52
|
<Heading>Heading</Heading>
|
|
54
53
|
<Text>
|
|
55
54
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sapien sit ullamcorper id. Aliquam luctus sed turpis
|
|
@@ -271,14 +270,18 @@ The `gridline` variant adds lateral padding and applies a full-bleed visual back
|
|
|
271
270
|
|
|
272
271
|
### River.Content and RiverBreakout.Content `Required`
|
|
273
272
|
|
|
274
|
-
|
|
273
|
+
`EyebrowText`, [`Text`](../../typography/Text/index.md),
|
|
274
|
+
[`Heading`](../../typography/Heading/index.md), and
|
|
275
|
+
`Link` are the supported `children`. They can be composed in
|
|
276
|
+
any order, but their rendered output will always be in a predetermined order. Standalone `Label` children remain
|
|
277
|
+
rendered for compatibility, but are deprecated; use `EyebrowText` instead.
|
|
275
278
|
|
|
276
|
-
| Name | Type
|
|
277
|
-
| :---------- |
|
|
278
|
-
| `children` | [`Text`](../../typography/Text/index.md),[`Heading`](../../typography/Heading/index.md), `Link` | | Content that corresponds to the adjacent visual. |
|
|
279
|
-
| `className` | `string`
|
|
280
|
-
| `id` | `string`
|
|
281
|
-
| `ref` | `React.RefObject`
|
|
279
|
+
| Name | Type | Default | Description |
|
|
280
|
+
| :---------- | :-------------------------------------------------------------------------------------------------------------- | :-----: | :----------------------------------------------- |
|
|
281
|
+
| `children` | `EyebrowText`, [`Text`](../../typography/Text/index.md), [`Heading`](../../typography/Heading/index.md), `Link` | | Content that corresponds to the adjacent visual. |
|
|
282
|
+
| `className` | `string` | | Sets a custom class on the root element |
|
|
283
|
+
| `id` | `string` | | Sets a custom id |
|
|
284
|
+
| `ref` | `React.RefObject` | | Forward a Ref to the underlying DOM node |
|
|
282
285
|
|
|
283
286
|
### RiverBreakout
|
|
284
287
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Token
|
|
3
|
-
description: Token
|
|
3
|
+
description: Use Token to display compact metadata that describes or supports adjacent content.
|
|
4
4
|
keywords: ['tag', 'metadata', 'category', 'chip', 'link']
|
|
5
5
|
ready: true
|
|
6
6
|
source: https://github.com/primer/brand/blob/main/packages/react/src/Token/Token.tsx
|
|
@@ -12,7 +12,9 @@ a11yReviewed: false
|
|
|
12
12
|
import {Avatar, Stack, Token} from '@primer/react-brand'
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Use Token to display compact metadata that describes or supports adjacent content, such as a category, status, date,
|
|
16
|
+
author, or related topic. Keep it visually attached to the content it describes, and follow each compound component's
|
|
17
|
+
documented child API rather than inserting Token directly.
|
|
16
18
|
|
|
17
19
|
Keep `Token` content short and easy to scan. A single word is ideal. Two short words are acceptable when the category or type needs more context.
|
|
18
20
|
|
|
@@ -81,6 +83,5 @@ Use a leading visual when it helps users scan the Token more quickly. Octicons,
|
|
|
81
83
|
|
|
82
84
|
## Related components
|
|
83
85
|
|
|
84
|
-
- [Label](../Label/index.md): For larger non-interactive status and metadata treatments.
|
|
85
86
|
- Link: For inline navigational text.
|
|
86
87
|
- [Button](../Button/index.md): For higher-emphasis actions.
|
package/docs/components/index.md
CHANGED
|
@@ -25,7 +25,7 @@ description: Primer Brand UI components
|
|
|
25
25
|
- [IDE](IDE/index.md): Use the IDE to showcase a simulated integrated developer environment, complete with a code editor and AI chat that's intended to enhance code representation in marketing contexts.
|
|
26
26
|
- [Image](Image/react.md): Use the image component to display a graphical representation.
|
|
27
27
|
- [Inline code](InlineCode/index.md): Use InlineCode to render a short inline code fragment.
|
|
28
|
-
- [Label](Label/react.md): Use
|
|
28
|
+
- [Label](Label/react.md): Use label to display short status or metadata attached to an object in product-like UI.
|
|
29
29
|
- [Logo suite](LogoSuite/react.md): Use a logo suite to present a list logos, such as sponsors or vendors.
|
|
30
30
|
- [Media playlist](MediaPlaylist/index.md): Use MediaPlaylist to pair thumbnail-backed media items with a shared playback or media area.
|
|
31
31
|
- [Minimal footer](MinimalFooter/index.md): Use the minimal footer component to provide a global footer featuring legal links, social links, and optional footnotes.
|
|
@@ -49,7 +49,7 @@ description: Primer Brand UI components
|
|
|
49
49
|
- [Testimonial](Testimonial/react.md): Use testimonial to display a quote from a customer or user.
|
|
50
50
|
- [Tiles](Tiles/index.md): Use tiles to display a grid of logos or icons with optional links.
|
|
51
51
|
- [Timeline](Timeline/index.md): Use the timeline component to display a list of connected items as a vertical timeline.
|
|
52
|
-
- [Token](Token/index.md): Token
|
|
52
|
+
- [Token](Token/index.md): Use Token to display compact metadata that describes or supports adjacent content.
|
|
53
53
|
- [Tooltip](Tooltip/index.md): Use the tooltip component to display a short message when a user hovers or focuses an interactive element.
|
|
54
54
|
- [Unordered list](UnorderedList/react.md): Use the unordered list component to present a collection of items without specific ordering.
|
|
55
55
|
- [Video player](VideoPlayer/index.md): Use the video player component to enable playback of self-hosted videos
|
package/docs/index.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Primer Brand docs (v0.74.0-rc.
|
|
1
|
+
# Primer Brand docs (v0.74.0-rc.bca63c2e)
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@primer/react-brand@0.74.0-rc.
|
|
3
|
+
These docs are bundled with `@primer/react-brand@0.74.0-rc.bca63c2e` and match your installed version.
|
|
4
4
|
|
|
5
5
|
New here? Start with [Getting started](getting-started/index.md) for installation, global
|
|
6
6
|
stylesheet and font setup. Component directories are named after their import (e.g.
|
|
@@ -59,7 +59,7 @@ stylesheet and font setup. Component directories are named after their import (e
|
|
|
59
59
|
- [IDE](components/IDE/index.md): Use the IDE to showcase a simulated integrated developer environment, complete with a code editor and AI chat that's intended to enhance code representation in marketing contexts.
|
|
60
60
|
- [Image](components/Image/react.md): Use the image component to display a graphical representation.
|
|
61
61
|
- [Inline code](components/InlineCode/index.md): Use InlineCode to render a short inline code fragment.
|
|
62
|
-
- [Label](components/Label/react.md): Use
|
|
62
|
+
- [Label](components/Label/react.md): Use label to display short status or metadata attached to an object in product-like UI.
|
|
63
63
|
- [Logo suite](components/LogoSuite/react.md): Use a logo suite to present a list logos, such as sponsors or vendors.
|
|
64
64
|
- [Media playlist](components/MediaPlaylist/index.md): Use MediaPlaylist to pair thumbnail-backed media items with a shared playback or media area.
|
|
65
65
|
- [Minimal footer](components/MinimalFooter/index.md): Use the minimal footer component to provide a global footer featuring legal links, social links, and optional footnotes.
|
|
@@ -83,7 +83,7 @@ stylesheet and font setup. Component directories are named after their import (e
|
|
|
83
83
|
- [Testimonial](components/Testimonial/react.md): Use testimonial to display a quote from a customer or user.
|
|
84
84
|
- [Tiles](components/Tiles/index.md): Use tiles to display a grid of logos or icons with optional links.
|
|
85
85
|
- [Timeline](components/Timeline/index.md): Use the timeline component to display a list of connected items as a vertical timeline.
|
|
86
|
-
- [Token](components/Token/index.md): Token
|
|
86
|
+
- [Token](components/Token/index.md): Use Token to display compact metadata that describes or supports adjacent content.
|
|
87
87
|
- [Tooltip](components/Tooltip/index.md): Use the tooltip component to display a short message when a user hovers or focuses an interactive element.
|
|
88
88
|
- [Unordered list](components/UnorderedList/react.md): Use the unordered list component to present a collection of items without specific ordering.
|
|
89
89
|
- [Video player](components/VideoPlayer/index.md): Use the video player component to enable playback of self-hosted videos
|
package/docs/introduction/mcp.md
CHANGED
|
@@ -14,16 +14,16 @@ It is a version-aware, local (`stdio`) server that reads the docs and metadata o
|
|
|
14
14
|
|
|
15
15
|
The server exposes a set of tools that AI agents can call:
|
|
16
16
|
|
|
17
|
-
| Tool | What it does
|
|
18
|
-
| -------------------------- |
|
|
19
|
-
| `primer_brand_setup` | Configures Primer Brand first-time and maintains a Primer Brand pointer beside the declaring `package.json`.
|
|
20
|
-
| `primer_brand_page_design` | Page-design conventions (header/footer, hero media, gridline aesthetic, card grids,
|
|
21
|
-
| `primer_brand_component` | Get a component API information like props, allowed values and named sub-components.
|
|
22
|
-
| `primer_brand_examples` | Reference examples taken from our Storybook.
|
|
23
|
-
| `primer_brand_tokens` | Resolve design tokens by intent (color, space, typography) to CSS variables and values.
|
|
24
|
-
| `primer_brand_asset` | Find Octicons (`@primer/octicons-react`) and Octovisuals (`@primer/octovisuals-react`) more easily
|
|
25
|
-
| `primer_brand_docs` | Search and read Primer Brand guidance, including principles, accessibility and getting started.
|
|
26
|
-
| `primer_brand_review` | Check generated JSX and CSS against the design system for unknown components, invalid props, hardcoded values
|
|
17
|
+
| Tool | What it does |
|
|
18
|
+
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| `primer_brand_setup` | Configures Primer Brand first-time and maintains a Primer Brand pointer beside the declaring `package.json`. |
|
|
20
|
+
| `primer_brand_page_design` | Page-design conventions (header/footer, hero media, gridline aesthetic, card grids, metadata patterns) and the current-brand reference templates to start from. |
|
|
21
|
+
| `primer_brand_component` | Get a component API information like props, allowed values and named sub-components. |
|
|
22
|
+
| `primer_brand_examples` | Reference examples taken from our Storybook. |
|
|
23
|
+
| `primer_brand_tokens` | Resolve design tokens by intent (color, space, typography) to CSS variables and values. |
|
|
24
|
+
| `primer_brand_asset` | Find Octicons (`@primer/octicons-react`) and Octovisuals (`@primer/octovisuals-react`) more easily |
|
|
25
|
+
| `primer_brand_docs` | Search and read Primer Brand guidance, including principles, accessibility and getting started. |
|
|
26
|
+
| `primer_brand_review` | Check generated JSX and CSS against the design system for unknown components, invalid props, hardcoded values |
|
|
27
27
|
|
|
28
28
|
## Set up in VS Code
|
|
29
29
|
|
package/esm/Bento/Bento.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bento.d.ts","sourceRoot":"","sources":["../../src/Bento/Bento.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,YAAY,EAA2D,MAAM,OAAO,CAAA;AAGnG,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAA;AAGnD,OAAO,EAAsB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,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GACtC,SAAS,CAAC,cAAc,CAAC,CAAA;AAkF3B,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAA;CAC9B,GAAG,SAAS,CAAC,kBAAkB,CAAC,GAC/B,YAAY,CAAA;AA6Cd,KAAK,gBAAgB,GAAG;IACtB,eAAe,CAAC,EAAE,KAAK,CAAA;IACvB,aAAa,CAAC,EAAE,KAAK,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAA;CACtC,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GACtC,SAAS,CAAC,cAAc,CAAC,CAAA;AAmD3B;;;;GAIG;AACH,eAAO,MAAM,KAAK,4BAtVkB,UAAU;8IAmF3C,cAAc;uHAuNd,gBAAgB;uHA5IhB,iBAAiB;;CAwLgE,CAAA"}
|
package/esm/Bento/Bento.js
CHANGED
|
@@ -46,8 +46,8 @@ var g = ({ className: t, ...n }) => /* @__PURE__ */ m("section", {
|
|
|
46
46
|
}, b = ({ children: n, leadingVisual: r, padding: o = "spacious", verticalAlign: s, horizontalAlign: c = "start", className: d, ...f }) => {
|
|
47
47
|
let m = [l.Bento__Content];
|
|
48
48
|
m.push(..._("Bento__Item", "verticalAlign", s), ..._("Bento__Item", "horizontalAlign", c), ..._("Bento", "padding", o));
|
|
49
|
-
let g = p(() => u.Children.toArray(n), [n]), v = g.filter((e) => u.isValidElement(e) && e.type === x), y = g.find((e) => u.isValidElement(e) && e.type === a), b = g.find((e) => u.isValidElement(e) && e.type === t), S = g.find((e) => u.isValidElement(e) && e.type === i);
|
|
50
|
-
return /* @__PURE__ */ h("div", {
|
|
49
|
+
let g = p(() => u.Children.toArray(n), [n]), v = g.filter((e) => u.isValidElement(e) && e.type === x), y = g.find((e) => u.isValidElement(e) && e.type === a), b = g.find((e) => u.isValidElement(e) && e.type === t), S = g.find((e) => u.isValidElement(e) && e.type === i), C = u.isValidElement(y);
|
|
50
|
+
return C && (process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test") && console.warn("Bento.Content: standalone `Label` children are deprecated. Remove it or migrate from Bento."), /* @__PURE__ */ h("div", {
|
|
51
51
|
className: e(l[`Bento-padding--${o}`], ...m, d),
|
|
52
52
|
...f,
|
|
53
53
|
children: [
|
|
@@ -55,7 +55,7 @@ var g = ({ className: t, ...n }) => /* @__PURE__ */ m("section", {
|
|
|
55
55
|
className: l["Bento__Content-icon"],
|
|
56
56
|
size: r.props.size || 44
|
|
57
57
|
}),
|
|
58
|
-
|
|
58
|
+
C && u.cloneElement(y, { className: e(l["Bento__Content-label"], y.props.className) }),
|
|
59
59
|
v.map((t) => u.cloneElement(t, { className: e(!u.isValidElement(b) && l["Bento__heading--no-text"], c === "center" && l["Bento__heading--with-max-width"], t.props.className) })),
|
|
60
60
|
u.isValidElement(b) && u.cloneElement(b, {
|
|
61
61
|
variant: b.props.variant || "muted",
|
package/esm/Bento/Bento.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bento.js","names":[],"sources":["../../src/Bento/Bento.tsx"],"sourcesContent":["import React, {ReactElement, forwardRef, useCallback, useMemo, Ref, PropsWithChildren} from 'react'\nimport {clsx} from 'clsx'\nimport {useWindowSize, BreakpointSize} from '../hooks/useWindowSize'\nimport type {BaseProps} from '../component-helpers'\nimport findElementInChildren from '../findElementInChildren'\n\nimport {Heading, Text, Link, HeadingProps, TextProps, LinkProps, ColorMode as FullColorMode, Image, Label} from '../'\n\nimport type {IconProps} from '../Icon'\n\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/bento/base.css'\nimport styles from './Bento.module.css'\n\ntype ColorMode = Exclude<FullColorMode, 'auto'>\n\nexport type Size = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge'\nexport type ColumnIndex = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12\n\ntype ResponsiveColumnIndex = Partial<Record<Size, ColumnIndex>>\ntype ResponsiveRowIndex = Partial<Record<Size, number>>\n\ntype Flow = 'row' | 'column'\ntype ResponsiveFlow = Partial<Record<Size, Flow>>\n\ntype Align = 'start' | 'center' | 'end'\ntype ResponsiveAlign = Partial<Record<Size, Align>>\n\ntype Padding = 'condensed' | 'normal' | 'spacious'\ntype ResponsivePadding = Partial<Record<Size, Padding>>\n\ntype Order = 'default' | 'reversed'\ntype ResponsiveOrder = Partial<Record<Size, Order>>\n\ntype BentoProps = React.HTMLAttributes<HTMLDivElement> & BaseProps<HTMLDivElement>\n\nconst Root = ({className, ...rest}: BentoProps) => {\n return <section className={clsx(styles.Bento, className)} {...rest}></section>\n}\n\ntype ValidChildren = React.ReactElement<BentoVisualProps | BentoContentProps>\ntype ValidItemChildren = [ValidChildren?, ValidChildren?]\n\ntype BentoItemProps = {\n columnStart?: ColumnIndex | ResponsiveColumnIndex\n columnSpan?: ColumnIndex | ResponsiveColumnIndex\n rowStart?: number | ResponsiveRowIndex\n rowSpan?: number | ResponsiveRowIndex\n flow?: Flow | ResponsiveFlow\n colorMode?: ColorMode\n visualAsBackground?: boolean\n order?: Order | ResponsiveOrder\n bgColor?: 'default' | 'subtle'\n} & React.HTMLAttributes<HTMLDivElement> &\n BaseProps<HTMLDivElement>\n\nconst returnClassBasedOnResponsiveMap = (\n classIdentifier: string,\n propName: string,\n prop?:\n | ResponsiveColumnIndex\n | ColumnIndex\n | ResponsiveRowIndex\n | number\n | ResponsiveFlow\n | Flow\n | ResponsiveAlign\n | Align\n | ResponsivePadding\n | Padding,\n) => {\n const classesToMerge: string[] = []\n if (typeof prop === 'number' || typeof prop === 'string') {\n classesToMerge.push(styles[`${classIdentifier}--${propName}-${prop}`])\n } else if (typeof prop === 'object') {\n for (const [key, value] of Object.entries(prop)) {\n classesToMerge.push(styles[`${classIdentifier}--${key}-${propName}-${value}`])\n }\n }\n return classesToMerge\n}\n\ntype ReturnOrderedChildrenProps = {\n order: Order | ResponsiveOrder\n children: React.ReactNode\n currentBreakpointSize?: BreakpointSize\n}\n\nconst returnOrderedChildren = ({order, children, currentBreakpointSize}: ReturnOrderedChildrenProps) => {\n if (typeof order === 'string') {\n return order === 'default' ? children : React.Children.toArray(children).reverse()\n } else if (typeof order === 'object' && currentBreakpointSize) {\n // This handles setting the order based on breakpoints as you might expect via CSS\n const filledStyleOrder: ResponsiveOrder = {}\n let previousSize: Order = 'default'\n for (const size of Object.keys(BreakpointSize)) {\n const lowerCaseSize = size.toLocaleLowerCase()\n if (order[lowerCaseSize]) previousSize = order[lowerCaseSize]\n filledStyleOrder[lowerCaseSize] = order[lowerCaseSize] || previousSize\n }\n return filledStyleOrder[currentBreakpointSize] === 'default' ? children : React.Children.toArray(children).reverse()\n } else {\n return children\n }\n}\n\nconst Item = ({\n className,\n columnStart,\n columnSpan = 12,\n rowStart,\n rowSpan = 2,\n flow = 'row',\n colorMode,\n visualAsBackground = false,\n order = 'default',\n bgColor = 'subtle',\n children,\n ...rest\n}: BentoItemProps) => {\n const {currentBreakpointSize} = useWindowSize()\n\n const validChildren = React.Children.toArray(children).reduce<ValidItemChildren>((acc, child) => {\n if (React.isValidElement<BentoVisualProps>(child) && child.type === Visual) {\n acc.push(child)\n }\n if (React.isValidElement<BentoContentProps>(child) && child.type === Content) {\n acc.push(child)\n }\n return acc\n }, [])\n\n const contentChildPadding =\n validChildren.find(\n (child): child is React.ReactElement<BentoContentProps> =>\n React.isValidElement<BentoContentProps>(child) && child.type === Content,\n )?.props.padding || 'spacious'\n\n const bentoItemClassArray = [styles.Bento__Item, styles[`Bento__Item--bgColor-${bgColor}`]]\n\n bentoItemClassArray.push(\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'column-span', columnSpan),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'row-span', rowSpan),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'column-start', columnStart),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'row-start', rowStart),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'flow', flow),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'gap', contentChildPadding),\n )\n\n if (!visualAsBackground && React.Children.toArray(children).length >= 1) {\n if (flow === 'column') {\n bentoItemClassArray.push(styles['Bento-column-padding-override'])\n }\n if (flow === 'row') {\n bentoItemClassArray.push(styles['Bento-row-padding-override'])\n }\n }\n\n const colorModeProp = colorMode ? {'data-color-mode': colorMode} : {}\n\n const orderedChildren = returnOrderedChildren({order, children: validChildren, currentBreakpointSize})\n\n return (\n <div\n {...colorModeProp}\n className={clsx(\n ...bentoItemClassArray,\n (visualAsBackground || React.Children.toArray(children).length === 1) &&\n styles[`Bento__Item--visual-as-background`],\n className,\n )}\n {...rest}\n >\n {orderedChildren}\n </div>\n )\n}\n\ntype BentoContentProps = {\n leadingVisual?: ReactElement<IconProps>\n padding?: Padding | ResponsivePadding\n verticalAlign?: Align | ResponsiveAlign\n horizontalAlign?: Exclude<Align, 'end'> | Partial<Record<Size, Exclude<Align, 'end'>>>\n} & React.HTMLAttributes<HTMLDivElement> &\n BaseProps<HTMLDivElement>\n\nconst Content = ({\n children,\n leadingVisual: LeadingVisual,\n padding = 'spacious',\n verticalAlign,\n horizontalAlign = 'start',\n className,\n ...rest\n}: BentoContentProps) => {\n const bentoContentClassArray = [styles.Bento__Content]\n bentoContentClassArray.push(\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'verticalAlign', verticalAlign),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'horizontalAlign', horizontalAlign),\n ...returnClassBasedOnResponsiveMap('Bento', 'padding', padding),\n )\n\n const memoizedChildren = useMemo(() => React.Children.toArray(children), [children])\n\n const HeadingChildren = memoizedChildren.filter(\n (child): child is React.ReactElement<BentoHeadingProps> =>\n React.isValidElement<BentoHeadingProps>(child) && child.type === _Heading,\n )\n\n const LabelChild = memoizedChildren.find(\n (child): child is React.ReactElement<TextProps> => React.isValidElement<TextProps>(child) && child.type === Label,\n )\n const TextChild = memoizedChildren.find(\n (child): child is React.ReactElement<TextProps> => React.isValidElement<TextProps>(child) && child.type === Text,\n )\n const LinkChild = memoizedChildren.find(\n (child): child is React.ReactElement<LinkProps> => React.isValidElement<LinkProps>(child) && child.type === Link,\n )\n\n return (\n <div className={clsx(styles[`Bento-padding--${padding}`], ...bentoContentClassArray, className)} {...rest}>\n {React.isValidElement<IconProps>(LeadingVisual) &&\n React.cloneElement(LeadingVisual, {\n className: styles['Bento__Content-icon'],\n size: LeadingVisual.props.size || 44,\n })}\n\n {React.isValidElement<TextProps>(LabelChild) &&\n React.cloneElement(LabelChild, {\n className: clsx(styles['Bento__Content-label'], LabelChild.props.className),\n })}\n\n {HeadingChildren.map(HeadingChild =>\n React.cloneElement(HeadingChild, {\n className: clsx(\n !React.isValidElement(TextChild) && styles['Bento__heading--no-text'],\n horizontalAlign === 'center' && styles['Bento__heading--with-max-width'],\n HeadingChild.props.className,\n ),\n }),\n )}\n\n {React.isValidElement<TextProps>(TextChild) &&\n React.cloneElement(TextChild, {\n variant: TextChild.props.variant || 'muted',\n as: TextChild.props.as || 'p',\n size: TextChild.props.size || '300',\n className: clsx(styles['Bento__Content-text'], TextChild.props.className),\n })}\n\n {React.isValidElement<LinkProps>(LinkChild) &&\n React.cloneElement(LinkChild, {\n variant: LinkChild.props.variant || 'accent',\n className: clsx(styles['Bento__call-to-action'], LinkChild.props.className),\n })}\n </div>\n )\n}\n\ntype BentoHeadingProps = {\n variant?: 'default' | 'muted'\n} & BaseProps<HTMLHeadingElement> &\n HeadingProps\n\nconst _Heading = forwardRef(\n (\n {\n as = 'h3',\n size = '5',\n weight = 'medium',\n variant = 'default',\n className,\n children,\n ...props\n }: PropsWithChildren<BentoHeadingProps>,\n ref: Ref<HTMLHeadingElement>,\n ) => {\n const childrenArray = useMemo(() => React.Children.toArray(children), [children])\n\n const getConditionalVariant = useCallback(() => {\n if (findElementInChildren(children, 'b') || findElementInChildren(children, 'em')) {\n return 'muted'\n }\n return 'default'\n }, [children])\n\n const defaultColor = childrenArray.length === 1 ? 'default' : getConditionalVariant()\n\n return (\n <Heading\n ref={ref}\n className={clsx(\n defaultColor === 'muted' && styles[`Bento__heading--muted`],\n variant === 'muted' && styles[`Bento__heading--muted`],\n className,\n )}\n size={size}\n as={as}\n weight={weight}\n {...props}\n >\n {children}\n </Heading>\n )\n },\n)\n\ntype BentoVisualProps = {\n horizontalAlign?: Align\n verticalAlign?: Align\n fillMedia?: boolean\n overflow?: 'hidden' | 'initial'\n position?: string\n padding?: Padding | ResponsivePadding\n} & React.HTMLAttributes<HTMLDivElement> &\n BaseProps<HTMLDivElement>\n\nconst Visual = ({\n horizontalAlign,\n verticalAlign,\n fillMedia = true,\n overflow = 'hidden',\n position = '50% 50%',\n padding,\n className,\n children,\n ...rest\n}: BentoVisualProps) => {\n const bentoVisualClassArray = [\n styles.Bento__Visual,\n horizontalAlign && styles[`Bento__Visual--horizontalAlign-${horizontalAlign}`],\n verticalAlign && styles[`Bento__Visual--verticalAlign-${verticalAlign}`],\n styles[`Bento__Visual--overflow-${overflow}`],\n ]\n bentoVisualClassArray.push(...returnClassBasedOnResponsiveMap('Bento', 'padding', padding))\n const childrenToRender = React.Children.map(children, child => {\n if (React.isValidElement(child)) {\n if (React.isValidElement<React.ImgHTMLAttributes<HTMLImageElement>>(child) && child.type === 'img') {\n return React.cloneElement(child, {\n style: {...child.props.style, objectPosition: position},\n })\n }\n if (React.isValidElement<React.ComponentProps<typeof Image>>(child) && child.type === Image) {\n return React.cloneElement(child, {\n style: {...child.props.style, objectPosition: position},\n })\n }\n return child\n }\n return null\n })\n return (\n <div\n className={clsx(\n ...bentoVisualClassArray,\n fillMedia && styles['Bento__Visual--fill'],\n !fillMedia && styles['Bento__Visual--no-fill'],\n className,\n )}\n {...rest}\n >\n {childrenToRender}\n </div>\n )\n}\n\n/**\n * Use Bento to present content in a responsive grid layout.\n * @deprecated Bento is deprecated and will be removed in a future release. Use CTABanner or River instead.\n * @see https://primer.style/brand/components/Bento\n */\nexport const Bento = Object.assign(Root, {Item, Visual, Content, Heading: _Heading})\n"],"mappings":";;;;;;;;;;;;;AAmCA,IAAM,KAAQ,EAAC,cAAW,GAAG,QACpB,kBAAC,WAAD;CAAS,WAAW,EAAK,EAAO,OAAO,EAAU;CAAE,GAAI;CAAgB,CAAA,EAmB1E,KACJ,GACA,GACA,MAWG;CACH,IAAM,IAA2B,EAAE;AACnC,KAAI,OAAO,KAAS,YAAY,OAAO,KAAS,SAC9C,GAAe,KAAK,EAAO,GAAG,EAAgB,IAAI,EAAS,GAAG,KAAQ;UAC7D,OAAO,KAAS,SACzB,MAAK,IAAM,CAAC,GAAK,MAAU,OAAO,QAAQ,EAAK,CAC7C,GAAe,KAAK,EAAO,GAAG,EAAgB,IAAI,EAAI,GAAG,EAAS,GAAG,KAAS;AAGlF,QAAO;GASH,KAAyB,EAAC,UAAO,aAAU,+BAAuD;AACtG,KAAI,OAAO,KAAU,SACnB,QAAO,MAAU,YAAY,IAAW,EAAM,SAAS,QAAQ,EAAS,CAAC,SAAS;KACzE,OAAO,KAAU,YAAY,GAAuB;EAE7D,IAAM,IAAoC,EAAE,EACxC,IAAsB;AAC1B,OAAK,IAAM,KAAQ,OAAO,KAAK,EAAe,EAAE;GAC9C,IAAM,IAAgB,EAAK,mBAAmB;AAE9C,GADI,EAAM,OAAgB,IAAe,EAAM,KAC/C,EAAiB,KAAiB,EAAM,MAAkB;;AAE5D,SAAO,EAAiB,OAA2B,YAAY,IAAW,EAAM,SAAS,QAAQ,EAAS,CAAC,SAAS;OAEpH,QAAO;GAIL,KAAQ,EACZ,cACA,gBACA,gBAAa,IACb,aACA,aAAU,GACV,UAAO,OACP,cACA,wBAAqB,IACrB,WAAQ,WACR,aAAU,UACV,aACA,GAAG,QACiB;CACpB,IAAM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;CAAS,SAAS;CAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"Bento.js","names":[],"sources":["../../src/Bento/Bento.tsx"],"sourcesContent":["import React, {ReactElement, forwardRef, useCallback, useMemo, Ref, PropsWithChildren} from 'react'\nimport {clsx} from 'clsx'\nimport {useWindowSize, BreakpointSize} from '../hooks/useWindowSize'\nimport type {BaseProps} from '../component-helpers'\nimport findElementInChildren from '../findElementInChildren'\n\nimport {Heading, Text, Link, HeadingProps, TextProps, LinkProps, ColorMode as FullColorMode, Image} from '../'\nimport {Label, type LabelProps} from '../Label'\n\nimport type {IconProps} from '../Icon'\n\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/bento/base.css'\nimport styles from './Bento.module.css'\n\ntype ColorMode = Exclude<FullColorMode, 'auto'>\n\nexport type Size = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge'\nexport type ColumnIndex = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12\n\ntype ResponsiveColumnIndex = Partial<Record<Size, ColumnIndex>>\ntype ResponsiveRowIndex = Partial<Record<Size, number>>\n\ntype Flow = 'row' | 'column'\ntype ResponsiveFlow = Partial<Record<Size, Flow>>\n\ntype Align = 'start' | 'center' | 'end'\ntype ResponsiveAlign = Partial<Record<Size, Align>>\n\ntype Padding = 'condensed' | 'normal' | 'spacious'\ntype ResponsivePadding = Partial<Record<Size, Padding>>\n\ntype Order = 'default' | 'reversed'\ntype ResponsiveOrder = Partial<Record<Size, Order>>\n\ntype BentoProps = React.HTMLAttributes<HTMLDivElement> & BaseProps<HTMLDivElement>\n\nconst Root = ({className, ...rest}: BentoProps) => {\n return <section className={clsx(styles.Bento, className)} {...rest}></section>\n}\n\ntype ValidChildren = React.ReactElement<BentoVisualProps | BentoContentProps>\ntype ValidItemChildren = [ValidChildren?, ValidChildren?]\n\ntype BentoItemProps = {\n columnStart?: ColumnIndex | ResponsiveColumnIndex\n columnSpan?: ColumnIndex | ResponsiveColumnIndex\n rowStart?: number | ResponsiveRowIndex\n rowSpan?: number | ResponsiveRowIndex\n flow?: Flow | ResponsiveFlow\n colorMode?: ColorMode\n visualAsBackground?: boolean\n order?: Order | ResponsiveOrder\n bgColor?: 'default' | 'subtle'\n} & React.HTMLAttributes<HTMLDivElement> &\n BaseProps<HTMLDivElement>\n\nconst returnClassBasedOnResponsiveMap = (\n classIdentifier: string,\n propName: string,\n prop?:\n | ResponsiveColumnIndex\n | ColumnIndex\n | ResponsiveRowIndex\n | number\n | ResponsiveFlow\n | Flow\n | ResponsiveAlign\n | Align\n | ResponsivePadding\n | Padding,\n) => {\n const classesToMerge: string[] = []\n if (typeof prop === 'number' || typeof prop === 'string') {\n classesToMerge.push(styles[`${classIdentifier}--${propName}-${prop}`])\n } else if (typeof prop === 'object') {\n for (const [key, value] of Object.entries(prop)) {\n classesToMerge.push(styles[`${classIdentifier}--${key}-${propName}-${value}`])\n }\n }\n return classesToMerge\n}\n\ntype ReturnOrderedChildrenProps = {\n order: Order | ResponsiveOrder\n children: React.ReactNode\n currentBreakpointSize?: BreakpointSize\n}\n\nconst returnOrderedChildren = ({order, children, currentBreakpointSize}: ReturnOrderedChildrenProps) => {\n if (typeof order === 'string') {\n return order === 'default' ? children : React.Children.toArray(children).reverse()\n } else if (typeof order === 'object' && currentBreakpointSize) {\n // This handles setting the order based on breakpoints as you might expect via CSS\n const filledStyleOrder: ResponsiveOrder = {}\n let previousSize: Order = 'default'\n for (const size of Object.keys(BreakpointSize)) {\n const lowerCaseSize = size.toLocaleLowerCase()\n if (order[lowerCaseSize]) previousSize = order[lowerCaseSize]\n filledStyleOrder[lowerCaseSize] = order[lowerCaseSize] || previousSize\n }\n return filledStyleOrder[currentBreakpointSize] === 'default' ? children : React.Children.toArray(children).reverse()\n } else {\n return children\n }\n}\n\nconst Item = ({\n className,\n columnStart,\n columnSpan = 12,\n rowStart,\n rowSpan = 2,\n flow = 'row',\n colorMode,\n visualAsBackground = false,\n order = 'default',\n bgColor = 'subtle',\n children,\n ...rest\n}: BentoItemProps) => {\n const {currentBreakpointSize} = useWindowSize()\n\n const validChildren = React.Children.toArray(children).reduce<ValidItemChildren>((acc, child) => {\n if (React.isValidElement<BentoVisualProps>(child) && child.type === Visual) {\n acc.push(child)\n }\n if (React.isValidElement<BentoContentProps>(child) && child.type === Content) {\n acc.push(child)\n }\n return acc\n }, [])\n\n const contentChildPadding =\n validChildren.find(\n (child): child is React.ReactElement<BentoContentProps> =>\n React.isValidElement<BentoContentProps>(child) && child.type === Content,\n )?.props.padding || 'spacious'\n\n const bentoItemClassArray = [styles.Bento__Item, styles[`Bento__Item--bgColor-${bgColor}`]]\n\n bentoItemClassArray.push(\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'column-span', columnSpan),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'row-span', rowSpan),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'column-start', columnStart),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'row-start', rowStart),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'flow', flow),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'gap', contentChildPadding),\n )\n\n if (!visualAsBackground && React.Children.toArray(children).length >= 1) {\n if (flow === 'column') {\n bentoItemClassArray.push(styles['Bento-column-padding-override'])\n }\n if (flow === 'row') {\n bentoItemClassArray.push(styles['Bento-row-padding-override'])\n }\n }\n\n const colorModeProp = colorMode ? {'data-color-mode': colorMode} : {}\n\n const orderedChildren = returnOrderedChildren({order, children: validChildren, currentBreakpointSize})\n\n return (\n <div\n {...colorModeProp}\n className={clsx(\n ...bentoItemClassArray,\n (visualAsBackground || React.Children.toArray(children).length === 1) &&\n styles[`Bento__Item--visual-as-background`],\n className,\n )}\n {...rest}\n >\n {orderedChildren}\n </div>\n )\n}\n\ntype BentoContentProps = {\n leadingVisual?: ReactElement<IconProps>\n padding?: Padding | ResponsivePadding\n verticalAlign?: Align | ResponsiveAlign\n horizontalAlign?: Exclude<Align, 'end'> | Partial<Record<Size, Exclude<Align, 'end'>>>\n} & React.HTMLAttributes<HTMLDivElement> &\n BaseProps<HTMLDivElement>\n\nconst Content = ({\n children,\n leadingVisual: LeadingVisual,\n padding = 'spacious',\n verticalAlign,\n horizontalAlign = 'start',\n className,\n ...rest\n}: BentoContentProps) => {\n const bentoContentClassArray = [styles.Bento__Content]\n bentoContentClassArray.push(\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'verticalAlign', verticalAlign),\n ...returnClassBasedOnResponsiveMap('Bento__Item', 'horizontalAlign', horizontalAlign),\n ...returnClassBasedOnResponsiveMap('Bento', 'padding', padding),\n )\n\n const memoizedChildren = useMemo(() => React.Children.toArray(children), [children])\n\n const HeadingChildren = memoizedChildren.filter(\n (child): child is React.ReactElement<BentoHeadingProps> =>\n React.isValidElement<BentoHeadingProps>(child) && child.type === _Heading,\n )\n\n const LabelChild = memoizedChildren.find(\n (child): child is React.ReactElement<LabelProps> => React.isValidElement<LabelProps>(child) && child.type === Label,\n )\n const TextChild = memoizedChildren.find(\n (child): child is React.ReactElement<TextProps> => React.isValidElement<TextProps>(child) && child.type === Text,\n )\n const LinkChild = memoizedChildren.find(\n (child): child is React.ReactElement<LinkProps> => React.isValidElement<LinkProps>(child) && child.type === Link,\n )\n\n const usesDeprecatedLabel = React.isValidElement<LabelProps>(LabelChild)\n\n if (usesDeprecatedLabel && (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test')) {\n // eslint-disable-next-line no-console\n console.warn('Bento.Content: standalone `Label` children are deprecated. Remove it or migrate from Bento.')\n }\n\n return (\n <div className={clsx(styles[`Bento-padding--${padding}`], ...bentoContentClassArray, className)} {...rest}>\n {React.isValidElement<IconProps>(LeadingVisual) &&\n React.cloneElement(LeadingVisual, {\n className: styles['Bento__Content-icon'],\n size: LeadingVisual.props.size || 44,\n })}\n\n {usesDeprecatedLabel &&\n React.cloneElement(LabelChild as React.ReactElement<LabelProps>, {\n className: clsx(styles['Bento__Content-label'], LabelChild.props.className),\n })}\n\n {HeadingChildren.map(HeadingChild =>\n React.cloneElement(HeadingChild, {\n className: clsx(\n !React.isValidElement(TextChild) && styles['Bento__heading--no-text'],\n horizontalAlign === 'center' && styles['Bento__heading--with-max-width'],\n HeadingChild.props.className,\n ),\n }),\n )}\n\n {React.isValidElement<TextProps>(TextChild) &&\n React.cloneElement(TextChild, {\n variant: TextChild.props.variant || 'muted',\n as: TextChild.props.as || 'p',\n size: TextChild.props.size || '300',\n className: clsx(styles['Bento__Content-text'], TextChild.props.className),\n })}\n\n {React.isValidElement<LinkProps>(LinkChild) &&\n React.cloneElement(LinkChild, {\n variant: LinkChild.props.variant || 'accent',\n className: clsx(styles['Bento__call-to-action'], LinkChild.props.className),\n })}\n </div>\n )\n}\n\ntype BentoHeadingProps = {\n variant?: 'default' | 'muted'\n} & BaseProps<HTMLHeadingElement> &\n HeadingProps\n\nconst _Heading = forwardRef(\n (\n {\n as = 'h3',\n size = '5',\n weight = 'medium',\n variant = 'default',\n className,\n children,\n ...props\n }: PropsWithChildren<BentoHeadingProps>,\n ref: Ref<HTMLHeadingElement>,\n ) => {\n const childrenArray = useMemo(() => React.Children.toArray(children), [children])\n\n const getConditionalVariant = useCallback(() => {\n if (findElementInChildren(children, 'b') || findElementInChildren(children, 'em')) {\n return 'muted'\n }\n return 'default'\n }, [children])\n\n const defaultColor = childrenArray.length === 1 ? 'default' : getConditionalVariant()\n\n return (\n <Heading\n ref={ref}\n className={clsx(\n defaultColor === 'muted' && styles[`Bento__heading--muted`],\n variant === 'muted' && styles[`Bento__heading--muted`],\n className,\n )}\n size={size}\n as={as}\n weight={weight}\n {...props}\n >\n {children}\n </Heading>\n )\n },\n)\n\ntype BentoVisualProps = {\n horizontalAlign?: Align\n verticalAlign?: Align\n fillMedia?: boolean\n overflow?: 'hidden' | 'initial'\n position?: string\n padding?: Padding | ResponsivePadding\n} & React.HTMLAttributes<HTMLDivElement> &\n BaseProps<HTMLDivElement>\n\nconst Visual = ({\n horizontalAlign,\n verticalAlign,\n fillMedia = true,\n overflow = 'hidden',\n position = '50% 50%',\n padding,\n className,\n children,\n ...rest\n}: BentoVisualProps) => {\n const bentoVisualClassArray = [\n styles.Bento__Visual,\n horizontalAlign && styles[`Bento__Visual--horizontalAlign-${horizontalAlign}`],\n verticalAlign && styles[`Bento__Visual--verticalAlign-${verticalAlign}`],\n styles[`Bento__Visual--overflow-${overflow}`],\n ]\n bentoVisualClassArray.push(...returnClassBasedOnResponsiveMap('Bento', 'padding', padding))\n const childrenToRender = React.Children.map(children, child => {\n if (React.isValidElement(child)) {\n if (React.isValidElement<React.ImgHTMLAttributes<HTMLImageElement>>(child) && child.type === 'img') {\n return React.cloneElement(child, {\n style: {...child.props.style, objectPosition: position},\n })\n }\n if (React.isValidElement<React.ComponentProps<typeof Image>>(child) && child.type === Image) {\n return React.cloneElement(child, {\n style: {...child.props.style, objectPosition: position},\n })\n }\n return child\n }\n return null\n })\n return (\n <div\n className={clsx(\n ...bentoVisualClassArray,\n fillMedia && styles['Bento__Visual--fill'],\n !fillMedia && styles['Bento__Visual--no-fill'],\n className,\n )}\n {...rest}\n >\n {childrenToRender}\n </div>\n )\n}\n\n/**\n * Use Bento to present content in a responsive grid layout.\n * @deprecated Bento is deprecated and will be removed in a future release. Use CTABanner or River instead.\n * @see https://primer.style/brand/components/Bento\n */\nexport const Bento = Object.assign(Root, {Item, Visual, Content, Heading: _Heading})\n"],"mappings":";;;;;;;;;;;;;AAoCA,IAAM,KAAQ,EAAC,cAAW,GAAG,QACpB,kBAAC,WAAD;CAAS,WAAW,EAAK,EAAO,OAAO,EAAU;CAAE,GAAI;CAAgB,CAAA,EAmB1E,KACJ,GACA,GACA,MAWG;CACH,IAAM,IAA2B,EAAE;AACnC,KAAI,OAAO,KAAS,YAAY,OAAO,KAAS,SAC9C,GAAe,KAAK,EAAO,GAAG,EAAgB,IAAI,EAAS,GAAG,KAAQ;UAC7D,OAAO,KAAS,SACzB,MAAK,IAAM,CAAC,GAAK,MAAU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AAW,EAAO,0BACnC,MAAY,WAAW,EAAO,0BAC9B,EACD;EACK;EACF;EACI;EACR,GAAI;EAEH;EACO,CAAA;EAGf,EAYK,KAAU,EACd,oBACA,kBACA,eAAY,IACZ,cAAW,UACX,cAAW,WACX,YACA,cACA,aACA,GAAG,QACmB;CACtB,IAAM,IAAwB;EAC5B,EAAO;EACP,KAAmB,EAAO,kCAAkC;EAC5D,KAAiB,EAAO,gCAAgC;EACxD,EAAO,2BAA2B;EACnC;AACD,GAAsB,KAAK,GAAG,EAAgC,SAAS,WAAW,EAAQ,CAAC;CAC3F,IAAM,IAAmB,EAAM,SAAS,IAAI,IAAU,MAChD,EAAM,eAAe,EAAM,GACzB,EAAM,eAA0D,EAAM,IAAI,EAAM,SAAS,SAKzF,EAAM,eAAmD,EAAM,IAAI,EAAM,SAAS,IAC7E,EAAM,aAAa,GAAO,EAC/B,OAAO;EAAC,GAAG,EAAM,MAAM;EAAO,gBAAgB;EAAS,EACxD,CAAC,GAEG,IAEF,KACP;AACF,QACE,kBAAC,OAAD;EACE,WAAW,EACT,GAAG,GACH,KAAa,EAAO,wBACpB,CAAC,KAAa,EAAO,2BACrB,EACD;EACD,GAAI;YAEH;EACG,CAAA;GASG,IAAQ,OAAO,OAAO,GAAM;CAAC;CAAM;CAAQ;CAAS,SAAS;CAAS,CAAC"}
|
package/esm/Card/Card.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ type CardDescriptionProps = BaseProps<HTMLParagraphElement> & {
|
|
|
97
97
|
};
|
|
98
98
|
/**
|
|
99
99
|
* Card component:
|
|
100
|
-
*
|
|
100
|
+
* @see https://primer.style/brand/components/Card
|
|
101
101
|
*/
|
|
102
102
|
export declare const Card: React.ForwardRefExoticComponent<Omit<CardProps, "ref"> & React.RefAttributes<HTMLDivElement>> & {
|
|
103
103
|
Image: typeof CardImage;
|
package/esm/Card/Card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","names":[],"sources":["../../src/Card/Card.tsx"],"sourcesContent":["import React, {RefObject, forwardRef} from 'react'\n\nimport {clsx} from 'clsx'\nimport {Heading, HeadingProps, Text, Image, type ImageProps} from '..'\nimport {EyebrowText} from '../EyebrowText'\nimport {Icon, type IconProps} from '../Icon'\nimport {Token} from '../Token'\nimport {ExpandableArrow} from '../ExpandableArrow'\nimport type {BaseProps} from '../component-helpers'\nimport {useProvidedRefOrCreate} from '../hooks/useRef'\nimport {Colors} from '../constants'\nimport {isFragmentElement} from '../utils/isFragmentElement'\n\n/**\n * Design tokens\n */\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/inline-code/colors-with-modes.css'\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/card/base.css'\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/card/colors-with-modes.css'\n\n/**\n * Main stylesheet (as a CSS Module)\n */\nimport styles from './Card.module.css'\nimport stylesLink from '../Link/Link.module.css'\n\nexport const CardVariants = ['default', 'minimal'] as const\nexport const CardCTAVariants = ['text', 'arrow', 'none'] as const\nexport const CardBackgroundColors = ['default', 'subtle', 'none'] as const\nexport const CardTokenPositions = ['block-start', 'block-end'] as const\nexport const CardLabelVariants = ['token', 'accent-text'] as const\nexport const CardImagePaddingOptions = ['default', 'none'] as const\n\nexport const CardIconColors = Colors\n\nexport const defaultCardIconColor = CardIconColors[0]\nexport const defaultCardCTAVariant = CardCTAVariants[0]\nexport const defaultCardLabelVariant = CardLabelVariants[0]\n\nexport type CardVariants = (typeof CardVariants)[number]\nexport type CardCTAVariant = (typeof CardCTAVariants)[number]\nexport type CardTokenPosition = (typeof CardTokenPositions)[number]\nexport type CardLabelVariant = (typeof CardLabelVariants)[number]\nexport type CardBackgroundColor = (typeof CardBackgroundColors)[number]\nexport type CardImagePadding = (typeof CardImagePaddingOptions)[number]\n\ntype CardLeadingVisual = React.ReactElement | React.ComponentType<{className?: string}>\n\nexport type CardProps = {\n /**\n * Specify alternative card appearance\n */\n variant?: CardVariants\n /**\n * Valid children include Card.Image, Card.Icon, Card.Label, Card.Tokens, Card.Heading, and Card.Description\n */\n children:\n | React.ReactNode\n | React.ReactElement<CardImageProps>\n | React.ReactElement<CardIconProps>\n | React.ReactElement<CardLabelProps>\n | React.ReactElement<CardTokensProps>\n | React.ReactElement<CardHeadingProps>\n | React.ReactElement<CardDescriptionProps>\n /**\n * Disable transitions and animations within the Card\n */\n disableAnimation?: boolean\n /**\n * The href of the link\n * */\n href: string\n /**\n * Changes the cta text of the card\n * */\n ctaText?: string\n /**\n * Specifies the presentation of the call-to-action area\n */\n ctaVariant?: CardCTAVariant\n /**\n * Optional, custom background color.\n */\n backgroundColor?: CardBackgroundColor\n /**\n * A visual that appears before the heading, commonly used for a logo or brand mark\n */\n leadingVisual?: CardLeadingVisual\n /**\n * Adds a border to the card.\n */\n hasBorder?: boolean\n /**\n * Fills the width of the parent container and removes the default max-width.\n */\n fullWidth?: boolean\n /**\n * Aligns the card content\n */\n align?: 'start' | 'center'\n} & Omit<BaseProps<HTMLDivElement>, 'animate'> &\n Omit<React.ComponentPropsWithoutRef<'div'>, 'onMouseEnter' | 'onMouseLeave' | 'onFocus' | 'onBlur'> &\n Pick<React.ComponentPropsWithoutRef<'a'>, 'onMouseEnter' | 'onMouseLeave' | 'onFocus' | 'onBlur'>\n\nconst CardRoot = forwardRef<HTMLDivElement, CardProps>(\n (\n {\n align = 'start',\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n children: childrenMaybeWrappedInFragment,\n className,\n ctaText = 'Learn more',\n ctaVariant = defaultCardCTAVariant,\n disableAnimation = false,\n fullWidth = false,\n href,\n hasBorder = false,\n leadingVisual,\n style,\n variant = 'default',\n backgroundColor,\n ...props\n },\n ref,\n ) => {\n const cardRef = useProvidedRefOrCreate(ref as RefObject<HTMLDivElement>)\n const resolvedBackgroundColor =\n backgroundColor ?? (variant === 'minimal' || ctaVariant === 'arrow' ? 'none' : 'default')\n\n let children: React.ReactNode | null\n\n if (childrenMaybeWrappedInFragment == null) {\n children = null\n } else if (isFragmentElement(childrenMaybeWrappedInFragment)) {\n children = childrenMaybeWrappedInFragment.props.children ?? null\n } else {\n children = childrenMaybeWrappedInFragment\n }\n\n const {cardImage, cardIcon, cardLabel, cardTokensBlockStart, cardTokensBlockEnd, cardHeading, cardDescription} =\n React.Children.toArray(children).reduce<{\n cardHeading?: ReturnType<typeof CardHeading>\n cardImage?: ReturnType<typeof CardImage>\n cardIcon?: ReturnType<typeof CardIcon>\n cardLabel?: ReturnType<typeof CardLabel>\n cardTokensBlockStart?: ReturnType<typeof CardTokens>\n cardTokensBlockEnd?: ReturnType<typeof CardTokens>\n cardDescription?: ReturnType<typeof CardDescription>\n }>((acc, child) => {\n if (isCardHeading(child)) {\n acc.cardHeading = React.cloneElement(child, {\n href,\n })\n } else if (isCardImage(child)) {\n acc.cardImage = child\n } else if (isCardIcon(child)) {\n acc.cardIcon = child\n } else if (isCardLabel(child)) {\n acc.cardLabel = child\n } else if (isCardTokens(child)) {\n if (child.props.position === 'block-end') {\n acc.cardTokensBlockEnd = child\n } else {\n acc.cardTokensBlockStart = child\n }\n } else if (isCardDescription(child)) {\n acc.cardDescription = child\n }\n\n return acc\n }, {})\n\n if ((process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') && leadingVisual && cardIcon) {\n // eslint-disable-next-line no-console\n console.warn('Card: `leadingVisual` and `Card.Icon` cannot be used together. `Card.Icon` will not be rendered.')\n }\n\n const renderedLeadingVisual = getRenderableLeadingVisual(leadingVisual)\n const renderedCardIcon = renderedLeadingVisual ? undefined : cardIcon\n const imagePosition = cardImage ? cardImage.props.position || 'block-start' : null\n const shouldRenderLinkArrow = !(align === 'center' && ctaVariant === 'text')\n\n return (\n <DefaultCardWrapperComponent\n style={style}\n className={clsx(\n fullWidth ? styles['Card--fullWidth'] : styles['Card--maxWidth'],\n styles[`Card--align-${align}`],\n )}\n >\n <div\n className={clsx(\n styles.Card,\n disableAnimation && styles['Card--disableAnimation'],\n renderedLeadingVisual && styles['Card--hasLeadingVisual'],\n ctaVariant === 'arrow' && styles['Card--ctaVariant-arrow'],\n cardTokensBlockEnd && styles['Card--tokensPosition-block-end'],\n variant === 'minimal' && styles['Card--variant-minimal'],\n hasBorder && styles['Card--border'],\n styles[`Card--backgroundColor-${resolvedBackgroundColor}`],\n imagePosition && styles[`Card--imagePos-${imagePosition}`],\n className,\n )}\n style={style}\n ref={cardRef}\n {...props}\n >\n {imagePosition === 'block-start' ? cardImage : null}\n {renderedLeadingVisual ? <div className={styles.Card__leadingVisual}>{renderedLeadingVisual}</div> : null}\n {renderedCardIcon}\n {cardTokensBlockStart}\n {cardLabel}\n {cardHeading}\n {cardDescription}\n {cardTokensBlockEnd}\n {imagePosition === 'block-end' ? cardImage : null}\n\n {ctaVariant !== 'none' ? (\n <div\n className={clsx(styles.Card__action, ctaVariant === 'arrow' && styles['Card__action--arrowOnly'])}\n aria-hidden={ctaVariant === 'arrow' ? true : undefined}\n >\n <span className={clsx(ctaVariant === 'arrow' && styles.Card__actionLabelClip)}>\n <Text as=\"span\" size=\"200\" className={clsx(stylesLink['Link--label'], styles.Card__actionLabel)}>\n {ctaText}\n </Text>\n </span>\n {shouldRenderLinkArrow ? (\n <span\n className={clsx(\n styles.Card__actionIcon,\n ctaVariant === 'arrow' && styles['Card__actionIcon--arrowOnly'],\n )}\n >\n <ExpandableArrow\n className={clsx(stylesLink['Link-arrow'], styles['Card--expandableArrow'])}\n aria-hidden=\"true\"\n />\n </span>\n ) : null}\n </div>\n ) : null}\n </div>\n </DefaultCardWrapperComponent>\n )\n },\n)\n\ntype DefaultCardWrapperComponentProps = React.PropsWithChildren<{\n className?: string\n style?: React.CSSProperties\n}>\n\nfunction DefaultCardWrapperComponent({className, children, style}: DefaultCardWrapperComponentProps) {\n return (\n <div className={clsx(styles['Card__outer'], className)} style={style}>\n {children}\n </div>\n )\n}\n\nfunction getRenderableLeadingVisual(leadingVisual?: CardLeadingVisual) {\n if (!leadingVisual) {\n return null\n }\n\n if (typeof leadingVisual === 'function') {\n return React.createElement(leadingVisual, {className: styles['Card__leadingVisualItem']})\n }\n\n if (React.isValidElement<{className?: string}>(leadingVisual)) {\n return React.cloneElement(leadingVisual, {\n className: clsx(styles['Card__leadingVisualItem'], leadingVisual.props.className),\n })\n }\n\n return null\n}\n\nexport type CardImageProps = {\n position?: 'block-start' | 'block-end'\n padding?: CardImagePadding\n} & ImageProps\n\nfunction CardImage({className, position = 'block-start', padding = 'default', ...rest}: CardImageProps) {\n return (\n <div\n className={clsx(\n styles.Card__image,\n styles[`Card__image--position-${position}`],\n padding === 'none' && styles['Card__image--padding-none'],\n )}\n >\n <Image className={className} {...rest} />\n </div>\n )\n}\n\ntype CardIconProps = IconProps\n\nconst CardIcon = ({className, hasBackground = true, ...props}: IconProps) => (\n <Icon className={clsx(styles.Card__icon, className)} hasBackground={hasBackground} {...props} />\n)\n\ntype CardTokensProps = BaseProps<HTMLDivElement> & {\n children: React.ReactNode | React.ReactNode[]\n position?: CardTokenPosition\n}\n\nconst CardTokens = forwardRef<HTMLDivElement, CardTokensProps>(\n ({children, className, position = 'block-start', ...rest}, ref) => {\n return (\n <div\n className={clsx(\n styles.Card__tokens,\n position === 'block-end' && styles['Card__tokens--position-block-end'],\n className,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n )\n },\n)\n\ntype CardLabelProps = Omit<BaseProps<HTMLSpanElement>, 'animate'> &\n Omit<React.ComponentPropsWithoutRef<'span'>, 'children'> & {\n children: React.ReactNode | React.ReactNode[]\n variant?: CardLabelVariant\n }\n\nconst CardLabel = forwardRef<HTMLSpanElement, CardLabelProps>(\n ({children, variant = defaultCardLabelVariant, className, ...rest}, ref) => {\n if (variant === 'accent-text') {\n return (\n <EyebrowText ref={ref} className={clsx(styles.Card__label, className)} variant=\"accent\" {...rest}>\n {children}\n </EyebrowText>\n )\n }\n\n return (\n <Token\n ref={ref as React.Ref<HTMLSpanElement | HTMLAnchorElement>}\n className={clsx(styles.Card__label, className)}\n {...rest}\n >\n {children}\n </Token>\n )\n },\n)\n\ntype CardHeadingProps = BaseProps<HTMLHeadingElement> & {\n children: React.ReactNode | React.ReactNode[]\n as?: Exclude<HeadingProps['as'], 'h1'>\n href?: string\n} & Omit<HeadingProps, 'onMouseEnter' | 'onMouseLeave' | 'onFocus' | 'onBlur'> &\n React.ComponentPropsWithoutRef<'a'>\n\nconst CardHeading = forwardRef<HTMLHeadingElement, CardHeadingProps>(\n ({children, as = 'h3', className, href, onMouseEnter, onMouseLeave, onBlur, onFocus, ...rest}, ref) => {\n return (\n <Heading size=\"6\" className={clsx(styles.Card__heading, className)} ref={ref} as={as} {...rest}>\n <a\n href={href}\n className={clsx(styles.Card__link)}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onBlur={onBlur}\n onFocus={onFocus}\n >\n {children}\n </a>\n </Heading>\n )\n },\n)\n\ntype CardDescriptionProps = BaseProps<HTMLParagraphElement> & {\n children: React.ReactNode | React.ReactNode[]\n}\n\nconst CardDescription = forwardRef<HTMLParagraphElement, CardDescriptionProps>(\n ({children, className, ...rest}, ref) => {\n return (\n <Text variant=\"muted\" ref={ref} size=\"200\" as=\"p\" className={clsx(styles.Card__description, className)} {...rest}>\n {children}\n </Text>\n )\n },\n)\n\nconst createComponentTypeGuard =\n <T,>(componentType: React.ComponentType<T>) =>\n (element: unknown): element is React.ReactElement<T> =>\n React.isValidElement(element) && element.type === componentType\n\nconst isCardImage = createComponentTypeGuard(CardImage)\nconst isCardIcon = createComponentTypeGuard(CardIcon)\nconst isCardLabel = createComponentTypeGuard(CardLabel)\nconst isCardTokens = createComponentTypeGuard(CardTokens)\nconst isCardHeading = createComponentTypeGuard(CardHeading)\nconst isCardDescription = createComponentTypeGuard(CardDescription)\n\n/**\n * Card component:\n * {@link https://primer.style/brand/components/Card/ See usage examples}.\n */\nexport const Card = Object.assign(CardRoot, {\n Image: CardImage,\n Icon: CardIcon,\n Label: CardLabel,\n Tokens: CardTokens,\n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iBAAc,iBAAc,WAAQ,YAAS,GAAG,KAAO,MAE3F,kBAAC,GAAD;CAAS,MAAK;CAAI,WAAW,EAAK,EAAO,eAAe,EAAU;CAAO;CAAS;CAAI,GAAI;WACxF,kBAAC,KAAD;EACQ;EACN,WAAW,EAAK,EAAO,WAAW;EACpB;EACA;EACN;EACC;EAER;EACC,CAAA;CACI,CAAA,CAGf,EAMK,IAAkB,GACrB,EAAC,aAAU,cAAW,GAAG,KAAO,MAE7B,kBAAC,GAAD;CAAM,SAAQ;CAAa;CAAK,MAAK;CAAM,IAAG;CAAI,WAAW,EAAK,EAAO,mBAAmB,EAAU;CAAE,GAAI;CACzG;CACI,CAAA,CAGZ,EAEK,KACC,OACJ,MACC,EAAM,eAAe,EAAQ,IAAI,EAAQ,SAAS,GAEhD,IAAc,EAAyB,EAAU,EACjD,IAAa,EAAyB,EAAS,EAC/C,IAAc,EAAyB,EAAU,EACjD,IAAe,EAAyB,EAAW,EACnD,IAAgB,EAAyB,EAAY,EACrD,IAAoB,EAAyB,EAAgB,EAMtD,IAAO,OAAO,OAAO,GAAU;CAC1C,OAAO;CACP,MAAM;CACN,OAAO;CACP,QAAQ;CACR,SAAS;CACT,aAAa;CACd,CAAC"}
|
|
1
|
+
{"version":3,"file":"Card.js","names":[],"sources":["../../src/Card/Card.tsx"],"sourcesContent":["import React, {RefObject, forwardRef} from 'react'\n\nimport {clsx} from 'clsx'\nimport {Heading, HeadingProps, Text, Image, type ImageProps} from '..'\nimport {EyebrowText} from '../EyebrowText'\nimport {Icon, type IconProps} from '../Icon'\nimport {Token} from '../Token'\nimport {ExpandableArrow} from '../ExpandableArrow'\nimport type {BaseProps} from '../component-helpers'\nimport {useProvidedRefOrCreate} from '../hooks/useRef'\nimport {Colors} from '../constants'\nimport {isFragmentElement} from '../utils/isFragmentElement'\n\n/**\n * Design tokens\n */\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/inline-code/colors-with-modes.css'\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/card/base.css'\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/card/colors-with-modes.css'\n\n/**\n * Main stylesheet (as a CSS Module)\n */\nimport styles from './Card.module.css'\nimport stylesLink from '../Link/Link.module.css'\n\nexport const CardVariants = ['default', 'minimal'] as const\nexport const CardCTAVariants = ['text', 'arrow', 'none'] as const\nexport const CardBackgroundColors = ['default', 'subtle', 'none'] as const\nexport const CardTokenPositions = ['block-start', 'block-end'] as const\nexport const CardLabelVariants = ['token', 'accent-text'] as const\nexport const CardImagePaddingOptions = ['default', 'none'] as const\n\nexport const CardIconColors = Colors\n\nexport const defaultCardIconColor = CardIconColors[0]\nexport const defaultCardCTAVariant = CardCTAVariants[0]\nexport const defaultCardLabelVariant = CardLabelVariants[0]\n\nexport type CardVariants = (typeof CardVariants)[number]\nexport type CardCTAVariant = (typeof CardCTAVariants)[number]\nexport type CardTokenPosition = (typeof CardTokenPositions)[number]\nexport type CardLabelVariant = (typeof CardLabelVariants)[number]\nexport type CardBackgroundColor = (typeof CardBackgroundColors)[number]\nexport type CardImagePadding = (typeof CardImagePaddingOptions)[number]\n\ntype CardLeadingVisual = React.ReactElement | React.ComponentType<{className?: string}>\n\nexport type CardProps = {\n /**\n * Specify alternative card appearance\n */\n variant?: CardVariants\n /**\n * Valid children include Card.Image, Card.Icon, Card.Label, Card.Tokens, Card.Heading, and Card.Description\n */\n children:\n | React.ReactNode\n | React.ReactElement<CardImageProps>\n | React.ReactElement<CardIconProps>\n | React.ReactElement<CardLabelProps>\n | React.ReactElement<CardTokensProps>\n | React.ReactElement<CardHeadingProps>\n | React.ReactElement<CardDescriptionProps>\n /**\n * Disable transitions and animations within the Card\n */\n disableAnimation?: boolean\n /**\n * The href of the link\n * */\n href: string\n /**\n * Changes the cta text of the card\n * */\n ctaText?: string\n /**\n * Specifies the presentation of the call-to-action area\n */\n ctaVariant?: CardCTAVariant\n /**\n * Optional, custom background color.\n */\n backgroundColor?: CardBackgroundColor\n /**\n * A visual that appears before the heading, commonly used for a logo or brand mark\n */\n leadingVisual?: CardLeadingVisual\n /**\n * Adds a border to the card.\n */\n hasBorder?: boolean\n /**\n * Fills the width of the parent container and removes the default max-width.\n */\n fullWidth?: boolean\n /**\n * Aligns the card content\n */\n align?: 'start' | 'center'\n} & Omit<BaseProps<HTMLDivElement>, 'animate'> &\n Omit<React.ComponentPropsWithoutRef<'div'>, 'onMouseEnter' | 'onMouseLeave' | 'onFocus' | 'onBlur'> &\n Pick<React.ComponentPropsWithoutRef<'a'>, 'onMouseEnter' | 'onMouseLeave' | 'onFocus' | 'onBlur'>\n\nconst CardRoot = forwardRef<HTMLDivElement, CardProps>(\n (\n {\n align = 'start',\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n children: childrenMaybeWrappedInFragment,\n className,\n ctaText = 'Learn more',\n ctaVariant = defaultCardCTAVariant,\n disableAnimation = false,\n fullWidth = false,\n href,\n hasBorder = false,\n leadingVisual,\n style,\n variant = 'default',\n backgroundColor,\n ...props\n },\n ref,\n ) => {\n const cardRef = useProvidedRefOrCreate(ref as RefObject<HTMLDivElement>)\n const resolvedBackgroundColor =\n backgroundColor ?? (variant === 'minimal' || ctaVariant === 'arrow' ? 'none' : 'default')\n\n let children: React.ReactNode | null\n\n if (childrenMaybeWrappedInFragment == null) {\n children = null\n } else if (isFragmentElement(childrenMaybeWrappedInFragment)) {\n children = childrenMaybeWrappedInFragment.props.children ?? null\n } else {\n children = childrenMaybeWrappedInFragment\n }\n\n const {cardImage, cardIcon, cardLabel, cardTokensBlockStart, cardTokensBlockEnd, cardHeading, cardDescription} =\n React.Children.toArray(children).reduce<{\n cardHeading?: ReturnType<typeof CardHeading>\n cardImage?: ReturnType<typeof CardImage>\n cardIcon?: ReturnType<typeof CardIcon>\n cardLabel?: ReturnType<typeof CardLabel>\n cardTokensBlockStart?: ReturnType<typeof CardTokens>\n cardTokensBlockEnd?: ReturnType<typeof CardTokens>\n cardDescription?: ReturnType<typeof CardDescription>\n }>((acc, child) => {\n if (isCardHeading(child)) {\n acc.cardHeading = React.cloneElement(child, {\n href,\n })\n } else if (isCardImage(child)) {\n acc.cardImage = child\n } else if (isCardIcon(child)) {\n acc.cardIcon = child\n } else if (isCardLabel(child)) {\n acc.cardLabel = child\n } else if (isCardTokens(child)) {\n if (child.props.position === 'block-end') {\n acc.cardTokensBlockEnd = child\n } else {\n acc.cardTokensBlockStart = child\n }\n } else if (isCardDescription(child)) {\n acc.cardDescription = child\n }\n\n return acc\n }, {})\n\n if ((process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') && leadingVisual && cardIcon) {\n // eslint-disable-next-line no-console\n console.warn('Card: `leadingVisual` and `Card.Icon` cannot be used together. `Card.Icon` will not be rendered.')\n }\n\n const renderedLeadingVisual = getRenderableLeadingVisual(leadingVisual)\n const renderedCardIcon = renderedLeadingVisual ? undefined : cardIcon\n const imagePosition = cardImage ? cardImage.props.position || 'block-start' : null\n const shouldRenderLinkArrow = !(align === 'center' && ctaVariant === 'text')\n\n return (\n <DefaultCardWrapperComponent\n style={style}\n className={clsx(\n fullWidth ? styles['Card--fullWidth'] : styles['Card--maxWidth'],\n styles[`Card--align-${align}`],\n )}\n >\n <div\n className={clsx(\n styles.Card,\n disableAnimation && styles['Card--disableAnimation'],\n renderedLeadingVisual && styles['Card--hasLeadingVisual'],\n ctaVariant === 'arrow' && styles['Card--ctaVariant-arrow'],\n cardTokensBlockEnd && styles['Card--tokensPosition-block-end'],\n variant === 'minimal' && styles['Card--variant-minimal'],\n hasBorder && styles['Card--border'],\n styles[`Card--backgroundColor-${resolvedBackgroundColor}`],\n imagePosition && styles[`Card--imagePos-${imagePosition}`],\n className,\n )}\n style={style}\n ref={cardRef}\n {...props}\n >\n {imagePosition === 'block-start' ? cardImage : null}\n {renderedLeadingVisual ? <div className={styles.Card__leadingVisual}>{renderedLeadingVisual}</div> : null}\n {renderedCardIcon}\n {cardTokensBlockStart}\n {cardLabel}\n {cardHeading}\n {cardDescription}\n {cardTokensBlockEnd}\n {imagePosition === 'block-end' ? cardImage : null}\n\n {ctaVariant !== 'none' ? (\n <div\n className={clsx(styles.Card__action, ctaVariant === 'arrow' && styles['Card__action--arrowOnly'])}\n aria-hidden={ctaVariant === 'arrow' ? true : undefined}\n >\n <span className={clsx(ctaVariant === 'arrow' && styles.Card__actionLabelClip)}>\n <Text as=\"span\" size=\"200\" className={clsx(stylesLink['Link--label'], styles.Card__actionLabel)}>\n {ctaText}\n </Text>\n </span>\n {shouldRenderLinkArrow ? (\n <span\n className={clsx(\n styles.Card__actionIcon,\n ctaVariant === 'arrow' && styles['Card__actionIcon--arrowOnly'],\n )}\n >\n <ExpandableArrow\n className={clsx(stylesLink['Link-arrow'], styles['Card--expandableArrow'])}\n aria-hidden=\"true\"\n />\n </span>\n ) : null}\n </div>\n ) : null}\n </div>\n </DefaultCardWrapperComponent>\n )\n },\n)\n\ntype DefaultCardWrapperComponentProps = React.PropsWithChildren<{\n className?: string\n style?: React.CSSProperties\n}>\n\nfunction DefaultCardWrapperComponent({className, children, style}: DefaultCardWrapperComponentProps) {\n return (\n <div className={clsx(styles['Card__outer'], className)} style={style}>\n {children}\n </div>\n )\n}\n\nfunction getRenderableLeadingVisual(leadingVisual?: CardLeadingVisual) {\n if (!leadingVisual) {\n return null\n }\n\n if (typeof leadingVisual === 'function') {\n return React.createElement(leadingVisual, {className: styles['Card__leadingVisualItem']})\n }\n\n if (React.isValidElement<{className?: string}>(leadingVisual)) {\n return React.cloneElement(leadingVisual, {\n className: clsx(styles['Card__leadingVisualItem'], leadingVisual.props.className),\n })\n }\n\n return null\n}\n\nexport type CardImageProps = {\n position?: 'block-start' | 'block-end'\n padding?: CardImagePadding\n} & ImageProps\n\nfunction CardImage({className, position = 'block-start', padding = 'default', ...rest}: CardImageProps) {\n return (\n <div\n className={clsx(\n styles.Card__image,\n styles[`Card__image--position-${position}`],\n padding === 'none' && styles['Card__image--padding-none'],\n )}\n >\n <Image className={className} {...rest} />\n </div>\n )\n}\n\ntype CardIconProps = IconProps\n\nconst CardIcon = ({className, hasBackground = true, ...props}: IconProps) => (\n <Icon className={clsx(styles.Card__icon, className)} hasBackground={hasBackground} {...props} />\n)\n\ntype CardTokensProps = BaseProps<HTMLDivElement> & {\n children: React.ReactNode | React.ReactNode[]\n position?: CardTokenPosition\n}\n\nconst CardTokens = forwardRef<HTMLDivElement, CardTokensProps>(\n ({children, className, position = 'block-start', ...rest}, ref) => {\n return (\n <div\n className={clsx(\n styles.Card__tokens,\n position === 'block-end' && styles['Card__tokens--position-block-end'],\n className,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n )\n },\n)\n\ntype CardLabelProps = Omit<BaseProps<HTMLSpanElement>, 'animate'> &\n Omit<React.ComponentPropsWithoutRef<'span'>, 'children'> & {\n children: React.ReactNode | React.ReactNode[]\n variant?: CardLabelVariant\n }\n\nconst CardLabel = forwardRef<HTMLSpanElement, CardLabelProps>(\n ({children, variant = defaultCardLabelVariant, className, ...rest}, ref) => {\n if (variant === 'accent-text') {\n return (\n <EyebrowText ref={ref} className={clsx(styles.Card__label, className)} variant=\"accent\" {...rest}>\n {children}\n </EyebrowText>\n )\n }\n\n return (\n <Token\n ref={ref as React.Ref<HTMLSpanElement | HTMLAnchorElement>}\n className={clsx(styles.Card__label, className)}\n {...rest}\n >\n {children}\n </Token>\n )\n },\n)\n\ntype CardHeadingProps = BaseProps<HTMLHeadingElement> & {\n children: React.ReactNode | React.ReactNode[]\n as?: Exclude<HeadingProps['as'], 'h1'>\n href?: string\n} & Omit<HeadingProps, 'onMouseEnter' | 'onMouseLeave' | 'onFocus' | 'onBlur'> &\n React.ComponentPropsWithoutRef<'a'>\n\nconst CardHeading = forwardRef<HTMLHeadingElement, CardHeadingProps>(\n ({children, as = 'h3', className, href, onMouseEnter, onMouseLeave, onBlur, onFocus, ...rest}, ref) => {\n return (\n <Heading size=\"6\" className={clsx(styles.Card__heading, className)} ref={ref} as={as} {...rest}>\n <a\n href={href}\n className={clsx(styles.Card__link)}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onBlur={onBlur}\n onFocus={onFocus}\n >\n {children}\n </a>\n </Heading>\n )\n },\n)\n\ntype CardDescriptionProps = BaseProps<HTMLParagraphElement> & {\n children: React.ReactNode | React.ReactNode[]\n}\n\nconst CardDescription = forwardRef<HTMLParagraphElement, CardDescriptionProps>(\n ({children, className, ...rest}, ref) => {\n return (\n <Text variant=\"muted\" ref={ref} size=\"200\" as=\"p\" className={clsx(styles.Card__description, className)} {...rest}>\n {children}\n </Text>\n )\n },\n)\n\nconst createComponentTypeGuard =\n <T,>(componentType: React.ComponentType<T>) =>\n (element: unknown): element is React.ReactElement<T> =>\n React.isValidElement(element) && element.type === componentType\n\nconst isCardImage = createComponentTypeGuard(CardImage)\nconst isCardIcon = createComponentTypeGuard(CardIcon)\nconst isCardLabel = createComponentTypeGuard(CardLabel)\nconst isCardTokens = createComponentTypeGuard(CardTokens)\nconst isCardHeading = createComponentTypeGuard(CardHeading)\nconst isCardDescription = createComponentTypeGuard(CardDescription)\n\n/**\n * Card component:\n * @see https://primer.style/brand/components/Card\n */\nexport const Card = Object.assign(CardRoot, {\n Image: CardImage,\n Icon: CardIcon,\n Label: CardLabel,\n Tokens: CardTokens,\n Heading: CardHeading,\n Description: CardDescription,\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0BA,IAAa,IAAe,CAAC,WAAW,UAAU,EACrC,IAAkB;CAAC;CAAQ;CAAS;CAAO,EAC3C,IAAuB;CAAC;CAAW;CAAU;CAAO,EACpD,IAAqB,CAAC,eAAe,YAAY,EACjD,IAAoB,CAAC,SAAS,cAAc,EAC5C,IAA0B,CAAC,WAAW,OAAO,EAE7C,IAAiB,GAEjB,IAAuB,EAAe,IACtC,IAAwB,EAAgB,IACxC,IAA0B,EAAkB,IAmEnD,IAAW,GAEb,EACE,WAAQ,SACR,iBACA,iBACA,YACA,WACA,UAAU,GACV,cACA,aAAU,cACV,gBAAa,GAC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