@q2devel/q2-storybook 1.0.119 → 1.0.121

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.
@@ -21,6 +21,7 @@ export type BasketDialogProps = {
21
21
  productLink?: (productName: string, variationId: string) => string;
22
22
  title?: string;
23
23
  checkoutText?: string;
24
+ checkoutTextClass?: string;
24
25
  continueShoppingText?: string;
25
26
  showShippingNote?: boolean;
26
27
  showQuantityControls?: boolean;
@@ -40,4 +41,4 @@ export type BasketDialogProps = {
40
41
  shippingAndTax: string;
41
42
  };
42
43
  };
43
- export declare const BasketDialog: ({ isOpen, onClose, products, subtotal, onQuantityChange, onRemoveProduct, onCheckout, onContinueShopping, productLink, title, checkoutText, continueShoppingText, showShippingNote, showQuantityControls, pendingUpdates, processingItems, isAddingToCart, totalItems, locale, productPriceOptions, totalPriceOptions, translations, }: BasketDialogProps) => import("react/jsx-runtime").JSX.Element;
44
+ export declare const BasketDialog: ({ isOpen, onClose, products, subtotal, onQuantityChange, onRemoveProduct, onCheckout, onContinueShopping, productLink, title, checkoutText, checkoutTextClass, continueShoppingText, showShippingNote, showQuantityControls, pendingUpdates, processingItems, isAddingToCart, totalItems, locale, productPriceOptions, totalPriceOptions, translations, }: BasketDialogProps) => import("react/jsx-runtime").JSX.Element;
@@ -7,7 +7,7 @@ import { useEffect, useRef, useState } from 'react';
7
7
  import Heading from '../../../components/Base/heading/Heading';
8
8
  import Button from '../../../components/Base/button/Button';
9
9
  import { Price } from '../../../components/Base/price/Price';
10
- export const BasketDialog = ({ isOpen, onClose, products, subtotal, onQuantityChange, onRemoveProduct, onCheckout, onContinueShopping, productLink, title = 'Váš košík', checkoutText = 'Pokračovat k objednávce', continueShoppingText = 'Pokračovat v nákupu', showShippingNote = true, showQuantityControls = true, pendingUpdates = {}, processingItems = {}, isAddingToCart = false, totalItems, locale, productPriceOptions, totalPriceOptions, translations, }) => {
10
+ export const BasketDialog = ({ isOpen, onClose, products, subtotal, onQuantityChange, onRemoveProduct, onCheckout, onContinueShopping, productLink, title = 'Váš košík', checkoutText = 'Pokračovat k objednávce', checkoutTextClass = 'button-brand w-full', continueShoppingText = 'Pokračovat v nákupu', showShippingNote = true, showQuantityControls = true, pendingUpdates = {}, processingItems = {}, isAddingToCart = false, totalItems, locale, productPriceOptions, totalPriceOptions, translations, }) => {
11
11
  const [shouldShowAddingIndicator, setShouldShowAddingIndicator] = useState(false);
12
12
  const initialTotalItems = useRef(null);
13
13
  useEffect(() => {
@@ -83,5 +83,5 @@ export const BasketDialog = ({ isOpen, onClose, products, subtotal, onQuantityCh
83
83
  onRemoveProduct(product.variation_uuid), disabled: isProcessing, children: translations.remove }) }))] })] })] }, `${product.variation_uuid}-${isTemporaryRow
84
84
  ? 'temp'
85
85
  : 'normal'}`));
