@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,70 @@
|
|
|
1
|
+
/* ── Modal ── */
|
|
2
|
+
.kombos-modal {
|
|
3
|
+
position: fixed;
|
|
4
|
+
inset: 0;
|
|
5
|
+
z-index: var(--kombos-z-overlay);
|
|
6
|
+
background: rgba(0, 0, 0, 0.35);
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
opacity: 0;
|
|
11
|
+
transition: opacity 0.3s;
|
|
12
|
+
padding: 1rem;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.kombos-modal--open {
|
|
16
|
+
opacity: 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.kombos-modal__panel {
|
|
20
|
+
background: var(--kombos-white);
|
|
21
|
+
border-radius: 6px;
|
|
22
|
+
width: 100%;
|
|
23
|
+
max-height: 90vh;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
transform: translateY(1rem);
|
|
27
|
+
transition: transform 0.3s;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.kombos-modal--open .kombos-modal__panel {
|
|
31
|
+
transform: translateY(0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.kombos-modal__header {
|
|
35
|
+
display: flex;
|
|
36
|
+
justify-content: space-between;
|
|
37
|
+
align-items: center;
|
|
38
|
+
background: var(--kombos-white);
|
|
39
|
+
padding: 1.5rem;
|
|
40
|
+
border-bottom: 1px solid var(--kombos-gray-200);
|
|
41
|
+
border-radius: 6px 6px 0 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.kombos-modal__title {
|
|
45
|
+
color: var(--kombos-gray-900);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.kombos-modal__close {
|
|
49
|
+
background: none;
|
|
50
|
+
border: none;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
padding: 0;
|
|
53
|
+
color: var(--kombos-gray-700);
|
|
54
|
+
font-size: 1.25rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.kombos-modal__body {
|
|
58
|
+
padding: 1.5rem;
|
|
59
|
+
overflow-y: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.kombos-modal__footer {
|
|
63
|
+
background: var(--kombos-white);
|
|
64
|
+
padding: 1.5rem;
|
|
65
|
+
border-top: 1px solid var(--kombos-gray-200);
|
|
66
|
+
border-radius: 0 0 6px 6px;
|
|
67
|
+
display: flex;
|
|
68
|
+
gap: 0.75rem;
|
|
69
|
+
justify-content: flex-end;
|
|
70
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cx } from "../../utils/cx";
|
|
2
|
+
import SpinnerIcon from "../SpinnerIcon";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default function PageLoader({ className }: Props) {
|
|
9
|
+
return (
|
|
10
|
+
<div className={cx("page-loader", className)}>
|
|
11
|
+
<SpinnerIcon />
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { observer } from "@ikas/component-utils";
|
|
2
|
+
import { cx } from "../../utils/cx";
|
|
3
|
+
import { getPageNumbers } from "../../utils/pagination";
|
|
4
|
+
import {
|
|
5
|
+
CaretDoubleLeftSVG,
|
|
6
|
+
CaretLeftSVG,
|
|
7
|
+
CaretRightSVG,
|
|
8
|
+
CaretDoubleRightSVG,
|
|
9
|
+
DotsThreeSVG,
|
|
10
|
+
} from "../icons";
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
currentPage: number;
|
|
14
|
+
totalPages: number;
|
|
15
|
+
hasPrev: boolean;
|
|
16
|
+
hasNext: boolean;
|
|
17
|
+
onPageChange: (page: number) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const Pagination = observer(function Pagination({
|
|
21
|
+
currentPage,
|
|
22
|
+
totalPages,
|
|
23
|
+
hasPrev,
|
|
24
|
+
hasNext,
|
|
25
|
+
onPageChange,
|
|
26
|
+
}: Props) {
|
|
27
|
+
if (totalPages <= 1) return null;
|
|
28
|
+
|
|
29
|
+
const pages = getPageNumbers(currentPage, totalPages);
|
|
30
|
+
|
|
31
|
+
const showFirstBtn = totalPages > 5 && currentPage >= 5;
|
|
32
|
+
const showLastBtn = totalPages > 5 && currentPage <= totalPages - 4;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<nav className="kombos-pagination" aria-label="Pagination">
|
|
36
|
+
<div className="kombos-pagination__nav-group">
|
|
37
|
+
{showFirstBtn && (
|
|
38
|
+
<button
|
|
39
|
+
type="button"
|
|
40
|
+
className="kombos-pagination__nav-btn"
|
|
41
|
+
onClick={() => onPageChange(1)}
|
|
42
|
+
aria-label="First page"
|
|
43
|
+
>
|
|
44
|
+
<CaretDoubleLeftSVG />
|
|
45
|
+
</button>
|
|
46
|
+
)}
|
|
47
|
+
<button
|
|
48
|
+
type="button"
|
|
49
|
+
className="kombos-pagination__nav-btn"
|
|
50
|
+
onClick={() => onPageChange(currentPage - 1)}
|
|
51
|
+
disabled={!hasPrev}
|
|
52
|
+
aria-label="Previous page"
|
|
53
|
+
>
|
|
54
|
+
<CaretLeftSVG />
|
|
55
|
+
</button>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<div className="kombos-pagination__pages">
|
|
59
|
+
{pages.map((page, i) =>
|
|
60
|
+
page === "dots" ? (
|
|
61
|
+
<span key={`dots-${i}`} className="kombos-pagination__dots">
|
|
62
|
+
<DotsThreeSVG />
|
|
63
|
+
</span>
|
|
64
|
+
) : (
|
|
65
|
+
<button
|
|
66
|
+
key={page}
|
|
67
|
+
type="button"
|
|
68
|
+
className={cx(
|
|
69
|
+
"kombos-pagination__page",
|
|
70
|
+
"text-md-semibold",
|
|
71
|
+
page === currentPage && "kombos-pagination__page--active"
|
|
72
|
+
)}
|
|
73
|
+
onClick={() => onPageChange(page)}
|
|
74
|
+
aria-current={page === currentPage ? "page" : undefined}
|
|
75
|
+
>
|
|
76
|
+
{page}
|
|
77
|
+
</button>
|
|
78
|
+
)
|
|
79
|
+
)}
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div className="kombos-pagination__nav-group">
|
|
83
|
+
<button
|
|
84
|
+
type="button"
|
|
85
|
+
className="kombos-pagination__nav-btn"
|
|
86
|
+
onClick={() => onPageChange(currentPage + 1)}
|
|
87
|
+
disabled={!hasNext}
|
|
88
|
+
aria-label="Next page"
|
|
89
|
+
>
|
|
90
|
+
<CaretRightSVG />
|
|
91
|
+
</button>
|
|
92
|
+
{showLastBtn && (
|
|
93
|
+
<button
|
|
94
|
+
type="button"
|
|
95
|
+
className="kombos-pagination__nav-btn"
|
|
96
|
+
onClick={() => onPageChange(totalPages)}
|
|
97
|
+
aria-label="Last page"
|
|
98
|
+
>
|
|
99
|
+
<CaretDoubleRightSVG />
|
|
100
|
+
</button>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
</nav>
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export default Pagination;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* ===== Pagination ===== */
|
|
2
|
+
.kombos-pagination {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
gap: 0.75rem 1.5rem;
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Left/right button groups (first+prev, next+last) */
|
|
12
|
+
.kombos-pagination__nav-group {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 0.375rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Navigation buttons (first, prev, next, last) */
|
|
19
|
+
.kombos-pagination__nav-btn {
|
|
20
|
+
width: 2rem;
|
|
21
|
+
height: 2rem;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
background: var(--kombos-gray-50);
|
|
26
|
+
border: 1px solid var(--kombos-gray-200);
|
|
27
|
+
border-radius: 6px;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
font-size: 1rem;
|
|
30
|
+
color: var(--kombos-gray-900);
|
|
31
|
+
transition: border-color 0.15s ease, background-color 0.15s ease;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.kombos-pagination__nav-btn:hover:not(:disabled) {
|
|
35
|
+
border-color: var(--kombos-gray-300);
|
|
36
|
+
background: var(--kombos-gray-100);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.kombos-pagination__nav-btn:disabled {
|
|
40
|
+
cursor: default;
|
|
41
|
+
color: var(--kombos-gray-300);
|
|
42
|
+
background: var(--kombos-gray-50);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Page numbers container */
|
|
46
|
+
.kombos-pagination__pages {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 0.25rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Page number buttons — 32×32 */
|
|
53
|
+
.kombos-pagination__page {
|
|
54
|
+
width: 2rem;
|
|
55
|
+
height: 2rem;
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
background: none;
|
|
60
|
+
border: none;
|
|
61
|
+
border-radius: 6px;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
padding: 0;
|
|
64
|
+
color: var(--kombos-gray-500);
|
|
65
|
+
transition: color 0.15s ease, background-color 0.15s ease;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.kombos-pagination__page:hover {
|
|
69
|
+
color: var(--kombos-gray-900);
|
|
70
|
+
background: var(--kombos-gray-50);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.kombos-pagination__page--active {
|
|
74
|
+
color: var(--kombos-white);
|
|
75
|
+
background: var(--kombos-gray-900);
|
|
76
|
+
pointer-events: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Dots separator */
|
|
80
|
+
.kombos-pagination__dots {
|
|
81
|
+
width: 2rem;
|
|
82
|
+
height: 2rem;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
font-size: 1rem;
|
|
87
|
+
color: var(--kombos-gray-400);
|
|
88
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { useState, useRef, useEffect } from "preact/hooks";
|
|
2
|
+
import {
|
|
3
|
+
getSelectedProductVariant,
|
|
4
|
+
getProductVariantMainImage,
|
|
5
|
+
getProductVariantDiscountPercentage,
|
|
6
|
+
hasProductVariantDiscount,
|
|
7
|
+
hasProductVariantStock,
|
|
8
|
+
addSelectedtedVariantToCart,
|
|
9
|
+
getProductHref,
|
|
10
|
+
getDefaultSrc,
|
|
11
|
+
IkasProduct,
|
|
12
|
+
isAddToCartEnabled,
|
|
13
|
+
isFavoriteIkasProduct,
|
|
14
|
+
addIkasProductToFavorites,
|
|
15
|
+
removeIkasProductFromFavorites,
|
|
16
|
+
customerStore,
|
|
17
|
+
hasCustomer,
|
|
18
|
+
Router,
|
|
19
|
+
createMediaSrcset,
|
|
20
|
+
} from "@ikas/bp-storefront";
|
|
21
|
+
import { observer } from "@ikas/component-utils";
|
|
22
|
+
import { NoProductSVG, Heart2SVG, HeartFilledSVG } from "../icons";
|
|
23
|
+
import Button from "../Button";
|
|
24
|
+
import SpinnerIcon from "../SpinnerIcon";
|
|
25
|
+
import Tag from "../Tag";
|
|
26
|
+
import { resolveAspectRatio, resolveObjectFit } from "../../utils/media";
|
|
27
|
+
import { showToast } from "../../utils/toast";
|
|
28
|
+
import type { AspectRatio, ObjectFit } from "../../global-types";
|
|
29
|
+
|
|
30
|
+
interface Props {
|
|
31
|
+
product: IkasProduct;
|
|
32
|
+
addToCartText: string;
|
|
33
|
+
addedToCartText?: string;
|
|
34
|
+
outOfStockText?: string;
|
|
35
|
+
goToProductText?: string;
|
|
36
|
+
showFavorite?: boolean;
|
|
37
|
+
hideAddToCartButton?: boolean;
|
|
38
|
+
badgeText?: string;
|
|
39
|
+
aspectRatio?: AspectRatio;
|
|
40
|
+
objectFit?: ObjectFit;
|
|
41
|
+
dataPage?: number;
|
|
42
|
+
sizes?: string;
|
|
43
|
+
openCartOnAdd?: boolean;
|
|
44
|
+
errorMessage?: string;
|
|
45
|
+
onFavoriteRemove?: () => void;
|
|
46
|
+
priority?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const ProductCard = observer(function ProductCard({
|
|
50
|
+
product,
|
|
51
|
+
addToCartText,
|
|
52
|
+
addedToCartText = "Sepete Eklendi",
|
|
53
|
+
outOfStockText = "Tükendi",
|
|
54
|
+
goToProductText = "Ürüne Git",
|
|
55
|
+
showFavorite = true,
|
|
56
|
+
hideAddToCartButton = false,
|
|
57
|
+
badgeText,
|
|
58
|
+
aspectRatio,
|
|
59
|
+
objectFit,
|
|
60
|
+
dataPage,
|
|
61
|
+
sizes = "(max-width: 767px) calc(50vw - 24px), (max-width: 1023px) calc(50vw - 44px), 300px",
|
|
62
|
+
openCartOnAdd = true,
|
|
63
|
+
errorMessage = "Ürün sepete eklenemedi",
|
|
64
|
+
onFavoriteRemove,
|
|
65
|
+
priority = false,
|
|
66
|
+
}: Props) {
|
|
67
|
+
const [cartState, setCartState] = useState<"idle" | "loading" | "added">(
|
|
68
|
+
"idle",
|
|
69
|
+
);
|
|
70
|
+
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
return () => {
|
|
74
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
75
|
+
};
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
const selectedVariant = getSelectedProductVariant(product);
|
|
79
|
+
const productImage = selectedVariant
|
|
80
|
+
? getProductVariantMainImage(selectedVariant)
|
|
81
|
+
: null;
|
|
82
|
+
const image = productImage?.image;
|
|
83
|
+
|
|
84
|
+
const sortedImages = selectedVariant?.images
|
|
85
|
+
? [...selectedVariant.images].sort((a, b) => a.order - b.order)
|
|
86
|
+
: [];
|
|
87
|
+
const secondImage = sortedImages.length > 1 ? sortedImages[1]?.image : null;
|
|
88
|
+
const hasDiscount = selectedVariant
|
|
89
|
+
? hasProductVariantDiscount(selectedVariant)
|
|
90
|
+
: false;
|
|
91
|
+
const inStock = selectedVariant
|
|
92
|
+
? hasProductVariantStock(selectedVariant)
|
|
93
|
+
: false;
|
|
94
|
+
const discountPercentage =
|
|
95
|
+
hasDiscount && selectedVariant
|
|
96
|
+
? getProductVariantDiscountPercentage(selectedVariant)
|
|
97
|
+
: null;
|
|
98
|
+
|
|
99
|
+
const productHref = getProductHref(product);
|
|
100
|
+
const isBundleProduct = !!selectedVariant?.bundleSettings;
|
|
101
|
+
const hasOptionSet = !!product.productOptionSet;
|
|
102
|
+
const isFavorite = isFavoriteIkasProduct(product);
|
|
103
|
+
|
|
104
|
+
const mediaStyle: Record<string, string> = {};
|
|
105
|
+
const resolvedAR = resolveAspectRatio(aspectRatio);
|
|
106
|
+
const resolvedOF = resolveObjectFit(objectFit);
|
|
107
|
+
if (resolvedAR) mediaStyle.aspectRatio = resolvedAR;
|
|
108
|
+
if (resolvedOF) mediaStyle.objectFit = resolvedOF;
|
|
109
|
+
|
|
110
|
+
const handleAddToCart = async () => {
|
|
111
|
+
if (cartState === "loading") return;
|
|
112
|
+
|
|
113
|
+
if (!isAddToCartEnabled(product) || isBundleProduct || hasOptionSet) {
|
|
114
|
+
Router.navigate(productHref);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
119
|
+
setCartState("loading");
|
|
120
|
+
try {
|
|
121
|
+
const result = await addSelectedtedVariantToCart(product, 1);
|
|
122
|
+
|
|
123
|
+
if (result.success) {
|
|
124
|
+
if (openCartOnAdd) {
|
|
125
|
+
window.dispatchEvent(new CustomEvent("ikas:open-cart-sidebar"));
|
|
126
|
+
}
|
|
127
|
+
setCartState("added");
|
|
128
|
+
} else {
|
|
129
|
+
showToast(errorMessage, "error");
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
timerRef.current = setTimeout(() => setCartState("idle"), 2000);
|
|
133
|
+
} catch {
|
|
134
|
+
setCartState("idle");
|
|
135
|
+
showToast(errorMessage, "error");
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const handleFavoriteToggle = async () => {
|
|
140
|
+
const isLoggedIn = hasCustomer(customerStore);
|
|
141
|
+
if (!isLoggedIn) {
|
|
142
|
+
Router.navigateToPage("LOGIN");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (isFavorite) {
|
|
147
|
+
await removeIkasProductFromFavorites(product);
|
|
148
|
+
onFavoriteRemove?.();
|
|
149
|
+
} else {
|
|
150
|
+
await addIkasProductToFavorites(product);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<div className="kombos-product-card" data-page={dataPage}>
|
|
156
|
+
{/* Image container */}
|
|
157
|
+
<div className="kombos-product-card__image-wrapper">
|
|
158
|
+
<a href={productHref} className="kombos-product-card__media-link" aria-label={product.name || "Product"}>
|
|
159
|
+
{image?.isVideo ? (
|
|
160
|
+
<video
|
|
161
|
+
src={getDefaultSrc(image)}
|
|
162
|
+
className="kombos-product-card__media"
|
|
163
|
+
style={mediaStyle}
|
|
164
|
+
muted
|
|
165
|
+
loop
|
|
166
|
+
autoPlay
|
|
167
|
+
playsInline
|
|
168
|
+
aria-label={product.name}
|
|
169
|
+
>
|
|
170
|
+
<track kind="captions" />
|
|
171
|
+
</video>
|
|
172
|
+
) : image ? (
|
|
173
|
+
<>
|
|
174
|
+
<img
|
|
175
|
+
src={getDefaultSrc(image)}
|
|
176
|
+
srcSet={createMediaSrcset(image)}
|
|
177
|
+
sizes={sizes}
|
|
178
|
+
alt={product.name}
|
|
179
|
+
className="kombos-product-card__media kombos-product-card__media--primary"
|
|
180
|
+
style={mediaStyle}
|
|
181
|
+
loading={priority ? "eager" : "lazy"}
|
|
182
|
+
decoding={priority ? "sync" : "async"}
|
|
183
|
+
fetchpriority={priority ? "high" : undefined}
|
|
184
|
+
/>
|
|
185
|
+
{secondImage && !secondImage.isVideo && (
|
|
186
|
+
<img
|
|
187
|
+
src={getDefaultSrc(secondImage)}
|
|
188
|
+
srcSet={createMediaSrcset(secondImage)}
|
|
189
|
+
sizes={sizes}
|
|
190
|
+
alt=""
|
|
191
|
+
className="kombos-product-card__media kombos-product-card__media--hover"
|
|
192
|
+
style={mediaStyle}
|
|
193
|
+
loading="lazy"
|
|
194
|
+
decoding="async"
|
|
195
|
+
/>
|
|
196
|
+
)}
|
|
197
|
+
</>
|
|
198
|
+
) : (
|
|
199
|
+
<div
|
|
200
|
+
className="kombos-product-card__media kombos-product-card__media--placeholder"
|
|
201
|
+
style={mediaStyle}
|
|
202
|
+
>
|
|
203
|
+
<NoProductSVG />
|
|
204
|
+
</div>
|
|
205
|
+
)}
|
|
206
|
+
</a>
|
|
207
|
+
|
|
208
|
+
{/* Out of stock overlay — must render before badges/heart so they appear on top */}
|
|
209
|
+
{!inStock && <div className="kombos-product-card__overlay" />}
|
|
210
|
+
|
|
211
|
+
{/* Badges */}
|
|
212
|
+
{(hasDiscount || badgeText) && (
|
|
213
|
+
<div className="kombos-product-card__badges">
|
|
214
|
+
{hasDiscount && discountPercentage && (
|
|
215
|
+
<Tag type="discounted" size="s">
|
|
216
|
+
%{discountPercentage}
|
|
217
|
+
</Tag>
|
|
218
|
+
)}
|
|
219
|
+
{badgeText && (
|
|
220
|
+
<Tag type="new" size="s">
|
|
221
|
+
{badgeText}
|
|
222
|
+
</Tag>
|
|
223
|
+
)}
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
226
|
+
|
|
227
|
+
{/* Favorite button */}
|
|
228
|
+
{showFavorite && (
|
|
229
|
+
<button
|
|
230
|
+
type="button"
|
|
231
|
+
className="kombos-product-card__favorite"
|
|
232
|
+
onClick={handleFavoriteToggle}
|
|
233
|
+
aria-label="Favorite"
|
|
234
|
+
>
|
|
235
|
+
{isFavorite ? <HeartFilledSVG /> : <Heart2SVG />}
|
|
236
|
+
</button>
|
|
237
|
+
)}
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
{/* Add to Cart / Go to Product */}
|
|
241
|
+
{!hideAddToCartButton && (
|
|
242
|
+
<>
|
|
243
|
+
{isBundleProduct || (hasOptionSet && inStock) ? (
|
|
244
|
+
<Button
|
|
245
|
+
variant="primary"
|
|
246
|
+
size="xs"
|
|
247
|
+
className="kombos-product-card__add-btn"
|
|
248
|
+
onClick={() => Router.navigate(productHref)}
|
|
249
|
+
>
|
|
250
|
+
{goToProductText}
|
|
251
|
+
</Button>
|
|
252
|
+
) : (
|
|
253
|
+
<Button
|
|
254
|
+
variant={cartState === "added" ? "secondary" : "primary"}
|
|
255
|
+
size="xs"
|
|
256
|
+
className="kombos-product-card__add-btn"
|
|
257
|
+
onClick={inStock ? handleAddToCart : undefined}
|
|
258
|
+
disabled={!inStock || cartState === "loading"}
|
|
259
|
+
icon={
|
|
260
|
+
inStock && cartState === "loading" ? <SpinnerIcon /> : undefined
|
|
261
|
+
}
|
|
262
|
+
>
|
|
263
|
+
{!inStock && outOfStockText}
|
|
264
|
+
{inStock && cartState === "added" && addedToCartText}
|
|
265
|
+
{inStock &&
|
|
266
|
+
(cartState === "idle" || cartState === "loading") &&
|
|
267
|
+
addToCartText}
|
|
268
|
+
</Button>
|
|
269
|
+
)}
|
|
270
|
+
</>
|
|
271
|
+
)}
|
|
272
|
+
</div>
|
|
273
|
+
);
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
export default ProductCard;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* ===== Product Card ===== */
|
|
2
|
+
.kombos-product-card {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 0.75rem;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Image wrapper */
|
|
10
|
+
.kombos-product-card__image-wrapper {
|
|
11
|
+
position: relative;
|
|
12
|
+
border-radius: 6px;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.kombos-product-card__media-link {
|
|
17
|
+
display: block;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.kombos-product-card__media {
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: auto;
|
|
23
|
+
display: block;
|
|
24
|
+
background: var(--kombos-gray-100);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.kombos-product-card__media--primary {
|
|
28
|
+
transition: opacity 0.3s ease;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.kombos-product-card__media--hover {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 0;
|
|
34
|
+
left: 0;
|
|
35
|
+
height: 100%;
|
|
36
|
+
opacity: 0;
|
|
37
|
+
transition: opacity 0.3s ease;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.kombos-product-card__image-wrapper:hover .kombos-product-card__media--primary {
|
|
41
|
+
opacity: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.kombos-product-card__image-wrapper:hover .kombos-product-card__media--hover {
|
|
45
|
+
opacity: 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.kombos-product-card__media--placeholder {
|
|
49
|
+
border: 1px solid var(--kombos-gray-100);
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
color: var(--kombos-gray-300);
|
|
55
|
+
font-size: 4rem;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Badges */
|
|
59
|
+
.kombos-product-card__badges {
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 0.75rem;
|
|
62
|
+
left: 0.75rem;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 0.5rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Favorite */
|
|
69
|
+
.kombos-product-card__favorite {
|
|
70
|
+
position: absolute;
|
|
71
|
+
top: 0.75rem;
|
|
72
|
+
right: 0.75rem;
|
|
73
|
+
background: none;
|
|
74
|
+
border: none;
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
padding: 0;
|
|
77
|
+
font-size: 1.5rem;
|
|
78
|
+
color: var(--kombos-gray-900);
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Out of stock overlay */
|
|
85
|
+
.kombos-product-card__overlay {
|
|
86
|
+
position: absolute;
|
|
87
|
+
top: 0;
|
|
88
|
+
left: 0;
|
|
89
|
+
width: 100%;
|
|
90
|
+
height: 100%;
|
|
91
|
+
background: rgba(0, 0, 0, 0.32);
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/* Add to Cart Button */
|
|
97
|
+
.kombos-product-card__add-btn {
|
|
98
|
+
width: 100%;
|
|
99
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MinusSVG, PlusSVG } from "../icons";
|
|
2
|
+
import { cx } from "../../utils/cx";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
value: number;
|
|
6
|
+
onChange: (value: number) => void;
|
|
7
|
+
size?: "default" | "sm";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function QuantitySelector({
|
|
11
|
+
value,
|
|
12
|
+
onChange,
|
|
13
|
+
size = "default",
|
|
14
|
+
}: Props) {
|
|
15
|
+
return (
|
|
16
|
+
<div className={cx("kombos-pd__qty", size === "sm" && "kombos-pd__qty--sm")}>
|
|
17
|
+
<button
|
|
18
|
+
type="button"
|
|
19
|
+
className="kombos-pd__qty-btn"
|
|
20
|
+
onClick={() => onChange(Math.max(1, value - 1))}
|
|
21
|
+
disabled={value <= 1}
|
|
22
|
+
aria-label="Decrease quantity"
|
|
23
|
+
>
|
|
24
|
+
<MinusSVG />
|
|
25
|
+
</button>
|
|
26
|
+
<span
|
|
27
|
+
className={cx("kombos-pd__qty-value", size === "sm" ? "text-sm-medium" : "text-md-medium")}
|
|
28
|
+
>
|
|
29
|
+
{value}
|
|
30
|
+
</span>
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
className="kombos-pd__qty-btn"
|
|
34
|
+
onClick={() => onChange(value + 1)}
|
|
35
|
+
aria-label="Increase quantity"
|
|
36
|
+
>
|
|
37
|
+
<PlusSVG />
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|