@evenicanpm/storefront-core 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +37 -0
- package/.storybook/preview.ts +14 -0
- package/README.md +17 -2
- package/__mocks__/next-font.js +4 -0
- package/package.json +19 -13
- package/src/api-manager/datasources/e4/graphqlRequestSdk.ts +265 -5
- package/src/api-manager/schemas/product.schema.ts +2 -2
- package/src/api-manager/services/cart/mutations/add-discount-code.ts +11 -0
- package/src/api-manager/services/cart/mutations/checkout.ts +1 -1
- package/src/api-manager/services/create-query.ts +11 -4
- package/src/api-manager/services/product/queries/get-product-availability.ts +1 -2
- package/src/api-manager/services/user/mutations/add-to-wishlist.ts +2 -2
- package/src/api-manager/services/user/mutations/copy-cart-to-wishlist.ts +2 -1
- package/src/api-manager/services/user/mutations/remove-from-wishlist.ts +4 -4
- package/src/api-manager/services/user/mutations/update-wishlist.ts +2 -1
- package/src/api-manager/services/user/queries/get-wishlist-details.ts +2 -2
- package/src/cms/blocks/components/product-carousel/index.tsx +6 -3
- package/src/cms/blocks/components/product-section-fullwidth/index.tsx +2 -2
- package/src/cms/blocks/components/shared/product-grid.tsx +5 -2
- package/src/cms/interfaces/navigation.ts +9 -9
- package/src/components/Blocks/Components/CategoryCarousel/index.tsx +3 -3
- package/src/components/Blocks/Components/HeroCarousel/index.tsx +2 -2
- package/src/components/Blocks/Components/ProductCarousel/index.tsx +5 -5
- package/src/components/Blocks/Components/ProductSectionFullWidth/index.tsx +6 -6
- package/src/components/Blocks/Components/Services/service-card.tsx +4 -1
- package/src/components/Blocks/Components/shared/featured-product-card.tsx +2 -2
- package/src/components/Blocks/Components/shared/product-category-item.tsx +3 -3
- package/src/components/Blocks/Components/shared/product-grid.tsx +2 -2
- package/src/components/Blocks/Components/shared/top-categories-card.tsx +1 -1
- package/src/components/Blocks/Components/shared/top-rating-product-card.tsx +6 -3
- package/src/components/Footer/sections/FooterAppStore.tsx +1 -1
- package/src/components/Footer/sections/FooterContact.tsx +1 -1
- package/src/components/Footer/sections/FooterLogo.tsx +2 -2
- package/src/components/Footer/sections/FooterSocialLinks.tsx +1 -1
- package/src/components/_components/MiniCartClient.tsx +2 -2
- package/src/components/_components/accordion/accordion-header.tsx +1 -1
- package/src/components/_components/carousel-cards/carousel-card-1/carousel-card-1.tsx +2 -2
- package/src/components/_components/carousel-cards/carousel-card-2/carousel-card-2.tsx +9 -4
- package/src/components/_components/carousel-cards/carousel-card-3/carousel-card-3.tsx +6 -3
- package/src/components/_components/carousel-cards/carousel-card-4/carousel-card-4.tsx +6 -1
- package/src/components/_components/categories/category-list/category-list.tsx +3 -3
- package/src/components/_components/categories/mega-menu/banner.tsx +7 -3
- package/src/components/_components/categories/mega-menu/column-list.tsx +3 -3
- package/src/components/_components/categories/mega-menu/mega-menu-1.tsx +2 -2
- package/src/components/_components/category-cards/category-card-1/category-card-1.tsx +2 -2
- package/src/components/_components/countdown/count-box.tsx +4 -1
- package/src/components/_components/countdown/count-down.tsx +1 -1
- package/src/components/_components/data-table/table-header.tsx +1 -1
- package/src/components/_components/footer/components/app-store.tsx +1 -1
- package/src/components/_components/footer/components/logo.tsx +2 -2
- package/src/components/_components/footer/components/social-links.tsx +1 -1
- package/src/components/_components/footer/footer-1.tsx +1 -1
- package/src/components/_components/footer/footer-2.tsx +2 -2
- package/src/components/_components/footer/footer-3.tsx +2 -2
- package/src/components/_components/footer/footer-4.tsx +3 -3
- package/src/components/_components/header/components/categories-menu.tsx +3 -3
- package/src/components/_components/header/components/mobile-header.tsx +9 -6
- package/src/components/_components/header/components/user.tsx +5 -5
- package/src/components/_components/header/header.tsx +2 -2
- package/src/components/_components/header/sticky-header.tsx +3 -3
- package/src/components/_components/mini-cart/components/cart-item.tsx +5 -2
- package/src/components/_components/mini-cart/components/empty-view.tsx +2 -2
- package/src/components/_components/mini-cart/components/top-header.tsx +5 -2
- package/src/components/_components/mini-cart/mini-cart.tsx +3 -3
- package/src/components/_components/mobile-navigation/mobile-navigation-bar.tsx +5 -5
- package/src/components/_components/nav-link/nav-link-2.tsx +1 -1
- package/src/components/_components/nav-link/nav-link-3.tsx +1 -1
- package/src/components/_components/navbar/categories.tsx +3 -3
- package/src/components/_components/navbar/category-based-menu/category-based-menu.tsx +1 -1
- package/src/components/_components/navbar/category-based-menu/components/child-categories.tsx +2 -2
- package/src/components/_components/navbar/mega-menu/category-list.tsx +1 -1
- package/src/components/_components/navbar/mega-menu/mega-menu.tsx +1 -1
- package/src/components/_components/navbar/mobile-menu/mobile-menu.tsx +2 -2
- package/src/components/_components/navbar/mobile-menu/render-levels.tsx +3 -3
- package/src/components/_components/navbar/nav-list/nav-item-child.tsx +3 -3
- package/src/components/_components/navbar/nav-list/nav-list.tsx +4 -4
- package/src/components/_components/newsletter/newsletter.tsx +5 -1
- package/src/components/_components/newsletter/social-icons.tsx +1 -1
- package/src/components/_components/page-sidenav/grocery-side-nav/components/link-item.tsx +2 -2
- package/src/components/_components/page-sidenav/grocery-side-nav/components/list-item.tsx +2 -2
- package/src/components/_components/page-sidenav/grocery-side-nav/components/nav-accordion.tsx +2 -2
- package/src/components/_components/page-sidenav/grocery-side-nav/grocery-side-nav.tsx +3 -3
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/list-item.tsx +2 -2
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/nav-accordion.tsx +2 -2
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/render-child.tsx +2 -2
- package/src/components/_components/page-sidenav/health-beauty-side-nav/health-beauty-side-nav.tsx +5 -5
- package/src/components/_components/page-sidenav/side-navbar/components/list-item.tsx +1 -1
- package/src/components/_components/page-sidenav/side-navbar/components/nav-accordion.tsx +3 -3
- package/src/components/_components/page-sidenav/side-navbar/components/render-child.tsx +1 -1
- package/src/components/_components/page-sidenav/side-navbar/side-nav-bar.tsx +4 -4
- package/src/components/_components/page-sidenav/side-navbar-2/components/sidebar-accordion.tsx +1 -1
- package/src/components/_components/page-sidenav/side-navbar-2/side-navbar-2.tsx +2 -2
- package/src/components/_components/product-cards/product-card-1/components/quantity-buttons.tsx +2 -2
- package/src/components/_components/product-cards/product-card-1/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-10/product-card.tsx +9 -5
- package/src/components/_components/product-cards/product-card-11/product-card.tsx +6 -3
- package/src/components/_components/product-cards/product-card-12/product-card.tsx +4 -4
- package/src/components/_components/product-cards/product-card-13/product-card.tsx +6 -3
- package/src/components/_components/product-cards/product-card-14/product-card.tsx +7 -4
- package/src/components/_components/product-cards/product-card-15/product-card.tsx +6 -3
- package/src/components/_components/product-cards/product-card-16/components/quantity-buttons.tsx +2 -2
- package/src/components/_components/product-cards/product-card-16/product-card.tsx +5 -2
- package/src/components/_components/product-cards/product-card-2/components/product-price.tsx +2 -2
- package/src/components/_components/product-cards/product-card-2/product-card.tsx +4 -4
- package/src/components/_components/product-cards/product-card-3/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-3/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-4/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-4/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-5/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-5/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-6/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-6/product-card.tsx +3 -3
- package/src/components/_components/product-cards/product-card-7/components/quantity-buttons.tsx +2 -2
- package/src/components/_components/product-cards/product-card-7/product-card.tsx +5 -2
- package/src/components/_components/product-cards/product-card-8/product-card.tsx +9 -5
- package/src/components/_components/product-cards/product-card-9/components/add-to-cart.tsx +5 -2
- package/src/components/_components/product-cards/product-card-9/product-card.tsx +1 -1
- package/src/components/_components/product-cards/product-price.tsx +2 -2
- package/src/components/_components/product-cards/product-rating.tsx +2 -2
- package/src/components/_components/product-cards/product-title.tsx +1 -1
- package/src/components/_components/product-cards/use-product.ts +1 -1
- package/src/components/_components/product-dimensions/product-dimensions.tsx +1 -1
- package/src/components/_components/product-quantity-buttons/product-quantity-buttons.tsx +2 -2
- package/src/components/_components/products-view/products-grid-view.tsx +2 -2
- package/src/components/_components/products-view/products-list-view.tsx +2 -2
- package/src/components/_components/search-box/components/category-dropdown.tsx +1 -1
- package/src/components/_components/search-box/components/search-result.tsx +1 -1
- package/src/components/_components/search-box/hooks/use-search.ts +1 -1
- package/src/components/_components/search-box/search-input-category.tsx +3 -3
- package/src/components/_components/service-cards/service-card-1/service-card-1.tsx +5 -2
- package/src/components/_components/service-cards/service-card-2/service-card-2.tsx +5 -2
- package/src/components/_components/service-cards/service-card-3/service-card-3.tsx +4 -1
- package/src/components/_components/settings/setting.tsx +3 -3
- package/src/components/_components/side-nav/side-nav.tsx +1 -1
- package/src/components/_components/stories/story-content/story-content.tsx +1 -1
- package/src/components/_components/stories/story-item/story-item.tsx +1 -1
- package/src/components/_components/topbar/top-bar.tsx +6 -3
- package/src/components/_components/wishlist-modal/wishlist-modal-item.tsx +1 -1
- package/src/components-v2/accordion/accordion-header.stories.tsx +28 -0
- package/src/components-v2/categories/category-list/category-list.tsx +2 -2
- package/src/components-v2/categories/category-list/styles.ts +3 -2
- package/src/components-v2/categories/mega-menu/column-list.tsx +1 -1
- package/src/components-v2/categories/mega-menu/mega-menu-1.tsx +6 -3
- package/src/components-v2/categories/mega-menu/mega-menu-2.tsx +2 -2
- package/src/components-v2/header/__tests__/user.test.tsx +12 -12
- package/src/components-v2/header/components/user.tsx +12 -11
- package/src/components-v2/mini-cart/mini-cart.tsx +9 -14
- package/src/components-v2/mobile-navigation/mobile-navigation-bar.tsx +1 -1
- package/src/components-v2/navbar/mobile-menu/mobile-menu.tsx +2 -2
- package/src/components-v2/product-cards/favorite-button.tsx +52 -0
- package/src/components-v2/product-cards/product-card/product-card.tsx +87 -47
- package/src/components-v2/product-cards/product-card-plp/product-card.tsx +140 -51
- package/src/components-v2/product-cards/product-card-plp/styles/index.ts +17 -0
- package/src/components-v2/product-cards/product-card-plp-list/product-card.tsx +76 -42
- package/src/components-v2/product-cards/product-card-search/product-card.tsx +50 -21
- package/src/components-v2/product-cards/product-card-search/styles/index.ts +0 -10
- package/src/components-v2/product-dialog/compound/product-dialog.tsx +39 -15
- package/src/components-v2/product-quantity-buttons/compound/quantity-buttons-root.tsx +22 -7
- package/src/components-v2/product-quantity-variants/index.tsx +1 -1
- package/src/components-v2/products-view/compound/context.ts +46 -1
- package/src/components-v2/products-view/compound/products-grid-view.tsx +23 -14
- package/src/components-v2/products-view/compound/products-list-view.tsx +12 -3
- package/src/components-v2/search-bar/compound/context.ts +24 -3
- package/src/components-v2/search-bar/compound/results-item-lg.tsx +14 -13
- package/src/components-v2/search-bar/compound/results-item-sm.tsx +5 -5
- package/src/components-v2/search-bar/compound/results-suspense.tsx +3 -3
- package/src/components-v2/search-bar/compound/results.tsx +4 -4
- package/src/components-v2/search-bar/compound/textfield-adornment-category.tsx +1 -1
- package/src/components-v2/search-bar/compound/textfield.tsx +3 -3
- package/src/components-v2/search-bar/hooks/use-click-outside.ts +1 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/add-to-wishlist-button.tsx +2 -6
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-bottom-ui.tsx +6 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-dialog.tsx +22 -15
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-list.tsx +8 -7
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/context.ts +8 -8
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-item.tsx +29 -19
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/hooks/use-add-to-wishlist.ts +27 -77
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/index.tsx +1 -9
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-bottom-ui.tsx +7 -2
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog.tsx +20 -12
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-form.tsx +25 -5
- package/src/hooks/use-cart.ts +11 -14
- package/src/hooks/use-favorite.ts +17 -0
- package/src/hooks/use-variants.ts +4 -3
- package/src/pages/account/addresses/address-item.tsx +1 -1
- package/src/pages/account/dashboard-header.tsx +3 -3
- package/src/pages/account/navigation.tsx +5 -2
- package/src/pages/account/no-records.tsx +1 -1
- package/src/pages/account/orders/order-progress.tsx +5 -2
- package/src/pages/account/orders/order-row.tsx +4 -1
- package/src/pages/account/orders/order-summary.tsx +6 -2
- package/src/pages/account/orders/ordered-products.tsx +9 -2
- package/src/pages/account/profile/user-info.tsx +5 -2
- package/src/pages/account/wishlist/create-new-list.tsx +1 -1
- package/src/pages/account/wishlist/wishlist-item.tsx +2 -2
- package/src/pages/checkout/checkout-alt-form/address-card.tsx +5 -2
- package/src/pages/checkout/checkout-alt-form/checkout-step.tsx +3 -3
- package/src/pages/checkout/checkout-alt-form/customer-information.tsx +1 -1
- package/src/pages/checkout/checkout-alt-form/delivery-address.tsx +5 -1
- package/src/pages/checkout/checkout-alt-form/delivery-options.tsx +6 -2
- package/src/pages/checkout/checkout-alt-form/edit-address-form.tsx +1 -1
- package/src/pages/checkout/checkout-alt-form/heading.tsx +2 -2
- package/src/pages/checkout/checkout-alt-form/new-address-form.tsx +9 -4
- package/src/pages/checkout/checkout-alt-form/payment-details.tsx +6 -3
- package/src/pages/checkout/checkout-alt-summary/cart-item.tsx +5 -2
- package/src/pages/checkout/checkout-alt-summary/checkout-alt-summary.tsx +4 -2
- package/src/pages/checkout/checkout-alt-summary/list-item.tsx +2 -2
- package/src/pages/confirmation/address.tsx +4 -1
- package/src/pages/confirmation/confirmation-summary.tsx +6 -3
- package/src/pages/confirmation/ordered-products.tsx +9 -2
- package/src/pages/product-details/available-shops.tsx +5 -2
- package/src/pages/product-details/bopis/find-in-store-modal.tsx +1 -1
- package/src/pages/product-details/bopis/pickup-option-select.tsx +1 -1
- package/src/pages/product-details/frequently-bought.tsx +9 -2
- package/src/pages/product-details/frequently-product-card.tsx +8 -5
- package/src/pages/product-details/product-comment.tsx +7 -2
- package/src/pages/product-details/product-description.tsx +1 -1
- package/src/pages/product-details/product-filter-card.tsx +11 -3
- package/src/pages/product-details/product-intro/product-intro-images.tsx +4 -1
- package/src/pages/product-details/product-intro/product-intro.tsx +8 -5
- package/src/pages/product-details/product-review.tsx +5 -2
- package/src/pages/product-details/related-products.tsx +2 -2
- package/src/pages/product-list/facet-group.tsx +1 -1
- package/src/pages/product-list/list-filter.tsx +5 -2
- package/src/pages/product-list/pagination.tsx +1 -1
- package/src/pages/product-list/quick-view-dialog-content.tsx +2 -2
- package/src/pages/product-list/selected-facets.tsx +1 -1
- package/src/pages/quickorder/order-upload.tsx +1 -1
- package/src/pages/quickorder/quick-order-form.tsx +6 -3
- package/src/pages/quickorder/quick-order-row.tsx +1 -1
- package/src/pages-v2/account/account-navigation.tsx +1 -1
- package/src/pages-v2/account/orders/order-summary.tsx +5 -2
- package/src/pages-v2/account/profile/user-info.tsx +6 -3
- package/src/pages-v2/account/wishlist/wishlist-item.tsx +1 -1
- package/src/pages-v2/cart/__tests__/checkout-form.test.tsx +1 -1
- package/src/pages-v2/cart/estimate-shipping.tsx +3 -0
- package/src/pages-v2/checkout/checkout-alt-form/checkout-step.tsx +4 -4
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/address-card.tsx +1 -1
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/delivery-address.tsx +12 -5
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/new-address-form.tsx +27 -5
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/styles.ts +2 -1
- package/src/pages-v2/checkout/checkout-alt-form/steps/customer-info/customer-information.tsx +27 -7
- package/src/pages-v2/checkout/checkout-alt-form/steps/shipping/delivery-options.tsx +8 -1
- package/src/pages-v2/confirmation/address.tsx +5 -1
- package/src/pages-v2/product-details/available-shops.tsx +4 -1
- package/src/pages-v2/product-details/bopis/find-in-store-button.tsx +1 -1
- package/src/pages-v2/product-details/bopis/find-in-store-modal.tsx +3 -5
- package/src/pages-v2/product-details/product-intro/compound/context.ts +69 -12
- package/src/pages-v2/product-details/product-intro/compound/product-info.tsx +73 -27
- package/src/pages-v2/product-details/product-intro/compound/product-intro-images.tsx +19 -6
- package/src/pages-v2/product-details/product-intro/utils.ts +2 -2
- package/src/pages-v2/product-details/product-tabs.tsx +19 -4
- package/src/pages-v2/product-details/related-products.tsx +3 -3
- package/src/pages-v2/quickorder/context.ts +2 -2
- package/src/pages-v2/quickorder/order-upload.tsx +6 -2
- package/src/pages-v2/quickorder/provider.tsx +24 -9
- package/src/pages-v2/quickorder/quick-order-actions.tsx +2 -2
- package/src/pages-v2/quickorder/quick-order-header.tsx +6 -3
- package/src/pages-v2/quickorder/quick-order-row.tsx +1 -1
- package/src/pages-v2/quickorder/quick-order-table.tsx +10 -4
- package/src/pages-v2/quickorder/quick-order-upload.tsx +2 -2
- package/src/stories/Button.stories.ts +54 -0
- package/src/stories/Button.tsx +35 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/Header.stories.ts +34 -0
- package/src/stories/Header.tsx +54 -0
- package/src/stories/Page.stories.ts +33 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +68 -0
- package/src/theme/build-mui-theme.ts +104 -0
- package/src/theme/components.ts +163 -0
- package/src/theme/emotion-cache.tsx +101 -0
- package/src/theme/theme-colors.ts +205 -0
- package/src/theme/theme-options-sample.ts +69 -0
- package/src/theme/theme-options.ts +172 -0
- package/src/theme/theme-provider.tsx +44 -0
- package/src/theme/typography.ts +22 -0
- package/src/theme/utils.ts +17 -0
- package/tsconfig.json +3 -1
- package/src/api-manager/lib/cart-cookie-handler.ts +0 -14
- package/src/components-v2/product-cards/product-card/components/hover-actions.tsx +0 -37
- package/src/components-v2/product-cards/product-card-plp/components/quantity-buttons.tsx +0 -54
- package/src/components-v2/product-cards/product-card-plp-list/components/add-to-cart.tsx +0 -63
- package/src/components-v2/product-cards/product-card-plp-list/components/favorite-button.tsx +0 -27
- package/src/components-v2/product-cards/use-product.ts +0 -35
- package/src/components-v2/products-view/products-grid-view.tsx +0 -65
- package/src/components-v2/products-view/products-list-view.tsx +0 -66
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/context.ts +0 -2
- /package/src/components-v2/product-cards/{product-card/components/quantity-buttons.tsx → quantity-buttons.tsx} +0 -0
|
@@ -47,7 +47,7 @@ function CustomTabPanel(props: TabPanelProps) {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
const TabsContext = createContext<TabsContext>(null);
|
|
50
|
+
const TabsContext = createContext<TabsContext | null>(null);
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* @category Compound Component
|
|
@@ -70,7 +70,12 @@ export default function ProductTabs({ productAttributes, children }: Props) {
|
|
|
70
70
|
* @category Sub-Component
|
|
71
71
|
*/
|
|
72
72
|
ProductTabs.Tabs = ({ children }: { children: React.ReactNode }) => {
|
|
73
|
-
const
|
|
73
|
+
const ctx = useContext(TabsContext);
|
|
74
|
+
if (!ctx)
|
|
75
|
+
throw new Error(
|
|
76
|
+
"ProductTabs.Tabs must be used inside a ProductTabsContext",
|
|
77
|
+
);
|
|
78
|
+
const { selectedOption, handleOptionClick } = ctx;
|
|
74
79
|
return (
|
|
75
80
|
<StyledTabs
|
|
76
81
|
textColor="primary"
|
|
@@ -100,7 +105,12 @@ ProductTabs.Content = ({
|
|
|
100
105
|
index: number;
|
|
101
106
|
children: React.ReactNode;
|
|
102
107
|
}) => {
|
|
103
|
-
const
|
|
108
|
+
const ctx = useContext(TabsContext);
|
|
109
|
+
if (!ctx)
|
|
110
|
+
throw new Error(
|
|
111
|
+
"ProductTabs.Tabs must be used inside a ProductTabsContext",
|
|
112
|
+
);
|
|
113
|
+
const { selectedOption } = ctx;
|
|
104
114
|
return (
|
|
105
115
|
<CustomTabPanel value={selectedOption} index={index}>
|
|
106
116
|
{children}
|
|
@@ -112,6 +122,11 @@ ProductTabs.Content = ({
|
|
|
112
122
|
* @category Sub-Component
|
|
113
123
|
*/
|
|
114
124
|
ProductTabs.Description = () => {
|
|
115
|
-
const
|
|
125
|
+
const ctx = useContext(TabsContext);
|
|
126
|
+
if (!ctx)
|
|
127
|
+
throw new Error(
|
|
128
|
+
"ProductTabs.Tabs must be used inside a ProductTabsContext",
|
|
129
|
+
);
|
|
130
|
+
const { productAttributes } = ctx;
|
|
116
131
|
return <ProductDescription attributes={productAttributes} />;
|
|
117
132
|
};
|
|
@@ -42,10 +42,10 @@ export default function RelatedProducts({ RecordId }: Props) {
|
|
|
42
42
|
<ProductCard.Rating />
|
|
43
43
|
<ProductCard.Price />
|
|
44
44
|
</ProductCard.Info>
|
|
45
|
-
<ProductCard.Actions>
|
|
45
|
+
{/* <ProductCard.Actions>
|
|
46
46
|
<ProductCard.QuantityButtons />
|
|
47
|
-
|
|
48
|
-
</ProductCard.Actions>
|
|
47
|
+
<ProductCard.HoverActions />
|
|
48
|
+
</ProductCard.Actions> */}
|
|
49
49
|
</ProductCard.Body>
|
|
50
50
|
</ProductCard>
|
|
51
51
|
</Grid>
|
|
@@ -16,7 +16,7 @@ export type QuickOrderContextType = {
|
|
|
16
16
|
handleRowUpdate: (
|
|
17
17
|
id: number,
|
|
18
18
|
value: string,
|
|
19
|
-
quantity: string
|
|
19
|
+
quantity: string,
|
|
20
20
|
) => Promise<void>;
|
|
21
21
|
handleRowDelete: (id: number) => void;
|
|
22
22
|
handleAddRows: () => void;
|
|
@@ -27,7 +27,7 @@ export type QuickOrderContextType = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const QuickOrderContext = createContext<QuickOrderContextType | null>(
|
|
30
|
-
null
|
|
30
|
+
null,
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
export const useQuickOrder = () => {
|
|
@@ -39,7 +39,7 @@ export default function OrderUpload({ onUploadItems }: OrderUploadProps) {
|
|
|
39
39
|
|
|
40
40
|
const handleReject = (rejections: FileRejection[]) => {
|
|
41
41
|
const msgs = rejections.map(
|
|
42
|
-
(r) => `${r.file.name} ${t("fileRejectionMsg")}
|
|
42
|
+
(r) => `${r.file.name} ${t("fileRejectionMsg")}`,
|
|
43
43
|
);
|
|
44
44
|
setFileRejections(msgs);
|
|
45
45
|
};
|
|
@@ -137,7 +137,11 @@ export default function OrderUpload({ onUploadItems }: OrderUploadProps) {
|
|
|
137
137
|
))}
|
|
138
138
|
</Alert>
|
|
139
139
|
)}
|
|
140
|
-
<DropZone
|
|
140
|
+
<DropZone
|
|
141
|
+
onChange={getFiles}
|
|
142
|
+
handleReject={handleReject}
|
|
143
|
+
accept={accept}
|
|
144
|
+
/>
|
|
141
145
|
</>
|
|
142
146
|
);
|
|
143
147
|
}
|
|
@@ -26,7 +26,9 @@ export default function QuickOrderProvider({
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const initTable = useCallback(() => {
|
|
29
|
-
const newRows = Array.from({ length: 3 }, (_, i) =>
|
|
29
|
+
const newRows = Array.from({ length: 3 }, (_, i) =>
|
|
30
|
+
generateEmptyRow(i + 1),
|
|
31
|
+
);
|
|
30
32
|
setRows(newRows);
|
|
31
33
|
}, []);
|
|
32
34
|
|
|
@@ -36,7 +38,7 @@ export default function QuickOrderProvider({
|
|
|
36
38
|
rowId: number,
|
|
37
39
|
value: string,
|
|
38
40
|
found: boolean,
|
|
39
|
-
qty: string
|
|
41
|
+
qty: string,
|
|
40
42
|
): QuickOrderRowData => {
|
|
41
43
|
let rowError = RowError.None;
|
|
42
44
|
if (
|
|
@@ -56,7 +58,7 @@ export default function QuickOrderProvider({
|
|
|
56
58
|
rowError,
|
|
57
59
|
};
|
|
58
60
|
},
|
|
59
|
-
[]
|
|
61
|
+
[],
|
|
60
62
|
);
|
|
61
63
|
|
|
62
64
|
const getProductSearchResults = useCallback(
|
|
@@ -64,13 +66,13 @@ export default function QuickOrderProvider({
|
|
|
64
66
|
const results = await searchProducts({ itemIds });
|
|
65
67
|
return results;
|
|
66
68
|
},
|
|
67
|
-
[searchProducts]
|
|
69
|
+
[searchProducts],
|
|
68
70
|
);
|
|
69
71
|
|
|
70
72
|
const handleRowUpdate = async (
|
|
71
73
|
id: number,
|
|
72
74
|
value: string,
|
|
73
|
-
quantity: string
|
|
75
|
+
quantity: string,
|
|
74
76
|
) => {
|
|
75
77
|
const updated = [...rows];
|
|
76
78
|
const idx = updated.findIndex((row) => row.id === id);
|
|
@@ -84,7 +86,13 @@ export default function QuickOrderProvider({
|
|
|
84
86
|
product = (response && response[0]) || null;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
updated[idx] = generateRowData(
|
|
89
|
+
updated[idx] = generateRowData(
|
|
90
|
+
!!product ? product : null,
|
|
91
|
+
id,
|
|
92
|
+
value,
|
|
93
|
+
!!product,
|
|
94
|
+
quantity,
|
|
95
|
+
);
|
|
88
96
|
setRows(updated);
|
|
89
97
|
};
|
|
90
98
|
|
|
@@ -136,11 +144,17 @@ export default function QuickOrderProvider({
|
|
|
136
144
|
items.forEach((it: any) => {
|
|
137
145
|
const product = response?.find(
|
|
138
146
|
(r: any) =>
|
|
139
|
-
r.ItemId?.toLowerCase() === it.itemId.toString().toLowerCase()
|
|
147
|
+
r.ItemId?.toLowerCase() === it.itemId.toString().toLowerCase(),
|
|
140
148
|
);
|
|
141
149
|
const qty = it.qty || 1;
|
|
142
150
|
updated.push(
|
|
143
|
-
generateRowData(
|
|
151
|
+
generateRowData(
|
|
152
|
+
product || null,
|
|
153
|
+
rowId++,
|
|
154
|
+
it.itemId,
|
|
155
|
+
!!product,
|
|
156
|
+
qty.toString(),
|
|
157
|
+
),
|
|
144
158
|
);
|
|
145
159
|
});
|
|
146
160
|
|
|
@@ -155,7 +169,8 @@ export default function QuickOrderProvider({
|
|
|
155
169
|
if (!rows.length) return;
|
|
156
170
|
const header = "SKU,Quantity\n";
|
|
157
171
|
const csv =
|
|
158
|
-
header +
|
|
172
|
+
header +
|
|
173
|
+
rows.map(({ value, quantity }) => `${value},${quantity}`).join("\n");
|
|
159
174
|
const uri = "data:text/csv;charset=utf-8," + csv;
|
|
160
175
|
const link = document.createElement("a");
|
|
161
176
|
link.setAttribute("href", encodeURI(uri));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { FlexBox } from "
|
|
4
|
-
import { BorderShadowCard } from "
|
|
3
|
+
import { FlexBox } from "@evenicanpm/storefront-core/src/components-v2/flex-box/index";
|
|
4
|
+
import { BorderShadowCard } from "@evenicanpm/storefront-core/src/components-v2/BoxShadowCard";
|
|
5
5
|
import { Button } from "@mui/material";
|
|
6
6
|
import { useQuickOrder } from "./context";
|
|
7
7
|
import { useTranslations } from "next-intl";
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { FlexBox } from "
|
|
4
|
-
import { BorderShadowCard } from "
|
|
5
|
-
import {
|
|
3
|
+
import { FlexBox } from "@evenicanpm/storefront-core/src/components-v2/flex-box/index";
|
|
4
|
+
import { BorderShadowCard } from "@evenicanpm/storefront-core/src/components-v2/BoxShadowCard";
|
|
5
|
+
import {
|
|
6
|
+
H2,
|
|
7
|
+
Span,
|
|
8
|
+
} from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
6
9
|
import { useTranslations } from "next-intl";
|
|
7
10
|
|
|
8
11
|
const QuickOrderHeader = () => {
|
|
@@ -62,7 +62,7 @@ export default function QuickOrderRow({
|
|
|
62
62
|
_.debounce((val: string) => {
|
|
63
63
|
onRowChange(id, val, quantity);
|
|
64
64
|
}, 500),
|
|
65
|
-
[onRowChange, id, quantity]
|
|
65
|
+
[onRowChange, id, quantity],
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
const handleValueChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
@@ -8,13 +8,14 @@ import {
|
|
|
8
8
|
TableHead,
|
|
9
9
|
TableRow,
|
|
10
10
|
} from "@mui/material";
|
|
11
|
-
import { BorderShadowCard } from "
|
|
11
|
+
import { BorderShadowCard } from "@evenicanpm/storefront-core/src/components-v2/BoxShadowCard";
|
|
12
12
|
import QuickOrderRow from "./quick-order-row";
|
|
13
13
|
import { useQuickOrder } from "./context";
|
|
14
14
|
import { useTranslations } from "next-intl";
|
|
15
15
|
|
|
16
16
|
const QuickOrderTable = () => {
|
|
17
|
-
const { rows, handleRowUpdate, handleRowDelete, handleAddRows } =
|
|
17
|
+
const { rows, handleRowUpdate, handleRowDelete, handleAddRows } =
|
|
18
|
+
useQuickOrder();
|
|
18
19
|
const t = useTranslations("QuickOrder");
|
|
19
20
|
|
|
20
21
|
return (
|
|
@@ -29,9 +30,14 @@ const QuickOrderTable = () => {
|
|
|
29
30
|
<TableCell sx={{ color: "white", width: { xs: "20%" } }}>
|
|
30
31
|
{t("Table.quantity")}
|
|
31
32
|
</TableCell>
|
|
32
|
-
<TableCell sx={{ color: "white" }}>
|
|
33
|
+
<TableCell sx={{ color: "white" }}>
|
|
34
|
+
{t("Table.itemName")}
|
|
35
|
+
</TableCell>
|
|
33
36
|
<TableCell
|
|
34
|
-
sx={{
|
|
37
|
+
sx={{
|
|
38
|
+
color: "white",
|
|
39
|
+
display: { xs: "none", sm: "table-cell" },
|
|
40
|
+
}}
|
|
35
41
|
>
|
|
36
42
|
{t("Table.price")}
|
|
37
43
|
</TableCell>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { FlexBox } from "
|
|
4
|
-
import { BorderShadowCard } from "
|
|
3
|
+
import { FlexBox } from "@evenicanpm/storefront-core/src/components-v2/flex-box/index";
|
|
4
|
+
import { BorderShadowCard } from "@evenicanpm/storefront-core/src/components-v2/BoxShadowCard";
|
|
5
5
|
import OrderUpload from "./order-upload";
|
|
6
6
|
import { useQuickOrder } from "./context";
|
|
7
7
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
|
|
3
|
+
import { fn } from 'storybook/test';
|
|
4
|
+
|
|
5
|
+
import { Button } from './Button';
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Example/Button',
|
|
10
|
+
component: Button,
|
|
11
|
+
parameters: {
|
|
12
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
13
|
+
layout: 'centered',
|
|
14
|
+
},
|
|
15
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
18
|
+
argTypes: {
|
|
19
|
+
backgroundColor: { control: 'color' },
|
|
20
|
+
},
|
|
21
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
22
|
+
args: { onClick: fn() },
|
|
23
|
+
} satisfies Meta<typeof Button>;
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
|
|
28
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
29
|
+
export const Primary: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
primary: true,
|
|
32
|
+
label: 'Button',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Secondary: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
label: 'Button',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Large: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
size: 'large',
|
|
45
|
+
label: 'Button',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Small: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
size: 'small',
|
|
52
|
+
label: 'Button',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import './button.css';
|
|
2
|
+
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
/** Is this the principal call to action on the page? */
|
|
5
|
+
primary?: boolean;
|
|
6
|
+
/** What background color to use */
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
/** How large should the button be? */
|
|
9
|
+
size?: 'small' | 'medium' | 'large';
|
|
10
|
+
/** Button contents */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Optional click handler */
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Primary UI component for user interaction */
|
|
17
|
+
export const Button = ({
|
|
18
|
+
primary = false,
|
|
19
|
+
size = 'medium',
|
|
20
|
+
backgroundColor,
|
|
21
|
+
label,
|
|
22
|
+
...props
|
|
23
|
+
}: ButtonProps) => {
|
|
24
|
+
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
25
|
+
return (
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
|
29
|
+
style={{ backgroundColor }}
|
|
30
|
+
{...props}
|
|
31
|
+
>
|
|
32
|
+
{label}
|
|
33
|
+
</button>
|
|
34
|
+
);
|
|
35
|
+
};
|