@pagamio/frontend-commons-lib 0.8.302 → 0.8.304

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-square 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-10 w-10 sm:h-12 sm:w-12", 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 sm:p-4", children: [product.category && (_jsx("span", { className: "mb-0.5 hidden text-[10px] font-medium uppercase tracking-wide text-muted-foreground sm:block", children: product.category.name })), _jsx(LinkWrapper, { children: _jsx("h3", { className: "line-clamp-2 text-xs font-medium leading-snug text-foreground transition-colors hover:text-primary sm:text-sm", children: product.name }) }), _jsx("div", { className: "flex-1" }), _jsxs("div", { className: "mt-1.5 sm:mt-3", children: [_jsxs("div", { className: "flex items-baseline justify-between gap-1", children: [_jsx("span", { className: "text-sm font-bold text-foreground sm:text-base", children: priceDisplay }), hasVariants && (_jsxs("span", { className: "hidden text-[11px] font-medium text-muted-foreground sm:inline", children: [product.variants.length, " option", product.variants.length !== 1 ? 's' : ''] }))] }), isLowStock && _jsxs("p", { className: "mt-0.5 text-[11px] font-medium text-warning", children: ["Only ", product.totalStock, " left"] }), hasStock && !isLowStock && (_jsxs("p", { className: "mt-0.5 hidden text-[11px] text-muted-foreground sm:block", children: [product.totalStock, " in stock"] }))] }), _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-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) {
@@ -50,7 +50,7 @@ export function ProductCard({ product, onAddToCart, isAddingToCart, storeId, bas
50
50
  else if (onAddToCart && canAddToCart) {
51
51
  onAddToCart(product);
52
52
  }
53
- }, className: cn('mt-2 flex h-8 w-full items-center justify-center gap-1.5 rounded-lg text-xs font-medium transition-colors sm:mt-3 sm:h-9 sm:text-sm', hasVariants
53
+ }, className: cn('mt-1.5 flex h-7 w-full items-center justify-center gap-1 rounded-md text-[11px] font-medium transition-colors sm:h-8', hasVariants
54
54
  ? hasStock || isBackorderable
55
55
  ? 'bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80'
56
56
  : 'cursor-not-allowed bg-muted text-muted-foreground'
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Skeleton } from '../ui/Skeleton';
3
3
  export function ProductCardSkeleton() {
4
- return (_jsxs("div", { className: "overflow-hidden rounded-lg border border-border bg-background sm:rounded-xl", children: [_jsx(Skeleton, { className: "aspect-square w-full rounded-none" }), _jsxs("div", { className: "space-y-2 p-2 sm:p-4", children: [_jsx(Skeleton, { className: "h-3 w-3/4" }), _jsx(Skeleton, { className: "h-3 w-1/2" }), _jsx("div", { className: "pt-1", children: _jsx(Skeleton, { className: "h-4 w-20" }) }), _jsx(Skeleton, { className: "h-8 w-full rounded-lg sm:h-9" })] })] }));
4
+ return (_jsxs("div", { className: "overflow-hidden rounded-lg border border-border bg-background sm:rounded-xl", children: [_jsx(Skeleton, { className: "aspect-[4/3] w-full rounded-none" }), _jsxs("div", { className: "space-y-1.5 p-2", children: [_jsx(Skeleton, { className: "h-3 w-3/4" }), _jsx(Skeleton, { className: "h-3 w-1/2" }), _jsx(Skeleton, { className: "h-7 w-full rounded-md sm:h-8" })] })] }));
5
5
  }
@@ -2,7 +2,7 @@ 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-2 sm:gap-4 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5';
5
+ const GRID_CLASSES = 'grid grid-cols-2 gap-2 sm:grid-cols-3 sm:gap-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6';
6
6
  export function ProductGrid({ products, isLoading, onAddToCart, addingProductId, storeId, emptyMessage = 'No products found', basePath, linkSuffix, skeletonCount = 8, currency, renderLink, onNavigate, }) {
7
7
  if (isLoading) {
8
8
  return (_jsx("div", { className: GRID_CLASSES, children: Array.from({ length: skeletonCount }, (_, i) => (_jsx(ProductCardSkeleton, {}, i))) }));
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Modal as FlowbiteModal, ModalBody as FlowbiteModalBody, ModalFooter as FlowbiteModalFooter, ModalHeader as FlowbiteModalHeader, } from 'flowbite-react';
2
+ import { Modal as FlowbiteModal, ModalBody as FlowbiteModalBody, ModalFooter as FlowbiteModalFooter, } from 'flowbite-react';
3
+ import { HiX } from 'react-icons/hi';
3
4
  import { cn } from '../../helpers';
4
5
  import Button from './Button';
5
6
  /**
@@ -26,6 +27,6 @@ import Button from './Button';
26
27
  * ```
27
28
  */
28
29
  const Modal = ({ title, children, isOpen, onClose, size = 'md', dismissible = false, primaryButton, secondaryButton, headerContent, footerContent, className, ...rest }) => {
29
- return (_jsxs(FlowbiteModal, { show: isOpen, onClose: onClose, size: size, dismissible: dismissible, className: cn('max-h-[90vh] mt-16 md:mt-0 md:max-h-full', className), ...rest, children: [_jsx(FlowbiteModalHeader, { className: cn(!(title ?? headerContent) && 'border-b-0 pb-0'), children: headerContent ?? title }), _jsx(FlowbiteModalBody, { children: _jsx("div", { className: "space-y-4", children: children }) }), (primaryButton || secondaryButton || footerContent) && (_jsx(FlowbiteModalFooter, { children: footerContent ?? (_jsxs("div", { className: "flex w-full justify-end gap-2", children: [secondaryButton && (_jsx(Button, { onClick: secondaryButton.onClick, variant: secondaryButton.variant ?? 'outline-primary', disabled: secondaryButton.loading ?? secondaryButton.disabled, className: secondaryButton.variant, children: secondaryButton.label })), primaryButton && (_jsx(Button, { onClick: primaryButton.onClick, variant: primaryButton.variant ?? 'primary', disabled: primaryButton.loading ?? primaryButton.disabled, className: primaryButton.variant, children: primaryButton.label }))] })) }))] }));
30
+ return (_jsxs(FlowbiteModal, { show: isOpen, onClose: onClose, size: size, dismissible: dismissible, className: cn('max-h-[90vh] mt-16 md:mt-0 md:max-h-full', className), ...rest, children: [_jsxs("div", { className: cn('flex items-center justify-between rounded-t border-b border-gray-200 p-4 dark:border-gray-600', !(title ?? headerContent) && 'border-b-0 pb-2'), children: [_jsx("div", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: headerContent ?? title ?? null }), _jsxs("button", { type: "button", "aria-label": "Close", onClick: onClose, className: "ml-auto inline-flex items-center rounded-lg bg-transparent p-1.5 text-sm text-gray-400 hover:bg-gray-200 hover:text-gray-900 dark:hover:bg-gray-600 dark:hover:text-white", children: [_jsx(HiX, { className: "h-5 w-5" }), _jsx("span", { className: "sr-only", children: "Close modal" })] })] }), _jsx(FlowbiteModalBody, { children: _jsx("div", { className: "space-y-4", children: children }) }), (primaryButton || secondaryButton || footerContent) && (_jsx(FlowbiteModalFooter, { children: footerContent ?? (_jsxs("div", { className: "flex w-full justify-end gap-2", children: [secondaryButton && (_jsx(Button, { onClick: secondaryButton.onClick, variant: secondaryButton.variant ?? 'outline-primary', disabled: secondaryButton.loading ?? secondaryButton.disabled, className: secondaryButton.variant, children: secondaryButton.label })), primaryButton && (_jsx(Button, { onClick: primaryButton.onClick, variant: primaryButton.variant ?? 'primary', disabled: primaryButton.loading ?? primaryButton.disabled, className: primaryButton.variant, children: primaryButton.label }))] })) }))] }));
30
31
  };
31
32
  export default Modal;
package/lib/styles.css CHANGED
@@ -977,9 +977,6 @@ video {
977
977
  .mb-0 {
978
978
  margin-bottom: 0px;
979
979
  }
980
- .mb-0\.5 {
981
- margin-bottom: 0.125rem;
982
- }
983
980
  .mb-1 {
984
981
  margin-bottom: 0.25rem;
985
982
  }
@@ -1151,6 +1148,9 @@ video {
1151
1148
  .aspect-\[16\/9\] {
1152
1149
  aspect-ratio: 16/9;
1153
1150
  }
1151
+ .aspect-\[4\/3\] {
1152
+ aspect-ratio: 4/3;
1153
+ }
1154
1154
  .aspect-square {
1155
1155
  aspect-ratio: 1 / 1;
1156
1156
  }
@@ -2922,6 +2922,9 @@ video {
2922
2922
  .pb-0 {
2923
2923
  padding-bottom: 0px;
2924
2924
  }
2925
+ .pb-2 {
2926
+ padding-bottom: 0.5rem;
2927
+ }
2925
2928
  .pb-2\.5 {
2926
2929
  padding-bottom: 0.625rem;
2927
2930
  }
@@ -6398,6 +6401,10 @@ video {
6398
6401
  grid-template-columns: repeat(2, minmax(0, 1fr));
6399
6402
  }
6400
6403
 
6404
+ .sm\:grid-cols-3 {
6405
+ grid-template-columns: repeat(3, minmax(0, 1fr));
6406
+ }
6407
+
6401
6408
  .sm\:flex-row {
6402
6409
  flex-direction: row;
6403
6410
  }
@@ -6879,6 +6886,10 @@ video {
6879
6886
  grid-template-columns: repeat(4, minmax(0, 1fr));
6880
6887
  }
6881
6888
 
6889
+ .lg\:grid-cols-5 {
6890
+ grid-template-columns: repeat(5, minmax(0, 1fr));
6891
+ }
6892
+
6882
6893
  .lg\:flex-row {
6883
6894
  flex-direction: row;
6884
6895
  }
@@ -6922,8 +6933,8 @@ video {
6922
6933
  display: none;
6923
6934
  }
6924
6935
 
6925
- .xl\:grid-cols-4 {
6926
- grid-template-columns: repeat(4, minmax(0, 1fr));
6936
+ .xl\:grid-cols-6 {
6937
+ grid-template-columns: repeat(6, minmax(0, 1fr));
6927
6938
  }
6928
6939
 
6929
6940
  .xl\:px-24 {
@@ -6940,10 +6951,6 @@ video {
6940
6951
  .\32xl\:hidden {
6941
6952
  display: none;
6942
6953
  }
6943
-
6944
- .\32xl\:grid-cols-5 {
6945
- grid-template-columns: repeat(5, minmax(0, 1fr));
6946
- }
6947
6954
  }
6948
6955
  .rtl\:before\:-translate-x-5:where([dir="rtl"], [dir="rtl"] *)::before {
6949
6956
  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.302",
4
+ "version": "0.8.304",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": false