@tripie-pyotato/design-system 0.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/.turbo/turbo-build.log +4 -0
- package/.turbo/turbo-lint$colon$fix.log +22 -0
- package/.turbo/turbo-lint.log +18 -0
- package/.turbo/turbo-test.log +152 -0
- package/.turbo/turbo-typecheck.log +5 -0
- package/coverage/clover.xml +1651 -0
- package/coverage/coverage-final.json +57 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/dist/button.js.html +112 -0
- package/coverage/lcov-report/dist/common.js.html +127 -0
- package/coverage/lcov-report/dist/components/body/_body.js.html +157 -0
- package/coverage/lcov-report/dist/components/body/_body.stories.js.html +193 -0
- package/coverage/lcov-report/dist/components/body/index.html +146 -0
- package/coverage/lcov-report/dist/components/body/index.js.html +109 -0
- package/coverage/lcov-report/dist/components/index.html +116 -0
- package/coverage/lcov-report/dist/components/index.js.html +127 -0
- package/coverage/lcov-report/dist/components/myButton/index.html +161 -0
- package/coverage/lcov-report/dist/components/myButton/index.js.html +154 -0
- package/coverage/lcov-report/dist/components/myButton/my-button.js.html +109 -0
- package/coverage/lcov-report/dist/components/myButton/myButton.js.html +133 -0
- package/coverage/lcov-report/dist/components/myButton/myButton.stories.js.html +181 -0
- package/coverage/lcov-report/dist/components/typography/_typography.js.html +190 -0
- package/coverage/lcov-report/dist/components/typography/_typography.stories.js.html +352 -0
- package/coverage/lcov-report/dist/components/typography/index.html +146 -0
- package/coverage/lcov-report/dist/components/typography/index.js.html +154 -0
- package/coverage/lcov-report/dist/components/typography/text/_text.js.html +139 -0
- package/coverage/lcov-report/dist/components/typography/text/_text.stories.js.html +259 -0
- package/coverage/lcov-report/dist/components/typography/text/index.html +146 -0
- package/coverage/lcov-report/dist/components/typography/text/index.js.html +160 -0
- package/coverage/lcov-report/dist/fonts/index.html +116 -0
- package/coverage/lcov-report/dist/fonts/index.js.html +154 -0
- package/coverage/lcov-report/dist/hooks/index.html +131 -0
- package/coverage/lcov-report/dist/hooks/index.js.html +136 -0
- package/coverage/lcov-report/dist/hooks/useAppTheme.js.html +202 -0
- package/coverage/lcov-report/dist/index.html +161 -0
- package/coverage/lcov-report/dist/index.js.html +139 -0
- package/coverage/lcov-report/dist/my-button.js.html +109 -0
- package/coverage/lcov-report/dist/myButton/Button.stories.js.html +229 -0
- package/coverage/lcov-report/dist/myButton/index.html +161 -0
- package/coverage/lcov-report/dist/myButton/index.js.html +154 -0
- package/coverage/lcov-report/dist/myButton/myButton.js.html +133 -0
- package/coverage/lcov-report/dist/myButton/myButton.stories.js.html +181 -0
- package/coverage/lcov-report/dist/text/index.html +176 -0
- package/coverage/lcov-report/dist/text/index.js.html +139 -0
- package/coverage/lcov-report/dist/text/text.js.html +151 -0
- package/coverage/lcov-report/dist/text/text.stories.js.html +232 -0
- package/coverage/lcov-report/dist/text/typography.js.html +160 -0
- package/coverage/lcov-report/dist/text/typography.stories.js.html +166 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +431 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/components/body/_body.stories.tsx.html +196 -0
- package/coverage/lcov-report/src/components/body/_body.tsx.html +163 -0
- package/coverage/lcov-report/src/components/body/index.html +146 -0
- package/coverage/lcov-report/src/components/body/index.ts.html +88 -0
- package/coverage/lcov-report/src/components/index.html +116 -0
- package/coverage/lcov-report/src/components/index.ts.html +97 -0
- package/coverage/lcov-report/src/components/myButton/index.html +161 -0
- package/coverage/lcov-report/src/components/myButton/index.ts.html +91 -0
- package/coverage/lcov-report/src/components/myButton/my-button.tsx.html +109 -0
- package/coverage/lcov-report/src/components/myButton/myButton.stories.tsx.html +220 -0
- package/coverage/lcov-report/src/components/myButton/myButton.tsx.html +160 -0
- package/coverage/lcov-report/src/components/typography/font/_font.tsx.html +127 -0
- package/coverage/lcov-report/src/components/typography/font/index.html +131 -0
- package/coverage/lcov-report/src/components/typography/font/index.ts.html +91 -0
- package/coverage/lcov-report/src/components/typography/headings/_headings.stories.tsx.html +361 -0
- package/coverage/lcov-report/src/components/typography/headings/_headings.tsx.html +211 -0
- package/coverage/lcov-report/src/components/typography/headings/index.html +146 -0
- package/coverage/lcov-report/src/components/typography/headings/index.ts.html +91 -0
- package/coverage/lcov-report/src/components/typography/index.html +116 -0
- package/coverage/lcov-report/src/components/typography/index.ts.html +91 -0
- package/coverage/lcov-report/src/components/typography/link/_link.stories.tsx.html +268 -0
- package/coverage/lcov-report/src/components/typography/link/_link.tsx.html +199 -0
- package/coverage/lcov-report/src/components/typography/link/index.html +146 -0
- package/coverage/lcov-report/src/components/typography/link/index.ts.html +91 -0
- package/coverage/lcov-report/src/components/typography/paragraph/_paragraph.stories.tsx.html +229 -0
- package/coverage/lcov-report/src/components/typography/paragraph/_paragraph.tsx.html +124 -0
- package/coverage/lcov-report/src/components/typography/paragraph/index.html +131 -0
- package/coverage/lcov-report/src/components/typography/text/_text.stories.tsx.html +184 -0
- package/coverage/lcov-report/src/components/typography/text/_text.tsx.html +196 -0
- package/coverage/lcov-report/src/components/typography/text/index.html +146 -0
- package/coverage/lcov-report/src/components/typography/text/index.ts.html +91 -0
- package/coverage/lcov-report/src/hooks/index.html +131 -0
- package/coverage/lcov-report/src/hooks/index.ts.html +88 -0
- package/coverage/lcov-report/src/hooks/useAppTheme.ts.html +220 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/src/index.ts.html +91 -0
- package/coverage/lcov-report/turbo/generators/config.ts.html +175 -0
- package/coverage/lcov-report/turbo/generators/index.html +116 -0
- package/coverage/lcov.info +2087 -0
- package/dist/button.d.ts +7 -0
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +9 -0
- package/dist/common.d.ts +12 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +14 -0
- package/dist/components/body/_body.d.ts +8 -0
- package/dist/components/body/_body.d.ts.map +1 -0
- package/dist/components/body/_body.js +24 -0
- package/dist/components/body/_body.stories.d.ts +7 -0
- package/dist/components/body/_body.stories.d.ts.map +1 -0
- package/dist/components/body/_body.stories.js +36 -0
- package/dist/components/body/index.d.ts +2 -0
- package/dist/components/body/index.d.ts.map +1 -0
- package/dist/components/body/index.js +8 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +14 -0
- package/dist/components/myButton/index.d.ts +3 -0
- package/dist/components/myButton/index.d.ts.map +1 -0
- package/dist/components/myButton/index.js +23 -0
- package/dist/components/myButton/my-button.d.ts +4 -0
- package/dist/components/myButton/my-button.d.ts.map +1 -0
- package/dist/components/myButton/my-button.js +8 -0
- package/dist/components/myButton/myButton.d.ts +7 -0
- package/dist/components/myButton/myButton.d.ts.map +1 -0
- package/dist/components/myButton/myButton.js +16 -0
- package/dist/components/myButton/myButton.stories.d.ts +7 -0
- package/dist/components/myButton/myButton.stories.d.ts.map +1 -0
- package/dist/components/myButton/myButton.stories.js +32 -0
- package/dist/components/typography/_typography.d.ts +23 -0
- package/dist/components/typography/_typography.d.ts.map +1 -0
- package/dist/components/typography/_typography.js +35 -0
- package/dist/components/typography/_typography.stories.d.ts +13 -0
- package/dist/components/typography/_typography.stories.d.ts.map +1 -0
- package/dist/components/typography/_typography.stories.js +89 -0
- package/dist/components/typography/index.d.ts +3 -0
- package/dist/components/typography/index.d.ts.map +1 -0
- package/dist/components/typography/index.js +23 -0
- package/dist/components/typography/text/_text.d.ts +19 -0
- package/dist/components/typography/text/_text.d.ts.map +1 -0
- package/dist/components/typography/text/_text.js +18 -0
- package/dist/components/typography/text/_text.stories.d.ts +10 -0
- package/dist/components/typography/text/_text.stories.d.ts.map +1 -0
- package/dist/components/typography/text/_text.stories.js +58 -0
- package/dist/components/typography/text/index.d.ts +3 -0
- package/dist/components/typography/text/index.d.ts.map +1 -0
- package/dist/components/typography/text/index.js +25 -0
- package/dist/fonts/index.d.ts +3 -0
- package/dist/fonts/index.d.ts.map +1 -0
- package/dist/fonts/index.js +23 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +17 -0
- package/dist/hooks/useAppTheme.d.ts +21 -0
- package/dist/hooks/useAppTheme.d.ts.map +1 -0
- package/dist/hooks/useAppTheme.js +39 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/my-button.d.ts +4 -0
- package/dist/my-button.d.ts.map +1 -0
- package/dist/my-button.js +8 -0
- package/dist/myButton/Button.stories.d.ts +8 -0
- package/dist/myButton/Button.stories.d.ts.map +1 -0
- package/dist/myButton/Button.stories.js +48 -0
- package/dist/myButton/index.d.ts +3 -0
- package/dist/myButton/index.d.ts.map +1 -0
- package/dist/myButton/index.js +23 -0
- package/dist/myButton/myButton.d.ts +7 -0
- package/dist/myButton/myButton.d.ts.map +1 -0
- package/dist/myButton/myButton.js +16 -0
- package/dist/myButton/myButton.stories.d.ts +7 -0
- package/dist/myButton/myButton.stories.d.ts.map +1 -0
- package/dist/myButton/myButton.stories.js +32 -0
- package/dist/src/components/Accordian/Accordian.jsx +61 -0
- package/dist/src/components/Accordian/accordian.stories.jsx +76 -0
- package/dist/src/components/Accordian/index.js +21 -0
- package/dist/src/components/Accordian/variants.js +46 -0
- package/dist/src/components/Carousel/Carousel.jsx +84 -0
- package/dist/src/components/Carousel/Carousel.spec.jsx +203 -0
- package/dist/src/components/Carousel/carousel.stories.jsx +56 -0
- package/dist/src/components/Carousel/images.js +40 -0
- package/dist/src/components/Carousel/index.js +20 -0
- package/dist/src/components/Chip/Chip.jsx +27 -0
- package/dist/src/components/Chip/Chip.spec.jsx +103 -0
- package/dist/src/components/Chip/chip.stories.jsx +61 -0
- package/dist/src/components/Chip/index.js +20 -0
- package/dist/src/components/ChipMarker/ChipMarker.jsx +17 -0
- package/dist/src/components/ChipMarker/chip.stories.jsx +42 -0
- package/dist/src/components/ChipMarker/index.js +20 -0
- package/dist/src/components/Divider/Divider.jsx +21 -0
- package/dist/src/components/Divider/constants.js +10 -0
- package/dist/src/components/Divider/divider.stories.jsx +72 -0
- package/dist/src/components/Divider/index.js +20 -0
- package/dist/src/components/Headings/Headings.jsx +37 -0
- package/dist/src/components/Headings/headings.stories.jsx +83 -0
- package/dist/src/components/Headings/index.js +20 -0
- package/dist/src/components/Link/Link.jsx +26 -0
- package/dist/src/components/Link/List.spec.jsx +22 -0
- package/dist/src/components/Link/index.js +20 -0
- package/dist/src/components/Link/link.stories.jsx +53 -0
- package/dist/src/components/List/List.jsx +29 -0
- package/dist/src/components/List/list-item.stories.jsx +81 -0
- package/dist/src/components/List/list.stories.jsx +45 -0
- package/dist/src/components/List/variants.js +24 -0
- package/dist/src/components/MotionSlideUp/MotionSlideUp.jsx +20 -0
- package/dist/src/components/MotionSlideUp/index.js +20 -0
- package/dist/src/components/Particle/Background/ParticleBackground.jsx +16 -0
- package/dist/src/components/Particle/Background/index.js +20 -0
- package/dist/src/components/Particle/Background/particle-background.stories.jsx +29 -0
- package/dist/src/components/Particle/Field/ParticleField.jsx +17 -0
- package/dist/src/components/Particle/Field/index.js +20 -0
- package/dist/src/components/Particle/Field/particle-field.stories.jsx +31 -0
- package/dist/src/components/Particle/Particles/Particles.jsx +15 -0
- package/dist/src/components/RotatingBlur/RotatingBlur.jsx +19 -0
- package/dist/src/components/RotatingBlur/index.js +20 -0
- package/dist/src/components/RotatingBlur/rotating-blur.stories.jsx +38 -0
- package/dist/src/components/SplashScreen/SplashScreen.jsx +22 -0
- package/dist/src/components/SplashScreen/index.js +20 -0
- package/dist/src/components/SplashScreen/splash-screen.stories.jsx +44 -0
- package/dist/src/components/Switch/Switch.jsx +18 -0
- package/dist/src/components/Switch/index.js +20 -0
- package/dist/src/components/Switch/switch.stories.jsx +31 -0
- package/dist/src/components/Switch/variants.js +35 -0
- package/dist/src/components/Text/Text.jsx +72 -0
- package/dist/src/components/Text/index.js +20 -0
- package/dist/src/components/Text/text.stories.jsx +44 -0
- package/dist/src/components/Text/variants.js +40 -0
- package/dist/src/components/TextFill/TextFillAnimation.jsx +51 -0
- package/dist/src/components/TextFill/index.js +20 -0
- package/dist/src/components/TextFill/text-fill-animation.stories.jsx +51 -0
- package/dist/src/components/TextUnderlineAnimation/TextUnderlineAnimation.jsx +16 -0
- package/dist/src/components/TextUnderlineAnimation/index.js +20 -0
- package/dist/src/components/TextUnderlineAnimation/text-underline-animation.stories.jsx +34 -0
- package/dist/src/components/TextUnderlineAnimation/variants.js +24 -0
- package/dist/src/components/TripieButton/Animated/AnimateButton.spec.jsx +106 -0
- package/dist/src/components/TripieButton/Animated/AnimatedButton.jsx +16 -0
- package/dist/src/components/TripieButton/Animated/animated-button.stories.jsx +58 -0
- package/dist/src/components/TripieButton/Animated/index.js +20 -0
- package/dist/src/components/TripieButton/Animated/variants.js +15 -0
- package/dist/src/components/TripieButton/MenuToggle/MenuItem/index.jsx +15 -0
- package/dist/src/components/TripieButton/MenuToggle/MenuItem/menu-item.stories.jsx +36 -0
- package/dist/src/components/TripieButton/MenuToggle/MenuItem/variants.js +19 -0
- package/dist/src/components/TripieButton/MenuToggle/MenuList/index.jsx +15 -0
- package/dist/src/components/TripieButton/MenuToggle/MenuList/menu-list.stories.jsx +41 -0
- package/dist/src/components/TripieButton/MenuToggle/MenuList/variants.js +15 -0
- package/dist/src/components/TripieButton/MenuToggle/MenuToggle.jsx +45 -0
- package/dist/src/components/TripieButton/MenuToggle/index.js +20 -0
- package/dist/src/components/TripieButton/MenuToggle/menu-toggle.stories.jsx +55 -0
- package/dist/src/components/TripieButton/NoStyle/NoStyleButton.jsx +12 -0
- package/dist/src/components/TripieButton/NoStyle/NoStyleButton.spec.jsx +87 -0
- package/dist/src/components/TripieButton/NoStyle/index.js +20 -0
- package/dist/src/components/TripieButton/NoStyle/no-style-button.stories.jsx +29 -0
- package/dist/src/components/TripieCard/Card.jsx +57 -0
- package/dist/src/components/TripieCard/card.stories.jsx +45 -0
- package/dist/src/components/TripieCard/index.js +20 -0
- package/dist/src/components/TripieContainer/TripieContainer.jsx +23 -0
- package/dist/src/components/TripieContainer/index.js +20 -0
- package/dist/src/components/TripieContainer/tripie-container.stories.jsx +70 -0
- package/dist/src/components/TripieIcon/Icon.jsx +84 -0
- package/dist/src/components/TripieIcon/icon-transport.stories.jsx +89 -0
- package/dist/src/components/TripieIcon/icon.stories.jsx +68 -0
- package/dist/src/components/TripieIcon/index.js +20 -0
- package/dist/src/components/TripieIcon/variants.js +172 -0
- package/dist/src/components/TripieImage/TripieImage.jsx +25 -0
- package/dist/src/components/TripieImage/index.js +20 -0
- package/dist/src/components/TripieImage/tripie-image.stories.jsx +86 -0
- package/dist/src/components/TripieSkeleton/Skeleton.jsx +30 -0
- package/dist/src/components/TripieSkeleton/index.js +20 -0
- package/dist/src/components/TripieSkeleton/skeleton.stories.jsx +28 -0
- package/dist/src/components/index.js +54 -0
- package/dist/src/font.js +12 -0
- package/dist/src/hooks/index.js +19 -0
- package/dist/src/hooks/useAppTheme.js +33 -0
- package/dist/src/hooks/useCycle.js +32 -0
- package/dist/src/hooks/useDrawer.js +21 -0
- package/dist/src/index.js +19 -0
- package/dist/src/shared/colors.js +20 -0
- package/dist/src/shared/index.js +19 -0
- package/dist/src/shared/resource.js +26 -0
- package/dist/src/shared/variants.js +66 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.d.ts.map +1 -0
- package/dist/text/index.js +18 -0
- package/dist/text/text.d.ts +47 -0
- package/dist/text/text.d.ts.map +1 -0
- package/dist/text/text.js +22 -0
- package/dist/text/text.stories.d.ts +10 -0
- package/dist/text/text.stories.d.ts.map +1 -0
- package/dist/text/text.stories.js +49 -0
- package/dist/text/typography.d.ts +18 -0
- package/dist/text/typography.d.ts.map +1 -0
- package/dist/text/typography.js +25 -0
- package/dist/text/typography.stories.d.ts +7 -0
- package/dist/text/typography.stories.d.ts.map +1 -0
- package/dist/text/typography.stories.js +27 -0
- package/dist/turbo/generators/config.js +30 -0
- package/jest.config.cjs +21 -0
- package/jest.setup.cjs +4 -0
- package/package.json +80 -0
- package/setupTests.mjs +39 -0
- package/src/base/_breakpoint.scss +15 -0
- package/src/base/_colors.scss +98 -0
- package/src/base/_config.scss +33 -0
- package/src/base/_font-size.scss +17 -0
- package/src/base/_font-stack.scss +27 -0
- package/src/base/_font-weight.scss +23 -0
- package/src/base/_letter-spacing.scss +12 -0
- package/src/base/_line-height.scss +12 -0
- package/src/base/_motion.scss +35 -0
- package/src/base/_shape.scss +19 -0
- package/src/base/_space.scss +58 -0
- package/src/base/_theme.scss +97 -0
- package/src/base/_z-index.scss +44 -0
- package/src/base/index.scss +13 -0
- package/src/components/Accordian/Accordian.tsx +72 -0
- package/src/components/Accordian/accordian.module.scss +18 -0
- package/src/components/Accordian/accordian.stories.tsx +86 -0
- package/src/components/Accordian/index.ts +3 -0
- package/src/components/Accordian/variants.ts +45 -0
- package/src/components/Carousel/Carousel.spec.tsx +239 -0
- package/src/components/Carousel/Carousel.tsx +131 -0
- package/src/components/Carousel/carousel.module.scss +61 -0
- package/src/components/Carousel/carousel.stories.tsx +117 -0
- package/src/components/Carousel/images.ts +44 -0
- package/src/components/Carousel/index.ts +2 -0
- package/src/components/Chip/Chip.spec.tsx +59 -0
- package/src/components/Chip/Chip.tsx +64 -0
- package/src/components/Chip/chip.module.scss +79 -0
- package/src/components/Chip/chip.stories.tsx +70 -0
- package/src/components/Chip/index.ts +2 -0
- package/src/components/ChipMarker/ChipMarker.tsx +20 -0
- package/src/components/ChipMarker/chip-marker.module.scss +75 -0
- package/src/components/ChipMarker/chip.stories.tsx +48 -0
- package/src/components/ChipMarker/index.ts +2 -0
- package/src/components/Divider/Divider.tsx +29 -0
- package/src/components/Divider/constants.ts +9 -0
- package/src/components/Divider/divider.module.scss +37 -0
- package/src/components/Divider/divider.stories.tsx +94 -0
- package/src/components/Divider/index.ts +2 -0
- package/src/components/Headings/Headings.tsx +36 -0
- package/src/components/Headings/headings.module.scss +46 -0
- package/src/components/Headings/headings.stories.tsx +92 -0
- package/src/components/Headings/index.ts +2 -0
- package/src/components/Link/Link.tsx +31 -0
- package/src/components/Link/List.spec.tsx +25 -0
- package/src/components/Link/index.ts +2 -0
- package/src/components/Link/link.module.scss +26 -0
- package/src/components/Link/link.stories.tsx +61 -0
- package/src/components/List/List.tsx +63 -0
- package/src/components/List/list-item.stories.tsx +89 -0
- package/src/components/List/list.module.scss +59 -0
- package/src/components/List/list.stories.tsx +65 -0
- package/src/components/List/variants.ts +23 -0
- package/src/components/MotionSlideUp/MotionSlideUp.tsx +37 -0
- package/src/components/MotionSlideUp/index.ts +2 -0
- package/src/components/Particle/Background/ParticleBackground.tsx +18 -0
- package/src/components/Particle/Background/index.ts +2 -0
- package/src/components/Particle/Background/particle-background.module.scss +25 -0
- package/src/components/Particle/Background/particle-background.stories.tsx +36 -0
- package/src/components/Particle/Field/ParticleField.tsx +28 -0
- package/src/components/Particle/Field/index.ts +2 -0
- package/src/components/Particle/Field/particle-field.module.scss +6 -0
- package/src/components/Particle/Field/particle-field.stories.tsx +38 -0
- package/src/components/Particle/Particles/Particles.tsx +22 -0
- package/src/components/Particle/Particles/particles.module.scss +19 -0
- package/src/components/RotatingBlur/RotatingBlur.tsx +26 -0
- package/src/components/RotatingBlur/index.ts +2 -0
- package/src/components/RotatingBlur/rotating-blur.module.scss +59 -0
- package/src/components/RotatingBlur/rotating-blur.stories.tsx +45 -0
- package/src/components/SplashScreen/SplashScreen.tsx +31 -0
- package/src/components/SplashScreen/index.ts +2 -0
- package/src/components/SplashScreen/splash-screen.module.scss +12 -0
- package/src/components/SplashScreen/splash-screen.stories.tsx +53 -0
- package/src/components/Switch/Switch.tsx +33 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/Switch/switch.module.scss +43 -0
- package/src/components/Switch/switch.stories.tsx +36 -0
- package/src/components/Switch/variants.ts +34 -0
- package/src/components/Text/Text.tsx +158 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/Text/text.module.scss +84 -0
- package/src/components/Text/text.stories.tsx +52 -0
- package/src/components/Text/variants.ts +53 -0
- package/src/components/TextFill/TextFillAnimation.tsx +87 -0
- package/src/components/TextFill/index.ts +2 -0
- package/src/components/TextFill/text-fill-animation.module.scss +37 -0
- package/src/components/TextFill/text-fill-animation.stories.tsx +61 -0
- package/src/components/TextUnderlineAnimation/TextUnderlineAnimation.tsx +37 -0
- package/src/components/TextUnderlineAnimation/index.ts +2 -0
- package/src/components/TextUnderlineAnimation/text-underline-animation.stories.tsx +39 -0
- package/src/components/TextUnderlineAnimation/text-underline.module.scss +13 -0
- package/src/components/TextUnderlineAnimation/variants.ts +23 -0
- package/src/components/TripieButton/Animated/AnimateButton.spec.tsx +84 -0
- package/src/components/TripieButton/Animated/AnimatedButton.tsx +88 -0
- package/src/components/TripieButton/Animated/animated-button.module.scss +61 -0
- package/src/components/TripieButton/Animated/animated-button.stories.tsx +68 -0
- package/src/components/TripieButton/Animated/index.ts +2 -0
- package/src/components/TripieButton/MenuToggle/MenuItem/index.tsx +28 -0
- package/src/components/TripieButton/MenuToggle/MenuItem/menu-item.module.scss +14 -0
- package/src/components/TripieButton/MenuToggle/MenuItem/menu-item.stories.tsx +42 -0
- package/src/components/TripieButton/MenuToggle/MenuItem/variants.ts +18 -0
- package/src/components/TripieButton/MenuToggle/MenuList/index.tsx +20 -0
- package/src/components/TripieButton/MenuToggle/MenuList/menu-list.module.scss +21 -0
- package/src/components/TripieButton/MenuToggle/MenuList/menu-list.stories.tsx +51 -0
- package/src/components/TripieButton/MenuToggle/MenuList/variants.ts +14 -0
- package/src/components/TripieButton/MenuToggle/MenuToggle.tsx +67 -0
- package/src/components/TripieButton/MenuToggle/index.ts +2 -0
- package/src/components/TripieButton/MenuToggle/menu-toggle.module.scss +42 -0
- package/src/components/TripieButton/MenuToggle/menu-toggle.stories.tsx +73 -0
- package/src/components/TripieButton/NoStyle/NoStyleButton.spec.tsx +50 -0
- package/src/components/TripieButton/NoStyle/NoStyleButton.tsx +27 -0
- package/src/components/TripieButton/NoStyle/index.ts +2 -0
- package/src/components/TripieButton/NoStyle/no-style-button.module.scss +5 -0
- package/src/components/TripieButton/NoStyle/no-style-button.stories.tsx +34 -0
- package/src/components/TripieCard/Card.tsx +167 -0
- package/src/components/TripieCard/card.module.scss +122 -0
- package/src/components/TripieCard/card.stories.tsx +66 -0
- package/src/components/TripieCard/index.ts +2 -0
- package/src/components/TripieContainer/TripieContainer.tsx +54 -0
- package/src/components/TripieContainer/index.ts +2 -0
- package/src/components/TripieContainer/tripie-container.module.scss +93 -0
- package/src/components/TripieContainer/tripie-container.stories.tsx +81 -0
- package/src/components/TripieIcon/Icon.tsx +242 -0
- package/src/components/TripieIcon/icon-transport.stories.tsx +108 -0
- package/src/components/TripieIcon/icon.module.scss +35 -0
- package/src/components/TripieIcon/icon.stories.tsx +81 -0
- package/src/components/TripieIcon/index.ts +2 -0
- package/src/components/TripieIcon/variants.ts +177 -0
- package/src/components/TripieImage/TripieImage.tsx +90 -0
- package/src/components/TripieImage/index.ts +2 -0
- package/src/components/TripieImage/tripie-image.module.scss +73 -0
- package/src/components/TripieImage/tripie-image.stories.tsx +128 -0
- package/src/components/TripieSkeleton/Skeleton.tsx +27 -0
- package/src/components/TripieSkeleton/index.ts +2 -0
- package/src/components/TripieSkeleton/skeleton.module.scss +7 -0
- package/src/components/TripieSkeleton/skeleton.stories.tsx +32 -0
- package/src/components/index.ts +25 -0
- package/src/font.ts +12 -0
- package/src/functions/_breakpoint.scss +21 -0
- package/src/functions/_color.scss +63 -0
- package/src/functions/_config.scss +27 -0
- package/src/functions/_shape.scss +29 -0
- package/src/functions/_space.scss +28 -0
- package/src/functions/_typography.scss +101 -0
- package/src/functions/_units.scss +66 -0
- package/src/functions/_z-index.scss +21 -0
- package/src/functions/index.scss +8 -0
- package/src/generator/_generator.scss +21 -0
- package/src/generator/index.scss +1 -0
- package/src/global.scss +49 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useAppTheme.ts +41 -0
- package/src/hooks/useCycle.ts +28 -0
- package/src/hooks/useDrawer.ts +29 -0
- package/src/index.ts +3 -0
- package/src/mixins/_border.scss +83 -0
- package/src/mixins/_clear.scss +21 -0
- package/src/mixins/_color.scss +19 -0
- package/src/mixins/_default.scss +40 -0
- package/src/mixins/_media.scss +26 -0
- package/src/mixins/_normalize.scss +353 -0
- package/src/mixins/_positioning.scss +34 -0
- package/src/mixins/_pseudo.scss +39 -0
- package/src/mixins/_reset.scss +70 -0
- package/src/mixins/_shape.scss +12 -0
- package/src/mixins/_skeleton.scss +89 -0
- package/src/mixins/_text.scss +52 -0
- package/src/mixins/_transition.scss +90 -0
- package/src/mixins/_z-index.scss +12 -0
- package/src/mixins/index.scss +14 -0
- package/src/mixins.scss +275 -0
- package/src/shared/colors.ts +18 -0
- package/src/shared/index.ts +3 -0
- package/src/shared/resource.ts +26 -0
- package/src/shared/variants.ts +68 -0
- package/src/shared/wrappers/classNames.ts +2 -0
- package/src/shared/wrappers/index.tsx +4 -0
- package/src/shared/wrappers/motion-wrapper.tsx +27 -0
- package/src/static/fonts/MaruBuri-Regular.eot +0 -0
- package/src/static/fonts/MaruBuri-Regular.otf +0 -0
- package/src/static/fonts/MaruBuri-Regular.ttf +0 -0
- package/src/static/fonts/MaruBuri-Regular.woff +0 -0
- package/src/static/fonts/MaruBuri-Regular.woff2 +0 -0
- package/src/styles/index.scss +2 -0
- package/src/typings.d.ts +5 -0
- package/src/variables.scss +31 -0
- package/tsconfig.json +21 -0
- package/turbo/generators/config.ts +30 -0
- package/turbo/generators/templates/component.hbs +8 -0
- package/vite.config.mjs +25 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { classNames, Motion } from '../../shared/wrappers';
|
|
3
|
+
|
|
4
|
+
import { createContext, ReactNode, useContext, useMemo } from 'react';
|
|
5
|
+
|
|
6
|
+
import { useCycle } from '../../hooks';
|
|
7
|
+
import Divider from '../Divider/Divider';
|
|
8
|
+
import Icon, { IconProps } from '../TripieIcon/Icon';
|
|
9
|
+
import Style from './accordian.module.scss';
|
|
10
|
+
import { ACCORDIAN_VARIANTS } from './variants';
|
|
11
|
+
|
|
12
|
+
const cx = classNames.bind(Style);
|
|
13
|
+
|
|
14
|
+
const AccordionContext = createContext<{ current: string; cycle: () => null }>({
|
|
15
|
+
current: 'closed',
|
|
16
|
+
cycle: () => null,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type AccordionProps = Partial<{ children: ReactNode; className: string }>;
|
|
20
|
+
|
|
21
|
+
const Accordion = ({ children, className }: Partial<AccordionProps>) => {
|
|
22
|
+
const [current, cycle] = useCycle('closed', 'open');
|
|
23
|
+
|
|
24
|
+
// context provider에 넘겨지는 value prop 객체는 매 랜더때마다 바뀌므로 useMemo로 감싸주기
|
|
25
|
+
const value = useMemo(() => {
|
|
26
|
+
return { current, cycle };
|
|
27
|
+
}, [current]);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<AccordionContext.Provider value={value}>
|
|
31
|
+
<Motion.Div className={cx('accordion', className)}>{children}</Motion.Div>
|
|
32
|
+
</AccordionContext.Provider>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const AccordionDivider = ({ className }: AccordionProps) => {
|
|
37
|
+
const { current } = useContext(AccordionContext);
|
|
38
|
+
return <Divider current={current} className={cx(className)} />;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const AccordionHeader = ({ children }: AccordionProps) => {
|
|
42
|
+
const { cycle } = useContext(AccordionContext);
|
|
43
|
+
return (
|
|
44
|
+
<Motion.Div className={cx('accordion-header')} whileHover={{ cursor: 'pointer' }} onTapStart={() => cycle()}>
|
|
45
|
+
{children}
|
|
46
|
+
</Motion.Div>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const AccordionIcon = ({ src, className, sizes = 'icon' }: IconProps) => {
|
|
51
|
+
const { current } = useContext(AccordionContext);
|
|
52
|
+
return (
|
|
53
|
+
<Icon src={src} sizes={sizes} variants={ACCORDIAN_VARIANTS.BUTTON} animate={current} className={cx(className)} />
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const AccordionBody = ({ children }: AccordionProps) => {
|
|
58
|
+
const { current } = useContext(AccordionContext);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Motion.Div variants={ACCORDIAN_VARIANTS.DETAILS} animate={current} className={cx('accordion-body')}>
|
|
62
|
+
{children}
|
|
63
|
+
</Motion.Div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
Accordion.Divider = AccordionDivider;
|
|
68
|
+
Accordion.Icon = AccordionIcon;
|
|
69
|
+
Accordion.Header = AccordionHeader;
|
|
70
|
+
Accordion.Body = AccordionBody;
|
|
71
|
+
|
|
72
|
+
export default Accordion;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@use '../../variables' as *;
|
|
2
|
+
|
|
3
|
+
.accordion-header {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 0.5rem;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
}
|
|
9
|
+
.divider {
|
|
10
|
+
height: 1.5px;
|
|
11
|
+
}
|
|
12
|
+
.accordion-body {
|
|
13
|
+
color: $theme-40;
|
|
14
|
+
}
|
|
15
|
+
.accordion {
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { Container } from '..';
|
|
5
|
+
import { useAppTheme } from '../../hooks';
|
|
6
|
+
import Accordion from './Accordian';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof Accordion> = {
|
|
9
|
+
title: 'tripie-ui/Accordion',
|
|
10
|
+
component: Accordion,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
argTypes: {},
|
|
13
|
+
parameters: {
|
|
14
|
+
docs: {
|
|
15
|
+
description: {
|
|
16
|
+
component: '<더보기>와 같이 클릭 시 상세 내용이 펼쳐지는 아코디언 컴포넌트입니다.',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
decorators: [
|
|
21
|
+
(story, context) => {
|
|
22
|
+
const { mode, setMode } = useAppTheme();
|
|
23
|
+
const selectedTheme = context.globals.theme || mode;
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setMode(selectedTheme);
|
|
27
|
+
}, [selectedTheme]);
|
|
28
|
+
|
|
29
|
+
return <div className={`${context.globals.theme}`}>{story()}</div>;
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
36
|
+
|
|
37
|
+
export const Default: Story = {
|
|
38
|
+
name: 'Default',
|
|
39
|
+
render: () => {
|
|
40
|
+
return (
|
|
41
|
+
<Accordion>
|
|
42
|
+
<Accordion.Header>
|
|
43
|
+
<Container margin="m" applyMargin="top">
|
|
44
|
+
Default <Accordion.Icon />
|
|
45
|
+
</Container>
|
|
46
|
+
</Accordion.Header>
|
|
47
|
+
<Accordion.Divider />
|
|
48
|
+
<Container applyMargin="top-bottom">
|
|
49
|
+
<Accordion.Body>default content</Accordion.Body>
|
|
50
|
+
</Container>
|
|
51
|
+
</Accordion>
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const MultipleAccordion: Story = {
|
|
57
|
+
name: 'Multiple',
|
|
58
|
+
render: () => {
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<Accordion>
|
|
62
|
+
<Accordion.Header>
|
|
63
|
+
<Container margin="m" applyMargin="top">
|
|
64
|
+
Accordion 1 <Accordion.Icon />
|
|
65
|
+
</Container>
|
|
66
|
+
</Accordion.Header>
|
|
67
|
+
<Accordion.Divider />
|
|
68
|
+
<Container applyMargin="top-bottom">
|
|
69
|
+
<Accordion.Body>Accordion content 1</Accordion.Body>
|
|
70
|
+
</Container>
|
|
71
|
+
</Accordion>
|
|
72
|
+
<Accordion>
|
|
73
|
+
<Accordion.Header>
|
|
74
|
+
<Container margin="m" applyMargin="top">
|
|
75
|
+
Accordion 2<Accordion.Icon />
|
|
76
|
+
</Container>
|
|
77
|
+
</Accordion.Header>
|
|
78
|
+
<Accordion.Divider />
|
|
79
|
+
<Container applyMargin="top-bottom">
|
|
80
|
+
<Accordion.Body>Accordion content 2</Accordion.Body>
|
|
81
|
+
</Container>
|
|
82
|
+
</Accordion>
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import COLORS from '../../shared/colors';
|
|
2
|
+
import { MotionProps } from '../../shared/wrappers/motion-wrapper';
|
|
3
|
+
|
|
4
|
+
export const ACCORDIAN_VARIANTS = {
|
|
5
|
+
DETAILS: {
|
|
6
|
+
closed: () => ({
|
|
7
|
+
height: '0%',
|
|
8
|
+
opacity: 0,
|
|
9
|
+
display: 'none',
|
|
10
|
+
}),
|
|
11
|
+
open: () => ({
|
|
12
|
+
transform: {
|
|
13
|
+
height: 'fit-content',
|
|
14
|
+
},
|
|
15
|
+
transition: {
|
|
16
|
+
duration: 2,
|
|
17
|
+
bounce: 0,
|
|
18
|
+
damping: 2,
|
|
19
|
+
stiffness: 10,
|
|
20
|
+
},
|
|
21
|
+
}),
|
|
22
|
+
} as unknown as MotionProps['variants'],
|
|
23
|
+
BUTTON: {
|
|
24
|
+
closed: () => ({}),
|
|
25
|
+
open: () => ({
|
|
26
|
+
rotate: '45deg',
|
|
27
|
+
transition: {
|
|
28
|
+
duration: 0.5,
|
|
29
|
+
bounce: 0,
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
} as MotionProps['variants'],
|
|
33
|
+
DIVIDER: {
|
|
34
|
+
closed: () => ({
|
|
35
|
+
backgroundColor: COLORS[400],
|
|
36
|
+
}),
|
|
37
|
+
open: () => ({
|
|
38
|
+
backgroundColor: COLORS[50],
|
|
39
|
+
transition: {
|
|
40
|
+
duration: 0.5,
|
|
41
|
+
bounce: 0,
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
} as MotionProps['variants'],
|
|
45
|
+
};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import { useInView } from 'react-intersection-observer';
|
|
3
|
+
import { describe, expect, it, Mock, vi } from 'vitest';
|
|
4
|
+
import TripieImage from '../TripieImage/TripieImage';
|
|
5
|
+
import Carousel from './Carousel';
|
|
6
|
+
import images from './images';
|
|
7
|
+
|
|
8
|
+
// https://vitest.dev/guide/mocking#globals
|
|
9
|
+
const IntersectionObserverMock = vi.fn(() => ({
|
|
10
|
+
disconnect: vi.fn(),
|
|
11
|
+
observe: vi.fn(),
|
|
12
|
+
takeRecords: vi.fn(),
|
|
13
|
+
unobserve: vi.fn(),
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
vi.stubGlobal('IntersectionObserver', IntersectionObserverMock);
|
|
17
|
+
|
|
18
|
+
vi.mock('react-intersection-observer', () => ({
|
|
19
|
+
useInView: vi.fn(() => ({
|
|
20
|
+
ref: vi.fn(), // Mock function
|
|
21
|
+
inView: false, // Start as false
|
|
22
|
+
})),
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
// Mock `scrollIntoView` since JSDOM doesn’t have it
|
|
26
|
+
Element.prototype.scrollIntoView = vi.fn();
|
|
27
|
+
|
|
28
|
+
// vi.spyOn(window.HTMLElement.prototype, 'scrollIntoView').mockImplementation(() => {});
|
|
29
|
+
|
|
30
|
+
(useInView as Mock).mockImplementation(({ threshold }) => {
|
|
31
|
+
return {
|
|
32
|
+
ref: vi.fn(),
|
|
33
|
+
inView: threshold === 0.6,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('Carousel Component', () => {
|
|
38
|
+
it('1. 캐로솔 이미지가 1개인 경우 다음/이전 버튼이 보이지 않는다.', () => {
|
|
39
|
+
render(
|
|
40
|
+
<Carousel
|
|
41
|
+
items={images.slice(0, 1).map((item, index) => (
|
|
42
|
+
<TripieImage.WithSourceUrl
|
|
43
|
+
sizes="large"
|
|
44
|
+
key={item.src + index}
|
|
45
|
+
alt={item.alt}
|
|
46
|
+
src={item.src}
|
|
47
|
+
sourceUrl={item.sourceUrl}
|
|
48
|
+
blurDataURL={item.blurDataURL}
|
|
49
|
+
/>
|
|
50
|
+
))}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const carouselElement = screen.getByAltText(images[0].alt);
|
|
55
|
+
expect(carouselElement).toBeInTheDocument();
|
|
56
|
+
|
|
57
|
+
const nextButton = screen.queryByRole('button', { name: /next/i });
|
|
58
|
+
const prevButton = screen.queryByRole('button', { name: /previous/i });
|
|
59
|
+
|
|
60
|
+
expect(nextButton).not.toBeInTheDocument();
|
|
61
|
+
expect(prevButton).not.toBeInTheDocument();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('2. 캐로솔 이미지가 여려 개인 경우, 하나의 이미지만 focus된다.', () => {
|
|
65
|
+
const { container } = render(
|
|
66
|
+
<Carousel
|
|
67
|
+
items={images.map((item, index) => (
|
|
68
|
+
<TripieImage.WithSourceUrl
|
|
69
|
+
sizes="large"
|
|
70
|
+
key={item.src + index}
|
|
71
|
+
alt={item.alt}
|
|
72
|
+
src={item.src}
|
|
73
|
+
sourceUrl={item.sourceUrl}
|
|
74
|
+
blurDataURL={item.blurDataURL}
|
|
75
|
+
/>
|
|
76
|
+
))}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const carouselItemElements = Array.from(container.querySelectorAll('*')).filter(el =>
|
|
81
|
+
el.className.match(/carousel-item/)
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const focusedElement = carouselItemElements.filter(el => el.className.match(/focused/));
|
|
85
|
+
|
|
86
|
+
expect(focusedElement.length).toEqual(1);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('3. 캐로솔 아이템이 2개인 경우, 다음 버튼을 클릭하면 두번째 아이템에 focus되고 이전 버튼이 생기고, 다음 버튼이 사라진다.', () => {
|
|
90
|
+
const { container } = render(
|
|
91
|
+
<Carousel
|
|
92
|
+
items={images.slice(0, 2).map((item, index) => (
|
|
93
|
+
<TripieImage.WithSourceUrl
|
|
94
|
+
sizes="large"
|
|
95
|
+
key={item.src + index}
|
|
96
|
+
alt={item.alt}
|
|
97
|
+
src={item.src}
|
|
98
|
+
sourceUrl={item.sourceUrl}
|
|
99
|
+
blurDataURL={item.blurDataURL}
|
|
100
|
+
/>
|
|
101
|
+
))}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
expect(container).toBeInTheDocument();
|
|
106
|
+
|
|
107
|
+
const buttonElements = container.querySelectorAll('button');
|
|
108
|
+
|
|
109
|
+
const carouselItemElements = Array.from(container.querySelectorAll('*')).filter(el =>
|
|
110
|
+
el.className.match(/carousel-item/)
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
expect(carouselItemElements.length).toEqual(2);
|
|
114
|
+
|
|
115
|
+
const focusedElement = carouselItemElements.findIndex(el => el.className.match(/focused/));
|
|
116
|
+
|
|
117
|
+
expect(focusedElement).toEqual(0);
|
|
118
|
+
expect(buttonElements.length).toEqual(1); // 버튼이 하나만 있고,
|
|
119
|
+
expect(buttonElements[0].name).toEqual('next'); // 해당 버튼이 다음 버튼
|
|
120
|
+
expect(buttonElements[0].name).not.toEqual('previous'); // 해당 버튼이 다음 버튼
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('4. 3개의 이미지 캐로솔에서 다음버튼을 두 번 누르면 이미지 1->2->3으로, 이전 버튼을 1번 누르면 3->2로 focus된다.', async () => {
|
|
124
|
+
// 4. 첫 번째 아이템이 focused일 때, 다음 버튼을 클릭하면 다음 아이템에 focus된다.'
|
|
125
|
+
const { container } = render(
|
|
126
|
+
<Carousel
|
|
127
|
+
items={images.slice(0, 3).map((item, index) => (
|
|
128
|
+
<TripieImage.WithSourceUrl
|
|
129
|
+
sizes="large"
|
|
130
|
+
key={item.src + index}
|
|
131
|
+
alt={item.alt}
|
|
132
|
+
src={item.src}
|
|
133
|
+
sourceUrl={item.sourceUrl}
|
|
134
|
+
blurDataURL={item.blurDataURL}
|
|
135
|
+
/>
|
|
136
|
+
))}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
expect(container).toBeInTheDocument();
|
|
141
|
+
|
|
142
|
+
// 스크롤 컨테이너
|
|
143
|
+
const scrollContainer = Array.from(container.querySelectorAll('*')).filter(el =>
|
|
144
|
+
el.className.match(/carousel-container/)
|
|
145
|
+
)[0];
|
|
146
|
+
|
|
147
|
+
expect(scrollContainer).toBeInTheDocument();
|
|
148
|
+
|
|
149
|
+
// 전체 캐로솔 아이템들
|
|
150
|
+
const carouselItems = Array.from(container.querySelectorAll('*')).filter(el => el.className.match(/carousel-item/));
|
|
151
|
+
|
|
152
|
+
expect(carouselItems.length).toBe(3);
|
|
153
|
+
|
|
154
|
+
// 'next' 버튼
|
|
155
|
+
const nextButton = container.querySelector('button[name="next"]');
|
|
156
|
+
expect(nextButton).toBeInTheDocument();
|
|
157
|
+
|
|
158
|
+
// 다음 버튼 클릭
|
|
159
|
+
await act(() => fireEvent.click(nextButton!));
|
|
160
|
+
|
|
161
|
+
// 클래스 변경, 두번째 항목(인덱스1)에만 focus
|
|
162
|
+
await waitFor(() => {
|
|
163
|
+
expect(carouselItems[0].classList.contains('focused')).toBe(false);
|
|
164
|
+
expect(carouselItems[1].classList.contains('focused')).toBe(true);
|
|
165
|
+
expect(carouselItems[2].classList.contains('focused')).toBe(false);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// 다음 버튼 클릭
|
|
169
|
+
await act(() => fireEvent.click(nextButton!));
|
|
170
|
+
|
|
171
|
+
// 클래스 변경, 세번째 항목(인덱스2)에만 focus
|
|
172
|
+
await waitFor(() => {
|
|
173
|
+
expect(carouselItems[0].classList.contains('focused')).toBe(false);
|
|
174
|
+
expect(carouselItems[1].classList.contains('focused')).toBe(false);
|
|
175
|
+
expect(carouselItems[2].classList.contains('focused')).toBe(true);
|
|
176
|
+
expect(nextButton).not.toBeInTheDocument(); // 마지막 항목이므로 다음 버튼이 보이지 않는다.
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// 'previous' 버튼
|
|
180
|
+
const prevButton = container.querySelector('button[name="previous"]');
|
|
181
|
+
expect(prevButton).toBeInTheDocument();
|
|
182
|
+
|
|
183
|
+
// 이전 버튼 클릭
|
|
184
|
+
await act(() => fireEvent.click(prevButton!));
|
|
185
|
+
|
|
186
|
+
// 클래스 변경, 두번째 항목(인덱스)에만 focus
|
|
187
|
+
await waitFor(() => {
|
|
188
|
+
expect(carouselItems[0].classList.contains('focused')).toBe(false);
|
|
189
|
+
expect(carouselItems[1].classList.contains('focused')).toBe(true);
|
|
190
|
+
expect(carouselItems[2].classList.contains('focused')).toBe(false);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
expect(Element.prototype.scrollIntoView).toHaveBeenCalled();
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// !! 🤔 스크롤 테스트가 잘 안됨 !! https://github.com/f-lab-edu/Tripie/blob/e6a096584da85ba6cfba371464b96aee4e77847c/packages/design-system/src/components/Carousel/Carousel.tsx#L92 useEffect가 안먹힘.
|
|
197
|
+
// it('5. 스크롤', async () => {
|
|
198
|
+
// const { container } = render(
|
|
199
|
+
// <Carousel
|
|
200
|
+
// items={images.slice(0, 2).map((item, index) => (
|
|
201
|
+
// <TripieImage.WithSourceUrl
|
|
202
|
+
// sizes="large"
|
|
203
|
+
// key={item.src + index}
|
|
204
|
+
// alt={item.alt}
|
|
205
|
+
// src={item.src}
|
|
206
|
+
// sourceUrl={item.sourceUrl}
|
|
207
|
+
// blurDataURL={item.blurDataURL}
|
|
208
|
+
// />
|
|
209
|
+
// ))}
|
|
210
|
+
// />
|
|
211
|
+
// );
|
|
212
|
+
|
|
213
|
+
// expect(container).toBeInTheDocument();
|
|
214
|
+
|
|
215
|
+
// // Get all carousel items
|
|
216
|
+
// const carouselItems = Array.from(container.querySelectorAll('*')).filter(el => el.className.match(/carousel-item/));
|
|
217
|
+
|
|
218
|
+
// expect(carouselItems.length).toBe(2);
|
|
219
|
+
|
|
220
|
+
// // Ensure first item is focused initially
|
|
221
|
+
// expect(carouselItems[0].classList.contains('focused')).toBe(true);
|
|
222
|
+
// expect(carouselItems[1].classList.contains('focused')).toBe(false);
|
|
223
|
+
|
|
224
|
+
// act(() => {
|
|
225
|
+
// container.scrollLeft = 1000;
|
|
226
|
+
// fireEvent.scroll(container);
|
|
227
|
+
// !! 동작하므로 scroll은 되는 것 같지만 state 변경이 잘 안된듯
|
|
228
|
+
// container.addEventListener('scroll', () => {
|
|
229
|
+
// console.log('Scroll event triggered!');
|
|
230
|
+
// });
|
|
231
|
+
// });
|
|
232
|
+
|
|
233
|
+
// // Wait for class update where only the second item is focused
|
|
234
|
+
// await waitFor(() => {
|
|
235
|
+
// expect(carouselItems[0].classList.contains('focused')).toBe(false);
|
|
236
|
+
// expect(carouselItems[1].classList.contains('focused')).toBe(true);
|
|
237
|
+
// });
|
|
238
|
+
// });
|
|
239
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { classNames } from '../../shared/wrappers';
|
|
3
|
+
|
|
4
|
+
import { ReactElement, ReactNode, RefObject, useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { useInView } from 'react-intersection-observer';
|
|
6
|
+
|
|
7
|
+
import NoStyleButton from '../TripieButton/NoStyle/NoStyleButton';
|
|
8
|
+
import TripieContainer from '../TripieContainer/TripieContainer';
|
|
9
|
+
import Icon from '../TripieIcon/Icon';
|
|
10
|
+
import Style from './carousel.module.scss';
|
|
11
|
+
|
|
12
|
+
const cx = classNames.bind(Style);
|
|
13
|
+
|
|
14
|
+
const Carousel = ({ items, className }: { items: ReactElement[]; className?: string }) => {
|
|
15
|
+
const [focusedIndex, setFocusedIndex] = useState(0);
|
|
16
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
17
|
+
|
|
18
|
+
const handleScrollButton = useCallback(
|
|
19
|
+
(direction: 'prev' | 'next') => {
|
|
20
|
+
let next = focusedIndex;
|
|
21
|
+
setFocusedIndex(prevIndex => {
|
|
22
|
+
if (direction === 'prev') {
|
|
23
|
+
next = prevIndex != 0 ? prevIndex - 1 : 0;
|
|
24
|
+
return next;
|
|
25
|
+
}
|
|
26
|
+
if (direction === 'next') {
|
|
27
|
+
next = prevIndex != items.length - 1 ? prevIndex + 1 : items.length - 1;
|
|
28
|
+
return next;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return prevIndex;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (ref?.current?.children?.[next] != null) {
|
|
35
|
+
ref.current.children?.[next].scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
[ref, focusedIndex]
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<TripieContainer margin="none" className={cx('carousel')}>
|
|
43
|
+
{items.length > 1 && focusedIndex != 0 ? (
|
|
44
|
+
<NoStyleButton name="previous" action={() => handleScrollButton('prev')}>
|
|
45
|
+
<Icon.Scroll className={cx('scroll-icon', 'next-icon')} next={false} />
|
|
46
|
+
</NoStyleButton>
|
|
47
|
+
) : null}
|
|
48
|
+
<TripieContainer margin="none" className={cx('flex-items', 'carousel-inner')}>
|
|
49
|
+
<TripieContainer margin="none" className={cx('insta-like-carousel-container', className)} refs={ref}>
|
|
50
|
+
{items.map((item, index) => (
|
|
51
|
+
<CarouselItem
|
|
52
|
+
key={`carousel-item-${item?.key}`}
|
|
53
|
+
index={index}
|
|
54
|
+
setFocusedIndex={setFocusedIndex}
|
|
55
|
+
focusedIndex={focusedIndex}
|
|
56
|
+
>
|
|
57
|
+
{item}
|
|
58
|
+
</CarouselItem>
|
|
59
|
+
))}
|
|
60
|
+
</TripieContainer>
|
|
61
|
+
</TripieContainer>
|
|
62
|
+
{items.length > 1 && focusedIndex != items.length - 1 ? (
|
|
63
|
+
<NoStyleButton name="next" action={() => handleScrollButton('next')}>
|
|
64
|
+
<Icon.Scroll className={cx('scroll-icon', 'prev-icon')} />
|
|
65
|
+
</NoStyleButton>
|
|
66
|
+
) : null}
|
|
67
|
+
</TripieContainer>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const CarouselItem = ({
|
|
72
|
+
children,
|
|
73
|
+
className,
|
|
74
|
+
index,
|
|
75
|
+
setFocusedIndex,
|
|
76
|
+
focusedIndex,
|
|
77
|
+
threshold = 0.6,
|
|
78
|
+
}: {
|
|
79
|
+
children: ReactNode;
|
|
80
|
+
index: number;
|
|
81
|
+
className?: string;
|
|
82
|
+
setFocusedIndex: (index: number) => void;
|
|
83
|
+
focusedIndex: number;
|
|
84
|
+
threshold?: number;
|
|
85
|
+
}) => {
|
|
86
|
+
const { ref, inView } = useInView({
|
|
87
|
+
threshold: threshold, // 60% 보여야 동작
|
|
88
|
+
triggerOnce: false, // 가시성 체크
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// 보이면 스크롤한 인덱스로 이동
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (inView && index != focusedIndex) {
|
|
94
|
+
setFocusedIndex(index);
|
|
95
|
+
}
|
|
96
|
+
}, [inView, focusedIndex]);
|
|
97
|
+
|
|
98
|
+
// 버튼 클릭으로 보이지 않는 경우 인접한 캐로솔로 인덱스 포커스
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (!inView && index != focusedIndex) {
|
|
101
|
+
setFocusedIndex(focusedIndex);
|
|
102
|
+
}
|
|
103
|
+
}, [inView, focusedIndex]);
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<TripieContainer
|
|
107
|
+
margin="none"
|
|
108
|
+
refs={ref as unknown as RefObject<HTMLDivElement>}
|
|
109
|
+
className={cx('insta-like-carousel-item', focusedIndex == index ? 'focused' : '', className)}
|
|
110
|
+
>
|
|
111
|
+
{children}
|
|
112
|
+
</TripieContainer>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// 좌표를 클릭하는 등 외부의 조작으로 carousel 포커싱이 결정되어 스타일만 carousel 형태
|
|
117
|
+
const ControlledCarousel = ({ children, className }: { children: ReactNode; className?: string }) => {
|
|
118
|
+
return (
|
|
119
|
+
<TripieContainer margin="none" className={cx('carousel')}>
|
|
120
|
+
<TripieContainer margin="none" className={cx('flex-items', 'carousel-inner')}>
|
|
121
|
+
<TripieContainer margin="none" className={cx('insta-like-carousel-container', className)}>
|
|
122
|
+
{children}
|
|
123
|
+
</TripieContainer>
|
|
124
|
+
</TripieContainer>
|
|
125
|
+
</TripieContainer>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
Carousel.Controlled = ControlledCarousel;
|
|
130
|
+
|
|
131
|
+
export default Carousel;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@use '../../variables' as *;
|
|
2
|
+
@use '../../mixins' as *;
|
|
3
|
+
|
|
4
|
+
.carousel {
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
margin: auto;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
.flex-items {
|
|
11
|
+
@include flex-items;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.carousel-inner {
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
transition: transform 0.5s ease-in-out;
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.insta-like-carousel-container {
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
overflow-x: auto;
|
|
23
|
+
overflow-y: hidden;
|
|
24
|
+
scroll-snap-type: x mandatory; /* Enables snapping on the x-axis */
|
|
25
|
+
-webkit-overflow-scrolling: touch; /* For smooth scrolling on iOS */
|
|
26
|
+
scroll-behavior: smooth; /* Optional: makes the snapping animated */
|
|
27
|
+
gap: 1rem;
|
|
28
|
+
@include visible-scroll(false);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.insta-like-carousel-item {
|
|
32
|
+
flex: 0 0 100%; /* Each image takes up 100% of the container's width */
|
|
33
|
+
scroll-snap-align: center; /* Aligns each image in the center of the viewport */
|
|
34
|
+
position: relative;
|
|
35
|
+
transition:
|
|
36
|
+
transform 0.3s ease,
|
|
37
|
+
box-shadow 0.3s ease;
|
|
38
|
+
background-size: cover;
|
|
39
|
+
background-position: center;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.with-border {
|
|
43
|
+
@include with-border;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.scroll-icon {
|
|
47
|
+
position: absolute;
|
|
48
|
+
z-index: 100;
|
|
49
|
+
border: 1px solid $theme-50;
|
|
50
|
+
border-radius: 100%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.next-icon {
|
|
54
|
+
left: 1rem;
|
|
55
|
+
top: 49%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.prev-icon {
|
|
59
|
+
right: 1rem;
|
|
60
|
+
top: 49%;
|
|
61
|
+
}
|