@beyondcorp/beyond-ui 1.1.69 → 1.1.71
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.
|
@@ -54,7 +54,7 @@ const AllProductsView = ({ products, onProductClick, onAddToCart, onWishlist, on
|
|
|
54
54
|
{ value: 'featured', label: 'Featured' },
|
|
55
55
|
{ value: 'price-asc', label: 'Price: Low to High' },
|
|
56
56
|
{ value: 'price-desc', label: 'Price: High to Low' },
|
|
57
|
-
], className: "w-full sm:w-40" }))] }) }) }) }), jsx(PageLayoutContent, { layout: "centered", spacing: "lg", children: jsx(DashboardGrid, { columns:
|
|
57
|
+
], className: "w-full sm:w-40" }))] }) }) }) }), jsx(PageLayoutContent, { layout: "centered", spacing: "lg", children: jsx(DashboardGrid, { columns: 3, children: filteredProducts.length === 0 ? (jsx("div", { className: "col-span-full text-center text-gray-500 py-12", children: "No products found." })) : (filteredProducts.map((product) => (jsx(ProductCard, { product: product, onClick: () => onProductClick && onProductClick(product.id), onAddToCart: () => onAddToCart && onAddToCart(product.id), onWishlist: () => onWishlist && onWishlist(product.id), onShare: () => onShare && onShare(product.id) }, product.id)))) }) })] }));
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
export { AllProductsView };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AllProductsView.js","sources":["../../../src/components/AllProductsView/AllProductsView.tsx"],"sourcesContent":["import React, { useState, useMemo } from 'react';\r\nimport { PageLayout, PageHeader, PageLayoutContent } from '../PageLayout';\r\nimport { Input } from '../Input';\r\nimport { Select } from '../Select';\r\nimport { useDebounce } from '../../hooks/useDebounce';\r\nimport { useBreakpoint } from '../../hooks/useBreakpoint';\r\nimport { cn } from '../../utils/cn';\r\nimport { ProductData } from '../SingleProductView/SingleProductView';\r\nimport { ProductCard } from './ProductCard';\r\nimport { DashboardGrid } from '../DashboardGrid/DashboardGrid';\r\n\r\nexport interface AllProductsViewProps {\r\n products: ProductData[];\r\n onProductClick?: (productId: string) => void;\r\n onAddToCart?: (productId: string) => void;\r\n onWishlist?: (productId: string) => void;\r\n onShare?: (productId: string) => void;\r\n enableSearch?: boolean;\r\n enableFilter?: boolean;\r\n enableSort?: boolean;\r\n className?: string;\r\n}\r\n\r\nexport const AllProductsView: React.FC<AllProductsViewProps> = ({\r\n products,\r\n onProductClick,\r\n onAddToCart,\r\n onWishlist,\r\n onShare,\r\n enableSearch = true,\r\n enableFilter = true,\r\n enableSort = true,\r\n className,\r\n}) => {\r\n const [search, setSearch] = useState('');\r\n const debouncedSearch = useDebounce(search, 300);\r\n const [sort, setSort] = useState('featured');\r\n const [filter, setFilter] = useState('all');\r\n const { currentBreakpoint, isBelow } = useBreakpoint();\r\n const isMobile = isBelow('md');\r\n\r\n // Filter and sort products\r\n const filteredProducts = useMemo(() => {\r\n let result = products;\r\n if (debouncedSearch) {\r\n result = result.filter((p) =>\r\n p.name.toLowerCase().includes(debouncedSearch.toLowerCase())\r\n );\r\n }\r\n if (filter !== 'all') {\r\n result = result.filter((p) =>\r\n p.colors?.includes(filter)\r\n );\r\n }\r\n if (sort === 'price-asc') {\r\n result = [...result].sort((a, b) => a.price - b.price);\r\n } else if (sort === 'price-desc') {\r\n result = [...result].sort((a, b) => b.price - a.price);\r\n }\r\n // Default: featured (no sort)\r\n return result;\r\n }, [products, debouncedSearch, filter, sort]);\r\n\r\n // Collect all colors for filter options\r\n const allColors = useMemo(() => {\r\n const colorSet = new Set<string>();\r\n products.forEach((p) => p.colors?.forEach((c) => colorSet.add(c)));\r\n return Array.from(colorSet);\r\n }, [products]);\r\n\r\n return (\r\n <PageLayout variant=\"centered\" maxWidth=\"xl\" className={cn(className)}>\r\n <PageHeader>\r\n <div className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8\">\r\n <div className=\"flex flex-col md:flex-row md:items-center md:justify-between gap-2 md:gap-4 h-auto md:h-16\">\r\n {/* <span className=\"font-bold text-xl\">Marketplace</span> */}\r\n <div className=\"flex flex-col sm:flex-row gap-2 sm:gap-4 w-full md:w-auto\">\r\n {enableSearch && (\r\n <Input\r\n placeholder=\"Search products...\"\r\n value={search}\r\n onChange={(e) => setSearch(e.target.value)}\r\n className=\"w-full sm:w-64\"\r\n />\r\n )}\r\n {enableFilter && (\r\n <Select\r\n value={filter}\r\n onChange={e => setFilter(e.target.value)}\r\n options={[\r\n { value: 'all', label: 'All Colors' },\r\n ...allColors.map((c) => ({ value: c, label: c })),\r\n ]}\r\n className=\"w-full sm:w-32\"\r\n />\r\n )}\r\n {enableSort && (\r\n <Select\r\n value={sort}\r\n onChange={e => setSort(e.target.value)}\r\n options={[\r\n { value: 'featured', label: 'Featured' },\r\n { value: 'price-asc', label: 'Price: Low to High' },\r\n { value: 'price-desc', label: 'Price: High to Low' },\r\n ]}\r\n className=\"w-full sm:w-40\"\r\n />\r\n )}\r\n </div>\r\n </div>\r\n </div>\r\n </PageHeader>\r\n\r\n <PageLayoutContent layout=\"centered\" spacing=\"lg\">\r\n <DashboardGrid columns={
|
|
1
|
+
{"version":3,"file":"AllProductsView.js","sources":["../../../src/components/AllProductsView/AllProductsView.tsx"],"sourcesContent":["import React, { useState, useMemo } from 'react';\r\nimport { PageLayout, PageHeader, PageLayoutContent } from '../PageLayout';\r\nimport { Input } from '../Input';\r\nimport { Select } from '../Select';\r\nimport { useDebounce } from '../../hooks/useDebounce';\r\nimport { useBreakpoint } from '../../hooks/useBreakpoint';\r\nimport { cn } from '../../utils/cn';\r\nimport { ProductData } from '../SingleProductView/SingleProductView';\r\nimport { ProductCard } from './ProductCard';\r\nimport { DashboardGrid } from '../DashboardGrid/DashboardGrid';\r\n\r\nexport interface AllProductsViewProps {\r\n products: ProductData[];\r\n onProductClick?: (productId: string) => void;\r\n onAddToCart?: (productId: string) => void;\r\n onWishlist?: (productId: string) => void;\r\n onShare?: (productId: string) => void;\r\n enableSearch?: boolean;\r\n enableFilter?: boolean;\r\n enableSort?: boolean;\r\n className?: string;\r\n}\r\n\r\nexport const AllProductsView: React.FC<AllProductsViewProps> = ({\r\n products,\r\n onProductClick,\r\n onAddToCart,\r\n onWishlist,\r\n onShare,\r\n enableSearch = true,\r\n enableFilter = true,\r\n enableSort = true,\r\n className,\r\n}) => {\r\n const [search, setSearch] = useState('');\r\n const debouncedSearch = useDebounce(search, 300);\r\n const [sort, setSort] = useState('featured');\r\n const [filter, setFilter] = useState('all');\r\n const { currentBreakpoint, isBelow } = useBreakpoint();\r\n const isMobile = isBelow('md');\r\n\r\n // Filter and sort products\r\n const filteredProducts = useMemo(() => {\r\n let result = products;\r\n if (debouncedSearch) {\r\n result = result.filter((p) =>\r\n p.name.toLowerCase().includes(debouncedSearch.toLowerCase())\r\n );\r\n }\r\n if (filter !== 'all') {\r\n result = result.filter((p) =>\r\n p.colors?.includes(filter)\r\n );\r\n }\r\n if (sort === 'price-asc') {\r\n result = [...result].sort((a, b) => a.price - b.price);\r\n } else if (sort === 'price-desc') {\r\n result = [...result].sort((a, b) => b.price - a.price);\r\n }\r\n // Default: featured (no sort)\r\n return result;\r\n }, [products, debouncedSearch, filter, sort]);\r\n\r\n // Collect all colors for filter options\r\n const allColors = useMemo(() => {\r\n const colorSet = new Set<string>();\r\n products.forEach((p) => p.colors?.forEach((c) => colorSet.add(c)));\r\n return Array.from(colorSet);\r\n }, [products]);\r\n\r\n return (\r\n <PageLayout variant=\"centered\" maxWidth=\"xl\" className={cn(className)}>\r\n <PageHeader>\r\n <div className=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8\">\r\n <div className=\"flex flex-col md:flex-row md:items-center md:justify-between gap-2 md:gap-4 h-auto md:h-16\">\r\n {/* <span className=\"font-bold text-xl\">Marketplace</span> */}\r\n <div className=\"flex flex-col sm:flex-row gap-2 sm:gap-4 w-full md:w-auto\">\r\n {enableSearch && (\r\n <Input\r\n placeholder=\"Search products...\"\r\n value={search}\r\n onChange={(e) => setSearch(e.target.value)}\r\n className=\"w-full sm:w-64\"\r\n />\r\n )}\r\n {enableFilter && (\r\n <Select\r\n value={filter}\r\n onChange={e => setFilter(e.target.value)}\r\n options={[\r\n { value: 'all', label: 'All Colors' },\r\n ...allColors.map((c) => ({ value: c, label: c })),\r\n ]}\r\n className=\"w-full sm:w-32\"\r\n />\r\n )}\r\n {enableSort && (\r\n <Select\r\n value={sort}\r\n onChange={e => setSort(e.target.value)}\r\n options={[\r\n { value: 'featured', label: 'Featured' },\r\n { value: 'price-asc', label: 'Price: Low to High' },\r\n { value: 'price-desc', label: 'Price: High to Low' },\r\n ]}\r\n className=\"w-full sm:w-40\"\r\n />\r\n )}\r\n </div>\r\n </div>\r\n </div>\r\n </PageHeader>\r\n\r\n <PageLayoutContent layout=\"centered\" spacing=\"lg\">\r\n <DashboardGrid columns={3}>\r\n {filteredProducts.length === 0 ? (\r\n <div className=\"col-span-full text-center text-gray-500 py-12\">\r\n No products found.\r\n </div>\r\n ) : (\r\n filteredProducts.map((product) => (\r\n <ProductCard\r\n key={product.id}\r\n product={product}\r\n onClick={() => onProductClick && onProductClick(product.id)}\r\n onAddToCart={() => onAddToCart && onAddToCart(product.id)}\r\n onWishlist={() => onWishlist && onWishlist(product.id)}\r\n onShare={() => onShare && onShare(product.id)}\r\n />\r\n ))\r\n )}\r\n </DashboardGrid>\r\n </PageLayoutContent>\r\n </PageLayout>\r\n );\r\n};"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;AAuBO,MAAM,eAAe,GAAmC,CAAC,EAC9D,QAAQ,EACR,cAAc,EACd,WAAW,EACX,UAAU,EACV,OAAO,EACP,YAAY,GAAG,IAAI,EACnB,YAAY,GAAG,IAAI,EACnB,UAAU,GAAG,IAAI,EACjB,SAAS,GACV,KAAI;IACH,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;IACxC,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC;IAChD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CA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