86
- }), shouldShowAddingIndicator && (_jsxs("li", { className: "flex py-6 opacity-75 bg-gray-50", children: [_jsx("div", { className: "size-24 shrink-0 overflow-hidden rounded-md border border-gray-200 relative", children: _jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-white bg-opacity-75", children: _jsx(Spinner, { className: "h-8 w-8 text-[var(--primary)]" }) }) }), _jsx("div", { className: "ml-4 flex flex-1 flex-col justify-center", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Spinner, { className: "h-4 w-4 text-[var(--primary)]" }), _jsx("p", { className: "text-gray-500 italic", children: translations.addingToBasket })] }) })] }))] })) }) })] }), _jsxs("div", { className: "border-t border-gray-200 px-4 py-6 sm:px-6", children: [_jsxs("div", { className: "flex justify-between text-base font-medium text-gray-900", children: [_jsx("p", { children: translations.total }), _jsx(Price, { value: subtotal, locale: locale, options: totalPriceOptions })] }), showShippingNote && (_jsx("p", { className: "mt-0.5 text-sm text-gray-500", children: translations.shippingAndTax })), products.length > 0 && onCheckout && (_jsx("div", { className: "mt-6", children: _jsx("button", { onClick: handleCheckout, className: "button-brand w-full", children: checkoutText }) })), _jsx("div", { className: "mt-6 flex justify-center text-center text-sm text-gray-500", children: _jsx("p", { children: _jsxs("button", { type: "button", onClick: handleContinueShopping, className: "font-medium text-[var(--primary)] hover:text-[var(--primary)]", children: [continueShoppingText, _jsx("span", { "aria-hidden": "true", children: " \u2192" })] }) }) })] })] }) }) }) }) })] }));
86
+ }), shouldShowAddingIndicator && (_jsxs("li", { className: "flex py-6 opacity-75 bg-gray-50", children: [_jsx("div", { className: "size-24 shrink-0 overflow-hidden rounded-md border border-gray-200 relative", children: _jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-white bg-opacity-75", children: _jsx(Spinner, { className: "h-8 w-8 text-[var(--primary)]" }) }) }), _jsx("div", { className: "ml-4 flex flex-1 flex-col justify-center", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Spinner, { className: "h-4 w-4 text-[var(--primary)]" }), _jsx("p", { className: "text-gray-500 italic", children: translations.addingToBasket })] }) })] }))] })) }) })] }), _jsxs("div", { className: "border-t border-gray-200 px-4 py-6 sm:px-6", children: [_jsxs("div", { className: "flex justify-between text-base font-medium text-gray-900", children: [_jsx("p", { children: translations.total }), _jsx(Price, { value: subtotal, locale: locale, options: totalPriceOptions })] }), showShippingNote && (_jsx("p", { className: "mt-0.5 text-sm text-gray-500", children: translations.shippingAndTax })), products.length > 0 && onCheckout && (_jsx("div", { className: "mt-6", children: _jsx("button", { onClick: handleCheckout, className: checkoutTextClass, children: checkoutText }) })), _jsx("div", { className: "mt-6 flex justify-center text-center text-sm text-gray-500", children: _jsx("p", { children: _jsxs("button", { type: "button", onClick: handleContinueShopping, className: "font-medium text-[var(--primary)] hover:text-[var(--primary)]", children: [continueShoppingText, _jsx("span", { "aria-hidden": "true", children: " \u2192" })] }) }) })] })] }) }) }) }) })] }));
87
87
  };
@@ -17,6 +17,7 @@ export type BasketOverviewProps = {
17
17
  productLink?: (productName: string, variationId: string) => string;
18
18
  title?: string;
19
19
  checkoutText?: string;
20
+ checkoutTextClass?: string;
20
21
  continueShoppingText?: string;
21
22
  shippingNote?: string;
22
23
  totalText?: string;
@@ -31,4 +32,4 @@ export type BasketOverviewProps = {
31
32
  emptyBasketPlaceholder?: string;
32
33
  };
33
34
  };
34
- export declare const BasketOverview: ({ products, subtotal, onQuantityChange, onRemoveProduct, onClearBasket, onCheckout, onContinueShopping, productLink, title, checkoutText, continueShoppingText, showShippingNote, clearBasketText, totalText, shippingNote, pendingUpdates, processingItems, locale, productPriceOptions, TotalPriceOptions, translations, }: BasketOverviewProps) => import("react/jsx-runtime").JSX.Element;
35
+ export declare const BasketOverview: ({ products, subtotal, onQuantityChange, onRemoveProduct, onClearBasket, onCheckout, onContinueShopping, productLink, title, checkoutText, checkoutTextClass, continueShoppingText, showShippingNote, clearBasketText, totalText, shippingNote, pendingUpdates, processingItems, locale, productPriceOptions, TotalPriceOptions, translations, }: BasketOverviewProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,7 +5,7 @@ import Heading from '../../../components/Base/heading/Heading';
5
5
  import { Price } from '../../../components/Base/price/Price';
6
6
  import { CheckIcon, ClockIcon, TrashIcon } from '@heroicons/react/20/solid';
7
7
  import { MinusIcon, PlusIcon } from '@heroicons/react/24/solid';
8
- export const BasketOverview = ({ products, subtotal, onQuantityChange, onRemoveProduct, onClearBasket, onCheckout, onContinueShopping, productLink, title = 'Shopping Cart', checkoutText = 'Checkout', continueShoppingText = 'Continue Shopping', showShippingNote = true, clearBasketText = 'Clear basket', totalText, shippingNote, pendingUpdates = {}, processingItems = {}, locale, productPriceOptions, TotalPriceOptions, translations, }) => {
8
+ export const BasketOverview = ({ products, subtotal, onQuantityChange, onRemoveProduct, onClearBasket, onCheckout, onContinueShopping, productLink, title = 'Shopping Cart', checkoutText = 'Checkout', checkoutTextClass = 'button-brand w-full', continueShoppingText = 'Continue Shopping', showShippingNote = true, clearBasketText = 'Clear basket', totalText, shippingNote, pendingUpdates = {}, processingItems = {}, locale, productPriceOptions, TotalPriceOptions, translations, }) => {
9
9
  const handleIncrement = (product, quantity) => {
10
10
  if (onQuantityChange) {
11
11
  onQuantityChange(product.variation_uuid, quantity + 1);
@@ -34,5 +34,5 @@ export const BasketOverview = ({ products, subtotal, onQuantityChange, onRemoveP
34
34
  : 'bg-gray-200 hover:bg-gray-300'}`, children: _jsx(MinusIcon, { className: "h-4 w-4" }) }), _jsx("span", { className: "mx-2 min-w-[20px] text-center text-black", children: displayQuantity }), _jsx("button", { type: "button", onClick: () => handleIncrement(product, displayQuantity), disabled: isProcessing, className: `rounded-full p-1 text-gray-600 ${isProcessing
35
35
  ? 'bg-gray-100 cursor-not-allowed opacity-50'
36
36
  : 'bg-gray-200 hover:bg-gray-300'}`, children: _jsx(PlusIcon, { className: "h-4 w-4" }) })] })] })] })] }, product.variation_uuid));
37
- })) })] }), _jsxs("section", { "aria-labelledby": "summary-heading", className: "mt-10", children: [_jsx(Heading, { level: 2, id: "summary-heading", className: "sr-only", children: "Order summary" }), products.length > 0 && onClearBasket && (_jsx("div", { className: "mb-4", children: _jsxs("button", { type: "button", onClick: onClearBasket, className: "inline-flex items-center text-sm font-medium text-red-600 hover:text-red-500", children: [_jsx(TrashIcon, { className: "mr-1 h-5 w-5 text-red-500" }), clearBasketText] }) })), _jsxs("div", { children: [_jsx("dl", { className: "space-y-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("dt", { className: "text-base font-medium text-gray-900", children: totalText }), _jsx("dd", { className: "ml-4 text-base font-medium text-gray-900", children: _jsx(Price, { value: subtotal, locale: locale, options: TotalPriceOptions }) })] }) }), showShippingNote && (_jsx("p", { className: "mt-1 text-sm text-gray-500", children: shippingNote }))] }), products.length > 0 && onCheckout && (_jsx("div", { className: "mt-10", children: _jsx("button", { type: "button", onClick: onCheckout, className: "button-brand w-full", children: checkoutText }) })), onContinueShopping && (_jsx("div", { className: "mt-6 text-center text-sm", children: _jsx("p", { children: _jsxs("button", { type: "button", onClick: onContinueShopping, className: "font-medium text-[var(--primary)] hover:text-[var(--primary)]", children: [continueShoppingText, _jsx("span", { "aria-hidden": "true", children: " \u2192" })] }) }) }))] })] })] }) }));
37
+ })) })] }), _jsxs("section", { "aria-labelledby": "summary-heading", className: "mt-10", children: [_jsx(Heading, { level: 2, id: "summary-heading", className: "sr-only", children: "Order summary" }), products.length > 0 && onClearBasket && (_jsx("div", { className: "mb-4", children: _jsxs("button", { type: "button", onClick: onClearBasket, className: "inline-flex items-center text-sm font-medium text-red-600 hover:text-red-500", children: [_jsx(TrashIcon, { className: "mr-1 h-5 w-5 text-red-500" }), clearBasketText] }) })), _jsxs("div", { children: [_jsx("dl", { className: "space-y-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("dt", { className: "text-base font-medium text-gray-900", children: totalText }), _jsx("dd", { className: "ml-4 text-base font-medium text-gray-900", children: _jsx(Price, { value: subtotal, locale: locale, options: TotalPriceOptions }) })] }) }), showShippingNote && (_jsx("p", { className: "mt-1 text-sm text-gray-500", children: shippingNote }))] }), products.length > 0 && onCheckout && (_jsx("div", { className: "mt-10", children: _jsx("button", { type: "button", onClick: onCheckout, className: checkoutTextClass, children: checkoutText }) })), onContinueShopping && (_jsx("div", { className: "mt-6 text-center text-sm", children: _jsx("p", { children: _jsxs("button", { type: "button", onClick: onContinueShopping, className: "font-medium text-[var(--primary)] hover:text-[var(--primary)]", children: [continueShoppingText, _jsx("span", { "aria-hidden": "true", children: " \u2192" })] }) }) }))] })] })] }) }));
38
38
  };
@@ -24,6 +24,9 @@ export type ProductProps = {
24
24
  showColors?: boolean;
25
25
  buttonText?: string;
26
26
  className?: string;
27
+ specification?: Array<{
28
+ [key: string]: string;
29
+ }>;
27
30
  product?: Product;
28
31
  showAddButton?: boolean;
29
32
  currentQuantity: number;
@@ -68,6 +71,9 @@ export type ProductProps = {
68
71
  question: string;
69
72
  optionOfShipping: string;
70
73
  addToWishlist: string;
74
+ specification: string;
75
+ EAN: string;
76
+ sku: string;
71
77
  };
72
78
  locale: string;
73
79
  quantUnit?: string;
@@ -80,4 +86,4 @@ export type ProductProps = {
80
86
  mainQuantUnitClassName?: string;
81
87
  discountQuantUnitClassName?: string;
82
88
  };
83
- export declare const ProductDetail: ({ name, price, href, discountPercent, description, detail, buttonText, className, product, currentQuantity, onQuantityChange, maxQuantity, disabled, badges, showVariations, variations, currentVariationId, cartMode, onOpenBasket, showWishlistButton, isInWishlist, onWishlistToggle, enableMultipleWishlists, wishlists, onAddToWishlist, onRemoveFromWishlist, onCreateWishlist, productWishlistIds, isWishlistPending, isLogged, onWishlistTextClick, showWishlistDropdown, onCloseWishlistDropdown, onAddToSpecificWishlist, onRemoveFromSpecificWishlist, onCreateNewWishlistFromDropdown, onShippingOptionsClick, isWatchdogEnabled, onWatchdogClick, onDemandClick, translations, locale, quantUnit, mainPriceFormatOptions, discountPriceFormatOptions, variationPriceFormatOptions, mainPriceClassName, discountPriceClassName, variationPriceClassName, mainQuantUnitClassName, discountQuantUnitClassName, }: ProductProps) => import("react/jsx-runtime").JSX.Element | null;
89
+ export declare const ProductDetail: ({ name, price, href, discountPercent, description, detail, buttonText, className, specification, product, currentQuantity, onQuantityChange, maxQuantity, disabled, badges, showVariations, variations, currentVariationId, cartMode, onOpenBasket, showWishlistButton, isInWishlist, onWishlistToggle, enableMultipleWishlists, wishlists, onAddToWishlist, onRemoveFromWishlist, onCreateWishlist, productWishlistIds, isWishlistPending, isLogged, onWishlistTextClick, showWishlistDropdown, onCloseWishlistDropdown, onAddToSpecificWishlist, onRemoveFromSpecificWishlist, onCreateNewWishlistFromDropdown, onShippingOptionsClick, isWatchdogEnabled, onWatchdogClick, onDemandClick, translations, locale, quantUnit, mainPriceFormatOptions, discountPriceFormatOptions, variationPriceFormatOptions, mainPriceClassName, discountPriceClassName, variationPriceClassName, mainQuantUnitClassName, discountQuantUnitClassName, }: ProductProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -10,7 +10,7 @@ import { Price } from '../../Base/price/Price';
10
10
  import { HorizontalTab } from '../../Web/tabs/HorizontalTab';
11
11
  import WishlistDropdown from '../wishlist/WishlistDropdown';
12
12
  import ProductDetailGallery from './ProductDetailGallery';
13
- export const ProductDetail = ({ name = '', price = 0, href = '', discountPercent = 0, description = '', detail = { tabs: [] }, buttonText = 'Add to bag', className = '',
13
+ export const ProductDetail = ({ name = '', price = 0, href = '', discountPercent = 0, description = '', detail = { tabs: [] }, buttonText = 'Add to bag', className = '', specification,
14
14
  // Cart props
15
15
  product, currentQuantity = 0, onQuantityChange, maxQuantity = 99, disabled = false, badges = [], showVariations = false, variations = [], currentVariationId, cartMode = 'full', onOpenBasket,
16
16
  // Wishlist props
@@ -18,9 +18,22 @@ showWishlistButton = false, isInWishlist = false, onWishlistToggle, enableMultip
18
18
  // Wishlist dropdown props
19
19
  showWishlistDropdown = false, onCloseWishlistDropdown, onAddToSpecificWishlist, onRemoveFromSpecificWishlist, onCreateNewWishlistFromDropdown,
20
20
  //modals
21
- onShippingOptionsClick, isWatchdogEnabled = false, onWatchdogClick, onDemandClick, translations, locale, quantUnit,
21
+ onShippingOptionsClick, isWatchdogEnabled = false, onWatchdogClick, onDemandClick, translations = {
22
+ recommendedPrice: 'Doporučená cena',
23
+ shippingDetailFree: 'Dostupné zdarma',
24
+ shippingDetailFee: 'Dostupné za',
25
+ watchDog: 'Sledování',
26
+ question: 'Otázka',
27
+ optionOfShipping: 'Možnosti dodání',
28
+ addToWishlist: 'Přidat do wishlistu',
29
+ specification: 'Parametry',
30
+ EAN: 'EAN',
31
+ sku: 'Kód',
32
+ }, locale, quantUnit,
22
33
  // NOVÉ PRICE API
23
- mainPriceFormatOptions, discountPriceFormatOptions, variationPriceFormatOptions, mainPriceClassName, discountPriceClassName, variationPriceClassName, mainQuantUnitClassName, discountQuantUnitClassName, }) => {
34
+ mainPriceFormatOptions, discountPriceFormatOptions, variationPriceFormatOptions, mainPriceClassName, discountPriceClassName, variationPriceClassName, mainQuantUnitClassName, discountQuantUnitClassName,
35
+ // translation
36
+ }) => {
24
37
  const wishlistButtonRef = useRef(null);
25
38
  // Cart functions - updated logic based on cartMode
26
39
  const shouldShowQuantityControls = () => {
@@ -84,7 +97,7 @@ mainPriceFormatOptions, discountPriceFormatOptions, variationPriceFormatOptions,
84
97
  }
85
98
  return (_jsx("div", { className: buildClassesByJoining('bg-white', className), children: _jsxs("div", { className: "py-4", children: [_jsxs("div", { className: "lg:grid lg:grid-cols-2 lg:items-start lg:gap-x-8 ", children: [_jsx(ProductDetailGallery, { product: product, showWishlistButton: showWishlistButton, enableMultipleWishlists: enableMultipleWishlists, isInWishlist: isInWishlist, wishlists: wishlists, productWishlistIds: productWishlistIds, isWishlistPending: isWishlistPending, onWishlistToggle: onWishlistToggle || (() => { }), onAddToWishlist: onAddToWishlist || (() => { }), onRemoveFromWishlist: onRemoveFromWishlist || (() => { }), onCreateWishlist: onCreateWishlist || (() => { }) }), _jsxs("div", { className: "mt-10 px-4 sm:mt-16 sm:px-0 lg:mt-0", children: [badges && badges.length > 0 && (_jsx("div", { className: "flex flex-wrap gap-2", children: badges.map((badge, index) => (_jsx("span", { className: badge.color
86
99
  ? `${badge.color} inline-flex items-center px-2 py-1 text-xs font-medium text-w`
87
- : 'bg-gray-200 text-gray-800 px-2 py-1 text-xs font-medium', children: badge.text }, index))) })), _jsx(Heading, { className: "mt-8 font-extralight", level: 1, children: name }), _jsxs("div", { className: "flex gap-4", children: [_jsxs("span", { className: "text-sm text-gray-500", children: ["K\u00F3d: ", product.sku] }), _jsxs("span", { className: "text-sm text-gray-500", children: ["EAN: ", product.ean] })] }), _jsxs("div", { className: "mt-6", children: [_jsx(Heading, { level: 3, className: "sr-only", children: "Description" }), _jsx("div", { dangerouslySetInnerHTML: { __html: description }, className: "space-y-6 text-base text-gray-700" })] }), _jsxs("form", { className: "mt-6", children: [showVariations && (_jsxs("div", { children: [_jsx(Heading, { level: 3, className: "text-gray-600 mb-2", children: "Variace" }), _jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-1 2xl:grid-cols-2 gap-3", children: visibleVariations.map((variation) => (_jsxs(Button, { asLink: true, unstyled: true, href: variation.href, "aria-label": variation.title, className: buildClassesByJoining('w-full border p-4 flex justify-between items-center shadow-sm', currentVariationId == variation.id
100
+ : 'bg-gray-200 text-gray-800 px-2 py-1 text-xs font-medium', children: badge.text }, index))) })), _jsx(Heading, { className: "mt-8 font-extralight", level: 1, children: name }), _jsxs("div", { className: "flex gap-4", children: [_jsxs("span", { className: "text-sm text-gray-500", children: [translations.sku, ": ", product.sku] }), _jsxs("span", { className: "text-sm text-gray-500", children: [translations.EAN, ": ", product.ean] })] }), _jsxs("div", { className: "mt-6", children: [_jsx(Heading, { level: 3, className: "sr-only", children: "Description" }), _jsx("div", { dangerouslySetInnerHTML: { __html: description }, className: "space-y-6 text-base text-gray-700" })] }), _jsxs("form", { className: "mt-6", children: [showVariations && (_jsxs("div", { children: [_jsx(Heading, { level: 3, className: "text-gray-600 mb-2", children: "Variace" }), _jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-1 2xl:grid-cols-2 gap-3", children: visibleVariations.map((variation) => (_jsxs(Button, { asLink: true, unstyled: true, href: variation.href, "aria-label": variation.title, className: buildClassesByJoining('w-full border p-4 flex justify-between items-center shadow-sm', currentVariationId == variation.id
88
101
  ? 'border-[var(--primary)]'
89
102
  : 'border-gray-200', 'cursor-pointer transition-all duration-150 hover:border-[var(--primary)] hover:shadow-md'), children: [_jsxs("div", { className: "flex flex-col justify-between gap-1", children: [_jsx("span", { className: "font-medium text-base capitalize", children: variation.title }), _jsx("span", { className: (variation.stock ?? 0) > 0
90
103
  ? 'text-green-600 text-sm'
@@ -111,5 +124,13 @@ mainPriceFormatOptions, discountPriceFormatOptions, variationPriceFormatOptions,
111
124
  : 'bg-primary hover:bg-green-600'} text-white disabled:opacity-50 disabled:bg-black-300 disabled:cursor-not-allowed shadow-sm transition-all duration-200`, "aria-label": "Zv\u00FD\u0161i\u0165 mno\u017Estvo", children: _jsx(PlusIcon, { className: "h-5 w-5" }) })] }) })) })] }) })] }), _jsxs("section", { "aria-labelledby": "details-heading", className: "mt-8", children: [_jsx(Heading, { level: 2, id: "details-heading", className: "sr-only", children: "Additional details" }), _jsx("div", { className: "mt-3", children: price > 1000 ? (_jsx("p", { className: "text-sm text-gray-800", children: translations.shippingDetailFree })) : (_jsx("p", { className: "text-sm text-gray-800", children: translations.shippingDetailFee })) }), _jsx("div", { className: "mt-8", children: _jsxs("div", { className: "border-t py-5 border-gray-200 flex flex-col sm:flex-row flex-wrap gap-6 text-gray-600", children: [isWatchdogEnabled && (_jsxs(Button, { unstyled: true, className: "flex gap-2", onClick: onWatchdogClick, children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "size-5 text-[var(--primary)]", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0M3.124 7.5A8.969 8.969 0 0 1 5.292 3m13.416 0a8.969 8.969 0 0 1 2.168 4.5" }) }), _jsx("span", { className: "underline hover:no-underline", children: translations.watchDog })] })), _jsxs(Button, { unstyled: true, className: "flex gap-2", onClick: onDemandClick, children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "size-5 text-[var(--primary)]", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z" }) }), _jsx("span", { className: "underline hover:no-underline", children: translations.question })] }), _jsxs(Button, { unstyled: true, className: "flex gap-2", onClick: onShippingOptionsClick, children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "size-5 text-[var(--primary)]", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z" }) }), _jsx("span", { className: "underline hover:no-underline cursor-pointer", children: translations.optionOfShipping })] }), isLogged && (_jsxs("div", { className: "relative", children: [_jsxs("button", { ref: wishlistButtonRef, className: "flex gap-2 text-left hover:text-green-600 transition-colors", onClick: onWishlistTextClick, children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "size-5 text-[var(--primary)]", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z" }) }), _jsx("span", { className: "underline hover:no-underline", children: translations.addToWishlist })] }), showWishlistDropdown && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40", onClick: onCloseWishlistDropdown }), _jsx("div", { className: "absolute top-full left-52 mt-1 z-50", children: _jsx(WishlistDropdown, { show: true, wishlists: wishlists || [], productWishlistIds: productWishlistIds || [], isWishlistPending: isWishlistPending, onAddToWishlist: onAddToSpecificWishlist ||
