@automattic/onboarding 1.0.0 → 1.0.1
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/.storybook/index.scss +16 -0
- package/.storybook/main.ts +15 -0
- package/.storybook/preview.ts +5 -0
- package/CHANGELOG.md +5 -0
- package/dist/cjs/action-buttons/index.js +1 -13
- package/dist/cjs/action-buttons/index.js.map +1 -1
- package/dist/cjs/action-buttons/style.scss +4 -40
- package/dist/cjs/cart/create-cart-manager-client.js +3 -3
- package/dist/cjs/cart/create-cart-manager-client.js.map +1 -1
- package/dist/cjs/cart/index.js +45 -67
- package/dist/cjs/cart/index.js.map +1 -1
- package/dist/cjs/confetti/index.js +1 -1
- package/dist/cjs/confetti/index.js.map +1 -1
- package/dist/cjs/flow-progress/use-flow-progress.js +0 -57
- package/dist/cjs/flow-progress/use-flow-progress.js.map +1 -1
- package/dist/cjs/hooks/use-persisted-state.js +61 -0
- package/dist/cjs/hooks/use-persisted-state.js.map +1 -0
- package/dist/cjs/hooray/index.js +1 -1
- package/dist/cjs/index.js +11 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mshots-image/index.js +34 -15
- package/dist/cjs/mshots-image/index.js.map +1 -1
- package/dist/cjs/mshots-image/style.scss +1 -0
- package/dist/cjs/navigator/hooks/index.js +2 -1
- package/dist/cjs/navigator/hooks/index.js.map +1 -1
- package/dist/cjs/navigator/navigator-buttons/index.js +2 -2
- package/dist/cjs/navigator/navigator-buttons/index.js.map +1 -1
- package/dist/cjs/navigator/navigator-header/index.js.map +1 -1
- package/dist/cjs/navigator/navigator-screens/hooks/index.js +3 -2
- package/dist/cjs/navigator/navigator-screens/hooks/index.js.map +1 -1
- package/dist/cjs/navigator/navigator-screens/hooks/use-navigator-screens.js +1 -1
- package/dist/cjs/navigator/navigator-screens/hooks/use-navigator-screens.js.map +1 -1
- package/dist/cjs/navigator/navigator-screens/navigator-screens.js +7 -2
- package/dist/cjs/navigator/navigator-screens/navigator-screens.js.map +1 -1
- package/dist/cjs/select-card-checkbox/index.js +4 -3
- package/dist/cjs/select-card-checkbox/index.js.map +1 -1
- package/dist/cjs/select-card-checkbox/style.scss +11 -14
- package/dist/cjs/select-card-checkbox-v2/index.js +15 -0
- package/dist/cjs/select-card-checkbox-v2/index.js.map +1 -0
- package/dist/cjs/select-card-checkbox-v2/style.scss +25 -0
- package/dist/cjs/select-items/index.js +2 -1
- package/dist/cjs/select-items/index.js.map +1 -1
- package/dist/cjs/select-items/style.scss +2 -1
- package/dist/cjs/setup-tailored-site-after-creation.js +9 -37
- package/dist/cjs/setup-tailored-site-after-creation.js.map +1 -1
- package/dist/cjs/step-container/index.js +10 -12
- package/dist/cjs/step-container/index.js.map +1 -1
- package/dist/cjs/step-container/style.scss +35 -77
- package/dist/cjs/step-container-v2/components/ContentRow/ContentRow.js +14 -0
- package/dist/cjs/step-container-v2/components/ContentRow/ContentRow.js.map +1 -0
- package/dist/cjs/step-container-v2/components/ContentRow/style.scss +26 -0
- package/dist/cjs/step-container-v2/components/ContentWrapper/ContentWrapper.js +19 -0
- package/dist/cjs/step-container-v2/components/ContentWrapper/ContentWrapper.js.map +1 -0
- package/dist/cjs/step-container-v2/components/ContentWrapper/style.scss +70 -0
- package/dist/cjs/step-container-v2/components/Heading/Heading.js +17 -0
- package/dist/cjs/step-container-v2/components/Heading/Heading.js.map +1 -0
- package/dist/cjs/step-container-v2/components/Heading/style.scss +47 -0
- package/dist/cjs/step-container-v2/components/StepContainerV2/StepContainerV2.js +36 -0
- package/dist/cjs/step-container-v2/components/StepContainerV2/StepContainerV2.js.map +1 -0
- package/dist/cjs/step-container-v2/components/StepContainerV2/context.js +13 -0
- package/dist/cjs/step-container-v2/components/StepContainerV2/context.js.map +1 -0
- package/dist/cjs/step-container-v2/components/StepContainerV2/style.scss +21 -0
- package/dist/cjs/step-container-v2/components/StepCounter/StepCounter.js +17 -0
- package/dist/cjs/step-container-v2/components/StepCounter/StepCounter.js.map +1 -0
- package/dist/cjs/step-container-v2/components/StepCounter/style.scss +4 -0
- package/dist/cjs/step-container-v2/components/StickyBottomBar/StickyBottomBar.js +17 -0
- package/dist/cjs/step-container-v2/components/StickyBottomBar/StickyBottomBar.js.map +1 -0
- package/dist/cjs/step-container-v2/components/StickyBottomBar/StickyBottomBarRenderer.js +31 -0
- package/dist/cjs/step-container-v2/components/StickyBottomBar/StickyBottomBarRenderer.js.map +1 -0
- package/dist/cjs/step-container-v2/components/StickyBottomBar/style.scss +56 -0
- package/dist/cjs/step-container-v2/components/TopBar/TopBar.js +55 -0
- package/dist/cjs/step-container-v2/components/TopBar/TopBar.js.map +1 -0
- package/dist/cjs/step-container-v2/components/TopBar/TopBarRenderer.js +32 -0
- package/dist/cjs/step-container-v2/components/TopBar/TopBarRenderer.js.map +1 -0
- package/dist/cjs/step-container-v2/components/TopBar/style.scss +75 -0
- package/dist/cjs/step-container-v2/components/buttons/BackButton/BackButton.js +29 -0
- package/dist/cjs/step-container-v2/components/buttons/BackButton/BackButton.js.map +1 -0
- package/dist/cjs/step-container-v2/components/buttons/BackButton/style.scss +16 -0
- package/dist/cjs/step-container-v2/components/buttons/LinkButton/LinkButton.js +18 -0
- package/dist/cjs/step-container-v2/components/buttons/LinkButton/LinkButton.js.map +1 -0
- package/dist/cjs/step-container-v2/components/buttons/LinkButton/style.scss +6 -0
- package/dist/cjs/step-container-v2/components/buttons/PrimaryButton/PrimaryButton.js +18 -0
- package/dist/cjs/step-container-v2/components/buttons/PrimaryButton/PrimaryButton.js.map +1 -0
- package/dist/cjs/step-container-v2/components/buttons/PrimaryButton/style.scss +6 -0
- package/dist/cjs/step-container-v2/components/buttons/SecondaryButton/SecondaryButton.js +18 -0
- package/dist/cjs/step-container-v2/components/buttons/SecondaryButton/SecondaryButton.js.map +1 -0
- package/dist/cjs/step-container-v2/components/buttons/SecondaryButton/style.scss +6 -0
- package/dist/cjs/step-container-v2/components/buttons/SkipButton/SkipButton.js +28 -0
- package/dist/cjs/step-container-v2/components/buttons/SkipButton/SkipButton.js.map +1 -0
- package/dist/cjs/step-container-v2/contexts/StepContainerV2Context.js +17 -0
- package/dist/cjs/step-container-v2/contexts/StepContainerV2Context.js.map +1 -0
- package/dist/cjs/step-container-v2/helpers/decorateButtonWithTracksEventRecording.js +18 -0
- package/dist/cjs/step-container-v2/helpers/decorateButtonWithTracksEventRecording.js.map +1 -0
- package/dist/cjs/step-container-v2/helpers/normalizeButtonProps.js +13 -0
- package/dist/cjs/step-container-v2/helpers/normalizeButtonProps.js.map +1 -0
- package/dist/cjs/step-container-v2/helpers/wireframe-placeholder.js +18 -0
- package/dist/cjs/step-container-v2/helpers/wireframe-placeholder.js.map +1 -0
- package/dist/cjs/step-container-v2/helpers/withStepContainerV2ContextDecorator.js +15 -0
- package/dist/cjs/step-container-v2/helpers/withStepContainerV2ContextDecorator.js.map +1 -0
- package/dist/cjs/step-container-v2/index.js +41 -0
- package/dist/cjs/step-container-v2/index.js.map +1 -0
- package/dist/cjs/step-container-v2/types.js +3 -0
- package/dist/cjs/step-container-v2/types.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.js +26 -0
- package/dist/cjs/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.stories.js +52 -0
- package/dist/cjs/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.stories.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.js +26 -0
- package/dist/cjs/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.stories.js +25 -0
- package/dist/cjs/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.stories.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/style.scss +14 -0
- package/dist/cjs/step-container-v2/wireframes/Loading/Loading.js +30 -0
- package/dist/cjs/step-container-v2/wireframes/Loading/Loading.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/Loading/Loading.stories.js +29 -0
- package/dist/cjs/step-container-v2/wireframes/Loading/Loading.stories.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/Loading/style.scss +22 -0
- package/dist/cjs/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.js +17 -0
- package/dist/cjs/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.stories.js +17 -0
- package/dist/cjs/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.stories.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/PlaygroundLayout/style.scss +5 -0
- package/dist/cjs/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.js +38 -0
- package/dist/cjs/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.stories.js +28 -0
- package/dist/cjs/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.stories.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/TwoColumnLayout/style.scss +15 -0
- package/dist/cjs/step-container-v2/wireframes/WideLayout/WideLayout.js +17 -0
- package/dist/cjs/step-container-v2/wireframes/WideLayout/WideLayout.js.map +1 -0
- package/dist/cjs/step-container-v2/wireframes/WideLayout/WideLayout.stories.js +41 -0
- package/dist/cjs/step-container-v2/wireframes/WideLayout/WideLayout.stories.js.map +1 -0
- package/dist/cjs/step-navigation-link/index.js +2 -2
- package/dist/cjs/step-navigation-link/index.js.map +1 -1
- package/dist/cjs/step-navigation-link/style.scss +5 -3
- package/dist/cjs/titles/styles.scss +2 -2
- package/dist/cjs/upload-and-set-site-logo.js +4 -5
- package/dist/cjs/upload-and-set-site-logo.js.map +1 -1
- package/dist/cjs/utils/contrastChecker.js +1 -22
- package/dist/cjs/utils/contrastChecker.js.map +1 -1
- package/dist/cjs/utils/flows.js +73 -117
- package/dist/cjs/utils/flows.js.map +1 -1
- package/dist/cjs/utils/is-domain.js +1 -2
- package/dist/cjs/utils/is-domain.js.map +1 -1
- package/dist/cjs/utils/use-data-loss-warning.js +1 -2
- package/dist/cjs/utils/use-data-loss-warning.js.map +1 -1
- package/dist/cjs/wpcom-request.js +24 -0
- package/dist/cjs/wpcom-request.js.map +1 -0
- package/dist/esm/action-buttons/index.js +1 -11
- package/dist/esm/action-buttons/index.js.map +1 -1
- package/dist/esm/action-buttons/style.scss +4 -40
- package/dist/esm/cart/create-cart-manager-client.js +1 -1
- package/dist/esm/cart/create-cart-manager-client.js.map +1 -1
- package/dist/esm/cart/index.js +40 -61
- package/dist/esm/cart/index.js.map +1 -1
- package/dist/esm/confetti/index.js +1 -1
- package/dist/esm/confetti/index.js.map +1 -1
- package/dist/esm/flow-progress/use-flow-progress.js +1 -58
- package/dist/esm/flow-progress/use-flow-progress.js.map +1 -1
- package/dist/esm/hooks/use-persisted-state.js +57 -0
- package/dist/esm/hooks/use-persisted-state.js.map +1 -0
- package/dist/esm/hooray/index.js +1 -1
- package/dist/esm/index.js +6 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mshots-image/index.js +33 -13
- package/dist/esm/mshots-image/index.js.map +1 -1
- package/dist/esm/mshots-image/style.scss +1 -0
- package/dist/esm/navigator/navigator-buttons/index.js.map +1 -1
- package/dist/esm/navigator/navigator-header/index.js.map +1 -1
- package/dist/esm/navigator/navigator-screens/hooks/use-navigator-screens.js +1 -1
- package/dist/esm/navigator/navigator-screens/hooks/use-navigator-screens.js.map +1 -1
- package/dist/esm/navigator/navigator-screens/navigator-screens.js +8 -3
- package/dist/esm/navigator/navigator-screens/navigator-screens.js.map +1 -1
- package/dist/esm/select-card-checkbox/index.js +4 -3
- package/dist/esm/select-card-checkbox/index.js.map +1 -1
- package/dist/esm/select-card-checkbox/style.scss +11 -14
- package/dist/esm/select-card-checkbox-v2/index.js +12 -0
- package/dist/esm/select-card-checkbox-v2/index.js.map +1 -0
- package/dist/esm/select-card-checkbox-v2/style.scss +25 -0
- package/dist/esm/select-items/index.js +3 -2
- package/dist/esm/select-items/index.js.map +1 -1
- package/dist/esm/select-items/style.scss +2 -1
- package/dist/esm/setup-tailored-site-after-creation.js +9 -37
- package/dist/esm/setup-tailored-site-after-creation.js.map +1 -1
- package/dist/esm/step-container/index.js +11 -13
- package/dist/esm/step-container/index.js.map +1 -1
- package/dist/esm/step-container/style.scss +35 -77
- package/dist/esm/step-container-v2/components/ContentRow/ContentRow.js +9 -0
- package/dist/esm/step-container-v2/components/ContentRow/ContentRow.js.map +1 -0
- package/dist/esm/step-container-v2/components/ContentRow/style.scss +26 -0
- package/dist/esm/step-container-v2/components/ContentWrapper/ContentWrapper.js +14 -0
- package/dist/esm/step-container-v2/components/ContentWrapper/ContentWrapper.js.map +1 -0
- package/dist/esm/step-container-v2/components/ContentWrapper/style.scss +70 -0
- package/dist/esm/step-container-v2/components/Heading/Heading.js +12 -0
- package/dist/esm/step-container-v2/components/Heading/Heading.js.map +1 -0
- package/dist/esm/step-container-v2/components/Heading/style.scss +47 -0
- package/dist/esm/step-container-v2/components/StepContainerV2/StepContainerV2.js +32 -0
- package/dist/esm/step-container-v2/components/StepContainerV2/StepContainerV2.js.map +1 -0
- package/dist/esm/step-container-v2/components/StepContainerV2/context.js +10 -0
- package/dist/esm/step-container-v2/components/StepContainerV2/context.js.map +1 -0
- package/dist/esm/step-container-v2/components/StepContainerV2/style.scss +21 -0
- package/dist/esm/step-container-v2/components/StepCounter/StepCounter.js +13 -0
- package/dist/esm/step-container-v2/components/StepCounter/StepCounter.js.map +1 -0
- package/dist/esm/step-container-v2/components/StepCounter/style.scss +4 -0
- package/dist/esm/step-container-v2/components/StickyBottomBar/StickyBottomBar.js +12 -0
- package/dist/esm/step-container-v2/components/StickyBottomBar/StickyBottomBar.js.map +1 -0
- package/dist/esm/step-container-v2/components/StickyBottomBar/StickyBottomBarRenderer.js +27 -0
- package/dist/esm/step-container-v2/components/StickyBottomBar/StickyBottomBarRenderer.js.map +1 -0
- package/dist/esm/step-container-v2/components/StickyBottomBar/style.scss +56 -0
- package/dist/esm/step-container-v2/components/TopBar/TopBar.js +49 -0
- package/dist/esm/step-container-v2/components/TopBar/TopBar.js.map +1 -0
- package/dist/esm/step-container-v2/components/TopBar/TopBarRenderer.js +27 -0
- package/dist/esm/step-container-v2/components/TopBar/TopBarRenderer.js.map +1 -0
- package/dist/esm/step-container-v2/components/TopBar/style.scss +75 -0
- package/dist/esm/step-container-v2/components/buttons/BackButton/BackButton.js +25 -0
- package/dist/esm/step-container-v2/components/buttons/BackButton/BackButton.js.map +1 -0
- package/dist/esm/step-container-v2/components/buttons/BackButton/style.scss +16 -0
- package/dist/esm/step-container-v2/components/buttons/LinkButton/LinkButton.js +14 -0
- package/dist/esm/step-container-v2/components/buttons/LinkButton/LinkButton.js.map +1 -0
- package/dist/esm/step-container-v2/components/buttons/LinkButton/style.scss +6 -0
- package/dist/esm/step-container-v2/components/buttons/PrimaryButton/PrimaryButton.js +14 -0
- package/dist/esm/step-container-v2/components/buttons/PrimaryButton/PrimaryButton.js.map +1 -0
- package/dist/esm/step-container-v2/components/buttons/PrimaryButton/style.scss +6 -0
- package/dist/esm/step-container-v2/components/buttons/SecondaryButton/SecondaryButton.js +14 -0
- package/dist/esm/step-container-v2/components/buttons/SecondaryButton/SecondaryButton.js.map +1 -0
- package/dist/esm/step-container-v2/components/buttons/SecondaryButton/style.scss +6 -0
- package/dist/esm/step-container-v2/components/buttons/SkipButton/SkipButton.js +24 -0
- package/dist/esm/step-container-v2/components/buttons/SkipButton/SkipButton.js.map +1 -0
- package/dist/esm/step-container-v2/contexts/StepContainerV2Context.js +13 -0
- package/dist/esm/step-container-v2/contexts/StepContainerV2Context.js.map +1 -0
- package/dist/esm/step-container-v2/helpers/decorateButtonWithTracksEventRecording.js +14 -0
- package/dist/esm/step-container-v2/helpers/decorateButtonWithTracksEventRecording.js.map +1 -0
- package/dist/esm/step-container-v2/helpers/normalizeButtonProps.js +8 -0
- package/dist/esm/step-container-v2/helpers/normalizeButtonProps.js.map +1 -0
- package/dist/esm/step-container-v2/helpers/wireframe-placeholder.js +15 -0
- package/dist/esm/step-container-v2/helpers/wireframe-placeholder.js.map +1 -0
- package/dist/esm/step-container-v2/helpers/withStepContainerV2ContextDecorator.js +11 -0
- package/dist/esm/step-container-v2/helpers/withStepContainerV2ContextDecorator.js.map +1 -0
- package/dist/esm/step-container-v2/index.js +22 -0
- package/dist/esm/step-container-v2/index.js.map +1 -0
- package/dist/esm/step-container-v2/types.js +2 -0
- package/dist/esm/step-container-v2/types.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.js +22 -0
- package/dist/esm/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.stories.js +45 -0
- package/dist/esm/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.stories.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.js +23 -0
- package/dist/esm/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.stories.js +21 -0
- package/dist/esm/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.stories.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/style.scss +14 -0
- package/dist/esm/step-container-v2/wireframes/Loading/Loading.js +26 -0
- package/dist/esm/step-container-v2/wireframes/Loading/Loading.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/Loading/Loading.stories.js +22 -0
- package/dist/esm/step-container-v2/wireframes/Loading/Loading.stories.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/Loading/style.scss +22 -0
- package/dist/esm/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.js +12 -0
- package/dist/esm/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.stories.js +13 -0
- package/dist/esm/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.stories.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/PlaygroundLayout/style.scss +5 -0
- package/dist/esm/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.js +33 -0
- package/dist/esm/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.stories.js +22 -0
- package/dist/esm/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.stories.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/TwoColumnLayout/style.scss +15 -0
- package/dist/esm/step-container-v2/wireframes/WideLayout/WideLayout.js +13 -0
- package/dist/esm/step-container-v2/wireframes/WideLayout/WideLayout.js.map +1 -0
- package/dist/esm/step-container-v2/wireframes/WideLayout/WideLayout.stories.js +36 -0
- package/dist/esm/step-container-v2/wireframes/WideLayout/WideLayout.stories.js.map +1 -0
- package/dist/esm/step-navigation-link/index.js +2 -2
- package/dist/esm/step-navigation-link/index.js.map +1 -1
- package/dist/esm/step-navigation-link/style.scss +5 -3
- package/dist/esm/titles/styles.scss +2 -2
- package/dist/esm/upload-and-set-site-logo.js +1 -1
- package/dist/esm/upload-and-set-site-logo.js.map +1 -1
- package/dist/esm/utils/contrastChecker.js +0 -20
- package/dist/esm/utils/contrastChecker.js.map +1 -1
- package/dist/esm/utils/flows.js +57 -96
- package/dist/esm/utils/flows.js.map +1 -1
- package/dist/esm/wpcom-request.js +18 -0
- package/dist/esm/wpcom-request.js.map +1 -0
- package/dist/styles/mixins.scss +4 -4
- package/dist/styles/variables.scss +2 -2
- package/dist/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/action-buttons/index.d.ts +0 -4
- package/dist/types/action-buttons/index.d.ts.map +1 -1
- package/dist/types/cart/index.d.ts +7 -4
- package/dist/types/cart/index.d.ts.map +1 -1
- package/dist/types/flow-progress/use-flow-progress.d.ts.map +1 -1
- package/dist/types/hooks/use-persisted-state.d.ts +26 -0
- package/dist/types/hooks/use-persisted-state.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/intent-screen/index.d.ts.map +1 -1
- package/dist/types/mshots-image/index.d.ts +2 -1
- package/dist/types/mshots-image/index.d.ts.map +1 -1
- package/dist/types/navigator/hooks/use-navigator-listener.d.ts.map +1 -1
- package/dist/types/navigator/navigator-buttons/index.d.ts +1 -1
- package/dist/types/navigator/navigator-buttons/index.d.ts.map +1 -1
- package/dist/types/navigator/navigator-header/index.d.ts +1 -1
- package/dist/types/navigator/navigator-header/index.d.ts.map +1 -1
- package/dist/types/navigator/navigator-item-group/index.d.ts +0 -1
- package/dist/types/navigator/navigator-item-group/index.d.ts.map +1 -1
- package/dist/types/navigator/navigator-listener/index.d.ts.map +1 -1
- package/dist/types/navigator/navigator-screen/index.d.ts.map +1 -1
- package/dist/types/navigator/navigator-screens/hooks/use-navigator-buttons.d.ts.map +1 -1
- package/dist/types/navigator/navigator-screens/hooks/use-navigator-screens.d.ts.map +1 -1
- package/dist/types/navigator/navigator-screens/navigator-screens.d.ts +4 -2
- package/dist/types/navigator/navigator-screens/navigator-screens.d.ts.map +1 -1
- package/dist/types/navigator/navigator-screens/types.d.ts +1 -1
- package/dist/types/navigator/navigator-screens/types.d.ts.map +1 -1
- package/dist/types/progress/index.d.ts.map +1 -1
- package/dist/types/select-card-checkbox/index.d.ts +3 -1
- package/dist/types/select-card-checkbox/index.d.ts.map +1 -1
- package/dist/types/select-card-checkbox-v2/index.d.ts +12 -0
- package/dist/types/select-card-checkbox-v2/index.d.ts.map +1 -0
- package/dist/types/select-items/index.d.ts +1 -1
- package/dist/types/select-items/index.d.ts.map +1 -1
- package/dist/types/setup-tailored-site-after-creation.d.ts +1 -1
- package/dist/types/setup-tailored-site-after-creation.d.ts.map +1 -1
- package/dist/types/step-container/index.d.ts +3 -4
- package/dist/types/step-container/index.d.ts.map +1 -1
- package/dist/types/step-container-v2/components/ContentRow/ContentRow.d.ts +9 -0
- package/dist/types/step-container-v2/components/ContentRow/ContentRow.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/ContentWrapper/ContentWrapper.d.ts +15 -0
- package/dist/types/step-container-v2/components/ContentWrapper/ContentWrapper.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/Heading/Heading.d.ts +11 -0
- package/dist/types/step-container-v2/components/Heading/Heading.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/StepContainerV2/StepContainerV2.d.ts +7 -0
- package/dist/types/step-container-v2/components/StepContainerV2/StepContainerV2.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/StepContainerV2/context.d.ts +12 -0
- package/dist/types/step-container-v2/components/StepContainerV2/context.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/StepCounter/StepCounter.d.ts +7 -0
- package/dist/types/step-container-v2/components/StepCounter/StepCounter.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/StickyBottomBar/StickyBottomBar.d.ts +14 -0
- package/dist/types/step-container-v2/components/StickyBottomBar/StickyBottomBar.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/StickyBottomBar/StickyBottomBarRenderer.d.ts +5 -0
- package/dist/types/step-container-v2/components/StickyBottomBar/StickyBottomBarRenderer.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/TopBar/TopBar.d.ts +25 -0
- package/dist/types/step-container-v2/components/TopBar/TopBar.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/TopBar/TopBarRenderer.d.ts +6 -0
- package/dist/types/step-container-v2/components/TopBar/TopBarRenderer.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/buttons/BackButton/BackButton.d.ts +6 -0
- package/dist/types/step-container-v2/components/buttons/BackButton/BackButton.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/buttons/LinkButton/LinkButton.d.ts +4 -0
- package/dist/types/step-container-v2/components/buttons/LinkButton/LinkButton.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/buttons/PrimaryButton/PrimaryButton.d.ts +4 -0
- package/dist/types/step-container-v2/components/buttons/PrimaryButton/PrimaryButton.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/buttons/SecondaryButton/SecondaryButton.d.ts +4 -0
- package/dist/types/step-container-v2/components/buttons/SecondaryButton/SecondaryButton.d.ts.map +1 -0
- package/dist/types/step-container-v2/components/buttons/SkipButton/SkipButton.d.ts +9 -0
- package/dist/types/step-container-v2/components/buttons/SkipButton/SkipButton.d.ts.map +1 -0
- package/dist/types/step-container-v2/contexts/StepContainerV2Context.d.ts +10 -0
- package/dist/types/step-container-v2/contexts/StepContainerV2Context.d.ts.map +1 -0
- package/dist/types/step-container-v2/helpers/decorateButtonWithTracksEventRecording.d.ts +8 -0
- package/dist/types/step-container-v2/helpers/decorateButtonWithTracksEventRecording.d.ts.map +1 -0
- package/dist/types/step-container-v2/helpers/normalizeButtonProps.d.ts +5 -0
- package/dist/types/step-container-v2/helpers/normalizeButtonProps.d.ts.map +1 -0
- package/dist/types/step-container-v2/helpers/wireframe-placeholder.d.ts +7 -0
- package/dist/types/step-container-v2/helpers/wireframe-placeholder.d.ts.map +1 -0
- package/dist/types/step-container-v2/helpers/withStepContainerV2ContextDecorator.d.ts +2 -0
- package/dist/types/step-container-v2/helpers/withStepContainerV2ContextDecorator.d.ts.map +1 -0
- package/dist/types/step-container-v2/index.d.ts +22 -0
- package/dist/types/step-container-v2/index.d.ts.map +1 -0
- package/dist/types/step-container-v2/types.d.ts +4 -0
- package/dist/types/step-container-v2/types.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.d.ts +16 -0
- package/dist/types/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.stories.d.ts +9 -0
- package/dist/types/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.stories.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.d.ts +18 -0
- package/dist/types/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.stories.d.ts +6 -0
- package/dist/types/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.stories.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/Loading/Loading.d.ts +12 -0
- package/dist/types/step-container-v2/wireframes/Loading/Loading.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/Loading/Loading.stories.d.ts +9 -0
- package/dist/types/step-container-v2/wireframes/Loading/Loading.stories.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.d.ts +10 -0
- package/dist/types/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.stories.d.ts +6 -0
- package/dist/types/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.stories.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.d.ts +20 -0
- package/dist/types/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.stories.d.ts +8 -0
- package/dist/types/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.stories.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/WideLayout/WideLayout.d.ts +13 -0
- package/dist/types/step-container-v2/wireframes/WideLayout/WideLayout.d.ts.map +1 -0
- package/dist/types/step-container-v2/wireframes/WideLayout/WideLayout.stories.d.ts +9 -0
- package/dist/types/step-container-v2/wireframes/WideLayout/WideLayout.stories.d.ts.map +1 -0
- package/dist/types/step-navigation-link/index.d.ts +1 -1
- package/dist/types/step-navigation-link/index.d.ts.map +1 -1
- package/dist/types/upload-and-set-site-logo.d.ts +1 -1
- package/dist/types/upload-and-set-site-logo.d.ts.map +1 -1
- package/dist/types/utils/contrastChecker.d.ts +0 -10
- package/dist/types/utils/contrastChecker.d.ts.map +1 -1
- package/dist/types/utils/domain-suggester.d.ts.map +1 -1
- package/dist/types/utils/flows.d.ts +37 -46
- package/dist/types/utils/flows.d.ts.map +1 -1
- package/dist/types/wpcom-request.d.ts +7 -0
- package/dist/types/wpcom-request.d.ts.map +1 -0
- package/jest.config.js +0 -1
- package/package.json +44 -23
- package/src/action-buttons/index.tsx +0 -40
- package/src/action-buttons/style.scss +4 -40
- package/src/cart/create-cart-manager-client.ts +1 -1
- package/src/cart/index.tsx +60 -103
- package/src/cart/test/index.ts +14 -14
- package/src/confetti/index.tsx +1 -1
- package/src/flow-progress/use-flow-progress.ts +1 -66
- package/src/hooks/test/index.ts +54 -0
- package/src/hooks/use-persisted-state.ts +85 -0
- package/src/hooray/index.tsx +1 -1
- package/src/index.ts +7 -12
- package/src/intent-screen/test/index.tsx +10 -7
- package/src/mshots-image/index.tsx +52 -21
- package/src/mshots-image/style.scss +1 -0
- package/src/navigator/navigator-buttons/index.tsx +1 -0
- package/src/navigator/navigator-header/index.tsx +1 -0
- package/src/navigator/navigator-screens/hooks/use-navigator-screens.tsx +5 -1
- package/src/navigator/navigator-screens/navigator-screens.tsx +17 -0
- package/src/navigator/navigator-screens/types.ts +1 -0
- package/src/select-card-checkbox/index.tsx +10 -4
- package/src/select-card-checkbox/style.scss +11 -14
- package/src/select-card-checkbox-v2/index.tsx +51 -0
- package/src/select-card-checkbox-v2/style.scss +25 -0
- package/src/select-card-checkbox-v2/test/index.test.tsx +49 -0
- package/src/select-items/index.tsx +10 -4
- package/src/select-items/style.scss +2 -1
- package/src/setup-tailored-site-after-creation.ts +16 -60
- package/src/step-container/index.tsx +21 -42
- package/src/step-container/style.scss +35 -77
- package/src/step-container-v2/README.md +235 -0
- package/src/step-container-v2/components/ContentRow/ContentRow.tsx +27 -0
- package/src/step-container-v2/components/ContentRow/style.scss +26 -0
- package/src/step-container-v2/components/ContentWrapper/ContentWrapper.tsx +41 -0
- package/src/step-container-v2/components/ContentWrapper/style.scss +70 -0
- package/src/step-container-v2/components/Heading/Heading.tsx +31 -0
- package/src/step-container-v2/components/Heading/style.scss +47 -0
- package/src/step-container-v2/components/StepContainerV2/StepContainerV2.tsx +55 -0
- package/src/step-container-v2/components/StepContainerV2/context.ts +25 -0
- package/src/step-container-v2/components/StepContainerV2/style.scss +21 -0
- package/src/step-container-v2/components/StepCounter/StepCounter.tsx +32 -0
- package/src/step-container-v2/components/StepCounter/style.scss +4 -0
- package/src/step-container-v2/components/StickyBottomBar/StickyBottomBar.tsx +46 -0
- package/src/step-container-v2/components/StickyBottomBar/StickyBottomBarRenderer.tsx +41 -0
- package/src/step-container-v2/components/StickyBottomBar/style.scss +56 -0
- package/src/step-container-v2/components/TopBar/TopBar.tsx +116 -0
- package/src/step-container-v2/components/TopBar/TopBarRenderer.tsx +43 -0
- package/src/step-container-v2/components/TopBar/style.scss +75 -0
- package/src/step-container-v2/components/buttons/BackButton/BackButton.tsx +32 -0
- package/src/step-container-v2/components/buttons/BackButton/style.scss +16 -0
- package/src/step-container-v2/components/buttons/LinkButton/LinkButton.tsx +17 -0
- package/src/step-container-v2/components/buttons/LinkButton/style.scss +6 -0
- package/src/step-container-v2/components/buttons/PrimaryButton/PrimaryButton.tsx +17 -0
- package/src/step-container-v2/components/buttons/PrimaryButton/style.scss +6 -0
- package/src/step-container-v2/components/buttons/SecondaryButton/SecondaryButton.tsx +17 -0
- package/src/step-container-v2/components/buttons/SecondaryButton/style.scss +6 -0
- package/src/step-container-v2/components/buttons/SkipButton/SkipButton.tsx +30 -0
- package/src/step-container-v2/contexts/StepContainerV2Context.ts +23 -0
- package/src/step-container-v2/helpers/decorateButtonWithTracksEventRecording.ts +28 -0
- package/src/step-container-v2/helpers/normalizeButtonProps.ts +14 -0
- package/src/step-container-v2/helpers/wireframe-placeholder.tsx +28 -0
- package/src/step-container-v2/helpers/withStepContainerV2ContextDecorator.tsx +16 -0
- package/src/step-container-v2/index.tsx +24 -0
- package/src/step-container-v2/types.ts +4 -0
- package/src/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.stories.tsx +122 -0
- package/src/step-container-v2/wireframes/CenteredColumnLayout/CenteredColumnLayout.tsx +66 -0
- package/src/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.stories.tsx +51 -0
- package/src/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/FixedColumnOnTheLeftLayout.tsx +69 -0
- package/src/step-container-v2/wireframes/FixedColumnOnTheLeftLayout/style.scss +14 -0
- package/src/step-container-v2/wireframes/Loading/Loading.stories.tsx +27 -0
- package/src/step-container-v2/wireframes/Loading/Loading.tsx +52 -0
- package/src/step-container-v2/wireframes/Loading/style.scss +22 -0
- package/src/step-container-v2/wireframes/Loading/test/Loading.test.tsx +42 -0
- package/src/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.stories.tsx +21 -0
- package/src/step-container-v2/wireframes/PlaygroundLayout/PlaygroundLayout.tsx +31 -0
- package/src/step-container-v2/wireframes/PlaygroundLayout/style.scss +5 -0
- package/src/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.stories.tsx +93 -0
- package/src/step-container-v2/wireframes/TwoColumnLayout/TwoColumnLayout.tsx +93 -0
- package/src/step-container-v2/wireframes/TwoColumnLayout/style.scss +15 -0
- package/src/step-container-v2/wireframes/WideLayout/WideLayout.stories.tsx +83 -0
- package/src/step-container-v2/wireframes/WideLayout/WideLayout.tsx +44 -0
- package/src/step-navigation-link/index.tsx +3 -0
- package/src/step-navigation-link/style.scss +5 -3
- package/src/style-imports.d.ts +3 -0
- package/src/titles/styles.scss +2 -2
- package/src/upload-and-set-site-logo.ts +1 -1
- package/src/utils/contrastChecker.ts +0 -35
- package/src/utils/flows.ts +67 -123
- package/src/wpcom-request.ts +26 -0
- package/styles/mixins.scss +4 -4
- package/styles/variables.scss +2 -2
- package/tsconfig.json +1 -0
- package/dist/cjs/feature-icon/index.js +0 -19
- package/dist/cjs/feature-icon/index.js.map +0 -1
- package/dist/cjs/flow-progress/index.js +0 -14
- package/dist/cjs/flow-progress/index.js.map +0 -1
- package/dist/cjs/flow-progress/style.scss +0 -5
- package/dist/cjs/notice/index.js +0 -12
- package/dist/cjs/notice/index.js.map +0 -1
- package/dist/cjs/notice/style.scss +0 -19
- package/dist/cjs/select-card-radio/index.js +0 -21
- package/dist/cjs/select-card-radio/index.js.map +0 -1
- package/dist/cjs/select-card-radio/style.scss +0 -44
- package/dist/cjs/sensei-logo/index.js +0 -8
- package/dist/cjs/sensei-logo/index.js.map +0 -1
- package/dist/cjs/videopress-logo/index.js +0 -8
- package/dist/cjs/videopress-logo/index.js.map +0 -1
- package/dist/esm/feature-icon/index.js +0 -16
- package/dist/esm/feature-icon/index.js.map +0 -1
- package/dist/esm/flow-progress/index.js +0 -12
- package/dist/esm/flow-progress/index.js.map +0 -1
- package/dist/esm/flow-progress/style.scss +0 -5
- package/dist/esm/notice/index.js +0 -9
- package/dist/esm/notice/index.js.map +0 -1
- package/dist/esm/notice/style.scss +0 -19
- package/dist/esm/select-card-radio/index.js +0 -15
- package/dist/esm/select-card-radio/index.js.map +0 -1
- package/dist/esm/select-card-radio/style.scss +0 -44
- package/dist/esm/sensei-logo/index.js +0 -6
- package/dist/esm/sensei-logo/index.js.map +0 -1
- package/dist/esm/videopress-logo/index.js +0 -6
- package/dist/esm/videopress-logo/index.js.map +0 -1
- package/dist/types/feature-icon/index.d.ts +0 -9
- package/dist/types/feature-icon/index.d.ts.map +0 -1
- package/dist/types/flow-progress/index.d.ts +0 -9
- package/dist/types/flow-progress/index.d.ts.map +0 -1
- package/dist/types/notice/index.d.ts +0 -7
- package/dist/types/notice/index.d.ts.map +0 -1
- package/dist/types/select-card-radio/index.d.ts +0 -22
- package/dist/types/select-card-radio/index.d.ts.map +0 -1
- package/dist/types/sensei-logo/index.d.ts +0 -8
- package/dist/types/sensei-logo/index.d.ts.map +0 -1
- package/dist/types/videopress-logo/index.d.ts +0 -8
- package/dist/types/videopress-logo/index.d.ts.map +0 -1
- package/src/feature-icon/index.tsx +0 -102
- package/src/flow-progress/index.tsx +0 -22
- package/src/flow-progress/style.scss +0 -5
- package/src/notice/index.tsx +0 -16
- package/src/notice/style.scss +0 -19
- package/src/select-card-radio/index.tsx +0 -64
- package/src/select-card-radio/style.scss +0 -44
- package/src/select-card-radio/test/index.tsx +0 -50
- package/src/sensei-logo/index.tsx +0 -30
- package/src/videopress-logo/index.tsx +0 -36
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# StepContainerV2
|
|
2
|
+
|
|
3
|
+
Next-generation step composition utility.
|
|
4
|
+
|
|
5
|
+
**Disclaimer: This is a work in progress and the API is not yet stable.**
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
This is a compilation of everything we've learned with `StepContainer`. Just like its predecessor, it focuses on aesthetics of the step (standardized components, margins, paddings, etc.), and not their content or functionality. The main difference is that it's more flexible and easier to extend.
|
|
10
|
+
|
|
11
|
+
The new version focuses on modularity and composition instead of overrides through props and CSS. We've observed that the previous version accepted a variety of props that modified how a component looks. Most of the times these properties had to play nicely with each other, which increased complexity.
|
|
12
|
+
|
|
13
|
+
This version, however, provides several "slots" that allow the developer to declare _which_ parts of the step will be rendered through the creation of wireframes, instead of imperatively specifying _what_ to render. `topBar`, `heading`, `stickyBottomBar`, and `footer` are example of slots.
|
|
14
|
+
|
|
15
|
+
It also provides the elements to be used within these slots, such as `TopBar`, `Heading`, `StickyBottomBar`, and `Footer`, as well as their internal elements, such as buttons like `PrimaryButton`, `SkipButton`, and `BackButton`.
|
|
16
|
+
|
|
17
|
+
Here's an example:
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
import { Step } from '@automattic/onboarding';
|
|
21
|
+
|
|
22
|
+
const MyStep = () => {
|
|
23
|
+
const nextButton = <Step.PrimaryButton onClick={ navigation.submit } />;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Step.CenteredColumnLayout
|
|
27
|
+
columnWidth={ 4 }
|
|
28
|
+
topBar={ <Step.TopBar /> }
|
|
29
|
+
heading={ <Step.Heading text="Heading" /> }
|
|
30
|
+
stickyBottomBar={ <Step.StickyBottomBar rightElement={ nextButton } /> }
|
|
31
|
+
>
|
|
32
|
+
{ ( { isSmallViewport } ) => (
|
|
33
|
+
<>
|
|
34
|
+
<p>Here comes the content of the step.</p>
|
|
35
|
+
{ isSmallViewport && nextButton }
|
|
36
|
+
</>
|
|
37
|
+
) }
|
|
38
|
+
</Step.CenteredColumnLayout>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
In the example above, the top bar won't have a skip nor a back button. There's a `stickyBottomBar` that will render the Next button on mobile, and the same button will also be rendered within the step's content, but only on smaller screens and above. Although it's possible, this particular step won't render a footer.
|
|
44
|
+
|
|
45
|
+
It reduces the complexity of layouting by delegating the rendering responsibility to the components within the slots. A good example of what we mean here is the [`headerImageUrl` prop of `StepContainer`](../step-container/index.tsx), which should exist if `isHorizontalLayout` is `true`, but there is no explanation of that in the code, and it's not obvious to the developer reading code introduced by others.
|
|
46
|
+
|
|
47
|
+
Read the [how to extend it](#how-to-extend-it) section to learn how to reproduce this behavior in `StepContainerV2`.
|
|
48
|
+
|
|
49
|
+
## How to use it
|
|
50
|
+
|
|
51
|
+
**You shouldn't use `StepContainerV2` directly. Instead, use the wireframes that are exported from this package.**
|
|
52
|
+
|
|
53
|
+
Aside from the stories (run `yarn storybook:start`), you can follow the examples from `~/client/landing/stepper/declarative-flow/internals/steps-repository`.
|
|
54
|
+
|
|
55
|
+
Please do NOT override the `Step.*` components with CSS as this creates inconsistencies between steps and becomes a maintenance nightmare. Ideally, you should not need to do this as the steps are designed to be composed, and the wireframes are approved by the designers.
|
|
56
|
+
|
|
57
|
+
### What are wireframes?
|
|
58
|
+
|
|
59
|
+
Wireframes are layout arrangements that have been approved by the Dotcom designers. They are exported from this package and can be used in the steps.
|
|
60
|
+
|
|
61
|
+
Here are the wireframes specs: <https://www.figma.com/design/QFAYPvq4xYUZC5AFkrfJFM/Dotcom-Onboarding-(Open)?node-id=1-31&p=f&t=CX7AmXyb9CTsFGAI-0>.
|
|
62
|
+
|
|
63
|
+
## How to extend it
|
|
64
|
+
|
|
65
|
+
- Try to keep the components as generic as possible, and without adding overrides to components coming from `@wordpress/components` unless explicitly approved by the designers.
|
|
66
|
+
- If the step has a unique UI element that does not exist in other steps, it probably does not belong in `StepContainerV2`. Try using some of the slots, or add a new one.
|
|
67
|
+
- Do not add `is*` props to `StepContainerV2` as we want to stick to composition.
|
|
68
|
+
- Do not export `StepContainerV2` directly. We're defining several wireframes that were approved by the designers, and these are the components you should be using in the steps.
|
|
69
|
+
|
|
70
|
+
### Workshop: How to create the horizontal layout wireframe
|
|
71
|
+
|
|
72
|
+
As a way to demonstrate how to create a new wireframe, let's re-create `HorizontalLayout`.
|
|
73
|
+
|
|
74
|
+
This layout arranges two columns side by side. It has the heading on the left and the content on the right. Optionally, an image is rendered below the heading. One example of where this layout is used is in `/setup/site-setup/intent?siteSlug=%s`.
|
|
75
|
+
|
|
76
|
+
Let's create a new wireframe named `HorizontalLayout`. Here's what its code looks like:
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
interface HorizontalLayoutProps {
|
|
80
|
+
topBar?: ContentProp;
|
|
81
|
+
heading?: ReactNode;
|
|
82
|
+
imageUrl?: string;
|
|
83
|
+
className?: string;
|
|
84
|
+
children?: ContentProp;
|
|
85
|
+
footer?: ReactNode;
|
|
86
|
+
stickyBottomBar?: ContentProp;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const HorizontalLayout = ( {
|
|
90
|
+
topBar,
|
|
91
|
+
heading,
|
|
92
|
+
imageUrl,
|
|
93
|
+
children,
|
|
94
|
+
footer,
|
|
95
|
+
stickyBottomBar,
|
|
96
|
+
}: HorizontalLayoutProps ) => {
|
|
97
|
+
return (
|
|
98
|
+
<StepContainerV2>
|
|
99
|
+
{ ( context ) => {
|
|
100
|
+
const content = typeof children === 'function' ? children( context ) : children;
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<>
|
|
104
|
+
<TopBarRenderer topBar={ topBar } />
|
|
105
|
+
<ContentWrapper width="wide" centerAligned={ context.isSmallViewport }>
|
|
106
|
+
<ContentRow
|
|
107
|
+
columns={ 10 }
|
|
108
|
+
className="step-container-v2__content-row--horizontal-layout"
|
|
109
|
+
>
|
|
110
|
+
<div className="step-container-v2__content-row--horizontal-layout-left">
|
|
111
|
+
{ heading }
|
|
112
|
+
{ imageUrl && <img src={ imageUrl } alt="" /> }
|
|
113
|
+
</div>
|
|
114
|
+
<div className="step-container-v2__content-row--horizontal-layout-right">
|
|
115
|
+
{ content }
|
|
116
|
+
</div>
|
|
117
|
+
</ContentRow>
|
|
118
|
+
{ footer }
|
|
119
|
+
</ContentWrapper>
|
|
120
|
+
<StickyBottomBarRenderer stickyBottomBar={ stickyBottomBar } />
|
|
121
|
+
</>
|
|
122
|
+
);
|
|
123
|
+
} }
|
|
124
|
+
</StepContainerV2>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Then, we need to add the styles for the new wireframe. Let's create a new file called `style.scss` and add the following code:
|
|
130
|
+
|
|
131
|
+
```scss
|
|
132
|
+
.step-container-v2__content-row--horizontal-layout {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
gap: 3rem;
|
|
136
|
+
|
|
137
|
+
@include break-large {
|
|
138
|
+
flex-direction: row;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.step-container-v2__content-row--horizontal-layout-left,
|
|
143
|
+
.step-container-v2__content-row--horizontal-layout-right {
|
|
144
|
+
flex: 1;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.step-container-v2__content-row--horizontal-layout-left {
|
|
148
|
+
display: flex;
|
|
149
|
+
flex-direction: column;
|
|
150
|
+
align-items: flex-start;
|
|
151
|
+
gap: 3rem;
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
> Notice that we're using the `@include break-large` mixin to target the large viewport and above. The Gutenberg breakpoints are matched within StepContainerV2, so we can use them to create responsive styles for the wireframe.
|
|
156
|
+
|
|
157
|
+
One implementation detail is that the `HorizontalLayout` wireframe does not render the illustration on mobile. `StepContainerV2` accepts a render prop that can be used to render the content of the step. This is useful to conditionally render content based on the viewports defined for the wireframe. We can then modify the previous example to render the illustration only on medium and larger screens.
|
|
158
|
+
|
|
159
|
+
Let's modify the `children` of `HorizontalLayout` to reflect this new requirement:
|
|
160
|
+
|
|
161
|
+
```jsx
|
|
162
|
+
( context ) => {
|
|
163
|
+
const content = typeof children === 'function' ? children( context ) : children;
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<>
|
|
167
|
+
<TopBarRenderer topBar={ topBar } />
|
|
168
|
+
<ContentWrapper width="wide" centerAligned={ context.isSmallViewport }>
|
|
169
|
+
<ContentRow columns={ 10 } className="step-container-v2__content-row--horizontal-layout">
|
|
170
|
+
<div className="step-container-v2__content-row--horizontal-layout-left">
|
|
171
|
+
{ heading }
|
|
172
|
+
{ context.isSmallViewport && imageUrl && <img src={ imageUrl } alt="" /> }
|
|
173
|
+
</div>
|
|
174
|
+
<div className="step-container-v2__content-row--horizontal-layout-right">{ content }</div>
|
|
175
|
+
</ContentRow>
|
|
176
|
+
{ footer }
|
|
177
|
+
</ContentWrapper>
|
|
178
|
+
<StickyBottomBarRenderer stickyBottomBar={ stickyBottomBar } />
|
|
179
|
+
</>
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The horizontal layout wireframe expects the heading element to be left-aligned. We can create a new compound component and expose that as part of the public API of the wireframe:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
HorizontalLayout.Heading = ( props: ComponentProps< typeof Heading > ) => (
|
|
188
|
+
<Heading { ...props } align="left" />
|
|
189
|
+
);
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Last but not least, let's export the wireframe so it can be used in a step:
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
// In step-container-v2/index.ts
|
|
196
|
+
// ...
|
|
197
|
+
export { HorizontalLayout } from './wireframes/HorizontalLayout/HorizontalLayout';
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Et voilà, we've created a new wireframe. Here's how to use it:
|
|
201
|
+
|
|
202
|
+
```jsx
|
|
203
|
+
<Step.HorizontalLayout
|
|
204
|
+
heading={ <Step.HorizontalLayout.Heading text="Heading" /> }
|
|
205
|
+
imageUrl={ imageUrl }
|
|
206
|
+
>
|
|
207
|
+
<p>Here comes the content rendered in the right column of the step.</p>
|
|
208
|
+
<Step.PrimaryButton onClick={ navigation.submit } />
|
|
209
|
+
</Step.HorizontalLayout>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
This feels a bit more verbose, but it's fine since we won't be creating wireframes every day. Remember that a wireframe is the shell of a step, which is designed to be reusable. This longer process ensures that the wireframe is well-thought-out.
|
|
213
|
+
|
|
214
|
+
## FAQ
|
|
215
|
+
|
|
216
|
+
### Will this component be called `StepContainerV2` forever?
|
|
217
|
+
|
|
218
|
+
Of course not! The plan is for this new version to replace `StepContainer` entirely. We'll do this migration gradually.
|
|
219
|
+
|
|
220
|
+
### How can I adopt it in Stepper without breaking steps that are used in multiple flows?
|
|
221
|
+
|
|
222
|
+
There's an utility called `shouldUseStepContainerV2` that allows, at a step level, to define which flows should render this version of the container vs. the original one.
|
|
223
|
+
|
|
224
|
+
### How do I run storybook?
|
|
225
|
+
|
|
226
|
+
Either:
|
|
227
|
+
|
|
228
|
+
- `yarn storybook:start` from the root of this package, or
|
|
229
|
+
- `yarn workspace @automattic/onboarding storybook:start` from the root of the monorepo.
|
|
230
|
+
|
|
231
|
+
Storybook will open a browser window automatically.
|
|
232
|
+
|
|
233
|
+
### Who can I contact if I have any questions?
|
|
234
|
+
|
|
235
|
+
Ping @quake-team on Slack.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import './style.scss';
|
|
5
|
+
|
|
6
|
+
export const ContentRow = ( {
|
|
7
|
+
children,
|
|
8
|
+
columns = 12,
|
|
9
|
+
className,
|
|
10
|
+
stretched,
|
|
11
|
+
}: {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
columns?: number;
|
|
14
|
+
className?: string;
|
|
15
|
+
stretched?: boolean;
|
|
16
|
+
} ) => {
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
className={ clsx( 'step-container-v2__content-row', className, {
|
|
20
|
+
stretched,
|
|
21
|
+
} ) }
|
|
22
|
+
style={ { '--columns': columns } as CSSProperties }
|
|
23
|
+
>
|
|
24
|
+
{ children }
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@import '@wordpress/base-styles/breakpoints';
|
|
2
|
+
@import '@wordpress/base-styles/mixins';
|
|
3
|
+
|
|
4
|
+
.step-container-v2__content-row {
|
|
5
|
+
width: 100%;
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
|
|
8
|
+
@include break-small {
|
|
9
|
+
--total-column-width: calc(
|
|
10
|
+
var( --columns ) * var( --step-container-v2-content-column-width )
|
|
11
|
+
);
|
|
12
|
+
--total-gap-width: calc(
|
|
13
|
+
( var( --columns ) - 1 ) * var( --step-container-v2-content-column-gap )
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
--step-container-v2-content-row-max-width: calc(
|
|
17
|
+
var( --total-gap-width ) + var( --total-column-width )
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
max-width: var( --step-container-v2-content-row-max-width );
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.stretched {
|
|
24
|
+
align-self: stretch;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import './style.scss';
|
|
5
|
+
|
|
6
|
+
type ContentWrapperProps = {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
centerAligned?: boolean;
|
|
9
|
+
axisDirection?: 'vertical' | 'horizontal';
|
|
10
|
+
noTopPadding?: boolean;
|
|
11
|
+
noBottomPadding?: boolean;
|
|
12
|
+
noInlinePadding?: boolean;
|
|
13
|
+
isFullWidth?: boolean;
|
|
14
|
+
noGap?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const ContentWrapper = ( {
|
|
18
|
+
children,
|
|
19
|
+
centerAligned,
|
|
20
|
+
axisDirection = 'vertical',
|
|
21
|
+
noTopPadding = false,
|
|
22
|
+
noBottomPadding = false,
|
|
23
|
+
noInlinePadding = false,
|
|
24
|
+
isFullWidth = false,
|
|
25
|
+
noGap = false,
|
|
26
|
+
}: ContentWrapperProps ) => {
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className={ clsx( 'step-container-v2__content-wrapper', `axis-${ axisDirection }`, {
|
|
30
|
+
'center-aligned': centerAligned,
|
|
31
|
+
'no-top-padding': noTopPadding,
|
|
32
|
+
'no-bottom-padding': noBottomPadding,
|
|
33
|
+
'no-inline-padding': noInlinePadding,
|
|
34
|
+
'is-full-width': isFullWidth,
|
|
35
|
+
'no-gap': noGap,
|
|
36
|
+
} ) }
|
|
37
|
+
>
|
|
38
|
+
{ children }
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@import '@wordpress/base-styles/breakpoints';
|
|
2
|
+
@import '@wordpress/base-styles/mixins';
|
|
3
|
+
|
|
4
|
+
.step-container-v2__content-wrapper {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 3rem;
|
|
8
|
+
width: 100%;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
flex: 1;
|
|
11
|
+
|
|
12
|
+
&.axis-vertical {
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.axis-horizontal {
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
padding: var( --step-container-v2-content-block-padding )
|
|
21
|
+
var( --step-container-v2-content-inline-padding );
|
|
22
|
+
|
|
23
|
+
&.no-top-padding {
|
|
24
|
+
padding-top: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.no-bottom-padding {
|
|
28
|
+
padding-bottom: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.no-inline-padding {
|
|
32
|
+
padding: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.no-gap {
|
|
36
|
+
gap: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
--step-container-v2-content-max-width: 1344px;
|
|
40
|
+
|
|
41
|
+
max-width: calc(
|
|
42
|
+
var( --step-container-v2-content-max-width ) + 2 *
|
|
43
|
+
var( --step-container-v2-content-inline-padding )
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
--step-container-v2-content-column-gap: 24px;
|
|
47
|
+
|
|
48
|
+
--step-container-v2-content-max-width-minus-column-gaps: calc(
|
|
49
|
+
var( --step-container-v2-content-max-width ) - 11 *
|
|
50
|
+
var( --step-container-v2-content-column-gap )
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
--step-container-v2-content-column-width: calc(
|
|
54
|
+
var( --step-container-v2-content-max-width-minus-column-gaps ) / 12
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
&.center-aligned {
|
|
58
|
+
@include break-small {
|
|
59
|
+
justify-content: center;
|
|
60
|
+
padding-bottom: calc(
|
|
61
|
+
var( --step-container-v2-content-block-padding ) + var( --step-container-v2-top-bar-height )
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.is-full-width {
|
|
67
|
+
--step-container-v2-content-max-width: 100%;
|
|
68
|
+
max-width: 100%;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import './style.scss';
|
|
5
|
+
|
|
6
|
+
interface HeadingProps {
|
|
7
|
+
text: ReactNode;
|
|
8
|
+
subText?: ReactNode;
|
|
9
|
+
align?: 'left' | 'center';
|
|
10
|
+
size?: 'small';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Heading = ( { text, subText, align, size }: HeadingProps ) => {
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
className={ clsx( 'step-container-v2__heading', {
|
|
17
|
+
left: align === 'left',
|
|
18
|
+
center: align === 'center',
|
|
19
|
+
} ) }
|
|
20
|
+
>
|
|
21
|
+
<h1
|
|
22
|
+
className={ clsx( 'wp-brand-font', {
|
|
23
|
+
small: size === 'small',
|
|
24
|
+
} ) }
|
|
25
|
+
>
|
|
26
|
+
{ text }
|
|
27
|
+
</h1>
|
|
28
|
+
{ subText && <p>{ subText }</p> }
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@import '@wordpress/base-styles/breakpoints';
|
|
2
|
+
@import '@wordpress/base-styles/mixins';
|
|
3
|
+
@import "@automattic/typography/styles/fonts";
|
|
4
|
+
|
|
5
|
+
.step-container-v2__heading {
|
|
6
|
+
width: 100%;
|
|
7
|
+
text-wrap: balance;
|
|
8
|
+
|
|
9
|
+
@include break-small {
|
|
10
|
+
text-align: center;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
h1 {
|
|
14
|
+
margin-block: 0;
|
|
15
|
+
color: var( --color-neutral-100 );
|
|
16
|
+
font-size: 2rem;
|
|
17
|
+
line-height: 1.25;
|
|
18
|
+
text-wrap: balance;
|
|
19
|
+
|
|
20
|
+
&:not( .small ) {
|
|
21
|
+
@include break-large {
|
|
22
|
+
font-size: 2.75rem;
|
|
23
|
+
line-height: 1.15;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
p {
|
|
29
|
+
margin-block: 0.5rem 0;
|
|
30
|
+
color: var( --color-text );
|
|
31
|
+
font-size: 0.875rem;
|
|
32
|
+
line-height: 1.5;
|
|
33
|
+
text-wrap: balance;
|
|
34
|
+
|
|
35
|
+
@include break-large {
|
|
36
|
+
font-size: 1rem;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.left {
|
|
41
|
+
text-align: left !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.center {
|
|
45
|
+
text-align: center !important;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { ContentProp, StepContainerV2Context } from './context';
|
|
4
|
+
import './style.scss';
|
|
5
|
+
|
|
6
|
+
export const StepContainerV2 = ( {
|
|
7
|
+
children,
|
|
8
|
+
initialTopBarHeight,
|
|
9
|
+
}: {
|
|
10
|
+
children: ContentProp;
|
|
11
|
+
initialTopBarHeight?: string;
|
|
12
|
+
} ) => {
|
|
13
|
+
const isSmallViewport = useViewportMatch( 'small', '>=' );
|
|
14
|
+
const isLargeViewport = useViewportMatch( 'large', '>=' );
|
|
15
|
+
|
|
16
|
+
const [ topBarHeight, setTopBarHeight ] = useState( initialTopBarHeight ?? '0px' );
|
|
17
|
+
const [ stickyBottomBarHeight, setStickyBottomBarHeight ] = useState( 0 );
|
|
18
|
+
|
|
19
|
+
const stepContainerContextValue = useMemo(
|
|
20
|
+
() => ( {
|
|
21
|
+
isSmallViewport,
|
|
22
|
+
isLargeViewport,
|
|
23
|
+
topBarHeight,
|
|
24
|
+
setTopBarHeight,
|
|
25
|
+
stickyBottomBarHeight,
|
|
26
|
+
setStickyBottomBarHeight,
|
|
27
|
+
} ),
|
|
28
|
+
[
|
|
29
|
+
isSmallViewport,
|
|
30
|
+
isLargeViewport,
|
|
31
|
+
topBarHeight,
|
|
32
|
+
setTopBarHeight,
|
|
33
|
+
stickyBottomBarHeight,
|
|
34
|
+
setStickyBottomBarHeight,
|
|
35
|
+
]
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const content = typeof children === 'function' ? children( stepContainerContextValue ) : children;
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<StepContainerV2Context.Provider value={ stepContainerContextValue }>
|
|
42
|
+
<div
|
|
43
|
+
className="step-container-v2"
|
|
44
|
+
style={
|
|
45
|
+
{
|
|
46
|
+
'--step-container-v2-top-bar-height': topBarHeight,
|
|
47
|
+
'--step-container-v2-sticky-bottom-bar-height': `${ stickyBottomBarHeight }px`,
|
|
48
|
+
} as React.CSSProperties
|
|
49
|
+
}
|
|
50
|
+
>
|
|
51
|
+
{ content }
|
|
52
|
+
</div>
|
|
53
|
+
</StepContainerV2Context.Provider>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createContext, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface StepContainerV2InternalContextType {
|
|
4
|
+
isSmallViewport: boolean;
|
|
5
|
+
isLargeViewport: boolean;
|
|
6
|
+
topBarHeight: string;
|
|
7
|
+
setTopBarHeight: ( height: string ) => void;
|
|
8
|
+
stickyBottomBarHeight: number;
|
|
9
|
+
setStickyBottomBarHeight: ( height: number ) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ContentProp< T = ReactNode > =
|
|
13
|
+
| ( (
|
|
14
|
+
context: Pick< StepContainerV2InternalContextType, 'isSmallViewport' | 'isLargeViewport' >
|
|
15
|
+
) => T )
|
|
16
|
+
| T;
|
|
17
|
+
|
|
18
|
+
export const StepContainerV2Context = createContext< StepContainerV2InternalContextType >( {
|
|
19
|
+
isSmallViewport: false,
|
|
20
|
+
isLargeViewport: false,
|
|
21
|
+
topBarHeight: '0px',
|
|
22
|
+
setTopBarHeight: () => {},
|
|
23
|
+
stickyBottomBarHeight: 0,
|
|
24
|
+
setStickyBottomBarHeight: () => {},
|
|
25
|
+
} );
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@import '@wordpress/base-styles/breakpoints';
|
|
2
|
+
@import '@wordpress/base-styles/mixins';
|
|
3
|
+
|
|
4
|
+
.step-container-v2 {
|
|
5
|
+
--step-container-v2-content-block-padding: 2rem;
|
|
6
|
+
--step-container-v2-content-inline-padding: 1rem;
|
|
7
|
+
|
|
8
|
+
--step-container-v2-top-bar-padding: 1rem;
|
|
9
|
+
--step-container-v2-top-bar-content-height: 24px;
|
|
10
|
+
|
|
11
|
+
@include break-small {
|
|
12
|
+
--step-container-v2-content-inline-padding: 3rem;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
width: 100%;
|
|
16
|
+
min-height: 100vh;
|
|
17
|
+
margin: 0;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
align-items: center;
|
|
21
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { sprintf } from '@wordpress/i18n';
|
|
2
|
+
import { useI18n } from '@wordpress/react-i18n';
|
|
3
|
+
|
|
4
|
+
import './style.scss';
|
|
5
|
+
|
|
6
|
+
export interface StepCounterProps {
|
|
7
|
+
current: number;
|
|
8
|
+
total: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const StepCounter = ( { current, total }: StepCounterProps ) => {
|
|
12
|
+
const { __ } = useI18n();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<span
|
|
16
|
+
className="step-container-v2__step-counter"
|
|
17
|
+
aria-label={ sprintf(
|
|
18
|
+
/* translators: 1: current step number, 2: total number of steps. */
|
|
19
|
+
__( 'Step %1$d of %2$d', __i18n_text_domain__ ),
|
|
20
|
+
current,
|
|
21
|
+
total
|
|
22
|
+
) }
|
|
23
|
+
>
|
|
24
|
+
{ sprintf(
|
|
25
|
+
/* translators: 1: current step number, 2: total number of steps. */
|
|
26
|
+
__( '%1$d of %2$d', __i18n_text_domain__ ),
|
|
27
|
+
current,
|
|
28
|
+
total
|
|
29
|
+
) }
|
|
30
|
+
</span>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import './style.scss';
|
|
5
|
+
|
|
6
|
+
interface StickyBottomBarProps {
|
|
7
|
+
leftElement?: ReactNode;
|
|
8
|
+
centerElement?: ReactNode;
|
|
9
|
+
rightElement?: ReactNode;
|
|
10
|
+
noBoxShadow?: boolean;
|
|
11
|
+
hasTransparentBackground?: boolean;
|
|
12
|
+
centerText?: boolean;
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const StickyBottomBar = ( {
|
|
17
|
+
leftElement,
|
|
18
|
+
centerElement,
|
|
19
|
+
rightElement,
|
|
20
|
+
noBoxShadow,
|
|
21
|
+
hasTransparentBackground,
|
|
22
|
+
centerText,
|
|
23
|
+
fullWidth,
|
|
24
|
+
}: StickyBottomBarProps ) => {
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
className={ clsx( 'step-container-v2__sticky-bottom-bar', {
|
|
28
|
+
'step-container-v2__sticky-bottom-bar--no-box-shadow': noBoxShadow === true,
|
|
29
|
+
'step-container-v2__sticky-bottom-bar--center-text': centerText === true,
|
|
30
|
+
'step-container-v2__sticky-bottom-bar--full-width': fullWidth === true,
|
|
31
|
+
'step-container-v2__sticky-bottom-bar--has-transparent-background':
|
|
32
|
+
hasTransparentBackground === true,
|
|
33
|
+
} ) }
|
|
34
|
+
>
|
|
35
|
+
{ leftElement && (
|
|
36
|
+
<div className="step-container-v2__sticky-bottom-bar-left-element">{ leftElement }</div>
|
|
37
|
+
) }
|
|
38
|
+
{ centerElement && (
|
|
39
|
+
<div className="step-container-v2__sticky-bottom-bar-center-element">{ centerElement }</div>
|
|
40
|
+
) }
|
|
41
|
+
{ rightElement && (
|
|
42
|
+
<div className="step-container-v2__sticky-bottom-bar-right-element">{ rightElement }</div>
|
|
43
|
+
) }
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
};
|