@vendure-platform/create 0.5.0 → 0.5.2
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 +8 -0
- package/README.md +39 -39
- package/dist/add-to-existing.js +1 -1
- package/dist/assets/demo-data/initial-data.json +663 -663
- package/dist/assets/storefront/components.json +20 -20
- package/dist/assets/storefront/eslint.config.mjs +10 -10
- package/dist/assets/storefront/graphql.config.yml +1 -1
- package/dist/assets/storefront/next.config.ts +5 -4
- package/dist/assets/storefront/package.json +1 -1
- package/dist/assets/storefront/postcss.config.mjs +1 -1
- package/dist/assets/storefront/src/app/[locale]/(catalog)/catalog/page.tsx +17 -21
- package/dist/assets/storefront/src/app/[locale]/(catalog)/collection/[slug]/page.tsx +64 -42
- package/dist/assets/storefront/src/app/[locale]/(catalog)/layout.tsx +1 -5
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/actions.ts +69 -65
- package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/page.tsx +64 -38
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/page.tsx +24 -27
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-results.tsx +11 -9
- package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-term.tsx +4 -4
- package/dist/assets/storefront/src/app/[locale]/(scenario)/[...path]/page.tsx +1 -1
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/accept-invitation-client.tsx +8 -13
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/actions.ts +11 -14
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/page.tsx +30 -33
- package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/sign-out-and-retry.tsx +6 -6
- package/dist/assets/storefront/src/app/[locale]/account/addresses/actions.ts +30 -45
- package/dist/assets/storefront/src/app/[locale]/account/addresses/address-form.tsx +166 -159
- package/dist/assets/storefront/src/app/[locale]/account/addresses/addresses-client.tsx +35 -26
- package/dist/assets/storefront/src/app/[locale]/account/addresses/loading.tsx +1 -3
- package/dist/assets/storefront/src/app/[locale]/account/addresses/page.tsx +16 -18
- package/dist/assets/storefront/src/app/[locale]/account/approvals/actions.ts +5 -8
- package/dist/assets/storefront/src/app/[locale]/account/approvals/page.tsx +77 -69
- package/dist/assets/storefront/src/app/[locale]/account/company/actions.ts +10 -11
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/actions.ts +6 -15
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/address-form.tsx +57 -49
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/addresses-client.tsx +23 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/addresses/page.tsx +30 -30
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/actions.ts +20 -29
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-unit-form.tsx +32 -37
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-units-client.tsx +32 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/page.tsx +24 -24
- package/dist/assets/storefront/src/app/[locale]/account/company/business-units/types.ts +7 -4
- package/dist/assets/storefront/src/app/[locale]/account/company/edit-company-form.tsx +11 -21
- package/dist/assets/storefront/src/app/[locale]/account/company/page.tsx +23 -28
- package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/page.tsx +24 -24
- package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/payment-methods-client.tsx +5 -7
- package/dist/assets/storefront/src/app/[locale]/account/company/roles/page.tsx +22 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/roles/roles-client.tsx +11 -26
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/actions.ts +6 -10
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/page.tsx +18 -16
- package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/tax-ids-client.tsx +74 -67
- package/dist/assets/storefront/src/app/[locale]/account/company/users/actions.ts +16 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/users/edit-user-form.tsx +27 -25
- package/dist/assets/storefront/src/app/[locale]/account/company/users/invite-user-form.tsx +27 -19
- package/dist/assets/storefront/src/app/[locale]/account/company/users/page.tsx +32 -29
- package/dist/assets/storefront/src/app/[locale]/account/company/users/users-client.tsx +35 -38
- package/dist/assets/storefront/src/app/[locale]/account/error.tsx +1 -3
- package/dist/assets/storefront/src/app/[locale]/account/layout.tsx +16 -22
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/page.tsx +151 -103
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-actions.ts +6 -7
- package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-dialog.tsx +22 -48
- package/dist/assets/storefront/src/app/[locale]/account/orders/loading.tsx +8 -8
- package/dist/assets/storefront/src/app/[locale]/account/orders/page.tsx +101 -61
- package/dist/assets/storefront/src/app/[locale]/account/profile/actions.ts +32 -23
- package/dist/assets/storefront/src/app/[locale]/account/profile/change-password-form.tsx +6 -16
- package/dist/assets/storefront/src/app/[locale]/account/profile/edit-email-form.tsx +7 -17
- package/dist/assets/storefront/src/app/[locale]/account/profile/edit-profile-form.tsx +6 -16
- package/dist/assets/storefront/src/app/[locale]/account/profile/loading.tsx +12 -18
- package/dist/assets/storefront/src/app/[locale]/account/profile/page.tsx +15 -15
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/file-upload-tab.tsx +2 -6
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/manual-entry-tab.tsx +18 -15
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/page.tsx +3 -6
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/preview-table.tsx +10 -2
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/save-to-list-dialog.tsx +24 -26
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/sku-autocomplete.tsx +19 -10
- package/dist/assets/storefront/src/app/[locale]/account/quick-order/text-input-tab.tsx +3 -8
- package/dist/assets/storefront/src/app/[locale]/account/quotes/[id]/page.tsx +86 -59
- package/dist/assets/storefront/src/app/[locale]/account/quotes/actions.ts +38 -45
- package/dist/assets/storefront/src/app/[locale]/account/quotes/new/new-quote-form.tsx +3 -5
- package/dist/assets/storefront/src/app/[locale]/account/quotes/new/page.tsx +6 -6
- package/dist/assets/storefront/src/app/[locale]/account/quotes/page.tsx +92 -59
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-item-search.tsx +11 -9
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-member-form.tsx +31 -15
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/members-panel.tsx +52 -33
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/page.tsx +22 -14
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/rename-dialog.tsx +34 -13
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/actions.ts +117 -72
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/new/new-shared-cart-form.tsx +21 -14
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/new/page.tsx +10 -10
- package/dist/assets/storefront/src/app/[locale]/account/shared-carts/page.tsx +54 -41
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/page.tsx +22 -8
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/shopping-list-detail-client.tsx +62 -49
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/actions.ts +9 -4
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/create-shopping-list-form.tsx +5 -11
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/loading.tsx +1 -1
- package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/page.tsx +32 -42
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/actions.ts +8 -8
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/claim-form.tsx +6 -10
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/page.tsx +76 -55
- package/dist/assets/storefront/src/app/[locale]/account/store-credits/reveal-code.tsx +10 -6
- package/dist/assets/storefront/src/app/[locale]/account/verify-email/page.tsx +32 -39
- package/dist/assets/storefront/src/app/[locale]/cart/actions.ts +29 -23
- package/dist/assets/storefront/src/app/[locale]/cart/cart-items.tsx +111 -40
- package/dist/assets/storefront/src/app/[locale]/cart/cart-line-actions.tsx +9 -9
- package/dist/assets/storefront/src/app/[locale]/cart/cart-quantity-control.tsx +61 -48
- package/dist/assets/storefront/src/app/[locale]/cart/cart-remove-button.tsx +15 -9
- package/dist/assets/storefront/src/app/[locale]/cart/cart.tsx +38 -41
- package/dist/assets/storefront/src/app/[locale]/cart/code-input.tsx +8 -8
- package/dist/assets/storefront/src/app/[locale]/cart/order-summary.tsx +50 -32
- package/dist/assets/storefront/src/app/[locale]/cart/page.tsx +11 -11
- package/dist/assets/storefront/src/app/[locale]/cart/promotion-code.tsx +48 -42
- package/dist/assets/storefront/src/app/[locale]/cart/reapproval-confirm.tsx +22 -20
- package/dist/assets/storefront/src/app/[locale]/cart/request-quote-button.tsx +7 -16
- package/dist/assets/storefront/src/app/[locale]/checkout/actions.ts +39 -65
- package/dist/assets/storefront/src/app/[locale]/checkout/cancel-quote-checkout-button.tsx +5 -5
- package/dist/assets/storefront/src/app/[locale]/checkout/checkout-flow.tsx +202 -202
- package/dist/assets/storefront/src/app/[locale]/checkout/checkout-provider.tsx +142 -142
- package/dist/assets/storefront/src/app/[locale]/checkout/order-summary.tsx +158 -139
- package/dist/assets/storefront/src/app/[locale]/checkout/page.tsx +56 -47
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/delivery-step.tsx +86 -88
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/payment-step.tsx +90 -91
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/review-step.tsx +166 -161
- package/dist/assets/storefront/src/app/[locale]/checkout/steps/shipping-address-step.tsx +573 -494
- package/dist/assets/storefront/src/app/[locale]/error.tsx +3 -5
- package/dist/assets/storefront/src/app/[locale]/forgot-password/actions.ts +10 -7
- package/dist/assets/storefront/src/app/[locale]/forgot-password/forgot-password-form.tsx +10 -25
- package/dist/assets/storefront/src/app/[locale]/forgot-password/page.tsx +5 -5
- package/dist/assets/storefront/src/app/[locale]/globals.css +48 -48
- package/dist/assets/storefront/src/app/[locale]/layout.tsx +53 -47
- package/dist/assets/storefront/src/app/[locale]/not-found.tsx +3 -5
- package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/order-confirmation.tsx +71 -44
- package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/page.tsx +7 -5
- package/dist/assets/storefront/src/app/[locale]/page.tsx +33 -35
- package/dist/assets/storefront/src/app/[locale]/register/actions.ts +7 -7
- package/dist/assets/storefront/src/app/[locale]/register/page.tsx +22 -16
- package/dist/assets/storefront/src/app/[locale]/register/registration-form.tsx +22 -34
- package/dist/assets/storefront/src/app/[locale]/register-company/actions.ts +15 -19
- package/dist/assets/storefront/src/app/[locale]/register-company/page.tsx +17 -15
- package/dist/assets/storefront/src/app/[locale]/register-company/registration-form.tsx +9 -15
- package/dist/assets/storefront/src/app/[locale]/reset-password/actions.ts +7 -8
- package/dist/assets/storefront/src/app/[locale]/reset-password/page.tsx +18 -12
- package/dist/assets/storefront/src/app/[locale]/reset-password/reset-password-form.tsx +8 -16
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/add-to-cart-button.tsx +10 -4
- package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/page.tsx +62 -30
- package/dist/assets/storefront/src/app/[locale]/sign-in/actions.ts +14 -16
- package/dist/assets/storefront/src/app/[locale]/sign-in/login-form.tsx +17 -30
- package/dist/assets/storefront/src/app/[locale]/sign-in/page.tsx +35 -30
- package/dist/assets/storefront/src/app/[locale]/verify/actions.ts +8 -8
- package/dist/assets/storefront/src/app/[locale]/verify/page.tsx +18 -14
- package/dist/assets/storefront/src/app/[locale]/verify/verify-content.tsx +25 -27
- package/dist/assets/storefront/src/app/[locale]/verify-pending/page.tsx +23 -23
- package/dist/assets/storefront/src/app/api/clear-company-context/route.ts +6 -3
- package/dist/assets/storefront/src/app/api/revalidate/route.ts +19 -28
- package/dist/assets/storefront/src/app/api/search-analytics/route.ts +1 -1
- package/dist/assets/storefront/src/components/commerce/account-nav-items.ts +43 -18
- package/dist/assets/storefront/src/components/commerce/account-sidebar.tsx +30 -22
- package/dist/assets/storefront/src/components/commerce/active-filters.tsx +1 -1
- package/dist/assets/storefront/src/components/commerce/add-to-shared-cart.tsx +49 -27
- package/dist/assets/storefront/src/components/commerce/approval-decision-form.tsx +9 -13
- package/dist/assets/storefront/src/components/commerce/approval-status-badge.tsx +23 -15
- package/dist/assets/storefront/src/components/commerce/business-unit-switcher.tsx +11 -11
- package/dist/assets/storefront/src/components/commerce/catalog-search-bar.tsx +2 -2
- package/dist/assets/storefront/src/components/commerce/category-product-section.tsx +28 -16
- package/dist/assets/storefront/src/components/commerce/category-sidebar.tsx +31 -18
- package/dist/assets/storefront/src/components/commerce/collection-hero-banner.tsx +2 -4
- package/dist/assets/storefront/src/components/commerce/company-state-badge.tsx +10 -16
- package/dist/assets/storefront/src/components/commerce/company-switcher.tsx +12 -12
- package/dist/assets/storefront/src/components/commerce/configurator-form.tsx +188 -79
- package/dist/assets/storefront/src/components/commerce/facet-filters.tsx +29 -49
- package/dist/assets/storefront/src/components/commerce/gift-card-pdp.tsx +4 -4
- package/dist/assets/storefront/src/components/commerce/gift-card-product-info.tsx +20 -30
- package/dist/assets/storefront/src/components/commerce/instant-search-dropdown.tsx +258 -227
- package/dist/assets/storefront/src/components/commerce/order-status-badge.tsx +27 -19
- package/dist/assets/storefront/src/components/commerce/packaging-unit-selector.tsx +27 -26
- package/dist/assets/storefront/src/components/commerce/permission-gate.tsx +4 -4
- package/dist/assets/storefront/src/components/commerce/price-range-filter.tsx +5 -5
- package/dist/assets/storefront/src/components/commerce/price-tiers.tsx +38 -21
- package/dist/assets/storefront/src/components/commerce/price.tsx +3 -3
- package/dist/assets/storefront/src/components/commerce/product-card-list.tsx +35 -14
- package/dist/assets/storefront/src/components/commerce/product-card.tsx +31 -16
- package/dist/assets/storefront/src/components/commerce/product-carousel.tsx +20 -12
- package/dist/assets/storefront/src/components/commerce/product-grid.tsx +14 -13
- package/dist/assets/storefront/src/components/commerce/product-image-carousel.tsx +10 -8
- package/dist/assets/storefront/src/components/commerce/product-info.tsx +118 -74
- package/dist/assets/storefront/src/components/commerce/product-list-expansion.tsx +102 -74
- package/dist/assets/storefront/src/components/commerce/product-list-view.tsx +1 -1
- package/dist/assets/storefront/src/components/commerce/product-sidebar.tsx +36 -11
- package/dist/assets/storefront/src/components/commerce/product-view-switcher.tsx +33 -21
- package/dist/assets/storefront/src/components/commerce/quote-action-buttons.tsx +54 -36
- package/dist/assets/storefront/src/components/commerce/quote-activity-timeline.tsx +126 -50
- package/dist/assets/storefront/src/components/commerce/quote-comment-form.tsx +9 -13
- package/dist/assets/storefront/src/components/commerce/quote-csv-export-button.tsx +6 -6
- package/dist/assets/storefront/src/components/commerce/quote-product-search.tsx +22 -18
- package/dist/assets/storefront/src/components/commerce/quote-request-form.tsx +28 -27
- package/dist/assets/storefront/src/components/commerce/quote-status-badge.tsx +26 -18
- package/dist/assets/storefront/src/components/commerce/quote-validity-indicator.tsx +7 -7
- package/dist/assets/storefront/src/components/commerce/quote-version-comparison.tsx +50 -30
- package/dist/assets/storefront/src/components/commerce/related-products.tsx +37 -28
- package/dist/assets/storefront/src/components/commerce/shared-cart-status-badge.tsx +12 -8
- package/dist/assets/storefront/src/components/commerce/shop-by-category.tsx +8 -7
- package/dist/assets/storefront/src/components/commerce/shopping-list-toggle.tsx +14 -20
- package/dist/assets/storefront/src/components/commerce/sort-dropdown.tsx +9 -16
- package/dist/assets/storefront/src/components/commerce/store-credit-summary.tsx +30 -32
- package/dist/assets/storefront/src/components/commerce/subcollection-tiles.tsx +11 -13
- package/dist/assets/storefront/src/components/layout/auth-page-shell.tsx +2 -2
- package/dist/assets/storefront/src/components/layout/draft-mode-indicator.tsx +2 -7
- package/dist/assets/storefront/src/components/layout/draft-mode-link.tsx +4 -2
- package/dist/assets/storefront/src/components/layout/footer.tsx +70 -28
- package/dist/assets/storefront/src/components/layout/navbar/actions.ts +9 -12
- package/dist/assets/storefront/src/components/layout/navbar/cart-icon.tsx +9 -9
- package/dist/assets/storefront/src/components/layout/navbar/channel-picker-wrapper.tsx +4 -9
- package/dist/assets/storefront/src/components/layout/navbar/channel-picker.tsx +13 -8
- package/dist/assets/storefront/src/components/layout/navbar/currency-picker-wrapper.tsx +4 -4
- package/dist/assets/storefront/src/components/layout/navbar/currency-picker.tsx +11 -6
- package/dist/assets/storefront/src/components/layout/navbar/language-picker.tsx +7 -7
- package/dist/assets/storefront/src/components/layout/navbar/login-button.tsx +24 -21
- package/dist/assets/storefront/src/components/layout/navbar/mobile-nav.tsx +8 -8
- package/dist/assets/storefront/src/components/layout/navbar/nav-menu-items.tsx +4 -6
- package/dist/assets/storefront/src/components/layout/navbar/navbar-cart.tsx +1 -1
- package/dist/assets/storefront/src/components/layout/navbar/navbar-collections.tsx +41 -42
- package/dist/assets/storefront/src/components/layout/navbar/navbar-link.tsx +7 -10
- package/dist/assets/storefront/src/components/layout/navbar/navbar-user.tsx +18 -23
- package/dist/assets/storefront/src/components/layout/navbar/theme-switcher.tsx +9 -9
- package/dist/assets/storefront/src/components/layout/navbar.tsx +36 -31
- package/dist/assets/storefront/src/components/layout/search-input.tsx +35 -32
- package/dist/assets/storefront/src/components/providers/awaiting-approval-banner.tsx +12 -10
- package/dist/assets/storefront/src/components/providers/cart-count-server.tsx +14 -12
- package/dist/assets/storefront/src/components/providers/company-context-guard.tsx +4 -4
- package/dist/assets/storefront/src/components/providers/company-permissions-server.tsx +2 -6
- package/dist/assets/storefront/src/components/providers/theme-provider.tsx +3 -3
- package/dist/assets/storefront/src/components/shared/breadcrumbs.tsx +4 -1
- package/dist/assets/storefront/src/components/shared/country-select.tsx +63 -67
- package/dist/assets/storefront/src/components/shared/pagination.tsx +15 -28
- package/dist/assets/storefront/src/components/shared/prefetch-link.tsx +1 -1
- package/dist/assets/storefront/src/components/shared/skeletons/search-input-skeleton.tsx +1 -3
- package/dist/assets/storefront/src/components/ui/accordion.tsx +46 -51
- package/dist/assets/storefront/src/components/ui/alert-dialog.tsx +94 -121
- package/dist/assets/storefront/src/components/ui/alert.tsx +48 -54
- package/dist/assets/storefront/src/components/ui/aspect-ratio.tsx +5 -7
- package/dist/assets/storefront/src/components/ui/avatar.tsx +29 -44
- package/dist/assets/storefront/src/components/ui/badge.tsx +28 -37
- package/dist/assets/storefront/src/components/ui/breadcrumb.tsx +82 -89
- package/dist/assets/storefront/src/components/ui/button.tsx +43 -49
- package/dist/assets/storefront/src/components/ui/calendar.tsx +157 -198
- package/dist/assets/storefront/src/components/ui/card.tsx +53 -76
- package/dist/assets/storefront/src/components/ui/carousel.tsx +194 -212
- package/dist/assets/storefront/src/components/ui/chart.tsx +274 -317
- package/dist/assets/storefront/src/components/ui/checkbox.tsx +24 -27
- package/dist/assets/storefront/src/components/ui/collapsible.tsx +9 -21
- package/dist/assets/storefront/src/components/ui/command.tsx +114 -159
- package/dist/assets/storefront/src/components/ui/context-menu.tsx +167 -199
- package/dist/assets/storefront/src/components/ui/dialog.tsx +97 -114
- package/dist/assets/storefront/src/components/ui/drawer.tsx +93 -107
- package/dist/assets/storefront/src/components/ui/dropdown-menu.tsx +171 -206
- package/dist/assets/storefront/src/components/ui/empty-state.tsx +5 -5
- package/dist/assets/storefront/src/components/ui/field.tsx +196 -208
- package/dist/assets/storefront/src/components/ui/form.tsx +115 -139
- package/dist/assets/storefront/src/components/ui/hover-card.tsx +27 -33
- package/dist/assets/storefront/src/components/ui/input-otp.tsx +50 -59
- package/dist/assets/storefront/src/components/ui/input.tsx +17 -17
- package/dist/assets/storefront/src/components/ui/kbd-shortcut.tsx +3 -1
- package/dist/assets/storefront/src/components/ui/label.tsx +16 -19
- package/dist/assets/storefront/src/components/ui/menubar.tsx +193 -223
- package/dist/assets/storefront/src/components/ui/navigation-menu.tsx +123 -130
- package/dist/assets/storefront/src/components/ui/pagination.tsx +87 -108
- package/dist/assets/storefront/src/components/ui/popover.tsx +29 -35
- package/dist/assets/storefront/src/components/ui/progress.tsx +19 -26
- package/dist/assets/storefront/src/components/ui/radio-group.tsx +32 -38
- package/dist/assets/storefront/src/components/ui/resizable.tsx +37 -42
- package/dist/assets/storefront/src/components/ui/scroll-area.tsx +41 -47
- package/dist/assets/storefront/src/components/ui/select.tsx +130 -152
- package/dist/assets/storefront/src/components/ui/separator.tsx +21 -21
- package/dist/assets/storefront/src/components/ui/sheet.tsx +90 -111
- package/dist/assets/storefront/src/components/ui/sidebar.tsx +611 -649
- package/dist/assets/storefront/src/components/ui/skeleton.tsx +10 -10
- package/dist/assets/storefront/src/components/ui/slider.tsx +50 -55
- package/dist/assets/storefront/src/components/ui/sonner.tsx +20 -20
- package/dist/assets/storefront/src/components/ui/switch.tsx +23 -26
- package/dist/assets/storefront/src/components/ui/table.tsx +65 -97
- package/dist/assets/storefront/src/components/ui/tabs.tsx +39 -55
- package/dist/assets/storefront/src/components/ui/textarea.tsx +14 -14
- package/dist/assets/storefront/src/components/ui/toggle-group.tsx +56 -62
- package/dist/assets/storefront/src/components/ui/toggle.tsx +37 -38
- package/dist/assets/storefront/src/components/ui/tooltip.tsx +38 -46
- package/dist/assets/storefront/src/config/scenario-meta.ts +2 -2
- package/dist/assets/storefront/src/config/scenario.ts +14 -16
- package/dist/assets/storefront/src/contexts/auth-context.tsx +5 -6
- package/dist/assets/storefront/src/graphql.ts +5 -5
- package/dist/assets/storefront/src/hooks/use-mobile.ts +13 -13
- package/dist/assets/storefront/src/i18n/locale-utils.ts +3 -3
- package/dist/assets/storefront/src/i18n/navigation.ts +4 -4
- package/dist/assets/storefront/src/i18n/request.ts +4 -4
- package/dist/assets/storefront/src/i18n/routing.ts +5 -5
- package/dist/assets/storefront/src/i18n/server.ts +3 -3
- package/dist/assets/storefront/src/lib/actions/switch-channel.ts +9 -9
- package/dist/assets/storefront/src/lib/actions/switch-currency.ts +7 -7
- package/dist/assets/storefront/src/lib/auth.ts +1 -1
- package/dist/assets/storefront/src/lib/backend-health.ts +3 -3
- package/dist/assets/storefront/src/lib/cart-count-context.tsx +10 -4
- package/dist/assets/storefront/src/lib/cart-guard-utils.ts +2 -1
- package/dist/assets/storefront/src/lib/cart-guard.ts +7 -6
- package/dist/assets/storefront/src/lib/channel-server.ts +4 -4
- package/dist/assets/storefront/src/lib/company-context.ts +1 -1
- package/dist/assets/storefront/src/lib/company-permissions-context.tsx +1 -5
- package/dist/assets/storefront/src/lib/currency-server.ts +4 -4
- package/dist/assets/storefront/src/lib/format.ts +16 -7
- package/dist/assets/storefront/src/lib/metadata.ts +39 -44
- package/dist/assets/storefront/src/lib/quantity.ts +2 -4
- package/dist/assets/storefront/src/lib/search-bar-context.tsx +7 -4
- package/dist/assets/storefront/src/lib/use-recent-searches.ts +8 -6
- package/dist/assets/storefront/src/lib/utils.ts +3 -3
- package/dist/assets/storefront/src/lib/vendure/actions.ts +18 -16
- package/dist/assets/storefront/src/lib/vendure/api.ts +36 -23
- package/dist/assets/storefront/src/lib/vendure/approval-utils.ts +9 -8
- package/dist/assets/storefront/src/lib/vendure/cached.ts +20 -15
- package/dist/assets/storefront/src/lib/vendure/queries.ts +15 -5
- package/dist/assets/storefront/src/middleware.ts +1 -1
- package/dist/assets/storefront/src/scenarios/customer/hero.tsx +2 -2
- package/dist/assets/storefront/src/scenarios/customer/meta.ts +1 -1
- package/dist/bin/run.js +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/scaffold-storefront-only.js +1 -1
- package/dist/scaffolder.js +1 -1
- package/dist/template-renderer.js +1 -1
- package/package.json +2 -2
|
@@ -1,357 +1,314 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
4
|
-
import * as RechartsPrimitive from
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as RechartsPrimitive from 'recharts';
|
|
5
5
|
|
|
6
|
-
import { cn } from
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
7
7
|
|
|
8
8
|
// Format: { THEME_NAME: CSS_SELECTOR }
|
|
9
|
-
const THEMES = { light:
|
|
9
|
+
const THEMES = { light: '', dark: '.dark' } as const;
|
|
10
10
|
|
|
11
11
|
export type ChartConfig = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| { color?: never; theme: Record<keyof typeof THEMES, string> }
|
|
18
|
-
)
|
|
19
|
-
}
|
|
12
|
+
[k in string]: {
|
|
13
|
+
label?: React.ReactNode;
|
|
14
|
+
icon?: React.ComponentType;
|
|
15
|
+
} & ({ color?: string; theme?: never } | { color?: never; theme: Record<keyof typeof THEMES, string> });
|
|
16
|
+
};
|
|
20
17
|
|
|
21
18
|
type ChartContextProps = {
|
|
22
|
-
|
|
23
|
-
}
|
|
19
|
+
config: ChartConfig;
|
|
20
|
+
};
|
|
24
21
|
|
|
25
|
-
const ChartContext = React.createContext<ChartContextProps | null>(null)
|
|
22
|
+
const ChartContext = React.createContext<ChartContextProps | null>(null);
|
|
26
23
|
|
|
27
24
|
function useChart() {
|
|
28
|
-
|
|
25
|
+
const context = React.useContext(ChartContext);
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
if (!context) {
|
|
28
|
+
throw new Error('useChart must be used within a <ChartContainer />');
|
|
29
|
+
}
|
|
33
30
|
|
|
34
|
-
|
|
31
|
+
return context;
|
|
35
32
|
}
|
|
36
33
|
|
|
37
34
|
function ChartContainer({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}: React.ComponentProps<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
typeof RechartsPrimitive.ResponsiveContainer
|
|
47
|
-
>["children"]
|
|
35
|
+
id,
|
|
36
|
+
className,
|
|
37
|
+
children,
|
|
38
|
+
config,
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<'div'> & {
|
|
41
|
+
config: ChartConfig;
|
|
42
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
|
|
48
43
|
}) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
</
|
|
67
|
-
|
|
68
|
-
</ChartContext.Provider>
|
|
69
|
-
)
|
|
44
|
+
const uniqueId = React.useId();
|
|
45
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<ChartContext.Provider value={{ config }}>
|
|
49
|
+
<div
|
|
50
|
+
data-slot="chart"
|
|
51
|
+
data-chart={chartId}
|
|
52
|
+
className={cn(
|
|
53
|
+
"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
|
|
54
|
+
className,
|
|
55
|
+
)}
|
|
56
|
+
{...props}
|
|
57
|
+
>
|
|
58
|
+
<ChartStyle id={chartId} config={config} />
|
|
59
|
+
<RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>
|
|
60
|
+
</div>
|
|
61
|
+
</ChartContext.Provider>
|
|
62
|
+
);
|
|
70
63
|
}
|
|
71
64
|
|
|
72
65
|
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.map(
|
|
86
|
-
([theme, prefix]) => `
|
|
66
|
+
const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
|
|
67
|
+
|
|
68
|
+
if (!colorConfig.length) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<style
|
|
74
|
+
dangerouslySetInnerHTML={{
|
|
75
|
+
__html: Object.entries(THEMES)
|
|
76
|
+
.map(
|
|
77
|
+
([theme, prefix]) => `
|
|
87
78
|
${prefix} [data-chart=${id}] {
|
|
88
79
|
${colorConfig
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
})
|
|
95
|
-
.join("\n")}
|
|
96
|
-
}
|
|
97
|
-
`
|
|
98
|
-
)
|
|
99
|
-
.join("\n"),
|
|
100
|
-
}}
|
|
101
|
-
/>
|
|
102
|
-
)
|
|
80
|
+
.map(([key, itemConfig]) => {
|
|
81
|
+
const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color;
|
|
82
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
83
|
+
})
|
|
84
|
+
.join('\n')}
|
|
103
85
|
}
|
|
86
|
+
`,
|
|
87
|
+
)
|
|
88
|
+
.join('\n'),
|
|
89
|
+
}}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
104
93
|
|
|
105
|
-
const ChartTooltip = RechartsPrimitive.Tooltip
|
|
94
|
+
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
106
95
|
|
|
107
96
|
function ChartTooltipContent({
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
97
|
+
active,
|
|
98
|
+
payload,
|
|
99
|
+
className,
|
|
100
|
+
indicator = 'dot',
|
|
101
|
+
hideLabel = false,
|
|
102
|
+
hideIndicator = false,
|
|
103
|
+
label,
|
|
104
|
+
labelFormatter,
|
|
105
|
+
labelClassName,
|
|
106
|
+
formatter,
|
|
107
|
+
color,
|
|
108
|
+
nameKey,
|
|
109
|
+
labelKey,
|
|
121
110
|
}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
111
|
+
React.ComponentProps<'div'> & {
|
|
112
|
+
hideLabel?: boolean;
|
|
113
|
+
hideIndicator?: boolean;
|
|
114
|
+
indicator?: 'line' | 'dot' | 'dashed';
|
|
115
|
+
nameKey?: string;
|
|
116
|
+
labelKey?: string;
|
|
117
|
+
}) {
|
|
118
|
+
const { config } = useChart();
|
|
119
|
+
|
|
120
|
+
const tooltipLabel = React.useMemo(() => {
|
|
121
|
+
if (hideLabel || !payload?.length) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const [item] = payload;
|
|
126
|
+
const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;
|
|
127
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
128
|
+
const value =
|
|
129
|
+
!labelKey && typeof label === 'string'
|
|
130
|
+
? config[label as keyof typeof config]?.label || label
|
|
131
|
+
: itemConfig?.label;
|
|
132
|
+
|
|
133
|
+
if (labelFormatter) {
|
|
134
|
+
return <div className={cn('font-medium', labelClassName)}>{labelFormatter(value, payload)}</div>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!value) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return <div className={cn('font-medium', labelClassName)}>{value}</div>;
|
|
142
|
+
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
143
|
+
|
|
144
|
+
if (!active || !payload?.length) {
|
|
145
|
+
return null;
|
|
134
146
|
}
|
|
135
147
|
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
const nestLabel = payload.length === 1 && indicator !== 'dot';
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<div
|
|
152
|
+
className={cn(
|
|
153
|
+
'border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl',
|
|
154
|
+
className,
|
|
155
|
+
)}
|
|
156
|
+
>
|
|
157
|
+
{!nestLabel ? tooltipLabel : null}
|
|
158
|
+
<div className="grid gap-1.5">
|
|
159
|
+
{payload
|
|
160
|
+
.filter((item) => item.type !== 'none')
|
|
161
|
+
.map((item, index) => {
|
|
162
|
+
const key = `${nameKey || item.name || item.dataKey || 'value'}`;
|
|
163
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
164
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<div
|
|
168
|
+
key={item.dataKey}
|
|
169
|
+
className={cn(
|
|
170
|
+
'[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5',
|
|
171
|
+
indicator === 'dot' && 'items-center',
|
|
172
|
+
)}
|
|
173
|
+
>
|
|
174
|
+
{formatter && item?.value !== undefined && item.name ? (
|
|
175
|
+
formatter(item.value, item.name, item, index, item.payload)
|
|
176
|
+
) : (
|
|
177
|
+
<>
|
|
178
|
+
{itemConfig?.icon ? (
|
|
179
|
+
<itemConfig.icon />
|
|
180
|
+
) : (
|
|
181
|
+
!hideIndicator && (
|
|
182
|
+
<div
|
|
183
|
+
className={cn(
|
|
184
|
+
'shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)',
|
|
185
|
+
{
|
|
186
|
+
'h-2.5 w-2.5': indicator === 'dot',
|
|
187
|
+
'w-1': indicator === 'line',
|
|
188
|
+
'w-0 border-[1.5px] border-dashed bg-transparent':
|
|
189
|
+
indicator === 'dashed',
|
|
190
|
+
'my-0.5': nestLabel && indicator === 'dashed',
|
|
191
|
+
},
|
|
192
|
+
)}
|
|
193
|
+
style={
|
|
194
|
+
{
|
|
195
|
+
'--color-bg': indicatorColor,
|
|
196
|
+
'--color-border': indicatorColor,
|
|
197
|
+
} as React.CSSProperties
|
|
198
|
+
}
|
|
199
|
+
/>
|
|
200
|
+
)
|
|
201
|
+
)}
|
|
202
|
+
<div
|
|
203
|
+
className={cn(
|
|
204
|
+
'flex flex-1 justify-between leading-none',
|
|
205
|
+
nestLabel ? 'items-end' : 'items-center',
|
|
206
|
+
)}
|
|
207
|
+
>
|
|
208
|
+
<div className="grid gap-1.5">
|
|
209
|
+
{nestLabel ? tooltipLabel : null}
|
|
210
|
+
<span className="text-muted-foreground">
|
|
211
|
+
{itemConfig?.label || item.name}
|
|
212
|
+
</span>
|
|
213
|
+
</div>
|
|
214
|
+
{item.value && (
|
|
215
|
+
<span className="text-foreground font-mono font-medium tabular-nums">
|
|
216
|
+
{item.value.toLocaleString()}
|
|
217
|
+
</span>
|
|
218
|
+
)}
|
|
219
|
+
</div>
|
|
220
|
+
</>
|
|
221
|
+
)}
|
|
222
|
+
</div>
|
|
223
|
+
);
|
|
224
|
+
})}
|
|
225
|
+
</div>
|
|
148
226
|
</div>
|
|
149
|
-
|
|
150
|
-
|
|
227
|
+
);
|
|
228
|
+
}
|
|
151
229
|
|
|
152
|
-
|
|
153
|
-
return null
|
|
154
|
-
}
|
|
230
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
155
231
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
labelFormatter,
|
|
232
|
+
function ChartLegendContent({
|
|
233
|
+
className,
|
|
234
|
+
hideIcon = false,
|
|
160
235
|
payload,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return (
|
|
190
|
-
<div
|
|
191
|
-
key={item.dataKey}
|
|
192
|
-
className={cn(
|
|
193
|
-
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
|
|
194
|
-
indicator === "dot" && "items-center"
|
|
195
|
-
)}
|
|
196
|
-
>
|
|
197
|
-
{formatter && item?.value !== undefined && item.name ? (
|
|
198
|
-
formatter(item.value, item.name, item, index, item.payload)
|
|
199
|
-
) : (
|
|
200
|
-
<>
|
|
201
|
-
{itemConfig?.icon ? (
|
|
202
|
-
<itemConfig.icon />
|
|
203
|
-
) : (
|
|
204
|
-
!hideIndicator && (
|
|
236
|
+
verticalAlign = 'bottom',
|
|
237
|
+
nameKey,
|
|
238
|
+
}: React.ComponentProps<'div'> &
|
|
239
|
+
Pick<RechartsPrimitive.LegendProps, 'payload' | 'verticalAlign'> & {
|
|
240
|
+
hideIcon?: boolean;
|
|
241
|
+
nameKey?: string;
|
|
242
|
+
}) {
|
|
243
|
+
const { config } = useChart();
|
|
244
|
+
|
|
245
|
+
if (!payload?.length) {
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return (
|
|
250
|
+
<div
|
|
251
|
+
className={cn(
|
|
252
|
+
'flex items-center justify-center gap-4',
|
|
253
|
+
verticalAlign === 'top' ? 'pb-3' : 'pt-3',
|
|
254
|
+
className,
|
|
255
|
+
)}
|
|
256
|
+
>
|
|
257
|
+
{payload
|
|
258
|
+
.filter((item) => item.type !== 'none')
|
|
259
|
+
.map((item) => {
|
|
260
|
+
const key = `${nameKey || item.dataKey || 'value'}`;
|
|
261
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
262
|
+
|
|
263
|
+
return (
|
|
205
264
|
<div
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
"flex flex-1 justify-between leading-none",
|
|
228
|
-
nestLabel ? "items-end" : "items-center"
|
|
229
|
-
)}
|
|
230
|
-
>
|
|
231
|
-
<div className="grid gap-1.5">
|
|
232
|
-
{nestLabel ? tooltipLabel : null}
|
|
233
|
-
<span className="text-muted-foreground">
|
|
234
|
-
{itemConfig?.label || item.name}
|
|
235
|
-
</span>
|
|
236
|
-
</div>
|
|
237
|
-
{item.value && (
|
|
238
|
-
<span className="text-foreground font-mono font-medium tabular-nums">
|
|
239
|
-
{item.value.toLocaleString()}
|
|
240
|
-
</span>
|
|
241
|
-
)}
|
|
242
|
-
</div>
|
|
243
|
-
</>
|
|
244
|
-
)}
|
|
245
|
-
</div>
|
|
246
|
-
)
|
|
247
|
-
})}
|
|
248
|
-
</div>
|
|
249
|
-
</div>
|
|
250
|
-
)
|
|
265
|
+
key={item.value}
|
|
266
|
+
className={cn(
|
|
267
|
+
'[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3',
|
|
268
|
+
)}
|
|
269
|
+
>
|
|
270
|
+
{itemConfig?.icon && !hideIcon ? (
|
|
271
|
+
<itemConfig.icon />
|
|
272
|
+
) : (
|
|
273
|
+
<div
|
|
274
|
+
className="h-2 w-2 shrink-0 rounded-[2px]"
|
|
275
|
+
style={{
|
|
276
|
+
backgroundColor: item.color,
|
|
277
|
+
}}
|
|
278
|
+
/>
|
|
279
|
+
)}
|
|
280
|
+
{itemConfig?.label}
|
|
281
|
+
</div>
|
|
282
|
+
);
|
|
283
|
+
})}
|
|
284
|
+
</div>
|
|
285
|
+
);
|
|
251
286
|
}
|
|
252
287
|
|
|
253
|
-
|
|
288
|
+
// Helper to extract item config from a payload.
|
|
289
|
+
function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {
|
|
290
|
+
if (typeof payload !== 'object' || payload === null) {
|
|
291
|
+
return undefined;
|
|
292
|
+
}
|
|
254
293
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
return (
|
|
273
|
-
<div
|
|
274
|
-
className={cn(
|
|
275
|
-
"flex items-center justify-center gap-4",
|
|
276
|
-
verticalAlign === "top" ? "pb-3" : "pt-3",
|
|
277
|
-
className
|
|
278
|
-
)}
|
|
279
|
-
>
|
|
280
|
-
{payload
|
|
281
|
-
.filter((item) => item.type !== "none")
|
|
282
|
-
.map((item) => {
|
|
283
|
-
const key = `${nameKey || item.dataKey || "value"}`
|
|
284
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
285
|
-
|
|
286
|
-
return (
|
|
287
|
-
<div
|
|
288
|
-
key={item.value}
|
|
289
|
-
className={cn(
|
|
290
|
-
"[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
|
|
291
|
-
)}
|
|
292
|
-
>
|
|
293
|
-
{itemConfig?.icon && !hideIcon ? (
|
|
294
|
-
<itemConfig.icon />
|
|
295
|
-
) : (
|
|
296
|
-
<div
|
|
297
|
-
className="h-2 w-2 shrink-0 rounded-[2px]"
|
|
298
|
-
style={{
|
|
299
|
-
backgroundColor: item.color,
|
|
300
|
-
}}
|
|
301
|
-
/>
|
|
302
|
-
)}
|
|
303
|
-
{itemConfig?.label}
|
|
304
|
-
</div>
|
|
305
|
-
)
|
|
306
|
-
})}
|
|
307
|
-
</div>
|
|
308
|
-
)
|
|
309
|
-
}
|
|
294
|
+
const payloadPayload =
|
|
295
|
+
'payload' in payload && typeof payload.payload === 'object' && payload.payload !== null
|
|
296
|
+
? payload.payload
|
|
297
|
+
: undefined;
|
|
298
|
+
|
|
299
|
+
let configLabelKey: string = key;
|
|
300
|
+
|
|
301
|
+
if (key in payload && typeof payload[key as keyof typeof payload] === 'string') {
|
|
302
|
+
configLabelKey = payload[key as keyof typeof payload] as string;
|
|
303
|
+
} else if (
|
|
304
|
+
payloadPayload &&
|
|
305
|
+
key in payloadPayload &&
|
|
306
|
+
typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'
|
|
307
|
+
) {
|
|
308
|
+
configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;
|
|
309
|
+
}
|
|
310
310
|
|
|
311
|
-
|
|
312
|
-
function getPayloadConfigFromPayload(
|
|
313
|
-
config: ChartConfig,
|
|
314
|
-
payload: unknown,
|
|
315
|
-
key: string
|
|
316
|
-
) {
|
|
317
|
-
if (typeof payload !== "object" || payload === null) {
|
|
318
|
-
return undefined
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
const payloadPayload =
|
|
322
|
-
"payload" in payload &&
|
|
323
|
-
typeof payload.payload === "object" &&
|
|
324
|
-
payload.payload !== null
|
|
325
|
-
? payload.payload
|
|
326
|
-
: undefined
|
|
327
|
-
|
|
328
|
-
let configLabelKey: string = key
|
|
329
|
-
|
|
330
|
-
if (
|
|
331
|
-
key in payload &&
|
|
332
|
-
typeof payload[key as keyof typeof payload] === "string"
|
|
333
|
-
) {
|
|
334
|
-
configLabelKey = payload[key as keyof typeof payload] as string
|
|
335
|
-
} else if (
|
|
336
|
-
payloadPayload &&
|
|
337
|
-
key in payloadPayload &&
|
|
338
|
-
typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
|
|
339
|
-
) {
|
|
340
|
-
configLabelKey = payloadPayload[
|
|
341
|
-
key as keyof typeof payloadPayload
|
|
342
|
-
] as string
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
return configLabelKey in config
|
|
346
|
-
? config[configLabelKey]
|
|
347
|
-
: config[key as keyof typeof config]
|
|
311
|
+
return configLabelKey in config ? config[configLabelKey] : config[key as keyof typeof config];
|
|
348
312
|
}
|
|
349
313
|
|
|
350
|
-
export {
|
|
351
|
-
ChartContainer,
|
|
352
|
-
ChartTooltip,
|
|
353
|
-
ChartTooltipContent,
|
|
354
|
-
ChartLegend,
|
|
355
|
-
ChartLegendContent,
|
|
356
|
-
ChartStyle,
|
|
357
|
-
}
|
|
314
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|