@pagamio/frontend-commons-lib 0.8.322 → 0.8.324
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.
|
@@ -36,7 +36,7 @@ export function ProductCard({ product, onAddToCart, isAddingToCart, storeId, bas
|
|
|
36
36
|
}
|
|
37
37
|
return (_jsx("a", { href: productUrl, className: className, tabIndex: tabIndex, "aria-label": ariaLabel, children: children }));
|
|
38
38
|
};
|
|
39
|
-
return (_jsxs("div", { className: cn('group relative flex flex-col overflow-hidden bg-background transition-shadow duration-200', 'rounded-lg sm:rounded-xl', 'hover:shadow-lg', featured ? 'border-2 border-foreground shadow-md' : 'border border-border shadow-sm'), children: [_jsxs(LinkWrapper, { className: "relative block aspect-[4/3] w-full overflow-hidden bg-muted", tabIndex: -1, ariaLabel: `View ${product.name}`, children: [product.imageUrl ? (_jsx(ImageComponent, { src: product.imageUrl, alt: product.name, fill: true, className: "object-cover", sizes: "(max-width: 640px) 50vw, (max-width: 1024px) 33vw, 25vw" })) : (_jsx("div", { className: "flex h-full w-full items-center justify-center bg-muted text-muted-foreground", children: _jsx("svg", { className: "h-8 w-8", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }) })), !hasStock && !isBackorderable && (_jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/40", children: _jsx("span", { className: "rounded-full bg-white/90 px-3 py-1 text-[11px] font-bold uppercase tracking-wide text-foreground sm:px-4 sm:py-1.5 sm:text-xs", children: "Out of Stock" }) })), !hasStock && isBackorderable && (_jsx("div", { className: "absolute left-2 top-2 z-10 rounded-full bg-warning px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide text-white sm:left-3 sm:top-3 sm:px-2.5 sm:py-1", children: "Backorder" })), featured && hasStock && (_jsx("div", { className: "absolute left-2 top-2 z-10 rounded-full bg-foreground px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide text-white sm:left-3 sm:top-3 sm:px-2.5 sm:py-1", children: "Popular" }))] }), _jsxs("div", { className: "flex flex-1 flex-col p-2", children: [_jsx(LinkWrapper, { children: _jsx("h3", { className: "line-clamp-2 text-xs font-medium leading-snug text-foreground transition-colors hover:text-primary", children: product.name }) }), _jsx("div", { className: "flex-1" }), _jsxs("div", { className: "mt-1", children: [_jsxs("div", { className: "flex items-baseline justify-between gap-1", children: [_jsx("span", { className: "text-xs font-bold text-foreground sm:text-sm", children: priceDisplay }), hasVariants && (_jsxs("span", { className: "text-[10px] font-medium text-muted-foreground", children: [product.variants.length, " opt"] }))] }), isLowStock && _jsxs("p", { className: "mt-0.5 text-[10px] font-medium text-warning", children: ["Only ", product.totalStock, " left"] })] }), _jsx("button", { type: "button", disabled: hasVariants ? !hasStock && !isBackorderable : !canAddToCart || isAddingToCart, onClick: (e) => {
|
|
39
|
+
return (_jsxs("div", { className: cn('group relative flex flex-col overflow-hidden bg-background transition-shadow duration-200', 'rounded-lg sm:rounded-xl', 'hover:shadow-lg', featured ? 'border-2 border-foreground shadow-md' : 'border border-border shadow-sm'), children: [_jsxs(LinkWrapper, { className: "relative block aspect-[4/3] w-full overflow-hidden bg-muted", tabIndex: -1, ariaLabel: `View ${product.name}`, children: [product.imageUrl ? (_jsx(ImageComponent, { src: product.imageUrl, alt: product.name, fill: true, className: "object-cover", sizes: "(max-width: 640px) 50vw, (max-width: 1024px) 33vw, 25vw" })) : (_jsx("div", { className: "flex h-full w-full items-center justify-center bg-muted text-muted-foreground", children: _jsx("svg", { className: "h-8 w-8", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }) })), !hasStock && !isBackorderable && (_jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/40", children: _jsx("span", { className: "rounded-full bg-white/90 px-3 py-1 text-[11px] font-bold uppercase tracking-wide text-foreground sm:px-4 sm:py-1.5 sm:text-xs", children: "Out of Stock" }) })), !hasStock && isBackorderable && (_jsx("div", { className: "absolute left-2 top-2 z-10 rounded-full bg-warning px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide text-white sm:left-3 sm:top-3 sm:px-2.5 sm:py-1", children: "Backorder" })), featured && hasStock && (_jsx("div", { className: "absolute left-2 top-2 z-10 rounded-full bg-foreground px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide text-white sm:left-3 sm:top-3 sm:px-2.5 sm:py-1", children: "Popular" }))] }), _jsxs("div", { className: "flex flex-1 flex-col p-1.5 sm:p-2", children: [_jsx(LinkWrapper, { children: _jsx("h3", { className: "line-clamp-2 text-xs font-medium leading-snug text-foreground transition-colors hover:text-primary", children: product.name }) }), _jsx("div", { className: "flex-1" }), _jsxs("div", { className: "mt-1", children: [_jsxs("div", { className: "flex items-baseline justify-between gap-1", children: [_jsx("span", { className: "text-xs font-bold text-foreground sm:text-sm", children: priceDisplay }), hasVariants && (_jsxs("span", { className: "text-[10px] font-medium text-muted-foreground", children: [product.variants.length, " opt"] }))] }), isLowStock && _jsxs("p", { className: "mt-0.5 text-[10px] font-medium text-warning", children: ["Only ", product.totalStock, " left"] })] }), _jsx("button", { type: "button", disabled: hasVariants ? !hasStock && !isBackorderable : !canAddToCart || isAddingToCart, onClick: (e) => {
|
|
40
40
|
e.preventDefault();
|
|
41
41
|
e.stopPropagation();
|
|
42
42
|
if (hasVariants) {
|
|
@@ -58,5 +58,5 @@ export function ProductCard({ product, onAddToCart, isAddingToCart, storeId, bas
|
|
|
58
58
|
? isBackorderable && !hasStock
|
|
59
59
|
? 'bg-warning text-white hover:bg-warning/90'
|
|
60
60
|
: 'bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80'
|
|
61
|
-
: 'cursor-not-allowed bg-muted text-muted-foreground'), children: hasVariants ? (_jsxs(_Fragment, { children: [_jsx(HiOutlineViewGrid, { className: "h-3.5 w-3.5" }), _jsx("span", { children: !hasStock && !isBackorderable ? 'Out of Stock' : 'Options' })] })) : isAddingToCart ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "h-3.5 w-3.5 animate-spin rounded-full border-2 border-background/30 border-t-background" }), _jsx("span", { children: "Adding..." })] })) : (_jsxs(_Fragment, { children: [_jsx(HiOutlineShoppingCart, { className: "h-3.5 w-3.5" }), _jsx("span", { children: !storeId ? 'Select Store' : hasStock ? 'Add
|
|
61
|
+
: 'cursor-not-allowed bg-muted text-muted-foreground'), children: hasVariants ? (_jsxs(_Fragment, { children: [_jsx(HiOutlineViewGrid, { className: "h-3.5 w-3.5" }), _jsx("span", { children: !hasStock && !isBackorderable ? 'Out of Stock' : 'Options' })] })) : isAddingToCart ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "h-3.5 w-3.5 animate-spin rounded-full border-2 border-background/30 border-t-background" }), _jsx("span", { children: "Adding..." })] })) : (_jsxs(_Fragment, { children: [_jsx(HiOutlineShoppingCart, { className: "h-3.5 w-3.5" }), _jsx("span", { children: !storeId ? 'Select Store' : hasStock ? 'Add' : isBackorderable ? 'Backorder' : 'Sold Out' })] })) })] })] }));
|
|
62
62
|
}
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import EmptyState from '../ui/EmptyState';
|
|
3
3
|
import { ProductCard } from './ProductCard';
|
|
4
4
|
import { ProductCardSkeleton } from './ProductCardSkeleton';
|
|
5
|
-
const GRID_CLASSES = 'grid grid-cols-2 gap-
|
|
6
|
-
export function ProductGrid({ products, isLoading, onAddToCart, addingProductId, storeId, emptyMessage = 'No products found', basePath, linkSuffix, skeletonCount =
|
|
5
|
+
const GRID_CLASSES = 'grid grid-cols-2 gap-1.5 sm:grid-cols-4 sm:gap-2 md:grid-cols-5 lg:grid-cols-7 xl:grid-cols-8 2xl:grid-cols-10';
|
|
6
|
+
export function ProductGrid({ products, isLoading, onAddToCart, addingProductId, storeId, emptyMessage = 'No products found', basePath, linkSuffix, skeletonCount = 24, currency, renderLink, onNavigate, }) {
|
|
7
7
|
if (isLoading) {
|
|
8
8
|
return (_jsx("div", { className: GRID_CLASSES, children: Array.from({ length: skeletonCount }, (_, i) => (_jsx(ProductCardSkeleton, {}, i))) }));
|
|
9
9
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { MultiSelect } from '../../../../components';
|
|
4
|
-
const MultiSelectInputComponent = React.forwardRef(({ field, error, options, ...props }, ref) => (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-foreground", children: field.label }), _jsx(MultiSelect, { className: "w-full border-input
|
|
4
|
+
const MultiSelectInputComponent = React.forwardRef(({ field, error, options, ...props }, ref) => (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-foreground", children: field.label }), _jsx(MultiSelect, { className: "w-full border-input disabled:text-muted-foreground disabled:bg-muted disabled:cursor-not-allowed", options: (options ?? []), value: props.value, defaultValue: props.value, disabled: field.disabled, onChange: props.onChange,
|
|
5
|
+
// Render selected tags inside the input itself rather than as a
|
|
6
|
+
// separate row below — matches how every other select-style input
|
|
7
|
+
// in the app surfaces selections, and stops the field from looking
|
|
8
|
+
// empty when items are already chosen.
|
|
9
|
+
tagPosition: "inside" }), error && _jsx("p", { className: "mt-2 text-sm text-red-500", children: error.message })] })));
|
|
5
10
|
export default MultiSelectInputComponent;
|
package/lib/styles.css
CHANGED
|
@@ -2942,9 +2942,6 @@ video {
|
|
|
2942
2942
|
.pb-4 {
|
|
2943
2943
|
padding-bottom: 1rem;
|
|
2944
2944
|
}
|
|
2945
|
-
.pb-5 {
|
|
2946
|
-
padding-bottom: 1.25rem;
|
|
2947
|
-
}
|
|
2948
2945
|
.pl-10 {
|
|
2949
2946
|
padding-left: 2.5rem;
|
|
2950
2947
|
}
|
|
@@ -6458,8 +6455,8 @@ video {
|
|
|
6458
6455
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
6459
6456
|
}
|
|
6460
6457
|
|
|
6461
|
-
.sm\:grid-cols-
|
|
6462
|
-
grid-template-columns: repeat(
|
|
6458
|
+
.sm\:grid-cols-4 {
|
|
6459
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
6463
6460
|
}
|
|
6464
6461
|
|
|
6465
6462
|
.sm\:flex-row {
|
|
@@ -6737,8 +6734,8 @@ video {
|
|
|
6737
6734
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
6738
6735
|
}
|
|
6739
6736
|
|
|
6740
|
-
.md\:grid-cols-
|
|
6741
|
-
grid-template-columns: repeat(
|
|
6737
|
+
.md\:grid-cols-5 {
|
|
6738
|
+
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
6742
6739
|
}
|
|
6743
6740
|
|
|
6744
6741
|
.md\:flex-row {
|
|
@@ -6943,8 +6940,8 @@ video {
|
|
|
6943
6940
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
6944
6941
|
}
|
|
6945
6942
|
|
|
6946
|
-
.lg\:grid-cols-
|
|
6947
|
-
grid-template-columns: repeat(
|
|
6943
|
+
.lg\:grid-cols-7 {
|
|
6944
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
6948
6945
|
}
|
|
6949
6946
|
|
|
6950
6947
|
.lg\:flex-row {
|
|
@@ -6994,8 +6991,8 @@ video {
|
|
|
6994
6991
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
6995
6992
|
}
|
|
6996
6993
|
|
|
6997
|
-
.xl\:grid-cols-
|
|
6998
|
-
grid-template-columns: repeat(
|
|
6994
|
+
.xl\:grid-cols-8 {
|
|
6995
|
+
grid-template-columns: repeat(8, minmax(0, 1fr));
|
|
6999
6996
|
}
|
|
7000
6997
|
|
|
7001
6998
|
.xl\:px-24 {
|
|
@@ -7012,6 +7009,10 @@ video {
|
|
|
7012
7009
|
.\32xl\:hidden {
|
|
7013
7010
|
display: none;
|
|
7014
7011
|
}
|
|
7012
|
+
|
|
7013
|
+
.\32xl\:grid-cols-10 {
|
|
7014
|
+
grid-template-columns: repeat(10, minmax(0, 1fr));
|
|
7015
|
+
}
|
|
7015
7016
|
}
|
|
7016
7017
|
.rtl\:before\:-translate-x-5:where([dir="rtl"], [dir="rtl"] *)::before {
|
|
7017
7018
|
content: var(--tw-content);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagamio/frontend-commons-lib",
|
|
3
3
|
"description": "Pagamio library for Frontend reusable components like the form engine and table container",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.324",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": false
|