112
125
  (() => { }), onRemoveFromWishlist: onRemoveFromSpecificWishlist ||
113
126
  (() => { }), onCreateNewWishlist: onCreateNewWishlistFromDropdown ||
114
- (() => { }), onClose: onCloseWishlistDropdown, isModal: false }) })] }))] }))] }) })] })] })] }), _jsx("section", { className: "mt-10", children: _jsx(HorizontalTab, { ...detail }) })] }) }));
127
+ (() => { }), onClose: onCloseWishlistDropdown, isModal: false }) })] }))] }))] }) })] })] })] }), _jsx("section", { className: "mt-10", children: _jsx(HorizontalTab, { ...detail }) }), specification && specification.length > 0 &&
128
+ _jsxs("section", { children: [_jsx(Heading, { level: 3, className: "label", children: translations.specification }), specification.map((item, index) => {
129
+ if ('separator' in item) {
130
+ return _jsx("div", { className: "h-4" }, index);
131
+ }
132
+ const key = Object.keys(item)[0];
133
+ const value = item[key];
134
+ return (_jsx("div", { className: "flex flex-col gap-2", children: _jsxs("span", { className: "", children: [key, ": ", value] }) }, index));
135
+ })] })] }) }));
115
136
  };
@@ -8,6 +8,7 @@ type BlogCardProps = {
8
8
  buttonText?: string;
9
9
  showSeparator?: boolean;
10
10
  bodyLimit?: number;
11
+ titleLimit?: number;
11
12
  href?: string;
12
13
  className?: {
13
14
  article?: string;
@@ -17,6 +18,8 @@ type BlogCardProps = {
17
18
  description?: string;
18
19
  separator?: string;
19
20
  };
21
+ createdAt?: string;
22
+ createdText?: string;
20
23
  };
21
- declare const BlogCard: ({ post, variant, fallbackBackgroundColor, textHorizontal, textVertical, buttonText, showSeparator, bodyLimit, href, className, }: BlogCardProps) => import("react/jsx-runtime").JSX.Element;
24
+ declare const BlogCard: ({ post, variant, fallbackBackgroundColor, textHorizontal, textVertical, buttonText, showSeparator, bodyLimit, titleLimit, href, className, createdAt, createdText, }: BlogCardProps) => import("react/jsx-runtime").JSX.Element;
22
25
  export default BlogCard;
@@ -8,12 +8,13 @@ const stripHtmlTags = (html) => {
8
8
  const truncateText = (text, limit) => {
9
9
  return text.length > limit ? text.slice(0, limit).trim() + '…' : text;
10
10
  };
11
- const BlogCard = ({ post, variant = 'imageOverlay', fallbackBackgroundColor = 'bg-gray-200', textHorizontal = 'center', textVertical = 'center', buttonText = 'Více informací', showSeparator = true, bodyLimit = 150, href, className = {}, }) => {
11
+ const BlogCard = ({ post, variant = 'imageOverlay', fallbackBackgroundColor = 'bg-gray-200', textHorizontal = 'center', textVertical = 'center', buttonText = 'Více informací', showSeparator = true, bodyLimit = 150, titleLimit = 50, href = '/blog', className = {}, createdAt = '', createdText = 'Vytvořeno', }) => {
12
12
  const { article = '', image = '', heading = '', button = '', description = '', separator = '', } = className;
13
13
  const hasImage = Boolean(post.field_image_url);
14
14
  const finalHref = href;
15
15
  const cleanBody = post.body ? stripHtmlTags(post.body) : '';
16
16
  const limitedBody = bodyLimit ? truncateText(cleanBody, bodyLimit) : cleanBody;
17
+ const limitedTitle = titleLimit ? truncateText(post.title, titleLimit) : post.title;
17
18
  const horizontalAlignments = {
18
19
  left: 'items-start text-left',
19
20
  center: 'items-center text-center',
@@ -25,11 +26,11 @@ const BlogCard = ({ post, variant = 'imageOverlay', fallbackBackgroundColor = 'b
25
26
  bottom: 'justify-end',
26
27
  };
27
28
  if (variant === 'imageTop') {
28
- return (_jsxs("article", { className: clsx('bg-white shadow-sm rounded overflow-hidden', article), children: [hasImage ? (_jsx("img", { alt: post.title, src: post.field_image_url, className: clsx('w-full h-48 object-cover', image) })) : (_jsx("div", { className: clsx('w-full h-48 flex items-center justify-center', fallbackBackgroundColor), children: _jsx("span", { className: "text-gray-600 text-center px-4 text-sm font-medium", children: post.title }) })), _jsxs("div", { className: "p-4", children: [_jsx(Heading, { level: 3, className: clsx('text-black font-semibold mb-2', heading), children: post.title }), limitedBody && (_jsx("p", { className: clsx('text-gray-600 text-sm mb-4', description), children: limitedBody })), showSeparator && _jsx("hr", { className: clsx('my-4', separator) }), _jsx(Button, { asLink: true, unstyled: true, href: finalHref, className: clsx('text-sm font-medium', button), children: buttonText })] })] }));
29
+ return (_jsxs("article", { className: clsx('bg-white shadow-sm rounded overflow-hidden', article), children: [hasImage ? (_jsx("img", { alt: post.title, src: post.field_image_url, className: clsx('w-full h-48 object-cover', image) })) : (_jsxs("div", { className: clsx('w-full h-48 flex items-center justify-center', fallbackBackgroundColor), children: [_jsx("span", { className: "text-gray-600 text-center px-4 text-sm font-medium", children: limitedTitle }), _jsx("span", { className: "text-gray-600 text-center px-4 text-xs font-light", children: createdAt })] })), _jsxs("div", { className: "p-4", children: [_jsx(Heading, { level: 3, className: clsx('text-black font-semibold mb-2', heading), children: limitedTitle }), createdAt && (_jsxs("p", { className: "text-gray-600 text-sm font-normal mb-2", children: [createdText, ": ", createdAt] })), limitedBody && (_jsx("p", { className: clsx('text-gray-600 text-md mb-4', description), children: limitedBody })), showSeparator && _jsx("hr", { className: clsx('my-4', separator) }), _jsx(Button, { asLink: true, unstyled: true, href: finalHref, className: clsx('text-sm font-medium', button), children: buttonText })] })] }));
29
30
  }
30
31
  // imageOverlay variant
31
32
  return (_jsx("article", { className: clsx('relative isolate overflow-hidden flex flex-col', hasImage
32
33
  ? 'px-8 pt-8 pb-8 bg-gray-900 h-[320px]'
33
- : `h-80 ${fallbackBackgroundColor}`, article), children: hasImage ? (_jsxs(_Fragment, { children: [_jsx("img", { alt: post.title, src: post.field_image_url, className: clsx('absolute inset-0 -z-10 w-full h-full object-cover', image) }), _jsx("div", { className: "absolute inset-0 -z-10 bg-gradient-to-t from-gray-900 via-gray-900/40" }), _jsx("div", { className: "absolute inset-0 -z-10 ring-1 ring-gray-900/10 ring-inset" }), _jsx("div", { className: clsx('flex flex-1 flex-col', verticalAlignments[textVertical], horizontalAlignments[textHorizontal]), children: _jsx(Heading, { level: 3, className: clsx('font-extralight text-white', heading), children: _jsxs(Button, { asLink: true, unstyled: true, href: finalHref, className: clsx(button), children: [_jsx("span", { className: "absolute inset-0" }), post.title] }) }) })] })) : (_jsx("div", { className: clsx('flex flex-1 flex-col px-8', verticalAlignments[textVertical], horizontalAlignments[textHorizontal]), children: _jsx(Heading, { level: 3, className: clsx('text-gray-800 font-medium', heading), children: _jsx(Button, { asLink: true, unstyled: true, href: finalHref, className: clsx(button), children: post.title }) }) })) }));
34
+ : `h-80 ${fallbackBackgroundColor}`, article), children: hasImage ? (_jsxs(_Fragment, { children: [_jsx("img", { alt: post.title, src: post.field_image_url, className: clsx('absolute inset-0 -z-10 w-full h-full object-cover', image) }), _jsx("div", { className: "absolute inset-0 -z-10 bg-gradient-to-t from-gray-900 via-gray-900/40" }), _jsx("div", { className: "absolute inset-0 -z-10 ring-1 ring-gray-900/10 ring-inset" }), _jsx("div", { className: clsx('flex flex-1 flex-col', verticalAlignments[textVertical], horizontalAlignments[textHorizontal]), children: _jsx(Heading, { level: 3, className: clsx('font-extralight text-white', heading), children: _jsxs(Button, { asLink: true, unstyled: true, href: finalHref, className: clsx(button), children: [_jsx("span", { className: "absolute inset-0" }), limitedTitle] }) }) })] })) : (_jsx("div", { className: clsx('flex flex-1 flex-col px-8', verticalAlignments[textVertical], horizontalAlignments[textHorizontal]), children: _jsx(Heading, { level: 3, className: clsx('text-gray-800 font-medium', heading), children: _jsx(Button, { asLink: true, unstyled: true, href: finalHref, className: clsx(button), children: limitedTitle }) }) })) }));
34
35
  };
35
36
  export default BlogCard;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@q2devel/q2-storybook",
3
- "version": "1.0.119",
3
+ "version": "1.0.121",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",