@q2devel/q2-storybook 1.0.65 → 1.0.67

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.
Files changed (31) hide show
  1. package/dist/components/Base/badge/Badge.d.ts +1 -1
  2. package/dist/components/Base/badge/Badge.js +2 -2
  3. package/dist/components/Base/modal/Modal.js +1 -1
  4. package/dist/components/Ecommerce/basket-dialog/BasketDialog.d.ts +3 -3
  5. package/dist/components/Ecommerce/basket-dialog/BasketDialog.js +24 -29
  6. package/dist/components/Ecommerce/category-tree/CategoryTree.js +2 -2
  7. package/dist/components/Ecommerce/product-card/ProductCard.d.ts +7 -1
  8. package/dist/components/Ecommerce/product-card/ProductCard.js +35 -14
  9. package/dist/components/Forms/contact-form/ContactForm.js +7 -1
  10. package/dist/components/Forms/text-area/TextArea.d.ts +4 -2
  11. package/dist/components/Forms/text-area/TextArea.js +16 -4
  12. package/dist/components/Forms/text-field/TextField.d.ts +4 -2
  13. package/dist/components/Forms/text-field/TextField.js +53 -51
  14. package/dist/components/Forms/text-field/TextField.types.d.ts +2 -0
  15. package/dist/components/Web/banner/Banner.d.ts +1 -1
  16. package/dist/components/Web/dynamic-grid/DynamicLayout.d.ts +8 -0
  17. package/dist/components/Web/dynamic-grid/DynamicLayout.js +172 -0
  18. package/dist/components/Web/footer/Footer.js +86 -1
  19. package/dist/components/Web/nav-bar/NavBar.d.ts +1 -1
  20. package/dist/components/Web/nav-bar/NavBar.js +6 -6
  21. package/dist/components/Web/web-section/WebSection.d.ts +5 -2
  22. package/dist/components/Web/web-section/WebSection.js +17 -3
  23. package/dist/components/label/Label.js +2 -2
  24. package/dist/index.d.ts +33 -27
  25. package/dist/index.js +34 -28
  26. package/dist/server/grid-endpoint.d.ts +1 -0
  27. package/dist/server/grid-endpoint.js +35 -0
  28. package/dist/style.css +1 -1
  29. package/dist/utils/generalHelperFunction.d.ts +15 -1
  30. package/dist/utils/generalHelperFunction.js +69 -8
  31. package/package.json +5 -1
