@mohasinac/appkit 2.7.55 → 2.7.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/shared/actions/action-registry.js +31 -5
- package/dist/client.d.ts +1 -3
- package/dist/client.js +1 -2
- package/dist/constants/field-names.d.ts +3 -0
- package/dist/constants/field-names.js +3 -0
- package/dist/features/about/components/FAQPageView.js +2 -2
- package/dist/features/about/components/FeesView.js +1 -1
- package/dist/features/about/components/PolicyPageView.js +1 -1
- package/dist/features/about/components/PublicProfileView.js +1 -1
- package/dist/features/account/components/AddressesIndexListing.js +1 -1
- package/dist/features/account/components/MessagesView.js +1 -1
- package/dist/features/account/components/NotificationPreferencesPanel.js +12 -3
- package/dist/features/account/components/UserOffersPanel.js +2 -2
- package/dist/features/account/components/UserSidebar.js +3 -3
- package/dist/features/account/components/UserSupportView.js +1 -1
- package/dist/features/admin/components/AdminAllEventEntriesView.js +1 -1
- package/dist/features/admin/components/AdminBidsView.js +5 -1
- package/dist/features/admin/components/AdminBlogView.js +6 -1
- package/dist/features/admin/components/AdminBrandsView.js +6 -1
- package/dist/features/admin/components/AdminBundleEditorView.js +13 -9
- package/dist/features/admin/components/AdminBundlesView.js +3 -1
- package/dist/features/admin/components/AdminCarouselEditorView.js +7 -8
- package/dist/features/admin/components/AdminCarouselView.js +4 -2
- package/dist/features/admin/components/AdminCartsView.js +1 -1
- package/dist/features/admin/components/AdminCategoriesView.js +6 -1
- package/dist/features/admin/components/AdminContactView.js +3 -1
- package/dist/features/admin/components/AdminCouponsView.js +4 -2
- package/dist/features/admin/components/AdminEmployeeEditorView.js +1 -1
- package/dist/features/admin/components/AdminFaqsView.js +3 -1
- package/dist/features/admin/components/AdminFeatureFlagsView.js +1 -1
- package/dist/features/admin/components/AdminFeaturesView.js +4 -0
- package/dist/features/admin/components/AdminMediaView.js +10 -5
- package/dist/features/admin/components/AdminNavigationView.js +1 -1
- package/dist/features/admin/components/AdminNewsletterView.js +3 -1
- package/dist/features/admin/components/AdminNotificationsView.js +6 -1
- package/dist/features/admin/components/AdminOrdersView.js +10 -1
- package/dist/features/admin/components/AdminPayoutsView.js +5 -1
- package/dist/features/admin/components/AdminPrizeDrawsView.js +4 -0
- package/dist/features/admin/components/AdminProductsView.js +13 -1
- package/dist/features/admin/components/AdminReviewsView.js +6 -1
- package/dist/features/admin/components/AdminScammersView.js +1 -1
- package/dist/features/admin/components/AdminSectionsView.js +1 -1
- package/dist/features/admin/components/AdminSessionsView.js +5 -1
- package/dist/features/admin/components/AdminSidebar.js +3 -3
- package/dist/features/admin/components/AdminSiteSettingsView.js +1 -1
- package/dist/features/admin/components/AdminStoreEditorView.js +1 -1
- package/dist/features/admin/components/AdminStoresView.js +6 -1
- package/dist/features/admin/components/AdminSublistingCategoriesView.js +2 -0
- package/dist/features/admin/components/AdminSupportTicketDetailView.js +1 -1
- package/dist/features/admin/components/AdminSupportTicketsView.js +1 -1
- package/dist/features/admin/components/AdminTeamView.js +3 -1
- package/dist/features/admin/components/AdminUserEditorView.js +1 -1
- package/dist/features/admin/components/AdminUsersView.js +5 -1
- package/dist/features/admin/components/AdminViewCards.js +2 -2
- package/dist/features/admin/constants/filter-tabs.d.ts +9 -0
- package/dist/features/admin/constants/filter-tabs.js +3 -0
- package/dist/features/auctions/components/AuctionBottomActions.d.ts +7 -0
- package/dist/features/auctions/components/AuctionBottomActions.js +24 -0
- package/dist/features/auctions/components/AuctionDetailPageView.js +7 -7
- package/dist/features/auctions/components/AuctionsListView.js +1 -1
- package/dist/features/auctions/components/MarketplaceAuctionGrid.js +1 -1
- package/dist/features/auctions/components/PlaceBidFormClient.js +1 -1
- package/dist/features/auth/components/LoginForm.js +1 -1
- package/dist/features/auth/components/VerifyEmailView.js +2 -2
- package/dist/features/before-after/components/BeforeAfterGallery.js +1 -1
- package/dist/features/blog/components/BlogFeaturedCard.js +1 -1
- package/dist/features/blog/components/BlogIndexListing.js +1 -1
- package/dist/features/blog/components/BlogListView.js +2 -2
- package/dist/features/blog/components/BlogPostView.js +8 -8
- package/dist/features/cart/components/CartDrawer.js +1 -1
- package/dist/features/cart/repository/cart.repository.js +11 -4
- package/dist/features/cart/schemas/firestore.d.ts +3 -0
- package/dist/features/categories/components/BrandDetailPageView.js +1 -1
- package/dist/features/categories/components/CategoriesIndexListing.js +1 -1
- package/dist/features/categories/components/CategoryDetailPageView.js +39 -3
- package/dist/features/categories/components/CategoryDetailTabs.d.ts +4 -1
- package/dist/features/categories/components/CategoryDetailTabs.js +7 -2
- package/dist/features/categories/components/CategoryGrid.js +1 -1
- package/dist/features/categories/components/CategoryProductsView.js +1 -1
- package/dist/features/categories/components/CategoryStoresListing.d.ts +5 -0
- package/dist/features/categories/components/CategoryStoresListing.js +11 -0
- package/dist/features/categories/components/CategoryTableColumns.js +2 -2
- package/dist/features/categories/components/CategoryTree.js +1 -1
- package/dist/features/categories/components/index.d.ts +2 -0
- package/dist/features/categories/components/index.js +1 -0
- package/dist/features/checkout/components/CheckoutStepper.js +1 -1
- package/dist/features/classified/components/ClassifiedIndexListing.js +2 -0
- package/dist/features/classified/components/ClassifiedListView.js +1 -1
- package/dist/features/contact/components/ContactInfoSidebar.js +1 -1
- package/dist/features/digital-codes/components/DigitalCodesIndexListing.js +2 -0
- package/dist/features/digital-codes/components/DigitalCodesListView.js +1 -1
- package/dist/features/events/components/AdminEventsView.js +5 -1
- package/dist/features/events/components/EventCard.js +1 -1
- package/dist/features/events/components/EventPollWidget.js +1 -1
- package/dist/features/events/components/EventStatusBadge.js +5 -5
- package/dist/features/events/components/EventsIndexListing.js +1 -1
- package/dist/features/events/components/EventsListView.js +2 -2
- package/dist/features/events/components/SpinWheelView.js +4 -2
- package/dist/features/filters/AsyncFacetSection.js +3 -3
- package/dist/features/filters/FilterFacetSection.js +5 -5
- package/dist/features/filters/RangeFilter.js +1 -1
- package/dist/features/forms/Input.js +2 -2
- package/dist/features/forms/Select.js +1 -1
- package/dist/features/forms/Slider.js +1 -1
- package/dist/features/forms/Textarea.js +1 -1
- package/dist/features/forms/utils.d.ts +1 -1
- package/dist/features/forms/utils.js +1 -1
- package/dist/features/history/hooks/useHistory.js +23 -10
- package/dist/features/homepage/components/AdvertisementBanner.js +2 -2
- package/dist/features/homepage/components/FeaturedResultsSection.js +1 -1
- package/dist/features/homepage/components/HeroSection.js +1 -1
- package/dist/features/homepage/components/NewsletterSection.js +1 -1
- package/dist/features/homepage/components/SectionCarousel.js +1 -1
- package/dist/features/live/components/LiveItemsIndexListing.js +2 -0
- package/dist/features/live/components/LiveItemsListView.js +1 -1
- package/dist/features/orders/components/OrdersList.js +12 -12
- package/dist/features/pre-orders/components/MarketplacePreorderCard.js +1 -1
- package/dist/features/pre-orders/components/PreOrderActionsClient.js +1 -1
- package/dist/features/pre-orders/components/PreOrderBadge.js +5 -5
- package/dist/features/pre-orders/components/PreOrderBottomActions.d.ts +5 -0
- package/dist/features/pre-orders/components/PreOrderBottomActions.js +22 -0
- package/dist/features/pre-orders/components/PreOrderDetailPageView.js +5 -5
- package/dist/features/pre-orders/components/PreOrdersIndexListing.js +47 -0
- package/dist/features/pre-orders/components/PreOrdersListView.js +1 -1
- package/dist/features/pre-orders/components/PreorderCard.js +3 -3
- package/dist/features/products/components/AuctionsIndexListing.js +23 -0
- package/dist/features/products/components/BidHistory.js +2 -2
- package/dist/features/products/components/CompareOverlay.js +1 -1
- package/dist/features/products/components/CustomFieldsEditor.js +1 -1
- package/dist/features/products/components/CustomSectionTabContent.js +1 -1
- package/dist/features/products/components/CustomSectionsEditor.js +1 -1
- package/dist/features/products/components/GroupSettingsPanel.js +2 -2
- package/dist/features/products/components/MakeOfferButton.js +1 -1
- package/dist/features/products/components/PrizeDrawBottomActions.d.ts +6 -0
- package/dist/features/products/components/PrizeDrawBottomActions.js +24 -0
- package/dist/features/products/components/PrizeDrawDetailPageView.js +3 -5
- package/dist/features/products/components/PrizeDrawEntryActions.js +5 -18
- package/dist/features/products/components/PrizeRevealModal.js +5 -2
- package/dist/features/products/components/ProductDetailActions.d.ts +6 -1
- package/dist/features/products/components/ProductDetailActions.js +36 -6
- package/dist/features/products/components/ProductDetailPageView.js +17 -16
- package/dist/features/products/components/ProductGalleryClient.js +1 -1
- package/dist/features/products/components/ProductGrid.js +6 -6
- package/dist/features/products/components/ProductTabs.js +1 -1
- package/dist/features/products/components/ProductTabsShell.js +1 -1
- package/dist/features/products/components/ProductsIndexListing.js +47 -0
- package/dist/features/products/components/RelatedProducts.js +1 -1
- package/dist/features/products/components/ShowGroupSection.js +1 -1
- package/dist/features/products/components/SublistingCarouselSection.js +1 -1
- package/dist/features/products/components/SublistingCategorySelect.js +1 -1
- package/dist/features/products/components/index.d.ts +0 -2
- package/dist/features/products/components/index.js +0 -1
- package/dist/features/products/constants/action-defs.d.ts +7 -0
- package/dist/features/products/constants/action-defs.js +14 -0
- package/dist/features/products/constants/listing-tabs.d.ts +6 -0
- package/dist/features/products/constants/listing-tabs.js +1 -0
- package/dist/features/promotions/components/CouponCard.js +2 -2
- package/dist/features/promotions/components/CouponsIndexListing.js +2 -2
- package/dist/features/reviews/components/ReviewDetailPageView.js +1 -1
- package/dist/features/reviews/components/ReviewDetailShell.js +3 -3
- package/dist/features/reviews/components/ReviewModal.js +2 -2
- package/dist/features/reviews/components/ReviewSummary.js +1 -1
- package/dist/features/reviews/components/ReviewsIndexListing.js +1 -1
- package/dist/features/reviews/components/ReviewsList.js +1 -1
- package/dist/features/seller/components/SellerAddressesView.js +4 -3
- package/dist/features/seller/components/SellerAnalyticsAlertsView.js +1 -1
- package/dist/features/seller/components/SellerAuctionsView.js +10 -3
- package/dist/features/seller/components/SellerBidsView.js +22 -7
- package/dist/features/seller/components/SellerBundlesView.js +10 -3
- package/dist/features/seller/components/SellerClassifiedView.js +10 -3
- package/dist/features/seller/components/SellerCouponsView.js +13 -4
- package/dist/features/seller/components/SellerDigitalCodesView.js +10 -3
- package/dist/features/seller/components/SellerGoogleReviewsView.js +10 -5
- package/dist/features/seller/components/SellerGroupedListingsView.js +2 -0
- package/dist/features/seller/components/SellerLiveView.js +10 -3
- package/dist/features/seller/components/SellerOffersPanel.js +2 -2
- package/dist/features/seller/components/SellerOffersView.js +1 -1
- package/dist/features/seller/components/SellerOrdersView.js +40 -17
- package/dist/features/seller/components/SellerPayoutMethodsView.js +13 -4
- package/dist/features/seller/components/SellerPayoutsView.js +1 -1
- package/dist/features/seller/components/SellerPreOrdersView.js +7 -2
- package/dist/features/seller/components/SellerPrizeDrawsView.js +7 -2
- package/dist/features/seller/components/SellerProductShell.js +27 -9
- package/dist/features/seller/components/SellerProductsCards.js +2 -1
- package/dist/features/seller/components/SellerProductsView.js +21 -8
- package/dist/features/seller/components/SellerReviewsView.js +8 -0
- package/dist/features/seller/components/SellerShippingConfigsView.js +13 -4
- package/dist/features/seller/components/SellerSidebar.js +2 -2
- package/dist/features/seller/components/SellerStoreCategoriesView.js +10 -3
- package/dist/features/seller/components/SellerTemplatesView.js +19 -6
- package/dist/features/shell/StepForm.js +9 -3
- package/dist/features/site-settings/components/ActionPermissionsManager.js +1 -1
- package/dist/features/site-settings/components/NavPermissionsManager.js +1 -1
- package/dist/features/stores/components/InteractiveStoreCard.js +1 -1
- package/dist/features/stores/components/StoreDetailLayoutView.js +1 -1
- package/dist/features/stores/components/StoreReviewsListing.js +1 -1
- package/dist/features/stores/components/StoresIndexListing.js +17 -1
- package/dist/features/whatsapp-bot/components/SellerWhatsAppSettingsView.js +1 -1
- package/dist/features/wishlist/components/WishlistPage.js +2 -2
- package/dist/features/wishlist/hooks/useWishlistToggle.js +6 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +6 -3
- package/dist/react/hooks/use-action-dispatch.d.ts +5 -0
- package/dist/react/hooks/use-action-dispatch.js +10 -0
- package/dist/seed/cart-seed-data.js +50 -3
- package/dist/seed/categories-seed-data.js +80 -16
- package/dist/seed/index.d.ts +3 -0
- package/dist/seed/index.js +3 -0
- package/dist/seed/manifest.js +15 -1
- package/dist/seed/products-classifieds-seed-data.d.ts +10 -0
- package/dist/seed/products-classifieds-seed-data.js +197 -0
- package/dist/seed/products-digital-codes-seed-data.d.ts +10 -0
- package/dist/seed/products-digital-codes-seed-data.js +204 -0
- package/dist/seed/products-live-items-seed-data.d.ts +13 -0
- package/dist/seed/products-live-items-seed-data.js +190 -0
- package/dist/styles.css +16 -1
- package/dist/tailwind-utilities.css +1 -1
- package/dist/tokens/index.d.ts +3 -3
- package/dist/tokens/index.js +3 -3
- package/dist/ui/DataTable.js +3 -3
- package/dist/ui/components/Button.style.css +15 -0
- package/dist/ui/components/Input.js +1 -1
- package/dist/ui/components/ListingToolbar.js +1 -1
- package/dist/ui/components/Select.js +1 -1
- package/dist/ui/components/StatsGrid.js +1 -1
- package/dist/ui/index.d.ts +0 -4
- package/dist/ui/index.js +0 -2
- package/package.json +1 -1
- package/dist/_internal/client/features/seller/print-center/InventoryLabel.d.ts +0 -12
- package/dist/_internal/client/features/seller/print-center/InventoryLabel.js +0 -49
- package/dist/_internal/client/features/seller/print-center/LabelDesignPicker.d.ts +0 -7
- package/dist/_internal/client/features/seller/print-center/LabelDesignPicker.js +0 -32
- package/dist/_internal/client/features/seller/print-center/OrderPackingLabel.d.ts +0 -28
- package/dist/_internal/client/features/seller/print-center/OrderPackingLabel.js +0 -33
- package/dist/_internal/client/features/seller/print-center/PhysicalLocationModal.d.ts +0 -12
- package/dist/_internal/client/features/seller/print-center/PhysicalLocationModal.js +0 -30
- package/dist/_internal/client/features/seller/print-center/PrintCenterView.d.ts +0 -12
- package/dist/_internal/client/features/seller/print-center/PrintCenterView.js +0 -102
- package/dist/_internal/client/features/seller/print-center/PrintGrid.d.ts +0 -12
- package/dist/_internal/client/features/seller/print-center/PrintGrid.js +0 -13
- package/dist/_internal/client/features/seller/print-center/StoreCard.d.ts +0 -19
- package/dist/_internal/client/features/seller/print-center/StoreCard.js +0 -30
- package/dist/_internal/client/features/seller/print-center/WebsiteCard.d.ts +0 -11
- package/dist/_internal/client/features/seller/print-center/WebsiteCard.js +0 -25
- package/dist/_internal/client/features/seller/print-center/index.d.ts +0 -11
- package/dist/_internal/client/features/seller/print-center/index.js +0 -10
- package/dist/_internal/client/features/seller/print-center/types.d.ts +0 -20
- package/dist/_internal/client/features/seller/print-center/types.js +0 -20
- package/dist/_internal/client/features/seller/print-center/useInventoryPdf.d.ts +0 -18
- package/dist/_internal/client/features/seller/print-center/useInventoryPdf.js +0 -76
- package/dist/features/account/repository/address.repository.d.ts +0 -17
- package/dist/features/account/repository/address.repository.js +0 -184
- package/dist/features/auctions/components/AuctionCard.d.ts +0 -29
- package/dist/features/auctions/components/AuctionCard.js +0 -38
- package/dist/features/categories/components/BundleAddToCartCta.d.ts +0 -16
- package/dist/features/categories/components/BundleAddToCartCta.js +0 -54
- package/dist/features/categories/components/CategoriesListView.d.ts +0 -31
- package/dist/features/categories/components/CategoriesListView.js +0 -27
- package/dist/features/products/components/AuctionsView.d.ts +0 -6
- package/dist/features/products/components/AuctionsView.js +0 -5
- package/dist/features/products/components/BuyBar.d.ts +0 -21
- package/dist/features/products/components/BuyBar.js +0 -19
- package/dist/features/products/components/PreOrdersView.d.ts +0 -6
- package/dist/features/products/components/PreOrdersView.js +0 -5
- package/dist/features/reviews/components/ReviewsListView.d.ts +0 -31
- package/dist/features/reviews/components/ReviewsListView.js +0 -16
- package/dist/features/stores/components/StoresListView.d.ts +0 -19
- package/dist/features/stores/components/StoresListView.js +0 -25
- package/dist/features/stores/repository/store-address.repository.d.ts +0 -55
- package/dist/features/stores/repository/store-address.repository.js +0 -187
- package/dist/ui/components/BulkActionsBar.d.ts +0 -18
- package/dist/ui/components/BulkActionsBar.js +0 -25
- package/dist/ui/components/CollageLightbox.d.ts +0 -18
- package/dist/ui/components/CollageLightbox.js +0 -41
- package/dist/ui/components/StickyBottomBar.d.ts +0 -22
- package/dist/ui/components/StickyBottomBar.js +0 -20
package/dist/tokens/index.d.ts
CHANGED
|
@@ -366,7 +366,7 @@ export declare const THEME_CONSTANTS: {
|
|
|
366
366
|
readonly bgInput: "bg-white dark:bg-slate-800/60";
|
|
367
367
|
readonly textPrimary: "text-zinc-900 dark:text-zinc-50";
|
|
368
368
|
readonly textSecondary: "text-zinc-500 dark:text-zinc-400";
|
|
369
|
-
readonly textMuted: "text-zinc-400 dark:text-zinc-
|
|
369
|
+
readonly textMuted: "text-zinc-400 dark:text-zinc-400";
|
|
370
370
|
readonly textError: "text-red-600 dark:text-red-400";
|
|
371
371
|
readonly textSuccess: "text-emerald-600 dark:text-emerald-400";
|
|
372
372
|
readonly textOnPrimary: "text-white";
|
|
@@ -585,7 +585,7 @@ export declare const THEME_CONSTANTS: {
|
|
|
585
585
|
readonly base: "rounded-lg border border-zinc-200 dark:border-slate-700 bg-white dark:bg-slate-800/60 px-3.5 py-2.5 text-base sm:text-sm text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-primary-500/40 dark:focus:ring-secondary-400/40 focus:border-primary-500 dark:focus:border-secondary-400 focus:outline-none transition-colors duration-150 placeholder:text-zinc-400 dark:placeholder:text-zinc-500";
|
|
586
586
|
readonly error: "border-red-400 dark:border-red-500 focus:ring-red-500/20 focus:border-red-500 bg-red-50/30 dark:bg-red-950/10";
|
|
587
587
|
readonly success: "border-emerald-400 dark:border-emerald-500 focus:ring-emerald-500/20 focus:border-emerald-500";
|
|
588
|
-
readonly disabled: "bg-zinc-50 dark:bg-slate-800/30 text-zinc-400 dark:text-zinc-
|
|
588
|
+
readonly disabled: "bg-zinc-50 dark:bg-slate-800/30 text-zinc-400 dark:text-zinc-400 cursor-not-allowed opacity-60";
|
|
589
589
|
readonly withIcon: "pl-10";
|
|
590
590
|
};
|
|
591
591
|
readonly card: {
|
|
@@ -778,7 +778,7 @@ export declare const THEME_CONSTANTS: {
|
|
|
778
778
|
readonly emptyState: "flex flex-col items-center justify-center py-12 text-center text-zinc-500 dark:text-zinc-400";
|
|
779
779
|
};
|
|
780
780
|
readonly icon: {
|
|
781
|
-
readonly muted: "text-zinc-400 dark:text-zinc-
|
|
781
|
+
readonly muted: "text-zinc-400 dark:text-zinc-400";
|
|
782
782
|
readonly primary: "text-primary-600 dark:text-secondary-400";
|
|
783
783
|
readonly success: "text-emerald-500 dark:text-emerald-400";
|
|
784
784
|
readonly danger: "text-red-500 dark:text-red-400";
|
package/dist/tokens/index.js
CHANGED
|
@@ -203,7 +203,7 @@ const THEMED = {
|
|
|
203
203
|
// Text
|
|
204
204
|
textPrimary: "text-zinc-900 dark:text-zinc-50",
|
|
205
205
|
textSecondary: "text-zinc-500 dark:text-zinc-400",
|
|
206
|
-
textMuted: "text-zinc-400 dark:text-zinc-
|
|
206
|
+
textMuted: "text-zinc-400 dark:text-zinc-400",
|
|
207
207
|
textError: "text-red-600 dark:text-red-400",
|
|
208
208
|
textSuccess: "text-emerald-600 dark:text-emerald-400",
|
|
209
209
|
textOnPrimary: "text-white",
|
|
@@ -488,7 +488,7 @@ const INPUT = {
|
|
|
488
488
|
base: "rounded-lg border border-zinc-200 dark:border-slate-700 bg-white dark:bg-slate-800/60 px-3.5 py-2.5 text-base sm:text-sm text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-primary-500/40 dark:focus:ring-secondary-400/40 focus:border-primary-500 dark:focus:border-secondary-400 focus:outline-none transition-colors duration-150 placeholder:text-zinc-400 dark:placeholder:text-zinc-500",
|
|
489
489
|
error: "border-red-400 dark:border-red-500 focus:ring-red-500/20 focus:border-red-500 bg-red-50/30 dark:bg-red-950/10",
|
|
490
490
|
success: "border-emerald-400 dark:border-emerald-500 focus:ring-emerald-500/20 focus:border-emerald-500",
|
|
491
|
-
disabled: "bg-zinc-50 dark:bg-slate-800/30 text-zinc-400 dark:text-zinc-
|
|
491
|
+
disabled: "bg-zinc-50 dark:bg-slate-800/30 text-zinc-400 dark:text-zinc-400 cursor-not-allowed opacity-60",
|
|
492
492
|
withIcon: "pl-10",
|
|
493
493
|
};
|
|
494
494
|
/**
|
|
@@ -674,7 +674,7 @@ const PATTERNS = {
|
|
|
674
674
|
};
|
|
675
675
|
/** Icon colour variants and sizes. */
|
|
676
676
|
const ICON = {
|
|
677
|
-
muted: "text-zinc-400 dark:text-zinc-
|
|
677
|
+
muted: "text-zinc-400 dark:text-zinc-400",
|
|
678
678
|
primary: "text-primary-600 dark:text-secondary-400",
|
|
679
679
|
success: "text-emerald-500 dark:text-emerald-400",
|
|
680
680
|
danger: "text-red-500 dark:text-red-400",
|
package/dist/ui/DataTable.js
CHANGED
|
@@ -98,7 +98,7 @@ pageSize: pageSizeProp, stickyHeader: stickyHeaderProp, striped: stripedProp, sh
|
|
|
98
98
|
if (data.length === 0) {
|
|
99
99
|
if (emptyState)
|
|
100
100
|
return _jsx(_Fragment, { children: emptyState });
|
|
101
|
-
return (_jsx("div", { className: "appkit-data-table__wrapper", "data-section": "datatable-div-632", children: _jsx("div", { className: "appkit-data-table__empty", "data-section": "datatable-div-633", children: _jsxs("div", { className: "text-center px-4", "data-section": "datatable-div-634", children: [emptyIcon ?? (_jsx("svg", { className: "mx-auto h-12 w-12 text-zinc-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4" }) })), _jsx(Text, { size: "sm", weight: "semibold", className: "mt-4", children: emptyTitle ?? noDataTitle }), _jsx(Text, { size: "sm", variant: "secondary", className: "mt-1", children: emptyMessage ?? noDataDescription })] }) }) }));
|
|
101
|
+
return (_jsx("div", { className: "appkit-data-table__wrapper", "data-section": "datatable-div-632", children: _jsx("div", { className: "appkit-data-table__empty", "data-section": "datatable-div-633", children: _jsxs("div", { className: "text-center px-4", "data-section": "datatable-div-634", children: [emptyIcon ?? (_jsx("svg", { className: "mx-auto h-12 w-12 text-zinc-400 dark:text-zinc-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4" }) })), _jsx(Text, { size: "sm", weight: "semibold", className: "mt-4", children: emptyTitle ?? noDataTitle }), _jsx(Text, { size: "sm", variant: "secondary", className: "mt-1", children: emptyMessage ?? noDataDescription })] }) }) }));
|
|
102
102
|
}
|
|
103
103
|
const renderViewToggle = () => {
|
|
104
104
|
if (!showViewToggle)
|
|
@@ -132,7 +132,7 @@ pageSize: pageSizeProp, stickyHeader: stickyHeaderProp, striped: stripedProp, sh
|
|
|
132
132
|
? "ascending"
|
|
133
133
|
: "descending"
|
|
134
134
|
: "none"
|
|
135
|
-
: undefined, className: `appkit-data-table__th ${col.sortable ? "appkit-data-table__th--sortable" : ""}`, style: { width: col.width }, onClick: () => col.sortable && handleSort(col.key), children: _jsxs(Row, { gap: "sm", children: [col.header, col.sortable && (_jsx("span", { className: "text-zinc-400", "aria-hidden": "true", children: sortKey === col.key ? (sortDirection === "asc" ? ("↑") : ("↓")) : (_jsx("span", { className: "opacity-30", children: "\u2195" })) }))] }) }, col.key))), actions && (_jsx("th", { scope: "col", className: "appkit-data-table__th appkit-data-table__td--actions", children: labelActions }))] }) }), _jsx("tbody", { className: "appkit-data-table__tbody divide-y divide-zinc-200 dark:divide-slate-700", children: paginatedData.map((item, index) => (_jsxs("tr", { className: [
|
|
135
|
+
: undefined, className: `appkit-data-table__th ${col.sortable ? "appkit-data-table__th--sortable" : ""}`, style: { width: col.width }, onClick: () => col.sortable && handleSort(col.key), children: _jsxs(Row, { gap: "sm", children: [col.header, col.sortable && (_jsx("span", { className: "text-zinc-400 dark:text-zinc-400", "aria-hidden": "true", children: sortKey === col.key ? (sortDirection === "asc" ? ("↑") : ("↓")) : (_jsx("span", { className: "opacity-30", children: "\u2195" })) }))] }) }, col.key))), actions && (_jsx("th", { scope: "col", className: "appkit-data-table__th appkit-data-table__td--actions", children: labelActions }))] }) }), _jsx("tbody", { className: "appkit-data-table__tbody divide-y divide-zinc-200 dark:divide-slate-700", children: paginatedData.map((item, index) => (_jsxs("tr", { className: [
|
|
136
136
|
"appkit-data-table__row",
|
|
137
137
|
striped && index % 2 === 1
|
|
138
138
|
? "appkit-data-table__row--striped"
|
|
@@ -157,7 +157,7 @@ function DataTableTableView({ columns, paginatedData, keyExtractor, selectable,
|
|
|
157
157
|
? sortKey === col.key
|
|
158
158
|
? sortDirection === "asc" ? "ascending" : "descending"
|
|
159
159
|
: "none"
|
|
160
|
-
: undefined, className: `appkit-data-table__th ${col.sortable ? "appkit-data-table__th--sortable" : ""}`, style: { width: col.width }, onClick: () => col.sortable && onSort(col.key), children: _jsxs(Row, { gap: "sm", children: [col.header, col.sortable && (_jsx("span", { className: "text-zinc-400", "aria-hidden": "true", children: sortKey === col.key ? (sortDirection === "asc" ? "↑" : "↓") : _jsx("span", { className: "opacity-30", children: "\u2195" }) }))] }) }, col.key))), actions && (_jsx("th", { scope: "col", className: "appkit-data-table__th appkit-data-table__td--actions", children: labelActions }))] }) }), _jsx("tbody", { className: "appkit-data-table__tbody divide-y divide-zinc-200 dark:divide-slate-700", children: paginatedData.map((item, index) => (_jsxs("tr", { className: [
|
|
160
|
+
: undefined, className: `appkit-data-table__th ${col.sortable ? "appkit-data-table__th--sortable" : ""}`, style: { width: col.width }, onClick: () => col.sortable && onSort(col.key), children: _jsxs(Row, { gap: "sm", children: [col.header, col.sortable && (_jsx("span", { className: "text-zinc-400 dark:text-zinc-400", "aria-hidden": "true", children: sortKey === col.key ? (sortDirection === "asc" ? "↑" : "↓") : _jsx("span", { className: "opacity-30", children: "\u2195" }) }))] }) }, col.key))), actions && (_jsx("th", { scope: "col", className: "appkit-data-table__th appkit-data-table__td--actions", children: labelActions }))] }) }), _jsx("tbody", { className: "appkit-data-table__tbody divide-y divide-zinc-200 dark:divide-slate-700", children: paginatedData.map((item, index) => (_jsxs("tr", { className: [
|
|
161
161
|
"appkit-data-table__row",
|
|
162
162
|
striped && index % 2 === 1 ? "appkit-data-table__row--striped" : "",
|
|
163
163
|
onRowClick ? "appkit-data-table__row--clickable" : "",
|
|
@@ -107,6 +107,13 @@
|
|
|
107
107
|
background: var(--appkit-color-secondary-400);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/* Cascade fill foreground to all non-appkit-component children inside filled
|
|
111
|
+
variants. :not([class*="appkit-"]) preserves Badge / Checkbox / Toggle
|
|
112
|
+
internal styling. Specificity (0,3,0) beats Tailwind text-* (0,1,0). */
|
|
113
|
+
.appkit-button.appkit-button--primary :not([class*="appkit-"]) {
|
|
114
|
+
color: inherit;
|
|
115
|
+
}
|
|
116
|
+
|
|
110
117
|
.appkit-button.appkit-button--secondary {
|
|
111
118
|
background: var(--appkit-color-surface);
|
|
112
119
|
border-color: var(--appkit-color-primary-700);
|
|
@@ -173,6 +180,10 @@
|
|
|
173
180
|
background: var(--appkit-color-error-hover);
|
|
174
181
|
}
|
|
175
182
|
|
|
183
|
+
.appkit-button.appkit-button--danger :not([class*="appkit-"]) {
|
|
184
|
+
color: inherit;
|
|
185
|
+
}
|
|
186
|
+
|
|
176
187
|
.appkit-button.appkit-button--warning {
|
|
177
188
|
background: var(--appkit-color-warning);
|
|
178
189
|
color: var(--appkit-color-text-on-primary);
|
|
@@ -182,6 +193,10 @@
|
|
|
182
193
|
background: var(--appkit-color-amber-400);
|
|
183
194
|
}
|
|
184
195
|
|
|
196
|
+
.appkit-button.appkit-button--warning :not([class*="appkit-"]) {
|
|
197
|
+
color: inherit;
|
|
198
|
+
}
|
|
199
|
+
|
|
185
200
|
.appkit-button__spinner {
|
|
186
201
|
width: 1rem;
|
|
187
202
|
height: 1rem;
|
|
@@ -24,6 +24,6 @@ export const Input = React.forwardRef(function Input({ label, error, helperText,
|
|
|
24
24
|
}
|
|
25
25
|
const adornment = rightIcon ??
|
|
26
26
|
(success && !error ? (_jsx("svg", { className: "h-4 w-4 text-green-600 dark:text-green-400", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: _jsx("path", { fillRule: "evenodd", d: "M16.704 5.29a1 1 0 010 1.42l-7.2 7.2a1 1 0 01-1.415 0l-3.2-3.2a1 1 0 111.414-1.42l2.493 2.494 6.493-6.494a1 1 0 011.415 0z", clipRule: "evenodd" }) })) : null);
|
|
27
|
-
return (_jsxs("div", { className: "w-full", "data-section": "input-div-527", children: [label && (_jsx(Label, { htmlFor: inputId, required: required, children: label })), _jsxs("div", { className: "relative", "data-section": "input-div-528", children: [icon && (_jsx("div", { className: "pointer-events-none absolute inset-y-0 left-3 flex items-center text-zinc-400 dark:text-zinc-
|
|
27
|
+
return (_jsxs("div", { className: "w-full", "data-section": "input-div-527", children: [label && (_jsx(Label, { htmlFor: inputId, required: required, children: label })), _jsxs("div", { className: "relative", "data-section": "input-div-528", children: [icon && (_jsx("div", { className: "pointer-events-none absolute inset-y-0 left-3 flex items-center text-zinc-400 dark:text-zinc-400", "data-section": "input-div-529", children: icon })), _jsx("input", { ...props, ref: ref, id: inputId, disabled: disabled, "aria-invalid": error ? "true" : undefined, className: inputClassName }), adornment && (_jsx("div", { className: "pointer-events-none absolute inset-y-0 right-3 flex items-center text-zinc-400 dark:text-zinc-400", "data-section": "input-div-530", children: adornment }))] }), error ? (_jsx(Text, { size: "sm", variant: "error", className: "mt-1.5", role: "alert", children: error })) : helperText ? (_jsx(Text, { size: "sm", variant: "secondary", className: "mt-1.5", children: helperText })) : null] }));
|
|
28
28
|
});
|
|
29
29
|
Input.displayName = "Input";
|
|
@@ -31,7 +31,7 @@ export function ListingToolbar({ filterCount = 0, onFiltersClick, searchValue =
|
|
|
31
31
|
const allSelected = bulkTotalCount > 0 && bulkSelectedCount === bulkTotalCount;
|
|
32
32
|
return (_jsx("div", { "data-testid": "listing-toolbar", className: `sticky top-[var(--header-height,0px)] z-20 border-b border-zinc-200 dark:border-slate-700 bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm py-2 px-3 sm:py-2.5 sm:px-4 ${className}`, children: _jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-2.5", children: [bulkMode ? (_jsxs("div", { className: "flex flex-1 items-center gap-2", children: [_jsxs("button", { type: "button", onClick: onBulkSelectAll, className: "flex items-center gap-1.5 rounded-lg border border-zinc-300 dark:border-slate-600 px-3 py-1.5 text-sm font-medium text-zinc-700 dark:text-zinc-200 hover:bg-zinc-50 dark:hover:bg-slate-800 transition-colors", children: [allSelected
|
|
33
33
|
? _jsx(CheckSquare, { className: "h-4 w-4 text-[var(--appkit-color-primary,theme(colors.violet.600))]" })
|
|
34
|
-
: _jsx(Square, { className: "h-4 w-4" }), allSelected ? l.deselectAll : l.selectAll(bulkTotalCount)] }), _jsx("span", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: l.selected(bulkSelectedCount) }), _jsx("button", { type: "button", onClick: onBulkClear, className: "text-xs text-zinc-400 hover:text-rose-500 dark:text-zinc-
|
|
34
|
+
: _jsx(Square, { className: "h-4 w-4" }), allSelected ? l.deselectAll : l.selectAll(bulkTotalCount)] }), _jsx("span", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: l.selected(bulkSelectedCount) }), _jsx("button", { type: "button", onClick: onBulkClear, className: "text-xs text-zinc-400 hover:text-rose-500 dark:text-zinc-400 transition-colors", children: l.clearSelection })] })) : onSearchChange ? (_jsxs("div", { className: "flex flex-1 items-center overflow-hidden rounded-lg border border-zinc-300 dark:border-slate-600 bg-white dark:bg-slate-900 min-w-0", children: [_jsx("input", { type: "text", value: searchValue, onChange: (e) => onSearchChange(e.target.value), onKeyDown: handleKeyDown, placeholder: searchPlaceholder, className: "min-w-0 flex-1 bg-transparent px-3 py-2 text-sm text-zinc-900 dark:text-zinc-100 placeholder-zinc-400 outline-none" }), _jsx("button", { type: "button", onClick: onSearchCommit, className: "flex shrink-0 items-center justify-center px-2.5 py-2 text-zinc-400 hover:text-[var(--appkit-color-primary,theme(colors.violet.600))] transition-colors", "aria-label": l.search, children: _jsx(Search, { className: "h-4 w-4" }) })] })) : null, _jsxs("div", { className: "flex items-center gap-1.5 sm:gap-2 shrink-0", children: [onFiltersClick && (_jsxs("button", { type: "button", onClick: onFiltersClick, className: "relative flex shrink-0 items-center gap-1.5 rounded-lg border border-zinc-300 dark:border-slate-600 px-2.5 py-1.5 sm:px-3.5 sm:py-2 text-sm font-medium text-zinc-700 dark:text-zinc-200 hover:bg-zinc-50 dark:hover:bg-slate-800 transition-colors", children: [_jsx(SlidersHorizontal, { className: "h-4 w-4" }), _jsx("span", { className: "hidden sm:inline", children: l.filters }), filterCount > 0 && (_jsx("span", { className: "absolute -top-1.5 -right-1.5 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--appkit-color-primary,theme(colors.violet.600))] text-[10px] font-bold text-white", children: filterCount }))] })), sortOptions && sortValue !== undefined && onSortChange && (_jsxs("div", { className: "flex items-center gap-1.5 text-sm text-zinc-500 dark:text-zinc-400", children: [_jsx("span", { className: "hidden md:inline whitespace-nowrap text-xs", children: l.sort }), _jsx(SortDropdown, { value: sortValue, onChange: onSortChange, options: sortOptions })] })), !hideViewToggle && onViewChange && (_jsxs("div", { className: "flex items-center rounded-lg border border-zinc-300 dark:border-slate-600 overflow-hidden", children: [_jsx("button", { type: "button", onClick: () => onViewChange("grid"), "aria-label": l.gridView, className: `${VIEW_BTN_BASE} ${view === "grid" ? VIEW_BTN_ACTIVE : VIEW_BTN_INACTIVE}`, children: _jsx(LayoutGrid, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: () => onViewChange("list"), "aria-label": l.listView, className: `${VIEW_BTN_BASE} ${view === "list" ? VIEW_BTN_ACTIVE : VIEW_BTN_INACTIVE}`, children: _jsx(List, { className: "h-4 w-4" }) }), showTableView && (_jsx("button", { type: "button", onClick: () => onViewChange("table"), "aria-label": l.tableView, className: `${VIEW_BTN_BASE} ${view === "table" ? VIEW_BTN_ACTIVE : VIEW_BTN_INACTIVE}`, children: _jsx(Table2, { className: "h-4 w-4" }) }))] })), onResetAll && hasActiveState && (_jsx("button", { type: "button", onClick: onResetAll, "aria-label": l.resetAll, title: l.resetAll, className: "flex shrink-0 items-center justify-center rounded-lg border border-zinc-300 dark:border-slate-600 p-1.5 sm:p-2 text-zinc-500 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:bg-slate-800 hover:text-rose-500 dark:hover:text-rose-400 transition-colors", children: _jsx(RotateCcw, { className: "h-4 w-4" }) })), toggles && toggles.length > 0 && (_jsx("div", { className: "flex items-center gap-1", children: toggles.map((t) => (_jsx("button", { type: "button", role: "switch", "aria-checked": t.active, onClick: () => t.onChange(!t.active), className: `rounded-full border px-2.5 py-1 text-xs font-medium transition-colors whitespace-nowrap ${t.active
|
|
35
35
|
? "border-transparent bg-[var(--appkit-color-primary,theme(colors.violet.600))] text-white"
|
|
36
36
|
: "border-zinc-300 dark:border-slate-600 text-zinc-600 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-slate-800"}`, children: t.label }, t.label))) })), extra] })] }) }));
|
|
37
37
|
}
|
|
@@ -23,5 +23,5 @@ export function Select({ options, value, onChange, onValueChange, placeholder, l
|
|
|
23
23
|
className,
|
|
24
24
|
]
|
|
25
25
|
.filter(Boolean)
|
|
26
|
-
.join(" "), children: [placeholder ? (_jsx("option", { value: "", disabled: true, children: placeholder })) : null, options.map((option) => (_jsx("option", { value: option.value, disabled: option.disabled, children: option.label }, String(option.value))))] }), _jsx("div", { className: "pointer-events-none absolute inset-y-0 right-3 flex items-center text-zinc-400 dark:text-zinc-
|
|
26
|
+
.join(" "), children: [placeholder ? (_jsx("option", { value: "", disabled: true, children: placeholder })) : null, options.map((option) => (_jsx("option", { value: option.value, disabled: option.disabled, children: option.label }, String(option.value))))] }), _jsx("div", { className: "pointer-events-none absolute inset-y-0 right-3 flex items-center text-zinc-400 dark:text-zinc-400", "data-section": "select-div-594", children: _jsx("svg", { className: "h-4 w-4", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: _jsx("path", { fillRule: "evenodd", d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", clipRule: "evenodd" }) }) })] }), error ? (_jsx(Text, { size: "sm", variant: "error", className: "appkit-select__error", role: "alert", children: error })) : helperText ? (_jsx(Text, { size: "sm", variant: "secondary", className: "appkit-select__error", children: helperText })) : null] }));
|
|
27
27
|
}
|
|
@@ -12,5 +12,5 @@ const variantClass = {
|
|
|
12
12
|
flat: "appkit-stats-grid--flat",
|
|
13
13
|
};
|
|
14
14
|
export function StatsGrid({ stats, columns = 3, variant = "elevated", className, }) {
|
|
15
|
-
return (_jsx(Div, { className: classNames("appkit-stats-grid", columnsClass[columns], variantClass[variant], className), children: stats.map((stat, i) => (_jsx(Div, { className: "appkit-stats-grid__item", children: _jsxs(Div, { className: "appkit-stats-grid__item-inner", children: [_jsxs(Div, { children: [_jsx(Text, { className: "appkit-stats-grid__label", children: stat.label }), _jsx(Text, { className: "appkit-stats-grid__value", children: stat.value })] }), stat.icon && (_jsx(Div, { className: classNames("appkit-stats-grid__icon", stat.colorClass ?? "text-zinc-400 dark:text-zinc-
|
|
15
|
+
return (_jsx(Div, { className: classNames("appkit-stats-grid", columnsClass[columns], variantClass[variant], className), children: stats.map((stat, i) => (_jsx(Div, { className: "appkit-stats-grid__item", children: _jsxs(Div, { className: "appkit-stats-grid__item-inner", children: [_jsxs(Div, { children: [_jsx(Text, { className: "appkit-stats-grid__label", children: stat.label }), _jsx(Text, { className: "appkit-stats-grid__value", children: stat.value })] }), stat.icon && (_jsx(Div, { className: classNames("appkit-stats-grid__icon", stat.colorClass ?? "text-zinc-400 dark:text-zinc-400"), children: stat.icon }))] }) }, `${stat.label}-${i}`))) }));
|
|
16
16
|
}
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -189,10 +189,6 @@ export type { StackedViewShellProps, StackedViewShellLabels, } from "./component
|
|
|
189
189
|
export { StackedViewShell } from "./components/StackedViewShell";
|
|
190
190
|
export type { BulkActionBarProps, BulkActionBarLabels, BulkActionItem, } from "./components/BulkActionBar";
|
|
191
191
|
export { BulkActionBar } from "./components/BulkActionBar";
|
|
192
|
-
export type { BulkActionsBarProps, BulkAction } from "./components/BulkActionsBar";
|
|
193
|
-
export { BulkActionsBar } from "./components/BulkActionsBar";
|
|
194
|
-
export type { StickyBottomBarProps } from "./components/StickyBottomBar";
|
|
195
|
-
export { StickyBottomBar } from "./components/StickyBottomBar";
|
|
196
192
|
export type { ClaimCouponButtonProps } from "./components/ClaimCouponButton";
|
|
197
193
|
export { ClaimCouponButton } from "./components/ClaimCouponButton";
|
|
198
194
|
export type { FlowStep, FlowDiagramProps } from "./components/FlowDiagram";
|
package/dist/ui/index.js
CHANGED
|
@@ -100,8 +100,6 @@ export { SlottedListingView } from "./components/SlottedListingView";
|
|
|
100
100
|
export { DetailViewShell } from "./components/DetailViewShell";
|
|
101
101
|
export { StackedViewShell } from "./components/StackedViewShell";
|
|
102
102
|
export { BulkActionBar } from "./components/BulkActionBar";
|
|
103
|
-
export { BulkActionsBar } from "./components/BulkActionsBar";
|
|
104
|
-
export { StickyBottomBar } from "./components/StickyBottomBar";
|
|
105
103
|
export { ClaimCouponButton } from "./components/ClaimCouponButton";
|
|
106
104
|
export { FlowDiagram } from "./components/FlowDiagram";
|
|
107
105
|
export { BaseListingCard } from "./components/BaseListingCard";
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ProductItem } from "../../../../../features/products/types";
|
|
2
|
-
import type { LabelDesign } from "./types";
|
|
3
|
-
interface InventoryLabelProps {
|
|
4
|
-
product: ProductItem;
|
|
5
|
-
publicBaseUrl: string;
|
|
6
|
-
design: LabelDesign;
|
|
7
|
-
qrDataUrl?: string;
|
|
8
|
-
barcodeDataUrl?: string;
|
|
9
|
-
brandName?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function InventoryLabel({ product, design, qrDataUrl, barcodeDataUrl, brandName }: InventoryLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
function getListingBadge(product) {
|
|
4
|
-
const lt = product.listingType;
|
|
5
|
-
if (lt === "auction") {
|
|
6
|
-
const sub = product.auctionEndDate
|
|
7
|
-
? `Ends ${new Date(product.auctionEndDate).toLocaleDateString("en-IN")}`
|
|
8
|
-
: undefined;
|
|
9
|
-
return { label: "AUCTION", sub };
|
|
10
|
-
}
|
|
11
|
-
if (lt === "pre-order") {
|
|
12
|
-
const sub = product.preOrderDeliveryDate
|
|
13
|
-
? `Expected ${new Date(product.preOrderDeliveryDate).toLocaleDateString("en-IN")}`
|
|
14
|
-
: undefined;
|
|
15
|
-
return { label: "PRE-ORDER", sub };
|
|
16
|
-
}
|
|
17
|
-
if (lt === "prize-draw")
|
|
18
|
-
return { label: "PRIZE DRAW" };
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
export function InventoryLabel({ product, design, qrDataUrl, barcodeDataUrl, brandName = "" }) {
|
|
22
|
-
const { size, show, colorScheme } = design;
|
|
23
|
-
const isDark = colorScheme === "dark";
|
|
24
|
-
const bg = isDark ? "#1a1a1a" : "#ffffff";
|
|
25
|
-
const fg = isDark ? "#f5f5f5" : "#111111";
|
|
26
|
-
const muted = isDark ? "#999999" : "#666666";
|
|
27
|
-
const border = isDark ? "#333333" : "#e5e5e5";
|
|
28
|
-
const badge = show.listingTypeBadge ? getListingBadge(product) : null;
|
|
29
|
-
const loc = product.physicalLocation;
|
|
30
|
-
const locStr = loc ? `${loc.zone} / ${loc.shelf} / ${loc.bin}` : null;
|
|
31
|
-
const priceStr = product.price != null ? `₹${(product.price / 100).toFixed(2)}` : null;
|
|
32
|
-
return (_jsxs("div", { style: {
|
|
33
|
-
width: `${size.widthMm}mm`,
|
|
34
|
-
height: `${size.heightMm}mm`,
|
|
35
|
-
background: bg,
|
|
36
|
-
color: fg,
|
|
37
|
-
border: `1px solid ${border}`,
|
|
38
|
-
borderRadius: "2px",
|
|
39
|
-
padding: "2mm",
|
|
40
|
-
fontFamily: "monospace, sans-serif",
|
|
41
|
-
fontSize: "7pt",
|
|
42
|
-
display: "flex",
|
|
43
|
-
flexDirection: "column",
|
|
44
|
-
gap: "1mm",
|
|
45
|
-
overflow: "hidden",
|
|
46
|
-
boxSizing: "border-box",
|
|
47
|
-
pageBreakInside: "avoid",
|
|
48
|
-
}, children: [_jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start" }, children: [show.logo && brandName && (_jsx("span", { style: { fontWeight: 700, fontSize: "6pt", color: muted, letterSpacing: "0.05em" }, children: brandName })), badge && (_jsx("span", { style: { background: "#111", color: "#fff", fontSize: "5pt", fontWeight: 700, padding: "0.5mm 1.5mm", borderRadius: "1px", letterSpacing: "0.05em" }, children: badge.label }))] }), _jsx("div", { style: { fontWeight: 700, fontSize: "8pt", lineHeight: 1.2, flex: 1 }, children: product.title }), badge?.sub && _jsx("div", { style: { fontSize: "6pt", color: muted }, children: badge.sub }), (show.price || show.stock) && (_jsxs("div", { style: { display: "flex", gap: "3mm", alignItems: "center" }, children: [show.price && priceStr && _jsx("span", { style: { fontWeight: 700, fontSize: "8pt" }, children: priceStr }), show.stock && product.stockCount != null && (_jsxs("span", { style: { fontSize: "6pt", color: muted }, children: ["Qty: ", product.stockCount] })), product.condition && _jsx("span", { style: { fontSize: "6pt", color: muted }, children: product.condition })] })), show.location && locStr && _jsx("div", { style: { fontSize: "6pt", color: muted }, children: locStr }), (show.barcode || qrDataUrl) && (_jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-end", marginTop: "auto" }, children: [show.barcode && barcodeDataUrl && (_jsx("img", { src: barcodeDataUrl, alt: "barcode", style: { height: "8mm", maxWidth: "60%" } })), qrDataUrl && _jsx("img", { src: qrDataUrl, alt: "qr", style: { width: "10mm", height: "10mm" } })] })), _jsx("div", { style: { fontSize: "5pt", color: muted, textAlign: "center" }, children: product.id })] }));
|
|
49
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type LabelDesign } from "./types";
|
|
2
|
-
interface LabelDesignPickerProps {
|
|
3
|
-
value: LabelDesign;
|
|
4
|
-
onChange: (design: LabelDesign) => void;
|
|
5
|
-
}
|
|
6
|
-
export declare function LabelDesignPicker({ value, onChange }: LabelDesignPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Row } from "../../../../../ui/components/Layout";
|
|
4
|
-
import { Button } from "../../../../../ui/components/Button";
|
|
5
|
-
import { Input } from "../../../../../ui/components/Input";
|
|
6
|
-
import { Text } from "../../../../../ui/components/Typography";
|
|
7
|
-
import { LABEL_DESIGN_STORAGE_KEY } from "./types";
|
|
8
|
-
const TEMPLATES = ["minimal", "detailed", "branded"];
|
|
9
|
-
const SCHEMES = [
|
|
10
|
-
{ value: "light", label: "Light" },
|
|
11
|
-
{ value: "dark", label: "Dark" },
|
|
12
|
-
{ value: "store-primary", label: "Brand" },
|
|
13
|
-
];
|
|
14
|
-
const SHOW_FIELDS = [
|
|
15
|
-
{ key: "logo", label: "Logo" },
|
|
16
|
-
{ key: "price", label: "Price" },
|
|
17
|
-
{ key: "stock", label: "Stock" },
|
|
18
|
-
{ key: "barcode", label: "Barcode" },
|
|
19
|
-
{ key: "location", label: "Location" },
|
|
20
|
-
{ key: "listingTypeBadge", label: "Type badge" },
|
|
21
|
-
];
|
|
22
|
-
export function LabelDesignPicker({ value, onChange }) {
|
|
23
|
-
const set = (key, val) => {
|
|
24
|
-
const next = { ...value, [key]: val };
|
|
25
|
-
onChange(next);
|
|
26
|
-
try {
|
|
27
|
-
localStorage.setItem(LABEL_DESIGN_STORAGE_KEY, JSON.stringify(next));
|
|
28
|
-
}
|
|
29
|
-
catch { /* noop */ }
|
|
30
|
-
};
|
|
31
|
-
return (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "12px", padding: "16px" }, children: [_jsxs(_Fragment, { children: [_jsx(Text, { variant: "muted", style: { fontSize: "11px", fontWeight: 600, marginBottom: "6px", display: "block" }, children: "Template" }), _jsx(Row, { gap: "xs", children: TEMPLATES.map(t => (_jsx(Button, { variant: value.template === t ? "primary" : "outline", size: "sm", onClick: () => set("template", t), children: t.charAt(0).toUpperCase() + t.slice(1) }, t))) })] }), _jsxs(_Fragment, { children: [_jsx(Text, { variant: "muted", style: { fontSize: "11px", fontWeight: 600, marginBottom: "6px", display: "block" }, children: "Color" }), _jsx(Row, { gap: "xs", children: SCHEMES.map(s => (_jsx(Button, { variant: value.colorScheme === s.value ? "primary" : "outline", size: "sm", onClick: () => set("colorScheme", s.value), children: s.label }, s.value))) })] }), _jsxs(_Fragment, { children: [_jsx(Text, { variant: "muted", style: { fontSize: "11px", fontWeight: 600, marginBottom: "6px", display: "block" }, children: "Size (mm)" }), _jsxs(Row, { gap: "sm", children: [_jsx(Input, { label: "W", type: "number", value: value.size.widthMm, onChange: e => set("size", { ...value.size, widthMm: Number(e.target.value) }), style: { width: "70px" } }), _jsx(Input, { label: "H", type: "number", value: value.size.heightMm, onChange: e => set("size", { ...value.size, heightMm: Number(e.target.value) }), style: { width: "70px" } })] })] }), _jsxs(_Fragment, { children: [_jsx(Text, { variant: "muted", style: { fontSize: "11px", fontWeight: 600, marginBottom: "6px", display: "block" }, children: "Show" }), _jsx("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "4px" }, children: SHOW_FIELDS.map(f => (_jsxs("label", { style: { display: "flex", alignItems: "center", gap: "6px", cursor: "pointer", fontSize: "12px" }, children: [_jsx("input", { type: "checkbox", checked: value.show[f.key], onChange: e => set("show", { ...value.show, [f.key]: e.target.checked }) }), f.label] }, f.key))) })] })] }));
|
|
32
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { LabelDesign } from "./types";
|
|
2
|
-
export interface OrderForLabel {
|
|
3
|
-
id: string;
|
|
4
|
-
createdAt?: string;
|
|
5
|
-
status?: string;
|
|
6
|
-
buyerDisplayName?: string;
|
|
7
|
-
buyerCity?: string;
|
|
8
|
-
items: {
|
|
9
|
-
productName: string;
|
|
10
|
-
quantity: number;
|
|
11
|
-
price: number;
|
|
12
|
-
}[];
|
|
13
|
-
physicalLocation?: {
|
|
14
|
-
zone: string;
|
|
15
|
-
shelf: string;
|
|
16
|
-
bin: string;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
interface OrderPackingLabelProps {
|
|
20
|
-
order: OrderForLabel;
|
|
21
|
-
storeBaseUrl: string;
|
|
22
|
-
design: LabelDesign;
|
|
23
|
-
qrDataUrl?: string;
|
|
24
|
-
barcodeDataUrl?: string;
|
|
25
|
-
brandName?: string;
|
|
26
|
-
}
|
|
27
|
-
export declare function OrderPackingLabel({ order, design, qrDataUrl, barcodeDataUrl, brandName }: OrderPackingLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
export function OrderPackingLabel({ order, design, qrDataUrl, barcodeDataUrl, brandName = "" }) {
|
|
4
|
-
const { size, show, colorScheme } = design;
|
|
5
|
-
const isDark = colorScheme === "dark";
|
|
6
|
-
const bg = isDark ? "#1a1a1a" : "#ffffff";
|
|
7
|
-
const fg = isDark ? "#f5f5f5" : "#111111";
|
|
8
|
-
const muted = isDark ? "#999999" : "#666666";
|
|
9
|
-
const border = isDark ? "#333333" : "#e5e5e5";
|
|
10
|
-
const MAX_ITEMS = 4;
|
|
11
|
-
const shownItems = order.items.slice(0, MAX_ITEMS);
|
|
12
|
-
const extraCount = order.items.length - MAX_ITEMS;
|
|
13
|
-
const loc = order.physicalLocation;
|
|
14
|
-
const locStr = loc ? `${loc.zone} / ${loc.shelf} / ${loc.bin}` : null;
|
|
15
|
-
const dateStr = order.createdAt ? new Date(order.createdAt).toLocaleDateString("en-IN") : "";
|
|
16
|
-
return (_jsxs("div", { style: {
|
|
17
|
-
width: `${size.widthMm}mm`,
|
|
18
|
-
height: `${size.heightMm}mm`,
|
|
19
|
-
background: bg,
|
|
20
|
-
color: fg,
|
|
21
|
-
border: `1px solid ${border}`,
|
|
22
|
-
borderRadius: "2px",
|
|
23
|
-
padding: "2mm",
|
|
24
|
-
fontFamily: "monospace, sans-serif",
|
|
25
|
-
fontSize: "7pt",
|
|
26
|
-
display: "flex",
|
|
27
|
-
flexDirection: "column",
|
|
28
|
-
gap: "1mm",
|
|
29
|
-
overflow: "hidden",
|
|
30
|
-
boxSizing: "border-box",
|
|
31
|
-
pageBreakInside: "avoid",
|
|
32
|
-
}, children: [_jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [_jsx("span", { style: { fontWeight: 700, fontSize: "9pt", letterSpacing: "0.1em" }, children: "PACKING SLIP" }), show.logo && brandName && _jsx("span", { style: { fontSize: "6pt", color: muted }, children: brandName })] }), _jsx("div", { style: { fontWeight: 700, fontSize: "8pt" }, children: order.id }), _jsxs("div", { style: { fontSize: "6pt", color: muted }, children: [dateStr, order.status ? ` · ${order.status}` : ""] }), _jsxs("div", { style: { borderTop: `1px solid ${border}`, paddingTop: "1mm", flex: 1 }, children: [shownItems.map((item, i) => (_jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: "6pt", marginBottom: "0.5mm" }, children: [_jsxs("span", { style: { flex: 1, overflow: "hidden" }, children: ["x", item.quantity, " ", item.productName] }), _jsxs("span", { children: ["Rs.", (item.price / 100).toFixed(0)] })] }, i))), extraCount > 0 && _jsxs("div", { style: { fontSize: "6pt", color: muted }, children: ["+", extraCount, " more"] })] }), (order.buyerDisplayName || order.buyerCity) && (_jsxs("div", { style: { fontSize: "6pt" }, children: [order.buyerDisplayName?.split(" ")[0], order.buyerCity ? ` · ${order.buyerCity}` : ""] })), show.location && locStr && _jsxs("div", { style: { fontSize: "6pt", color: muted }, children: ["Stage: ", locStr] }), (show.barcode || qrDataUrl) && (_jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-end", marginTop: "auto" }, children: [show.barcode && barcodeDataUrl && (_jsx("img", { src: barcodeDataUrl, alt: "barcode", style: { height: "8mm", maxWidth: "65%" } })), qrDataUrl && _jsx("img", { src: qrDataUrl, alt: "qr", style: { width: "10mm", height: "10mm" } })] }))] }));
|
|
33
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface PhysicalLocation {
|
|
2
|
-
zone: string;
|
|
3
|
-
shelf: string;
|
|
4
|
-
bin: string;
|
|
5
|
-
}
|
|
6
|
-
interface PhysicalLocationModalProps {
|
|
7
|
-
count: number;
|
|
8
|
-
onSave: (loc: PhysicalLocation) => Promise<void>;
|
|
9
|
-
onClose: () => void;
|
|
10
|
-
}
|
|
11
|
-
export declare function PhysicalLocationModal({ count, onSave, onClose }: PhysicalLocationModalProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { Modal } from "../../../../../ui/components/Modal";
|
|
5
|
-
import { Input } from "../../../../../ui/components/Input";
|
|
6
|
-
import { Button } from "../../../../../ui/components/Button";
|
|
7
|
-
import { Row } from "../../../../../ui/components/Layout";
|
|
8
|
-
import { Text } from "../../../../../ui/components/Typography";
|
|
9
|
-
export function PhysicalLocationModal({ count, onSave, onClose }) {
|
|
10
|
-
const [zone, setZone] = useState("");
|
|
11
|
-
const [shelf, setShelf] = useState("");
|
|
12
|
-
const [bin, setBin] = useState("");
|
|
13
|
-
const [saving, setSaving] = useState(false);
|
|
14
|
-
const [error, setError] = useState("");
|
|
15
|
-
const handleSave = async () => {
|
|
16
|
-
setSaving(true);
|
|
17
|
-
setError("");
|
|
18
|
-
try {
|
|
19
|
-
await onSave({ zone: zone.trim(), shelf: shelf.trim(), bin: bin.trim() });
|
|
20
|
-
onClose();
|
|
21
|
-
}
|
|
22
|
-
catch (e) {
|
|
23
|
-
setError(e instanceof Error ? e.message : "Failed to save location");
|
|
24
|
-
}
|
|
25
|
-
finally {
|
|
26
|
-
setSaving(false);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
return (_jsx(Modal, { isOpen: true, onClose: onClose, title: `Set Location — ${count} item${count !== 1 ? "s" : ""}`, size: "sm", actions: _jsxs(Row, { gap: "sm", justify: "end", children: [_jsx(Button, { variant: "ghost", onClick: onClose, disabled: saving, children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleSave, disabled: saving, children: saving ? "Saving..." : "Save" })] }), children: _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [_jsx(Text, { variant: "muted", children: "Assign a physical storage location to the selected items. All fields are optional." }), _jsx(Input, { label: "Zone (e.g. A, B, Storage-1)", value: zone, onChange: e => setZone(e.target.value), placeholder: "A" }), _jsx(Input, { label: "Shelf (e.g. 3, Top, Middle)", value: shelf, onChange: e => setShelf(e.target.value), placeholder: "3" }), _jsx(Input, { label: "Bin (e.g. Blue, Box-12)", value: bin, onChange: e => setBin(e.target.value), placeholder: "Blue" }), error && _jsx(Text, { variant: "error", children: error })] }) }));
|
|
30
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ProductItem } from "../../../../../features/products/types";
|
|
2
|
-
import { type OrderForLabel } from "./OrderPackingLabel";
|
|
3
|
-
import { type StoreForCard } from "./StoreCard";
|
|
4
|
-
export interface PrintCenterViewProps {
|
|
5
|
-
store: StoreForCard | null;
|
|
6
|
-
publicBaseUrl: string;
|
|
7
|
-
isAdmin?: boolean;
|
|
8
|
-
initialProducts?: ProductItem[];
|
|
9
|
-
initialOrders?: OrderForLabel[];
|
|
10
|
-
brandName?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function PrintCenterView({ store, publicBaseUrl, isAdmin, initialProducts, initialOrders, brandName, }: PrintCenterViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect, useCallback } from "react";
|
|
4
|
-
import { Tabs, TabsList, TabsTrigger, TabsContent } from "../../../../../ui/components/Tabs";
|
|
5
|
-
import { Button } from "../../../../../ui/components/Button";
|
|
6
|
-
import { Input } from "../../../../../ui/components/Input";
|
|
7
|
-
import { Text } from "../../../../../ui/components/Typography";
|
|
8
|
-
import { Row } from "../../../../../ui/components/Layout";
|
|
9
|
-
import { DEFAULT_PRODUCT_LABEL_DESIGN, DEFAULT_ORDER_LABEL_DESIGN, DEFAULT_CARD_DESIGN, LABEL_DESIGN_STORAGE_KEY, } from "./types";
|
|
10
|
-
import { LabelDesignPicker } from "./LabelDesignPicker";
|
|
11
|
-
import { PrintGrid } from "./PrintGrid";
|
|
12
|
-
import { InventoryLabel } from "./InventoryLabel";
|
|
13
|
-
import { OrderPackingLabel } from "./OrderPackingLabel";
|
|
14
|
-
import { StoreCard } from "./StoreCard";
|
|
15
|
-
import { WebsiteCard } from "./WebsiteCard";
|
|
16
|
-
import { useInventoryPdf } from "./useInventoryPdf";
|
|
17
|
-
function loadSavedDesign(def) {
|
|
18
|
-
try {
|
|
19
|
-
const raw = localStorage.getItem(LABEL_DESIGN_STORAGE_KEY);
|
|
20
|
-
if (raw)
|
|
21
|
-
return { ...def, ...JSON.parse(raw) };
|
|
22
|
-
}
|
|
23
|
-
catch { /* noop */ }
|
|
24
|
-
return def;
|
|
25
|
-
}
|
|
26
|
-
async function generateLabelData(id, qrUrl) {
|
|
27
|
-
try {
|
|
28
|
-
const [qrcode, jsbarcodeModule] = await Promise.all([
|
|
29
|
-
import("qrcode"),
|
|
30
|
-
import("jsbarcode"),
|
|
31
|
-
]);
|
|
32
|
-
const JsBarcode = jsbarcodeModule.default;
|
|
33
|
-
const qrDataUrl = await qrcode.toDataURL(qrUrl, { width: 80, margin: 1 });
|
|
34
|
-
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
35
|
-
JsBarcode(svg, id, { format: "CODE128", width: 1, height: 25, displayValue: false });
|
|
36
|
-
const barcodeDataUrl = "data:image/svg+xml;base64," + btoa(new XMLSerializer().serializeToString(svg));
|
|
37
|
-
return { qrDataUrl, barcodeDataUrl };
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
return {};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
export function PrintCenterView({ store, publicBaseUrl, isAdmin = false, initialProducts = [], initialOrders = [], brandName = "", }) {
|
|
44
|
-
const [tab, setTab] = useState("products");
|
|
45
|
-
const [productDesign, setProductDesign] = useState(() => loadSavedDesign(DEFAULT_PRODUCT_LABEL_DESIGN));
|
|
46
|
-
const [orderDesign, setOrderDesign] = useState(DEFAULT_ORDER_LABEL_DESIGN);
|
|
47
|
-
const [cardDesign, setCardDesign] = useState(DEFAULT_CARD_DESIGN);
|
|
48
|
-
const [selectedProductIds, setSelectedProductIds] = useState(new Set());
|
|
49
|
-
const [selectedOrderIds, setSelectedOrderIds] = useState(new Set());
|
|
50
|
-
const [storeCardCopies, setStoreCardCopies] = useState(1);
|
|
51
|
-
const [websiteCardCopies, setWebsiteCardCopies] = useState(1);
|
|
52
|
-
const [labelCache, setLabelCache] = useState({});
|
|
53
|
-
const [showGrid, setShowGrid] = useState(false);
|
|
54
|
-
const [printMode, setPrintMode] = useState("products");
|
|
55
|
-
const selectedProducts = initialProducts.filter(p => selectedProductIds.has(p.id));
|
|
56
|
-
const selectedOrders = initialOrders.filter(o => selectedOrderIds.has(o.id));
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
const items = [
|
|
59
|
-
...initialProducts.map(p => ({ id: p.id, url: `${publicBaseUrl}/products/${p.id}` })),
|
|
60
|
-
...initialOrders.map(o => ({ id: o.id, url: `${publicBaseUrl}/store/orders/${o.id}/view` })),
|
|
61
|
-
...(store ? [{ id: store.id, url: `${publicBaseUrl}/stores/${store.id}` }] : []),
|
|
62
|
-
];
|
|
63
|
-
for (const item of items) {
|
|
64
|
-
if (labelCache[item.id])
|
|
65
|
-
continue;
|
|
66
|
-
generateLabelData(item.id, item.url).then(data => setLabelCache(prev => ({ ...prev, [item.id]: data })));
|
|
67
|
-
}
|
|
68
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
-
}, [initialProducts.length, initialOrders.length, store?.id, publicBaseUrl]);
|
|
70
|
-
const { downloadPdf: dlProducts, isGenerating: genProducts } = useInventoryPdf({ products: selectedProducts, design: productDesign, publicBaseUrl, brandName });
|
|
71
|
-
const { downloadPdf: dlOrders, isGenerating: genOrders } = useInventoryPdf({ orders: selectedOrders, design: orderDesign, publicBaseUrl, brandName });
|
|
72
|
-
const { downloadPdf: dlStore, isGenerating: genStore } = useInventoryPdf({ storeCards: store ? Array(storeCardCopies).fill(store) : [], design: cardDesign, publicBaseUrl, brandName });
|
|
73
|
-
const { downloadPdf: dlWebsite, isGenerating: genWebsite } = useInventoryPdf({ websiteCards: store ? Array(websiteCardCopies).fill(store) : [], design: cardDesign, publicBaseUrl, brandName });
|
|
74
|
-
const toggleProduct = useCallback((id) => {
|
|
75
|
-
setSelectedProductIds(prev => { const s = new Set(prev); if (s.has(id))
|
|
76
|
-
s.delete(id);
|
|
77
|
-
else
|
|
78
|
-
s.add(id); return s; });
|
|
79
|
-
}, []);
|
|
80
|
-
const toggleOrder = useCallback((id) => {
|
|
81
|
-
setSelectedOrderIds(prev => { const s = new Set(prev); if (s.has(id))
|
|
82
|
-
s.delete(id);
|
|
83
|
-
else
|
|
84
|
-
s.add(id); return s; });
|
|
85
|
-
}, []);
|
|
86
|
-
if (showGrid && printMode === "products") {
|
|
87
|
-
return _jsx(PrintGrid, { items: selectedProducts.map(p => _jsx(InventoryLabel, { product: p, publicBaseUrl: publicBaseUrl, design: productDesign, qrDataUrl: labelCache[p.id]?.qrDataUrl, barcodeDataUrl: labelCache[p.id]?.barcodeDataUrl }, p.id)), columns: 4, onBack: () => setShowGrid(false), onDownloadPdf: dlProducts, isGeneratingPdf: genProducts });
|
|
88
|
-
}
|
|
89
|
-
if (showGrid && printMode === "orders") {
|
|
90
|
-
return _jsx(PrintGrid, { items: selectedOrders.map(o => _jsx(OrderPackingLabel, { order: o, storeBaseUrl: publicBaseUrl, design: orderDesign, qrDataUrl: labelCache[o.id]?.qrDataUrl, barcodeDataUrl: labelCache[o.id]?.barcodeDataUrl }, o.id)), columns: 4, onBack: () => setShowGrid(false), onDownloadPdf: dlOrders, isGeneratingPdf: genOrders });
|
|
91
|
-
}
|
|
92
|
-
if (showGrid && printMode === "store" && store) {
|
|
93
|
-
return _jsx(PrintGrid, { items: Array.from({ length: storeCardCopies }, (_, i) => _jsx(StoreCard, { store: store, publicBaseUrl: publicBaseUrl, design: cardDesign, qrDataUrl: labelCache[store.id]?.qrDataUrl, barcodeDataUrl: labelCache[store.id]?.barcodeDataUrl }, i)), columns: 4, onBack: () => setShowGrid(false), onDownloadPdf: dlStore, isGeneratingPdf: genStore });
|
|
94
|
-
}
|
|
95
|
-
if (showGrid && printMode === "website" && store) {
|
|
96
|
-
return _jsx(PrintGrid, { items: Array.from({ length: websiteCardCopies }, (_, i) => _jsx(WebsiteCard, { store: store, publicBaseUrl: publicBaseUrl, design: cardDesign, qrDataUrl: labelCache[store.id]?.qrDataUrl, brandName: brandName }, i)), columns: 4, onBack: () => setShowGrid(false), onDownloadPdf: dlWebsite, isGeneratingPdf: genWebsite });
|
|
97
|
-
}
|
|
98
|
-
const PANEL_STYLE = { border: "1px solid #e5e7eb", borderRadius: "6px", overflow: "hidden" };
|
|
99
|
-
const PANEL_HEAD = { padding: "12px", borderBottom: "1px solid #e5e7eb", fontWeight: 600, fontSize: "13px" };
|
|
100
|
-
const GRID_LAYOUT = { display: "grid", gridTemplateColumns: "1fr 280px", gap: "16px", marginTop: "16px" };
|
|
101
|
-
return (_jsxs("div", { style: { maxWidth: "960px" }, children: [isAdmin && (_jsxs("div", { style: { marginBottom: "16px", padding: "12px", background: "var(--appkit-color-primary, #6d28d9)", color: "#fff", borderRadius: "6px", fontSize: "13px" }, children: ["Admin mode \u2014 generating materials for: ", store?.storeName ?? "all stores"] })), _jsxs(Tabs, { value: tab, onChange: setTab, children: [_jsxs(TabsList, { children: [_jsx(TabsTrigger, { value: "products", children: "Product Labels" }), _jsx(TabsTrigger, { value: "orders", children: "Packing Slips" }), _jsx(TabsTrigger, { value: "store", children: "Store Cards" }), _jsx(TabsTrigger, { value: "website", children: "Website Cards" })] }), _jsx(TabsContent, { value: "products", children: _jsxs("div", { style: GRID_LAYOUT, children: [_jsxs("div", { style: { minWidth: 0 }, children: [_jsxs(Text, { variant: "muted", style: { marginBottom: "8px", display: "block" }, children: ["Select products (", selectedProductIds.size, " selected)"] }), _jsxs("div", { style: PANEL_STYLE, children: [initialProducts.length === 0 && (_jsx("div", { style: { padding: "24px", textAlign: "center", color: "#9ca3af" }, children: "No products loaded" })), initialProducts.map(p => (_jsxs("label", { style: { display: "flex", alignItems: "center", gap: "10px", padding: "10px 14px", borderBottom: "1px solid #f3f4f6", cursor: "pointer", background: selectedProductIds.has(p.id) ? "#f5f3ff" : "#fff" }, children: [_jsx("input", { type: "checkbox", checked: selectedProductIds.has(p.id), onChange: () => toggleProduct(p.id) }), _jsx("span", { style: { flex: 1, fontSize: "13px", fontWeight: 500 }, children: p.title }), _jsx("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: p.listingType ?? "standard" }), p.physicalLocation && (_jsxs("span", { style: { fontSize: "11px", color: "#6b7280", background: "#f3f4f6", padding: "2px 6px", borderRadius: "4px" }, children: [p.physicalLocation.zone, "/", p.physicalLocation.shelf, "/", p.physicalLocation.bin] }))] }, p.id)))] }), initialProducts.length > 0 && (_jsxs(Row, { gap: "sm", style: { marginTop: "6px" }, children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setSelectedProductIds(new Set(initialProducts.map(p => p.id))), children: "All" }), _jsx(Button, { variant: "ghost", size: "sm", onClick: () => setSelectedProductIds(new Set()), children: "Clear" })] })), _jsxs(Row, { gap: "sm", style: { marginTop: "12px" }, children: [_jsxs(Button, { variant: "primary", disabled: selectedProductIds.size === 0, onClick: () => { setPrintMode("products"); setShowGrid(true); }, children: ["Print", selectedProductIds.size > 0 ? ` (${selectedProductIds.size})` : ""] }), _jsx(Button, { variant: "outline", disabled: selectedProductIds.size === 0 || genProducts, onClick: dlProducts, children: genProducts ? "Generating..." : "Download PDF" })] })] }), _jsxs("div", { style: PANEL_STYLE, children: [_jsx("div", { style: PANEL_HEAD, children: "Label Design" }), _jsx(LabelDesignPicker, { value: productDesign, onChange: setProductDesign })] })] }) }), _jsx(TabsContent, { value: "orders", children: _jsxs("div", { style: GRID_LAYOUT, children: [_jsxs("div", { style: { minWidth: 0 }, children: [_jsxs(Text, { variant: "muted", style: { marginBottom: "8px", display: "block" }, children: ["Select orders (", selectedOrderIds.size, " selected)"] }), _jsxs("div", { style: PANEL_STYLE, children: [initialOrders.length === 0 && (_jsx("div", { style: { padding: "24px", textAlign: "center", color: "#9ca3af" }, children: "No orders loaded" })), initialOrders.map(o => (_jsxs("label", { style: { display: "flex", alignItems: "center", gap: "10px", padding: "10px 14px", borderBottom: "1px solid #f3f4f6", cursor: "pointer", background: selectedOrderIds.has(o.id) ? "#f5f3ff" : "#fff" }, children: [_jsx("input", { type: "checkbox", checked: selectedOrderIds.has(o.id), onChange: () => toggleOrder(o.id) }), _jsx("span", { style: { flex: 1, fontSize: "13px", fontWeight: 500 }, children: o.id }), _jsxs("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: [o.items.length, " item", o.items.length !== 1 ? "s" : ""] })] }, o.id)))] }), initialOrders.length > 0 && (_jsxs(Row, { gap: "sm", style: { marginTop: "6px" }, children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setSelectedOrderIds(new Set(initialOrders.map(o => o.id))), children: "All" }), _jsx(Button, { variant: "ghost", size: "sm", onClick: () => setSelectedOrderIds(new Set()), children: "Clear" })] })), _jsxs(Row, { gap: "sm", style: { marginTop: "12px" }, children: [_jsxs(Button, { variant: "primary", disabled: selectedOrderIds.size === 0, onClick: () => { setPrintMode("orders"); setShowGrid(true); }, children: ["Print", selectedOrderIds.size > 0 ? ` (${selectedOrderIds.size})` : ""] }), _jsx(Button, { variant: "outline", disabled: selectedOrderIds.size === 0 || genOrders, onClick: dlOrders, children: genOrders ? "Generating..." : "Download PDF" })] })] }), _jsxs("div", { style: PANEL_STYLE, children: [_jsx("div", { style: PANEL_HEAD, children: "Label Design" }), _jsx(LabelDesignPicker, { value: orderDesign, onChange: setOrderDesign })] })] }) }), _jsx(TabsContent, { value: "store", children: _jsxs("div", { style: GRID_LAYOUT, children: [_jsx("div", { style: { minWidth: 0 }, children: !store ? (_jsx(Text, { variant: "muted", children: "No store data available." })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { variant: "muted", style: { marginBottom: "12px", display: "block" }, children: ["Business cards for ", _jsx("strong", { children: store.storeName })] }), _jsxs(Row, { gap: "sm", style: { alignItems: "center", marginBottom: "16px" }, children: [_jsx("span", { style: { fontSize: "13px", fontWeight: 500 }, children: "Copies:" }), _jsx(Input, { type: "number", value: storeCardCopies, onChange: e => setStoreCardCopies(Math.max(1, Math.min(100, Number(e.target.value)))), style: { width: "80px" } })] }), _jsx("div", { style: { marginBottom: "16px" }, children: _jsx(StoreCard, { store: store, publicBaseUrl: publicBaseUrl, design: cardDesign, qrDataUrl: labelCache[store.id]?.qrDataUrl, barcodeDataUrl: labelCache[store.id]?.barcodeDataUrl }) }), _jsxs(Row, { gap: "sm", children: [_jsxs(Button, { variant: "primary", onClick: () => { setPrintMode("store"); setShowGrid(true); }, children: ["Print ", storeCardCopies, " card", storeCardCopies !== 1 ? "s" : ""] }), _jsx(Button, { variant: "outline", disabled: genStore, onClick: dlStore, children: genStore ? "Generating..." : "Download PDF" })] })] })) }), _jsxs("div", { style: PANEL_STYLE, children: [_jsx("div", { style: PANEL_HEAD, children: "Card Design" }), _jsx(LabelDesignPicker, { value: cardDesign, onChange: setCardDesign })] })] }) }), _jsx(TabsContent, { value: "website", children: _jsxs("div", { style: GRID_LAYOUT, children: [_jsx("div", { style: { minWidth: 0 }, children: !store ? (_jsx(Text, { variant: "muted", children: "No store data available." })) : (_jsxs(_Fragment, { children: [_jsx(Text, { variant: "muted", style: { marginBottom: "12px", display: "block" }, children: "Promotional cards to hand out at physical stalls and events." }), _jsxs(Row, { gap: "sm", style: { alignItems: "center", marginBottom: "16px" }, children: [_jsx("span", { style: { fontSize: "13px", fontWeight: 500 }, children: "Copies:" }), _jsx(Input, { type: "number", value: websiteCardCopies, onChange: e => setWebsiteCardCopies(Math.max(1, Math.min(100, Number(e.target.value)))), style: { width: "80px" } })] }), _jsx("div", { style: { marginBottom: "16px" }, children: _jsx(WebsiteCard, { store: store, publicBaseUrl: publicBaseUrl, design: cardDesign, qrDataUrl: labelCache[store.id]?.qrDataUrl, brandName: brandName }) }), _jsxs(Row, { gap: "sm", children: [_jsxs(Button, { variant: "primary", onClick: () => { setPrintMode("website"); setShowGrid(true); }, children: ["Print ", websiteCardCopies, " card", websiteCardCopies !== 1 ? "s" : ""] }), _jsx(Button, { variant: "outline", disabled: genWebsite, onClick: dlWebsite, children: genWebsite ? "Generating..." : "Download PDF" })] })] })) }), _jsxs("div", { style: PANEL_STYLE, children: [_jsx("div", { style: PANEL_HEAD, children: "Card Design" }), _jsx(LabelDesignPicker, { value: cardDesign, onChange: setCardDesign })] })] }) })] })] }));
|
|
102
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface PrintGridProps {
|
|
3
|
-
items: React.ReactNode[];
|
|
4
|
-
columns?: 2 | 4;
|
|
5
|
-
pageSize?: "A4" | "Letter" | "Label";
|
|
6
|
-
autoprint?: boolean;
|
|
7
|
-
onBack?: () => void;
|
|
8
|
-
onDownloadPdf?: () => void;
|
|
9
|
-
isGeneratingPdf?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare function PrintGrid({ items, columns, autoprint, onBack, onDownloadPdf, isGeneratingPdf }: PrintGridProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|