@ikas/component-cli 0.93.0 → 0.94.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/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +108 -42
- package/dist/commands/create.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/component-helpers.js +1 -1
- package/dist/utils/component-helpers.js.map +1 -1
- package/dist/utils/template.d.ts +12 -0
- package/dist/utils/template.d.ts.map +1 -1
- package/dist/utils/template.js +44 -0
- package/dist/utils/template.js.map +1 -1
- package/package.json +3 -2
- package/templates/create/claude-md +1 -1
- package/templates/create/cursorrules +1 -1
- package/templates/create/src/components/ExampleComponent/types.ts +1 -1
- package/templates/create/src/components/ExampleSection/types.ts +1 -1
- package/templates/create-full/README.md +78 -0
- package/templates/create-full/claude-md +721 -0
- package/templates/create-full/cursorrules +103 -0
- package/templates/create-full/gitignore +4 -0
- package/templates/create-full/ikas.config.json +5007 -0
- package/templates/create-full/mcp.json +10 -0
- package/templates/create-full/package.json +17 -0
- package/templates/create-full/src/components/AccountAddresses/components/AddressCard/index.tsx +55 -0
- package/templates/create-full/src/components/AccountAddresses/components/AddressCard/styles.css +46 -0
- package/templates/create-full/src/components/AccountAddresses/components/AddressModal/index.tsx +301 -0
- package/templates/create-full/src/components/AccountAddresses/components/AddressModal/styles.css +22 -0
- package/templates/create-full/src/components/AccountAddresses/index.tsx +127 -0
- package/templates/create-full/src/components/AccountAddresses/styles.css +41 -0
- package/templates/create-full/src/components/AccountAddresses/types.ts +15 -0
- package/templates/create-full/src/components/AccountFavorites/index.tsx +82 -0
- package/templates/create-full/src/components/AccountFavorites/styles.css +52 -0
- package/templates/create-full/src/components/AccountFavorites/types.ts +7 -0
- package/templates/create-full/src/components/AccountInfo/components/AccountSidebar/index.tsx +171 -0
- package/templates/create-full/src/components/AccountInfo/components/AccountSidebar/styles.css +144 -0
- package/templates/create-full/src/components/AccountInfo/index.tsx +91 -0
- package/templates/create-full/src/components/AccountInfo/styles.css +35 -0
- package/templates/create-full/src/components/AccountInfo/types.ts +9 -0
- package/templates/create-full/src/components/AccountInfoContent/index.tsx +134 -0
- package/templates/create-full/src/components/AccountInfoContent/styles.css +57 -0
- package/templates/create-full/src/components/AccountInfoContent/types.ts +8 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/OrderHeader/index.tsx +78 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/OrderHeader/styles.css +46 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/OrderItemRow/index.tsx +20 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/OrderItemRow/styles.css +16 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/OrderLineItemDisplay/index.tsx +112 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/OrderLineItemDisplay/styles.css +86 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/OrderSidebar/index.tsx +195 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/OrderSidebar/styles.css +93 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/PackageGroup/index.tsx +156 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/PackageGroup/styles.css +100 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/ReturnItemRow/index.tsx +56 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/ReturnItemRow/styles.css +57 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/ReturnView/index.tsx +159 -0
- package/templates/create-full/src/components/AccountOrderDetail/components/ReturnView/styles.css +29 -0
- package/templates/create-full/src/components/AccountOrderDetail/index.tsx +244 -0
- package/templates/create-full/src/components/AccountOrderDetail/styles.css +125 -0
- package/templates/create-full/src/components/AccountOrderDetail/types.ts +32 -0
- package/templates/create-full/src/components/AccountOrders/components/OrderCard/index.tsx +122 -0
- package/templates/create-full/src/components/AccountOrders/components/OrderCard/styles.css +114 -0
- package/templates/create-full/src/components/AccountOrders/index.tsx +105 -0
- package/templates/create-full/src/components/AccountOrders/styles.css +36 -0
- package/templates/create-full/src/components/AccountOrders/types.ts +11 -0
- package/templates/create-full/src/components/Announcement/index.tsx +11 -0
- package/templates/create-full/src/components/Announcement/styles.css +4 -0
- package/templates/create-full/src/components/Announcement/types.ts +4 -0
- package/templates/create-full/src/components/Announcements/index.tsx +91 -0
- package/templates/create-full/src/components/Announcements/styles.css +45 -0
- package/templates/create-full/src/components/Announcements/types.ts +8 -0
- package/templates/create-full/src/components/BlogHome/components/BlogCard/index.tsx +89 -0
- package/templates/create-full/src/components/BlogHome/components/BlogCard/styles.css +121 -0
- package/templates/create-full/src/components/BlogHome/index.tsx +124 -0
- package/templates/create-full/src/components/BlogHome/styles.css +118 -0
- package/templates/create-full/src/components/BlogHome/types.ts +15 -0
- package/templates/create-full/src/components/BlogPost/index.tsx +128 -0
- package/templates/create-full/src/components/BlogPost/styles.css +120 -0
- package/templates/create-full/src/components/BlogPost/types.ts +12 -0
- package/templates/create-full/src/components/CardProductName/index.tsx +25 -0
- package/templates/create-full/src/components/CardProductName/styles.css +22 -0
- package/templates/create-full/src/components/CardProductName/types.ts +7 -0
- package/templates/create-full/src/components/CardProductPrice/index.tsx +30 -0
- package/templates/create-full/src/components/CardProductPrice/styles.css +13 -0
- package/templates/create-full/src/components/CardProductPrice/types.ts +6 -0
- package/templates/create-full/src/components/CardProductVariants/index.tsx +10 -0
- package/templates/create-full/src/components/CardProductVariants/styles.css +1 -0
- package/templates/create-full/src/components/CardProductVariants/types.ts +6 -0
- package/templates/create-full/src/components/CartPage/components/CouponCode/index.tsx +108 -0
- package/templates/create-full/src/components/CartPage/components/CouponCode/styles.css +68 -0
- package/templates/create-full/src/components/CartPage/components/EmptyState/index.tsx +31 -0
- package/templates/create-full/src/components/CartPage/components/EmptyState/styles.css +18 -0
- package/templates/create-full/src/components/CartPage/components/OrderSummary/index.tsx +106 -0
- package/templates/create-full/src/components/CartPage/components/OrderSummary/styles.css +70 -0
- package/templates/create-full/src/components/CartPage/index.tsx +107 -0
- package/templates/create-full/src/components/CartPage/styles.css +54 -0
- package/templates/create-full/src/components/CartPage/types.ts +16 -0
- package/templates/create-full/src/components/CategoryImageItem/components/Card/index.tsx +64 -0
- package/templates/create-full/src/components/CategoryImageItem/components/Card/styles.css +56 -0
- package/templates/create-full/src/components/CategoryImageItem/index.tsx +64 -0
- package/templates/create-full/src/components/CategoryImageItem/styles.css +10 -0
- package/templates/create-full/src/components/CategoryImageItem/types.ts +16 -0
- package/templates/create-full/src/components/CategoryImages/index.tsx +62 -0
- package/templates/create-full/src/components/CategoryImages/styles.css +38 -0
- package/templates/create-full/src/components/CategoryImages/types.ts +11 -0
- package/templates/create-full/src/components/CategoryList/components/CategoryListControls/index.tsx +129 -0
- package/templates/create-full/src/components/CategoryList/components/CategoryListControls/styles.css +99 -0
- package/templates/create-full/src/components/CategoryList/components/FilterBoxValues/index.tsx +42 -0
- package/templates/create-full/src/components/CategoryList/components/FilterBoxValues/styles.css +27 -0
- package/templates/create-full/src/components/CategoryList/components/FilterCategoryList/index.tsx +43 -0
- package/templates/create-full/src/components/CategoryList/components/FilterCategoryList/styles.css +20 -0
- package/templates/create-full/src/components/CategoryList/components/FilterGroupValues/index.tsx +114 -0
- package/templates/create-full/src/components/CategoryList/components/FilterGroupValues/styles.css +1 -0
- package/templates/create-full/src/components/CategoryList/components/FilterListValues/index.tsx +54 -0
- package/templates/create-full/src/components/CategoryList/components/FilterListValues/styles.css +22 -0
- package/templates/create-full/src/components/CategoryList/components/FilterRangeListValues/index.tsx +50 -0
- package/templates/create-full/src/components/CategoryList/components/FilterRangeListValues/styles.css +25 -0
- package/templates/create-full/src/components/CategoryList/components/FilterRangeValues/index.tsx +189 -0
- package/templates/create-full/src/components/CategoryList/components/FilterRangeValues/styles.css +89 -0
- package/templates/create-full/src/components/CategoryList/components/FilterSidebar/index.tsx +92 -0
- package/templates/create-full/src/components/CategoryList/components/FilterSidebar/styles.css +27 -0
- package/templates/create-full/src/components/CategoryList/components/FilterSwatchValues/index.tsx +63 -0
- package/templates/create-full/src/components/CategoryList/components/FilterSwatchValues/styles.css +48 -0
- package/templates/create-full/src/components/CategoryList/components/MobileFilterModal/index.tsx +146 -0
- package/templates/create-full/src/components/CategoryList/components/MobileFilterModal/styles.css +133 -0
- package/templates/create-full/src/components/CategoryList/index.tsx +333 -0
- package/templates/create-full/src/components/CategoryList/styles.css +110 -0
- package/templates/create-full/src/components/CategoryList/types.ts +30 -0
- package/templates/create-full/src/components/CollapsibleContent/index.tsx +23 -0
- package/templates/create-full/src/components/CollapsibleContent/styles.css +11 -0
- package/templates/create-full/src/components/CollapsibleContent/types.ts +6 -0
- package/templates/create-full/src/components/CookieBar/index.tsx +78 -0
- package/templates/create-full/src/components/CookieBar/styles.css +111 -0
- package/templates/create-full/src/components/CookieBar/types.ts +10 -0
- package/templates/create-full/src/components/CustomerEmailVerification/index.tsx +168 -0
- package/templates/create-full/src/components/CustomerEmailVerification/styles.css +118 -0
- package/templates/create-full/src/components/CustomerEmailVerification/types.ts +17 -0
- package/templates/create-full/src/components/FeatureItem/index.tsx +27 -0
- package/templates/create-full/src/components/FeatureItem/styles.css +19 -0
- package/templates/create-full/src/components/FeatureItem/types.ts +7 -0
- package/templates/create-full/src/components/Features/index.tsx +25 -0
- package/templates/create-full/src/components/Features/styles.css +39 -0
- package/templates/create-full/src/components/Features/types.ts +5 -0
- package/templates/create-full/src/components/Footer/index.tsx +154 -0
- package/templates/create-full/src/components/Footer/styles.css +175 -0
- package/templates/create-full/src/components/Footer/types.ts +15 -0
- package/templates/create-full/src/components/ForgotPassword/components/ForgotPasswordForm/index.tsx +129 -0
- package/templates/create-full/src/components/ForgotPassword/components/ForgotPasswordForm/styles.css +0 -0
- package/templates/create-full/src/components/ForgotPassword/index.tsx +30 -0
- package/templates/create-full/src/components/ForgotPassword/styles.css +85 -0
- package/templates/create-full/src/components/ForgotPassword/types.ts +13 -0
- package/templates/create-full/src/components/Header/index.tsx +53 -0
- package/templates/create-full/src/components/Header/styles.css +6 -0
- package/templates/create-full/src/components/Header/types.ts +6 -0
- package/templates/create-full/src/components/HeroSlider/index.tsx +110 -0
- package/templates/create-full/src/components/HeroSlider/styles.css +129 -0
- package/templates/create-full/src/components/HeroSlider/types.ts +9 -0
- package/templates/create-full/src/components/HeroSliderItem/index.tsx +231 -0
- package/templates/create-full/src/components/HeroSliderItem/styles.css +152 -0
- package/templates/create-full/src/components/HeroSliderItem/types.ts +34 -0
- package/templates/create-full/src/components/Login/components/LoginForm/index.tsx +181 -0
- package/templates/create-full/src/components/Login/components/LoginForm/styles.css +0 -0
- package/templates/create-full/src/components/Login/index.tsx +37 -0
- package/templates/create-full/src/components/Login/styles.css +129 -0
- package/templates/create-full/src/components/Login/types.ts +18 -0
- package/templates/create-full/src/components/Navbar/components/CartSidebar/index.tsx +203 -0
- package/templates/create-full/src/components/Navbar/components/CartSidebar/styles.css +175 -0
- package/templates/create-full/src/components/Navbar/components/MobileMenu/index.tsx +198 -0
- package/templates/create-full/src/components/Navbar/components/MobileMenu/styles.css +122 -0
- package/templates/create-full/src/components/Navbar/components/NavItem/index.tsx +65 -0
- package/templates/create-full/src/components/Navbar/components/SearchModal/index.tsx +267 -0
- package/templates/create-full/src/components/Navbar/components/SearchModal/styles.css +182 -0
- package/templates/create-full/src/components/Navbar/index.tsx +250 -0
- package/templates/create-full/src/components/Navbar/styles.css +243 -0
- package/templates/create-full/src/components/Navbar/types.ts +37 -0
- package/templates/create-full/src/components/NotFound/index.tsx +39 -0
- package/templates/create-full/src/components/NotFound/styles.css +46 -0
- package/templates/create-full/src/components/NotFound/types.ts +8 -0
- package/templates/create-full/src/components/ProductDetail/components/ProductGallery/index.tsx +316 -0
- package/templates/create-full/src/components/ProductDetail/components/ProductGallery/styles.css +213 -0
- package/templates/create-full/src/components/ProductDetail/index.tsx +92 -0
- package/templates/create-full/src/components/ProductDetail/styles.css +58 -0
- package/templates/create-full/src/components/ProductDetail/types.ts +12 -0
- package/templates/create-full/src/components/ProductDetailAddToCart/components/PayWithIkas/index.tsx +34 -0
- package/templates/create-full/src/components/ProductDetailAddToCart/components/PayWithIkas/styles.css +4 -0
- package/templates/create-full/src/components/ProductDetailAddToCart/index.tsx +146 -0
- package/templates/create-full/src/components/ProductDetailAddToCart/styles.css +27 -0
- package/templates/create-full/src/components/ProductDetailAddToCart/types.ts +18 -0
- package/templates/create-full/src/components/ProductDetailBundleFurniture/components/BundleFurnitureRow/index.tsx +164 -0
- package/templates/create-full/src/components/ProductDetailBundleFurniture/components/BundleFurnitureSection/index.tsx +134 -0
- package/templates/create-full/src/components/ProductDetailBundleFurniture/components/BundleFurnitureSection/styles.css +188 -0
- package/templates/create-full/src/components/ProductDetailBundleFurniture/index.tsx +61 -0
- package/templates/create-full/src/components/ProductDetailBundleFurniture/styles.css +12 -0
- package/templates/create-full/src/components/ProductDetailBundleFurniture/types.ts +21 -0
- package/templates/create-full/src/components/ProductDetailBundleProduct/components/BundleProductItem/index.tsx +169 -0
- package/templates/create-full/src/components/ProductDetailBundleProduct/components/BundleProductItem/styles.css +141 -0
- package/templates/create-full/src/components/ProductDetailBundleProduct/components/BundleSkeletonLoading/index.tsx +35 -0
- package/templates/create-full/src/components/ProductDetailBundleProduct/components/BundleSkeletonLoading/styles.css +85 -0
- package/templates/create-full/src/components/ProductDetailBundleProduct/components/FurnitureRow/index.tsx +51 -0
- package/templates/create-full/src/components/ProductDetailBundleProduct/components/FurnitureRow/styles.css +30 -0
- package/templates/create-full/src/components/ProductDetailBundleProduct/components/FurnitureView/index.tsx +54 -0
- package/templates/create-full/src/components/ProductDetailBundleProduct/components/FurnitureView/styles.css +22 -0
- package/templates/create-full/src/components/ProductDetailBundleProduct/index.tsx +101 -0
- package/templates/create-full/src/components/ProductDetailBundleProduct/styles.css +20 -0
- package/templates/create-full/src/components/ProductDetailBundleProduct/types.ts +18 -0
- package/templates/create-full/src/components/ProductDetailDescription/index.tsx +56 -0
- package/templates/create-full/src/components/ProductDetailDescription/styles.css +21 -0
- package/templates/create-full/src/components/ProductDetailDescription/types.ts +13 -0
- package/templates/create-full/src/components/ProductDetailFeatureItem/index.tsx +28 -0
- package/templates/create-full/src/components/ProductDetailFeatureItem/styles.css +22 -0
- package/templates/create-full/src/components/ProductDetailFeatureItem/types.ts +7 -0
- package/templates/create-full/src/components/ProductDetailFeatures/index.tsx +40 -0
- package/templates/create-full/src/components/ProductDetailFeatures/styles.css +17 -0
- package/templates/create-full/src/components/ProductDetailFeatures/types.ts +10 -0
- package/templates/create-full/src/components/ProductDetailNameFavorite/index.tsx +66 -0
- package/templates/create-full/src/components/ProductDetailNameFavorite/styles.css +45 -0
- package/templates/create-full/src/components/ProductDetailNameFavorite/types.ts +11 -0
- package/templates/create-full/src/components/ProductDetailOffer/components/OfferCard/index.tsx +209 -0
- package/templates/create-full/src/components/ProductDetailOffer/components/OfferCard/styles.css +146 -0
- package/templates/create-full/src/components/ProductDetailOffer/components/OfferSummary/index.tsx +175 -0
- package/templates/create-full/src/components/ProductDetailOffer/index.tsx +199 -0
- package/templates/create-full/src/components/ProductDetailOffer/styles.css +211 -0
- package/templates/create-full/src/components/ProductDetailOffer/types.ts +24 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionCheckbox/index.tsx +52 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionCheckbox/styles.css +19 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionChoice/components/ChoiceBox/index.tsx +60 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionChoice/components/ChoiceBox/styles.css +38 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionChoice/components/ChoiceSelect/index.tsx +102 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionChoice/components/ChoiceSelect/styles.css +34 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionChoice/components/ChoiceSwatch/index.tsx +121 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionChoice/components/ChoiceSwatch/styles.css +87 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionChoice/index.tsx +57 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionColorPicker/index.tsx +54 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionColorPicker/styles.css +0 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionDatePicker/index.tsx +124 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionDatePicker/styles.css +1 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionFile/index.tsx +217 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionFile/styles.css +87 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionRenderer/index.tsx +133 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionText/index.tsx +60 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionText/styles.css +1 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionTextarea/index.tsx +74 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/components/OptionTextarea/styles.css +10 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/index.tsx +99 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/styles.css +30 -0
- package/templates/create-full/src/components/ProductDetailOptionSet/types.ts +21 -0
- package/templates/create-full/src/components/ProductDetailPrices/index.tsx +62 -0
- package/templates/create-full/src/components/ProductDetailPrices/styles.css +32 -0
- package/templates/create-full/src/components/ProductDetailPrices/types.ts +10 -0
- package/templates/create-full/src/components/ProductDetailProductGroup/index.tsx +74 -0
- package/templates/create-full/src/components/ProductDetailProductGroup/styles.css +33 -0
- package/templates/create-full/src/components/ProductDetailProductGroup/types.ts +10 -0
- package/templates/create-full/src/components/ProductDetailReviews/index.tsx +205 -0
- package/templates/create-full/src/components/ProductDetailReviews/styles.css +43 -0
- package/templates/create-full/src/components/ProductDetailReviews/types.ts +19 -0
- package/templates/create-full/src/components/ProductDetailSku/index.tsx +38 -0
- package/templates/create-full/src/components/ProductDetailSku/styles.css +16 -0
- package/templates/create-full/src/components/ProductDetailSku/types.ts +11 -0
- package/templates/create-full/src/components/ProductDetailVariant/index.tsx +38 -0
- package/templates/create-full/src/components/ProductDetailVariant/styles.css +14 -0
- package/templates/create-full/src/components/ProductDetailVariant/types.ts +12 -0
- package/templates/create-full/src/components/ProductSlider/index.tsx +151 -0
- package/templates/create-full/src/components/ProductSlider/styles.css +105 -0
- package/templates/create-full/src/components/ProductSlider/types.ts +17 -0
- package/templates/create-full/src/components/RecoverPassword/components/RecoverPasswordForm/index.tsx +133 -0
- package/templates/create-full/src/components/RecoverPassword/components/RecoverPasswordForm/styles.css +0 -0
- package/templates/create-full/src/components/RecoverPassword/index.tsx +30 -0
- package/templates/create-full/src/components/RecoverPassword/styles.css +93 -0
- package/templates/create-full/src/components/RecoverPassword/types.ts +13 -0
- package/templates/create-full/src/components/Register/components/RegisterForm/index.tsx +326 -0
- package/templates/create-full/src/components/Register/components/RegisterForm/styles.css +0 -0
- package/templates/create-full/src/components/Register/index.tsx +30 -0
- package/templates/create-full/src/components/Register/styles.css +152 -0
- package/templates/create-full/src/components/Register/types.ts +27 -0
- package/templates/create-full/src/components/RichText/index.tsx +25 -0
- package/templates/create-full/src/components/RichText/styles.css +51 -0
- package/templates/create-full/src/components/RichText/types.ts +5 -0
- package/templates/create-full/src/components/SocialMediaIcon/index.tsx +26 -0
- package/templates/create-full/src/components/SocialMediaIcon/styles.css +17 -0
- package/templates/create-full/src/components/SocialMediaIcon/types.ts +7 -0
- package/templates/create-full/src/components/index.ts +50 -0
- package/templates/create-full/src/global-types.ts +13 -0
- package/templates/create-full/src/global.css +582 -0
- package/templates/create-full/src/hooks/useBundleProducts.ts +75 -0
- package/templates/create-full/src/hooks/useColumnPreference.ts +26 -0
- package/templates/create-full/src/hooks/useInfiniteScroll.ts +49 -0
- package/templates/create-full/src/hooks/usePageTracking.ts +56 -0
- package/templates/create-full/src/hooks/usePayWithIkas.ts +114 -0
- package/templates/create-full/src/hooks/useRedirectIfLoggedIn.ts +35 -0
- package/templates/create-full/src/hooks/useScrollLock.ts +20 -0
- package/templates/create-full/src/hooks/useToast.ts +27 -0
- package/templates/create-full/src/ikas-component-utils.d.ts +3 -0
- package/templates/create-full/src/sub-components/Badge/index.tsx +208 -0
- package/templates/create-full/src/sub-components/Badge/styles.css +129 -0
- package/templates/create-full/src/sub-components/Breadcrumb/index.tsx +57 -0
- package/templates/create-full/src/sub-components/Breadcrumb/styles.css +49 -0
- package/templates/create-full/src/sub-components/BundleMedia/index.tsx +72 -0
- package/templates/create-full/src/sub-components/BundleQuantityBox/index.tsx +73 -0
- package/templates/create-full/src/sub-components/BundleQuantityBox/styles.css +43 -0
- package/templates/create-full/src/sub-components/Button/index.tsx +52 -0
- package/templates/create-full/src/sub-components/Button/styles.css +114 -0
- package/templates/create-full/src/sub-components/CartItem/components/BundleProductItem/index.tsx +59 -0
- package/templates/create-full/src/sub-components/CartItem/components/BundleProductItem/styles.css +24 -0
- package/templates/create-full/src/sub-components/CartItem/components/BundleProducts/index.tsx +55 -0
- package/templates/create-full/src/sub-components/CartItem/components/BundleProducts/styles.css +30 -0
- package/templates/create-full/src/sub-components/CartItem/components/ItemOptions/index.tsx +31 -0
- package/templates/create-full/src/sub-components/CartItem/components/ItemOptions/styles.css +6 -0
- package/templates/create-full/src/sub-components/CartItem/components/OptionValueDisplay/index.tsx +79 -0
- package/templates/create-full/src/sub-components/CartItem/components/OptionValueDisplay/styles.css +28 -0
- package/templates/create-full/src/sub-components/CartItem/index.tsx +216 -0
- package/templates/create-full/src/sub-components/CartItem/styles.css +170 -0
- package/templates/create-full/src/sub-components/Checkbox/index.tsx +42 -0
- package/templates/create-full/src/sub-components/Checkbox/styles.css +65 -0
- package/templates/create-full/src/sub-components/CollapsibleGroup/index.tsx +52 -0
- package/templates/create-full/src/sub-components/CollapsibleGroup/styles.css +51 -0
- package/templates/create-full/src/sub-components/ColorInput/index.tsx +33 -0
- package/templates/create-full/src/sub-components/ColorInput/styles.css +53 -0
- package/templates/create-full/src/sub-components/ConfirmModal/index.tsx +60 -0
- package/templates/create-full/src/sub-components/ConfirmModal/styles.css +20 -0
- package/templates/create-full/src/sub-components/FormItem/index.tsx +66 -0
- package/templates/create-full/src/sub-components/FormItem/styles.css +38 -0
- package/templates/create-full/src/sub-components/ImagePreviewModal/index.tsx +55 -0
- package/templates/create-full/src/sub-components/ImagePreviewModal/styles.css +50 -0
- package/templates/create-full/src/sub-components/Input/index.tsx +69 -0
- package/templates/create-full/src/sub-components/Input/styles.css +162 -0
- package/templates/create-full/src/sub-components/Modal/index.tsx +118 -0
- package/templates/create-full/src/sub-components/Modal/styles.css +70 -0
- package/templates/create-full/src/sub-components/PageLoader/index.tsx +14 -0
- package/templates/create-full/src/sub-components/PageLoader/styles.css +12 -0
- package/templates/create-full/src/sub-components/Pagination/index.tsx +107 -0
- package/templates/create-full/src/sub-components/Pagination/styles.css +88 -0
- package/templates/create-full/src/sub-components/ProductCard/index.tsx +276 -0
- package/templates/create-full/src/sub-components/ProductCard/styles.css +99 -0
- package/templates/create-full/src/sub-components/QuantitySelector/index.tsx +41 -0
- package/templates/create-full/src/sub-components/QuantitySelector/styles.css +51 -0
- package/templates/create-full/src/sub-components/ReviewCard/index.tsx +103 -0
- package/templates/create-full/src/sub-components/ReviewCard/styles.css +95 -0
- package/templates/create-full/src/sub-components/ReviewForm/index.tsx +115 -0
- package/templates/create-full/src/sub-components/ReviewForm/styles.css +11 -0
- package/templates/create-full/src/sub-components/ReviewSummary/index.tsx +65 -0
- package/templates/create-full/src/sub-components/ReviewSummary/styles.css +86 -0
- package/templates/create-full/src/sub-components/Select/index.tsx +86 -0
- package/templates/create-full/src/sub-components/Select/styles.css +110 -0
- package/templates/create-full/src/sub-components/SkeletonField/index.tsx +12 -0
- package/templates/create-full/src/sub-components/SkeletonField/styles.css +29 -0
- package/templates/create-full/src/sub-components/SliderArrow/index.tsx +26 -0
- package/templates/create-full/src/sub-components/SliderArrow/styles.css +24 -0
- package/templates/create-full/src/sub-components/SocialLoginButton/index.tsx +24 -0
- package/templates/create-full/src/sub-components/SocialLoginButton/styles.css +19 -0
- package/templates/create-full/src/sub-components/SpinnerIcon/index.tsx +10 -0
- package/templates/create-full/src/sub-components/SpinnerIcon/styles.css +8 -0
- package/templates/create-full/src/sub-components/StarRating/index.tsx +76 -0
- package/templates/create-full/src/sub-components/StarRating/styles.css +40 -0
- package/templates/create-full/src/sub-components/Tag/index.tsx +21 -0
- package/templates/create-full/src/sub-components/Tag/styles.css +30 -0
- package/templates/create-full/src/sub-components/Textarea/index.tsx +45 -0
- package/templates/create-full/src/sub-components/Textarea/styles.css +82 -0
- package/templates/create-full/src/sub-components/Toast/index.tsx +257 -0
- package/templates/create-full/src/sub-components/Toast/styles.css +3 -0
- package/templates/create-full/src/sub-components/Toggle/index.tsx +46 -0
- package/templates/create-full/src/sub-components/Toggle/styles.css +86 -0
- package/templates/create-full/src/sub-components/VariantBadge/index.tsx +153 -0
- package/templates/create-full/src/sub-components/VariantBadge/styles.css +47 -0
- package/templates/create-full/src/sub-components/icons/index.tsx +981 -0
- package/templates/create-full/src/utils/bundle.ts +70 -0
- package/templates/create-full/src/utils/cx.ts +4 -0
- package/templates/create-full/src/utils/fullName.ts +6 -0
- package/templates/create-full/src/utils/media.ts +36 -0
- package/templates/create-full/src/utils/optionPrice.ts +19 -0
- package/templates/create-full/src/utils/optionSet.ts +17 -0
- package/templates/create-full/src/utils/orderStatus.ts +28 -0
- package/templates/create-full/src/utils/pagination.ts +29 -0
- package/templates/create-full/src/utils/toast.ts +5 -0
- package/templates/create-full/tsconfig.json +30 -0
- package/templates/create-full/vite.config.ts +15 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/* ===== Navbar Component ===== */
|
|
2
|
+
.kombos-navbar__inner {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 0.75rem;
|
|
6
|
+
padding-block: 0.75rem;
|
|
7
|
+
position: relative;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
min-height: calc(var(--logo-h-mobile, 3rem) + 1.5rem);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Logo */
|
|
13
|
+
.kombos-navbar__logo {
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
text-decoration: none;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
position: absolute;
|
|
19
|
+
left: 50%;
|
|
20
|
+
top: 50%;
|
|
21
|
+
transform: translate(-50%, -50%);
|
|
22
|
+
height: var(--logo-h-mobile, 3rem);
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.kombos-navbar__logo-img {
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
object-fit: contain;
|
|
30
|
+
padding: 0.5rem 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Navigation */
|
|
34
|
+
.kombos-navbar__nav {
|
|
35
|
+
flex: 1;
|
|
36
|
+
display: none;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
gap: 1.5rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* NavItem sub-component uses kombos-header__* classes — keep those styles here */
|
|
43
|
+
.kombos-header__nav-item {
|
|
44
|
+
position: relative;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.kombos-header__nav-link {
|
|
48
|
+
color: var(--kombos-gray-700);
|
|
49
|
+
text-decoration: none;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: 0.25rem;
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
transition: opacity 0.2s ease;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.kombos-header__nav-link:hover {
|
|
58
|
+
opacity: 0.7;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.kombos-header__chevron {
|
|
62
|
+
flex-shrink: 0;
|
|
63
|
+
transition: transform 0.2s ease;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.kombos-header__nav-item:hover .kombos-header__chevron {
|
|
67
|
+
transform: rotate(180deg);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Dropdown */
|
|
71
|
+
.kombos-header__dropdown {
|
|
72
|
+
display: none;
|
|
73
|
+
position: absolute;
|
|
74
|
+
top: calc(100% + 1.125rem);
|
|
75
|
+
left: 50%;
|
|
76
|
+
transform: translateX(-50%);
|
|
77
|
+
background: var(--kombos-white);
|
|
78
|
+
border: 1px solid var(--kombos-gray-100);
|
|
79
|
+
border-radius: 6px;
|
|
80
|
+
padding: 0.375rem 0;
|
|
81
|
+
width: 13rem;
|
|
82
|
+
box-shadow: 0 2px 12px 0.4px rgba(0, 0, 0, 0.06);
|
|
83
|
+
z-index: var(--kombos-z-dropdown);
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Invisible bridge: covers the 18px gap between nav link and dropdown */
|
|
88
|
+
.kombos-header__dropdown::before {
|
|
89
|
+
content: "";
|
|
90
|
+
position: absolute;
|
|
91
|
+
bottom: 100%;
|
|
92
|
+
left: -0.75rem;
|
|
93
|
+
right: -0.75rem;
|
|
94
|
+
height: 1.125rem;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.kombos-header__nav-item:hover > .kombos-header__dropdown {
|
|
98
|
+
display: flex;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Nested dropdown (2nd level) */
|
|
102
|
+
.kombos-header__dropdown--nested {
|
|
103
|
+
top: -0.375rem;
|
|
104
|
+
left: calc(100% + 0.75rem);
|
|
105
|
+
transform: none;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Bridge: covers the 12px gap between 1st and 2nd level dropdowns */
|
|
109
|
+
.kombos-header__dropdown--nested::before {
|
|
110
|
+
content: "";
|
|
111
|
+
position: absolute;
|
|
112
|
+
top: -0.75rem;
|
|
113
|
+
bottom: -0.75rem;
|
|
114
|
+
right: 100%;
|
|
115
|
+
left: auto;
|
|
116
|
+
width: 0.75rem;
|
|
117
|
+
height: auto;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.kombos-header__dropdown-item {
|
|
121
|
+
position: relative;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.kombos-header__dropdown-item:hover > .kombos-header__dropdown--nested {
|
|
125
|
+
display: flex;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.kombos-header__dropdown-link {
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
justify-content: space-between;
|
|
132
|
+
color: var(--kombos-gray-900);
|
|
133
|
+
text-decoration: none;
|
|
134
|
+
padding: 0.75rem 1rem;
|
|
135
|
+
transition: background-color 0.15s ease;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.kombos-header__dropdown-link:hover {
|
|
139
|
+
background-color: var(--kombos-gray-50);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.kombos-header__caret-right {
|
|
143
|
+
flex-shrink: 0;
|
|
144
|
+
color: var(--kombos-gray-900);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* Action Icons */
|
|
148
|
+
.kombos-navbar__actions {
|
|
149
|
+
flex-shrink: 0;
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: 0.75rem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.kombos-navbar__icon-btn {
|
|
156
|
+
background: none;
|
|
157
|
+
border: none;
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
padding: 0;
|
|
160
|
+
display: flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
justify-content: center;
|
|
163
|
+
width: 1.5rem;
|
|
164
|
+
height: 1.5rem;
|
|
165
|
+
position: relative;
|
|
166
|
+
transition: opacity 0.2s ease;
|
|
167
|
+
font-size: 1.25rem;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.kombos-navbar__icon-btn:hover {
|
|
171
|
+
opacity: 0.6;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.kombos-navbar__badge {
|
|
175
|
+
position: absolute;
|
|
176
|
+
top: -0.375rem;
|
|
177
|
+
right: -0.5rem;
|
|
178
|
+
background: var(--kombos-badge-bg);
|
|
179
|
+
color: var(--kombos-white);
|
|
180
|
+
font-size: 0.625rem;
|
|
181
|
+
font-weight: 600;
|
|
182
|
+
min-width: 1.125rem;
|
|
183
|
+
height: 1.125rem;
|
|
184
|
+
border-radius: 9px;
|
|
185
|
+
display: flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
justify-content: center;
|
|
188
|
+
padding: 0 0.25rem;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* Hamburger (mobile only — visible by default) */
|
|
192
|
+
.kombos-navbar__hamburger {
|
|
193
|
+
display: flex;
|
|
194
|
+
background: none;
|
|
195
|
+
border: none;
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
padding: 0;
|
|
198
|
+
width: 1.5rem;
|
|
199
|
+
height: 1.5rem;
|
|
200
|
+
align-items: center;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
color: var(--kombos-gray-900);
|
|
203
|
+
transition: opacity 0.2s ease;
|
|
204
|
+
font-size: 1.375rem;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.kombos-navbar__hamburger:hover {
|
|
208
|
+
opacity: 0.6;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* ===== Responsive — Desktop ===== */
|
|
212
|
+
@media (min-width: 1024px) {
|
|
213
|
+
.kombos-navbar__inner {
|
|
214
|
+
gap: 2rem;
|
|
215
|
+
position: static;
|
|
216
|
+
justify-content: initial;
|
|
217
|
+
min-height: calc(var(--logo-h-desktop, 3.75rem) + 1.5rem);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.kombos-navbar__hamburger {
|
|
221
|
+
display: none;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.kombos-navbar__nav {
|
|
225
|
+
display: flex;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.kombos-navbar__nav--no-logo {
|
|
229
|
+
justify-content: flex-start;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.kombos-navbar__logo {
|
|
233
|
+
position: static;
|
|
234
|
+
left: auto;
|
|
235
|
+
top: auto;
|
|
236
|
+
transform: none;
|
|
237
|
+
height: var(--logo-h-desktop, 3.75rem);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.kombos-navbar__actions {
|
|
241
|
+
gap: 1.25rem;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// This file is auto-generated — do not edit manually.
|
|
2
|
+
import type { IkasImage, HeightStyleType, IkasNavigationLinkList, IkasProductList } from "@ikas/bp-storefront";
|
|
3
|
+
import type { AspectRatio, ObjectFit } from "../../global-types";
|
|
4
|
+
|
|
5
|
+
export interface Props {
|
|
6
|
+
logo?: IkasImage | null;
|
|
7
|
+
logoSizeDesktop?: HeightStyleType;
|
|
8
|
+
logoSizeMobile?: HeightStyleType;
|
|
9
|
+
navigationLinks?: IkasNavigationLinkList;
|
|
10
|
+
navigationLinkColor?: string;
|
|
11
|
+
coloredLinks?: IkasNavigationLinkList;
|
|
12
|
+
coloredLinkColor?: string;
|
|
13
|
+
cartTitle?: string;
|
|
14
|
+
emptyCartText?: string;
|
|
15
|
+
checkoutButtonText?: string;
|
|
16
|
+
totalText?: string;
|
|
17
|
+
freeShippingText?: string;
|
|
18
|
+
emptyCartButtonText?: string;
|
|
19
|
+
registerButtonText?: string;
|
|
20
|
+
loginButtonText?: string;
|
|
21
|
+
logoutButtonText?: string;
|
|
22
|
+
searchProductList?: IkasProductList;
|
|
23
|
+
hideAddToCartButton?: boolean;
|
|
24
|
+
searchPlaceholder?: string;
|
|
25
|
+
searchingText?: string;
|
|
26
|
+
noResultsText?: string;
|
|
27
|
+
resultCountText?: string;
|
|
28
|
+
addToCartText?: string;
|
|
29
|
+
addedToCartText?: string;
|
|
30
|
+
outOfStockText?: string;
|
|
31
|
+
goToProductText?: string;
|
|
32
|
+
viewAllText?: string;
|
|
33
|
+
components?: any;
|
|
34
|
+
imageAspectRatio?: AspectRatio;
|
|
35
|
+
imageObjectFit?: ObjectFit;
|
|
36
|
+
viewCartButtonText?: string;
|
|
37
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Router } from "@ikas/bp-storefront";
|
|
2
|
+
|
|
3
|
+
import { Props } from "./types";
|
|
4
|
+
import Button from "../../sub-components/Button";
|
|
5
|
+
|
|
6
|
+
export function NotFound({ title, description, button }: Props) {
|
|
7
|
+
return (
|
|
8
|
+
<section className="not-found">
|
|
9
|
+
<div className="not-found__wrapper kombos-container">
|
|
10
|
+
<div className="not-found__content">
|
|
11
|
+
<h1 className="not-found__title display-sm-semibold">{title}</h1>
|
|
12
|
+
<p className="not-found__description text-md-regular">
|
|
13
|
+
{description}
|
|
14
|
+
</p>
|
|
15
|
+
{button?.href && button?.label && (
|
|
16
|
+
<Button
|
|
17
|
+
variant="primary"
|
|
18
|
+
size="s"
|
|
19
|
+
onClick={() =>
|
|
20
|
+
Router.navigate(
|
|
21
|
+
button.href,
|
|
22
|
+
false,
|
|
23
|
+
button.openInNewTab ?? false,
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
style={{
|
|
27
|
+
minWidth: 200,
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
{button.label}
|
|
31
|
+
</Button>
|
|
32
|
+
)}
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</section>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default NotFound;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.not-found {
|
|
2
|
+
width: 100%;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.not-found__wrapper {
|
|
6
|
+
display: flex;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
align-items: center;
|
|
9
|
+
min-height: 50vh;
|
|
10
|
+
padding-top: 2rem;
|
|
11
|
+
padding-bottom: 2rem;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.not-found__content {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
align-items: center;
|
|
18
|
+
text-align: center;
|
|
19
|
+
gap: 1rem;
|
|
20
|
+
max-width: 29rem;
|
|
21
|
+
text-wrap-style: pretty;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.not-found__title {
|
|
25
|
+
color: var(--kombos-gray-900);
|
|
26
|
+
margin: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.not-found__description {
|
|
30
|
+
color: var(--kombos-gray-500);
|
|
31
|
+
margin: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media (min-width: 768px) {
|
|
35
|
+
.not-found__wrapper {
|
|
36
|
+
padding-top: 3rem;
|
|
37
|
+
padding-bottom: 3rem;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@media (min-width: 1024px) {
|
|
42
|
+
.not-found__wrapper {
|
|
43
|
+
padding-top: 4rem;
|
|
44
|
+
padding-bottom: 4rem;
|
|
45
|
+
}
|
|
46
|
+
}
|
package/templates/create-full/src/components/ProductDetail/components/ProductGallery/index.tsx
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createMediaSrcset,
|
|
3
|
+
getDefaultSrc,
|
|
4
|
+
getThumbnailSrc,
|
|
5
|
+
IkasImage,
|
|
6
|
+
} from "@ikas/bp-storefront";
|
|
7
|
+
import { useRef, useState, useCallback, useEffect, useMemo } from "preact/hooks";
|
|
8
|
+
import { cx } from "../../../../utils/cx";
|
|
9
|
+
import { NoProductSVG, PlaySVG } from "../../../../sub-components/icons";
|
|
10
|
+
import SliderArrow from "../../../../sub-components/SliderArrow";
|
|
11
|
+
import { resolveAspectRatio, resolveObjectFit } from "../../../../utils/media";
|
|
12
|
+
import type { AspectRatio, ObjectFit } from "../../../../global-types";
|
|
13
|
+
|
|
14
|
+
const SETTLE_DELAY = 100;
|
|
15
|
+
const DRAG_THRESHOLD_RATIO = 0.15;
|
|
16
|
+
const SNAP_DURATION = 300;
|
|
17
|
+
|
|
18
|
+
function easeInOutCubic(t: number): number {
|
|
19
|
+
return t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface Props {
|
|
23
|
+
images: IkasImage[];
|
|
24
|
+
productName: string;
|
|
25
|
+
aspectRatio?: AspectRatio;
|
|
26
|
+
objectFit?: ObjectFit;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default function ProductGallery({
|
|
30
|
+
images,
|
|
31
|
+
productName,
|
|
32
|
+
aspectRatio,
|
|
33
|
+
objectFit,
|
|
34
|
+
}: Props) {
|
|
35
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
36
|
+
const trackRef = useRef<HTMLDivElement>(null);
|
|
37
|
+
const mainWrapRef = useRef<HTMLDivElement>(null);
|
|
38
|
+
const thumbsRef = useRef<HTMLDivElement>(null);
|
|
39
|
+
const isProgrammaticRef = useRef(false);
|
|
40
|
+
const settleTimerRef = useRef<ReturnType<typeof setTimeout>>();
|
|
41
|
+
const isDraggingRef = useRef(false);
|
|
42
|
+
const dragStartXRef = useRef(0);
|
|
43
|
+
const dragScrollLeftRef = useRef(0);
|
|
44
|
+
const animFrameRef = useRef(0);
|
|
45
|
+
|
|
46
|
+
const hasMultiple = images.length > 1;
|
|
47
|
+
const resolvedAR = resolveAspectRatio(aspectRatio);
|
|
48
|
+
const resolvedOF = resolveObjectFit(objectFit);
|
|
49
|
+
|
|
50
|
+
const imageStyle = useMemo(() => ({ objectFit: resolvedOF as CSSStyleDeclaration["objectFit"] }), [resolvedOF]);
|
|
51
|
+
const thumbStyle = useMemo(() => ({ aspectRatio: resolvedAR }), [resolvedAR]);
|
|
52
|
+
|
|
53
|
+
// Sync thumbnail column height with main image
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (!hasMultiple) return;
|
|
56
|
+
const syncHeight = () => {
|
|
57
|
+
const wrap = mainWrapRef.current;
|
|
58
|
+
const thumbs = thumbsRef.current;
|
|
59
|
+
if (wrap && thumbs) {
|
|
60
|
+
thumbs.style.maxHeight = `${wrap.offsetHeight}px`;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
syncHeight();
|
|
64
|
+
window.addEventListener("resize", syncHeight);
|
|
65
|
+
return () => window.removeEventListener("resize", syncHeight);
|
|
66
|
+
}, [hasMultiple, aspectRatio]);
|
|
67
|
+
|
|
68
|
+
// Auto-play/pause videos based on selected slide
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
const track = trackRef.current;
|
|
71
|
+
if (!track) return;
|
|
72
|
+
const slides = track.children;
|
|
73
|
+
for (let i = 0; i < slides.length; i++) {
|
|
74
|
+
const video = slides[i].querySelector("video");
|
|
75
|
+
if (!video) continue;
|
|
76
|
+
if (i === selectedIndex) {
|
|
77
|
+
video.play().catch(() => {});
|
|
78
|
+
} else {
|
|
79
|
+
video.pause();
|
|
80
|
+
video.currentTime = 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, [selectedIndex]);
|
|
84
|
+
|
|
85
|
+
const scrollThumbIntoView = useCallback((index: number) => {
|
|
86
|
+
const thumb = thumbsRef.current?.children[index] as HTMLElement | undefined;
|
|
87
|
+
thumb?.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
88
|
+
}, []);
|
|
89
|
+
|
|
90
|
+
const smoothScrollTo = useCallback((track: HTMLElement, target: number) => {
|
|
91
|
+
cancelAnimationFrame(animFrameRef.current);
|
|
92
|
+
const start = track.scrollLeft;
|
|
93
|
+
const distance = target - start;
|
|
94
|
+
if (Math.abs(distance) < 1) {
|
|
95
|
+
track.scrollLeft = target;
|
|
96
|
+
track.style.scrollSnapType = "x mandatory";
|
|
97
|
+
isProgrammaticRef.current = false;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const startTime = performance.now();
|
|
101
|
+
const step = (now: number) => {
|
|
102
|
+
const elapsed = Math.min((now - startTime) / SNAP_DURATION, 1);
|
|
103
|
+
track.scrollLeft = start + distance * easeInOutCubic(elapsed);
|
|
104
|
+
if (elapsed < 1) {
|
|
105
|
+
animFrameRef.current = requestAnimationFrame(step);
|
|
106
|
+
} else {
|
|
107
|
+
track.style.scrollSnapType = "x mandatory";
|
|
108
|
+
isProgrammaticRef.current = false;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
animFrameRef.current = requestAnimationFrame(step);
|
|
112
|
+
}, []);
|
|
113
|
+
|
|
114
|
+
const goToSlide = useCallback((index: number) => {
|
|
115
|
+
const track = trackRef.current;
|
|
116
|
+
if (!track) return;
|
|
117
|
+
isProgrammaticRef.current = true;
|
|
118
|
+
clearTimeout(settleTimerRef.current);
|
|
119
|
+
const slide = track.children[index] as HTMLElement | undefined;
|
|
120
|
+
if (slide) {
|
|
121
|
+
track.scrollTo({ left: slide.offsetLeft, behavior: "smooth" });
|
|
122
|
+
}
|
|
123
|
+
setSelectedIndex(index);
|
|
124
|
+
scrollThumbIntoView(index);
|
|
125
|
+
}, [scrollThumbIntoView]);
|
|
126
|
+
|
|
127
|
+
const handlePrev = useCallback(() => {
|
|
128
|
+
goToSlide(selectedIndex === 0 ? images.length - 1 : selectedIndex - 1);
|
|
129
|
+
}, [goToSlide, selectedIndex, images.length]);
|
|
130
|
+
|
|
131
|
+
const handleNext = useCallback(() => {
|
|
132
|
+
goToSlide(selectedIndex === images.length - 1 ? 0 : selectedIndex + 1);
|
|
133
|
+
}, [goToSlide, selectedIndex, images.length]);
|
|
134
|
+
|
|
135
|
+
const handleScroll = useCallback(() => {
|
|
136
|
+
clearTimeout(settleTimerRef.current);
|
|
137
|
+
if (isProgrammaticRef.current) {
|
|
138
|
+
settleTimerRef.current = setTimeout(() => {
|
|
139
|
+
isProgrammaticRef.current = false;
|
|
140
|
+
}, SETTLE_DELAY);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const track = trackRef.current;
|
|
144
|
+
if (!track) return;
|
|
145
|
+
const newIndex = Math.round(track.scrollLeft / track.clientWidth);
|
|
146
|
+
if (newIndex >= 0 && newIndex < images.length) {
|
|
147
|
+
setSelectedIndex(newIndex);
|
|
148
|
+
}
|
|
149
|
+
}, [images.length]);
|
|
150
|
+
|
|
151
|
+
const handleMouseDown = useCallback((e: MouseEvent) => {
|
|
152
|
+
const track = trackRef.current;
|
|
153
|
+
if (!track) return;
|
|
154
|
+
cancelAnimationFrame(animFrameRef.current);
|
|
155
|
+
isDraggingRef.current = true;
|
|
156
|
+
dragStartXRef.current = e.pageX;
|
|
157
|
+
dragScrollLeftRef.current = track.scrollLeft;
|
|
158
|
+
track.style.scrollSnapType = "none";
|
|
159
|
+
track.style.cursor = "grabbing";
|
|
160
|
+
}, []);
|
|
161
|
+
|
|
162
|
+
const handleMouseMove = useCallback((e: MouseEvent) => {
|
|
163
|
+
if (!isDraggingRef.current) return;
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
const track = trackRef.current;
|
|
166
|
+
if (!track) return;
|
|
167
|
+
track.scrollLeft = dragScrollLeftRef.current - (e.pageX - dragStartXRef.current);
|
|
168
|
+
}, []);
|
|
169
|
+
|
|
170
|
+
const handleMouseEnd = useCallback((e: MouseEvent) => {
|
|
171
|
+
if (!isDraggingRef.current) return;
|
|
172
|
+
isDraggingRef.current = false;
|
|
173
|
+
const track = trackRef.current;
|
|
174
|
+
if (!track) return;
|
|
175
|
+
track.style.cursor = "";
|
|
176
|
+
|
|
177
|
+
const dragDelta = dragStartXRef.current - e.pageX;
|
|
178
|
+
const threshold = track.clientWidth * DRAG_THRESHOLD_RATIO;
|
|
179
|
+
let targetIndex = Math.round(dragScrollLeftRef.current / track.clientWidth);
|
|
180
|
+
if (dragDelta > threshold) targetIndex++;
|
|
181
|
+
else if (dragDelta < -threshold) targetIndex--;
|
|
182
|
+
const clamped = Math.max(0, Math.min(targetIndex, images.length - 1));
|
|
183
|
+
|
|
184
|
+
isProgrammaticRef.current = true;
|
|
185
|
+
setSelectedIndex(clamped);
|
|
186
|
+
smoothScrollTo(track, track.clientWidth * clamped);
|
|
187
|
+
scrollThumbIntoView(clamped);
|
|
188
|
+
}, [images.length, smoothScrollTo, scrollThumbIntoView]);
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<div className="kombos-pd__gallery">
|
|
192
|
+
{hasMultiple && (
|
|
193
|
+
<div className="kombos-pd__thumbs" ref={thumbsRef}>
|
|
194
|
+
{images.map((img, i) => (
|
|
195
|
+
<button
|
|
196
|
+
key={img.id || i}
|
|
197
|
+
type="button"
|
|
198
|
+
className={cx("kombos-pd__thumb", i === selectedIndex && "kombos-pd__thumb--active")}
|
|
199
|
+
onClick={() => goToSlide(i)}
|
|
200
|
+
style={thumbStyle}
|
|
201
|
+
>
|
|
202
|
+
{img.isVideo ? (
|
|
203
|
+
<div className="kombos-pd__thumb-video">
|
|
204
|
+
<video
|
|
205
|
+
src={getDefaultSrc(img)}
|
|
206
|
+
className="kombos-pd__thumb-img"
|
|
207
|
+
style={imageStyle}
|
|
208
|
+
muted
|
|
209
|
+
preload="metadata"
|
|
210
|
+
>
|
|
211
|
+
<track kind="captions" />
|
|
212
|
+
</video>
|
|
213
|
+
<span className="kombos-pd__thumb-play">
|
|
214
|
+
<PlaySVG />
|
|
215
|
+
</span>
|
|
216
|
+
</div>
|
|
217
|
+
) : (
|
|
218
|
+
<img
|
|
219
|
+
src={getThumbnailSrc(img)}
|
|
220
|
+
srcSet={createMediaSrcset(img)}
|
|
221
|
+
sizes="112px"
|
|
222
|
+
alt={`${productName} ${i + 1}`}
|
|
223
|
+
className="kombos-pd__thumb-img"
|
|
224
|
+
style={imageStyle}
|
|
225
|
+
/>
|
|
226
|
+
)}
|
|
227
|
+
</button>
|
|
228
|
+
))}
|
|
229
|
+
</div>
|
|
230
|
+
)}
|
|
231
|
+
|
|
232
|
+
<div className="kombos-pd__main-col">
|
|
233
|
+
<div
|
|
234
|
+
className="kombos-pd__main-image-wrap"
|
|
235
|
+
ref={mainWrapRef}
|
|
236
|
+
style={{ aspectRatio: resolvedAR }}
|
|
237
|
+
>
|
|
238
|
+
<div
|
|
239
|
+
className="kombos-pd__track"
|
|
240
|
+
ref={trackRef}
|
|
241
|
+
onScroll={handleScroll}
|
|
242
|
+
onMouseDown={handleMouseDown}
|
|
243
|
+
onMouseMove={handleMouseMove}
|
|
244
|
+
onMouseUp={handleMouseEnd}
|
|
245
|
+
onMouseLeave={handleMouseEnd}
|
|
246
|
+
>
|
|
247
|
+
{images.length > 0 ? (
|
|
248
|
+
images.map((img, i) => (
|
|
249
|
+
<div key={img.id || i} className="kombos-pd__slide">
|
|
250
|
+
{img.isVideo ? (
|
|
251
|
+
<video
|
|
252
|
+
className="kombos-pd__main-image kombos-pd__main-video"
|
|
253
|
+
src={getDefaultSrc(img)}
|
|
254
|
+
loop
|
|
255
|
+
muted
|
|
256
|
+
playsInline
|
|
257
|
+
style={imageStyle}
|
|
258
|
+
>
|
|
259
|
+
<track kind="captions" />
|
|
260
|
+
</video>
|
|
261
|
+
) : (
|
|
262
|
+
<img
|
|
263
|
+
className="kombos-pd__main-image"
|
|
264
|
+
src={getDefaultSrc(img)}
|
|
265
|
+
srcSet={createMediaSrcset(img)}
|
|
266
|
+
sizes="(max-width: 1023px) 100vw, min(calc((100vw - 440px) / 2), 530px)"
|
|
267
|
+
alt={img?.altText || `${productName} ${i + 1}`}
|
|
268
|
+
style={imageStyle}
|
|
269
|
+
loading={i === 0 ? "eager" : "lazy"}
|
|
270
|
+
fetchpriority={i === 0 ? "high" : undefined}
|
|
271
|
+
/>
|
|
272
|
+
)}
|
|
273
|
+
</div>
|
|
274
|
+
))
|
|
275
|
+
) : (
|
|
276
|
+
<div className="kombos-pd__slide">
|
|
277
|
+
<div className="kombos-pd__main-image kombos-pd__main-image--placeholder">
|
|
278
|
+
<NoProductSVG />
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
)}
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
{hasMultiple && (
|
|
285
|
+
<>
|
|
286
|
+
<SliderArrow
|
|
287
|
+
direction="left"
|
|
288
|
+
className="kombos-pd__arrow kombos-pd__arrow--prev"
|
|
289
|
+
onClick={handlePrev}
|
|
290
|
+
/>
|
|
291
|
+
<SliderArrow
|
|
292
|
+
direction="right"
|
|
293
|
+
className="kombos-pd__arrow kombos-pd__arrow--next"
|
|
294
|
+
onClick={handleNext}
|
|
295
|
+
/>
|
|
296
|
+
</>
|
|
297
|
+
)}
|
|
298
|
+
|
|
299
|
+
{hasMultiple && (
|
|
300
|
+
<div className="kombos-pd__dots">
|
|
301
|
+
{images.map((_, i) => (
|
|
302
|
+
<button
|
|
303
|
+
key={i}
|
|
304
|
+
type="button"
|
|
305
|
+
className={cx("kombos-pd__dot", i === selectedIndex && "kombos-pd__dot--active")}
|
|
306
|
+
onClick={() => goToSlide(i)}
|
|
307
|
+
aria-label={`${images[i]?.isVideo ? "Video" : "Image"} ${i + 1}`}
|
|
308
|
+
/>
|
|
309
|
+
))}
|
|
310
|
+
</div>
|
|
311
|
+
)}
|
|
312
|
+
</div>
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
);
|
|
316
|
+
}
|