@primer/react-brand 0.74.0 → 0.75.0-rc.a3f7dbd6
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/RiverAccordion/index.md +49 -6
- package/docs/index.md +2 -2
- package/esm/Hero/sub-components/HeroLabel.d.ts +1 -0
- package/esm/Hero/sub-components/HeroLabel.d.ts.map +1 -1
- package/esm/Hero/sub-components/HeroLabel.js +7 -6
- package/esm/Hero/sub-components/HeroLabel.js.map +1 -1
- package/esm/TextCursorAnimation/TextCursorAnimation.d.ts +8 -3
- package/esm/TextCursorAnimation/TextCursorAnimation.d.ts.map +1 -1
- package/esm/TextCursorAnimation/TextCursorAnimation.js +53 -27
- package/esm/TextCursorAnimation/TextCursorAnimation.js.map +1 -1
- package/esm/TextCursorAnimation/TextCursorAnimation.module-BS4hPR8H.css +1 -0
- package/esm/TextCursorAnimation/TextCursorAnimation.module.js +14 -4
- package/esm/TextCursorAnimation/TextCursorAnimation.module.js.map +1 -1
- package/esm/hooks/useCursorAnimation.d.ts +8 -31
- package/esm/hooks/useCursorAnimation.d.ts.map +1 -1
- package/esm/hooks/useCursorAnimation.js +84 -36
- package/esm/hooks/useCursorAnimation.js.map +1 -1
- package/esm/packages/design-tokens/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/base-DKbXhPKv.css +1 -0
- package/esm/packages/design-tokens/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors-with-modes-BucKYl1n.css +1 -0
- package/esm/river/RiverAccordion/RiverAccordion.d.ts +13 -4
- package/esm/river/RiverAccordion/RiverAccordion.d.ts.map +1 -1
- package/esm/river/RiverAccordion/RiverAccordion.js +35 -24
- package/esm/river/RiverAccordion/RiverAccordion.js.map +1 -1
- package/esm/river/RiverAccordion/RiverAccordion.module-Cr6Q-qkm.css +1 -0
- package/esm/river/RiverAccordion/RiverAccordion.module.js +7 -3
- package/esm/river/RiverAccordion/RiverAccordion.module.js.map +1 -1
- package/lib/Hero/sub-components/HeroLabel.d.ts +1 -0
- package/lib/TextCursorAnimation/TextCursorAnimation.d.ts +8 -3
- package/lib/css/main.css +188 -126
- 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/base.css +8 -0
- package/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors-with-modes.css +7 -3
- package/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors.css +4 -2
- 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/base.js +14 -0
- package/lib/design-tokens/js/module/tokens/functional/components/text-cursor-animation/colors.js +10 -2
- 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/base.js +6 -0
- package/lib/design-tokens/js/tokens/functional/components/text-cursor-animation/colors.js +4 -2
- 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/json/colors.json +3 -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/base.scss +5 -0
- package/lib/design-tokens/scss/tokens/functional/components/text-cursor-animation/colors.scss +4 -2
- 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/base.d.ts +17 -0
- package/lib/design-tokens/ts/tokens/functional/components/text-cursor-animation/base.js +14 -0
- package/lib/design-tokens/ts/tokens/functional/components/text-cursor-animation/colors.d.ts +4 -2
- package/lib/design-tokens/ts/tokens/functional/components/text-cursor-animation/colors.js +4 -2
- 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/hooks/useCursorAnimation.d.ts +8 -31
- package/lib/index.js +1 -1
- package/lib/river/RiverAccordion/RiverAccordion.d.ts +13 -4
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/esm/TextCursorAnimation/TextCursorAnimation.module-BJLhwKrK.css +0 -1
- package/esm/packages/design-tokens/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors-with-modes-BODdIvrY.css +0 -1
- package/esm/river/RiverAccordion/RiverAccordion.module-BTU_metB.css +0 -1
|
@@ -155,6 +155,47 @@ Use the `gridline` variant to add horizontal border lines, equal-width columns,
|
|
|
155
155
|
</RiverAccordion>
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
+
Set `hasBackground={false}` on a `RiverAccordion.Visual` to remove its background and inline start padding.
|
|
159
|
+
|
|
160
|
+
`leadingVisual` can also be set on `RiverAccordion.Heading` to add optional Octicons to the summary.
|
|
161
|
+
|
|
162
|
+
```jsx
|
|
163
|
+
<RiverAccordion variant="gridline">
|
|
164
|
+
<RiverAccordion.Item>
|
|
165
|
+
<RiverAccordion.Heading leadingVisual={<Icon icon={CopilotIcon} />}>Heading 1</RiverAccordion.Heading>
|
|
166
|
+
<RiverAccordion.Content>
|
|
167
|
+
<Text>This item removes the visual background and padding while preserving the media's aspect ratio.</Text>
|
|
168
|
+
<Link href="#">Call to action</Link>
|
|
169
|
+
</RiverAccordion.Content>
|
|
170
|
+
<RiverAccordion.Visual hasBackground={false}>
|
|
171
|
+
<img src="/images/placeholder-1.png" alt="Visual content for item 1" />
|
|
172
|
+
</RiverAccordion.Visual>
|
|
173
|
+
</RiverAccordion.Item>
|
|
174
|
+
|
|
175
|
+
<RiverAccordion.Item>
|
|
176
|
+
<RiverAccordion.Heading leadingVisual={<Icon icon={CopilotIcon} />}>Heading 2</RiverAccordion.Heading>
|
|
177
|
+
<RiverAccordion.Content>
|
|
178
|
+
<Text>The visual is displayed without a background while the accordion interaction stays the same.</Text>
|
|
179
|
+
<Link href="#">Call to action</Link>
|
|
180
|
+
</RiverAccordion.Content>
|
|
181
|
+
<RiverAccordion.Visual hasBackground={false}>
|
|
182
|
+
<img src="/images/placeholder-2.png" alt="Visual content for item 2" />
|
|
183
|
+
</RiverAccordion.Visual>
|
|
184
|
+
</RiverAccordion.Item>
|
|
185
|
+
|
|
186
|
+
<RiverAccordion.Item>
|
|
187
|
+
<RiverAccordion.Heading leadingVisual={<Icon icon={CopilotIcon} />}>Heading 3</RiverAccordion.Heading>
|
|
188
|
+
<RiverAccordion.Content>
|
|
189
|
+
<Text>Use this treatment when visuals should appear without a surrounding background panel.</Text>
|
|
190
|
+
<Link href="#">Call to action</Link>
|
|
191
|
+
</RiverAccordion.Content>
|
|
192
|
+
<RiverAccordion.Visual hasBackground={false}>
|
|
193
|
+
<img src="/images/placeholder-3.png" alt="Visual content for item 3" />
|
|
194
|
+
</RiverAccordion.Visual>
|
|
195
|
+
</RiverAccordion.Item>
|
|
196
|
+
</RiverAccordion>
|
|
197
|
+
```
|
|
198
|
+
|
|
158
199
|
## Component props
|
|
159
200
|
|
|
160
201
|
### RiverAccordion `Required`
|
|
@@ -177,9 +218,10 @@ Use the `gridline` variant to add horizontal border lines, equal-width columns,
|
|
|
177
218
|
|
|
178
219
|
### RiverAccordion.Heading `Required`
|
|
179
220
|
|
|
180
|
-
| Name
|
|
181
|
-
|
|
|
182
|
-
| `children`
|
|
221
|
+
| Name | Type | Default | Description |
|
|
222
|
+
| :-------------- | :--------------------- | :-----: | :--------------------------------------------- |
|
|
223
|
+
| `children` | `string` | | Heading text |
|
|
224
|
+
| `leadingVisual` | `ReactElement \| Icon` | | Decorative visual displayed before the heading |
|
|
183
225
|
|
|
184
226
|
`RiverAccordion.Heading` extends the [`Heading`](../../typography/Heading/index.md) component and supports all `Heading` props.
|
|
185
227
|
|
|
@@ -193,8 +235,9 @@ Use the `gridline` variant to add horizontal border lines, equal-width columns,
|
|
|
193
235
|
|
|
194
236
|
### RiverAccordion.Visual `Required`
|
|
195
237
|
|
|
196
|
-
| Name
|
|
197
|
-
|
|
|
198
|
-
| `children`
|
|
238
|
+
| Name | Type | Default | Description |
|
|
239
|
+
| :-------------- | :------------------- | :-----: | :------------------------------------------------------------- |
|
|
240
|
+
| `children` | `React.ReactElement` | | Visual content (e.g., image) |
|
|
241
|
+
| `hasBackground` | `boolean` | `true` | Displays a padded background when using the `gridline` variant |
|
|
199
242
|
|
|
200
243
|
`RiverAccordion.Visual` extends the HTML `div` element and supports all `div` props.
|
package/docs/index.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Primer Brand docs (v0.
|
|
1
|
+
# Primer Brand docs (v0.75.0-rc.a3f7dbd6)
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@primer/react-brand@0.
|
|
3
|
+
These docs are bundled with `@primer/react-brand@0.75.0-rc.a3f7dbd6` 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.
|
|
@@ -3,6 +3,7 @@ import type { BaseProps } from '../../component-helpers';
|
|
|
3
3
|
export type HeroLabelProps = Omit<TextProps, 'as' | 'ref' | 'animate'> & Omit<BaseProps<HTMLSpanElement>, 'animate'> & {
|
|
4
4
|
animate?: boolean;
|
|
5
5
|
animationDelay?: number;
|
|
6
|
+
initialText?: string;
|
|
6
7
|
};
|
|
7
8
|
export declare const HeroLabel: import("react").ForwardRefExoticComponent<Omit<HeroLabelProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
8
9
|
//# sourceMappingURL=HeroLabel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeroLabel.d.ts","sourceRoot":"","sources":["../../../src/Hero/sub-components/HeroLabel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAA;AACpC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAA;AAMtD,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,GAAG,KAAK,GAAG,SAAS,CAAC,GACpE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,SAAS,CAAC,GAAG;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"HeroLabel.d.ts","sourceRoot":"","sources":["../../../src/Hero/sub-components/HeroLabel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAA;AACpC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAA;AAMtD,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,GAAG,KAAK,GAAG,SAAS,CAAC,GACpE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,SAAS,CAAC,GAAG;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAEH,eAAO,MAAM,SAAS,yHAgCrB,CAAA"}
|
|
@@ -5,16 +5,17 @@ import r from "../Hero.module.js";
|
|
|
5
5
|
import { forwardRef as i } from "react";
|
|
6
6
|
import { jsx as a } from "react/jsx-runtime";
|
|
7
7
|
//#region src/Hero/sub-components/HeroLabel.tsx
|
|
8
|
-
var o = i(({ children: i, className: o, variant: s = "muted", animate: c = !1, animationDelay: l = 1e3,
|
|
9
|
-
let { variant:
|
|
8
|
+
var o = i(({ children: i, className: o, variant: s = "muted", animate: c = !1, animationDelay: l = 1e3, initialText: u, ...d }, f) => {
|
|
9
|
+
let { variant: p, enableAnimation: m } = t(), h = p === "gridline" || p === "gridline-expressive", g = m || c, _ = h && m || c;
|
|
10
10
|
return /* @__PURE__ */ a("span", {
|
|
11
|
-
ref:
|
|
11
|
+
ref: f,
|
|
12
12
|
className: e(r["Hero-label"], o),
|
|
13
|
-
...
|
|
13
|
+
...d,
|
|
14
14
|
children: /* @__PURE__ */ a(n, {
|
|
15
15
|
variant: s,
|
|
16
|
-
animate:
|
|
17
|
-
delay:
|
|
16
|
+
animate: g,
|
|
17
|
+
delay: _ ? l : 0,
|
|
18
|
+
initialText: u,
|
|
18
19
|
children: i
|
|
19
20
|
})
|
|
20
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeroLabel.js","names":[],"sources":["../../../src/Hero/sub-components/HeroLabel.tsx"],"sourcesContent":["import {forwardRef, PropsWithChildren} from 'react'\nimport {clsx} from 'clsx'\nimport {TextProps} from '../../Text'\nimport type {BaseProps} from '../../component-helpers'\nimport {TextCursorAnimation} from '../../TextCursorAnimation'\n\nimport styles from '../Hero.module.css'\nimport {useHeroContext} from '../HeroContext'\n\nexport type HeroLabelProps = Omit<TextProps, 'as' | 'ref' | 'animate'> &\n Omit<BaseProps<HTMLSpanElement>, 'animate'> & {\n animate?: boolean\n animationDelay?: number\n }\n\nexport const HeroLabel = forwardRef<HTMLSpanElement, HeroLabelProps>(\n (\n {\n children,\n className,\n variant = 'muted',\n animate = false,\n animationDelay = 1000,\n ...rest\n }: PropsWithChildren<HeroLabelProps>,\n ref,\n ) => {\n const {variant: heroVariant, enableAnimation} = useHeroContext()\n const isGridlineVariant = heroVariant === 'gridline' || heroVariant === 'gridline-expressive'\n\n const shouldAnimate = enableAnimation || animate\n const shouldHaveDelay = (isGridlineVariant && enableAnimation) || animate\n\n return (\n <span ref={ref} className={clsx(styles['Hero-label'], className)} {...rest}>\n <TextCursorAnimation
|
|
1
|
+
{"version":3,"file":"HeroLabel.js","names":[],"sources":["../../../src/Hero/sub-components/HeroLabel.tsx"],"sourcesContent":["import {forwardRef, PropsWithChildren} from 'react'\nimport {clsx} from 'clsx'\nimport {TextProps} from '../../Text'\nimport type {BaseProps} from '../../component-helpers'\nimport {TextCursorAnimation} from '../../TextCursorAnimation'\n\nimport styles from '../Hero.module.css'\nimport {useHeroContext} from '../HeroContext'\n\nexport type HeroLabelProps = Omit<TextProps, 'as' | 'ref' | 'animate'> &\n Omit<BaseProps<HTMLSpanElement>, 'animate'> & {\n animate?: boolean\n animationDelay?: number\n initialText?: string\n }\n\nexport const HeroLabel = forwardRef<HTMLSpanElement, HeroLabelProps>(\n (\n {\n children,\n className,\n variant = 'muted',\n animate = false,\n animationDelay = 1000,\n initialText,\n ...rest\n }: PropsWithChildren<HeroLabelProps>,\n ref,\n ) => {\n const {variant: heroVariant, enableAnimation} = useHeroContext()\n const isGridlineVariant = heroVariant === 'gridline' || heroVariant === 'gridline-expressive'\n\n const shouldAnimate = enableAnimation || animate\n const shouldHaveDelay = (isGridlineVariant && enableAnimation) || animate\n\n return (\n <span ref={ref} className={clsx(styles['Hero-label'], className)} {...rest}>\n <TextCursorAnimation\n variant={variant}\n animate={shouldAnimate}\n delay={shouldHaveDelay ? animationDelay : 0}\n initialText={initialText}\n >\n {children}\n </TextCursorAnimation>\n </span>\n )\n },\n)\n"],"mappings":";;;;;;;AAgBA,IAAa,IAAY,GAErB,EACE,aACA,cACA,aAAU,SACV,aAAU,IACV,oBAAiB,KACjB,gBACA,GAAG,KAEL,MACG;CACH,IAAM,EAAC,SAAS,GAAa,uBAAmB,GAAgB,EAC1D,IAAoB,MAAgB,cAAc,MAAgB,uBAElE,IAAgB,KAAmB,GACnC,IAAmB,KAAqB,KAAoB;AAElE,QACE,kBAAC,QAAD;EAAW;EAAK,WAAW,EAAK,EAAO,eAAe,EAAU;EAAE,GAAI;YACpE,kBAAC,GAAD;GACW;GACT,SAAS;GACT,OAAO,IAAkB,IAAiB;GAC7B;GAEZ;GACmB,CAAA;EACjB,CAAA;EAGZ"}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import { TextProps } from '../Text/Text';
|
|
3
|
+
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/base.css';
|
|
3
4
|
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors-with-modes.css';
|
|
4
5
|
export declare const testIds: {
|
|
5
6
|
root: string;
|
|
7
|
+
readonly text: string;
|
|
6
8
|
readonly cursor: string;
|
|
7
9
|
};
|
|
8
10
|
export type TextCursorAnimationProps = {
|
|
9
11
|
/**
|
|
10
|
-
* Whether to animate the text
|
|
11
|
-
* and a cursor that transitions from grey to green.
|
|
12
|
+
* Whether to animate the text with a typing effect.
|
|
12
13
|
*/
|
|
13
14
|
animate?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Optional text to type before transitioning to the final text
|
|
17
|
+
*/
|
|
18
|
+
initialText?: string;
|
|
14
19
|
['data-testid']?: string;
|
|
15
20
|
delay?: number;
|
|
16
21
|
waitForPageLoad?: boolean;
|
|
17
22
|
} & React.HTMLAttributes<HTMLSpanElement> & Omit<TextProps, 'animate' | 'as'>;
|
|
18
|
-
export declare function TextCursorAnimation({ children, className, animate, 'data-testid': testId, delay, waitForPageLoad, variant, }: PropsWithChildren<TextCursorAnimationProps>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function TextCursorAnimation({ children, className, animate, initialText, 'data-testid': testId, delay, waitForPageLoad, variant, }: PropsWithChildren<TextCursorAnimationProps>): import("react/jsx-runtime").JSX.Element;
|
|
19
24
|
//# sourceMappingURL=TextCursorAnimation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextCursorAnimation.d.ts","sourceRoot":"","sources":["../../src/TextCursorAnimation/TextCursorAnimation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAI9C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAA;AAEtC,OAAO,yHAAyH,CAAA;AAIhI,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"TextCursorAnimation.d.ts","sourceRoot":"","sources":["../../src/TextCursorAnimation/TextCursorAnimation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAI9C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAA;AAEtC,OAAO,4GAA4G,CAAA;AACnH,OAAO,yHAAyH,CAAA;AAIhI,eAAO,MAAM,OAAO;;;;CAQnB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAA;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,GAAG,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,GACvC,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC,CAAA;AAEnC,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,SAAS,EACT,OAAO,EACP,WAAW,EACX,aAAa,EAAE,MAAM,EACrB,KAAK,EACL,eAAsB,EACtB,OAAiB,GAClB,EAAE,iBAAiB,CAAC,wBAAwB,CAAC,2CA+E7C"}
|
|
@@ -1,47 +1,73 @@
|
|
|
1
1
|
import e from "../node_modules/clsx/dist/clsx.js";
|
|
2
2
|
import { useCursorAnimation as t } from "../hooks/useCursorAnimation.js";
|
|
3
3
|
import { EyebrowText as n } from "../EyebrowText/EyebrowText.js";
|
|
4
|
-
import '../packages/design-tokens/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors-with-modes-
|
|
4
|
+
import '../packages/design-tokens/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors-with-modes-BucKYl1n.css';import '../packages/design-tokens/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/base-DKbXhPKv.css';/* empty css */
|
|
5
|
+
/* empty css */
|
|
5
6
|
import r from "./TextCursorAnimation.module.js";
|
|
6
7
|
import "react";
|
|
7
8
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
8
9
|
//#region src/TextCursorAnimation/TextCursorAnimation.tsx
|
|
9
10
|
var o = {
|
|
10
11
|
root: "TextCursorAnimation",
|
|
12
|
+
get text() {
|
|
13
|
+
return `${this.root}-text`;
|
|
14
|
+
},
|
|
11
15
|
get cursor() {
|
|
12
16
|
return `${this.root}-cursor`;
|
|
13
17
|
}
|
|
14
18
|
};
|
|
15
|
-
function s({ children: s, className: c, animate: l, "data-testid":
|
|
16
|
-
let
|
|
17
|
-
text:
|
|
19
|
+
function s({ children: s, className: c, animate: l, initialText: u, "data-testid": d, delay: f, waitForPageLoad: p = !0, variant: m = "muted" }) {
|
|
20
|
+
let h = typeof s == "string" ? s : "", { showCursor: g, visibleText: _, cursorPhase: v } = t({
|
|
21
|
+
text: h,
|
|
22
|
+
initialText: u,
|
|
18
23
|
animate: l,
|
|
19
|
-
delay:
|
|
20
|
-
waitForPageLoad:
|
|
21
|
-
}),
|
|
22
|
-
"--
|
|
23
|
-
"--
|
|
24
|
-
|
|
25
|
-
"--
|
|
26
|
-
|
|
27
|
-
}, y = l === !0 && m, b = y ? _ : v, x = m || s;
|
|
24
|
+
delay: f,
|
|
25
|
+
waitForPageLoad: p
|
|
26
|
+
}), y = l === !0 && h.length > 0, b = h || s, x = {
|
|
27
|
+
initial: r["TextCursorAnimation__cursor--initial"],
|
|
28
|
+
correction: r["TextCursorAnimation__cursor--correction"],
|
|
29
|
+
final: r["TextCursorAnimation__cursor--final"],
|
|
30
|
+
complete: r["TextCursorAnimation__cursor--complete"]
|
|
31
|
+
}[y ? v : "complete"];
|
|
28
32
|
return /* @__PURE__ */ i("span", {
|
|
29
33
|
className: e(r.TextCursorAnimation, c),
|
|
30
|
-
"data-testid":
|
|
34
|
+
"data-testid": d || o.root,
|
|
31
35
|
children: /* @__PURE__ */ a("span", {
|
|
32
|
-
className: r
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
className: r.TextCursorAnimation__inner,
|
|
37
|
+
children: [y && /* @__PURE__ */ a("span", {
|
|
38
|
+
className: r.TextCursorAnimation__sizingContainer,
|
|
39
|
+
children: [/* @__PURE__ */ i(n, {
|
|
40
|
+
size: "100",
|
|
41
|
+
variant: m,
|
|
42
|
+
font: "monospace",
|
|
43
|
+
weight: "medium",
|
|
44
|
+
className: e(r.TextCursorAnimation__text, r.TextCursorAnimation__sizingText),
|
|
45
|
+
children: h
|
|
46
|
+
}), u && u !== h && /* @__PURE__ */ i(n, {
|
|
47
|
+
size: "100",
|
|
48
|
+
variant: m,
|
|
49
|
+
font: "monospace",
|
|
50
|
+
weight: "medium",
|
|
51
|
+
className: e(r.TextCursorAnimation__text, r.TextCursorAnimation__sizingText),
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
children: u
|
|
54
|
+
})]
|
|
55
|
+
}), /* @__PURE__ */ a("span", {
|
|
56
|
+
className: e(r.TextCursorAnimation__content, y && r["TextCursorAnimation__content--animated"]),
|
|
57
|
+
"aria-hidden": y ? "true" : void 0,
|
|
58
|
+
children: [/* @__PURE__ */ i(n, {
|
|
59
|
+
size: "100",
|
|
60
|
+
variant: m,
|
|
61
|
+
font: "monospace",
|
|
62
|
+
weight: "medium",
|
|
63
|
+
className: r.TextCursorAnimation__text,
|
|
64
|
+
"data-testid": o.text,
|
|
65
|
+
children: y ? _ : b
|
|
66
|
+
}), g && /* @__PURE__ */ i("span", {
|
|
67
|
+
className: e(r.TextCursorAnimation__cursor, y && r["TextCursorAnimation__cursor--animated"], x),
|
|
68
|
+
"aria-hidden": "true",
|
|
69
|
+
"data-testid": o.cursor
|
|
70
|
+
})]
|
|
45
71
|
})]
|
|
46
72
|
})
|
|
47
73
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextCursorAnimation.js","names":[],"sources":["../../src/TextCursorAnimation/TextCursorAnimation.tsx"],"sourcesContent":["import React, {PropsWithChildren} from 'react'\nimport {clsx} from 'clsx'\nimport {useCursorAnimation} from '../hooks/useCursorAnimation'\nimport {EyebrowText} from '../EyebrowText'\nimport {TextProps} from '../Text/Text'\n\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors-with-modes.css'\n\nimport styles from './TextCursorAnimation.module.css'\n\nexport const testIds = {\n root: 'TextCursorAnimation',\n get cursor() {\n return `${this.root}-cursor`\n },\n}\n\nexport type TextCursorAnimationProps = {\n /**\n * Whether to animate the text
|
|
1
|
+
{"version":3,"file":"TextCursorAnimation.js","names":[],"sources":["../../src/TextCursorAnimation/TextCursorAnimation.tsx"],"sourcesContent":["import React, {PropsWithChildren} from 'react'\nimport {clsx} from 'clsx'\nimport {useCursorAnimation} from '../hooks/useCursorAnimation'\nimport {EyebrowText} from '../EyebrowText'\nimport {TextProps} from '../Text/Text'\n\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/base.css'\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors-with-modes.css'\n\nimport styles from './TextCursorAnimation.module.css'\n\nexport const testIds = {\n root: 'TextCursorAnimation',\n get text() {\n return `${this.root}-text`\n },\n get cursor() {\n return `${this.root}-cursor`\n },\n}\n\nexport type TextCursorAnimationProps = {\n /**\n * Whether to animate the text with a typing effect.\n */\n animate?: boolean\n /**\n * Optional text to type before transitioning to the final text\n */\n initialText?: string\n ['data-testid']?: string\n delay?: number\n waitForPageLoad?: boolean\n} & React.HTMLAttributes<HTMLSpanElement> &\n Omit<TextProps, 'animate' | 'as'>\n\nexport function TextCursorAnimation({\n children,\n className,\n animate,\n initialText,\n 'data-testid': testId,\n delay,\n waitForPageLoad = true,\n variant = 'muted',\n}: PropsWithChildren<TextCursorAnimationProps>) {\n const text = typeof children === 'string' ? children : ''\n const {showCursor, visibleText, cursorPhase} = useCursorAnimation({\n text,\n initialText,\n animate,\n delay,\n waitForPageLoad,\n })\n\n const hasAnimation = animate === true && text.length > 0\n const content = text || children\n const cursorPhaseClassName = {\n initial: styles['TextCursorAnimation__cursor--initial'],\n correction: styles['TextCursorAnimation__cursor--correction'],\n final: styles['TextCursorAnimation__cursor--final'],\n complete: styles['TextCursorAnimation__cursor--complete'],\n }[hasAnimation ? cursorPhase : 'complete']\n\n return (\n <span className={clsx(styles.TextCursorAnimation, className)} data-testid={testId || testIds.root}>\n <span className={styles.TextCursorAnimation__inner}>\n {hasAnimation && (\n <span className={styles.TextCursorAnimation__sizingContainer}>\n <EyebrowText\n size=\"100\"\n variant={variant}\n font=\"monospace\"\n weight=\"medium\"\n className={clsx(styles.TextCursorAnimation__text, styles.TextCursorAnimation__sizingText)}\n >\n {text}\n </EyebrowText>\n {initialText && initialText !== text && (\n <EyebrowText\n size=\"100\"\n variant={variant}\n font=\"monospace\"\n weight=\"medium\"\n className={clsx(styles.TextCursorAnimation__text, styles.TextCursorAnimation__sizingText)}\n aria-hidden=\"true\"\n >\n {initialText}\n </EyebrowText>\n )}\n </span>\n )}\n <span\n className={clsx(\n styles.TextCursorAnimation__content,\n hasAnimation && styles['TextCursorAnimation__content--animated'],\n )}\n aria-hidden={hasAnimation ? 'true' : undefined}\n >\n <EyebrowText\n size=\"100\"\n variant={variant}\n font=\"monospace\"\n weight=\"medium\"\n className={styles.TextCursorAnimation__text}\n data-testid={testIds.text}\n >\n {hasAnimation ? visibleText : content}\n </EyebrowText>\n {showCursor && (\n <span\n className={clsx(\n styles.TextCursorAnimation__cursor,\n hasAnimation && styles['TextCursorAnimation__cursor--animated'],\n cursorPhaseClassName,\n )}\n aria-hidden=\"true\"\n data-testid={testIds.cursor}\n />\n )}\n </span>\n </span>\n </span>\n )\n}\n"],"mappings":";;;;;;;;;AAWA,IAAa,IAAU;CACrB,MAAM;CACN,IAAI,OAAO;AACT,SAAO,GAAG,KAAK,KAAK;;CAEtB,IAAI,SAAS;AACX,SAAO,GAAG,KAAK,KAAK;;CAEvB;AAiBD,SAAgB,EAAoB,EAClC,aACA,cACA,YACA,gBACA,eAAe,GACf,UACA,qBAAkB,IAClB,aAAU,WACoC;CAC9C,IAAM,IAAO,OAAO,KAAa,WAAW,IAAW,IACjD,EAAC,eAAY,gBAAa,mBAAe,EAAmB;EAChE;EACA;EACA;EACA;EACA;EACD,CAAC,EAEI,IAAe,MAAY,MAAQ,EAAK,SAAS,GACjD,IAAU,KAAQ,GAClB,IAAuB;EAC3B,SAAS,EAAO;EAChB,YAAY,EAAO;EACnB,OAAO,EAAO;EACd,UAAU,EAAO;EAClB,CAAC,IAAe,IAAc;AAE/B,QACE,kBAAC,QAAD;EAAM,WAAW,EAAK,EAAO,qBAAqB,EAAU;EAAE,eAAa,KAAU,EAAQ;YAC3F,kBAAC,QAAD;GAAM,WAAW,EAAO;aAAxB,CACG,KACC,kBAAC,QAAD;IAAM,WAAW,EAAO;cAAxB,CACE,kBAAC,GAAD;KACE,MAAK;KACI;KACT,MAAK;KACL,QAAO;KACP,WAAW,EAAK,EAAO,2BAA2B,EAAO,gCAAgC;eAExF;KACW,CAAA,EACb,KAAe,MAAgB,KAC9B,kBAAC,GAAD;KACE,MAAK;KACI;KACT,MAAK;KACL,QAAO;KACP,WAAW,EAAK,EAAO,2BAA2B,EAAO,gCAAgC;KACzF,eAAY;eAEX;KACW,CAAA,CAEX;OAET,kBAAC,QAAD;IACE,WAAW,EACT,EAAO,8BACP,KAAgB,EAAO,0CACxB;IACD,eAAa,IAAe,SAAS,KAAA;cALvC,CAOE,kBAAC,GAAD;KACE,MAAK;KACI;KACT,MAAK;KACL,QAAO;KACP,WAAW,EAAO;KAClB,eAAa,EAAQ;eAEpB,IAAe,IAAc;KAClB,CAAA,EACb,KACC,kBAAC,QAAD;KACE,WAAW,EACT,EAAO,6BACP,KAAgB,EAAO,0CACvB,EACD;KACD,eAAY;KACZ,eAAa,EAAQ;KACrB,CAAA,CAEC;MACF;;EACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation___fMZNu{align-items:center;display:inline-flex}.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__inner____uwkl{align-items:center;display:inline-flex;position:relative}.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__text___t1rcc{font-weight:var(--brand-text-weight-500);white-space:pre}.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__sizingContainer___7_wcg{clip-path:inset(50%);display:inline-grid}.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__sizingText___Mhr64{grid-area:1/1}.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__content___M_K3E{align-items:center;gap:calc(var(--base-size-8) + var(--base-size-2));display:inline-flex}.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__content--animated___Zmg8H{position:absolute;inset-block-start:0;inset-inline-start:0}.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor___suzWD{width:calc(var(--base-size-8) + var(--base-size-2) / 2);height:calc(var(--base-size-12) + var(--base-size-2));flex:0 0 calc(var(--base-size-8) + var(--base-size-2) / 2)}.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor--initial___Ozy64{background-color:var(--brand-TextCursorAnimation-cursor-color)}.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor--animated___EfpR4{animation:Primer_Brand__TextCursorAnimation-module__TextCursorAnimation-cursor-blink___cTxPh var(--brand-TextCursorAnimation-cursor-animationDuration) steps(1, end) .25s 3 forwards}.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor--correction___y1c10{background-color:var(--brand-TextCursorAnimation-cursor-deleteColor)}.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor--final___fBBsR,.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor--complete___gufWv{background-color:var(--brand-TextCursorAnimation-cursor-finalColor)}@keyframes Primer_Brand__TextCursorAnimation-module__TextCursorAnimation-cursor-blink___cTxPh{0%,79%{opacity:1}80%,99%{opacity:0}to{opacity:1}}@media (prefers-reduced-motion:reduce){.Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor___suzWD{animation:none}}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import './TextCursorAnimation.module-
|
|
1
|
+
import './TextCursorAnimation.module-BS4hPR8H.css';var e = {
|
|
2
2
|
TextCursorAnimation: "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation___fMZNu",
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
TextCursorAnimation__inner: "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__inner____uwkl",
|
|
4
|
+
TextCursorAnimation__text: "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__text___t1rcc",
|
|
5
|
+
TextCursorAnimation__sizingContainer: "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__sizingContainer___7_wcg",
|
|
6
|
+
TextCursorAnimation__sizingText: "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__sizingText___Mhr64",
|
|
7
|
+
TextCursorAnimation__content: "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__content___M_K3E",
|
|
8
|
+
"TextCursorAnimation__content--animated": "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__content--animated___Zmg8H",
|
|
9
|
+
TextCursorAnimation__cursor: "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor___suzWD",
|
|
10
|
+
"TextCursorAnimation__cursor--initial": "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor--initial___Ozy64",
|
|
11
|
+
"TextCursorAnimation__cursor--animated": "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor--animated___EfpR4",
|
|
12
|
+
"TextCursorAnimation-cursor-blink": "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation-cursor-blink___cTxPh",
|
|
13
|
+
"TextCursorAnimation__cursor--correction": "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor--correction___y1c10",
|
|
14
|
+
"TextCursorAnimation__cursor--final": "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor--final___fBBsR",
|
|
15
|
+
"TextCursorAnimation__cursor--complete": "Primer_Brand__TextCursorAnimation-module__TextCursorAnimation__cursor--complete___gufWv"
|
|
6
16
|
};
|
|
7
17
|
//#endregion
|
|
8
18
|
export { e as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextCursorAnimation.module.js","names":[],"sources":["../../src/TextCursorAnimation/TextCursorAnimation.module.css"],"sourcesContent":[".TextCursorAnimation {\n display: inline-flex;\n align-items: center;\n}\n\n.
|
|
1
|
+
{"version":3,"file":"TextCursorAnimation.module.js","names":[],"sources":["../../src/TextCursorAnimation/TextCursorAnimation.module.css"],"sourcesContent":[".TextCursorAnimation {\n display: inline-flex;\n align-items: center;\n}\n\n.TextCursorAnimation__inner {\n position: relative;\n display: inline-flex;\n align-items: center;\n}\n\n.TextCursorAnimation__text {\n font-weight: var(--brand-text-weight-500);\n white-space: pre;\n}\n\n.TextCursorAnimation__sizingContainer {\n display: inline-grid;\n clip-path: inset(50%);\n}\n\n.TextCursorAnimation__sizingText {\n grid-area: 1 / 1;\n}\n\n.TextCursorAnimation__content {\n display: inline-flex;\n align-items: center;\n gap: calc(var(--base-size-8) + var(--base-size-2));\n}\n\n.TextCursorAnimation__content--animated {\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 0;\n}\n\n.TextCursorAnimation__cursor {\n width: calc(var(--base-size-8) + var(--base-size-2) / 2);\n height: calc(var(--base-size-12) + var(--base-size-2));\n flex: 0 0 calc(var(--base-size-8) + var(--base-size-2) / 2);\n}\n\n.TextCursorAnimation__cursor--initial {\n background-color: var(--brand-TextCursorAnimation-cursor-color);\n}\n\n.TextCursorAnimation__cursor--animated {\n animation: TextCursorAnimation-cursor-blink var(--brand-TextCursorAnimation-cursor-animationDuration) steps(1, end)\n 250ms 3 forwards;\n}\n\n.TextCursorAnimation__cursor--correction {\n background-color: var(--brand-TextCursorAnimation-cursor-deleteColor);\n}\n\n.TextCursorAnimation__cursor--final,\n.TextCursorAnimation__cursor--complete {\n background-color: var(--brand-TextCursorAnimation-cursor-finalColor);\n}\n\n@keyframes TextCursorAnimation-cursor-blink {\n 0%,\n 79% {\n opacity: 1;\n }\n\n 80%,\n 99% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .TextCursorAnimation__cursor {\n animation: none;\n }\n}\n"],"mappings":""}
|
|
@@ -1,38 +1,15 @@
|
|
|
1
|
+
export type CursorAnimationPhase = 'initial' | 'correction' | 'final' | 'complete';
|
|
2
|
+
export type UseCursorAnimationResult = {
|
|
3
|
+
visibleText: string;
|
|
4
|
+
showCursor: boolean;
|
|
5
|
+
cursorPhase: CursorAnimationPhase;
|
|
6
|
+
};
|
|
1
7
|
export type UseCursorAnimationOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* The text content to animate
|
|
4
|
-
*/
|
|
5
8
|
text: string;
|
|
6
|
-
|
|
7
|
-
* Whether to animate the text reveal with a cursor effect
|
|
8
|
-
*/
|
|
9
|
+
initialText?: string;
|
|
9
10
|
animate?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Duration of the reveal animation in milliseconds
|
|
12
|
-
*/
|
|
13
|
-
duration?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Delay to start the animation in milliseconds
|
|
16
|
-
*/
|
|
17
11
|
delay?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Loads after the page has fully loaded
|
|
20
|
-
*/
|
|
21
12
|
waitForPageLoad?: boolean;
|
|
22
13
|
};
|
|
23
|
-
export
|
|
24
|
-
/**
|
|
25
|
-
* Whether the animation is currently running
|
|
26
|
-
*/
|
|
27
|
-
isAnimating: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Whether to show the cursor
|
|
30
|
-
*/
|
|
31
|
-
showCursor: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Progress of the animation (0 to 1)
|
|
34
|
-
*/
|
|
35
|
-
progress: number;
|
|
36
|
-
};
|
|
37
|
-
export declare function useCursorAnimation({ text, animate, duration, delay, waitForPageLoad, }: UseCursorAnimationOptions): UseCursorAnimationResult;
|
|
14
|
+
export declare function useCursorAnimation({ text, initialText, animate, delay, waitForPageLoad, }: UseCursorAnimationOptions): UseCursorAnimationResult;
|
|
38
15
|
//# sourceMappingURL=useCursorAnimation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCursorAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useCursorAnimation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCursorAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useCursorAnimation.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,UAAU,CAAA;AAElF,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,WAAW,EAAE,oBAAoB,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,WAAW,EACX,OAAO,EACP,KAAW,EACX,eAAsB,GACvB,EAAE,yBAAyB,GAAG,wBAAwB,CA6KtD"}
|
|
@@ -1,50 +1,98 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import e from "./useIsomorphicLayoutEffect.js";
|
|
2
|
+
import { useReducedMotion as t } from "./useReducedMotion.js";
|
|
3
|
+
import { useEffect as n, useState as r } from "react";
|
|
3
4
|
//#region src/hooks/useCursorAnimation.ts
|
|
4
|
-
function i({ text: i,
|
|
5
|
-
let l =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
function i({ text: i, initialText: a, animate: o, delay: s = 500, waitForPageLoad: c = !0 }) {
|
|
6
|
+
let l = t(), u = o === !0 && !l && i.length > 0, d = o === !0 && i.length > 0, [f, p] = r({
|
|
7
|
+
visibleText: d ? "" : i,
|
|
8
|
+
showCursor: !d,
|
|
9
|
+
cursorPhase: d ? "initial" : "complete"
|
|
10
|
+
});
|
|
11
|
+
return e(() => {
|
|
12
|
+
u || p({
|
|
13
|
+
visibleText: i,
|
|
14
|
+
showCursor: !0,
|
|
15
|
+
cursorPhase: "complete"
|
|
16
|
+
});
|
|
17
|
+
}, [u, i]), n(() => {
|
|
18
|
+
if (!u) return;
|
|
19
|
+
let e = 1e3 / 60, t = 85 / 75 * 24, n = [
|
|
20
|
+
">",
|
|
21
|
+
"*",
|
|
22
|
+
"=",
|
|
23
|
+
"&",
|
|
24
|
+
"+",
|
|
25
|
+
"-",
|
|
26
|
+
"%",
|
|
27
|
+
"^",
|
|
28
|
+
"_"
|
|
29
|
+
];
|
|
30
|
+
p({
|
|
31
|
+
visibleText: "",
|
|
32
|
+
showCursor: !1,
|
|
33
|
+
cursorPhase: "initial"
|
|
34
|
+
});
|
|
35
|
+
let r = typeof a == "string" && a.length > 0 && a !== i ? a : void 0, o = 0;
|
|
36
|
+
if (r) for (; o < r.length && o < i.length && r[o] === i[o];) o += 1;
|
|
37
|
+
let l = r !== void 0 && o < r.length, d = l ? r : i, f = l ? d.length - o : 0, m = d.length / 34 * 1e3, h = m + (l ? 308.8235294117647 : 0), g = h + f / t * 1e3, _ = g + (l ? i.length - o : 0) / 34 * 1e3, v = h - e, y = _ - 6 * e, b = (e, t) => {
|
|
38
|
+
let r = "", i = 0;
|
|
39
|
+
for (let a = 0; a < t; a += 1) {
|
|
40
|
+
let o = e[a];
|
|
41
|
+
if (/\s/.test(o)) {
|
|
42
|
+
r = `${r}${o}`;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
i += 1, r = `${r}${o}`, a === t - 1 && (r = `${r}${n[(i - 1) % n.length]}`);
|
|
46
|
+
}
|
|
47
|
+
return r;
|
|
48
|
+
}, x = (e) => {
|
|
49
|
+
let n = "";
|
|
50
|
+
if (e > 0 && e < m) n = b(d, Math.floor(e / 1e3 * 34));
|
|
51
|
+
else if (l && e >= m && e < h) n = d;
|
|
52
|
+
else if (l && e >= h && e < g) {
|
|
53
|
+
let r = e - h, i = Math.floor(r / 1e3 * t);
|
|
54
|
+
n = d.slice(0, d.length - i);
|
|
55
|
+
} else if (l && e >= g && e < _) {
|
|
56
|
+
let t = e - g, r = Math.min(i.length, o + Math.floor(t / 1e3 * 34));
|
|
57
|
+
n = i.slice(0, r);
|
|
58
|
+
} else e >= _ && (n = i);
|
|
59
|
+
let r = "initial";
|
|
60
|
+
return l && e >= v && (r = "correction"), e >= y && (r = "final"), e >= _ && (r = "complete"), {
|
|
61
|
+
visibleText: n,
|
|
62
|
+
showCursor: n.length > 0,
|
|
63
|
+
cursorPhase: r
|
|
64
|
+
};
|
|
65
|
+
}, S, C, w = () => {
|
|
66
|
+
let e = performance.now(), t = {
|
|
67
|
+
visibleText: "",
|
|
68
|
+
showCursor: !1,
|
|
69
|
+
cursorPhase: "initial"
|
|
70
|
+
}, n = (r) => {
|
|
71
|
+
let i = r - e, a = x(i);
|
|
72
|
+
(t.visibleText !== a.visibleText || t.showCursor !== a.showCursor || t.cursorPhase !== a.cursorPhase) && (t = a, p(a)), i < _ && (S = window.requestAnimationFrame(n));
|
|
73
|
+
};
|
|
74
|
+
S = window.requestAnimationFrame(n);
|
|
75
|
+
}, T = () => {
|
|
76
|
+
C = setTimeout(w, s);
|
|
14
77
|
};
|
|
15
|
-
|
|
16
|
-
}, [u, o]);
|
|
17
|
-
return n(() => {
|
|
18
|
-
if (!u) {
|
|
19
|
-
m(1), f(!1);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
let e = () => setTimeout(() => {
|
|
23
|
-
h();
|
|
24
|
-
}, s), t;
|
|
25
|
-
if (c && typeof window < "u") if (document.readyState === "complete") t = e();
|
|
78
|
+
if (c && typeof window < "u") if (document.readyState === "complete") T();
|
|
26
79
|
else {
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return window.addEventListener("load", n), () => {
|
|
31
|
-
window.removeEventListener("load", n), t && clearTimeout(t);
|
|
80
|
+
let e = () => T();
|
|
81
|
+
return window.addEventListener("load", e), () => {
|
|
82
|
+
window.removeEventListener("load", e), C !== void 0 && clearTimeout(C), S !== void 0 && window.cancelAnimationFrame(S);
|
|
32
83
|
};
|
|
33
84
|
}
|
|
34
|
-
else
|
|
85
|
+
else T();
|
|
35
86
|
return () => {
|
|
36
|
-
|
|
87
|
+
C !== void 0 && clearTimeout(C), S !== void 0 && window.cancelAnimationFrame(S);
|
|
37
88
|
};
|
|
38
89
|
}, [
|
|
39
|
-
h,
|
|
40
90
|
s,
|
|
91
|
+
a,
|
|
41
92
|
u,
|
|
93
|
+
i,
|
|
42
94
|
c
|
|
43
|
-
]),
|
|
44
|
-
isAnimating: d,
|
|
45
|
-
showCursor: !l && a === !0,
|
|
46
|
-
progress: p
|
|
47
|
-
};
|
|
95
|
+
]), f;
|
|
48
96
|
}
|
|
49
97
|
//#endregion
|
|
50
98
|
export { i as useCursorAnimation };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCursorAnimation.js","names":[],"sources":["../../src/hooks/useCursorAnimation.ts"],"sourcesContent":["import {useState, useEffect, useCallback} from 'react'\nimport {useReducedMotion} from './useReducedMotion'\n\nexport type UseCursorAnimationOptions = {\n /**\n * The text content to animate\n */\n text: string\n /**\n * Whether to animate the text reveal with a cursor effect\n */\n animate?: boolean\n /**\n * Duration of the reveal animation in milliseconds\n */\n duration?: number\n /**\n * Delay to start the animation in milliseconds\n */\n delay?: number\n /**\n * Loads after the page has fully loaded\n */\n waitForPageLoad?: boolean\n}\n\nexport type UseCursorAnimationResult = {\n /**\n * Whether the animation is currently running\n */\n isAnimating: boolean\n /**\n * Whether to show the cursor\n */\n showCursor: boolean\n /**\n * Progress of the animation (0 to 1)\n */\n progress: number\n}\n\nexport function useCursorAnimation({\n text,\n animate,\n duration = 500,\n delay = 500,\n waitForPageLoad = true,\n}: UseCursorAnimationOptions): UseCursorAnimationResult {\n const prefersReducedMotion = useReducedMotion()\n const shouldAnimate = animate === true && !prefersReducedMotion && text.length > 0\n\n const [isAnimating, setIsAnimating] = useState(shouldAnimate)\n const [progress, setProgress] = useState(shouldAnimate ? 0 : 1)\n\n const startAnimation = useCallback(() => {\n if (!shouldAnimate) {\n setProgress(1)\n setIsAnimating(false)\n return\n }\n\n setIsAnimating(true)\n setProgress(0)\n\n const startTime = performance.now()\n\n const tick = (currentTime: number) => {\n const elapsed = currentTime - startTime\n const newProgress = Math.min(elapsed / duration, 1)\n\n setProgress(newProgress)\n\n if (newProgress < 1) {\n requestAnimationFrame(tick)\n } else {\n setIsAnimating(false)\n }\n }\n\n requestAnimationFrame(tick)\n }, [shouldAnimate, duration])\n\n useEffect(() => {\n if (!shouldAnimate) {\n setProgress(1)\n setIsAnimating(false)\n return\n }\n\n const startDelayTimer = () => {\n return setTimeout(() => {\n startAnimation()\n }, delay)\n }\n\n let delayTimer: ReturnType<typeof setTimeout> | undefined\n\n if (waitForPageLoad && typeof window !== 'undefined') {\n // Check if page is already loaded\n if (document.readyState === 'complete') {\n delayTimer = startDelayTimer()\n } else {\n // Wait for page load before starting the delay timer\n const handleLoad = () => {\n delayTimer = startDelayTimer()\n }\n window.addEventListener('load', handleLoad)\n return () => {\n window.removeEventListener('load', handleLoad)\n if (delayTimer) clearTimeout(delayTimer)\n }\n }\n } else {\n delayTimer = startDelayTimer()\n }\n\n return () => {\n if (delayTimer) clearTimeout(delayTimer)\n }\n }, [startAnimation, delay, shouldAnimate, waitForPageLoad])\n\n const showCursor = !prefersReducedMotion && animate === true\n\n return {\n isAnimating,\n showCursor,\n progress,\n }\n}\n"],"mappings":";;;AAyCA,SAAgB,EAAmB,EACjC,SACA,YACA,cAAW,KACX,WAAQ,KACR,qBAAkB,MACoC;CACtD,IAAM,IAAuB,GAAkB,EACzC,IAAgB,MAAY,MAAQ,CAAC,KAAwB,EAAK,SAAS,GAE3E,CAAC,GAAa,KAAkB,EAAS,EAAc,EACvD,CAAC,GAAU,KAAe,EAAS,IAAsB,EAEzD,IAAiB,QAAkB;AACvC,MAAI,CAAC,GAAe;AAElB,GADA,EAAY,EAAE,EACd,EAAe,GAAM;AACrB;;AAIF,EADA,EAAe,GAAK,EACpB,EAAY,EAAE;EAEd,IAAM,IAAY,YAAY,KAAK,EAE7B,KAAQ,MAAwB;GACpC,IAAM,IAAU,IAAc,GACxB,IAAc,KAAK,IAAI,IAAU,GAAU,EAAE;AAInD,GAFA,EAAY,EAAY,EAEpB,IAAc,IAChB,sBAAsB,EAAK,GAE3B,EAAe,GAAM;;AAIzB,wBAAsB,EAAK;IAC1B,CAAC,GAAe,EAAS,CAAC;AA2C7B,QAzCA,QAAgB;AACd,MAAI,CAAC,GAAe;AAElB,GADA,EAAY,EAAE,EACd,EAAe,GAAM;AACrB;;EAGF,IAAM,UACG,iBAAiB;AACtB,MAAgB;KACf,EAAM,EAGP;AAEJ,MAAI,KAAmB,OAAO,SAAW,IAEvC,KAAI,SAAS,eAAe,WAC1B,KAAa,GAAiB;OACzB;GAEL,IAAM,UAAmB;AACvB,QAAa,GAAiB;;AAGhC,UADA,OAAO,iBAAiB,QAAQ,EAAW,QAC9B;AAEX,IADA,OAAO,oBAAoB,QAAQ,EAAW,EAC1C,KAAY,aAAa,EAAW;;;MAI5C,KAAa,GAAiB;AAGhC,eAAa;AACX,GAAI,KAAY,aAAa,EAAW;;IAEzC;EAAC;EAAgB;EAAO;EAAe;EAAgB,CAAC,EAIpD;EACL;EACA,YAJiB,CAAC,KAAwB,MAAY;EAKtD;EACD"}
|
|
1
|
+
{"version":3,"file":"useCursorAnimation.js","names":[],"sources":["../../src/hooks/useCursorAnimation.ts"],"sourcesContent":["import {useEffect, useState} from 'react'\nimport useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect'\nimport {useReducedMotion} from './useReducedMotion'\n\nexport type CursorAnimationPhase = 'initial' | 'correction' | 'final' | 'complete'\n\nexport type UseCursorAnimationResult = {\n visibleText: string\n showCursor: boolean\n cursorPhase: CursorAnimationPhase\n}\n\nexport type UseCursorAnimationOptions = {\n text: string\n initialText?: string\n animate?: boolean\n delay?: number\n waitForPageLoad?: boolean\n}\n\nexport function useCursorAnimation({\n text,\n initialText,\n animate,\n delay = 500,\n waitForPageLoad = true,\n}: UseCursorAnimationOptions): UseCursorAnimationResult {\n const prefersReducedMotion = useReducedMotion()\n\n const shouldAnimate = animate === true && !prefersReducedMotion && text.length > 0\n const shouldStartHidden = animate === true && text.length > 0\n\n const [frame, setFrame] = useState<UseCursorAnimationResult>({\n visibleText: shouldStartHidden ? '' : text,\n showCursor: !shouldStartHidden,\n cursorPhase: shouldStartHidden ? 'initial' : 'complete',\n })\n\n useIsomorphicLayoutEffect(() => {\n if (!shouldAnimate) {\n setFrame({visibleText: text, showCursor: true, cursorPhase: 'complete'})\n }\n }, [shouldAnimate, text])\n\n useEffect(() => {\n if (!shouldAnimate) return\n\n const frameDuration = 1000 / 60\n const charactersPerSecond = 30 * (85 / 75)\n const deleteCharactersPerSecond = 24 * (85 / 75)\n const correctionPauseDuration = 350 / (85 / 75)\n const scrambleSymbols = ['>', '*', '=', '&', '+', '-', '%', '^', '_']\n\n setFrame({visibleText: '', showCursor: false, cursorPhase: 'initial'})\n\n const candidateInitialText =\n typeof initialText === 'string' && initialText.length > 0 && initialText !== text ? initialText : undefined\n let sharedPrefixLength = 0\n\n if (candidateInitialText) {\n while (\n sharedPrefixLength < candidateInitialText.length &&\n sharedPrefixLength < text.length &&\n candidateInitialText[sharedPrefixLength] === text[sharedPrefixLength]\n ) {\n sharedPrefixLength += 1\n }\n }\n\n const hasCorrection = candidateInitialText !== undefined && sharedPrefixLength < candidateInitialText.length\n const firstText = hasCorrection ? candidateInitialText : text\n const deletedCharacterCount = hasCorrection ? firstText.length - sharedPrefixLength : 0\n const firstTypeDuration = (firstText.length / charactersPerSecond) * 1000\n const correctionStart = firstTypeDuration + (hasCorrection ? correctionPauseDuration : 0)\n const deleteDuration = (deletedCharacterCount / deleteCharactersPerSecond) * 1000\n const secondTypeStart = correctionStart + deleteDuration\n const secondTypeCharacterCount = hasCorrection ? text.length - sharedPrefixLength : 0\n const secondTypeDuration = (secondTypeCharacterCount / charactersPerSecond) * 1000\n const typingComplete = secondTypeStart + secondTypeDuration\n const correctionCursorStart = correctionStart - frameDuration\n const finalCursorStart = typingComplete - 6 * frameDuration\n\n const getScrambledText = (sourceText: string, characterCount: number) => {\n let result = ''\n let visibleCharacterIndex = 0\n\n for (let index = 0; index < characterCount; index += 1) {\n const character = sourceText[index]\n\n if (/\\s/.test(character)) {\n result = `${result}${character}`\n continue\n }\n\n visibleCharacterIndex += 1\n result = `${result}${character}`\n\n if (index === characterCount - 1) {\n result = `${result}${scrambleSymbols[(visibleCharacterIndex - 1) % scrambleSymbols.length]}`\n }\n }\n\n return result\n }\n\n const getFrame = (elapsed: number): UseCursorAnimationResult => {\n let nextText = ''\n\n if (elapsed > 0 && elapsed < firstTypeDuration) {\n const typedCharacterCount = Math.floor((elapsed / 1000) * charactersPerSecond)\n nextText = getScrambledText(firstText, typedCharacterCount)\n } else if (hasCorrection && elapsed >= firstTypeDuration && elapsed < correctionStart) {\n nextText = firstText\n } else if (hasCorrection && elapsed >= correctionStart && elapsed < secondTypeStart) {\n const deleteElapsed = elapsed - correctionStart\n const currentDeletedCharacterCount = Math.floor((deleteElapsed / 1000) * deleteCharactersPerSecond)\n nextText = firstText.slice(0, firstText.length - currentDeletedCharacterCount)\n } else if (hasCorrection && elapsed >= secondTypeStart && elapsed < typingComplete) {\n const secondTypeElapsed = elapsed - secondTypeStart\n const typedCharacterCount = Math.min(\n text.length,\n sharedPrefixLength + Math.floor((secondTypeElapsed / 1000) * charactersPerSecond),\n )\n nextText = text.slice(0, typedCharacterCount)\n } else if (elapsed >= typingComplete) {\n nextText = text\n }\n\n let nextCursorPhase: CursorAnimationPhase = 'initial'\n if (hasCorrection && elapsed >= correctionCursorStart) nextCursorPhase = 'correction'\n if (elapsed >= finalCursorStart) nextCursorPhase = 'final'\n if (elapsed >= typingComplete) nextCursorPhase = 'complete'\n\n return {\n visibleText: nextText,\n showCursor: nextText.length > 0,\n cursorPhase: nextCursorPhase,\n }\n }\n\n let animationFrame: number | undefined\n let delayTimer: ReturnType<typeof setTimeout> | undefined\n\n const startAnimation = () => {\n const startTime = performance.now()\n let previousFrame: UseCursorAnimationResult = {\n visibleText: '',\n showCursor: false,\n cursorPhase: 'initial',\n }\n\n const tick = (currentTime: number) => {\n const elapsed = currentTime - startTime\n const nextFrame = getFrame(elapsed)\n\n if (\n previousFrame.visibleText !== nextFrame.visibleText ||\n previousFrame.showCursor !== nextFrame.showCursor ||\n previousFrame.cursorPhase !== nextFrame.cursorPhase\n ) {\n previousFrame = nextFrame\n setFrame(nextFrame)\n }\n\n if (elapsed < typingComplete) {\n animationFrame = window.requestAnimationFrame(tick)\n }\n }\n\n animationFrame = window.requestAnimationFrame(tick)\n }\n\n const startDelayTimer = () => {\n delayTimer = setTimeout(startAnimation, delay)\n }\n\n if (waitForPageLoad && typeof window !== 'undefined') {\n if (document.readyState === 'complete') {\n startDelayTimer()\n } else {\n const handleLoad = () => startDelayTimer()\n window.addEventListener('load', handleLoad)\n return () => {\n window.removeEventListener('load', handleLoad)\n if (delayTimer !== undefined) clearTimeout(delayTimer)\n if (animationFrame !== undefined) window.cancelAnimationFrame(animationFrame)\n }\n }\n } else {\n startDelayTimer()\n }\n\n return () => {\n if (delayTimer !== undefined) clearTimeout(delayTimer)\n if (animationFrame !== undefined) window.cancelAnimationFrame(animationFrame)\n }\n }, [delay, initialText, shouldAnimate, text, waitForPageLoad])\n\n return frame\n}\n"],"mappings":";;;;AAoBA,SAAgB,EAAmB,EACjC,SACA,gBACA,YACA,WAAQ,KACR,qBAAkB,MACoC;CACtD,IAAM,IAAuB,GAAkB,EAEzC,IAAgB,MAAY,MAAQ,CAAC,KAAwB,EAAK,SAAS,GAC3E,IAAoB,MAAY,MAAQ,EAAK,SAAS,GAEtD,CAAC,GAAO,KAAY,EAAmC;EAC3D,aAAa,IAAoB,KAAK;EACtC,YAAY,CAAC;EACb,aAAa,IAAoB,YAAY;EAC9C,CAAC;AAkKF,QAhKA,QAAgC;AAC9B,EAAK,KACH,EAAS;GAAC,aAAa;GAAM,YAAY;GAAM,aAAa;GAAW,CAAC;IAEzE,CAAC,GAAe,EAAK,CAAC,EAEzB,QAAgB;AACd,MAAI,CAAC,EAAe;EAEpB,IAAM,IAAgB,MAAO,IAEvB,IAAkC,KAAK,KAAX,IAE5B,IAAkB;GAAC;GAAK;GAAK;GAAK;GAAK;GAAK;GAAK;GAAK;GAAK;GAAI;AAErE,IAAS;GAAC,aAAa;GAAI,YAAY;GAAO,aAAa;GAAU,CAAC;EAEtE,IAAM,IACJ,OAAO,KAAgB,YAAY,EAAY,SAAS,KAAK,MAAgB,IAAO,IAAc,KAAA,GAChG,IAAqB;AAEzB,MAAI,EACF,QACE,IAAqB,EAAqB,UAC1C,IAAqB,EAAK,UAC1B,EAAqB,OAAwB,EAAK,IAElD,MAAsB;EAI1B,IAAM,IAAgB,MAAyB,KAAA,KAAa,IAAqB,EAAqB,QAChG,IAAY,IAAgB,IAAuB,GACnD,IAAwB,IAAgB,EAAU,SAAS,IAAqB,GAChF,IAAqB,EAAU,SAAS,KAAuB,KAC/D,IAAkB,KAAqB,IAAgB,oBAA0B,IAEjF,IAAkB,IADA,IAAwB,IAA6B,KAIvE,IAAiB,KAFU,IAAgB,EAAK,SAAS,IAAqB,KAC7B,KAAuB,KAExE,IAAwB,IAAkB,GAC1C,IAAmB,IAAiB,IAAI,GAExC,KAAoB,GAAoB,MAA2B;GACvE,IAAI,IAAS,IACT,IAAwB;AAE5B,QAAK,IAAI,IAAQ,GAAG,IAAQ,GAAgB,KAAS,GAAG;IACtD,IAAM,IAAY,EAAW;AAE7B,QAAI,KAAK,KAAK,EAAU,EAAE;AACxB,SAAS,GAAG,IAAS;AACrB;;AAMF,IAHA,KAAyB,GACzB,IAAS,GAAG,IAAS,KAEjB,MAAU,IAAiB,MAC7B,IAAS,GAAG,IAAS,GAAiB,IAAwB,KAAK,EAAgB;;AAIvF,UAAO;KAGH,KAAY,MAA8C;GAC9D,IAAI,IAAW;AAEf,OAAI,IAAU,KAAK,IAAU,EAE3B,KAAW,EAAiB,GADA,KAAK,MAAO,IAAU,MAAQ,GACnB,CAAoB;YAClD,KAAiB,KAAW,KAAqB,IAAU,EACpE,KAAW;YACF,KAAiB,KAAW,KAAmB,IAAU,GAAiB;IACnF,IAAM,IAAgB,IAAU,GAC1B,IAA+B,KAAK,MAAO,IAAgB,MAAQ,EAA0B;AACnG,QAAW,EAAU,MAAM,GAAG,EAAU,SAAS,EAA6B;cACrE,KAAiB,KAAW,KAAmB,IAAU,GAAgB;IAClF,IAAM,IAAoB,IAAU,GAC9B,IAAsB,KAAK,IAC/B,EAAK,QACL,IAAqB,KAAK,MAAO,IAAoB,MAAQ,GAAoB,CAClF;AACD,QAAW,EAAK,MAAM,GAAG,EAAoB;UACpC,KAAW,MACpB,IAAW;GAGb,IAAI,IAAwC;AAK5C,UAJI,KAAiB,KAAW,MAAuB,IAAkB,eACrE,KAAW,MAAkB,IAAkB,UAC/C,KAAW,MAAgB,IAAkB,aAE1C;IACL,aAAa;IACb,YAAY,EAAS,SAAS;IAC9B,aAAa;IACd;KAGC,GACA,GAEE,UAAuB;GAC3B,IAAM,IAAY,YAAY,KAAK,EAC/B,IAA0C;IAC5C,aAAa;IACb,YAAY;IACZ,aAAa;IACd,EAEK,KAAQ,MAAwB;IACpC,IAAM,IAAU,IAAc,GACxB,IAAY,EAAS,EAAQ;AAWnC,KARE,EAAc,gBAAgB,EAAU,eACxC,EAAc,eAAe,EAAU,cACvC,EAAc,gBAAgB,EAAU,iBAExC,IAAgB,GAChB,EAAS,EAAU,GAGjB,IAAU,MACZ,IAAiB,OAAO,sBAAsB,EAAK;;AAIvD,OAAiB,OAAO,sBAAsB,EAAK;KAG/C,UAAwB;AAC5B,OAAa,WAAW,GAAgB,EAAM;;AAGhD,MAAI,KAAmB,OAAO,SAAW,IACvC,KAAI,SAAS,eAAe,WAC1B,IAAiB;OACZ;GACL,IAAM,UAAmB,GAAiB;AAE1C,UADA,OAAO,iBAAiB,QAAQ,EAAW,QAC9B;AAGX,IAFA,OAAO,oBAAoB,QAAQ,EAAW,EAC1C,MAAe,KAAA,KAAW,aAAa,EAAW,EAClD,MAAmB,KAAA,KAAW,OAAO,qBAAqB,EAAe;;;MAIjF,IAAiB;AAGnB,eAAa;AAEX,GADI,MAAe,KAAA,KAAW,aAAa,EAAW,EAClD,MAAmB,KAAA,KAAW,OAAO,qBAAqB,EAAe;;IAE9E;EAAC;EAAO;EAAa;EAAe;EAAM;EAAgB,CAAC,EAEvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--brand-TextCursorAnimation-cursor-animationDuration:.833s}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root,[data-color-mode=light]{--brand-TextCursorAnimation-cursor-color:var(--base-color-scale-purple-5);--brand-TextCursorAnimation-cursor-deleteColor:var(--base-color-scale-blue-4);--brand-TextCursorAnimation-cursor-finalColor:var(--base-color-scale-green-6)}[data-color-mode=dark]{--brand-TextCursorAnimation-cursor-color:var(--base-color-scale-purple-3);--brand-TextCursorAnimation-cursor-deleteColor:var(--base-color-scale-blue-3);--brand-TextCursorAnimation-cursor-finalColor:var(--base-color-scale-green-2)}
|