@vendure/dashboard 3.2.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/README.md +13 -0
- package/dist/plugin/.vendure-dashboard-temp/dev-config.js +227 -0
- package/dist/plugin/.vendure-dashboard-temp/dev-config.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/api-extensions.js +33 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/api-extensions.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/mv.resolver.js +69 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/mv.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-process.js +110 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-process.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-seller-strategy.js +134 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-seller-strategy.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-payment-handler.js +86 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-payment-handler.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-eligibility-checker.js +49 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-eligibility-checker.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-line-assignment-strategy.js +57 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-line-assignment-strategy.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/constants.js +20 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/constants.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/multivendor.plugin.js +151 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/multivendor.plugin.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/payment/mv-connect-sdk.js +47 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/payment/mv-connect-sdk.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/service/mv.service.js +222 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/service/mv.service.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/types.js +4 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/package.json +3 -0
- package/dist/plugin/.vendure-dashboard-temp/schema.graphql +6378 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/api-extensions.js +103 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/api-extensions.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-entity.resolver.js +105 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-entity.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-admin.resolver.js +183 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-admin.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-entity.resolver.js +113 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-entity.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-shop.resolver.js +112 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-shop.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/entities/product-review.entity.js +111 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/entities/product-review.entity.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-admin-types.js +616 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-admin-types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-shop-types.js +563 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-shop-types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/reviews-plugin.js +135 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/reviews-plugin.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/types.js +4 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/tsconfig.json +10 -0
- package/dist/plugin/config-loader.d.ts +27 -0
- package/dist/plugin/config-loader.js +141 -0
- package/dist/plugin/constants.d.ts +5 -0
- package/dist/plugin/constants.js +277 -0
- package/dist/plugin/index.d.ts +1 -0
- package/dist/plugin/index.js +1 -0
- package/dist/plugin/schema-generator.d.ts +5 -0
- package/dist/plugin/schema-generator.js +24 -0
- package/dist/plugin/ui-config.d.ts +3 -0
- package/dist/plugin/ui-config.js +35 -0
- package/dist/plugin/vite-plugin-admin-api-schema.d.ts +24 -0
- package/dist/plugin/vite-plugin-admin-api-schema.js +82 -0
- package/dist/plugin/vite-plugin-config-loader.d.ts +17 -0
- package/dist/plugin/vite-plugin-config-loader.js +56 -0
- package/dist/plugin/vite-plugin-config.d.ts +4 -0
- package/dist/plugin/vite-plugin-config.js +38 -0
- package/dist/plugin/vite-plugin-dashboard-metadata.d.ts +9 -0
- package/dist/plugin/vite-plugin-dashboard-metadata.js +52 -0
- package/dist/plugin/vite-plugin-gql-tada.d.ts +6 -0
- package/dist/plugin/vite-plugin-gql-tada.js +51 -0
- package/dist/plugin/vite-plugin-set-root.d.ts +4 -0
- package/dist/plugin/vite-plugin-set-root.js +15 -0
- package/dist/plugin/vite-plugin-ui-config.d.ts +15 -0
- package/dist/plugin/vite-plugin-ui-config.js +43 -0
- package/dist/plugin/vite-plugin-vendure-dashboard.d.ts +35 -0
- package/dist/plugin/vite-plugin-vendure-dashboard.js +81 -0
- package/index.html +15 -0
- package/lingui.config.js +12 -0
- package/package.json +118 -0
- package/src/app/app-providers.tsx +30 -0
- package/src/app/main.tsx +97 -0
- package/src/app/routeTree.gen.ts +1372 -0
- package/src/app/routes/__root.tsx +24 -0
- package/src/app/routes/_authenticated/_administrators/administrators.graphql.ts +79 -0
- package/src/app/routes/_authenticated/_administrators/administrators.tsx +86 -0
- package/src/app/routes/_authenticated/_administrators/administrators_.$id.tsx +155 -0
- package/src/app/routes/_authenticated/_administrators/components/role-permissions-display.tsx +133 -0
- package/src/app/routes/_authenticated/_assets/assets.tsx +19 -0
- package/src/app/routes/_authenticated/_channels/channels.graphql.ts +93 -0
- package/src/app/routes/_authenticated/_channels/channels.tsx +60 -0
- package/src/app/routes/_authenticated/_channels/channels_.$id.tsx +248 -0
- package/src/app/routes/_authenticated/_collections/collections.graphql.ts +133 -0
- package/src/app/routes/_authenticated/_collections/collections.tsx +195 -0
- package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +224 -0
- package/src/app/routes/_authenticated/_collections/components/collection-contents-preview-table.tsx +127 -0
- package/src/app/routes/_authenticated/_collections/components/collection-contents-sheet.tsx +46 -0
- package/src/app/routes/_authenticated/_collections/components/collection-contents-table.tsx +82 -0
- package/src/app/routes/_authenticated/_collections/components/collection-filters-selector.tsx +91 -0
- package/src/app/routes/_authenticated/_countries/countries.graphql.ts +69 -0
- package/src/app/routes/_authenticated/_countries/countries.tsx +67 -0
- package/src/app/routes/_authenticated/_countries/countries_.$id.tsx +122 -0
- package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-sheet.tsx +44 -0
- package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-table.tsx +129 -0
- package/src/app/routes/_authenticated/_customer-groups/customer-groups.graphql.ts +71 -0
- package/src/app/routes/_authenticated/_customer-groups/customer-groups.tsx +68 -0
- package/src/app/routes/_authenticated/_customer-groups/customer-groups_.$id.tsx +111 -0
- package/src/app/routes/_authenticated/_customers/components/customer-address-card.tsx +155 -0
- package/src/app/routes/_authenticated/_customers/components/customer-address-form.tsx +344 -0
- package/src/app/routes/_authenticated/_customers/components/customer-group-controls.tsx +4 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-container.tsx +78 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history.tsx +77 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/index.ts +3 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/use-customer-history.ts +169 -0
- package/src/app/routes/_authenticated/_customers/components/customer-order-table.tsx +88 -0
- package/src/app/routes/_authenticated/_customers/components/customer-status-badge.tsx +33 -0
- package/src/app/routes/_authenticated/_customers/customers.graphql.ts +204 -0
- package/src/app/routes/_authenticated/_customers/customers.tsx +82 -0
- package/src/app/routes/_authenticated/_customers/customers_.$id.tsx +274 -0
- package/src/app/routes/_authenticated/_facets/components/edit-facet-value.tsx +129 -0
- package/src/app/routes/_authenticated/_facets/components/facet-values-sheet.tsx +46 -0
- package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +97 -0
- package/src/app/routes/_authenticated/_facets/facets.graphql.ts +104 -0
- package/src/app/routes/_authenticated/_facets/facets.tsx +97 -0
- package/src/app/routes/_authenticated/_facets/facets_.$id.tsx +139 -0
- package/src/app/routes/_authenticated/_global-settings/global-settings.graphql.ts +28 -0
- package/src/app/routes/_authenticated/_global-settings/global-settings.tsx +161 -0
- package/src/app/routes/_authenticated/_orders/components/order-address.tsx +58 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/index.ts +3 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/order-history-container.tsx +73 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/order-history.tsx +96 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/use-order-history.ts +171 -0
- package/src/app/routes/_authenticated/_orders/components/order-table.tsx +169 -0
- package/src/app/routes/_authenticated/_orders/components/order-tax-summary.tsx +39 -0
- package/src/app/routes/_authenticated/_orders/components/payment-details.tsx +61 -0
- package/src/app/routes/_authenticated/_orders/orders.graphql.ts +325 -0
- package/src/app/routes/_authenticated/_orders/orders.tsx +120 -0
- package/src/app/routes/_authenticated/_orders/orders_.$id.tsx +133 -0
- package/src/app/routes/_authenticated/_payment-methods/components/payment-eligibility-checker-selector.tsx +104 -0
- package/src/app/routes/_authenticated/_payment-methods/components/payment-handler-selector.tsx +100 -0
- package/src/app/routes/_authenticated/_payment-methods/payment-methods.graphql.ts +83 -0
- package/src/app/routes/_authenticated/_payment-methods/payment-methods.tsx +64 -0
- package/src/app/routes/_authenticated/_payment-methods/payment-methods_.$id.tsx +183 -0
- package/src/app/routes/_authenticated/_product-variants/components/variant-price-detail.tsx +87 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants.graphql.ts +123 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants.tsx +78 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +331 -0
- package/src/app/routes/_authenticated/_products/components/create-product-variants-dialog.tsx +228 -0
- package/src/app/routes/_authenticated/_products/components/create-product-variants.tsx +462 -0
- package/src/app/routes/_authenticated/_products/components/option-value-input.tsx +96 -0
- package/src/app/routes/_authenticated/_products/components/product-variants-table.tsx +87 -0
- package/src/app/routes/_authenticated/_products/products.graphql.ts +116 -0
- package/src/app/routes/_authenticated/_products/products.tsx +48 -0
- package/src/app/routes/_authenticated/_products/products_.$id.tsx +196 -0
- package/src/app/routes/_authenticated/_profile/profile.graphql.ts +23 -0
- package/src/app/routes/_authenticated/_profile/profile.tsx +122 -0
- package/src/app/routes/_authenticated/_promotions/components/promotion-actions-selector.tsx +107 -0
- package/src/app/routes/_authenticated/_promotions/components/promotion-conditions-selector.tsx +107 -0
- package/src/app/routes/_authenticated/_promotions/promotions.graphql.ts +96 -0
- package/src/app/routes/_authenticated/_promotions/promotions.tsx +61 -0
- package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +235 -0
- package/src/app/routes/_authenticated/_roles/components/expandable-permissions.tsx +54 -0
- package/src/app/routes/_authenticated/_roles/components/permissions-grid.tsx +116 -0
- package/src/app/routes/_authenticated/_roles/roles.graphql.ts +67 -0
- package/src/app/routes/_authenticated/_roles/roles.tsx +96 -0
- package/src/app/routes/_authenticated/_roles/roles_.$id.tsx +142 -0
- package/src/app/routes/_authenticated/_sellers/sellers.graphql.ts +61 -0
- package/src/app/routes/_authenticated/_sellers/sellers.tsx +51 -0
- package/src/app/routes/_authenticated/_sellers/sellers_.$id.tsx +111 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/fulfillment-handler-selector.tsx +56 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/shipping-calculator-selector.tsx +101 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/shipping-eligibility-checker-selector.tsx +101 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-method-dialog.tsx +32 -0
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.graphql.ts +83 -0
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.tsx +55 -0
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +171 -0
- package/src/app/routes/_authenticated/_stock-locations/stock-locations.graphql.ts +62 -0
- package/src/app/routes/_authenticated/_stock-locations/stock-locations.tsx +48 -0
- package/src/app/routes/_authenticated/_stock-locations/stock-locations_.$id.tsx +115 -0
- package/src/app/routes/_authenticated/_system/components/payload-dialog.tsx +34 -0
- package/src/app/routes/_authenticated/_system/healthchecks.tsx +93 -0
- package/src/app/routes/_authenticated/_system/job-queue.graphql.ts +43 -0
- package/src/app/routes/_authenticated/_system/job-queue.tsx +161 -0
- package/src/app/routes/_authenticated/_tax-categories/tax-categories.graphql.ts +63 -0
- package/src/app/routes/_authenticated/_tax-categories/tax-categories.tsx +65 -0
- package/src/app/routes/_authenticated/_tax-categories/tax-categories_.$id.tsx +115 -0
- package/src/app/routes/_authenticated/_tax-rates/tax-rates.graphql.ts +75 -0
- package/src/app/routes/_authenticated/_tax-rates/tax-rates.tsx +108 -0
- package/src/app/routes/_authenticated/_tax-rates/tax-rates_.$id.tsx +148 -0
- package/src/app/routes/_authenticated/_zones/components/zone-countries-add.tsx +0 -0
- package/src/app/routes/_authenticated/_zones/components/zone-countries-sheet.tsx +31 -0
- package/src/app/routes/_authenticated/_zones/components/zone-countries-table.tsx +79 -0
- package/src/app/routes/_authenticated/_zones/zones.graphql.ts +96 -0
- package/src/app/routes/_authenticated/_zones/zones.tsx +57 -0
- package/src/app/routes/_authenticated/_zones/zones_.$id.tsx +103 -0
- package/src/app/routes/_authenticated/index.tsx +194 -0
- package/src/app/routes/_authenticated.tsx +25 -0
- package/src/app/routes/login.tsx +48 -0
- package/src/app/styles.css +82 -0
- package/src/app/tailwindcss-animate.css +275 -0
- package/src/i18n/locales/de.po +1579 -0
- package/src/i18n/locales/en.po +1579 -0
- package/src/lib/components/data-display/boolean.tsx +23 -0
- package/src/lib/components/data-display/date-time.tsx +13 -0
- package/src/lib/components/data-display/json.tsx +5 -0
- package/src/lib/components/data-display/money.tsx +15 -0
- package/src/lib/components/data-input/affixed-input.tsx +49 -0
- package/src/lib/components/data-input/customer-group-input.tsx +72 -0
- package/src/lib/components/data-input/datetime-input.tsx +150 -0
- package/src/lib/components/data-input/facet-value-input.tsx +68 -0
- package/src/lib/components/data-input/money-input.tsx +112 -0
- package/src/lib/components/data-input/richt-text-input.tsx +99 -0
- package/src/lib/components/data-table/data-table-column-header.tsx +73 -0
- package/src/lib/components/data-table/data-table-faceted-filter.tsx +172 -0
- package/src/lib/components/data-table/data-table-filter-dialog.tsx +73 -0
- package/src/lib/components/data-table/data-table-pagination.tsx +87 -0
- package/src/lib/components/data-table/data-table-view-options.tsx +53 -0
- package/src/lib/components/data-table/data-table.tsx +218 -0
- package/src/lib/components/layout/app-layout.tsx +42 -0
- package/src/lib/components/layout/app-sidebar.tsx +34 -0
- package/src/lib/components/layout/channel-switcher.tsx +87 -0
- package/src/lib/components/layout/content-language-selector.tsx +41 -0
- package/src/lib/components/layout/generated-breadcrumbs.tsx +82 -0
- package/src/lib/components/layout/language-dialog.tsx +104 -0
- package/src/lib/components/layout/nav-main.tsx +178 -0
- package/src/lib/components/layout/nav-projects.tsx +81 -0
- package/src/lib/components/layout/nav-user.tsx +176 -0
- package/src/lib/components/layout/prerelease-popup.tsx +38 -0
- package/src/lib/components/login/login-form.tsx +173 -0
- package/src/lib/components/shared/alerts.tsx +20 -0
- package/src/lib/components/shared/animated-number.tsx +49 -0
- package/src/lib/components/shared/asset-gallery.tsx +433 -0
- package/src/lib/components/shared/asset-picker-dialog.tsx +72 -0
- package/src/lib/components/shared/asset-preview-dialog.tsx +48 -0
- package/src/lib/components/shared/asset-preview.tsx +345 -0
- package/src/lib/components/shared/assigned-facet-values.tsx +68 -0
- package/src/lib/components/shared/channel-code-label.tsx +7 -0
- package/src/lib/components/shared/channel-selector.tsx +51 -0
- package/src/lib/components/shared/configurable-operation-arg-input.tsx +51 -0
- package/src/lib/components/shared/configurable-operation-input.tsx +133 -0
- package/src/lib/components/shared/confirmation-dialog.tsx +58 -0
- package/src/lib/components/shared/copyable-text.tsx +31 -0
- package/src/lib/components/shared/country-selector.tsx +105 -0
- package/src/lib/components/shared/currency-selector.tsx +33 -0
- package/src/lib/components/shared/custom-fields-form.tsx +86 -0
- package/src/lib/components/shared/customer-address-form.tsx +330 -0
- package/src/lib/components/shared/customer-group-chip.tsx +30 -0
- package/src/lib/components/shared/customer-group-selector.tsx +62 -0
- package/src/lib/components/shared/customer-selector.tsx +107 -0
- package/src/lib/components/shared/detail-page-button.tsx +22 -0
- package/src/lib/components/shared/entity-assets.tsx +340 -0
- package/src/lib/components/shared/error-page.tsx +31 -0
- package/src/lib/components/shared/facet-value-chip.tsx +45 -0
- package/src/lib/components/shared/facet-value-selector.tsx +306 -0
- package/src/lib/components/shared/focal-point-control.tsx +65 -0
- package/src/lib/components/shared/form-field-wrapper.tsx +37 -0
- package/src/lib/components/shared/history-timeline/history-entry.tsx +112 -0
- package/src/lib/components/shared/history-timeline/history-note-checkbox.tsx +28 -0
- package/src/lib/components/shared/history-timeline/history-note-editor.tsx +60 -0
- package/src/lib/components/shared/history-timeline/history-note-input.tsx +39 -0
- package/src/lib/components/shared/history-timeline/history-timeline.tsx +56 -0
- package/src/lib/components/shared/icon-mark.tsx +18 -0
- package/src/lib/components/shared/language-selector.tsx +48 -0
- package/src/lib/components/shared/logo-mark.tsx +24 -0
- package/src/lib/components/shared/multi-select.tsx +159 -0
- package/src/lib/components/shared/option-value-input.tsx +95 -0
- package/src/lib/components/shared/paginated-list-data-table.tsx +520 -0
- package/src/lib/components/shared/permission-guard.tsx +21 -0
- package/src/lib/components/shared/rich-text-editor.tsx +0 -0
- package/src/lib/components/shared/role-code-label.tsx +8 -0
- package/src/lib/components/shared/role-selector.tsx +56 -0
- package/src/lib/components/shared/seller-selector.tsx +107 -0
- package/src/lib/components/shared/tax-category-selector.tsx +65 -0
- package/src/lib/components/shared/translatable-form-field.tsx +74 -0
- package/src/lib/components/shared/vendure-image.tsx +159 -0
- package/src/lib/components/shared/zone-selector.tsx +66 -0
- package/src/lib/components/ui/accordion.tsx +59 -0
- package/src/lib/components/ui/alert-dialog.tsx +128 -0
- package/src/lib/components/ui/alert.tsx +60 -0
- package/src/lib/components/ui/avatar.tsx +38 -0
- package/src/lib/components/ui/badge.tsx +38 -0
- package/src/lib/components/ui/breadcrumb.tsx +102 -0
- package/src/lib/components/ui/button.tsx +51 -0
- package/src/lib/components/ui/calendar.tsx +69 -0
- package/src/lib/components/ui/card.tsx +47 -0
- package/src/lib/components/ui/checkbox.tsx +27 -0
- package/src/lib/components/ui/collapsible.tsx +33 -0
- package/src/lib/components/ui/command.tsx +133 -0
- package/src/lib/components/ui/dialog.tsx +116 -0
- package/src/lib/components/ui/dropdown-menu.tsx +220 -0
- package/src/lib/components/ui/form.tsx +141 -0
- package/src/lib/components/ui/hover-card.tsx +36 -0
- package/src/lib/components/ui/input.tsx +19 -0
- package/src/lib/components/ui/label.tsx +21 -0
- package/src/lib/components/ui/pagination.tsx +127 -0
- package/src/lib/components/ui/popover.tsx +40 -0
- package/src/lib/components/ui/scroll-area.tsx +50 -0
- package/src/lib/components/ui/select.tsx +161 -0
- package/src/lib/components/ui/separator.tsx +26 -0
- package/src/lib/components/ui/sheet.tsx +118 -0
- package/src/lib/components/ui/sidebar.tsx +696 -0
- package/src/lib/components/ui/skeleton.tsx +13 -0
- package/src/lib/components/ui/sonner.tsx +27 -0
- package/src/lib/components/ui/switch.tsx +26 -0
- package/src/lib/components/ui/table.tsx +82 -0
- package/src/lib/components/ui/tabs.tsx +48 -0
- package/src/lib/components/ui/textarea.tsx +18 -0
- package/src/lib/components/ui/tooltip.tsx +51 -0
- package/src/lib/constants.ts +326 -0
- package/src/lib/framework/component-registry/component-registry.tsx +70 -0
- package/src/lib/framework/component-registry/dynamic-component.tsx +58 -0
- package/src/lib/framework/dashboard-widget/base-widget.tsx +97 -0
- package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +96 -0
- package/src/lib/framework/dashboard-widget/latest-orders-widget/latest-orders-widget.graphql.ts +35 -0
- package/src/lib/framework/dashboard-widget/metrics-widget/chart.tsx +24 -0
- package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +82 -0
- package/src/lib/framework/dashboard-widget/metrics-widget/metrics-widget.graphql.ts +14 -0
- package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +167 -0
- package/src/lib/framework/dashboard-widget/orders-summary/order-summary-widget.graphql.ts +14 -0
- package/src/lib/framework/dashboard-widget/types.ts +22 -0
- package/src/lib/framework/dashboard-widget/widget-extensions.tsx +19 -0
- package/src/lib/framework/defaults.ts +219 -0
- package/src/lib/framework/document-introspection/add-custom-fields.spec.ts +242 -0
- package/src/lib/framework/document-introspection/add-custom-fields.ts +246 -0
- package/src/lib/framework/document-introspection/get-document-structure.spec.ts +310 -0
- package/src/lib/framework/document-introspection/get-document-structure.ts +460 -0
- package/src/lib/framework/document-introspection/hooks.ts +10 -0
- package/src/lib/framework/extension-api/define-dashboard-extension.ts +66 -0
- package/src/lib/framework/extension-api/extension-api-types.ts +58 -0
- package/src/lib/framework/extension-api/use-dashboard-extensions.ts +26 -0
- package/src/lib/framework/form-engine/form-schema-tools.ts +98 -0
- package/src/lib/framework/form-engine/use-generated-form.tsx +116 -0
- package/src/lib/framework/layout-engine/layout-extensions.ts +30 -0
- package/src/lib/framework/layout-engine/location-wrapper.tsx +96 -0
- package/src/lib/framework/layout-engine/page-layout.tsx +272 -0
- package/src/lib/framework/nav-menu/nav-menu-extensions.ts +66 -0
- package/src/lib/framework/page/detail-page-route-loader.tsx +48 -0
- package/src/lib/framework/page/detail-page.tsx +131 -0
- package/src/lib/framework/page/list-page.tsx +166 -0
- package/src/lib/framework/page/page-api.ts +9 -0
- package/src/lib/framework/page/page-types.ts +51 -0
- package/src/lib/framework/page/use-detail-page.ts +217 -0
- package/src/lib/framework/page/use-extended-router.tsx +69 -0
- package/src/lib/framework/registry/global-registry.ts +46 -0
- package/src/lib/framework/registry/registry-types.ts +15 -0
- package/src/lib/graphql/api.ts +61 -0
- package/src/lib/graphql/fragments.tsx +54 -0
- package/src/lib/graphql/graphql-env.d.ts +499 -0
- package/src/lib/graphql/graphql.ts +15 -0
- package/src/lib/hooks/use-auth.tsx +11 -0
- package/src/lib/hooks/use-channel.ts +12 -0
- package/src/lib/hooks/use-custom-field-config.ts +10 -0
- package/src/lib/hooks/use-grouped-permissions.ts +54 -0
- package/src/lib/hooks/use-local-format.ts +119 -0
- package/src/lib/hooks/use-mobile.ts +19 -0
- package/src/lib/hooks/use-page.tsx +11 -0
- package/src/lib/hooks/use-permissions.ts +22 -0
- package/src/lib/hooks/use-server-config.ts +4 -0
- package/src/lib/hooks/use-theme.ts +10 -0
- package/src/lib/hooks/use-user-settings.tsx +12 -0
- package/src/lib/index.ts +149 -0
- package/src/lib/lib/trans.tsx +16 -0
- package/src/lib/lib/utils.ts +60 -0
- package/src/lib/providers/auth.tsx +152 -0
- package/src/lib/providers/channel-provider.tsx +121 -0
- package/src/lib/providers/i18n-provider.tsx +28 -0
- package/src/lib/providers/server-config.tsx +279 -0
- package/src/lib/providers/theme-provider.tsx +54 -0
- package/src/lib/providers/user-settings.tsx +89 -0
- package/src/lib/virtual.d.ts +12 -0
- package/vite/config-loader.ts +181 -0
- package/vite/constants.ts +280 -0
- package/vite/index.ts +1 -0
- package/vite/schema-generator.ts +40 -0
- package/vite/ui-config.ts +60 -0
- package/vite/vite-plugin-admin-api-schema.ts +141 -0
- package/vite/vite-plugin-config-loader.ts +64 -0
- package/vite/vite-plugin-config.ts +42 -0
- package/vite/vite-plugin-dashboard-metadata.ts +58 -0
- package/vite/vite-plugin-gql-tada.ts +62 -0
- package/vite/vite-plugin-theme.ts +195 -0
- package/vite/vite-plugin-ui-config.ts +60 -0
- package/vite/vite-plugin-vendure-dashboard.ts +118 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Button } from '@/components/ui/button.js';
|
|
2
|
+
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from '@/components/ui/command.js';
|
|
3
|
+
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover.js';
|
|
4
|
+
import { api } from '@/graphql/api.js';
|
|
5
|
+
import { graphql } from '@/graphql/graphql.js';
|
|
6
|
+
import { Trans } from '@/lib/trans.js';
|
|
7
|
+
import { useQuery } from '@tanstack/react-query';
|
|
8
|
+
import { Plus, Search } from 'lucide-react';
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
|
|
11
|
+
const sellerListDocument = graphql(`
|
|
12
|
+
query SellerList($options: SellerListOptions) {
|
|
13
|
+
sellers(options: $options) {
|
|
14
|
+
items {
|
|
15
|
+
id
|
|
16
|
+
name
|
|
17
|
+
}
|
|
18
|
+
totalItems
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`);
|
|
22
|
+
|
|
23
|
+
export interface Seller {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface SellerSelectorProps {
|
|
29
|
+
value?: string | null;
|
|
30
|
+
onChange: (value: string) => void;
|
|
31
|
+
label?: string | React.ReactNode;
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function SellerSelector(props: SellerSelectorProps) {
|
|
36
|
+
const [open, setOpen] = useState(false);
|
|
37
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
38
|
+
|
|
39
|
+
const { data, isLoading } = useQuery({
|
|
40
|
+
queryKey: ['sellerList', searchTerm],
|
|
41
|
+
queryFn: () =>
|
|
42
|
+
api.query(sellerListDocument, {
|
|
43
|
+
options: {
|
|
44
|
+
sort: { name: 'ASC' },
|
|
45
|
+
filter: searchTerm ? {
|
|
46
|
+
name: { contains: searchTerm },
|
|
47
|
+
} : undefined,
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
staleTime: 1000 * 60, // 1 minute
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const handleSearch = (value: string) => {
|
|
54
|
+
setSearchTerm(value);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const selectedSeller = data?.sellers.items.find(seller => seller.id === props.value);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
61
|
+
<PopoverTrigger asChild>
|
|
62
|
+
<Button variant="outline" size="sm" type="button" disabled={props.readOnly} className="gap-2">
|
|
63
|
+
{selectedSeller ? (
|
|
64
|
+
<span className="flex-1 text-left">{selectedSeller.name}</span>
|
|
65
|
+
) : (
|
|
66
|
+
<>
|
|
67
|
+
<Plus className="h-4 w-4" />
|
|
68
|
+
{props.label ?? <Trans>Select seller</Trans>}
|
|
69
|
+
</>
|
|
70
|
+
)}
|
|
71
|
+
</Button>
|
|
72
|
+
</PopoverTrigger>
|
|
73
|
+
<PopoverContent className="p-0 w-[350px]" align="start">
|
|
74
|
+
<Command shouldFilter={false}>
|
|
75
|
+
<div className="flex items-center border-b px-3">
|
|
76
|
+
<CommandInput
|
|
77
|
+
placeholder="Search sellers..."
|
|
78
|
+
onValueChange={handleSearch}
|
|
79
|
+
className="h-10 flex-1 bg-transparent outline-none placeholder:text-muted-foreground"
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
<CommandList>
|
|
83
|
+
<CommandEmpty>
|
|
84
|
+
{isLoading ? (
|
|
85
|
+
<Trans>Loading...</Trans>
|
|
86
|
+
) : (
|
|
87
|
+
<Trans>No sellers found</Trans>
|
|
88
|
+
)}
|
|
89
|
+
</CommandEmpty>
|
|
90
|
+
{data?.sellers.items.map(seller => (
|
|
91
|
+
<CommandItem
|
|
92
|
+
key={seller.id}
|
|
93
|
+
onSelect={() => {
|
|
94
|
+
props.onChange(seller.id);
|
|
95
|
+
setOpen(false);
|
|
96
|
+
}}
|
|
97
|
+
className="flex flex-col items-start"
|
|
98
|
+
>
|
|
99
|
+
<div className="font-medium">{seller.name}</div>
|
|
100
|
+
</CommandItem>
|
|
101
|
+
))}
|
|
102
|
+
</CommandList>
|
|
103
|
+
</Command>
|
|
104
|
+
</PopoverContent>
|
|
105
|
+
</Popover>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Select,
|
|
3
|
+
SelectContent,
|
|
4
|
+
SelectGroup,
|
|
5
|
+
SelectItem,
|
|
6
|
+
SelectTrigger,
|
|
7
|
+
SelectValue,
|
|
8
|
+
} from '@/components/ui/select.js';
|
|
9
|
+
import { api } from '@/graphql/api.js';
|
|
10
|
+
import { graphql } from '@/graphql/graphql.js';
|
|
11
|
+
import { Trans } from '@/lib/trans.js';
|
|
12
|
+
import { useQuery } from '@tanstack/react-query';
|
|
13
|
+
import { Skeleton } from '../ui/skeleton.js';
|
|
14
|
+
|
|
15
|
+
const taxCategoriesDocument = graphql(`
|
|
16
|
+
query TaxCategories($options: TaxCategoryListOptions) {
|
|
17
|
+
taxCategories(options: $options) {
|
|
18
|
+
items {
|
|
19
|
+
id
|
|
20
|
+
name
|
|
21
|
+
isDefault
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`);
|
|
26
|
+
|
|
27
|
+
export interface TaxCategorySelectorProps {
|
|
28
|
+
value: string | undefined;
|
|
29
|
+
onChange: (value: string) => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function TaxCategorySelector({ value, onChange }: TaxCategorySelectorProps) {
|
|
33
|
+
const { data, isLoading, isPending, status } = useQuery({
|
|
34
|
+
queryKey: ['taxCategories'],
|
|
35
|
+
staleTime: 1000 * 60 * 5,
|
|
36
|
+
queryFn: () =>
|
|
37
|
+
api.query(taxCategoriesDocument, {
|
|
38
|
+
options: {
|
|
39
|
+
take: 100,
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
if (isLoading || isPending) {
|
|
44
|
+
return <Skeleton className="h-10 w-full" />;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Select value={value} onValueChange={value => value && onChange(value)}>
|
|
49
|
+
<SelectTrigger>
|
|
50
|
+
<SelectValue placeholder={<Trans>Select a tax category</Trans>} />
|
|
51
|
+
</SelectTrigger>
|
|
52
|
+
<SelectContent>
|
|
53
|
+
{data && (
|
|
54
|
+
<SelectGroup>
|
|
55
|
+
{data?.taxCategories.items.map(taxCategory => (
|
|
56
|
+
<SelectItem key={taxCategory.id} value={taxCategory.id}>
|
|
57
|
+
{taxCategory.name}
|
|
58
|
+
</SelectItem>
|
|
59
|
+
))}
|
|
60
|
+
</SelectGroup>
|
|
61
|
+
)}
|
|
62
|
+
</SelectContent>
|
|
63
|
+
</Select>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Controller } from 'react-hook-form';
|
|
2
|
+
import { FieldPath } from 'react-hook-form';
|
|
3
|
+
import { useUserSettings } from '@/hooks/use-user-settings.js';
|
|
4
|
+
import { ControllerProps } from 'react-hook-form';
|
|
5
|
+
import { FieldValues } from 'react-hook-form';
|
|
6
|
+
import { FormFieldWrapper } from './form-field-wrapper.js';
|
|
7
|
+
import { FormMessage } from '../ui/form.js';
|
|
8
|
+
import { FormControl } from '../ui/form.js';
|
|
9
|
+
import { FormItem } from '../ui/form.js';
|
|
10
|
+
import { FormDescription, FormField, FormLabel } from '../ui/form.js';
|
|
11
|
+
|
|
12
|
+
export type TranslatableEntity = FieldValues & {
|
|
13
|
+
translations?: Array<{ languageCode: string }> | null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type TranslatableFormFieldProps<TFieldValues extends TranslatableEntity | TranslatableEntity[]> = Omit<
|
|
17
|
+
ControllerProps<TFieldValues>,
|
|
18
|
+
'name'
|
|
19
|
+
> & {
|
|
20
|
+
name: TFieldValues extends TranslatableEntity
|
|
21
|
+
? keyof Omit<NonNullable<TFieldValues['translations']>[number], 'languageCode'>
|
|
22
|
+
: TFieldValues extends TranslatableEntity[]
|
|
23
|
+
? keyof Omit<NonNullable<TFieldValues[number]['translations']>[number], 'languageCode'>
|
|
24
|
+
: never;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const TranslatableFormField = <
|
|
28
|
+
TFieldValues extends TranslatableEntity | TranslatableEntity[] = TranslatableEntity,
|
|
29
|
+
>({
|
|
30
|
+
name,
|
|
31
|
+
...props
|
|
32
|
+
}: TranslatableFormFieldProps<TFieldValues>) => {
|
|
33
|
+
const { contentLanguage } = useUserSettings().settings;
|
|
34
|
+
const formValues = props.control?._formValues;
|
|
35
|
+
const translations = Array.isArray(formValues) ? formValues?.[0].translations : formValues?.translations;
|
|
36
|
+
const index = translations?.findIndex(
|
|
37
|
+
(translation: any) => translation?.languageCode === contentLanguage,
|
|
38
|
+
);
|
|
39
|
+
if (index === undefined || index === -1) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const translationName = `translations.${index}.${String(name)}` as FieldPath<TFieldValues>;
|
|
43
|
+
return <Controller {...props} name={translationName} key={translationName} />;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type TranslatableFormFieldWrapperProps<
|
|
47
|
+
TFieldValues extends TranslatableEntity | TranslatableEntity[],
|
|
48
|
+
> = TranslatableFormFieldProps<TFieldValues> &
|
|
49
|
+
Omit<React.ComponentProps<typeof FormFieldWrapper<TFieldValues>>, 'name'>;
|
|
50
|
+
|
|
51
|
+
export const TranslatableFormFieldWrapper = <
|
|
52
|
+
TFieldValues extends TranslatableEntity | TranslatableEntity[] = TranslatableEntity,
|
|
53
|
+
>({
|
|
54
|
+
name,
|
|
55
|
+
label,
|
|
56
|
+
description,
|
|
57
|
+
render,
|
|
58
|
+
...props
|
|
59
|
+
}: TranslatableFormFieldWrapperProps<TFieldValues>) => {
|
|
60
|
+
return (
|
|
61
|
+
<TranslatableFormField
|
|
62
|
+
control={props.control}
|
|
63
|
+
name={name}
|
|
64
|
+
render={renderArgs => (
|
|
65
|
+
<FormItem>
|
|
66
|
+
{label && <FormLabel>{label}</FormLabel>}
|
|
67
|
+
<FormControl>{render(renderArgs)}</FormControl>
|
|
68
|
+
{description && <FormDescription>{description}</FormDescription>}
|
|
69
|
+
<FormMessage />
|
|
70
|
+
</FormItem>
|
|
71
|
+
)}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { cn } from '@/lib/utils.js';
|
|
2
|
+
import { Image } from 'lucide-react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
export interface AssetLike {
|
|
6
|
+
id: string;
|
|
7
|
+
preview: string; // Base URL of the asset
|
|
8
|
+
name?: string | null;
|
|
9
|
+
focalPoint?: { x: number; y: number } | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ImagePreset = 'tiny' | 'thumb' | 'small' | 'medium' | 'large' | null;
|
|
13
|
+
export type ImageFormat = 'jpg' | 'jpeg' | 'png' | 'webp' | 'avif' | null;
|
|
14
|
+
export type ImageMode = 'crop' | 'resize' | null;
|
|
15
|
+
|
|
16
|
+
export interface VendureImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
17
|
+
asset: AssetLike | null | undefined;
|
|
18
|
+
preset?: ImagePreset;
|
|
19
|
+
mode?: ImageMode;
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
|
+
format?: ImageFormat;
|
|
23
|
+
quality?: number;
|
|
24
|
+
useFocalPoint?: boolean; // Whether to use the asset's focal point in crop mode
|
|
25
|
+
fallback?: React.ReactNode; // What to show if no asset is provided
|
|
26
|
+
ref?: React.Ref<HTMLImageElement>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function VendureImage({
|
|
30
|
+
asset,
|
|
31
|
+
preset = null,
|
|
32
|
+
mode = null,
|
|
33
|
+
width,
|
|
34
|
+
height,
|
|
35
|
+
format = null,
|
|
36
|
+
quality,
|
|
37
|
+
useFocalPoint = true,
|
|
38
|
+
fallback = null,
|
|
39
|
+
alt,
|
|
40
|
+
className,
|
|
41
|
+
style,
|
|
42
|
+
ref,
|
|
43
|
+
...imgProps
|
|
44
|
+
}: VendureImageProps) {
|
|
45
|
+
if (!asset) {
|
|
46
|
+
return fallback ? <>{fallback}</> : <PlaceholderImage preset={preset} width={width} height={height} className={className} />;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Build the URL with query parameters
|
|
50
|
+
const url = new URL(asset.preview);
|
|
51
|
+
|
|
52
|
+
// Handle preset if specified
|
|
53
|
+
if (preset) {
|
|
54
|
+
url.searchParams.set('preset', preset);
|
|
55
|
+
} else {
|
|
56
|
+
// Or handle custom dimensions and mode
|
|
57
|
+
if (width) url.searchParams.set('w', width.toString());
|
|
58
|
+
if (height) url.searchParams.set('h', height.toString());
|
|
59
|
+
if (mode) url.searchParams.set('mode', mode);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Add format if specified
|
|
63
|
+
if (format) {
|
|
64
|
+
url.searchParams.set('format', format);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Add quality if specified
|
|
68
|
+
if (quality) {
|
|
69
|
+
url.searchParams.set('q', quality.toString());
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Apply focal point if available and requested
|
|
73
|
+
if (useFocalPoint && asset.focalPoint && mode === 'crop') {
|
|
74
|
+
url.searchParams.set('fpx', asset.focalPoint.x.toString());
|
|
75
|
+
url.searchParams.set('fpy', asset.focalPoint.y.toString());
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<img
|
|
80
|
+
src={url.toString()}
|
|
81
|
+
alt={alt || asset.name || ''}
|
|
82
|
+
className={cn(className, 'rounded-sm')}
|
|
83
|
+
style={style}
|
|
84
|
+
loading="lazy"
|
|
85
|
+
ref={ref}
|
|
86
|
+
{...imgProps}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function PlaceholderImage({
|
|
92
|
+
width = 100,
|
|
93
|
+
height = 100,
|
|
94
|
+
preset = null,
|
|
95
|
+
className,
|
|
96
|
+
...props
|
|
97
|
+
}: React.ImgHTMLAttributes<HTMLImageElement> & { preset?: ImagePreset }) {
|
|
98
|
+
if (preset) {
|
|
99
|
+
switch (preset) {
|
|
100
|
+
case 'tiny':
|
|
101
|
+
width = 50;
|
|
102
|
+
height = 50;
|
|
103
|
+
break;
|
|
104
|
+
case 'thumb':
|
|
105
|
+
width = 150;
|
|
106
|
+
height = 150;
|
|
107
|
+
break;
|
|
108
|
+
case 'small':
|
|
109
|
+
width = 300;
|
|
110
|
+
height = 300;
|
|
111
|
+
break;
|
|
112
|
+
case 'medium':
|
|
113
|
+
width = 500;
|
|
114
|
+
height = 500;
|
|
115
|
+
break;
|
|
116
|
+
case 'large':
|
|
117
|
+
width = 800;
|
|
118
|
+
height = 800;
|
|
119
|
+
break;
|
|
120
|
+
default:
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return (
|
|
125
|
+
<div className={cn(className, 'rounded-sm bg-muted')} style={{ width, height }} {...props}>
|
|
126
|
+
<Image className="w-full h-full text-muted-foreground" />
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Convenience components for common use cases
|
|
132
|
+
export function Thumbnail({
|
|
133
|
+
asset,
|
|
134
|
+
size = 'thumb',
|
|
135
|
+
...props
|
|
136
|
+
}: Omit<VendureImageProps, 'preset'> & { size?: ImagePreset }) {
|
|
137
|
+
return <VendureImage asset={asset} preset={size} {...props} />;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function CroppedImage({ asset, width, height, ...props }: Omit<VendureImageProps, 'mode'>) {
|
|
141
|
+
return <VendureImage asset={asset} mode="crop" width={width} height={height} {...props} />;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function ResponsiveImage({
|
|
145
|
+
asset,
|
|
146
|
+
sizes = '100vw',
|
|
147
|
+
...props
|
|
148
|
+
}: VendureImageProps & { sizes?: string }) {
|
|
149
|
+
// Setup srcset with multiple sizes
|
|
150
|
+
const srcSet = [
|
|
151
|
+
`${asset?.preview}?w=320&mode=resize 320w`,
|
|
152
|
+
`${asset?.preview}?w=480&mode=resize 480w`,
|
|
153
|
+
`${asset?.preview}?w=640&mode=resize 640w`,
|
|
154
|
+
`${asset?.preview}?w=1024&mode=resize 1024w`,
|
|
155
|
+
`${asset?.preview}?w=1280&mode=resize 1280w`,
|
|
156
|
+
].join(', ');
|
|
157
|
+
|
|
158
|
+
return <VendureImage asset={asset} srcSet={srcSet} sizes={sizes} {...props} />;
|
|
159
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Select,
|
|
3
|
+
SelectContent,
|
|
4
|
+
SelectGroup,
|
|
5
|
+
SelectItem,
|
|
6
|
+
SelectTrigger,
|
|
7
|
+
SelectValue,
|
|
8
|
+
} from '@/components/ui/select.js';
|
|
9
|
+
import { api } from '@/graphql/api.js';
|
|
10
|
+
import { graphql } from '@/graphql/graphql.js';
|
|
11
|
+
import { Trans } from '@/lib/trans.js';
|
|
12
|
+
import { useQuery } from '@tanstack/react-query';
|
|
13
|
+
import { Skeleton } from '../ui/skeleton.js';
|
|
14
|
+
|
|
15
|
+
const zonesDocument = graphql(`
|
|
16
|
+
query Zones($options: ZoneListOptions) {
|
|
17
|
+
zones(options: $options) {
|
|
18
|
+
items {
|
|
19
|
+
id
|
|
20
|
+
name
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`);
|
|
25
|
+
|
|
26
|
+
export interface ZoneSelectorProps {
|
|
27
|
+
value: string | undefined;
|
|
28
|
+
onChange: (value: string) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function ZoneSelector({ value, onChange }: ZoneSelectorProps) {
|
|
32
|
+
const { data, isLoading, isPending } = useQuery({
|
|
33
|
+
queryKey: ['zones'],
|
|
34
|
+
staleTime: 1000 * 60 * 5,
|
|
35
|
+
queryFn: () =>
|
|
36
|
+
api.query(zonesDocument, {
|
|
37
|
+
options: {
|
|
38
|
+
take: 100,
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (isLoading || isPending) {
|
|
44
|
+
return <Skeleton className="h-10 w-full" />;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Select value={value} onValueChange={value => value && onChange(value)}>
|
|
49
|
+
<SelectTrigger>
|
|
50
|
+
<SelectValue placeholder={<Trans>Select a zone</Trans>} />
|
|
51
|
+
</SelectTrigger>
|
|
52
|
+
<SelectContent>
|
|
53
|
+
{data && (
|
|
54
|
+
<SelectGroup>
|
|
55
|
+
{data?.zones.items.map(zone => (
|
|
56
|
+
<SelectItem key={zone.id} value={zone.id}>
|
|
57
|
+
{zone.name}
|
|
58
|
+
</SelectItem>
|
|
59
|
+
))}
|
|
60
|
+
</SelectGroup>
|
|
61
|
+
)}
|
|
62
|
+
</SelectContent>
|
|
63
|
+
</Select>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
3
|
+
import { ChevronDownIcon } from 'lucide-react';
|
|
4
|
+
|
|
5
|
+
import { cn } from '@/lib/utils.js';
|
|
6
|
+
|
|
7
|
+
function Accordion({ ...props }: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
8
|
+
return <AccordionPrimitive.Root data-slot="accordion" {...props} />;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function AccordionItem({ className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
12
|
+
return (
|
|
13
|
+
<AccordionPrimitive.Item
|
|
14
|
+
data-slot="accordion-item"
|
|
15
|
+
className={cn('border-b last:border-b-0', className)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function AccordionTrigger({
|
|
22
|
+
className,
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
26
|
+
return (
|
|
27
|
+
<AccordionPrimitive.Header className="flex">
|
|
28
|
+
<AccordionPrimitive.Trigger
|
|
29
|
+
data-slot="accordion-trigger"
|
|
30
|
+
className={cn(
|
|
31
|
+
'focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180',
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
38
|
+
</AccordionPrimitive.Trigger>
|
|
39
|
+
</AccordionPrimitive.Header>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function AccordionContent({
|
|
44
|
+
className,
|
|
45
|
+
children,
|
|
46
|
+
...props
|
|
47
|
+
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
48
|
+
return (
|
|
49
|
+
<AccordionPrimitive.Content
|
|
50
|
+
data-slot="accordion-content"
|
|
51
|
+
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
52
|
+
{...props}
|
|
53
|
+
>
|
|
54
|
+
<div className={cn('pt-0 pb-4', className)}>{children}</div>
|
|
55
|
+
</AccordionPrimitive.Content>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils.js';
|
|
5
|
+
import { buttonVariants } from '@/components/ui/button.js';
|
|
6
|
+
|
|
7
|
+
function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
|
|
8
|
+
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
|
|
12
|
+
return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
|
|
16
|
+
return <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function AlertDialogOverlay({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
|
|
23
|
+
return (
|
|
24
|
+
<AlertDialogPrimitive.Overlay
|
|
25
|
+
data-slot="alert-dialog-overlay"
|
|
26
|
+
className={cn(
|
|
27
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
|
|
28
|
+
className,
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function AlertDialogContent({
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
|
|
39
|
+
return (
|
|
40
|
+
<AlertDialogPortal>
|
|
41
|
+
<AlertDialogOverlay />
|
|
42
|
+
<AlertDialogPrimitive.Content
|
|
43
|
+
data-slot="alert-dialog-content"
|
|
44
|
+
className={cn(
|
|
45
|
+
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
</AlertDialogPortal>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
55
|
+
return (
|
|
56
|
+
<div
|
|
57
|
+
data-slot="alert-dialog-header"
|
|
58
|
+
className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
data-slot="alert-dialog-footer"
|
|
68
|
+
className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
|
75
|
+
return (
|
|
76
|
+
<AlertDialogPrimitive.Title
|
|
77
|
+
data-slot="alert-dialog-title"
|
|
78
|
+
className={cn('text-lg font-semibold', className)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function AlertDialogDescription({
|
|
85
|
+
className,
|
|
86
|
+
...props
|
|
87
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
|
|
88
|
+
return (
|
|
89
|
+
<AlertDialogPrimitive.Description
|
|
90
|
+
data-slot="alert-dialog-description"
|
|
91
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function AlertDialogAction({
|
|
98
|
+
className,
|
|
99
|
+
...props
|
|
100
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
|
|
101
|
+
return <AlertDialogPrimitive.Action className={cn(buttonVariants(), className)} {...props} />;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function AlertDialogCancel({
|
|
105
|
+
className,
|
|
106
|
+
...props
|
|
107
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
|
|
108
|
+
return (
|
|
109
|
+
<AlertDialogPrimitive.Cancel
|
|
110
|
+
className={cn(buttonVariants({ variant: 'outline' }), className)}
|
|
111
|
+
{...props}
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
AlertDialog,
|
|
118
|
+
AlertDialogPortal,
|
|
119
|
+
AlertDialogOverlay,
|
|
120
|
+
AlertDialogTrigger,
|
|
121
|
+
AlertDialogContent,
|
|
122
|
+
AlertDialogHeader,
|
|
123
|
+
AlertDialogFooter,
|
|
124
|
+
AlertDialogTitle,
|
|
125
|
+
AlertDialogDescription,
|
|
126
|
+
AlertDialogAction,
|
|
127
|
+
AlertDialogCancel,
|
|
128
|
+
};
|