@propeller-commerce/propeller-v2-react-ui 0.11.0 → 0.11.1
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/CHANGELOG.md +51 -0
- package/dist/index.cjs +47 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -6
- package/dist/index.d.ts +69 -6
- package/dist/index.js +47 -6
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4973,10 +4973,32 @@ interface MenuProps {
|
|
|
4973
4973
|
menuClass?: string;
|
|
4974
4974
|
/**
|
|
4975
4975
|
* Main menu display type.
|
|
4976
|
-
* - 'dropdown-vertical': nested flyout panels on hover (default)
|
|
4977
|
-
*
|
|
4976
|
+
* - 'dropdown-vertical': nested flyout panels on hover (default). Lays each
|
|
4977
|
+
* level out as another 256px column, so it caps at 5 levels.
|
|
4978
|
+
* - 'jumbotron': full-width mega-menu panel showing all subcategories.
|
|
4979
|
+
* - 'accordion': inline vertical nesting at every breakpoint. The only style
|
|
4980
|
+
* with no depth ceiling — use it for trees deeper than a flyout can show.
|
|
4981
|
+
* (Also the mobile presentation of the other styles.)
|
|
4982
|
+
*
|
|
4983
|
+
* Typed as `MenuStyle | (string & {})` so the built-ins autocomplete while
|
|
4984
|
+
* any other value still type-checks — pair a custom value with
|
|
4985
|
+
* {@link MenuProps.renderMenu} to render it. Without `renderMenu`, an
|
|
4986
|
+
* unrecognised value falls back to 'accordion' and warns in development.
|
|
4987
|
+
*/
|
|
4988
|
+
menuStyle?: MenuStyle | (string & {});
|
|
4989
|
+
/**
|
|
4990
|
+
* Render the menu yourself instead of using a built-in `menuStyle`.
|
|
4991
|
+
*
|
|
4992
|
+
* The built-in styles cover the common shapes, but they are just three
|
|
4993
|
+
* arrangements of the same tree — this is the escape hatch for a fourth.
|
|
4994
|
+
* Receives the fetched categories plus the state and helpers the built-in
|
|
4995
|
+
* renderers use, so a custom menu gets working open/close behaviour, URL
|
|
4996
|
+
* building and click handling without reimplementing them.
|
|
4997
|
+
*
|
|
4998
|
+
* Return `null` to fall through to the `menuStyle` rendering (useful for
|
|
4999
|
+
* overriding a single breakpoint or category).
|
|
4978
5000
|
*/
|
|
4979
|
-
|
|
5001
|
+
renderMenu?: (ctx: MenuRenderContext) => React$1.ReactNode;
|
|
4980
5002
|
/**
|
|
4981
5003
|
* URL pattern for category links.
|
|
4982
5004
|
* Use `{categoryId}` and `{slug}` as placeholders.
|
|
@@ -5010,9 +5032,50 @@ interface MenuProps {
|
|
|
5010
5032
|
/** Configuration object passed to the component */
|
|
5011
5033
|
configuration?: any;
|
|
5012
5034
|
}
|
|
5035
|
+
/** Every style with a built-in renderer — the source of truth for the union. */
|
|
5036
|
+
declare const RENDERED_STYLES: readonly ["dropdown-vertical", "jumbotron", "accordion"];
|
|
5037
|
+
type MenuStyle = (typeof RENDERED_STYLES)[number];
|
|
5013
5038
|
/**
|
|
5014
|
-
*
|
|
5015
|
-
*
|
|
5039
|
+
* Everything a custom `renderMenu` needs to draw the tree: the data, the
|
|
5040
|
+
* open/close state, and the same helpers the built-in styles use.
|
|
5041
|
+
*
|
|
5042
|
+
* Exposing the helpers rather than just the categories is the point — URL
|
|
5043
|
+
* building respects `getUrl`/`configuration`, `handleItemClick` honours
|
|
5044
|
+
* `onMenuItemClick`, and the `openPath` helpers give working expand/collapse.
|
|
5045
|
+
* A custom renderer that only got `categories` would have to reimplement all
|
|
5046
|
+
* of that and would drift from the built-ins.
|
|
5047
|
+
*/
|
|
5048
|
+
interface MenuRenderContext {
|
|
5049
|
+
/** Root-level categories of the fetched tree. */
|
|
5050
|
+
categories: MenuCategory[];
|
|
5051
|
+
/** True while the internal fetch is in flight (never when `tree` is passed). */
|
|
5052
|
+
isLoading: boolean;
|
|
5053
|
+
/** True when the internal fetch failed. */
|
|
5054
|
+
hasError: boolean;
|
|
5055
|
+
/** Levels that may be rendered, after the style's cap is applied. */
|
|
5056
|
+
maxDepth: number;
|
|
5057
|
+
/** Children of `cat`, minus entries with no name or slug. */
|
|
5058
|
+
getSubCategories: (cat: MenuCategory) => MenuCategory[];
|
|
5059
|
+
/** Localised display name. */
|
|
5060
|
+
getCategoryName: (cat: MenuCategory) => string;
|
|
5061
|
+
/** Href honouring `getUrl` when provided, else `configuration.urls`. */
|
|
5062
|
+
getCategoryUrl: (cat: MenuCategory) => string;
|
|
5063
|
+
/** Click handler that fires `onMenuItemClick` and suppresses navigation. */
|
|
5064
|
+
handleItemClick: (cat: MenuCategory, e: React$1.MouseEvent) => void;
|
|
5065
|
+
/** Currently open branch as category ids, root → deepest. */
|
|
5066
|
+
openPath: number[];
|
|
5067
|
+
/** Is `categoryId` the open branch at `level` (0-based)? */
|
|
5068
|
+
isOpenAt: (level: number, categoryId: number) => boolean;
|
|
5069
|
+
/** Open a branch at `level`, closing anything deeper. Pass null to close. */
|
|
5070
|
+
openAt: (level: number, categoryId: number | null) => void;
|
|
5071
|
+
/** Toggle a branch at `level` — the accordion's click behaviour. */
|
|
5072
|
+
toggleAt: (level: number, categoryId: number) => void;
|
|
5073
|
+
}
|
|
5074
|
+
/**
|
|
5075
|
+
* Renders a multi-level category navigation menu from the fetched category
|
|
5076
|
+
* tree: a dropdown flyout or jumbotron mega-menu on desktop, an accordion on
|
|
5077
|
+
* mobile — or an accordion on every breakpoint when `menuStyle="accordion"`,
|
|
5078
|
+
* which is the option to pick for trees deeper than a flyout can lay out.
|
|
5016
5079
|
*
|
|
5017
5080
|
* @remarks Uses {@link useMenu} to fetch the category hierarchy.
|
|
5018
5081
|
*/
|
|
@@ -7319,4 +7382,4 @@ declare function DefaultProductBadges(props: BadgesComponentProps): React__defau
|
|
|
7319
7382
|
*/
|
|
7320
7383
|
declare function DefaultProductSurcharges(props: ProductSurchargesComponentProps): React__default.JSX.Element | null;
|
|
7321
7384
|
|
|
7322
|
-
export { AccountIconAndMenu, type AccountIconAndMenuProps, ActionCode, type ActionCodeProps, type AddContactFormState, type AddItemOptions, _default$1 as AddToCart, type AddToCartProps, AddToFavorite, type AddToFavoriteProps, AddressCardExport as AddressCard, type AddressCardProps, type AddressInput, AddressSelector, type AddressSelectorProps, type AttributeDisplayItem, type AttributeGroup, BreadcrumbsWithProvider as Breadcrumbs, type BreadcrumbsProps, CartBonusItems, type CartBonusItemsProps, CartCarriers, type CartCarriersProps, CartIconAndSidebar, type CartIconAndSidebarProps, type CartInitConfig, CartItemExport as CartItem, type CartItemProps, CartOverview, type CartOverviewProps, CartPaymethods, type CartPaymethodsProps, CartSummary, type CartSummaryProps, CategoryDescription, type CategoryDescriptionProps, CategoryShortDescriptionWithProvider as CategoryShortDescription, type CategoryShortDescriptionProps, ClusterCardExport as ClusterCard, type ClusterCardProps, ClusterConfigurator, type ClusterConfiguratorProps, ClusterInfo, type ClusterInfoProps, ClusterOptions, type ClusterOptionsProps, CompanySwitcher, type CompanySwitcherProps, type ConfiguredSetting, _default$1 as DefaultAddToCart, AddToFavorite as DefaultAddToFavorite, _default as DefaultItemStock, DefaultProductBadges, ProductBulkPrices as DefaultProductBulkPrices, ProductBundles as DefaultProductBundles, DefaultProductImage, ProductPriceDisplay as DefaultProductPrice, DefaultProductSurcharges, DeliveryDate, type DeliveryDateProps, FavoriteListDetails, type FavoriteListDetailsProps, type FavoriteListFormData, FavoriteListItemExport as FavoriteListItem, type FavoriteListItemProps, FavoriteLists, type FavoriteListsProps, type FetchActiveCartConfig, type FetchCrossupsellsInput, ForgotPassword, type ForgotPasswordProps, type GetCrossupsellsOptions, GridFilters, GridFiltersPanel, type GridFiltersPanelProps, type GridFiltersProps, GridPagination, type GridPaginationProps, GridTitleWithProvider as GridTitle, type GridTitleProps, GridToolbar, type GridToolbarProps, _default as ItemStock, type ItemStockProps, ItemsOverview, type ItemsOverviewProps, LoginFormExport as LoginForm, type LoginFormProps, LoginToOrderButton, type LoginToOrderButtonProps, MachineCard, type MachineCardProps, MachineGrid, type MachineGridProps, type MachineListingState, Menu, type MenuCategory, type MenuProps, OrderActions, type OrderActionsProps, OrderBonusItems, type OrderBonusItemsProps, OrderItemCard, type OrderItemCardProps, OrderList, type OrderListProps, type OrderSearchForm, OrderShipments, type OrderShipmentsProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, type PlaceOrderOptions, PriceToggle, type PriceToggleProps, ProductBulkPricesWithProvider as ProductBulkPrices, type ProductBulkPricesProps, ProductBundles, type ProductBundlesProps, ProductCard, type ProductCardProps, ProductDescription, type ProductDescriptionProps, ProductDownloads, type ProductDownloadsProps, ProductGallery, type ProductGalleryProps, ProductGridCompound as ProductGrid, type ProductGridConfig, ProductGridConfigProvider, type ProductGridProps, ProductInfoExport as ProductInfo, type ProductInfoProps, ProductPriceWithProvider as ProductPrice, type ProductPriceProps, ProductShortDescriptionWithProvider as ProductShortDescription, type ProductShortDescriptionProps, ProductSlider, type ProductSliderProps, ProductSpecifications, type ProductSpecificationsProps, ProductTabs, type ProductTabsProps, ProductVideos, type ProductVideosProps, type PropellerDeps, PropellerDepsProvider, type PropellerDepsProviderProps, type PropellerInfra, PropellerProvider, type PropellerProviderProps, type PropellerScope, PurchaseAuthorizationConfigurator, type PurchaseAuthorizationConfiguratorProps, PurchaseAuthorizationRequests, type PurchaseAuthorizationRequestsProps, QuickOrder, type QuickOrderLine, type QuickOrderMatch, type QuickOrderProps, type QuickOrderSubmitResult, type QuickOrderUploadLine, QuoteActions, type QuoteActionsProps, RegisterForm, type RegisterFormProps, type ResolveSpec, type RowEdit, SearchBar, type SearchBarProps, type UseAddressOptions, type UseAddressReturn, type LoginResult as UseAuthLoginResult, type UseAuthOptions, type RegisterContactInput as UseAuthRegisterContactInput, type RegisterCustomerInput as UseAuthRegisterCustomerInput, type UseAuthReturn, type UseCartOptions, type UseCartReturn, type UseCheckoutOptions, type UseCheckoutReturn, type UseClusterConfiguratorOptions, type UseClusterConfiguratorReturn, type UseCompanyOptions, type UseCompanyReturn, type UseFavoritesOptions, type UseFavoritesReturn, type UseMachinesOptions, type UseMachinesReturn, type UseMenuOptions, type UseMenuReturn, type UseOrdersOptions, type UseOrdersReturn, type BundleItem as UseProductBundlesBundleItem, type UseProductBundlesOptions, type UseProductBundlesReturn, type UseProductInfoOptions, type UseProductInfoReturn, type UseProductSearchOptions, type UseProductSearchReturn, type UseProductSliderOptions, type UseProductSliderReturn, type UseProductSpecsOptions, type UseProductSpecsReturn, type UsePurchaseAuthorizationConfiguratorOptions, type UsePurchaseAuthorizationConfiguratorReturn, type UsePurchaseAuthorizationRequestsOptions, type UsePurchaseAuthorizationRequestsReturn, type UseQuickOrderOptions, type UseQuickOrderReturn, type UseSparePartsOptions, type UseSparePartsReturn, UserDetails, type UserDetailsProps, buildRootMachinesQuery, fetchActiveCart, initCart, mergeAnonymousCart, useAddress, useAuth, useCart, useCheckout, useClusterConfigurator, useCompany, useFavorites, useInfraProps, useMachines, useMenu, useOrders, useProductBundles, useProductGridConfig, useProductInfo, useProductSearch, useProductSlider, useProductSpecs, usePropellerContext, usePropellerDeps, usePropellerScope, usePurchaseAuthorizationConfigurator, usePurchaseAuthorizationRequests, useQuickOrder, useRequiredPropellerDeps, useResolvedProps, useServices, useSpareParts, useUserMode };
|
|
7385
|
+
export { AccountIconAndMenu, type AccountIconAndMenuProps, ActionCode, type ActionCodeProps, type AddContactFormState, type AddItemOptions, _default$1 as AddToCart, type AddToCartProps, AddToFavorite, type AddToFavoriteProps, AddressCardExport as AddressCard, type AddressCardProps, type AddressInput, AddressSelector, type AddressSelectorProps, type AttributeDisplayItem, type AttributeGroup, BreadcrumbsWithProvider as Breadcrumbs, type BreadcrumbsProps, CartBonusItems, type CartBonusItemsProps, CartCarriers, type CartCarriersProps, CartIconAndSidebar, type CartIconAndSidebarProps, type CartInitConfig, CartItemExport as CartItem, type CartItemProps, CartOverview, type CartOverviewProps, CartPaymethods, type CartPaymethodsProps, CartSummary, type CartSummaryProps, CategoryDescription, type CategoryDescriptionProps, CategoryShortDescriptionWithProvider as CategoryShortDescription, type CategoryShortDescriptionProps, ClusterCardExport as ClusterCard, type ClusterCardProps, ClusterConfigurator, type ClusterConfiguratorProps, ClusterInfo, type ClusterInfoProps, ClusterOptions, type ClusterOptionsProps, CompanySwitcher, type CompanySwitcherProps, type ConfiguredSetting, _default$1 as DefaultAddToCart, AddToFavorite as DefaultAddToFavorite, _default as DefaultItemStock, DefaultProductBadges, ProductBulkPrices as DefaultProductBulkPrices, ProductBundles as DefaultProductBundles, DefaultProductImage, ProductPriceDisplay as DefaultProductPrice, DefaultProductSurcharges, DeliveryDate, type DeliveryDateProps, FavoriteListDetails, type FavoriteListDetailsProps, type FavoriteListFormData, FavoriteListItemExport as FavoriteListItem, type FavoriteListItemProps, FavoriteLists, type FavoriteListsProps, type FetchActiveCartConfig, type FetchCrossupsellsInput, ForgotPassword, type ForgotPasswordProps, type GetCrossupsellsOptions, GridFilters, GridFiltersPanel, type GridFiltersPanelProps, type GridFiltersProps, GridPagination, type GridPaginationProps, GridTitleWithProvider as GridTitle, type GridTitleProps, GridToolbar, type GridToolbarProps, _default as ItemStock, type ItemStockProps, ItemsOverview, type ItemsOverviewProps, LoginFormExport as LoginForm, type LoginFormProps, LoginToOrderButton, type LoginToOrderButtonProps, MachineCard, type MachineCardProps, MachineGrid, type MachineGridProps, type MachineListingState, Menu, type MenuCategory, type MenuProps, type MenuRenderContext, type MenuStyle, OrderActions, type OrderActionsProps, OrderBonusItems, type OrderBonusItemsProps, OrderItemCard, type OrderItemCardProps, OrderList, type OrderListProps, type OrderSearchForm, OrderShipments, type OrderShipmentsProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, type PlaceOrderOptions, PriceToggle, type PriceToggleProps, ProductBulkPricesWithProvider as ProductBulkPrices, type ProductBulkPricesProps, ProductBundles, type ProductBundlesProps, ProductCard, type ProductCardProps, ProductDescription, type ProductDescriptionProps, ProductDownloads, type ProductDownloadsProps, ProductGallery, type ProductGalleryProps, ProductGridCompound as ProductGrid, type ProductGridConfig, ProductGridConfigProvider, type ProductGridProps, ProductInfoExport as ProductInfo, type ProductInfoProps, ProductPriceWithProvider as ProductPrice, type ProductPriceProps, ProductShortDescriptionWithProvider as ProductShortDescription, type ProductShortDescriptionProps, ProductSlider, type ProductSliderProps, ProductSpecifications, type ProductSpecificationsProps, ProductTabs, type ProductTabsProps, ProductVideos, type ProductVideosProps, type PropellerDeps, PropellerDepsProvider, type PropellerDepsProviderProps, type PropellerInfra, PropellerProvider, type PropellerProviderProps, type PropellerScope, PurchaseAuthorizationConfigurator, type PurchaseAuthorizationConfiguratorProps, PurchaseAuthorizationRequests, type PurchaseAuthorizationRequestsProps, QuickOrder, type QuickOrderLine, type QuickOrderMatch, type QuickOrderProps, type QuickOrderSubmitResult, type QuickOrderUploadLine, QuoteActions, type QuoteActionsProps, RegisterForm, type RegisterFormProps, type ResolveSpec, type RowEdit, SearchBar, type SearchBarProps, type UseAddressOptions, type UseAddressReturn, type LoginResult as UseAuthLoginResult, type UseAuthOptions, type RegisterContactInput as UseAuthRegisterContactInput, type RegisterCustomerInput as UseAuthRegisterCustomerInput, type UseAuthReturn, type UseCartOptions, type UseCartReturn, type UseCheckoutOptions, type UseCheckoutReturn, type UseClusterConfiguratorOptions, type UseClusterConfiguratorReturn, type UseCompanyOptions, type UseCompanyReturn, type UseFavoritesOptions, type UseFavoritesReturn, type UseMachinesOptions, type UseMachinesReturn, type UseMenuOptions, type UseMenuReturn, type UseOrdersOptions, type UseOrdersReturn, type BundleItem as UseProductBundlesBundleItem, type UseProductBundlesOptions, type UseProductBundlesReturn, type UseProductInfoOptions, type UseProductInfoReturn, type UseProductSearchOptions, type UseProductSearchReturn, type UseProductSliderOptions, type UseProductSliderReturn, type UseProductSpecsOptions, type UseProductSpecsReturn, type UsePurchaseAuthorizationConfiguratorOptions, type UsePurchaseAuthorizationConfiguratorReturn, type UsePurchaseAuthorizationRequestsOptions, type UsePurchaseAuthorizationRequestsReturn, type UseQuickOrderOptions, type UseQuickOrderReturn, type UseSparePartsOptions, type UseSparePartsReturn, UserDetails, type UserDetailsProps, buildRootMachinesQuery, fetchActiveCart, initCart, mergeAnonymousCart, useAddress, useAuth, useCart, useCheckout, useClusterConfigurator, useCompany, useFavorites, useInfraProps, useMachines, useMenu, useOrders, useProductBundles, useProductGridConfig, useProductInfo, useProductSearch, useProductSlider, useProductSpecs, usePropellerContext, usePropellerDeps, usePropellerScope, usePurchaseAuthorizationConfigurator, usePurchaseAuthorizationRequests, useQuickOrder, useRequiredPropellerDeps, useResolvedProps, useServices, useSpareParts, useUserMode };
|
package/dist/index.d.ts
CHANGED
|
@@ -4973,10 +4973,32 @@ interface MenuProps {
|
|
|
4973
4973
|
menuClass?: string;
|
|
4974
4974
|
/**
|
|
4975
4975
|
* Main menu display type.
|
|
4976
|
-
* - 'dropdown-vertical': nested flyout panels on hover (default)
|
|
4977
|
-
*
|
|
4976
|
+
* - 'dropdown-vertical': nested flyout panels on hover (default). Lays each
|
|
4977
|
+
* level out as another 256px column, so it caps at 5 levels.
|
|
4978
|
+
* - 'jumbotron': full-width mega-menu panel showing all subcategories.
|
|
4979
|
+
* - 'accordion': inline vertical nesting at every breakpoint. The only style
|
|
4980
|
+
* with no depth ceiling — use it for trees deeper than a flyout can show.
|
|
4981
|
+
* (Also the mobile presentation of the other styles.)
|
|
4982
|
+
*
|
|
4983
|
+
* Typed as `MenuStyle | (string & {})` so the built-ins autocomplete while
|
|
4984
|
+
* any other value still type-checks — pair a custom value with
|
|
4985
|
+
* {@link MenuProps.renderMenu} to render it. Without `renderMenu`, an
|
|
4986
|
+
* unrecognised value falls back to 'accordion' and warns in development.
|
|
4987
|
+
*/
|
|
4988
|
+
menuStyle?: MenuStyle | (string & {});
|
|
4989
|
+
/**
|
|
4990
|
+
* Render the menu yourself instead of using a built-in `menuStyle`.
|
|
4991
|
+
*
|
|
4992
|
+
* The built-in styles cover the common shapes, but they are just three
|
|
4993
|
+
* arrangements of the same tree — this is the escape hatch for a fourth.
|
|
4994
|
+
* Receives the fetched categories plus the state and helpers the built-in
|
|
4995
|
+
* renderers use, so a custom menu gets working open/close behaviour, URL
|
|
4996
|
+
* building and click handling without reimplementing them.
|
|
4997
|
+
*
|
|
4998
|
+
* Return `null` to fall through to the `menuStyle` rendering (useful for
|
|
4999
|
+
* overriding a single breakpoint or category).
|
|
4978
5000
|
*/
|
|
4979
|
-
|
|
5001
|
+
renderMenu?: (ctx: MenuRenderContext) => React$1.ReactNode;
|
|
4980
5002
|
/**
|
|
4981
5003
|
* URL pattern for category links.
|
|
4982
5004
|
* Use `{categoryId}` and `{slug}` as placeholders.
|
|
@@ -5010,9 +5032,50 @@ interface MenuProps {
|
|
|
5010
5032
|
/** Configuration object passed to the component */
|
|
5011
5033
|
configuration?: any;
|
|
5012
5034
|
}
|
|
5035
|
+
/** Every style with a built-in renderer — the source of truth for the union. */
|
|
5036
|
+
declare const RENDERED_STYLES: readonly ["dropdown-vertical", "jumbotron", "accordion"];
|
|
5037
|
+
type MenuStyle = (typeof RENDERED_STYLES)[number];
|
|
5013
5038
|
/**
|
|
5014
|
-
*
|
|
5015
|
-
*
|
|
5039
|
+
* Everything a custom `renderMenu` needs to draw the tree: the data, the
|
|
5040
|
+
* open/close state, and the same helpers the built-in styles use.
|
|
5041
|
+
*
|
|
5042
|
+
* Exposing the helpers rather than just the categories is the point — URL
|
|
5043
|
+
* building respects `getUrl`/`configuration`, `handleItemClick` honours
|
|
5044
|
+
* `onMenuItemClick`, and the `openPath` helpers give working expand/collapse.
|
|
5045
|
+
* A custom renderer that only got `categories` would have to reimplement all
|
|
5046
|
+
* of that and would drift from the built-ins.
|
|
5047
|
+
*/
|
|
5048
|
+
interface MenuRenderContext {
|
|
5049
|
+
/** Root-level categories of the fetched tree. */
|
|
5050
|
+
categories: MenuCategory[];
|
|
5051
|
+
/** True while the internal fetch is in flight (never when `tree` is passed). */
|
|
5052
|
+
isLoading: boolean;
|
|
5053
|
+
/** True when the internal fetch failed. */
|
|
5054
|
+
hasError: boolean;
|
|
5055
|
+
/** Levels that may be rendered, after the style's cap is applied. */
|
|
5056
|
+
maxDepth: number;
|
|
5057
|
+
/** Children of `cat`, minus entries with no name or slug. */
|
|
5058
|
+
getSubCategories: (cat: MenuCategory) => MenuCategory[];
|
|
5059
|
+
/** Localised display name. */
|
|
5060
|
+
getCategoryName: (cat: MenuCategory) => string;
|
|
5061
|
+
/** Href honouring `getUrl` when provided, else `configuration.urls`. */
|
|
5062
|
+
getCategoryUrl: (cat: MenuCategory) => string;
|
|
5063
|
+
/** Click handler that fires `onMenuItemClick` and suppresses navigation. */
|
|
5064
|
+
handleItemClick: (cat: MenuCategory, e: React$1.MouseEvent) => void;
|
|
5065
|
+
/** Currently open branch as category ids, root → deepest. */
|
|
5066
|
+
openPath: number[];
|
|
5067
|
+
/** Is `categoryId` the open branch at `level` (0-based)? */
|
|
5068
|
+
isOpenAt: (level: number, categoryId: number) => boolean;
|
|
5069
|
+
/** Open a branch at `level`, closing anything deeper. Pass null to close. */
|
|
5070
|
+
openAt: (level: number, categoryId: number | null) => void;
|
|
5071
|
+
/** Toggle a branch at `level` — the accordion's click behaviour. */
|
|
5072
|
+
toggleAt: (level: number, categoryId: number) => void;
|
|
5073
|
+
}
|
|
5074
|
+
/**
|
|
5075
|
+
* Renders a multi-level category navigation menu from the fetched category
|
|
5076
|
+
* tree: a dropdown flyout or jumbotron mega-menu on desktop, an accordion on
|
|
5077
|
+
* mobile — or an accordion on every breakpoint when `menuStyle="accordion"`,
|
|
5078
|
+
* which is the option to pick for trees deeper than a flyout can lay out.
|
|
5016
5079
|
*
|
|
5017
5080
|
* @remarks Uses {@link useMenu} to fetch the category hierarchy.
|
|
5018
5081
|
*/
|
|
@@ -7319,4 +7382,4 @@ declare function DefaultProductBadges(props: BadgesComponentProps): React__defau
|
|
|
7319
7382
|
*/
|
|
7320
7383
|
declare function DefaultProductSurcharges(props: ProductSurchargesComponentProps): React__default.JSX.Element | null;
|
|
7321
7384
|
|
|
7322
|
-
export { AccountIconAndMenu, type AccountIconAndMenuProps, ActionCode, type ActionCodeProps, type AddContactFormState, type AddItemOptions, _default$1 as AddToCart, type AddToCartProps, AddToFavorite, type AddToFavoriteProps, AddressCardExport as AddressCard, type AddressCardProps, type AddressInput, AddressSelector, type AddressSelectorProps, type AttributeDisplayItem, type AttributeGroup, BreadcrumbsWithProvider as Breadcrumbs, type BreadcrumbsProps, CartBonusItems, type CartBonusItemsProps, CartCarriers, type CartCarriersProps, CartIconAndSidebar, type CartIconAndSidebarProps, type CartInitConfig, CartItemExport as CartItem, type CartItemProps, CartOverview, type CartOverviewProps, CartPaymethods, type CartPaymethodsProps, CartSummary, type CartSummaryProps, CategoryDescription, type CategoryDescriptionProps, CategoryShortDescriptionWithProvider as CategoryShortDescription, type CategoryShortDescriptionProps, ClusterCardExport as ClusterCard, type ClusterCardProps, ClusterConfigurator, type ClusterConfiguratorProps, ClusterInfo, type ClusterInfoProps, ClusterOptions, type ClusterOptionsProps, CompanySwitcher, type CompanySwitcherProps, type ConfiguredSetting, _default$1 as DefaultAddToCart, AddToFavorite as DefaultAddToFavorite, _default as DefaultItemStock, DefaultProductBadges, ProductBulkPrices as DefaultProductBulkPrices, ProductBundles as DefaultProductBundles, DefaultProductImage, ProductPriceDisplay as DefaultProductPrice, DefaultProductSurcharges, DeliveryDate, type DeliveryDateProps, FavoriteListDetails, type FavoriteListDetailsProps, type FavoriteListFormData, FavoriteListItemExport as FavoriteListItem, type FavoriteListItemProps, FavoriteLists, type FavoriteListsProps, type FetchActiveCartConfig, type FetchCrossupsellsInput, ForgotPassword, type ForgotPasswordProps, type GetCrossupsellsOptions, GridFilters, GridFiltersPanel, type GridFiltersPanelProps, type GridFiltersProps, GridPagination, type GridPaginationProps, GridTitleWithProvider as GridTitle, type GridTitleProps, GridToolbar, type GridToolbarProps, _default as ItemStock, type ItemStockProps, ItemsOverview, type ItemsOverviewProps, LoginFormExport as LoginForm, type LoginFormProps, LoginToOrderButton, type LoginToOrderButtonProps, MachineCard, type MachineCardProps, MachineGrid, type MachineGridProps, type MachineListingState, Menu, type MenuCategory, type MenuProps, OrderActions, type OrderActionsProps, OrderBonusItems, type OrderBonusItemsProps, OrderItemCard, type OrderItemCardProps, OrderList, type OrderListProps, type OrderSearchForm, OrderShipments, type OrderShipmentsProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, type PlaceOrderOptions, PriceToggle, type PriceToggleProps, ProductBulkPricesWithProvider as ProductBulkPrices, type ProductBulkPricesProps, ProductBundles, type ProductBundlesProps, ProductCard, type ProductCardProps, ProductDescription, type ProductDescriptionProps, ProductDownloads, type ProductDownloadsProps, ProductGallery, type ProductGalleryProps, ProductGridCompound as ProductGrid, type ProductGridConfig, ProductGridConfigProvider, type ProductGridProps, ProductInfoExport as ProductInfo, type ProductInfoProps, ProductPriceWithProvider as ProductPrice, type ProductPriceProps, ProductShortDescriptionWithProvider as ProductShortDescription, type ProductShortDescriptionProps, ProductSlider, type ProductSliderProps, ProductSpecifications, type ProductSpecificationsProps, ProductTabs, type ProductTabsProps, ProductVideos, type ProductVideosProps, type PropellerDeps, PropellerDepsProvider, type PropellerDepsProviderProps, type PropellerInfra, PropellerProvider, type PropellerProviderProps, type PropellerScope, PurchaseAuthorizationConfigurator, type PurchaseAuthorizationConfiguratorProps, PurchaseAuthorizationRequests, type PurchaseAuthorizationRequestsProps, QuickOrder, type QuickOrderLine, type QuickOrderMatch, type QuickOrderProps, type QuickOrderSubmitResult, type QuickOrderUploadLine, QuoteActions, type QuoteActionsProps, RegisterForm, type RegisterFormProps, type ResolveSpec, type RowEdit, SearchBar, type SearchBarProps, type UseAddressOptions, type UseAddressReturn, type LoginResult as UseAuthLoginResult, type UseAuthOptions, type RegisterContactInput as UseAuthRegisterContactInput, type RegisterCustomerInput as UseAuthRegisterCustomerInput, type UseAuthReturn, type UseCartOptions, type UseCartReturn, type UseCheckoutOptions, type UseCheckoutReturn, type UseClusterConfiguratorOptions, type UseClusterConfiguratorReturn, type UseCompanyOptions, type UseCompanyReturn, type UseFavoritesOptions, type UseFavoritesReturn, type UseMachinesOptions, type UseMachinesReturn, type UseMenuOptions, type UseMenuReturn, type UseOrdersOptions, type UseOrdersReturn, type BundleItem as UseProductBundlesBundleItem, type UseProductBundlesOptions, type UseProductBundlesReturn, type UseProductInfoOptions, type UseProductInfoReturn, type UseProductSearchOptions, type UseProductSearchReturn, type UseProductSliderOptions, type UseProductSliderReturn, type UseProductSpecsOptions, type UseProductSpecsReturn, type UsePurchaseAuthorizationConfiguratorOptions, type UsePurchaseAuthorizationConfiguratorReturn, type UsePurchaseAuthorizationRequestsOptions, type UsePurchaseAuthorizationRequestsReturn, type UseQuickOrderOptions, type UseQuickOrderReturn, type UseSparePartsOptions, type UseSparePartsReturn, UserDetails, type UserDetailsProps, buildRootMachinesQuery, fetchActiveCart, initCart, mergeAnonymousCart, useAddress, useAuth, useCart, useCheckout, useClusterConfigurator, useCompany, useFavorites, useInfraProps, useMachines, useMenu, useOrders, useProductBundles, useProductGridConfig, useProductInfo, useProductSearch, useProductSlider, useProductSpecs, usePropellerContext, usePropellerDeps, usePropellerScope, usePurchaseAuthorizationConfigurator, usePurchaseAuthorizationRequests, useQuickOrder, useRequiredPropellerDeps, useResolvedProps, useServices, useSpareParts, useUserMode };
|
|
7385
|
+
export { AccountIconAndMenu, type AccountIconAndMenuProps, ActionCode, type ActionCodeProps, type AddContactFormState, type AddItemOptions, _default$1 as AddToCart, type AddToCartProps, AddToFavorite, type AddToFavoriteProps, AddressCardExport as AddressCard, type AddressCardProps, type AddressInput, AddressSelector, type AddressSelectorProps, type AttributeDisplayItem, type AttributeGroup, BreadcrumbsWithProvider as Breadcrumbs, type BreadcrumbsProps, CartBonusItems, type CartBonusItemsProps, CartCarriers, type CartCarriersProps, CartIconAndSidebar, type CartIconAndSidebarProps, type CartInitConfig, CartItemExport as CartItem, type CartItemProps, CartOverview, type CartOverviewProps, CartPaymethods, type CartPaymethodsProps, CartSummary, type CartSummaryProps, CategoryDescription, type CategoryDescriptionProps, CategoryShortDescriptionWithProvider as CategoryShortDescription, type CategoryShortDescriptionProps, ClusterCardExport as ClusterCard, type ClusterCardProps, ClusterConfigurator, type ClusterConfiguratorProps, ClusterInfo, type ClusterInfoProps, ClusterOptions, type ClusterOptionsProps, CompanySwitcher, type CompanySwitcherProps, type ConfiguredSetting, _default$1 as DefaultAddToCart, AddToFavorite as DefaultAddToFavorite, _default as DefaultItemStock, DefaultProductBadges, ProductBulkPrices as DefaultProductBulkPrices, ProductBundles as DefaultProductBundles, DefaultProductImage, ProductPriceDisplay as DefaultProductPrice, DefaultProductSurcharges, DeliveryDate, type DeliveryDateProps, FavoriteListDetails, type FavoriteListDetailsProps, type FavoriteListFormData, FavoriteListItemExport as FavoriteListItem, type FavoriteListItemProps, FavoriteLists, type FavoriteListsProps, type FetchActiveCartConfig, type FetchCrossupsellsInput, ForgotPassword, type ForgotPasswordProps, type GetCrossupsellsOptions, GridFilters, GridFiltersPanel, type GridFiltersPanelProps, type GridFiltersProps, GridPagination, type GridPaginationProps, GridTitleWithProvider as GridTitle, type GridTitleProps, GridToolbar, type GridToolbarProps, _default as ItemStock, type ItemStockProps, ItemsOverview, type ItemsOverviewProps, LoginFormExport as LoginForm, type LoginFormProps, LoginToOrderButton, type LoginToOrderButtonProps, MachineCard, type MachineCardProps, MachineGrid, type MachineGridProps, type MachineListingState, Menu, type MenuCategory, type MenuProps, type MenuRenderContext, type MenuStyle, OrderActions, type OrderActionsProps, OrderBonusItems, type OrderBonusItemsProps, OrderItemCard, type OrderItemCardProps, OrderList, type OrderListProps, type OrderSearchForm, OrderShipments, type OrderShipmentsProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, type PlaceOrderOptions, PriceToggle, type PriceToggleProps, ProductBulkPricesWithProvider as ProductBulkPrices, type ProductBulkPricesProps, ProductBundles, type ProductBundlesProps, ProductCard, type ProductCardProps, ProductDescription, type ProductDescriptionProps, ProductDownloads, type ProductDownloadsProps, ProductGallery, type ProductGalleryProps, ProductGridCompound as ProductGrid, type ProductGridConfig, ProductGridConfigProvider, type ProductGridProps, ProductInfoExport as ProductInfo, type ProductInfoProps, ProductPriceWithProvider as ProductPrice, type ProductPriceProps, ProductShortDescriptionWithProvider as ProductShortDescription, type ProductShortDescriptionProps, ProductSlider, type ProductSliderProps, ProductSpecifications, type ProductSpecificationsProps, ProductTabs, type ProductTabsProps, ProductVideos, type ProductVideosProps, type PropellerDeps, PropellerDepsProvider, type PropellerDepsProviderProps, type PropellerInfra, PropellerProvider, type PropellerProviderProps, type PropellerScope, PurchaseAuthorizationConfigurator, type PurchaseAuthorizationConfiguratorProps, PurchaseAuthorizationRequests, type PurchaseAuthorizationRequestsProps, QuickOrder, type QuickOrderLine, type QuickOrderMatch, type QuickOrderProps, type QuickOrderSubmitResult, type QuickOrderUploadLine, QuoteActions, type QuoteActionsProps, RegisterForm, type RegisterFormProps, type ResolveSpec, type RowEdit, SearchBar, type SearchBarProps, type UseAddressOptions, type UseAddressReturn, type LoginResult as UseAuthLoginResult, type UseAuthOptions, type RegisterContactInput as UseAuthRegisterContactInput, type RegisterCustomerInput as UseAuthRegisterCustomerInput, type UseAuthReturn, type UseCartOptions, type UseCartReturn, type UseCheckoutOptions, type UseCheckoutReturn, type UseClusterConfiguratorOptions, type UseClusterConfiguratorReturn, type UseCompanyOptions, type UseCompanyReturn, type UseFavoritesOptions, type UseFavoritesReturn, type UseMachinesOptions, type UseMachinesReturn, type UseMenuOptions, type UseMenuReturn, type UseOrdersOptions, type UseOrdersReturn, type BundleItem as UseProductBundlesBundleItem, type UseProductBundlesOptions, type UseProductBundlesReturn, type UseProductInfoOptions, type UseProductInfoReturn, type UseProductSearchOptions, type UseProductSearchReturn, type UseProductSliderOptions, type UseProductSliderReturn, type UseProductSpecsOptions, type UseProductSpecsReturn, type UsePurchaseAuthorizationConfiguratorOptions, type UsePurchaseAuthorizationConfiguratorReturn, type UsePurchaseAuthorizationRequestsOptions, type UsePurchaseAuthorizationRequestsReturn, type UseQuickOrderOptions, type UseQuickOrderReturn, type UseSparePartsOptions, type UseSparePartsReturn, UserDetails, type UserDetailsProps, buildRootMachinesQuery, fetchActiveCart, initCart, mergeAnonymousCart, useAddress, useAuth, useCart, useCheckout, useClusterConfigurator, useCompany, useFavorites, useInfraProps, useMachines, useMenu, useOrders, useProductBundles, useProductGridConfig, useProductInfo, useProductSearch, useProductSlider, useProductSpecs, usePropellerContext, usePropellerDeps, usePropellerScope, usePurchaseAuthorizationConfigurator, usePurchaseAuthorizationRequests, useQuickOrder, useRequiredPropellerDeps, useResolvedProps, useServices, useSpareParts, useUserMode };
|
package/dist/index.js
CHANGED
|
@@ -12825,6 +12825,7 @@ function ItemsOverview(props) {
|
|
|
12825
12825
|
] });
|
|
12826
12826
|
}
|
|
12827
12827
|
var ItemsOverview_default = ItemsOverview;
|
|
12828
|
+
var RENDERED_STYLES = ["dropdown-vertical", "jumbotron", "accordion"];
|
|
12828
12829
|
function Menu(rawProps) {
|
|
12829
12830
|
const props = useInfraProps(rawProps);
|
|
12830
12831
|
const [openPath, setOpenPath] = useState([]);
|
|
@@ -12880,11 +12881,20 @@ function Menu(rawProps) {
|
|
|
12880
12881
|
return openPath[level] === categoryId;
|
|
12881
12882
|
}
|
|
12882
12883
|
function getMenuStyle() {
|
|
12883
|
-
|
|
12884
|
+
const requested = props.menuStyle || "dropdown-vertical";
|
|
12885
|
+
if (!RENDERED_STYLES.includes(requested)) {
|
|
12886
|
+
if (process.env.NODE_ENV !== "production") {
|
|
12887
|
+
console.warn(
|
|
12888
|
+
`[Menu] menuStyle="${requested}" has no built-in renderer (available: ${RENDERED_STYLES.join(", ")}); falling back to "accordion". Pass \`renderMenu\` to draw a custom style.`
|
|
12889
|
+
);
|
|
12890
|
+
}
|
|
12891
|
+
return "accordion";
|
|
12892
|
+
}
|
|
12893
|
+
return requested;
|
|
12884
12894
|
}
|
|
12885
12895
|
function getRenderableDepth() {
|
|
12886
12896
|
const requested = Math.max(1, props.depth ?? 3);
|
|
12887
|
-
const cap = getMenuStyle() === "
|
|
12897
|
+
const cap = getMenuStyle() === "accordion" ? Number.POSITIVE_INFINITY : 5;
|
|
12888
12898
|
if (process.env.NODE_ENV !== "production" && requested > cap) {
|
|
12889
12899
|
console.warn(
|
|
12890
12900
|
`[Menu] depth={${requested}} exceeds what menuStyle="${getMenuStyle()}" can lay out (${cap}); rendering ${cap} levels. Use menuStyle="accordion" for deeper trees.`
|
|
@@ -12980,7 +12990,7 @@ function Menu(rawProps) {
|
|
|
12980
12990
|
"button",
|
|
12981
12991
|
{
|
|
12982
12992
|
type: "button",
|
|
12983
|
-
className: "propeller-menu__toggle px-4 py-3",
|
|
12993
|
+
className: "propeller-menu__toggle cursor-pointer px-4 py-3 text-muted-foreground transition-colors hover:text-foreground",
|
|
12984
12994
|
"aria-expanded": expanded,
|
|
12985
12995
|
"aria-label": getCategoryName(cat),
|
|
12986
12996
|
onClick: () => toggleAt(level, cat.categoryId),
|
|
@@ -13002,6 +13012,31 @@ function Menu(rawProps) {
|
|
|
13002
13012
|
if (!props.graphqlClient) return;
|
|
13003
13013
|
fetchMenu(props.categoryId, userKey);
|
|
13004
13014
|
}, [hasPrefetchedTree, props.graphqlClient, props.categoryId, props.language, userKey, fetchMenu]);
|
|
13015
|
+
const customMenu = props.renderMenu ? props.renderMenu({
|
|
13016
|
+
categories: menuCategories,
|
|
13017
|
+
isLoading,
|
|
13018
|
+
hasError,
|
|
13019
|
+
maxDepth,
|
|
13020
|
+
getSubCategories,
|
|
13021
|
+
getCategoryName,
|
|
13022
|
+
getCategoryUrl,
|
|
13023
|
+
handleItemClick,
|
|
13024
|
+
openPath,
|
|
13025
|
+
isOpenAt,
|
|
13026
|
+
openAt,
|
|
13027
|
+
toggleAt
|
|
13028
|
+
}) : null;
|
|
13029
|
+
if (customMenu !== null && customMenu !== void 0) {
|
|
13030
|
+
return /* @__PURE__ */ jsx(
|
|
13031
|
+
"div",
|
|
13032
|
+
{
|
|
13033
|
+
className: `propeller-menu ${props.className || ""}`,
|
|
13034
|
+
"data-variant": props.menuStyle || "custom",
|
|
13035
|
+
"data-loading": isLoading ? "true" : "false",
|
|
13036
|
+
children: customMenu
|
|
13037
|
+
}
|
|
13038
|
+
);
|
|
13039
|
+
}
|
|
13005
13040
|
return /* @__PURE__ */ jsxs(
|
|
13006
13041
|
"div",
|
|
13007
13042
|
{
|
|
@@ -13019,7 +13054,7 @@ function Menu(rawProps) {
|
|
|
13019
13054
|
"nav",
|
|
13020
13055
|
{
|
|
13021
13056
|
className: `propeller-menu__nav hidden md:block ${props.menuClass || ""}`,
|
|
13022
|
-
children: /* @__PURE__ */ jsx("div", { className: "flex bg-popover border border-border shadow-lg", children: renderColumns(menuCategories, 0) })
|
|
13057
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex max-w-[100vw] overflow-x-auto bg-popover border border-border shadow-lg", children: renderColumns(menuCategories, 0) })
|
|
13023
13058
|
}
|
|
13024
13059
|
) : null,
|
|
13025
13060
|
!isLoading && !hasError && menuCategories.length > 0 && getMenuStyle() === "jumbotron" ? /* @__PURE__ */ jsxs(
|
|
@@ -13030,7 +13065,7 @@ function Menu(rawProps) {
|
|
|
13030
13065
|
/* @__PURE__ */ jsx("div", { className: "propeller-menu__tabs flex items-center border-b border-border", children: menuCategories?.map((l1, idx) => /* @__PURE__ */ jsx(
|
|
13031
13066
|
"button",
|
|
13032
13067
|
{
|
|
13033
|
-
className: `propeller-menu__tab px-5 py-3 text-sm font-medium transition-colors border-b-2 ${isOpenAt(0, l1.categoryId) ? "border-primary text-primary" : "border-transparent text-foreground hover:text-primary hover:border-primary/50"}`,
|
|
13068
|
+
className: `propeller-menu__tab cursor-pointer px-5 py-3 text-sm font-medium transition-colors border-b-2 ${isOpenAt(0, l1.categoryId) ? "border-primary text-primary" : "border-transparent text-foreground hover:text-primary hover:border-primary/50"}`,
|
|
13034
13069
|
"data-level": "1",
|
|
13035
13070
|
"data-active": isOpenAt(0, l1.categoryId) ? "true" : "false",
|
|
13036
13071
|
onMouseEnter: (event) => openAt(0, l1.categoryId),
|
|
@@ -13072,7 +13107,13 @@ function Menu(rawProps) {
|
|
|
13072
13107
|
]
|
|
13073
13108
|
}
|
|
13074
13109
|
) : null,
|
|
13075
|
-
!isLoading && !hasError && menuCategories.length > 0 ? /* @__PURE__ */ jsx(
|
|
13110
|
+
!isLoading && !hasError && menuCategories.length > 0 ? /* @__PURE__ */ jsx(
|
|
13111
|
+
"nav",
|
|
13112
|
+
{
|
|
13113
|
+
className: `propeller-menu__nav ${getMenuStyle() === "accordion" ? "block" : "md:hidden"} ${props.menuClass || ""}`,
|
|
13114
|
+
children: renderAccordion(menuCategories, 0)
|
|
13115
|
+
}
|
|
13116
|
+
) : null
|
|
13076
13117
|
]
|
|
13077
13118
|
}
|
|
13078
13119
|
);
|