@uni-design-system/uni-react 0.0.18 → 1.0.0
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/main.ts +26 -0
- package/.storybook/preview.ts +21 -0
- package/.turbo/turbo-build.log +12 -0
- package/CHANGELOG.md +12 -0
- package/dist/{cjs/components → components}/button/button.component.d.ts +2 -1
- package/dist/components/button/button.component.d.ts.map +1 -0
- package/dist/components/button/button.stories.d.ts +73 -0
- package/dist/components/button/button.stories.d.ts.map +1 -0
- package/dist/{esm/components → components}/button/index.d.ts +1 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/{cjs/components → components}/card/card.component.d.ts +2 -1
- package/dist/components/card/card.component.d.ts.map +1 -0
- package/dist/components/card/card.stories.d.ts +11 -0
- package/dist/components/card/card.stories.d.ts.map +1 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.d.ts.map +1 -0
- package/dist/{cjs/components → components}/draggable/SortableList/components/DragHandle/dragHandle.component.d.ts +1 -1
- package/dist/components/draggable/SortableList/components/DragHandle/dragHandle.component.d.ts.map +1 -0
- package/dist/{esm/components → components}/draggable/SortableList/components/DragHandle/index.d.ts +1 -0
- package/dist/components/draggable/SortableList/components/DragHandle/index.d.ts.map +1 -0
- package/dist/{esm/components → components}/draggable/SortableList/components/SortableItem/index.d.ts +1 -0
- package/dist/components/draggable/SortableList/components/SortableItem/index.d.ts.map +1 -0
- package/dist/{esm/components → components}/draggable/SortableList/components/SortableItem/sortableItem.component.d.ts +3 -2
- package/dist/components/draggable/SortableList/components/SortableItem/sortableItem.component.d.ts.map +1 -0
- package/dist/{cjs/components → components}/draggable/SortableList/components/SortableItem/sortableItem.context.d.ts +2 -2
- package/dist/components/draggable/SortableList/components/SortableItem/sortableItem.context.d.ts.map +1 -0
- package/dist/{esm/components → components}/draggable/SortableList/components/SortableOverlay/index.d.ts +1 -0
- package/dist/components/draggable/SortableList/components/SortableOverlay/index.d.ts.map +1 -0
- package/dist/{esm/components → components}/draggable/SortableList/components/SortableOverlay/sortableOverlay.component.d.ts +2 -1
- package/dist/components/draggable/SortableList/components/SortableOverlay/sortableOverlay.component.d.ts.map +1 -0
- package/dist/{esm/components → components}/draggable/SortableList/components/index.d.ts +1 -0
- package/dist/components/draggable/SortableList/components/index.d.ts.map +1 -0
- package/dist/{esm/components → components}/draggable/SortableList/index.d.ts +1 -0
- package/dist/components/draggable/SortableList/index.d.ts.map +1 -0
- package/dist/{cjs/components → components}/draggable/SortableList/mockData.d.ts +1 -0
- package/dist/components/draggable/SortableList/mockData.d.ts.map +1 -0
- package/dist/{cjs/components → components}/draggable/SortableList/sortableList.component.d.ts +3 -3
- package/dist/components/draggable/SortableList/sortableList.component.d.ts.map +1 -0
- package/dist/components/draggable/SortableList/sortableList.stories.d.ts +8 -0
- package/dist/components/draggable/SortableList/sortableList.stories.d.ts.map +1 -0
- package/dist/components/draggable/index.d.ts +2 -0
- package/dist/components/draggable/index.d.ts.map +1 -0
- package/dist/{cjs/components → components}/draggable/utilities/createRange.d.ts +1 -0
- package/dist/components/draggable/utilities/createRange.d.ts.map +1 -0
- package/dist/{cjs/components → components}/draggable/utilities/index.d.ts +1 -0
- package/dist/components/draggable/utilities/index.d.ts.map +1 -0
- package/dist/components/forms/index.d.ts +2 -0
- package/dist/components/forms/index.d.ts.map +1 -0
- package/dist/{esm/components → components}/forms/text-input/index.d.ts +1 -0
- package/dist/components/forms/text-input/index.d.ts.map +1 -0
- package/dist/{cjs/components → components}/forms/text-input/text-input.component.d.ts +2 -2
- package/dist/components/forms/text-input/text-input.component.d.ts.map +1 -0
- package/dist/{cjs/components → components}/forms/utils/validations.d.ts +1 -0
- package/dist/components/forms/utils/validations.d.ts.map +1 -0
- package/dist/components/grainy-gradient-background/grainy-gradient-background.component.d.ts +14 -0
- package/dist/components/grainy-gradient-background/grainy-gradient-background.component.d.ts.map +1 -0
- package/dist/components/grainy-gradient-background/grainy-gradient-background.component.stories.d.ts +91 -0
- package/dist/components/grainy-gradient-background/grainy-gradient-background.component.stories.d.ts.map +1 -0
- package/dist/{esm/components → components}/icon-text-row/icon-text-row.component.d.ts +1 -0
- package/dist/components/icon-text-row/icon-text-row.component.d.ts.map +1 -0
- package/dist/components/icon-text-row/icon-text-row.stories.d.ts +11 -0
- package/dist/components/icon-text-row/icon-text-row.stories.d.ts.map +1 -0
- package/dist/{esm/components → components}/icon-text-row/index.d.ts +1 -0
- package/dist/components/icon-text-row/index.d.ts.map +1 -0
- package/dist/{esm/components → components}/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/{esm/components → components}/modal/index.d.ts +1 -0
- package/dist/components/modal/index.d.ts.map +1 -0
- package/dist/{cjs/components → components}/modal/modal-close-button.component.d.ts +1 -0
- package/dist/components/modal/modal-close-button.component.d.ts.map +1 -0
- package/dist/{cjs/components → components}/modal/modal.component.d.ts +3 -2
- package/dist/components/modal/modal.component.d.ts.map +1 -0
- package/dist/components/modal/modal.stories.d.ts +8 -0
- package/dist/components/modal/modal.stories.d.ts.map +1 -0
- package/dist/{esm/components → components}/switch/index.d.ts +1 -0
- package/dist/components/switch/index.d.ts.map +1 -0
- package/dist/{esm/components → components}/switch/switch.component.d.ts +2 -2
- package/dist/components/switch/switch.component.d.ts.map +1 -0
- package/dist/{cjs/components → components}/switch/switch.config.d.ts +1 -0
- package/dist/components/switch/switch.config.d.ts.map +1 -0
- package/dist/components/switch/switch.stories.d.ts +11 -0
- package/dist/components/switch/switch.stories.d.ts.map +1 -0
- package/dist/{esm/core → core}/background/background.component.d.ts +1 -0
- package/dist/core/background/background.component.d.ts.map +1 -0
- package/dist/core/background/background.stories.d.ts +14 -0
- package/dist/core/background/background.stories.d.ts.map +1 -0
- package/dist/{esm/core → core}/background/index.d.ts +1 -0
- package/dist/core/background/index.d.ts.map +1 -0
- package/dist/{cjs/core → core}/border/border.style.d.ts +1 -0
- package/dist/core/border/border.style.d.ts.map +1 -0
- package/dist/core/border/index.d.ts +2 -0
- package/dist/core/border/index.d.ts.map +1 -0
- package/dist/core/container/container.component.d.ts +12 -0
- package/dist/core/container/container.component.d.ts.map +1 -0
- package/dist/{esm/core → core}/container/index.d.ts +1 -0
- package/dist/core/container/index.d.ts.map +1 -0
- package/dist/{esm/core → core}/filter/filter.argTypes.d.ts +1 -0
- package/dist/core/filter/filter.argTypes.d.ts.map +1 -0
- package/dist/{esm/core → core}/filter/filter.component.d.ts +2 -1
- package/dist/core/filter/filter.component.d.ts.map +1 -0
- package/dist/{cjs/core → core}/filter/filter.config.d.ts +1 -0
- package/dist/core/filter/filter.config.d.ts.map +1 -0
- package/dist/{cjs/core → core}/filter/filter.model.d.ts +1 -0
- package/dist/core/filter/filter.model.d.ts.map +1 -0
- package/dist/{cjs/core → core}/filter/filter.style.d.ts +1 -0
- package/dist/core/filter/filter.style.d.ts.map +1 -0
- package/dist/{cjs/core → core}/filter/filter.types.d.ts +1 -0
- package/dist/core/filter/filter.types.d.ts.map +1 -0
- package/dist/{esm/core → core}/filter/index.d.ts +1 -0
- package/dist/core/filter/index.d.ts.map +1 -0
- package/dist/{esm/core → core}/flex/flex.component.d.ts +2 -1
- package/dist/core/flex/flex.component.d.ts.map +1 -0
- package/dist/{cjs/core → core}/flex/flex.style.d.ts +1 -0
- package/dist/core/flex/flex.style.d.ts.map +1 -0
- package/dist/{esm/core → core}/flex/index.d.ts +1 -0
- package/dist/core/flex/index.d.ts.map +1 -0
- package/dist/{esm/core → core}/hooks/index.d.ts +1 -0
- package/dist/core/hooks/index.d.ts.map +1 -0
- package/dist/{cjs/core → core}/hooks/use-media.d.ts +1 -0
- package/dist/core/hooks/use-media.d.ts.map +1 -0
- package/dist/{esm/core → core}/hooks/use-toggle.d.ts +1 -0
- package/dist/core/hooks/use-toggle.d.ts.map +1 -0
- package/dist/{cjs/core → core}/icon/icon.component.d.ts +3 -3
- package/dist/core/icon/icon.component.d.ts.map +1 -0
- package/dist/core/icon/icon.stories.d.ts +16 -0
- package/dist/core/icon/icon.stories.d.ts.map +1 -0
- package/dist/core/icon/index.d.ts +3 -0
- package/dist/core/icon/index.d.ts.map +1 -0
- package/dist/{cjs/core → core}/image/image.argTypes.d.ts +1 -0
- package/dist/core/image/image.argTypes.d.ts.map +1 -0
- package/dist/{cjs/core → core}/image/image.component.d.ts +1 -1
- package/dist/core/image/image.component.d.ts.map +1 -0
- package/dist/{cjs/core → core}/image/image.model.d.ts +1 -0
- package/dist/core/image/image.model.d.ts.map +1 -0
- package/dist/core/image/image.stories.d.ts +201 -0
- package/dist/core/image/image.stories.d.ts.map +1 -0
- package/dist/{esm/core → core}/image/image.style.d.ts +1 -0
- package/dist/core/image/image.style.d.ts.map +1 -0
- package/dist/{esm/core → core}/image/image.types.d.ts +1 -0
- package/dist/core/image/image.types.d.ts.map +1 -0
- package/dist/{esm/core → core}/image/index.d.ts +1 -0
- package/dist/core/image/index.d.ts.map +1 -0
- package/dist/{esm/core → core}/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/{esm/core → core}/layout/index.d.ts +1 -0
- package/dist/core/layout/index.d.ts.map +1 -0
- package/dist/{esm/core → core}/layout/layout.context.d.ts +2 -1
- package/dist/core/layout/layout.context.d.ts.map +1 -0
- package/dist/{cjs/core → core}/layout/layout.hook.d.ts +1 -0
- package/dist/core/layout/layout.hook.d.ts.map +1 -0
- package/dist/core/layout/layout.provider.d.ts +4 -0
- package/dist/core/layout/layout.provider.d.ts.map +1 -0
- package/dist/{esm/core → core}/overlay/index.d.ts +1 -0
- package/dist/core/overlay/index.d.ts.map +1 -0
- package/dist/{cjs/core → core}/overlay/overlay.component.d.ts +1 -1
- package/dist/core/overlay/overlay.component.d.ts.map +1 -0
- package/dist/{esm/core → core}/overlay/overlay.config.d.ts +1 -0
- package/dist/core/overlay/overlay.config.d.ts.map +1 -0
- package/dist/{esm/core → core}/overlay/overlay.model.d.ts +1 -0
- package/dist/core/overlay/overlay.model.d.ts.map +1 -0
- package/dist/core/overlay/overlay.stories.d.ts +132 -0
- package/dist/core/overlay/overlay.stories.d.ts.map +1 -0
- package/dist/core/padding/index.d.ts +2 -0
- package/dist/core/padding/index.d.ts.map +1 -0
- package/dist/{esm/core → core}/padding/padding.style.d.ts +1 -0
- package/dist/core/padding/padding.style.d.ts.map +1 -0
- package/dist/core/shadow/index.d.ts +2 -0
- package/dist/core/shadow/index.d.ts.map +1 -0
- package/dist/{cjs/core → core}/shadow/shadow.style.d.ts +1 -0
- package/dist/core/shadow/shadow.style.d.ts.map +1 -0
- package/dist/core/text/index.d.ts +2 -0
- package/dist/core/text/index.d.ts.map +1 -0
- package/dist/{esm/core → core}/text/text.component.d.ts +3 -2
- package/dist/core/text/text.component.d.ts.map +1 -0
- package/dist/core/text/text.stories.d.ts +134 -0
- package/dist/core/text/text.stories.d.ts.map +1 -0
- package/dist/core/theme/index.d.ts +2 -0
- package/dist/core/theme/index.d.ts.map +1 -0
- package/dist/core/theme/theming.d.ts +11 -0
- package/dist/core/theme/theming.d.ts.map +1 -0
- package/dist/{esm/core → core}/transition/collapse/collapse.component.d.ts +3 -2
- package/dist/core/transition/collapse/collapse.component.d.ts.map +1 -0
- package/dist/{esm/core → core}/transition/collapse/index.d.ts +1 -0
- package/dist/core/transition/collapse/index.d.ts.map +1 -0
- package/dist/{cjs/core → core}/transition/fade/fade.argTypes.d.ts +1 -0
- package/dist/core/transition/fade/fade.argTypes.d.ts.map +1 -0
- package/dist/{cjs/core → core}/transition/fade/fade.component.d.ts +3 -2
- package/dist/core/transition/fade/fade.component.d.ts.map +1 -0
- package/dist/core/transition/fade/fade.stories.d.ts +27 -0
- package/dist/core/transition/fade/fade.stories.d.ts.map +1 -0
- package/dist/core/transition/fade/index.d.ts +2 -0
- package/dist/core/transition/fade/index.d.ts.map +1 -0
- package/dist/{esm/core → core}/transition/index.d.ts +1 -0
- package/dist/core/transition/index.d.ts.map +1 -0
- package/dist/{esm/core → core}/transition/slide/index.d.ts +1 -0
- package/dist/core/transition/slide/index.d.ts.map +1 -0
- package/dist/{esm/core → core}/transition/slide/slide.component.d.ts +3 -2
- package/dist/core/transition/slide/slide.component.d.ts.map +1 -0
- package/dist/core/transition/slide/slide.stories.d.ts +12 -0
- package/dist/core/transition/slide/slide.stories.d.ts.map +1 -0
- package/dist/{cjs/core → core}/transition/transition.argTypes.d.ts +1 -0
- package/dist/core/transition/transition.argTypes.d.ts.map +1 -0
- package/dist/{esm/core → core}/transition/transition.utils.d.ts +2 -1
- package/dist/core/transition/transition.utils.d.ts.map +1 -0
- package/dist/{esm/index.d.ts → index.d.ts} +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13575 -0
- package/dist/{cjs/layouts → layouts}/parallax-hero/parallax-hero.component.d.ts +1 -1
- package/dist/layouts/parallax-hero/parallax-hero.component.d.ts.map +1 -0
- package/dist/{cjs/layouts → layouts}/parallax-hero/parallax-hero.model.d.ts +1 -0
- package/dist/layouts/parallax-hero/parallax-hero.model.d.ts.map +1 -0
- package/dist/stories/Button.d.ts +15 -0
- package/dist/stories/Button.d.ts.map +1 -0
- package/dist/stories/Button.stories.d.ts +24 -0
- package/dist/stories/Button.stories.d.ts.map +1 -0
- package/dist/stories/Header.d.ts +12 -0
- package/dist/stories/Header.d.ts.map +1 -0
- package/dist/stories/Header.stories.d.ts +19 -0
- package/dist/stories/Header.stories.d.ts.map +1 -0
- package/dist/stories/Page.d.ts +3 -0
- package/dist/stories/Page.d.ts.map +1 -0
- package/dist/stories/Page.stories.d.ts +13 -0
- package/dist/stories/Page.stories.d.ts.map +1 -0
- package/dist/{cjs/tools → tools}/color-picker/color-picker.component.d.ts +1 -1
- package/dist/tools/color-picker/color-picker.component.d.ts.map +1 -0
- package/dist/tools/color-picker/color-picker.stories.d.ts +14 -0
- package/dist/tools/color-picker/color-picker.stories.d.ts.map +1 -0
- package/dist/{cjs/tools → tools}/color-swatch/color-swatch.component.d.ts +2 -1
- package/dist/tools/color-swatch/color-swatch.component.d.ts.map +1 -0
- package/dist/{esm/utils → utils}/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/{cjs/utils → utils}/storage-manager.d.ts +1 -0
- package/dist/utils/storage-manager.d.ts.map +1 -0
- package/package.json +51 -59
- package/src/components/button/button.component.tsx +125 -0
- package/src/components/button/button.stories.tsx +79 -0
- package/src/components/card/card.component.tsx +56 -0
- package/src/components/card/card.stories.tsx +22 -0
- package/src/components/draggable/SortableList/components/DragHandle/dragHandle.component.tsx +20 -0
- package/src/components/draggable/SortableList/components/SortableItem/sortableItem.component.tsx +46 -0
- package/src/components/draggable/SortableList/components/SortableItem/sortableItem.context.ts +14 -0
- package/src/components/draggable/SortableList/components/SortableOverlay/sortableOverlay.component.tsx +20 -0
- package/src/components/draggable/SortableList/mockData.ts +50 -0
- package/src/components/draggable/SortableList/sortableList.component.tsx +69 -0
- package/src/components/draggable/SortableList/sortableList.stories.tsx +67 -0
- package/src/components/draggable/utilities/createRange.ts +8 -0
- package/src/components/draggable/utilities/index.ts +1 -0
- package/src/components/forms/text-input/text-input.component.tsx +14 -0
- package/src/components/forms/utils/validations.ts +61 -0
- package/src/components/grainy-gradient-background/grainy-gradient-background.component.stories.tsx +57 -0
- package/src/components/grainy-gradient-background/grainy-gradient-background.component.tsx +68 -0
- package/src/components/icon-text-row/icon-text-row.component.tsx +65 -0
- package/src/components/icon-text-row/icon-text-row.stories.tsx +18 -0
- package/src/components/modal/modal-close-button.component.tsx +13 -0
- package/src/components/modal/modal.component.tsx +43 -0
- package/src/components/modal/modal.stories.tsx +25 -0
- package/src/components/switch/switch.component.tsx +56 -0
- package/src/components/switch/switch.config.ts +24 -0
- package/src/components/switch/switch.stories.tsx +12 -0
- package/src/core/background/background.component.tsx +47 -0
- package/src/core/background/background.stories.tsx +22 -0
- package/src/core/border/border.style.ts +30 -0
- package/src/core/container/container.component.tsx +20 -0
- package/src/core/filter/filter.argTypes.ts +111 -0
- package/src/core/filter/filter.component.tsx +11 -0
- package/src/core/filter/filter.config.ts +68 -0
- package/src/core/filter/filter.model.ts +22 -0
- package/src/core/filter/filter.style.ts +22 -0
- package/src/core/filter/filter.types.ts +12 -0
- package/src/core/flex/flex.component.tsx +91 -0
- package/src/core/flex/flex.style.ts +106 -0
- package/src/core/hooks/use-media.ts +29 -0
- package/src/core/hooks/use-toggle.tsx +23 -0
- package/src/core/icon/icon.component.tsx +19 -0
- package/src/core/icon/icon.stories.tsx +49 -0
- package/src/core/icon/index.ts +2 -0
- package/src/core/image/image.argTypes.ts +23 -0
- package/src/core/image/image.component.tsx +7 -0
- package/{dist/esm/core/image/image.model.d.ts → src/core/image/image.model.ts} +6 -5
- package/src/core/image/image.stories.tsx +22 -0
- package/src/core/image/image.style.ts +19 -0
- package/src/core/layout/layout.context.tsx +14 -0
- package/src/core/layout/layout.hook.tsx +11 -0
- package/src/core/layout/layout.provider.tsx +28 -0
- package/src/core/overlay/overlay.component.tsx +27 -0
- package/src/core/overlay/overlay.config.ts +23 -0
- package/src/core/overlay/overlay.model.ts +13 -0
- package/src/core/overlay/overlay.stories.tsx +73 -0
- package/src/core/padding/padding.style.ts +36 -0
- package/src/core/shadow/shadow.style.ts +5 -0
- package/src/core/text/text.component.tsx +47 -0
- package/src/core/text/text.stories.tsx +84 -0
- package/src/core/theme/index.ts +1 -0
- package/src/core/theme/theming.tsx +29 -0
- package/src/core/transition/collapse/collapse.component.tsx +133 -0
- package/src/core/transition/fade/fade.argTypes.ts +5 -0
- package/src/core/transition/fade/fade.component.tsx +45 -0
- package/src/core/transition/fade/fade.stories.tsx +52 -0
- package/src/core/transition/slide/slide.component.tsx +101 -0
- package/src/core/transition/slide/slide.stories.tsx +38 -0
- package/src/core/transition/transition.argTypes.ts +10 -0
- package/src/core/transition/transition.utils.ts +159 -0
- package/src/layouts/parallax-hero/parallax-hero.component.tsx +25 -0
- package/{dist/esm/layouts/parallax-hero/parallax-hero.model.d.ts → src/layouts/parallax-hero/parallax-hero.model.ts} +7 -5
- package/src/stories/Button.stories.ts +54 -0
- package/src/stories/Button.tsx +37 -0
- package/src/stories/Configure.mdx +388 -0
- package/src/stories/Header.stories.ts +34 -0
- package/src/stories/Header.tsx +56 -0
- package/src/stories/Page.stories.ts +33 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +68 -0
- package/src/tools/color-picker/color-picker.component.tsx +146 -0
- package/src/tools/color-picker/color-picker.stories.tsx +21 -0
- package/src/tools/color-swatch/color-swatch.component.tsx +61 -0
- package/src/utils/storage-manager.ts +48 -0
- package/tsconfig.json +12 -0
- package/vite.config.ts +29 -0
- package/vitest.config.ts +36 -0
- package/vitest.shims.d.ts +1 -0
- package/README.md +0 -22
- package/dist/cjs/components/button/button.component.js +0 -98
- package/dist/cjs/components/button/index.js +0 -17
- package/dist/cjs/components/card/card.component.js +0 -34
- package/dist/cjs/components/card/index.js +0 -17
- package/dist/cjs/components/draggable/SortableList/components/DragHandle/dragHandle.component.js +0 -48
- package/dist/cjs/components/draggable/SortableList/components/DragHandle/index.js +0 -5
- package/dist/cjs/components/draggable/SortableList/components/SortableItem/index.js +0 -5
- package/dist/cjs/components/draggable/SortableList/components/SortableItem/sortableItem.component.d.ts +0 -8
- package/dist/cjs/components/draggable/SortableList/components/SortableItem/sortableItem.component.js +0 -44
- package/dist/cjs/components/draggable/SortableList/components/SortableItem/sortableItem.context.js +0 -9
- package/dist/cjs/components/draggable/SortableList/components/SortableOverlay/index.js +0 -5
- package/dist/cjs/components/draggable/SortableList/components/SortableOverlay/sortableOverlay.component.d.ts +0 -5
- package/dist/cjs/components/draggable/SortableList/components/SortableOverlay/sortableOverlay.component.js +0 -19
- package/dist/cjs/components/draggable/SortableList/components/index.js +0 -9
- package/dist/cjs/components/draggable/SortableList/index.js +0 -18
- package/dist/cjs/components/draggable/SortableList/mockData.js +0 -53
- package/dist/cjs/components/draggable/SortableList/sortableList.component.js +0 -57
- package/dist/cjs/components/draggable/index.js +0 -17
- package/dist/cjs/components/draggable/utilities/createRange.js +0 -8
- package/dist/cjs/components/draggable/utilities/index.js +0 -5
- package/dist/cjs/components/forms/index.js +0 -17
- package/dist/cjs/components/forms/text-input/index.js +0 -17
- package/dist/cjs/components/forms/text-input/text-input.component.js +0 -12
- package/dist/cjs/components/forms/utils/validations.js +0 -55
- package/dist/cjs/components/icon-text-row/icon-text-row.component.d.ts +0 -12
- package/dist/cjs/components/icon-text-row/icon-text-row.component.js +0 -35
- package/dist/cjs/components/icon-text-row/index.js +0 -17
- package/dist/cjs/components/index.js +0 -23
- package/dist/cjs/components/modal/index.js +0 -17
- package/dist/cjs/components/modal/modal-close-button.component.js +0 -30
- package/dist/cjs/components/modal/modal.component.js +0 -22
- package/dist/cjs/components/switch/index.js +0 -17
- package/dist/cjs/components/switch/switch.component.d.ts +0 -8
- package/dist/cjs/components/switch/switch.component.js +0 -65
- package/dist/cjs/components/switch/switch.config.js +0 -25
- package/dist/cjs/core/background/background.component.d.ts +0 -15
- package/dist/cjs/core/background/background.component.js +0 -22
- package/dist/cjs/core/background/index.js +0 -17
- package/dist/cjs/core/border/border.style.js +0 -30
- package/dist/cjs/core/border/index.js +0 -17
- package/dist/cjs/core/container/container.component.d.ts +0 -6
- package/dist/cjs/core/container/container.component.js +0 -22
- package/dist/cjs/core/container/index.js +0 -17
- package/dist/cjs/core/filter/filter.argTypes.d.ts +0 -155
- package/dist/cjs/core/filter/filter.argTypes.js +0 -104
- package/dist/cjs/core/filter/filter.component.d.ts +0 -3
- package/dist/cjs/core/filter/filter.component.js +0 -15
- package/dist/cjs/core/filter/filter.config.js +0 -68
- package/dist/cjs/core/filter/filter.model.js +0 -2
- package/dist/cjs/core/filter/filter.style.js +0 -21
- package/dist/cjs/core/filter/filter.types.js +0 -2
- package/dist/cjs/core/filter/index.js +0 -20
- package/dist/cjs/core/flex/flex.component.d.ts +0 -54
- package/dist/cjs/core/flex/flex.component.js +0 -33
- package/dist/cjs/core/flex/flex.style.js +0 -86
- package/dist/cjs/core/flex/index.js +0 -18
- package/dist/cjs/core/hooks/index.js +0 -18
- package/dist/cjs/core/hooks/use-media.js +0 -29
- package/dist/cjs/core/hooks/use-toggle.d.ts +0 -14
- package/dist/cjs/core/hooks/use-toggle.js +0 -21
- package/dist/cjs/core/icon/icon.component.js +0 -17
- package/dist/cjs/core/icon/index.d.ts +0 -2
- package/dist/cjs/core/icon/index.js +0 -21
- package/dist/cjs/core/image/image.argTypes.js +0 -19
- package/dist/cjs/core/image/image.component.js +0 -24
- package/dist/cjs/core/image/image.model.js +0 -2
- package/dist/cjs/core/image/image.style.d.ts +0 -3
- package/dist/cjs/core/image/image.style.js +0 -22
- package/dist/cjs/core/image/image.types.js +0 -2
- package/dist/cjs/core/image/index.js +0 -18
- package/dist/cjs/core/index.js +0 -30
- package/dist/cjs/core/layout/index.js +0 -18
- package/dist/cjs/core/layout/layout.context.d.ts +0 -7
- package/dist/cjs/core/layout/layout.context.js +0 -11
- package/dist/cjs/core/layout/layout.hook.js +0 -16
- package/dist/cjs/core/layout/layout.provider.d.ts +0 -4
- package/dist/cjs/core/layout/layout.provider.js +0 -25
- package/dist/cjs/core/overlay/index.js +0 -18
- package/dist/cjs/core/overlay/overlay.component.js +0 -17
- package/dist/cjs/core/overlay/overlay.config.d.ts +0 -4
- package/dist/cjs/core/overlay/overlay.config.js +0 -20
- package/dist/cjs/core/overlay/overlay.model.d.ts +0 -12
- package/dist/cjs/core/overlay/overlay.model.js +0 -2
- package/dist/cjs/core/padding/index.js +0 -17
- package/dist/cjs/core/padding/padding.style.d.ts +0 -3
- package/dist/cjs/core/padding/padding.style.js +0 -34
- package/dist/cjs/core/shadow/index.js +0 -17
- package/dist/cjs/core/shadow/shadow.style.js +0 -8
- package/dist/cjs/core/text/index.js +0 -17
- package/dist/cjs/core/text/text.component.d.ts +0 -11
- package/dist/cjs/core/text/text.component.js +0 -30
- package/dist/cjs/core/theme/index.d.ts +0 -9
- package/dist/cjs/core/theme/index.js +0 -7
- package/dist/cjs/core/transition/collapse/collapse.component.d.ts +0 -24
- package/dist/cjs/core/transition/collapse/collapse.component.js +0 -79
- package/dist/cjs/core/transition/collapse/index.js +0 -17
- package/dist/cjs/core/transition/fade/fade.argTypes.js +0 -8
- package/dist/cjs/core/transition/fade/fade.component.js +0 -53
- package/dist/cjs/core/transition/fade/index.js +0 -17
- package/dist/cjs/core/transition/index.js +0 -19
- package/dist/cjs/core/transition/slide/index.js +0 -17
- package/dist/cjs/core/transition/slide/slide.component.d.ts +0 -15
- package/dist/cjs/core/transition/slide/slide.component.js +0 -54
- package/dist/cjs/core/transition/transition.argTypes.js +0 -13
- package/dist/cjs/core/transition/transition.utils.d.ts +0 -245
- package/dist/cjs/core/transition/transition.utils.js +0 -99
- package/dist/cjs/index.js +0 -19
- package/dist/cjs/layouts/parallax-hero/parallax-hero.component.js +0 -15
- package/dist/cjs/layouts/parallax-hero/parallax-hero.model.js +0 -2
- package/dist/cjs/tools/color-picker/color-picker.component.js +0 -138
- package/dist/cjs/tools/color-swatch/color-swatch.component.js +0 -38
- package/dist/cjs/utils/index.js +0 -17
- package/dist/cjs/utils/storage-manager.js +0 -49
- package/dist/esm/components/button/button.component.d.ts +0 -16
- package/dist/esm/components/button/button.component.js +0 -68
- package/dist/esm/components/button/index.js +0 -1
- package/dist/esm/components/card/card.component.d.ts +0 -14
- package/dist/esm/components/card/card.component.js +0 -27
- package/dist/esm/components/card/index.d.ts +0 -1
- package/dist/esm/components/card/index.js +0 -1
- package/dist/esm/components/draggable/SortableList/components/DragHandle/dragHandle.component.d.ts +0 -3
- package/dist/esm/components/draggable/SortableList/components/DragHandle/dragHandle.component.js +0 -21
- package/dist/esm/components/draggable/SortableList/components/DragHandle/index.js +0 -1
- package/dist/esm/components/draggable/SortableList/components/SortableItem/index.js +0 -1
- package/dist/esm/components/draggable/SortableList/components/SortableItem/sortableItem.component.js +0 -17
- package/dist/esm/components/draggable/SortableList/components/SortableItem/sortableItem.context.d.ts +0 -9
- package/dist/esm/components/draggable/SortableList/components/SortableItem/sortableItem.context.js +0 -6
- package/dist/esm/components/draggable/SortableList/components/SortableOverlay/index.js +0 -1
- package/dist/esm/components/draggable/SortableList/components/SortableOverlay/sortableOverlay.component.js +0 -12
- package/dist/esm/components/draggable/SortableList/components/index.js +0 -3
- package/dist/esm/components/draggable/SortableList/index.js +0 -2
- package/dist/esm/components/draggable/SortableList/mockData.d.ts +0 -4
- package/dist/esm/components/draggable/SortableList/mockData.js +0 -50
- package/dist/esm/components/draggable/SortableList/sortableList.component.d.ts +0 -13
- package/dist/esm/components/draggable/SortableList/sortableList.component.js +0 -30
- package/dist/esm/components/draggable/index.d.ts +0 -1
- package/dist/esm/components/draggable/index.js +0 -1
- package/dist/esm/components/draggable/utilities/createRange.d.ts +0 -1
- package/dist/esm/components/draggable/utilities/createRange.js +0 -4
- package/dist/esm/components/draggable/utilities/index.d.ts +0 -1
- package/dist/esm/components/draggable/utilities/index.js +0 -1
- package/dist/esm/components/forms/index.d.ts +0 -1
- package/dist/esm/components/forms/index.js +0 -1
- package/dist/esm/components/forms/text-input/index.js +0 -1
- package/dist/esm/components/forms/text-input/text-input.component.d.ts +0 -6
- package/dist/esm/components/forms/text-input/text-input.component.js +0 -5
- package/dist/esm/components/forms/utils/validations.d.ts +0 -2
- package/dist/esm/components/forms/utils/validations.js +0 -52
- package/dist/esm/components/icon-text-row/icon-text-row.component.js +0 -28
- package/dist/esm/components/icon-text-row/index.js +0 -1
- package/dist/esm/components/index.js +0 -7
- package/dist/esm/components/modal/index.js +0 -1
- package/dist/esm/components/modal/modal-close-button.component.d.ts +0 -3
- package/dist/esm/components/modal/modal-close-button.component.js +0 -23
- package/dist/esm/components/modal/modal.component.d.ts +0 -13
- package/dist/esm/components/modal/modal.component.js +0 -15
- package/dist/esm/components/switch/index.js +0 -1
- package/dist/esm/components/switch/switch.component.js +0 -38
- package/dist/esm/components/switch/switch.config.d.ts +0 -5
- package/dist/esm/components/switch/switch.config.js +0 -22
- package/dist/esm/core/background/background.component.js +0 -15
- package/dist/esm/core/background/index.js +0 -1
- package/dist/esm/core/border/border.style.d.ts +0 -3
- package/dist/esm/core/border/border.style.js +0 -26
- package/dist/esm/core/border/index.d.ts +0 -1
- package/dist/esm/core/border/index.js +0 -1
- package/dist/esm/core/container/container.component.d.ts +0 -6
- package/dist/esm/core/container/container.component.js +0 -16
- package/dist/esm/core/container/index.js +0 -1
- package/dist/esm/core/filter/filter.argTypes.js +0 -101
- package/dist/esm/core/filter/filter.component.js +0 -8
- package/dist/esm/core/filter/filter.config.d.ts +0 -3
- package/dist/esm/core/filter/filter.config.js +0 -65
- package/dist/esm/core/filter/filter.model.d.ts +0 -20
- package/dist/esm/core/filter/filter.model.js +0 -1
- package/dist/esm/core/filter/filter.style.d.ts +0 -3
- package/dist/esm/core/filter/filter.style.js +0 -17
- package/dist/esm/core/filter/filter.types.d.ts +0 -2
- package/dist/esm/core/filter/filter.types.js +0 -1
- package/dist/esm/core/filter/index.js +0 -4
- package/dist/esm/core/flex/flex.component.js +0 -27
- package/dist/esm/core/flex/flex.style.d.ts +0 -28
- package/dist/esm/core/flex/flex.style.js +0 -83
- package/dist/esm/core/flex/index.js +0 -2
- package/dist/esm/core/hooks/index.js +0 -2
- package/dist/esm/core/hooks/use-media.d.ts +0 -1
- package/dist/esm/core/hooks/use-media.js +0 -25
- package/dist/esm/core/hooks/use-toggle.js +0 -17
- package/dist/esm/core/icon/icon.component.d.ts +0 -10
- package/dist/esm/core/icon/icon.component.js +0 -10
- package/dist/esm/core/icon/index.d.ts +0 -2
- package/dist/esm/core/icon/index.js +0 -2
- package/dist/esm/core/image/image.argTypes.d.ts +0 -187
- package/dist/esm/core/image/image.argTypes.js +0 -16
- package/dist/esm/core/image/image.component.d.ts +0 -3
- package/dist/esm/core/image/image.component.js +0 -17
- package/dist/esm/core/image/image.model.js +0 -1
- package/dist/esm/core/image/image.style.js +0 -18
- package/dist/esm/core/image/image.types.js +0 -1
- package/dist/esm/core/image/index.js +0 -2
- package/dist/esm/core/index.js +0 -14
- package/dist/esm/core/layout/index.js +0 -2
- package/dist/esm/core/layout/layout.context.js +0 -6
- package/dist/esm/core/layout/layout.hook.d.ts +0 -2
- package/dist/esm/core/layout/layout.hook.js +0 -9
- package/dist/esm/core/layout/layout.provider.d.ts +0 -4
- package/dist/esm/core/layout/layout.provider.js +0 -18
- package/dist/esm/core/overlay/index.js +0 -2
- package/dist/esm/core/overlay/overlay.component.d.ts +0 -3
- package/dist/esm/core/overlay/overlay.component.js +0 -10
- package/dist/esm/core/overlay/overlay.config.js +0 -16
- package/dist/esm/core/overlay/overlay.model.js +0 -1
- package/dist/esm/core/padding/index.d.ts +0 -1
- package/dist/esm/core/padding/index.js +0 -1
- package/dist/esm/core/padding/padding.style.js +0 -30
- package/dist/esm/core/shadow/index.d.ts +0 -1
- package/dist/esm/core/shadow/index.js +0 -1
- package/dist/esm/core/shadow/shadow.style.d.ts +0 -2
- package/dist/esm/core/shadow/shadow.style.js +0 -4
- package/dist/esm/core/text/index.d.ts +0 -1
- package/dist/esm/core/text/index.js +0 -1
- package/dist/esm/core/text/text.component.js +0 -23
- package/dist/esm/core/theme/index.d.ts +0 -9
- package/dist/esm/core/theme/index.js +0 -3
- package/dist/esm/core/transition/collapse/collapse.component.js +0 -73
- package/dist/esm/core/transition/collapse/index.js +0 -1
- package/dist/esm/core/transition/fade/fade.argTypes.d.ts +0 -5
- package/dist/esm/core/transition/fade/fade.argTypes.js +0 -5
- package/dist/esm/core/transition/fade/fade.component.d.ts +0 -7
- package/dist/esm/core/transition/fade/fade.component.js +0 -47
- package/dist/esm/core/transition/fade/index.d.ts +0 -1
- package/dist/esm/core/transition/fade/index.js +0 -1
- package/dist/esm/core/transition/index.js +0 -3
- package/dist/esm/core/transition/slide/index.js +0 -1
- package/dist/esm/core/transition/slide/slide.component.js +0 -48
- package/dist/esm/core/transition/transition.argTypes.d.ts +0 -19
- package/dist/esm/core/transition/transition.argTypes.js +0 -10
- package/dist/esm/core/transition/transition.utils.js +0 -93
- package/dist/esm/index.js +0 -3
- package/dist/esm/layouts/parallax-hero/parallax-hero.component.d.ts +0 -3
- package/dist/esm/layouts/parallax-hero/parallax-hero.component.js +0 -8
- package/dist/esm/layouts/parallax-hero/parallax-hero.model.js +0 -1
- package/dist/esm/tools/color-picker/color-picker.component.d.ts +0 -8
- package/dist/esm/tools/color-picker/color-picker.component.js +0 -111
- package/dist/esm/tools/color-swatch/color-swatch.component.d.ts +0 -12
- package/dist/esm/tools/color-swatch/color-swatch.component.js +0 -31
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/storage-manager.d.ts +0 -7
- package/dist/esm/utils/storage-manager.js +0 -44
- /package/{dist/cjs/components/button/index.d.ts → src/components/button/index.ts} +0 -0
- /package/{dist/cjs/components/card/index.d.ts → src/components/card/index.ts} +0 -0
- /package/{dist/cjs/components/draggable/SortableList/components/DragHandle/index.d.ts → src/components/draggable/SortableList/components/DragHandle/index.ts} +0 -0
- /package/{dist/cjs/components/draggable/SortableList/components/SortableItem/index.d.ts → src/components/draggable/SortableList/components/SortableItem/index.ts} +0 -0
- /package/{dist/cjs/components/draggable/SortableList/components/SortableOverlay/index.d.ts → src/components/draggable/SortableList/components/SortableOverlay/index.ts} +0 -0
- /package/{dist/cjs/components/draggable/SortableList/components/index.d.ts → src/components/draggable/SortableList/components/index.ts} +0 -0
- /package/{dist/cjs/components/draggable/SortableList/index.d.ts → src/components/draggable/SortableList/index.ts} +0 -0
- /package/{dist/cjs/components/draggable/index.d.ts → src/components/draggable/index.ts} +0 -0
- /package/{dist/cjs/components/forms/index.d.ts → src/components/forms/index.ts} +0 -0
- /package/{dist/cjs/components/forms/text-input/index.d.ts → src/components/forms/text-input/index.ts} +0 -0
- /package/{dist/cjs/components/icon-text-row/index.d.ts → src/components/icon-text-row/index.ts} +0 -0
- /package/{dist/cjs/components/index.d.ts → src/components/index.ts} +0 -0
- /package/{dist/cjs/components/modal/index.d.ts → src/components/modal/index.ts} +0 -0
- /package/{dist/cjs/components/switch/index.d.ts → src/components/switch/index.ts} +0 -0
- /package/{dist/cjs/core/background/index.d.ts → src/core/background/index.ts} +0 -0
- /package/{dist/cjs/core/border/index.d.ts → src/core/border/index.ts} +0 -0
- /package/{dist/cjs/core/container/index.d.ts → src/core/container/index.ts} +0 -0
- /package/{dist/cjs/core/filter/index.d.ts → src/core/filter/index.ts} +0 -0
- /package/{dist/cjs/core/flex/index.d.ts → src/core/flex/index.ts} +0 -0
- /package/{dist/cjs/core/hooks/index.d.ts → src/core/hooks/index.ts} +0 -0
- /package/{dist/cjs/core/image/image.types.d.ts → src/core/image/image.types.ts} +0 -0
- /package/{dist/cjs/core/image/index.d.ts → src/core/image/index.ts} +0 -0
- /package/{dist/cjs/core/index.d.ts → src/core/index.ts} +0 -0
- /package/{dist/cjs/core/layout/index.d.ts → src/core/layout/index.ts} +0 -0
- /package/{dist/cjs/core/overlay/index.d.ts → src/core/overlay/index.ts} +0 -0
- /package/{dist/cjs/core/padding/index.d.ts → src/core/padding/index.ts} +0 -0
- /package/{dist/cjs/core/shadow/index.d.ts → src/core/shadow/index.ts} +0 -0
- /package/{dist/cjs/core/text/index.d.ts → src/core/text/index.ts} +0 -0
- /package/{dist/cjs/core/transition/collapse/index.d.ts → src/core/transition/collapse/index.ts} +0 -0
- /package/{dist/cjs/core/transition/fade/index.d.ts → src/core/transition/fade/index.ts} +0 -0
- /package/{dist/cjs/core/transition/index.d.ts → src/core/transition/index.ts} +0 -0
- /package/{dist/cjs/core/transition/slide/index.d.ts → src/core/transition/slide/index.ts} +0 -0
- /package/{dist/cjs/index.d.ts → src/index.ts} +0 -0
- /package/{dist/cjs/utils/index.d.ts → src/utils/index.ts} +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnimatePresence, HTMLMotionProps, motion, Variants as _Variants } from 'framer-motion';
|
|
3
|
+
import { forwardRef, useEffect, useState } from 'react';
|
|
4
|
+
import { TRANSITION_EASINGS, Variants, withDelay, WithTransitionConfig, cx, warn } from '../transition.utils';
|
|
5
|
+
|
|
6
|
+
const isNumeric = (value?: string | number) => value != null && parseInt(value.toString(), 10) > 0;
|
|
7
|
+
|
|
8
|
+
export interface CollapseOptions {
|
|
9
|
+
/**
|
|
10
|
+
* If `true`, the opacity of the content will be animated
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
animateOpacity?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The height you want the content in its collapsed state.
|
|
16
|
+
* @default 0
|
|
17
|
+
*/
|
|
18
|
+
startingHeight?: number | string;
|
|
19
|
+
/**
|
|
20
|
+
* The height you want the content in its expanded state.
|
|
21
|
+
* @default "auto"
|
|
22
|
+
*/
|
|
23
|
+
endingHeight?: number | string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const defaultTransitions = {
|
|
27
|
+
exit: {
|
|
28
|
+
height: { duration: 0.2, ease: TRANSITION_EASINGS.ease },
|
|
29
|
+
opacity: { duration: 0.3, ease: TRANSITION_EASINGS.ease },
|
|
30
|
+
},
|
|
31
|
+
enter: {
|
|
32
|
+
height: { duration: 0.3, ease: TRANSITION_EASINGS.ease },
|
|
33
|
+
opacity: { duration: 0.4, ease: TRANSITION_EASINGS.ease },
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const variants: Variants<CollapseOptions> = {
|
|
38
|
+
exit: ({ animateOpacity, startingHeight, transition, transitionEnd, delay }) => ({
|
|
39
|
+
...(animateOpacity && { opacity: isNumeric(startingHeight) ? 1 : 0 }),
|
|
40
|
+
height: startingHeight,
|
|
41
|
+
transitionEnd: transitionEnd?.exit as any,
|
|
42
|
+
transition: transition?.exit ?? withDelay.exit(defaultTransitions.exit, delay),
|
|
43
|
+
}),
|
|
44
|
+
enter: ({ animateOpacity, endingHeight, transition, transitionEnd, delay }) => ({
|
|
45
|
+
...(animateOpacity && { opacity: 1 }),
|
|
46
|
+
height: endingHeight,
|
|
47
|
+
transitionEnd: transitionEnd?.enter as any,
|
|
48
|
+
transition: transition?.enter ?? withDelay.enter(defaultTransitions.enter, delay),
|
|
49
|
+
}),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type ICollapse = CollapseProps;
|
|
53
|
+
|
|
54
|
+
export interface CollapseProps extends WithTransitionConfig<HTMLMotionProps<'div'>>, CollapseOptions {}
|
|
55
|
+
|
|
56
|
+
export const Collapse = forwardRef<HTMLDivElement, CollapseProps>((props, ref) => {
|
|
57
|
+
const {
|
|
58
|
+
in: isOpen,
|
|
59
|
+
unmountOnExit,
|
|
60
|
+
animateOpacity = true,
|
|
61
|
+
startingHeight = 0,
|
|
62
|
+
endingHeight = 'auto',
|
|
63
|
+
style,
|
|
64
|
+
className,
|
|
65
|
+
transition,
|
|
66
|
+
transitionEnd,
|
|
67
|
+
...rest
|
|
68
|
+
} = props;
|
|
69
|
+
|
|
70
|
+
const [mounted, setMounted] = useState(false);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const timeout = setTimeout(() => {
|
|
73
|
+
setMounted(true);
|
|
74
|
+
});
|
|
75
|
+
return () => clearTimeout(timeout);
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Warn 🚨: `startingHeight` and `unmountOnExit` are mutually exclusive
|
|
80
|
+
*
|
|
81
|
+
* If you specify a starting height, the collapsed needs to be mounted
|
|
82
|
+
* for the height to take effect.
|
|
83
|
+
*/
|
|
84
|
+
warn({
|
|
85
|
+
condition: Boolean(parseFloat(startingHeight.toString()) > 0 && unmountOnExit),
|
|
86
|
+
message: `startingHeight and unmountOnExit are mutually exclusive. You can't use them together`,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const hasStartingHeight = parseFloat(startingHeight.toString()) > 0;
|
|
90
|
+
|
|
91
|
+
const custom = {
|
|
92
|
+
startingHeight,
|
|
93
|
+
endingHeight,
|
|
94
|
+
animateOpacity,
|
|
95
|
+
transition: !mounted ? { enter: { duration: 0 } } : transition,
|
|
96
|
+
transitionEnd: {
|
|
97
|
+
enter: transitionEnd?.enter,
|
|
98
|
+
exit: unmountOnExit
|
|
99
|
+
? transitionEnd?.exit
|
|
100
|
+
: {
|
|
101
|
+
...transitionEnd?.exit,
|
|
102
|
+
display: hasStartingHeight ? 'block' : 'none',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const show = unmountOnExit ? isOpen : true;
|
|
108
|
+
const animate = isOpen || unmountOnExit ? 'enter' : 'exit';
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<AnimatePresence initial={false} custom={custom}>
|
|
112
|
+
{show && (
|
|
113
|
+
<motion.div
|
|
114
|
+
ref={ref}
|
|
115
|
+
{...rest}
|
|
116
|
+
className={cx('chakra-collapse', className)}
|
|
117
|
+
style={{
|
|
118
|
+
overflow: 'hidden',
|
|
119
|
+
display: 'block',
|
|
120
|
+
...style,
|
|
121
|
+
}}
|
|
122
|
+
custom={custom}
|
|
123
|
+
variants={variants as _Variants}
|
|
124
|
+
initial={unmountOnExit ? 'exit' : false}
|
|
125
|
+
animate={animate}
|
|
126
|
+
exit="exit"
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
</AnimatePresence>
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
Collapse.displayName = 'Collapse';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { AnimatePresence, HTMLMotionProps, motion, Variants as _Variants } from 'framer-motion';
|
|
4
|
+
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
import { TRANSITION_DEFAULTS, Variants, withDelay, WithTransitionConfig } from '../transition.utils';
|
|
7
|
+
|
|
8
|
+
export interface FadeProps extends WithTransitionConfig<HTMLMotionProps<'div'>> {}
|
|
9
|
+
|
|
10
|
+
const variants: Variants = {
|
|
11
|
+
enter: ({ transition, transitionEnd, delay } = {}) => ({
|
|
12
|
+
opacity: 1,
|
|
13
|
+
transition: transition?.enter ?? withDelay.enter(TRANSITION_DEFAULTS.enter, delay),
|
|
14
|
+
transitionEnd: transitionEnd?.enter as any,
|
|
15
|
+
}),
|
|
16
|
+
exit: ({ transition, transitionEnd, delay } = {}) => ({
|
|
17
|
+
opacity: 0,
|
|
18
|
+
transition: transition?.exit ?? withDelay.exit(TRANSITION_DEFAULTS.exit, delay),
|
|
19
|
+
transitionEnd: transitionEnd?.exit as any,
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const fadeConfig: HTMLMotionProps<'div'> = {
|
|
24
|
+
initial: 'exit',
|
|
25
|
+
animate: 'enter',
|
|
26
|
+
exit: 'exit',
|
|
27
|
+
variants: variants as _Variants,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Fade = forwardRef<HTMLDivElement, FadeProps>(function Fade(props, ref) {
|
|
31
|
+
const { unmountOnExit, in: isOpen, className, transition, transitionEnd, delay, ...rest } = props;
|
|
32
|
+
|
|
33
|
+
const animate = isOpen || unmountOnExit ? 'enter' : 'exit';
|
|
34
|
+
const show = unmountOnExit ? isOpen && unmountOnExit : true;
|
|
35
|
+
|
|
36
|
+
const custom = { transition, transitionEnd, delay };
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<AnimatePresence custom={custom}>
|
|
40
|
+
{show && <motion.div ref={ref} className={'fade'} custom={custom} {...fadeConfig} animate={animate} {...rest} />}
|
|
41
|
+
</AnimatePresence>
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
Fade.displayName = 'Fade';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Fade, FadeProps } from './fade.component';
|
|
3
|
+
import { useToggle } from '../../hooks';
|
|
4
|
+
import { Button, Card } from '../../../components';
|
|
5
|
+
import { Text } from '../../text';
|
|
6
|
+
import { fadeArgTypes } from './fade.argTypes';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components / Transition / Fade',
|
|
10
|
+
argTypes: fadeArgTypes,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Example = (props: FadeProps) => {
|
|
14
|
+
const [open, { toggle }] = useToggle(false);
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<Button onClick={toggle}>Toggle Fade</Button>
|
|
18
|
+
<Fade in={open} {...props}>
|
|
19
|
+
<Card cardType="elevated" colorToken="background">
|
|
20
|
+
<Text>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</Text>
|
|
21
|
+
</Card>
|
|
22
|
+
</Fade>
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const BasicFade = (props: FadeProps) => <Example {...props} />;
|
|
28
|
+
const BasicFadeProps: FadeProps = {};
|
|
29
|
+
BasicFade.props = BasicFadeProps;
|
|
30
|
+
|
|
31
|
+
export const FadeWithCustomTransition = (props: FadeProps) => <Example {...props} />;
|
|
32
|
+
const FadeWithCustomTransitionProps: FadeProps = {
|
|
33
|
+
transition: { enter: { duration: 0.3 }, exit: { duration: 0.5 } },
|
|
34
|
+
};
|
|
35
|
+
FadeWithCustomTransition.props = FadeWithCustomTransitionProps;
|
|
36
|
+
|
|
37
|
+
export const FadeWithTransitionEnd = (props: FadeProps) => <Example {...props} />;
|
|
38
|
+
const FadeFadeWithTransitionEndProps: FadeProps = {
|
|
39
|
+
style: { display: 'block' },
|
|
40
|
+
transitionEnd: { exit: { display: 'none' } },
|
|
41
|
+
};
|
|
42
|
+
FadeWithTransitionEnd.props = FadeFadeWithTransitionEndProps;
|
|
43
|
+
|
|
44
|
+
export const FadeWithTransitionDelay = (props: FadeProps) => <Example {...props} />;
|
|
45
|
+
const FadeWithTransitionDelayProps: FadeProps = {
|
|
46
|
+
delay: { enter: 0.2 },
|
|
47
|
+
style: {
|
|
48
|
+
maxWidth: 400,
|
|
49
|
+
paddingTop: 20,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
FadeWithTransitionDelay.props = FadeWithTransitionDelayProps;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnimatePresence, HTMLMotionProps, motion, MotionStyle, Variants as TVariants } from 'framer-motion';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
SlideDirection,
|
|
6
|
+
getSlideTransition,
|
|
7
|
+
TRANSITION_EASINGS,
|
|
8
|
+
Variants,
|
|
9
|
+
withDelay,
|
|
10
|
+
WithTransitionConfig,
|
|
11
|
+
cx,
|
|
12
|
+
} from '../transition.utils';
|
|
13
|
+
|
|
14
|
+
export type { SlideDirection };
|
|
15
|
+
|
|
16
|
+
const defaultTransition = {
|
|
17
|
+
exit: {
|
|
18
|
+
duration: 0.15,
|
|
19
|
+
ease: TRANSITION_EASINGS.easeInOut,
|
|
20
|
+
},
|
|
21
|
+
enter: {
|
|
22
|
+
type: 'spring' as const,
|
|
23
|
+
damping: 25,
|
|
24
|
+
stiffness: 180,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const variants: Variants<SlideOptions> = {
|
|
29
|
+
exit: ({ direction, transition, transitionEnd, delay }) => {
|
|
30
|
+
const { exit: exitStyles } = getSlideTransition({ direction });
|
|
31
|
+
return {
|
|
32
|
+
...exitStyles,
|
|
33
|
+
transition: transition?.exit ?? withDelay.exit(defaultTransition.exit, delay),
|
|
34
|
+
transitionEnd: transitionEnd?.exit as any,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
enter: ({ direction, transitionEnd, transition, delay }) => {
|
|
38
|
+
const { enter: enterStyles } = getSlideTransition({ direction });
|
|
39
|
+
return {
|
|
40
|
+
...enterStyles,
|
|
41
|
+
transition: transition?.enter ?? withDelay.enter(defaultTransition.enter, delay),
|
|
42
|
+
transitionEnd: transitionEnd?.enter as any,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export interface SlideOptions {
|
|
48
|
+
/**
|
|
49
|
+
* The direction to slide from
|
|
50
|
+
* @default "right"
|
|
51
|
+
*/
|
|
52
|
+
direction?: SlideDirection;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface SlideProps extends WithTransitionConfig<HTMLMotionProps<'div'>>, SlideOptions {
|
|
56
|
+
motionProps?: HTMLMotionProps<'div'>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const Slide = forwardRef<HTMLDivElement, SlideProps>(function Slide(props, ref) {
|
|
60
|
+
const {
|
|
61
|
+
direction = 'right',
|
|
62
|
+
style,
|
|
63
|
+
unmountOnExit,
|
|
64
|
+
in: isOpen,
|
|
65
|
+
className,
|
|
66
|
+
transition,
|
|
67
|
+
transitionEnd,
|
|
68
|
+
delay,
|
|
69
|
+
motionProps,
|
|
70
|
+
...rest
|
|
71
|
+
} = props;
|
|
72
|
+
|
|
73
|
+
const transitionStyles = getSlideTransition({ direction });
|
|
74
|
+
const computedStyle: MotionStyle = Object.assign({ position: 'fixed' }, transitionStyles.position, style);
|
|
75
|
+
|
|
76
|
+
const show = unmountOnExit ? isOpen && unmountOnExit : true;
|
|
77
|
+
const animate = isOpen || unmountOnExit ? 'enter' : 'exit';
|
|
78
|
+
|
|
79
|
+
const custom = { transitionEnd, transition, direction, delay };
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<AnimatePresence custom={custom}>
|
|
83
|
+
{show && (
|
|
84
|
+
<motion.div
|
|
85
|
+
{...rest}
|
|
86
|
+
ref={ref}
|
|
87
|
+
initial="exit"
|
|
88
|
+
className={cx('chakra-slide', className)}
|
|
89
|
+
animate={animate}
|
|
90
|
+
exit="exit"
|
|
91
|
+
custom={custom}
|
|
92
|
+
variants={variants as TVariants}
|
|
93
|
+
style={computedStyle}
|
|
94
|
+
{...motionProps}
|
|
95
|
+
/>
|
|
96
|
+
)}
|
|
97
|
+
</AnimatePresence>
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
Slide.displayName = 'Slide';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useToggle } from '../../hooks';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Slide, SlideProps } from './slide.component';
|
|
4
|
+
import { Button, Card } from '../../../components';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components / Transition / Slide',
|
|
8
|
+
component: Slide,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Sidebar = ({ ...args }: SlideProps) => {
|
|
12
|
+
const [open, { toggle }] = useToggle(false);
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<Button onClick={toggle}>Toggle Sidebar</Button>
|
|
16
|
+
<Slide
|
|
17
|
+
style={{
|
|
18
|
+
maxWidth: 400,
|
|
19
|
+
padding: 0,
|
|
20
|
+
}}
|
|
21
|
+
in={open}
|
|
22
|
+
{...args}
|
|
23
|
+
>
|
|
24
|
+
<Card
|
|
25
|
+
colorToken="background"
|
|
26
|
+
borderRadius="none"
|
|
27
|
+
cardType={open ? 'elevated' : undefined}
|
|
28
|
+
elevation="modal"
|
|
29
|
+
height="100%"
|
|
30
|
+
>
|
|
31
|
+
<Button buttonType="icon" iconName="xmarkSolid" onClick={toggle} />
|
|
32
|
+
</Card>
|
|
33
|
+
</Slide>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
Sidebar.args = {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const transitionArgTypes = {
|
|
2
|
+
fadeDuration: {
|
|
3
|
+
control: { type: 'range', min: 0, max: 2, step: 0.01 },
|
|
4
|
+
table: {
|
|
5
|
+
type: { summary: 'number' },
|
|
6
|
+
defaultValue: { summary: '0' },
|
|
7
|
+
},
|
|
8
|
+
description: 'The amount of time (in seconds) for the fade transition to complete.',
|
|
9
|
+
},
|
|
10
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { Target, TargetAndTransition, Transition } from 'framer-motion';
|
|
2
|
+
|
|
3
|
+
export type TransitionProperties = {
|
|
4
|
+
/**
|
|
5
|
+
* Custom `transition` definition for `enter` and `exit`
|
|
6
|
+
*/
|
|
7
|
+
transition?: TransitionConfig;
|
|
8
|
+
/**
|
|
9
|
+
* Custom `transitionEnd` definition for `enter` and `exit`
|
|
10
|
+
*/
|
|
11
|
+
transitionEnd?: TransitionEndConfig;
|
|
12
|
+
/**
|
|
13
|
+
* Custom `delay` definition for `enter` and `exit`
|
|
14
|
+
*/
|
|
15
|
+
delay?: number | DelayConfig;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type TargetResolver<P = {}> = (props: P & TransitionProperties) => TargetAndTransition;
|
|
19
|
+
|
|
20
|
+
type Variant<P = {}> = TargetAndTransition | TargetResolver<P>;
|
|
21
|
+
|
|
22
|
+
export type Variants<P = {}> = {
|
|
23
|
+
enter: Variant<P>;
|
|
24
|
+
exit: Variant<P>;
|
|
25
|
+
initial?: Variant<P>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type WithMotionState<P> = Partial<Record<'enter' | 'exit', P>>;
|
|
29
|
+
|
|
30
|
+
export type TransitionConfig = WithMotionState<Transition>;
|
|
31
|
+
|
|
32
|
+
export type TransitionEndConfig = WithMotionState<Target>;
|
|
33
|
+
|
|
34
|
+
export type DelayConfig = WithMotionState<number>;
|
|
35
|
+
|
|
36
|
+
export const TRANSITION_EASINGS = {
|
|
37
|
+
ease: [0.25, 0.1, 0.25, 1],
|
|
38
|
+
easeIn: [0.4, 0, 1, 1],
|
|
39
|
+
easeOut: [0, 0, 0.2, 1],
|
|
40
|
+
easeInOut: [0.4, 0, 0.2, 1],
|
|
41
|
+
} as const;
|
|
42
|
+
|
|
43
|
+
export const TRANSITION_VARIANTS = {
|
|
44
|
+
scale: {
|
|
45
|
+
enter: { scale: 1 },
|
|
46
|
+
exit: { scale: 0.95 },
|
|
47
|
+
},
|
|
48
|
+
fade: {
|
|
49
|
+
enter: { opacity: 1 },
|
|
50
|
+
exit: { opacity: 0 },
|
|
51
|
+
},
|
|
52
|
+
pushLeft: {
|
|
53
|
+
enter: { x: '100%' },
|
|
54
|
+
exit: { x: '-30%' },
|
|
55
|
+
},
|
|
56
|
+
pushRight: {
|
|
57
|
+
enter: { x: '-100%' },
|
|
58
|
+
exit: { x: '30%' },
|
|
59
|
+
},
|
|
60
|
+
pushUp: {
|
|
61
|
+
enter: { y: '100%' },
|
|
62
|
+
exit: { y: '-30%' },
|
|
63
|
+
},
|
|
64
|
+
pushDown: {
|
|
65
|
+
enter: { y: '-100%' },
|
|
66
|
+
exit: { y: '30%' },
|
|
67
|
+
},
|
|
68
|
+
slideLeft: {
|
|
69
|
+
position: { left: 0, top: 0, bottom: 0, width: '100%' },
|
|
70
|
+
enter: { x: 0, y: 0 },
|
|
71
|
+
exit: { x: '-100%', y: 0 },
|
|
72
|
+
},
|
|
73
|
+
slideRight: {
|
|
74
|
+
position: { right: 0, top: 0, bottom: 0, width: '100%' },
|
|
75
|
+
enter: { x: 0, y: 0 },
|
|
76
|
+
exit: { x: '100%', y: 0 },
|
|
77
|
+
},
|
|
78
|
+
slideUp: {
|
|
79
|
+
position: { top: 0, left: 0, right: 0, maxWidth: '100vw' },
|
|
80
|
+
enter: { x: 0, y: 0 },
|
|
81
|
+
exit: { x: 0, y: '-100%' },
|
|
82
|
+
},
|
|
83
|
+
slideDown: {
|
|
84
|
+
position: { bottom: 0, left: 0, right: 0, maxWidth: '100vw' },
|
|
85
|
+
enter: { x: 0, y: 0 },
|
|
86
|
+
exit: { x: 0, y: '100%' },
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type SlideDirection = 'top' | 'left' | 'bottom' | 'right';
|
|
91
|
+
|
|
92
|
+
export function getSlideTransition(options?: { direction?: SlideDirection }) {
|
|
93
|
+
const side = options?.direction ?? 'right';
|
|
94
|
+
switch (side) {
|
|
95
|
+
case 'right':
|
|
96
|
+
return TRANSITION_VARIANTS.slideRight;
|
|
97
|
+
case 'left':
|
|
98
|
+
return TRANSITION_VARIANTS.slideLeft;
|
|
99
|
+
case 'bottom':
|
|
100
|
+
return TRANSITION_VARIANTS.slideDown;
|
|
101
|
+
case 'top':
|
|
102
|
+
return TRANSITION_VARIANTS.slideUp;
|
|
103
|
+
default:
|
|
104
|
+
return TRANSITION_VARIANTS.slideRight;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const TRANSITION_DEFAULTS = {
|
|
109
|
+
enter: {
|
|
110
|
+
duration: 0.2,
|
|
111
|
+
ease: TRANSITION_EASINGS.easeOut,
|
|
112
|
+
},
|
|
113
|
+
exit: {
|
|
114
|
+
duration: 0.1,
|
|
115
|
+
ease: TRANSITION_EASINGS.easeIn,
|
|
116
|
+
},
|
|
117
|
+
} as const;
|
|
118
|
+
|
|
119
|
+
export type WithTransitionConfig<P extends object> = Omit<P, 'transition'> &
|
|
120
|
+
TransitionProperties & {
|
|
121
|
+
/**
|
|
122
|
+
* If `true`, the element will unmount when `in={false}` and animation is done
|
|
123
|
+
*/
|
|
124
|
+
unmountOnExit?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Show the component; triggers when enter or exit states
|
|
127
|
+
*/
|
|
128
|
+
in?: boolean;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const withDelay = {
|
|
132
|
+
enter: (transition: Transition, delay?: number | DelayConfig): Transition & { delay: number | undefined } => ({
|
|
133
|
+
...transition,
|
|
134
|
+
delay: typeof delay === 'number' ? delay : delay?.['enter'],
|
|
135
|
+
}),
|
|
136
|
+
exit: (transition: Transition, delay?: number | DelayConfig): Transition & { delay: number | undefined } => ({
|
|
137
|
+
...transition,
|
|
138
|
+
delay: typeof delay === 'number' ? delay : delay?.['exit'],
|
|
139
|
+
}),
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// chakra-ui/packages/utilities/shared-utils
|
|
143
|
+
export const cx = (...classNames: any[]) => classNames.filter(Boolean).join(' ');
|
|
144
|
+
|
|
145
|
+
function isDev() {
|
|
146
|
+
return process.env.NODE_ENV !== 'production';
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
type MessageOptions = {
|
|
150
|
+
condition: boolean;
|
|
151
|
+
message: string;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const warn = (options: MessageOptions) => {
|
|
155
|
+
const { condition, message } = options;
|
|
156
|
+
if (condition && isDev()) {
|
|
157
|
+
console.warn(message);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ParallaxHeroProps } from './parallax-hero.model';
|
|
3
|
+
|
|
4
|
+
export const ParallaxHero = ({ layers, children }: ParallaxHeroProps): JSX.Element => {
|
|
5
|
+
return (
|
|
6
|
+
<div>
|
|
7
|
+
<div id="hero">
|
|
8
|
+
{layers.map((layer) => (
|
|
9
|
+
<div
|
|
10
|
+
className={layer.name + 'layer'}
|
|
11
|
+
data-depth={layer.depth}
|
|
12
|
+
data-type="parallax"
|
|
13
|
+
style={{ backgroundImage: layer.src }}
|
|
14
|
+
/>
|
|
15
|
+
))}
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div id="static-hero">
|
|
19
|
+
<div className="static-hero-image" />
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div>{children}</div>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
|
|
2
3
|
export interface ImageLayer {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
name: string;
|
|
5
|
+
src: string;
|
|
6
|
+
depth: number;
|
|
6
7
|
}
|
|
8
|
+
|
|
7
9
|
export interface ParallaxHeroProps {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
layers: ImageLayer[];
|
|
11
|
+
children: ReactNode;
|
|
10
12
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { fn } from 'storybook/test';
|
|
4
|
+
|
|
5
|
+
import { Button } from './Button';
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Example/Button',
|
|
10
|
+
component: Button,
|
|
11
|
+
parameters: {
|
|
12
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
13
|
+
layout: 'centered',
|
|
14
|
+
},
|
|
15
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
18
|
+
argTypes: {
|
|
19
|
+
backgroundColor: { control: 'color' },
|
|
20
|
+
},
|
|
21
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#story-args
|
|
22
|
+
args: { onClick: fn() },
|
|
23
|
+
} satisfies Meta<typeof Button>;
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
|
|
28
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
29
|
+
export const Primary: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
primary: true,
|
|
32
|
+
label: 'Button',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Secondary: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
label: 'Button',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Large: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
size: 'large',
|
|
45
|
+
label: 'Button',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Small: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
size: 'small',
|
|
52
|
+
label: 'Button',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import './button.css';
|
|
4
|
+
|
|
5
|
+
export interface ButtonProps {
|
|
6
|
+
/** Is this the principal call to action on the page? */
|
|
7
|
+
primary?: boolean;
|
|
8
|
+
/** What background color to use */
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
/** How large should the button be? */
|
|
11
|
+
size?: 'small' | 'medium' | 'large';
|
|
12
|
+
/** Button contents */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Optional click handler */
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Primary UI component for user interaction */
|
|
19
|
+
export const Button = ({
|
|
20
|
+
primary = false,
|
|
21
|
+
size = 'medium',
|
|
22
|
+
backgroundColor,
|
|
23
|
+
label,
|
|
24
|
+
...props
|
|
25
|
+
}: ButtonProps) => {
|
|
26
|
+
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
27
|
+
return (
|
|
28
|
+
<button
|
|
29
|
+
type="button"
|
|
30
|
+
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
|
31
|
+
style={{ backgroundColor }}
|
|
32
|
+
{...props}
|
|
33
|
+
>
|
|
34
|
+
{label}
|
|
35
|
+
</button>
|
|
36
|
+
);
|
|
37
|
+
};
|