@@ -1,4 +1,4 @@
1
- import { MouseEvent, ReactNode } from 'react';
1
+ import { MouseEvent, ReactNode } from "react";
2
2
  interface BadgeProps {
3
3
  children: ReactNode;
4
4
  onClick?: (e: MouseEvent) => void;
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- const Badge = ({ children, onClick, color = 'bg-blue-100 text-blue-800', className = '', labelClassName = '', rightIcon, }) => (_jsxs("span", { className: `inline-flex items-center rounded px-2.5 py-0.5 text-xs font-medium ${color} ${className}`, onClick: onClick, children: [_jsx("span", { className: labelClassName, children: children }), rightIcon && _jsx("span", { className: "ml-1", children: rightIcon })] }));
3
+ const Badge = ({ children, onClick, color = "bg-blue-100 text-blue-800", className = "", labelClassName = "", rightIcon, }) => (_jsxs("span", { className: `inline-flex items-center rounded px-2.5 py-0.5 text-xs font-medium ${color} ${className}`, onClick: onClick, children: [_jsx("span", { className: labelClassName, children: children }), rightIcon && _jsx("span", { className: "ml-1", children: rightIcon })] }));
4
4
  export default Badge;
@@ -7,6 +7,6 @@ export const Modal = ({ title, description, descriptionClassName, buttonText, sh
7
7
  const handleClose = (value) => {
8
8
  onClose?.();
9
9
  };
10
- return (_jsxs(Dialog, { open: isOpen, onClose: handleClose, className: buildClassesByJoining('relative z-10', className), children: [_jsx(DialogBackdrop, { transition: true, className: buildClassesByJoining('fixed inset-0 bg-gray-500/75 transition-opacity data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in', backdropClassName) }), _jsx("div", { className: "fixed inset-0 z-10 w-screen overflow-y-auto", children: _jsx("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: _jsxs(DialogPanel, { transition: true, className: buildClassesByJoining('relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all data-closed:translate-y-4 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:my-8 sm:w-full sm:max-w-sm sm:p-6 data-closed:sm:translate-y-0 data-closed:sm:scale-95', panelClassName), children: [showCloseButton && (_jsxs("button", { type: "button", className: buildClassesByJoining('absolute top-4 right-4 text-gray-400 hover:text-gray-500 focus:outline-none', closeButtonClassName), onClick: () => onClose?.(), children: [_jsx("span", { className: "sr-only", children: "Close" }), _jsx(XMarkIcon, { className: "h-6 w-6", "aria-hidden": "true" })] })), _jsxs("div", { children: [showIcon && (_jsx("div", { className: buildClassesByJoining('mx-auto flex size-12 items-center justify-center rounded-full', iconBackgroundColor), children: _jsx("div", { className: iconColor, children: icon }) })), _jsxs("div", { className: "mt-3 text-center sm:mt-5", children: [title && (_jsx(DialogTitle, { as: "h3", className: "text-base font-semibold text-gray-900", children: title })), _jsx("div", { className: buildClassesByJoining('mt-2', descriptionClassName), children: description })] })] }), buttonText && (_jsx("div", { className: "mt-5 sm:mt-6", children: _jsx("button", { type: "button", onClick: () => onClose?.(), className: buildClassesByJoining('inline-flex w-full justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-green-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600', buttonClassName), children: buttonText }) }))] }) }) })] }));
10
+ return (_jsxs(Dialog, { open: isOpen, onClose: handleClose, className: buildClassesByJoining('relative z-10', className), children: [_jsx(DialogBackdrop, { transition: true, className: buildClassesByJoining('fixed inset-0 bg-gray-500/75 transition-opacity data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in', backdropClassName) }), _jsx("div", { className: "fixed inset-0 z-10 w-screen overflow-y-auto", children: _jsx("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: _jsxs(DialogPanel, { transition: true, className: buildClassesByJoining('relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all data-closed:translate-y-4 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:my-8 sm:w-full sm:max-w-sm sm:p-6 data-closed:sm:translate-y-0 data-closed:sm:scale-95', panelClassName), children: [showCloseButton && (_jsxs("button", { type: "button", className: buildClassesByJoining('absolute top-4 right-4 text-gray-400 hover:text-gray-500 focus:outline-none', closeButtonClassName), onClick: () => onClose?.(), children: [_jsx("span", { className: "sr-only", children: "Close" }), _jsx(XMarkIcon, { className: "h-6 w-6", "aria-hidden": "true" })] })), _jsxs("div", { children: [showIcon && (_jsx("div", { className: buildClassesByJoining('mx-auto flex size-12 items-center justify-center rounded-full', iconBackgroundColor), children: _jsx("div", { className: iconColor, children: icon }) })), _jsxs("div", { className: "mt-3 text-center sm:mt-5", children: [title && (_jsx(DialogTitle, { as: "h3", className: "text-base font-semibold text-gray-900", children: title })), _jsx("div", { className: buildClassesByJoining('mt-2', descriptionClassName), children: description })] })] }), buttonText && (_jsx("div", { className: "mt-5 sm:mt-6", children: _jsx("button", { type: "button", onClick: () => onClose?.(), className: buildClassesByJoining('inline-flex w-full justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-green-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600', buttonClassName), children: buttonText }) })), buttonText && (_jsx("div", { className: "mt-5 sm:mt-6", children: _jsx("button", { type: "button", onClick: () => onClose?.(), className: buildClassesByJoining('inline-flex w-full justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-green-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600', buttonClassName), children: buttonText }) }))] }) }) })] }));
11
11
  };
12
12
  export default Modal;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  export type BasketProduct = {
3
3
  id: string;
4
4
  name: string;
@@ -12,8 +12,8 @@ export type BasketProduct = {
12
12
  color?: string;
13
13
  [key: string]: any;
14
14
  };
15
- export type BasketDialogVariant = 'default' | 'compact' | 'full';
16
- export type BasketDialogPosition = 'right' | 'left';
15
+ export type BasketDialogVariant = "default" | "compact" | "full";
16
+ export type BasketDialogPosition = "right" | "left";
17
17
  export type BasketDialogProps = {
18
18
  isOpen: boolean;
19
19
  onClose: () => void;
@@ -1,12 +1,12 @@
1
- 'use client';
1
+ "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Dialog, DialogBackdrop, DialogPanel, DialogTitle } from '@headlessui/react';
4
- import { MinusIcon, PlusIcon, XMarkIcon } from '@heroicons/react/24/outline';
3
+ import { Dialog, DialogBackdrop, DialogPanel, DialogTitle, } from "@headlessui/react";
4
+ import { MinusIcon, PlusIcon, XMarkIcon } from "@heroicons/react/24/outline";
5
5
  // Helper funkcia pre formátovanie ceny
6
6
  const formatPrice = (price) => {
7
- return new Intl.NumberFormat('cs-CZ', {
8
- style: 'currency',
9
- currency: 'CZK',
7
+ return new Intl.NumberFormat("cs-CZ", {
8
+ style: "currency",
9
+ currency: "CZK",
10
10
  }).format(price);
11
11
  };
12
12
  export const BasketDialog = ({
@@ -15,11 +15,11 @@ isOpen, onClose, products, subtotal,
15
15
  // Callback funkcie
16
16
  onQuantityChange, onRemoveProduct, onCheckout, onContinueShopping, onProductClick,
17
17
  // Texty s predvolenými hodnotami
18
- title = 'Váš košík', checkoutText = 'Pokračovat k objednávce', continueShoppingText = 'Pokračovat v nákupu', emptyCartText = 'Váš košík je prázdný', quantityLabel = 'Množství:', removeButtonText = 'Odstranit', totalLabel = 'Celkem', shippingNoteText = 'Doprava a daně budou vypočítány při dokončení objednávky.',
18
+ title = "Váš košík", checkoutText = "Pokračovat k objednávce", continueShoppingText = "Pokračovat v nákupu", emptyCartText = "Váš košík je prázdný", quantityLabel = "Množství:", removeButtonText = "Odstranit", totalLabel = "Celkem", shippingNoteText = "Doprava a daně budou vypočítány při dokončení objednávky.",
19
19
  // Zobrazenie/konfigurácia s predvolenými hodnotami
20
- variant = 'default', position = 'right', showProductImages = true, showProductColors = true, showProductLinks = true, showRemoveButton = true, showSubtotal = true, showCheckoutButton = true, showContinueShoppingButton = true, showShippingNote = true, showQuantityControls = true,
20
+ variant = "default", position = "right", showProductImages = true, showProductColors = true, showProductLinks = true, showRemoveButton = true, showSubtotal = true, showCheckoutButton = true, showContinueShoppingButton = true, showShippingNote = true, showQuantityControls = true,
21
21
  // Štýlovanie s predvolenými hodnotami
22
- customClassName = '', maxHeight = '100vh', animationDuration = 500, backdropOpacity = 0.75,
22
+ customClassName = "", maxHeight = "100vh", animationDuration = 500, backdropOpacity = 0.75,
23
23
  // Vlastné renderovanie
24
24
  renderCustomProduct, renderCustomFooter,
25
25
  // Stav
@@ -54,16 +54,16 @@ pendingUpdates = {}, processingItems = {}, }) => {
54
54
  };
55
55
  const getVariantClasses = () => {
56
56
  switch (variant) {
57
- case 'compact':
58
- return 'max-w-sm';
59
- case 'full':
60
- return 'max-w-2xl';
57
+ case "compact":
58
+ return "max-w-sm";
59
+ case "full":
60
+ return "max-w-2xl";
61
61
  default:
62
- return 'max-w-md';
62
+ return "max-w-md";
63
63
  }
64
64
  };
65
65
  const getPositionClasses = () => {
66
- return position === 'left' ? 'left-0' : 'right-0';
66
+ return position === "left" ? "left-0" : "right-0";
67
67
  };
68
68
  return (_jsxs(Dialog, { open: isOpen, onClose: onClose, className: "relative z-60", children: [_jsx(DialogBackdrop, { transition: true, className: `fixed inset-0 bg-gray-500/75 transition-opacity duration-${animationDuration} ease-in-out data-closed:opacity-0`, style: { opacity: backdropOpacity } }), _jsx("div", { className: "fixed inset-0 overflow-hidden", children: _jsx("div", { className: "absolute inset-0 overflow-hidden", children: _jsx("div", { className: `pointer-events-none fixed inset-y-0 ${getPositionClasses()} flex max-w-full pl-10`, children: _jsx(DialogPanel, { transition: true, className: `pointer-events-auto w-screen ${getVariantClasses()} transform transition duration-${animationDuration} ease-in-out data-closed:translate-x-full sm:duration-700 ${customClassName}`, children: _jsxs("div", { className: "flex h-full flex-col overflow-y-scroll bg-white shadow-xl", style: { maxHeight }, children: [_jsxs("div", { className: "flex-1 overflow-y-auto px-4 py-6 sm:px-6", children: [_jsxs("div", { className: "flex items-start justify-between", children: [_jsx(DialogTitle, { className: "text-lg font-medium text-gray-900", children: title }), _jsx("div", { className: "ml-3 flex h-7 items-center", children: _jsxs("button", { type: "button", onClick: onClose, className: "relative -m-2 p-2 text-gray-400 hover:text-gray-500", children: [_jsx("span", { className: "absolute -inset-0.5" }), _jsx("span", { className: "sr-only", children: "Close panel" }), _jsx(XMarkIcon, { "aria-hidden": "true", className: "size-6" })] }) })] }), _jsx("div", { className: "mt-8", children: _jsx("div", { className: "flow-root", children: products.length === 0 ? (_jsx("div", { className: "py-6 text-center text-gray-500", children: emptyCartText })) : (_jsx("ul", { role: "list", className: "-my-6 divide-y divide-gray-200", children: products.map((product) => {
69
69
  if (renderCustomProduct) {
@@ -74,28 +74,23 @@ pendingUpdates = {}, processingItems = {}, }) => {
74
74
  : product.quantity;
75
75
  const isProcessing = processingItems[product.id] === true;
76
76
  return (_jsxs("li", { className: "flex py-6", children: [showProductImages &&
77
- product.variaton_image && (_jsx("div", { className: "size-24 shrink-0 overflow-hidden rounded-md border border-gray-200", children: _jsx("img", { alt: product.variaton_image
78
- .alt, src: product.variaton_image
79
- .src, className: "size-full object-cover" }) })), _jsxs("div", { className: "ml-4 flex flex-1 flex-col", children: [_jsxs("div", { children: [_jsxs("div", { className: "flex justify-between text-base font-medium text-gray-900", children: [_jsx("h3", { children: showProductLinks &&
80
- product.href ? (_jsx("a", { href: product.href, onClick: (e) => {
77
+ product.variaton_image && (_jsx("div", { className: "size-24 shrink-0 overflow-hidden rounded-md border border-gray-200", children: _jsx("img", { alt: product.variaton_image.alt, src: product.variaton_image.src, className: "size-full object-cover" }) })), _jsxs("div", { className: "ml-4 flex flex-1 flex-col", children: [_jsxs("div", { children: [_jsxs("div", { className: "flex justify-between text-base font-medium text-gray-900", children: [_jsx("h3", { children: showProductLinks && product.href ? (_jsx("a", { href: product.href, onClick: (e) => {
81
78
  if (onProductClick) {
82
79
  e.preventDefault();
83
80
  onProductClick(product);
84
81
  }
85
- }, children: product.name })) : (product.name) }), _jsx("p", { className: "ml-4", children: formatPrice(product.price) })] }), showProductColors &&
86
- product.color && (_jsx("p", { className: "mt-1 text-sm text-gray-500", children: product.color }))] }), _jsxs("div", { className: "flex flex-1 items-end justify-between text-sm", children: [showQuantityControls &&
82
+ }, children: product.name })) : (product.name) }), _jsx("p", { className: "ml-4", children: formatPrice(product.price) })] }), showProductColors && product.color && (_jsx("p", { className: "mt-1 text-sm text-gray-500", children: product.color }))] }), _jsxs("div", { className: "flex flex-1 items-end justify-between text-sm", children: [showQuantityControls &&
87
83
  onQuantityChange ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { className: "text-gray-500 mr-2", children: quantityLabel }), _jsxs("div", { className: "flex items-center", children: [_jsx("button", { type: "button", onClick: () => !isProcessing &&
88
84
  handleDecrement(product.id, displayQuantity), disabled: isProcessing, className: `rounded-full p-1 text-gray-600 ${isProcessing
89
- ? 'bg-gray-100 cursor-not-allowed opacity-50'
90
- : '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: () => !isProcessing &&
85
+ ? "bg-gray-100 cursor-not-allowed opacity-50"
86
+ : "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: () => !isProcessing &&
91
87
  handleIncrement(product.id, displayQuantity), disabled: isProcessing, className: `rounded-full p-1 text-gray-600 ${isProcessing
92
- ? 'bg-gray-100 cursor-not-allowed opacity-50'
93
- : 'bg-gray-200 hover:bg-gray-300'}`, children: _jsx(PlusIcon, { className: "h-4 w-4" }) })] })] })) : (_jsxs("p", { className: "text-gray-500", children: [quantityLabel, ' ', displayQuantity] })), showRemoveButton &&
94
- onRemoveProduct && (_jsx("div", { className: "flex", children: _jsx("button", { type: "button", className: `font-medium ${isProcessing
95
- ? 'text-gray-400 cursor-not-allowed'
96
- : 'text-green-600 hover:text-green-500'}`, onClick: () => !isProcessing &&
88
+ ? "bg-gray-100 cursor-not-allowed opacity-50"
89
+ : "bg-gray-200 hover:bg-gray-300"}`, children: _jsx(PlusIcon, { className: "h-4 w-4" }) })] })] })) : (_jsxs("p", { className: "text-gray-500", children: [quantityLabel, " ", displayQuantity] })), showRemoveButton && onRemoveProduct && (_jsx("div", { className: "flex", children: _jsx("button", { type: "button", className: `font-medium ${isProcessing
90
+ ? "text-gray-400 cursor-not-allowed"
91
+ : "text-green-600 hover:text-green-500"}`, onClick: () => !isProcessing &&
97
92
  onRemoveProduct(product.id), disabled: isProcessing, children: removeButtonText }) }))] })] })] }, product.id));
98
- }) })) }) })] }), _jsxs("div", { className: "border-t border-gray-200 px-4 py-6 sm:px-6", children: [showSubtotal && (_jsxs("div", { className: "flex justify-between text-base font-medium text-gray-900", children: [_jsx("p", { children: totalLabel }), _jsx("p", { children: typeof subtotal === 'number'
93
+ }) })) }) })] }), _jsxs("div", { className: "border-t border-gray-200 px-4 py-6 sm:px-6", children: [showSubtotal && (_jsxs("div", { className: "flex justify-between text-base font-medium text-gray-900", children: [_jsx("p", { children: totalLabel }), _jsx("p", { children: typeof subtotal === "number"
99
94
  ? formatPrice(subtotal)
100
95
  : subtotal })] })), showShippingNote && (_jsx("p", { className: "mt-0.5 text-sm text-gray-500", children: shippingNoteText })), products.length > 0 && showCheckoutButton && onCheckout && (_jsx("div", { className: "mt-6", children: _jsx("button", { onClick: handleCheckout, className: "flex w-full items-center justify-center rounded-md border border-transparent bg-green-600 px-6 py-3 text-base font-medium text-white shadow-xs hover:bg-green-700", children: checkoutText }) })), showContinueShoppingButton && (_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-green-600 hover:text-green-500", children: [continueShoppingText, _jsx("span", { "aria-hidden": "true", children: " \u2192" })] }) }) })), renderCustomFooter && renderCustomFooter()] })] }) }) }) }) })] }));
101
96
  };
@@ -1,8 +1,8 @@
1
- 'use client';
1
+ "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { buildClassesByJoining } from '@/utils/StyleHelper';
4
3
  import { MinusIcon, PlusIcon } from '@heroicons/react/20/solid';
5
4
  import { useEffect, useState } from 'react';
5
+ import { buildClassesByJoining } from '../../../utils/StyleHelper';
6
6
  import Button from '../../Base/button/Button';
7
7
  export const findChildren = (term, terms) => {
8
8
  const children = terms
@@ -1,5 +1,6 @@
1
1
  import { Product } from '@q2devel/q2-core';
2
2
  import React from 'react';
3
+ import { PriceFormatOptions } from '../../../utils/generalHelperFunction';
3
4
  export type Wishlist = {
4
5
  id: string;
5
6
  name: string;
@@ -34,6 +35,10 @@ export type ProductCardProps = {
34
35
  actionButton?: React.ReactNode;
35
36
  showAddButton?: boolean;
36
37
  showAddButtonOnHover?: boolean;
38
+ addButtonPosition?: 'overlay' | 'bottom';
39
+ addButtonAlignment?: 'left' | 'center' | 'right';
40
+ addButtonText?: string;
41
+ addButtonBottomClassName?: string;
37
42
  borderOnHoverClassName?: string;
38
43
  currentQuantity: number;
39
44
  onQuantityChange?: (product: Product, quantity: number) => void;
@@ -65,5 +70,6 @@ export type ProductCardProps = {
65
70
  isDeletePending?: boolean;
66
71
  deleteButtonSize?: 'sm' | 'md' | 'lg';
67
72
  deleteButtonPosition?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
73
+ priceFormatOptions?: PriceFormatOptions;
68
74
  };
69
- export declare const ProductCard: ({ product, href, className, imageClassName, contentClassName, titleClassName, colorClassName, priceClassName, descriptionClassName, badgeClassName, aspectRatio, imagePosition, imageObjectFit, layout, hoverEffect, renderBadges, renderColor, renderDescription, elevationLevel, rounded, titleLines, onCardClick, onImageClick, renderFooter, renderHeader, renderVariationName, actionButton, showAddButton, showAddButtonOnHover, borderOnHoverClassName, currentQuantity, onQuantityChange, addButtonIcon, maxQuantity, controlsClassName, buttonClassName, quantityClassName, customAddButton, disabled, locale, cartMode, showSpinnerInAdd, showWishlistButton, isInWishlist, onWishlistToggle, wishlistButtonClassName, isWishlistPending, enableMultipleWishlists, wishlists, onAddToWishlist, onRemoveFromWishlist, onCreateWishlist, wishlistDropdownClassName, productWishlistIds, showDeleteButton, onDelete, deleteButtonClassName, isDeletePending, deleteButtonSize, deleteButtonPosition, }: ProductCardProps) => import("react/jsx-runtime").JSX.Element;
75
+ export declare const ProductCard: ({ product, href, className, imageClassName, contentClassName, titleClassName, priceClassName, descriptionClassName, badgeClassName, aspectRatio, imagePosition, imageObjectFit, layout, hoverEffect, renderBadges, renderColor, renderDescription, elevationLevel, rounded, titleLines, onCardClick, onImageClick, renderFooter, renderHeader, renderVariationName, actionButton, showAddButton, showAddButtonOnHover, addButtonPosition, addButtonAlignment, addButtonText, addButtonBottomClassName, borderOnHoverClassName, currentQuantity, onQuantityChange, addButtonIcon, maxQuantity, controlsClassName, buttonClassName, quantityClassName, customAddButton, disabled, locale, cartMode, showSpinnerInAdd, showWishlistButton, isInWishlist, onWishlistToggle, wishlistButtonClassName, isWishlistPending, enableMultipleWishlists, wishlists, onAddToWishlist, onRemoveFromWishlist, onCreateWishlist, wishlistDropdownClassName, productWishlistIds, showDeleteButton, onDelete, deleteButtonClassName, isDeletePending, deleteButtonSize, deleteButtonPosition, priceFormatOptions, }: ProductCardProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,30 +1,39 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { formatPrice } from '../../../utils/generalHelperFunction';
4
- import { buildClassesByJoining } from '../../../utils/StyleHelper';
5
3
  import { ShoppingBagIcon } from '@heroicons/react/24/solid';
6
- import { useCallback, useRef, useState } from 'react';
4
+ import parseHTML from 'html-react-parser';
5
+ import { useCallback, useState } from 'react';
6
+ import { formatPriceForHTML, formatPriceString, } from '../../../utils/generalHelperFunction';
7
+ import { buildClassesByJoining } from '../../../utils/StyleHelper';
8
+ import Badge from '../../Base/badge/Badge';
7
9
  import AddToCart from '../../Base/button/AddToCart';
8
- import Heading from '../../Base/heading/Heading';
9
10
  import Button from '../../Base/button/Button';
11
+ import Heading from '../../Base/heading/Heading';
10
12
  import Spinner from '../../Base/spinner/Spinner';
11
- import Badge from '../../Base/badge/Badge';
12
- import LikeButton from '../wishlist/LikeButton';
13
13
  import DeleteButton from '../wishlist/DeleteButton';
14
- export const ProductCard = ({ product, href, className, imageClassName, contentClassName, titleClassName, colorClassName, priceClassName, descriptionClassName, badgeClassName, aspectRatio = 'square', imagePosition = 'center', imageObjectFit = 'cover', layout = 'default', hoverEffect = 'opacity', renderBadges = true, renderColor = true, renderDescription = false, elevationLevel = 0, rounded = 'md', titleLines = 1, onCardClick, onImageClick, renderFooter, renderHeader, renderVariationName = false, actionButton,
14
+ import LikeButton from '../wishlist/LikeButton';
15
+ export const ProductCard = ({ product, href, className, imageClassName, contentClassName, titleClassName, priceClassName, descriptionClassName, badgeClassName, aspectRatio = 'square', imagePosition = 'center', imageObjectFit = 'cover', layout = 'default', hoverEffect = 'opacity', renderBadges = true, renderColor = true, renderDescription = false, elevationLevel = 0, rounded = 'md', titleLines = 1, onCardClick, onImageClick, renderFooter, renderHeader, renderVariationName = false, actionButton,
15
16
  // Add to cart functionality
16
- showAddButton = false, showAddButtonOnHover = false, borderOnHoverClassName = '', currentQuantity = 0, onQuantityChange, addButtonIcon = _jsx(ShoppingBagIcon, { className: "h-4 w-4" }), maxQuantity = 99, controlsClassName = '', buttonClassName = '', quantityClassName = '', customAddButton, disabled = false, locale, cartMode = 'full', showSpinnerInAdd = false,
17
+ showAddButton = false, showAddButtonOnHover = false, addButtonPosition = 'overlay', addButtonAlignment = 'center', addButtonText = 'Pridať do košíka', addButtonBottomClassName = '', borderOnHoverClassName = '', currentQuantity = 0, onQuantityChange, addButtonIcon = _jsx(ShoppingBagIcon, { className: "h-4 w-4" }), maxQuantity = 99, controlsClassName = '', buttonClassName = '', quantityClassName = '', customAddButton, disabled = false, locale, cartMode = 'full', showSpinnerInAdd = false,
17
18
  // Wishlist functionality
18
19
  showWishlistButton = false, isInWishlist = false, onWishlistToggle, wishlistButtonClassName = '', isWishlistPending = false,
19
20
  // Multiple wishlists support
20
21
  enableMultipleWishlists = false, wishlists = [], onAddToWishlist, onRemoveFromWishlist, onCreateWishlist, wishlistDropdownClassName = '', productWishlistIds = [],
21
22
  // Delete functionality
22
- showDeleteButton = false, onDelete, deleteButtonClassName = '', isDeletePending = false, deleteButtonSize = 'md', deleteButtonPosition = 'top-right', }) => {
23
+ showDeleteButton = false, onDelete, deleteButtonClassName = '', isDeletePending = false, deleteButtonSize = 'md', deleteButtonPosition = 'top-right',
24
+ // Price formatting - NOVÉ JEDNODUCHÉ API
25
+ priceFormatOptions, }) => {
23
26
  const [showWishlistDropdown, setShowWishlistDropdown] = useState(false);
24
27
  const [showNewWishlistInput, setShowNewWishlistInput] = useState(false);
25
28
  const [newWishlistName, setNewWishlistName] = useState('');
26
- const inputRef = useRef(null);
27
- const showQuantityControls = currentQuantity > 0 || (disabled && currentQuantity === 0);
29
+ const getBottomButtonAlignment = () => {
30
+ const alignmentClasses = {
31
+ left: 'justify-start',
32
+ center: 'justify-center',
33
+ right: 'justify-end',
34
+ };
35
+ return alignmentClasses[addButtonAlignment];
36
+ };
28
37
  const shouldShowQuantityControls = () => {
29
38
  if (cartMode === 'add-only') {
30
39
  return false;
@@ -35,7 +44,7 @@ showDeleteButton = false, onDelete, deleteButtonClassName = '', isDeletePending
35
44
  if (cartMode === 'add-only') {
36
45
  return true;
37
46
  }
38
- return showAddButton;
47
+ return showAddButton && currentQuantity === 0;
39
48
  };
40
49
  // Determine which icon to show
41
50
  const getButtonIcon = () => {
@@ -152,6 +161,18 @@ showDeleteButton = false, onDelete, deleteButtonClassName = '', isDeletePending
152
161
  onDelete(product);
153
162
  }
154
163
  }, [onDelete, product]);
155
- return (_jsxs("div", { className: buildClassesByJoining('group relative h-full', layoutClass, elevationClass, onCardClick ? 'cursor-pointer' : '', borderOnHoverClassName, className), onClick: handleCardClick, children: [renderHeader && renderHeader(product), _jsxs("div", { className: buildClassesByJoining(imageLayoutClass, 'relative'), children: [product.badges && renderBadges && (_jsx("div", { className: "absolute top-2 left-2 z-10 flex flex-wrap gap-1", children: product.badges.map((badge, index) => (_jsx(Badge, { color: badge.color, children: badge.text }, index))) })), showDeleteButton ? (_jsx(DeleteButton, { show: showDeleteButton, onDelete: handleDelete, deleteButtonClassName: deleteButtonClassName, isDeletePending: isDeletePending, size: deleteButtonSize, position: deleteButtonPosition })) : (_jsx(LikeButton, { show: showWishlistButton, enableMultiple: enableMultipleWishlists, isInWishlist: isInWishlist, wishlists: wishlists, productWishlistIds: productWishlistIds, wishlistButtonClassName: wishlistButtonClassName, wishlistDropdownClassName: wishlistDropdownClassName, isWishlistPending: isWishlistPending, handleAddToWishlist: handleAddToWishlist, handleRemoveFromWishlist: handleRemoveFromWishlist, handleCreateNewWishlist: handleCreateNewWishlist, handleWishlistToggle: handleWishlistToggle })), _jsx("img", { alt: product.variation_images[0]?.alt, src: product.variation_images[0]?.href, className: buildClassesByJoining(aspectRatioClass, objectFitClass, objectPositionClass, hoverEffect !== 'none' ? hoverClass : '', roundedClass, 'bg-gray-200', onImageClick ? 'cursor-pointer' : '', imageClassName), onClick: handleImageClick }), _jsx("div", { className: showAddButtonOnHover === true ? 'opacity-0 group-hover:opacity-100 transition-opacity duration-300' : '', children: _jsx(AddToCart, { buttonClassName: buttonClassName, addButtonIcon: _jsx(ShoppingBagIcon, { className: "h-4 w-4" }), handleAddToCart: handleAddToCart, showAddButton: true, disabled: disabled }) })] }), _jsxs("div", { className: buildClassesByJoining('mt-4 h-full flex flex-col justify-between grow', contentLayoutClass, compactClass, contentClassName), children: [_jsxs("div", { className: "flex flex-col h-full justify-between", children: [_jsxs("div", { children: [_jsx(Heading, { level: 3, className: buildClassesByJoining('text-lg text-gray-700', titleLineClampClass, titleClassName), children: _jsxs(Button, { asLink: true, unstyled: true, href: href, children: [!onCardClick && (_jsx("span", { "aria-hidden": "true", className: "absolute inset-0" })), product.product_name] }) }), renderVariationName && product.variation_name && (_jsx(Heading, { className: 'text-md', level: 4, children: product.variation_name })), renderDescription && product.description && (_jsx("p", { className: buildClassesByJoining('mt-1 text-sm text-gray-500 line-clamp-2', descriptionClassName), children: product.description }))] }), _jsxs("div", { className: 'flex flex-col justify-between', children: [_jsx("p", { className: buildClassesByJoining('text-md font-bold text-gray-900', priceClassName), children: formatPrice(product.price, locale) }), _jsx("p", { className: buildClassesByJoining('text-sm font-normal text-gray-900 line-through', priceClassName), children: product?.discountPercent != null && product.discountPercent > 0 &&
156
- formatPrice(product.price / (1 - product.discountPercent / 100), locale) })] })] }), actionButton && _jsx("div", { className: "mt-2", children: actionButton }), renderFooter && renderFooter(product)] })] }));
164
+ // Rozhodnutie či použiť HTML alebo string formát
165
+ const shouldUseHtml = priceFormatOptions?.numberFormat === 'decimal-index' ||
166
+ priceFormatOptions?.numberClassName ||
167
+ priceFormatOptions?.currencyClassName ||
168
+ priceFormatOptions?.containerClassName;
169
+ return (_jsxs("div", { className: buildClassesByJoining('group relative h-full', layoutClass, elevationClass, onCardClick ? 'cursor-pointer' : '', borderOnHoverClassName, className), onClick: handleCardClick, children: [renderHeader && renderHeader(product), _jsxs("div", { className: buildClassesByJoining(imageLayoutClass, 'relative'), children: [product.badges && renderBadges && (_jsx("div", { className: "absolute top-2 left-2 z-10 flex flex-wrap gap-1", children: product.badges.map((badge, index) => (_jsx(Badge, { color: badge.color, children: badge.text }, index))) })), showDeleteButton ? (_jsx(DeleteButton, { show: showDeleteButton, onDelete: handleDelete, deleteButtonClassName: deleteButtonClassName, isDeletePending: isDeletePending, size: deleteButtonSize, position: deleteButtonPosition })) : (_jsx(LikeButton, { show: showWishlistButton, enableMultiple: enableMultipleWishlists, isInWishlist: isInWishlist, wishlists: wishlists, productWishlistIds: productWishlistIds, wishlistButtonClassName: wishlistButtonClassName, wishlistDropdownClassName: wishlistDropdownClassName, isWishlistPending: isWishlistPending, handleAddToWishlist: handleAddToWishlist, handleRemoveFromWishlist: handleRemoveFromWishlist, handleCreateNewWishlist: handleCreateNewWishlist, handleWishlistToggle: handleWishlistToggle })), _jsx("img", { alt: product.variation_images[0]?.alt, src: product.variation_images[0]?.href, className: buildClassesByJoining(aspectRatioClass, objectFitClass, objectPositionClass, hoverEffect !== 'none' ? hoverClass : '', roundedClass, 'bg-gray-200', onImageClick ? 'cursor-pointer' : '', imageClassName), onClick: handleImageClick }), addButtonPosition === 'overlay' && (_jsx("div", { className: showAddButtonOnHover === true
170
+ ? 'opacity-0 group-hover:opacity-100 transition-opacity duration-300'
171
+ : '', children: _jsx(AddToCart, { buttonClassName: buttonClassName, addButtonIcon: getButtonIcon(), handleAddToCart: handleAddToCart, showAddButton: shouldShowAddButton(), disabled: disabled, customAddButton: customAddButton }) }))] }), _jsxs("div", { className: buildClassesByJoining('mt-4 h-full flex flex-col justify-between grow', contentLayoutClass, compactClass, contentClassName), children: [_jsxs("div", { className: "flex flex-col h-full justify-between", children: [_jsxs("div", { children: [_jsx(Heading, { level: 3, className: buildClassesByJoining('text-lg text-gray-700', titleLineClampClass, titleClassName), children: _jsxs(Button, { asLink: true, unstyled: true, href: href, children: [!onCardClick && (_jsx("span", { "aria-hidden": "true", className: "absolute inset-0" })), product.product_name] }) }), renderVariationName && product.variation_name && (_jsx(Heading, { className: "text-md", level: 4, children: product.variation_name })), renderDescription && product.description && (_jsx("p", { className: buildClassesByJoining('mt-1 text-sm text-gray-500 line-clamp-2', descriptionClassName), children: parseHTML(product.description) }))] }), _jsxs("div", { className: "flex flex-col justify-between", children: [shouldUseHtml ? (_jsx("div", { className: buildClassesByJoining('text-md font-bold text-gray-900', priceClassName), dangerouslySetInnerHTML: formatPriceForHTML(product.price, locale, priceFormatOptions) })) : (_jsx("p", { className: buildClassesByJoining('text-md font-bold text-gray-900', priceClassName), children: formatPriceString(product.price, locale, priceFormatOptions) })), product?.discountPercent != null &&
172
+ product.discountPercent > 0 &&
173
+ (shouldUseHtml ? (_jsx("div", { className: buildClassesByJoining('text-sm font-normal text-gray-900 line-through', priceClassName), dangerouslySetInnerHTML: formatPriceForHTML(product.price / (1 - product.discountPercent / 100), locale, priceFormatOptions) })) : (_jsx("p", { className: buildClassesByJoining('text-sm font-normal text-gray-900 line-through', priceClassName), children: formatPriceString(product.price / (1 - product.discountPercent / 100), locale, priceFormatOptions) }))), addButtonPosition === 'bottom' && (_jsx("div", { className: buildClassesByJoining('mt-3 flex w-full', getBottomButtonAlignment()), children: shouldShowQuantityControls() ? (
174
+ // Quantity controls
175
+ _jsxs("div", { className: buildClassesByJoining('flex items-center gap-2', controlsClassName), children: [_jsx(Button, { onClick: handleDecrement, className: buildClassesByJoining('w-8 h-8 flex items-center justify-center rounded border', addButtonBottomClassName), disabled: disabled || currentQuantity <= 0, children: "\u2212" }), _jsx("span", { className: buildClassesByJoining('mx-2 font-medium', quantityClassName), children: currentQuantity }), _jsx(Button, { onClick: handleIncrement, className: buildClassesByJoining('w-8 h-8 flex items-center justify-center rounded border', addButtonBottomClassName), disabled: disabled || currentQuantity >= maxQuantity, children: "+" })] })) : shouldShowAddButton() ? (
176
+ // Add button
177
+ customAddButton || (_jsxs(Button, { onClick: handleAddToCart, className: buildClassesByJoining('flex items-center gap-2 px-4 py-2 rounded-md transition-colors', disabled ? 'opacity-50 cursor-not-allowed' : '', addButtonBottomClassName), disabled: disabled, children: [getButtonIcon(), _jsx("span", { children: addButtonText })] }))) : null }))] })] }), actionButton && _jsx("div", { className: "mt-2", children: actionButton }), renderFooter && renderFooter(product)] })] }));
157
178
  };
@@ -2,6 +2,8 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { EnvelopeIcon, PhoneIcon, UserIcon, ChatBubbleLeftIcon, BuildingOffice2Icon, } from "@heroicons/react/24/outline";
5
+ import TextField from "../text-field/TextField";
6
+ import TextArea from "../text-area/TextArea";
5
7
  export default function ContactForm({ title, color = "gray", }) {
6
8
  const [agreed, setAgreed] = useState(false);
7
9
  const colorMap = {
@@ -13,6 +15,8 @@ export default function ContactForm({ title, color = "gray", }) {
13
15
  checkbox: "accent-gray-700",
14
16
  button: "border border-white bg-[#2c2f36] text-white",
15
17
  titleStyle: "text-3xl font-sans uppercase text-center",
18
+ placeholder: "placeholder-gray-400",
19
+ colorMode: "light",
16
20
  },
17
21
  gray: {
18
22
  background: "bg-[#2c2f36]",
@@ -22,8 +26,10 @@ export default function ContactForm({ title, color = "gray", }) {
22
26
  checkbox: "accent-white",
23
27
  button: "border border-white bg-[#2c2f36] text-white",
24
28
  titleStyle: "text-3xl font-sans uppercase text-center",
29
+ placeholder: "placeholder-gray-400",
30
+ colorMode: "dark",
25
31
  },
26
32
  };
27
33
  const styles = colorMap[color] ?? colorMap.gray;
28
- return (_jsxs("form", { className: `${styles.background} ${styles.text} p-6 md:p-10 rounded-md w-[400px] md:w-[500px] mx-auto space-y-6`, children: [title && (_jsxs("h2", { className: styles.titleStyle, children: [title.split(" ").slice(0, -1).join(" "), " ", _jsx("span", { className: "text-[#c26b38]", children: title.split(" ").slice(-1) })] })), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsxs("div", { className: "relative", children: [_jsx(UserIcon, { className: `absolute left-2 top-1/2 transform -translate-y-1/2 h-5 w-5 ${styles.icon}` }), _jsx("input", { type: "text", className: `bg-transparent border-b ${styles.border} focus:outline-none pl-8 py-2 w-full placeholder-gray-400`, placeholder: "Jm\u00E9no", required: true })] }), _jsxs("div", { className: "relative", children: [_jsx(BuildingOffice2Icon, { className: `absolute left-2 top-1/2 transform -translate-y-1/2 h-5 w-5 ${styles.icon}` }), _jsx("input", { type: "text", className: `bg-transparent border-b ${styles.border} focus:outline-none pl-8 py-2 w-full placeholder-gray-400`, placeholder: "Firma" })] }), _jsxs("div", { className: "relative", children: [_jsx(EnvelopeIcon, { className: `absolute left-2 top-1/2 transform -translate-y-1/2 h-5 w-5 ${styles.icon}` }), _jsx("input", { type: "email", className: `bg-transparent border-b ${styles.border} focus:outline-none pl-8 py-2 w-full placeholder-gray-400`, placeholder: "Email", required: true })] }), _jsxs("div", { className: "relative", children: [_jsx(PhoneIcon, { className: `absolute left-2 top-1/2 transform -translate-y-1/2 h-5 w-5 ${styles.icon}` }), _jsx("input", { type: "tel", className: `bg-transparent border-b ${styles.border} focus:outline-none pl-8 py-2 w-full placeholder-gray-400`, placeholder: "Telefon", required: true })] }), _jsxs("div", { className: "md:col-span-2 relative", children: [_jsx(ChatBubbleLeftIcon, { className: `absolute left-2 top-3 h-5 w-5 ${styles.icon}` }), _jsx("textarea", { className: `bg-transparent border-b ${styles.border} focus:outline-none pl-8 py-2 w-full placeholder-gray-400`, placeholder: "Zpr\u00E1va..." })] })] }), _jsxs("div", { className: "flex items-center space-x-3", children: [_jsx("input", { id: "agree", type: "checkbox", checked: agreed, onChange: () => setAgreed(!agreed), className: `bg-transparent border ${styles.border} rounded-sm ${styles.checkbox}` }), _jsx("label", { htmlFor: "agree", className: "text-sm", children: "Souhlas s pou\u017Eit\u00EDm osobn\u00EDch \u00FAdaj\u016F" })] }), _jsx("button", { type: "submit", className: `px-6 py-2 uppercase text-sm ${styles.button}`, children: "ODESLAT" })] }));
34
+ return (_jsxs("form", { className: `${styles.background} ${styles.text} p-6 md:p-10 rounded-md w-[400px] md:w-[500px] mx-auto space-y-6`, children: [title && (_jsxs("h2", { className: styles.titleStyle, children: [title.split(" ").slice(0, -1).join(" "), " ", _jsx("span", { className: "text-[#c26b38]", children: title.split(" ").slice(-1) })] })), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsx(TextField, { type: "text", placeholder: "Jm\u00E9no", required: true, variant: "flat", color: styles.colorMode, leftIcon: _jsx(UserIcon, { className: `h-5 w-5 ${styles.icon}` }), className: `${styles.border} bg-transparent ${styles.placeholder}` }), _jsx(TextField, { type: "text", placeholder: "Firma", variant: "flat", color: styles.colorMode, leftIcon: _jsx(BuildingOffice2Icon, { className: `h-5 w-5 ${styles.icon}` }), className: `${styles.border} bg-transparent ${styles.placeholder}` }), _jsx(TextField, { type: "email", placeholder: "Email", required: true, variant: "flat", color: styles.colorMode, leftIcon: _jsx(EnvelopeIcon, { className: `h-5 w-5 ${styles.icon}` }), className: `${styles.border} bg-transparent ${styles.placeholder}` }), _jsx(TextField, { type: "text", placeholder: "Telefon", required: true, variant: "flat", color: styles.colorMode, leftIcon: _jsx(PhoneIcon, { className: `h-5 w-5 ${styles.icon}` }), className: `${styles.border} bg-transparent ${styles.placeholder}` }), _jsxs("div", { className: "md:col-span-2 relative", children: [_jsx(ChatBubbleLeftIcon, { className: `absolute left-2 top-3 h-5 w-5 ${styles.icon}` }), _jsx(TextArea, { id: "message", placeholder: "Zpr\u00E1va...", variant: "flat", color: styles.colorMode, className: `pl-8 pt-2 w-full ${styles.placeholder}` })] })] }), _jsxs("div", { className: "flex items-center space-x-3", children: [_jsx("input", { id: "agree", type: "checkbox", checked: agreed, onChange: () => setAgreed(!agreed), className: `bg-transparent border ${styles.border} rounded-sm ${styles.checkbox}` }), _jsx("label", { htmlFor: "agree", className: "text-sm", children: "Souhlas s pou\u017Eit\u00EDm osobn\u00EDch \u00FAdaj\u016F" })] }), _jsx("button", { type: "submit", className: `px-6 py-2 uppercase text-sm ${styles.button}`, children: "ODESLAT" })] }));
29
35
  }
@@ -1,8 +1,10 @@
1
- import { TextareaHTMLAttributes } from 'react';
1
+ import { TextareaHTMLAttributes } from "react";
2
2
  export interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
3
3
  label?: string;
4
4
  valid?: boolean;
5
5
  message?: string;
6
+ variant?: "flat" | "rounded";
7
+ color?: "light" | "dark";
6
8
  }
7
- export declare const TextArea: ({ className, label, valid, message, ...props }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const TextArea: ({ className, label, valid, message, variant, color, ...props }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
8
10
  export default TextArea;
@@ -1,7 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const TextArea = ({ className, label, valid = true, message, ...props }) => {
3
- return (_jsxs("div", { className: "flex flex-col gap-1 min-h-[80px]", role: "group", "aria-labelledby": label ? `${props.id}-label` : undefined, children: [label && (_jsx("label", { id: `${props.id}-label`, htmlFor: props.id, className: `text-sm font-medium ${!valid ? 'text-red-500' : 'text-gray-700'}`, children: label })), _jsx("textarea", { "aria-invalid": !valid ? 'true' : 'false', "aria-describedby": message ? `${props.id}-message` : undefined, "aria-required": props.required, className: `block w-full min-h-[200px] rounded-md border p-4 text-gray-900 text-sm lg:text-md shadow-md bg-white focus:ring-1 ${!valid
4
- ? 'border-red-500 focus:ring-red-500 focus:border-red-500'
5
- : 'border-gray-300 focus:ring-primary-500 focus:border-primary-500'} ${className || ''}`, ...props }), message && (_jsx("p", { id: `${props.id}-message`, className: `mt-1.5 text-sm ${!valid ? 'text-red-500' : 'text-gray-500'}`, role: !valid ? 'alert' : 'status', children: message }))] }));
2
+ export const TextArea = ({ className, label, valid = true, message, variant = "rounded", color = "light", ...props }) => {
3
+ const baseClasses = `block w-full text-sm lg:text-md resize-none ${color === "dark" ? "text-white" : "text-gray-900"}`;
4
+ const variantClasses = variant === "flat"
5
+ ? `min-h-[120px] border-b bg-transparent rounded-none focus:rounded-none focus:outline-none focus:ring-0 focus:border-b-2 shadow-none ${valid
6
+ ? "border-gray-400 focus:border-primary-500"
7
+ : "border-red-500 focus:border-red-500"}`
8
+ : `min-h-[200px] rounded-md border p-4 shadow-md bg-white ${valid
9
+ ? "border-gray-300 focus:ring-primary-500 focus:border-primary-500"
10
+ : "border-red-500 focus:ring-red-500 focus:border-red-500"}`;
11
+ const labelColor = !valid
12
+ ? "text-red-500"
13
+ : color === "dark"
14
+ ? "text-white"
15
+ : "text-gray-700";
16
+ const messageColor = !valid ? "text-red-500" : "text-gray-500";
17
+ return (_jsxs("div", { className: "flex flex-col gap-1 min-h-[80px]", role: "group", "aria-labelledby": label ? `${props.id}-label` : undefined, children: [label && (_jsx("label", { id: `${props.id}-label`, htmlFor: props.id, className: `text-sm font-medium ${labelColor}`, children: label })), _jsx("textarea", { "aria-invalid": !valid ? "true" : "false", "aria-describedby": message ? `${props.id}-message` : undefined, "aria-required": props.required, className: `${baseClasses} ${variantClasses} ${className || ""}`, ...props }), message && (_jsx("p", { id: `${props.id}-message`, className: `mt-1.5 text-sm ${messageColor}`, role: !valid ? "alert" : "status", children: message }))] }));
6
18
  };
7
19
  export default TextArea;
@@ -1,5 +1,5 @@
1
- import { MouseEvent } from 'react';
2
- import { TextFieldType } from './TextField.types';
1
+ import { MouseEvent } from "react";
2
+ import { TextFieldType } from "./TextField.types";
3
3
  declare const _default: import("react").ForwardRefExoticComponent<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "children" | "type" | "size"> & {
4
4
  label?: string | import("react").ReactNode;
5
5
  labelColor?: string;
@@ -18,5 +18,7 @@ declare const _default: import("react").ForwardRefExoticComponent<Omit<import("r
18
18
  showPasswordEyeIcon?: boolean;
19
19
  connected?: boolean;
20
20
  connectPosition?: "left" | "right" | "middle" | "none";
21
+ white?: boolean;
22
+ gray?: boolean;
21
23
  } & import("react").RefAttributes<HTMLInputElement>>;
22
24
  export default _default;
@@ -1,80 +1,82 @@
1
- 'use client';
1
+ "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { buildClassesByJoining } from '../../../utils/StyleHelper';
4
- import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline';
5
- import { forwardRef, useCallback, useId, useMemo, useState } from 'react';
6
- const TextField = ({ id: idProp, type: typeProp = 'text', label, labelColor = 'text-gray-700', labelType = 'outside', variant = 'rounded', size = 'md', color = 'primary', background = 'bg-white', autoComplete = 'off', valid = true, message, messageColor = 'text-gray-500', leftIcon, rightIcon, onLeftIconClick, onRightIconClick, showPasswordEyeIcon = true, connected = false, connectPosition = 'none', className, ...props }, ref) => {
3
+ import { EyeIcon, EyeSlashIcon, } from "@heroicons/react/24/outline";
4
+ import { forwardRef, useCallback, useId, useMemo, useState, } from "react";
5
+ import { buildClassesByJoining } from "../../../utils/StyleHelper";
6
+ const TextField = ({ id: idProp, type: typeProp = "text", label, labelColor = "text-gray-700", labelType = "outside", variant = "rounded", size = "md", color = "light", // NEW
7
+ background = "bg-white", autoComplete = "off", valid = true, message, messageColor = "text-gray-500", leftIcon, rightIcon, onLeftIconClick, onRightIconClick, showPasswordEyeIcon = true, connected = false, connectPosition = "none", className, ...props }, ref) => {
7
8
  const id = useId();
8
- const errorColor = 'text-red-500';
9
9
  const [showPassword, setShowPassword] = useState(false);
10
- const type = useMemo(() => (typeProp === 'password' && showPassword ? 'text' : typeProp), [typeProp, showPassword]);
10
+ const type = useMemo(() => (typeProp === "password" && showPassword ? "text" : typeProp), [typeProp, showPassword]);
11
11
  const toggleShowPassword = useCallback((event) => {
12
12
  setShowPassword((prev) => !prev);
13
13
  if (onRightIconClick)
14
14
  onRightIconClick(event);
15
15
  }, [onRightIconClick]);
16
- // Rozšírené variantné triedy pre spojené polia
17
16
  const variantClasses = {
18
- normal: 'border',
19
- rounded: 'border rounded-md',
20
- flat: 'border-b focus-within:border-b-2 focus-within:ring-0 shadow-none',
17
+ normal: "border",
18
+ rounded: "border rounded-md",
19
+ flat: "border-b focus-within:border-b-2 focus-within:ring-0 shadow-none",
21
20
  };
22
- // Upravené variantné triedy pre spojené polia
23
21
  const connectedVariantClasses = useMemo(() => {
24
22
  if (!connected)
25
23
  return variantClasses[variant];
26
- if (variant === 'rounded') {
27
- if (connectPosition === 'left')
28
- return 'border rounded-r-md rounded-l-none border-l-0';
29
- if (connectPosition === 'right')
30
- return 'border rounded-l-md rounded-r-none border-r-0';
31
- if (connectPosition === 'middle')
32
- return 'border border-l-0 border-r-0 rounded-none';
24
+ if (variant === "rounded") {
25
+ if (connectPosition === "left")
26
+ return "border rounded-r-md rounded-l-none border-l-0";
27
+ if (connectPosition === "right")
28
+ return "border rounded-l-md rounded-r-none border-r-0";
29
+ if (connectPosition === "middle")
30
+ return "border border-l-0 border-r-0 rounded-none";
33
31
  }
34
- if (connectPosition === 'left')
35
- return 'border border-l-0';
36
- if (connectPosition === 'right')
37
- return 'border border-r-0';
38
- if (connectPosition === 'middle')
39
- return 'border border-l-0 border-r-0';
32
+ if (connectPosition === "left")
33
+ return "border border-l-0";
34
+ if (connectPosition === "right")
35
+ return "border border-r-0";
36
+ if (connectPosition === "middle")
37
+ return "border border-l-0 border-r-0";
40
38
  return variantClasses[variant];
41
39
  }, [connected, connectPosition, variant]);
42
40
  const sizeClasses = {
43
- sm: 'py-0.5 px-3',
44
- md: 'py-2 px-3',
41
+ sm: "py-0.5 px-3",
42
+ md: "py-2 px-3",
45
43
  };
46
44
  const labelTypeClasses = {
47
- outside: 'block text-sm font-medium',
48
- inside: 'block text-xs font-medium text-gray-900',
49
- overlapping: 'absolute -top-2 left-2 -mt-px inline-block px-1 bg-white text-xs font-medium text-gray-900',
50
- hidden: 'sr-only',
51
- };
52
- const containerClasses = buildClassesByJoining('relative border-gray-300 shadow-sm focus-within:ring-1', !valid
53
- ? 'border-red-500 focus-within:ring-red-500'
54
- : `focus-within:ring-${color}-500 focus-within:border-${color}-500`, connected ? connectedVariantClasses : variantClasses[variant], sizeClasses[size], background, labelType === 'outside' && 'mt-1', className);
55
- const renderLeftIcon = () => {
56
- if (!leftIcon)
57
- return null;
58
- return (_jsx("span", { className: buildClassesByJoining('absolute inset-y-0 left-0 pl-3 flex items-center', labelType === 'inside' && 'mt-4'), onClick: onLeftIconClick ? onLeftIconClick : undefined, children: leftIcon }));
45
+ outside: "block text-sm font-medium",
46
+ inside: "block text-xs font-medium text-gray-900",
47
+ overlapping: "absolute -top-2 left-2 -mt-px inline-block px-1 bg-white text-xs font-medium text-gray-900",
48
+ hidden: "sr-only",
59
49
  };
50
+ const containerClasses = buildClassesByJoining("relative border-gray-300 shadow-sm focus-within:ring-1", !valid
51
+ ? "border-red-500 focus-within:ring-red-500"
52
+ : `focus-within:ring-primary-500 focus-within:border-primary-500`, connected ? connectedVariantClasses : variantClasses[variant], sizeClasses[size], background, labelType === "outside" && "mt-1", className);
53
+ const errorColor = "text-red-500";
54
+ const textColor = color === "dark" ? "text-white" : "text-gray-900";
55
+ const labelTextColor = !valid
56
+ ? errorColor
57
+ : color === "dark"
58
+ ? "text-white"
59
+ : labelColor;
60
+ const effectiveMessageColor = !valid
61
+ ? errorColor
62
+ : color === "dark"
63
+ ? "text-gray-400"
64
+ : messageColor;
65
+ const renderLeftIcon = () => leftIcon ? (_jsx("span", { className: buildClassesByJoining("absolute inset-y-0 left-0 pl-3 flex items-center", labelType === "inside" && "mt-4"), onClick: onLeftIconClick, children: leftIcon })) : null;
60
66
  const renderRightIcon = () => {
61
- if (!rightIcon && !(typeProp === 'password' && showPasswordEyeIcon))
67
+ if (!rightIcon && !(typeProp === "password" && showPasswordEyeIcon))
62
68
  return null;
63
69
  let icon = rightIcon;
64
- if (typeProp === 'password' && showPasswordEyeIcon) {
70
+ if (typeProp === "password" && showPasswordEyeIcon) {
65
71
  const IconComponent = showPassword ? EyeIcon : EyeSlashIcon;
66
- icon = (_jsx(IconComponent, { className: buildClassesByJoining('h-5 w-5', !valid ? 'text-red-500' : 'text-gray-400') }));
72
+ icon = (_jsx(IconComponent, { className: buildClassesByJoining("h-5 w-5", !valid ? "text-red-500" : "text-gray-400") }));
67
73
  }
68
74
  return (_jsx("span", { className: "absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer", onClick: toggleShowPassword, children: icon }));
69
75
  };
70
- const renderLabel = () => {
71
- if (!label)
72
- return null;
73
- return (_jsx("label", { htmlFor: id, className: buildClassesByJoining(labelTypeClasses[labelType], !valid ? errorColor : labelColor), children: label }));
74
- };
75
- return (_jsxs("div", { className: "min-h-[80px]", children: [labelType === 'outside' && renderLabel(), _jsxs("div", { className: containerClasses, children: [(labelType === 'overlapping' ||
76
- labelType === 'inside' ||
77
- labelType === 'hidden') &&
78
- renderLabel(), renderLeftIcon(), renderRightIcon(), _jsx("input", { ...props, ref: ref, id: id, autoComplete: autoComplete, type: type, className: buildClassesByJoining('block w-full border-0 p-0 text-gray-900 placeholder-gray-500 focus:ring-0 sm:text-sm bg-transparent outline-none', !!leftIcon && 'pl-6', !!rightIcon && 'pr-6') })] }), message && (_jsx("p", { className: buildClassesByJoining('mt-1.5 text-sm', !valid ? errorColor : messageColor), children: message }))] }));
76
+ const renderLabel = () => label ? (_jsx("label", { htmlFor: id, className: buildClassesByJoining(labelTypeClasses[labelType], labelTextColor), children: label })) : null;
77
+ return (_jsxs("div", { className: "min-h-[80px]", children: [labelType === "outside" && renderLabel(), _jsxs("div", { className: containerClasses, children: [(labelType === "overlapping" ||
78
+ labelType === "inside" ||
79
+ labelType === "hidden") &&
80
+ renderLabel(), renderLeftIcon(), renderRightIcon(), _jsx("input", { ...props, ref: ref, id: id, autoComplete: autoComplete, type: type, className: buildClassesByJoining("block w-full border-0 p-0 placeholder-gray-500 focus:ring-0 sm:text-sm bg-transparent outline-none", !!leftIcon && "pl-6", !!rightIcon && "pr-6", textColor) })] }), message && (_jsx("p", { className: buildClassesByJoining("mt-1.5 text-sm", effectiveMessageColor), children: message }))] }));
79
81
  };
80
82
  export default forwardRef(TextField);
@@ -21,4 +21,6 @@ export type TextFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'childr
21
21
  showPasswordEyeIcon?: boolean;
22
22
  connected?: boolean;
23
23
  connectPosition?: 'left' | 'right' | 'middle' | 'none';
24
+ white?: boolean;
25
+ gray?: boolean;
24
26
  };
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
1
  import { BannerItem } from '@q2devel/q2-core';
2
+ import { ReactNode } from 'react';
3
3
  export type ControlsType = 'arrows' | 'dots' | 'both' | 'none';
4
4
  export type BannerProps = {
5
5
  items: BannerItem[];
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ type DynamicLayoutProps = {
3
+ x: number;
4
+ y: number;
5
+ gap?: number;
6
+ };
7
+ export declare const DynamicLayout: React.FC<DynamicLayoutProps>;
8
+ export {};