@q2devel/q2-storybook 1.0.39 → 1.0.41

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 (86) hide show
  1. package/dist/components/Base/badge/Badge.d.ts +11 -0
  2. package/dist/components/Base/badge/Badge.js +4 -0
  3. package/dist/components/Base/button/AddToCart.d.ts +10 -0
  4. package/dist/components/Base/button/AddToCart.js +7 -0
  5. package/dist/components/Base/button/Button.d.ts +18 -0
  6. package/dist/components/Base/button/Button.js +38 -0
  7. package/dist/components/Base/heading/Heading.d.ts +9 -0
  8. package/dist/components/Base/heading/Heading.js +16 -0
  9. package/dist/components/Base/modal/Modal.d.ts +18 -0
  10. package/dist/components/Base/modal/Modal.js +12 -0
  11. package/dist/components/Base/spinner/Spinner.d.ts +10 -0
  12. package/dist/components/Base/spinner/Spinner.js +12 -0
  13. package/dist/components/Base/tooltip/Tooltip.d.ts +18 -0
  14. package/dist/components/Base/tooltip/Tooltip.js +18 -0
  15. package/dist/components/Ecommerce/basket-dialog/BasketDialog.d.ts +55 -0
  16. package/dist/components/Ecommerce/basket-dialog/BasketDialog.js +101 -0
  17. package/dist/components/Ecommerce/category-tree/CategoryTree.d.ts +14 -0
  18. package/dist/components/Ecommerce/category-tree/CategoryTree.js +55 -0
  19. package/dist/components/Ecommerce/product-card/ProductCard.d.ts +66 -0
  20. package/dist/components/Ecommerce/product-card/ProductCard.js +156 -0
  21. package/dist/components/Ecommerce/progress-stepper/ProgressStepper.d.ts +26 -0
  22. package/dist/components/Ecommerce/progress-stepper/ProgressStepper.js +44 -0
  23. package/dist/components/Ecommerce/wishlist/DeleteButton.d.ts +10 -0
  24. package/dist/components/Ecommerce/wishlist/DeleteButton.js +30 -0
  25. package/dist/components/Ecommerce/wishlist/LikeButton.d.ts +21 -0
  26. package/dist/components/Ecommerce/wishlist/LikeButton.js +41 -0
  27. package/dist/components/Ecommerce/wishlist/WishlistDropdown.d.ts +18 -0
  28. package/dist/components/Ecommerce/wishlist/WishlistDropdown.js +49 -0
  29. package/dist/components/Forms/dropdown/Dropdown.d.ts +11 -0
  30. package/dist/components/Forms/dropdown/Dropdown.js +12 -0
  31. package/dist/components/Forms/select-field/SelectField.d.ts +29 -0
  32. package/dist/components/Forms/select-field/SelectField.js +142 -0
  33. package/dist/components/Forms/select-field/SelectFieldOption.d.ts +4 -0
  34. package/dist/components/Forms/select-field/SelectFieldOption.js +7 -0
  35. package/dist/components/Forms/text-area/TextArea.d.ts +8 -0
  36. package/dist/components/Forms/text-area/TextArea.js +7 -0
  37. package/dist/components/Forms/text-field/TextField.d.ts +22 -0
  38. package/dist/components/Forms/text-field/TextField.js +80 -0
  39. package/dist/components/Forms/text-field/TextField.types.d.ts +24 -0
  40. package/dist/components/Forms/text-field/TextField.types.js +1 -0
  41. package/dist/components/Web/banner/Banner.d.ts +37 -0
  42. package/dist/components/Web/banner/Banner.js +126 -0
  43. package/dist/components/Web/breadcrumb/Breadcrumb.d.ts +17 -0
  44. package/dist/components/Web/breadcrumb/Breadcrumb.js +13 -0
  45. package/dist/components/Web/faq/FaqSection.d.ts +11 -0
  46. package/dist/components/Web/faq/FaqSection.js +18 -0
  47. package/dist/components/Web/nav-bar/NavBar.d.ts +19 -0
  48. package/dist/components/Web/nav-bar/NavBar.js +17 -0
  49. package/dist/components/Web/stats-card/StatsCard.d.ts +12 -0
  50. package/dist/components/Web/stats-card/StatsCard.js +9 -0
  51. package/dist/components/Web/tabs/HorizontalTab.d.ts +8 -0
  52. package/dist/components/Web/tabs/HorizontalTab.js +11 -0
  53. package/dist/components/Web/text-with-image/ImageWithText.d.ts +14 -0
  54. package/dist/components/Web/text-with-image/ImageWithText.js +7 -0
  55. package/dist/components/banner/Banner.d.ts +3 -14
  56. package/dist/components/banner/Banner.js +7 -3
  57. package/dist/components/breadcrumb/Breadcrumb.d.ts +17 -0
  58. package/dist/components/breadcrumb/Breadcrumb.js +13 -0
  59. package/dist/components/button/AddToCart.d.ts +10 -0
  60. package/dist/components/button/AddToCart.js +7 -0
  61. package/dist/components/button/Button.d.ts +11 -2
  62. package/dist/components/button/Button.js +35 -2
  63. package/dist/components/category-tree/CategoryTree.d.ts +14 -0
  64. package/dist/components/category-tree/CategoryTree.js +55 -0
  65. package/dist/components/like-button/DeleteButton.d.ts +10 -0
  66. package/dist/components/like-button/DeleteButton.js +30 -0
  67. package/dist/components/like-button/LikeButton.d.ts +21 -0
  68. package/dist/components/like-button/LikeButton.js +41 -0
  69. package/dist/components/like-button/WishlistDropdown.d.ts +18 -0
  70. package/dist/components/like-button/WishlistDropdown.js +49 -0
  71. package/dist/components/product-card/ProductCard.d.ts +30 -25
  72. package/dist/components/product-card/ProductCard.js +88 -42
  73. package/dist/components/select-field/SelectField.d.ts +2 -0
  74. package/dist/components/select-field/SelectField.js +51 -31
  75. package/dist/components/spinner/Spinner.d.ts +10 -0
  76. package/dist/components/spinner/Spinner.js +12 -0
  77. package/dist/components/tabs/HorizontalTab.d.ts +8 -0
  78. package/dist/components/tabs/HorizontalTab.js +11 -0
  79. package/dist/i18n/navigation.d.ts +6 -0
  80. package/dist/i18n/navigation.js +6 -0
  81. package/dist/index.d.ts +22 -9
  82. package/dist/index.js +22 -9
  83. package/dist/style.css +1 -1
  84. package/dist/utils/generalHelperFunction.d.ts +7 -0
  85. package/dist/utils/generalHelperFunction.js +47 -0
  86. package/package.json +4 -3
@@ -0,0 +1,156 @@
1
+ 'use client';
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
+ import { ShoppingBagIcon } from '@heroicons/react/24/solid';
6
+ import { useCallback, useRef, useState } from 'react';
7
+ import AddToCart from '../../Base/button/AddToCart';
8
+ import Heading from '../../Base/heading/Heading';
9
+ import Button from '../../Base/button/Button';
10
+ import Spinner from '../../Base/spinner/Spinner';
11
+ import Badge from '../../Base/badge/Badge';
12
+ import LikeButton from '../wishlist/LikeButton';
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, actionButton,
15
+ // Add to cart functionality
16
+ showAddButton = false, 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
+ // Wishlist functionality
18
+ showWishlistButton = false, isInWishlist = false, onWishlistToggle, wishlistButtonClassName = '', isWishlistPending = false,
19
+ // Multiple wishlists support
20
+ enableMultipleWishlists = false, wishlists = [], onAddToWishlist, onRemoveFromWishlist, onCreateWishlist, wishlistDropdownClassName = '', productWishlistIds = [],
21
+ // Delete functionality
22
+ showDeleteButton = false, onDelete, deleteButtonClassName = '', isDeletePending = false, deleteButtonSize = 'md', deleteButtonPosition = 'top-right', }) => {
23
+ const [showWishlistDropdown, setShowWishlistDropdown] = useState(false);
24
+ const [showNewWishlistInput, setShowNewWishlistInput] = useState(false);
25
+ const [newWishlistName, setNewWishlistName] = useState('');
26
+ const inputRef = useRef(null);
27
+ const showQuantityControls = currentQuantity > 0 || (disabled && currentQuantity === 0);
28
+ const shouldShowQuantityControls = () => {
29
+ if (cartMode === 'add-only') {
30
+ return false;
31
+ }
32
+ return currentQuantity > 0 || (disabled && currentQuantity === 0);
33
+ };
34
+ const shouldShowAddButton = () => {
35
+ if (cartMode === 'add-only') {
36
+ return true;
37
+ }
38
+ return showAddButton;
39
+ };
40
+ // Determine which icon to show
41
+ const getButtonIcon = () => {
42
+ if (cartMode === 'add-only' && disabled && showSpinnerInAdd) {
43
+ return _jsx(Spinner, { className: "h-4 w-4" });
44
+ }
45
+ return addButtonIcon;
46
+ };
47
+ // Create aspect ratio class
48
+ const aspectRatioClass = {
49
+ square: 'aspect-square',
50
+ auto: 'aspect-auto',
51
+ video: 'aspect-video',
52
+ wide: 'aspect-[16/9]',
53
+ }[aspectRatio];
54
+ // Create object-fit class
55
+ const objectFitClass = {
56
+ cover: 'object-cover',
57
+ contain: 'object-contain',
58
+ fill: 'object-fill',
59
+ none: 'object-none',
60
+ }[imageObjectFit];
61
+ // Create object-position class
62
+ const objectPositionClass = {
63
+ top: 'object-top',
64
+ center: 'object-center',
65
+ bottom: 'object-bottom',
66
+ }[imagePosition];
67
+ // Create hover effect class
68
+ const hoverClass = {
69
+ opacity: 'group-hover:opacity-75',
70
+ scale: 'transform transition-transform group-hover:scale-105',
71
+ shadow: 'transition-shadow group-hover:shadow-lg',
72
+ border: 'border border-transparent group-hover:border-primary-500',
73
+ none: '',
74
+ }[hoverEffect];
75
+ // Create shadow elevation class
76
+ const elevationClass = {
77
+ 0: '',
78
+ 1: 'shadow-sm',
79
+ 2: 'shadow',
80
+ 3: 'shadow-md',
81
+ }[elevationLevel];
82
+ // Create rounded class
83
+ const roundedClass = {
84
+ none: 'rounded-none',
85
+ sm: 'rounded-sm',
86
+ md: 'rounded-md',
87
+ lg: 'rounded-lg',
88
+ full: 'rounded-full',
89
+ }[rounded];
90
+ // Create title line clamp class
91
+ const titleLineClampClass = {
92
+ 1: 'line-clamp-1',
93
+ 2: 'line-clamp-2',
94
+ 3: 'line-clamp-3',
95
+ }[titleLines];
96
+ // Create layout class
97
+ const layoutClass = layout === 'horizontal' ? 'flex gap-4' : '';
98
+ const imageLayoutClass = layout === 'horizontal' ? 'w-1/3' : 'w-full';
99
+ const contentLayoutClass = layout === 'horizontal' ? 'w-2/3' : 'w-full';
100
+ const compactClass = layout === 'compact' ? 'space-y-1' : 'space-y-2';
101
+ const handleCardClick = useCallback(() => {
102
+ onCardClick && onCardClick(product);
103
+ }, [onCardClick, product]);
104
+ const handleImageClick = useCallback((e) => {
105
+ if (onImageClick) {
106
+ e.stopPropagation();
107
+ onImageClick(product);
108
+ }
109
+ }, [onImageClick, product]);
110
+ const handleAddToCart = useCallback(() => {
111
+ onQuantityChange && onQuantityChange(product, 1);
112
+ }, [onQuantityChange, product]);
113
+ const handleIncrement = useCallback(() => {
114
+ const newQuantity = Math.min(currentQuantity + 1, maxQuantity);
115
+ onQuantityChange && onQuantityChange(product, newQuantity);
116
+ }, [currentQuantity, maxQuantity, onQuantityChange, product]);
117
+ const handleDecrement = useCallback(() => {
118
+ const newQuantity = Math.max(currentQuantity - 1, 0);
119
+ onQuantityChange && onQuantityChange(product, newQuantity);
120
+ }, [currentQuantity, onQuantityChange, product]);
121
+ const handleAddToWishlist = useCallback((wishlistId) => (e) => {
122
+ e.stopPropagation();
123
+ if (!isWishlistPending) {
124
+ onAddToWishlist && onAddToWishlist(product, wishlistId);
125
+ setShowWishlistDropdown(false);
126
+ }
127
+ }, [onAddToWishlist, product, isWishlistPending]);
128
+ const handleRemoveFromWishlist = useCallback((wishlistId) => (e) => {
129
+ e.stopPropagation();
130
+ if (!isWishlistPending) {
131
+ onRemoveFromWishlist && onRemoveFromWishlist(product, wishlistId);
132
+ setShowWishlistDropdown(false);
133
+ }
134
+ }, [onRemoveFromWishlist, product, isWishlistPending]);
135
+ const handleCreateNewWishlist = useCallback((e) => {
136
+ e.stopPropagation();
137
+ e.preventDefault();
138
+ if (newWishlistName.trim() && onCreateWishlist) {
139
+ onCreateWishlist(newWishlistName.trim(), product);
140
+ setNewWishlistName('');
141
+ setShowNewWishlistInput(false);
142
+ setShowWishlistDropdown(false);
143
+ }
144
+ }, [newWishlistName, onCreateWishlist, product]);
145
+ const handleWishlistToggle = useCallback(() => {
146
+ if (onWishlistToggle) {
147
+ onWishlistToggle(product);
148
+ }
149
+ }, [onWishlistToggle, product]);
150
+ const handleDelete = useCallback(() => {
151
+ if (onDelete) {
152
+ onDelete(product);
153
+ }
154
+ }, [onDelete, product]);
155
+ return (_jsxs("div", { className: buildClassesByJoining('group relative', layoutClass, elevationClass, onCardClick ? 'cursor-pointer' : '', 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.images[0]?.alt, src: product.images[0]?.href, className: buildClassesByJoining(aspectRatioClass, objectFitClass, objectPositionClass, hoverEffect !== 'none' ? hoverClass : '', roundedClass, 'bg-gray-200', onImageClick ? 'cursor-pointer' : '', imageClassName), onClick: handleImageClick }), _jsx("div", { children: _jsx(AddToCart, { addButtonIcon: _jsx(ShoppingBagIcon, { className: "h-4 w-4" }), handleAddToCart: handleAddToCart, showAddButton: true, disabled: disabled }) })] }), _jsxs("div", { className: buildClassesByJoining('mt-4', contentLayoutClass, compactClass, contentClassName), children: [_jsxs("div", { className: "flex justify-between gap-3", children: [_jsxs("div", { children: [_jsx(Heading, { level: 3, className: buildClassesByJoining('text-sm 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.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-sm font-medium 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 && formatPrice(product.price / (1 - product.discountPercent / 100), locale) })] })] }), actionButton && _jsx("div", { className: "mt-2", children: actionButton }), renderFooter && renderFooter(product)] })] }));
156
+ };
@@ -0,0 +1,26 @@
1
+ import { ReactNode } from 'react';
2
+ export type StepStatus = 'complete' | 'current' | 'upcoming';
3
+ export interface Step {
4
+ id: string;
5
+ name: string;
6
+ href?: string;
7
+ status: StepStatus;
8
+ onClick?: () => void;
9
+ customIcon?: ReactNode;
10
+ }
11
+ export interface ProgressStepperProps {
12
+ steps: Step[];
13
+ className?: string;
14
+ orientation?: 'horizontal' | 'vertical';
15
+ showArrows?: boolean;
16
+ clickable?: boolean;
17
+ completeColor?: string;
18
+ currentColor?: string;
19
+ upcomingColor?: string;
20
+ completeIconClassName?: string;
21
+ currentIconClassName?: string;
22
+ upcomingIconClassName?: string;
23
+ showStepNumbers?: boolean;
24
+ renderCustomStep?: (step: Step, index: number, totalSteps: number) => ReactNode;
25
+ }
26
+ export declare const ProgressStepper: ({ steps, className, orientation, showArrows, clickable, completeColor, currentColor, upcomingColor, completeIconClassName, currentIconClassName, upcomingIconClassName, showStepNumbers, renderCustomStep, }: ProgressStepperProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { buildClassesByJoining } from '../../../utils/StyleHelper';
3
+ import { CheckIcon } from '@heroicons/react/24/solid';
4
+ import Button from '../../Base/button/Button';
5
+ export const ProgressStepper = ({ steps = [], className, orientation = 'horizontal', showArrows = true, clickable = true, completeColor = 'bg-green-600 hover:bg-green-800', currentColor = 'border-green-600 text-green-600', upcomingColor = 'border-gray-300 text-gray-500 group-hover:border-gray-400 group-hover:text-gray-900', completeIconClassName, currentIconClassName, upcomingIconClassName, showStepNumbers = true, renderCustomStep, }) => {
6
+ const renderStepContent = (step, stepIdx) => {
7
+ if (renderCustomStep) {
8
+ return renderCustomStep(step, stepIdx, steps.length);
9
+ }
10
+ const stepClicked = (e) => {
11
+ if (!clickable || !step.onClick)
12
+ return;
13
+ e.preventDefault();
14
+ step.onClick();
15
+ };
16
+ if (step.status === 'complete') {
17
+ if (step.href && clickable) {
18
+ return (_jsx(Button, { unstyled: true, href: step.href, onClick: stepClicked, className: buildClassesByJoining('group flex w-full items-center', !clickable && 'cursor-default'), children: _jsxs("span", { className: "flex items-center px-6 py-4 text-sm font-medium", children: [_jsx("span", { className: buildClassesByJoining('flex size-10 shrink-0 items-center justify-center rounded-full', completeColor, completeIconClassName), children: step.customIcon || (_jsx(CheckIcon, { "aria-hidden": "true", className: "size-6 text-white" })) }), _jsx("span", { className: "ml-4 text-sm font-medium text-gray-900", children: step.name })] }) }));
19
+ }
20
+ return (_jsx("div", { onClick: stepClicked, className: buildClassesByJoining('group flex w-full items-center', !clickable && 'cursor-default'), children: _jsxs("span", { className: "flex items-center px-6 py-4 text-sm font-medium", children: [_jsx("span", { className: buildClassesByJoining('flex size-10 shrink-0 items-center justify-center rounded-full', completeColor, completeIconClassName), children: step.customIcon || (_jsx(CheckIcon, { "aria-hidden": "true", className: "size-6 text-white" })) }), _jsx("span", { className: "ml-4 text-sm font-medium text-gray-900", children: step.name })] }) }));
21
+ }
22
+ if (step.status === 'current') {
23
+ if (step.href && clickable) {
24
+ return (_jsx(Button, { href: step.href, "aria-current": "step", onClick: stepClicked, className: buildClassesByJoining('group flex items-center text-sm font-medium', !clickable && 'cursor-default'), children: _jsxs("span", { className: "flex items-center px-6 py-4 text-sm font-medium", children: [_jsx("span", { className: buildClassesByJoining('flex size-10 shrink-0 items-center justify-center rounded-full border-2', currentColor, currentIconClassName), children: step.customIcon || (showStepNumbers && _jsx("span", { children: step.id })) }), _jsx("span", { className: "ml-4 text-sm font-medium text-green-600", children: step.name })] }) }));
25
+ }
26
+ return (_jsx("div", { "aria-current": "step", onClick: stepClicked, className: buildClassesByJoining('group flex items-center text-sm font-medium', !clickable && 'cursor-default'), children: _jsxs("span", { className: "flex items-center px-6 py-4 text-sm font-medium", children: [_jsx("span", { className: buildClassesByJoining('flex size-10 shrink-0 items-center justify-center rounded-full border-2', currentColor, currentIconClassName), children: step.customIcon || (showStepNumbers && _jsx("span", { children: step.id })) }), _jsx("span", { className: "ml-4 text-sm font-medium text-green-600", children: step.name })] }) }));
27
+ }
28
+ if (step.href && clickable) {
29
+ return (_jsx(Button, { href: step.href, onClick: stepClicked, className: buildClassesByJoining('group flex items-center', !clickable && 'cursor-default'), children: _jsxs("span", { className: "flex items-center px-6 py-4 text-sm font-medium", children: [_jsx("span", { className: buildClassesByJoining('flex size-10 shrink-0 items-center justify-center rounded-full border-2', upcomingColor, upcomingIconClassName), children: step.customIcon || (showStepNumbers && _jsx("span", { children: step.id })) }), _jsx("span", { className: "ml-4 text-sm font-medium text-gray-500 group-hover:text-gray-900", children: step.name })] }) }));
30
+ }
31
+ return (_jsx("div", { onClick: stepClicked, className: buildClassesByJoining('group flex items-center', !clickable && 'cursor-default'), children: _jsxs("span", { className: "flex items-center px-6 py-4 text-sm font-medium", children: [_jsx("span", { className: buildClassesByJoining('flex size-10 shrink-0 items-center justify-center rounded-full border-2', upcomingColor, upcomingIconClassName), children: step.customIcon || (showStepNumbers && _jsx("span", { children: step.id })) }), _jsx("span", { className: "ml-4 text-sm font-medium text-gray-500 group-hover:text-gray-900", children: step.name })] }) }));
32
+ };
33
+ const renderArrow = (stepIdx) => {
34
+ if (!showArrows || stepIdx === steps.length - 1)
35
+ return null;
36
+ if (orientation === 'horizontal') {
37
+ return (_jsx("div", { "aria-hidden": "true", className: "absolute top-0 right-0 hidden h-full w-5 md:block", children: _jsx("svg", { fill: "none", viewBox: "0 0 22 80", preserveAspectRatio: "none", className: "size-full text-gray-300", children: _jsx("path", { d: "M0 -2L20 40L0 82", stroke: "currentcolor", vectorEffect: "non-scaling-stroke", strokeLinejoin: "round" }) }) }));
38
+ }
39
+ // Vertical arrow (optional implementation)
40
+ return null;
41
+ };
42
+ const containerClasses = buildClassesByJoining(orientation === 'horizontal' ? 'md:flex md:divide-y-0' : 'flex-col', 'divide-y divide-gray-300 rounded-md border border-gray-300', className);
43
+ return (_jsx("nav", { "aria-label": "Progress", children: _jsx("ol", { role: "list", className: containerClasses, children: steps.map((step, stepIdx) => (_jsxs("li", { className: buildClassesByJoining('relative', orientation === 'horizontal' ? 'md:flex md:flex-1' : ''), children: [renderStepContent(step, stepIdx), renderArrow(stepIdx)] }, `${step.id}-${stepIdx}`))) }) }));
44
+ };
@@ -0,0 +1,10 @@
1
+ export interface DeleteButtonProps {
2
+ show: boolean;
3
+ onDelete: () => void;
4
+ deleteButtonClassName?: string;
5
+ isDeletePending?: boolean;
6
+ size?: 'sm' | 'md' | 'lg';
7
+ position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
8
+ }
9
+ export declare const DeleteButton: ({ show, onDelete, deleteButtonClassName, isDeletePending, size, position, }: DeleteButtonProps) => import("react/jsx-runtime").JSX.Element | null;
10
+ export default DeleteButton;
@@ -0,0 +1,30 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import buildClassesByJoining from '../../../utils/StyleHelper';
4
+ import { TrashIcon } from '@heroicons/react/24/outline';
5
+ export const DeleteButton = ({ show, onDelete, deleteButtonClassName = '', isDeletePending = false, size = 'md', position = 'top-right', }) => {
6
+ if (!show)
7
+ return null;
8
+ const sizeClasses = {
9
+ sm: 'p-1.5',
10
+ md: 'p-2',
11
+ lg: 'p-2.5',
12
+ }[size];
13
+ const iconSizeClasses = {
14
+ sm: 'h-4 w-4',
15
+ md: 'h-5 w-5',
16
+ lg: 'h-6 w-6',
17
+ }[size];
18
+ const positionClasses = {
19
+ 'top-right': 'top-2 right-2',
20
+ 'top-left': 'top-2 left-2',
21
+ 'bottom-right': 'bottom-2 right-2',
22
+ 'bottom-left': 'bottom-2 left-2',
23
+ }[position];
24
+ return (_jsx("div", { className: `absolute ${positionClasses} z-10`, children: _jsx("button", { onClick: (e) => {
25
+ e.stopPropagation();
26
+ if (!isDeletePending)
27
+ onDelete();
28
+ }, disabled: isDeletePending, className: buildClassesByJoining(sizeClasses, 'flex items-center justify-center rounded-full bg-white shadow-md hover:bg-gray-100 transition-colors duration-200', isDeletePending ? 'opacity-50 cursor-not-allowed' : 'hover:shadow-lg', deleteButtonClassName), "aria-label": "Delete", children: _jsx(TrashIcon, { className: buildClassesByJoining(iconSizeClasses, 'text-red-500') }) }) }));
29
+ };
30
+ export default DeleteButton;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export interface Wishlist {
3
+ id: string;
4
+ name: string;
5
+ }
6
+ export interface LikeButtonProps {
7
+ show?: boolean;
8
+ enableMultiple?: boolean;
9
+ isInWishlist?: boolean;
10
+ wishlists: Wishlist[];
11
+ productWishlistIds: string[];
12
+ wishlistButtonClassName?: string;
13
+ wishlistDropdownClassName?: string;
14
+ isWishlistPending?: boolean;
15
+ handleAddToWishlist: (id: string) => (e: React.MouseEvent) => void;
16
+ handleRemoveFromWishlist: (id: string) => (e: React.MouseEvent) => void;
17
+ handleCreateNewWishlist: (e: React.FormEvent) => void;
18
+ handleWishlistToggle?: () => void;
19
+ }
20
+ export declare const LikeButton: ({ show, enableMultiple, isInWishlist, wishlists, productWishlistIds, wishlistButtonClassName, wishlistDropdownClassName, isWishlistPending, handleAddToWishlist, handleRemoveFromWishlist, handleCreateNewWishlist, handleWishlistToggle, }: LikeButtonProps) => import("react/jsx-runtime").JSX.Element | null;
21
+ export default LikeButton;
@@ -0,0 +1,41 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import buildClassesByJoining from '../../../utils/StyleHelper';
4
+ import { ChevronDownIcon } from '@heroicons/react/24/outline';
5
+ import { HeartIcon as HeartIconOutline, HeartIcon as HeartIconSolid, } from '@heroicons/react/24/solid';
6
+ import { useState } from 'react';
7
+ import { WishlistDropdown } from './WishlistDropdown';
8
+ export const LikeButton = ({ show = true, enableMultiple = false, isInWishlist = false, wishlists, productWishlistIds, wishlistButtonClassName, wishlistDropdownClassName, isWishlistPending = false, handleAddToWishlist, handleRemoveFromWishlist, handleCreateNewWishlist, handleWishlistToggle, }) => {
9
+ const [showDropdown, setShowDropdown] = useState(false);
10
+ const handleDropdownToggle = () => setShowDropdown(prev => !prev);
11
+ const handleAddToWishlistWrapper = (wishlistId) => {
12
+ const mouseEvent = new MouseEvent('click');
13
+ handleAddToWishlist(wishlistId)(mouseEvent);
14
+ setShowDropdown(false);
15
+ };
16
+ const handleRemoveFromWishlistWrapper = (wishlistId) => {
17
+ const mouseEvent = new MouseEvent('click');
18
+ handleRemoveFromWishlist(wishlistId)(mouseEvent);
19
+ setShowDropdown(false);
20
+ };
21
+ const handleCreateNewWishlistWrapper = (name) => {
22
+ const form = document.createElement('form');
23
+ const input = document.createElement('input');
24
+ input.name = 'wishlistName';
25
+ input.value = name;
26
+ form.appendChild(input);
27
+ const formEvent = new Event('submit');
28
+ formEvent.target = form;
29
+ formEvent.preventDefault = () => { };
30
+ formEvent.stopPropagation = () => { };
31
+ handleCreateNewWishlist(formEvent);
32
+ setShowDropdown(false);
33
+ };
34
+ if (!show)
35
+ return null;
36
+ return (_jsx("div", { className: "absolute top-2 right-2 z-30", onClick: e => e.stopPropagation(), children: enableMultiple ? (_jsxs("div", { className: "relative", children: [_jsxs("button", { onClick: handleDropdownToggle, disabled: isWishlistPending, className: buildClassesByJoining('p-2 flex items-center justify-center rounded-full bg-white shadow-md hover:bg-gray-100 transition-colors duration-200', isWishlistPending ? 'opacity-50 cursor-not-allowed' : '', wishlistButtonClassName), "aria-label": "Wishlist options", children: [isInWishlist ? (_jsx(HeartIconSolid, { className: "h-5 w-5 text-red-500" })) : (_jsx(HeartIconOutline, { className: "h-5 w-5 text-gray-600" })), _jsx(ChevronDownIcon, { className: "h-4 w-4 ml-1 text-gray-600" })] }), _jsx(WishlistDropdown, { show: showDropdown && !isWishlistPending, wishlists: wishlists, productWishlistIds: productWishlistIds, isWishlistPending: isWishlistPending, onAddToWishlist: handleAddToWishlistWrapper, onRemoveFromWishlist: handleRemoveFromWishlistWrapper, onCreateNewWishlist: handleCreateNewWishlistWrapper, onClose: () => setShowDropdown(false), className: wishlistDropdownClassName })] })) : (_jsx("button", { onClick: e => {
37
+ e.stopPropagation();
38
+ handleWishlistToggle?.();
39
+ }, disabled: isWishlistPending, className: buildClassesByJoining('p-2 flex items-center justify-center rounded-full bg-white shadow-md hover:bg-gray-100 transition-colors duration-200', isWishlistPending ? 'opacity-50 cursor-not-allowed' : '', wishlistButtonClassName), "aria-label": isInWishlist ? 'Remove from favorites' : 'Add to favorites', children: isInWishlist ? (_jsx(HeartIconSolid, { className: "h-5 w-5 text-red-500" })) : (_jsx(HeartIconOutline, { className: "h-5 w-5 text-gray-600" })) })) }));
40
+ };
41
+ export default LikeButton;
@@ -0,0 +1,18 @@
1
+ export interface Wishlist {
2
+ id: string;
3
+ name: string;
4
+ }
5
+ export interface WishlistDropdownProps {
6
+ show: boolean;
7
+ wishlists: Wishlist[];
8
+ productWishlistIds: string[];
9
+ isWishlistPending: boolean;
10
+ onAddToWishlist: (wishlistId: string) => void;
11
+ onRemoveFromWishlist: (wishlistId: string) => void;
12
+ onCreateNewWishlist: (name: string) => void;
13
+ onClose?: () => void;
14
+ className?: string;
15
+ isModal?: boolean;
16
+ }
17
+ export declare const WishlistDropdown: ({ show, wishlists, productWishlistIds, isWishlistPending, onAddToWishlist, onRemoveFromWishlist, onCreateNewWishlist, onClose, className, isModal, }: WishlistDropdownProps) => import("react/jsx-runtime").JSX.Element | null;
18
+ export default WishlistDropdown;
@@ -0,0 +1,49 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import buildClassesByJoining from '../../../utils/StyleHelper';
4
+ import { CheckIcon, PlusCircleIcon, TrashIcon } from '@heroicons/react/24/outline';
5
+ import { useRef, useState } from 'react';
6
+ import TextField from '../../Forms/text-field/TextField';
7
+ export const WishlistDropdown = ({ show, wishlists, productWishlistIds, isWishlistPending, onAddToWishlist, onRemoveFromWishlist, onCreateNewWishlist, onClose, className, isModal = false, }) => {
8
+ const [showNewWishlistInput, setShowNewWishlistInput] = useState(false);
9
+ const [newWishlistName, setNewWishlistName] = useState('');
10
+ const inputRef = useRef(null);
11
+ const handleCreateNewWishlist = (e) => {
12
+ e.preventDefault();
13
+ if (newWishlistName.trim()) {
14
+ onCreateNewWishlist(newWishlistName.trim());
15
+ setNewWishlistName('');
16
+ setShowNewWishlistInput(false);
17
+ onClose?.();
18
+ }
19
+ };
20
+ const handleShowNewWishlistInput = (e) => {
21
+ e.stopPropagation();
22
+ setShowNewWishlistInput(true);
23
+ setTimeout(() => inputRef.current?.focus(), 0);
24
+ };
25
+ const handleWishlistClick = (wishlistId, isInWishlist) => {
26
+ if (isInWishlist) {
27
+ onRemoveFromWishlist(wishlistId);
28
+ }
29
+ else {
30
+ onAddToWishlist(wishlistId);
31
+ }
32
+ onClose?.();
33
+ };
34
+ if (!show)
35
+ return null;
36
+ const dropdownContent = (_jsxs("div", { className: "py-1", children: [wishlists.length > 0 && (_jsxs(_Fragment, { children: [_jsx("div", { className: "px-3 py-1.5 text-xs font-semibold text-gray-500 uppercase tracking-wider", children: "Wishlist Lists" }), wishlists.map(wishlist => {
37
+ const isInWishlist = productWishlistIds.includes(wishlist.id);
38
+ return (_jsxs("button", { onClick: () => handleWishlistClick(wishlist.id, isInWishlist), className: "w-full text-left px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100 flex items-center justify-between", disabled: isWishlistPending, children: [_jsxs("div", { className: "flex items-center", children: [isInWishlist ? (_jsx(TrashIcon, { className: "h-3.5 w-3.5 mr-2 text-red-600" })) : (_jsx(PlusCircleIcon, { className: "h-3.5 w-3.5 mr-2 text-green-600" })), _jsx("span", { className: "truncate", children: wishlist.name })] }), isInWishlist && (_jsx(CheckIcon, { className: "h-4 w-4 text-green-600 flex-shrink-0" }))] }, wishlist.id));
39
+ })] })), showNewWishlistInput ? (_jsx("form", { onSubmit: handleCreateNewWishlist, className: "px-3 py-2 border-t", children: _jsxs("div", { className: "space-y-2", children: [_jsx(TextField, { ref: inputRef, value: newWishlistName, onChange: (e) => setNewWishlistName(e.target.value), placeholder: "New wishlist name", size: "sm", className: "text-xs", onClick: (e) => e.stopPropagation(), disabled: isWishlistPending }), _jsxs("div", { className: "flex gap-1.5", children: [_jsx("button", { type: "submit", disabled: !newWishlistName.trim() || isWishlistPending, className: "flex-1 px-2 py-1 text-xs text-white bg-green-600 rounded hover:bg-green-700 disabled:opacity-50", children: "Create" }), _jsx("button", { type: "button", onClick: (e) => {
40
+ e.stopPropagation();
41
+ setShowNewWishlistInput(false);
42
+ setNewWishlistName('');
43
+ }, className: "flex-1 px-2 py-1 text-xs text-gray-600 bg-gray-200 rounded hover:bg-gray-300", children: "Cancel" })] })] }) })) : (_jsxs("button", { onClick: handleShowNewWishlistInput, className: "w-full text-left px-3 py-1.5 text-sm text-green-600 hover:bg-gray-100 flex items-center border-t", disabled: isWishlistPending, children: [_jsx(PlusCircleIcon, { className: "h-3.5 w-3.5 mr-2" }), _jsx("span", { className: "truncate", children: "Create New Wishlist" })] }))] }));
44
+ if (isModal) {
45
+ return (_jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50", children: _jsxs("div", { className: "bg-white rounded-lg shadow-xl p-6 m-4 max-w-md w-full", onClick: e => e.stopPropagation(), children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Wishlist Options" }), _jsx("div", { className: "bg-white rounded-md shadow-xs border border-gray-200", children: dropdownContent }), onClose && (_jsx("button", { onClick: onClose, className: "mt-4 w-full px-4 py-2 border border-gray-300 rounded hover:bg-gray-50", children: "Close" }))] }) }));
46
+ }
47
+ return (_jsx("div", { className: buildClassesByJoining('absolute right-0 mt-1 w-52 bg-white rounded-md shadow-xl z-50 border border-gray-200', className), children: dropdownContent }));
48
+ };
49
+ export default WishlistDropdown;
@@ -0,0 +1,11 @@
1
+ export type DropdownOption = {
2
+ id: string;
3
+ label: string;
4
+ };
5
+ export type DropdownProps = {
6
+ name?: string;
7
+ options: DropdownOption[];
8
+ onSelect: (id: string) => void;
9
+ selectedId?: string;
10
+ };
11
+ export default function Dropdown({ name, options, onSelect, selectedId, }: DropdownProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/react';
4
+ import { ChevronDownIcon } from '@heroicons/react/20/solid';
5
+ export default function Dropdown({ name = '', options, onSelect, selectedId = '', }) {
6
+ const selected = options.find((opt) => opt.id === selectedId) || options[0];
7
+ const buttonLabel = name ? `${name} ${selected.label}` : selected.label;
8
+ const handleSelect = (option) => {
9
+ onSelect(option.id);
10
+ };
11
+ return (_jsxs(Menu, { as: "div", className: "relative inline-block text-left z-50", children: [_jsx("div", { children: _jsxs(MenuButton, { className: "inline-flex w-full justify-center gap-x-1.5 rounded-md bg-white px-3 py-2 text-sm font-normal text-gray-900 shadow-xs ring-1 ring-gray-300 ring-inset hover:bg-gray-50", children: [buttonLabel, _jsx(ChevronDownIcon, { "aria-hidden": "true", className: "-mr-1 size-5 text-gray-400" })] }) }), _jsx(MenuItems, { className: "absolute right-0 z-10 mt-2 w-56 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black/5 focus:outline-none", children: _jsx("div", { className: "py-1", children: options.map((option) => (_jsx(MenuItem, { children: ({ active }) => (_jsx("button", { onClick: () => handleSelect(option), className: `block w-full text-left px-4 py-2 text-sm ${active ? 'bg-gray-100 text-gray-900' : 'text-gray-700'}`, children: option.label })) }, option.id))) }) })] }));
12
+ }
@@ -0,0 +1,29 @@
1
+ import React, { ReactNode, Ref } from 'react';
2
+ import { GroupBase, Props, SelectInstance } from 'react-select';
3
+ import { TooltipRef } from '../../Base/tooltip/Tooltip';
4
+ export type SelectFieldSize = 'sm' | 'md' | 'xs' | 'border-sm';
5
+ export type SelectFieldProps<Option, Group extends GroupBase<Option> = GroupBase<Option>, IsMulti extends boolean = false> = Omit<Props<Option, IsMulti, Group>, 'className' | 'classNamePrefix' | 'loadOptions'> & {
6
+ label?: string;
7
+ isRequired?: boolean;
8
+ srOnlyLabel?: boolean;
9
+ subtitle?: string;
10
+ color?: string;
11
+ valid?: boolean;
12
+ size?: SelectFieldSize;
13
+ message?: string;
14
+ className?: string;
15
+ removePaddingTop?: boolean;
16
+ renderMessageInTooltip?: boolean;
17
+ selectFieldType?: 'table' | 'default';
18
+ placeholder?: string;
19
+ tooltipRef?: Ref<TooltipRef>;
20
+ disablePortal?: boolean;
21
+ tooltipMessage?: ReactNode;
22
+ typeSelect?: 'single' | 'multi' | 'single-badges';
23
+ badgeLabelClassName?: string;
24
+ connected?: boolean;
25
+ connectPosition?: 'left' | 'right' | 'middle' | 'none';
26
+ };
27
+ export type SelectFieldRefType<Option, Group extends GroupBase<Option>, IsMulti extends boolean = false> = SelectInstance<Option, IsMulti, Group>;
28
+ declare const SelectField: <Option = unknown, Group extends GroupBase<Option> = GroupBase<Option>, IsMulti extends boolean = false>(props: SelectFieldProps<Option, Group, IsMulti> & React.RefAttributes<SelectFieldRefType<Option, Group, IsMulti>>) => React.JSX.Element;
29
+ export default SelectField;
@@ -0,0 +1,142 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { buildClassesByJoining } from '../../../utils/StyleHelper';
3
+ import { forwardRef, isValidElement, useId } from 'react';
4
+ import ReactSelect from 'react-select';
5
+ import Badge from '../../Base/badge/Badge';
6
+ import { CloseIcon } from '../../icon/CloseIcon';
7
+ import { InfoIcon } from '../../icon/InfoIcon';
8
+ import Label from '../../label/Label';
9
+ import Tooltip from '../../Base/tooltip/Tooltip';
10
+ import SelectFieldOption from './SelectFieldOption';
11
+ function SelectFieldComponent({ id, label, isRequired, srOnlyLabel, selectFieldType = 'default', subtitle, size = 'md', color = 'primary', valid = true, className, message, placeholder = selectFieldType === 'table' ? '...' : '', isSearchable = false, removePaddingTop, menuPosition = 'fixed', renderMessageInTooltip, tooltipRef, disablePortal, tooltipMessage, isMulti, typeSelect = isMulti ? 'multi' : 'single', badgeLabelClassName, styles: customStyles, connected, connectPosition, ...props }, ref) {
12
+ const randomId = useId();
13
+ const isMultiSelect = typeSelect === 'multi';
14
+ const renderMessage = () => {
15
+ return message && _jsx("span", { className: "text-xs mt-1 block text-gray-500", children: message });
16
+ };
17
+ const containerClassName = buildClassesByJoining({
18
+ invalid: !valid,
19
+ [color]: true,
20
+ [size]: true,
21
+ selector: true,
22
+ '!pt-0': removePaddingTop,
23
+ 'font-medium': selectFieldType === 'table',
24
+ }, className, 'flex flex-col gap-2');
25
+ const testAttributes = {
26
+ 'data-test-element': 'select',
27
+ 'data-test-element-type': typeSelect === 'multi' ? 'multi-select' : 'single-select',
28
+ 'data-test-name': props?.name,
29
+ 'data-test-selected-label': props?.value?.label,
30
+ 'data-test-selected-value': props?.value?.value,
31
+ 'data-test-is-disabled': props?.isDisabled,
32
+ };
33
+ const renderOptionBadge = ({ children, removeProps }) => {
34
+ return (_jsx(Badge, { color: "bg-green-100 text-green-800", rightIcon: _jsx(CloseIcon, { onMouseDown: (event) => {
35
+ event.preventDefault();
36
+ event.stopPropagation();
37
+ }, onClick: (event) => {
38
+ event.preventDefault();
39
+ event.stopPropagation();
40
+ if (removeProps && typeof removeProps.onClick === 'function') {
41
+ removeProps.onClick(event);
42
+ }
43
+ }, className: "w-4 h-4 cursor-pointer" }), className: "m-1", labelClassName: badgeLabelClassName, children: children }));
44
+ };
45
+ const getMultiValueComponent = (props) => {
46
+ const selectedValues = props.getValue();
47
+ if (selectFieldType === 'table') {
48
+ return (props.index === 0 && (_jsxs(_Fragment, { children: [renderOptionBadge(props), selectedValues.length > 1 && (_jsx(Badge, { color: "bg-green-100 text-green-800", className: "m-1", children: _jsxs("span", { children: ["+", selectedValues.length - 1] }) }))] })));
49
+ }
50
+ return renderOptionBadge(props);
51
+ };
52
+ const getBaseStyles = () => {
53
+ let controlStyles = {};
54
+ if (connected) {
55
+ if (connectPosition === 'left') {
56
+ controlStyles.borderTopRightRadius = 0;
57
+ controlStyles.borderBottomRightRadius = 0;
58
+ controlStyles.borderRight = 'none';
59
+ }
60
+ else if (connectPosition === 'right') {
61
+ controlStyles.borderTopLeftRadius = 0;
62
+ controlStyles.borderBottomLeftRadius = 0;
63
+ controlStyles.borderLeft = 'none';
64
+ }
65
+ else if (connectPosition === 'middle') {
66
+ controlStyles.borderRadius = 0;
67
+ controlStyles.borderRight = 'none';
68
+ controlStyles.borderLeft = 'none';
69
+ }
70
+ }
71
+ return {
72
+ ...customStyles,
73
+ indicatorSeparator: (base) => ({
74
+ ...base,
75
+ display: 'none',
76
+ }),
77
+ placeholder: (base) => ({
78
+ ...base,
79
+ opacity: 0.4,
80
+ fontWeight: 'normal',
81
+ fontSize: selectFieldType === 'table' ? '1rem' : '0.75rem',
82
+ }),
83
+ control: (base) => ({
84
+ ...base,
85
+ paddingLeft: selectFieldType === 'table' ? '4px' : '0',
86
+ minHeight: size === 'md' ? '36px' : '',
87
+ ...controlStyles,
88
+ }),
89
+ dropdownIndicator: (base, state) => ({
90
+ ...base,
91
+ opacity: state.isFocused || state.selectProps.menuIsOpen ? 1 : 0.4,
92
+ }),
93
+ singleValue: (base) => {
94
+ if (typeSelect !== 'single-badges') {
95
+ return base;
96
+ }
97
+ return {
98
+ ...base,
99
+ backgroundColor: '#E5EFFE',
100
+ border: '0.063rem solid #A0AEC0',
101
+ color: '#374151 !important',
102
+ padding: '0.125rem 0.625rem',
103
+ fontSize: '0.75rem',
104
+ borderRadius: '6px',
105
+ width: 'fit-content',
106
+ };
107
+ },
108
+ };
109
+ };
110
+ const commonProps = {
111
+ id: id || randomId,
112
+ instanceId: id || randomId,
113
+ isSearchable,
114
+ className: buildClassesByJoining({
115
+ [size]: true,
116
+ }, 'selector-container'),
117
+ menuPortalTarget: typeof document !== 'undefined' && menuPosition === 'fixed' && !disablePortal
118
+ ? document.body
119
+ : undefined,
120
+ classNamePrefix: 'selector',
121
+ placeholder,
122
+ menuPosition,
123
+ openMenuOnFocus: true,
124
+ openMenuOnClick: true,
125
+ noOptionsMessage: () => _jsx("div", { className: "text-gray-500 text-sm", children: "No options available" }),
126
+ };
127
+ return (_jsxs("div", { className: containerClassName, children: [(!!label?.length || isValidElement(tooltipMessage)) && (_jsxs("div", { className: "flex gap-1", children: [_jsx(Label, { text: label, isRequired: isRequired, htmlFor: randomId, subtitle: subtitle, srOnly: srOnlyLabel }), tooltipMessage && (_jsx(Tooltip, { placement: "top", content: tooltipMessage, contentClassName: "max-w-64", children: _jsx(InfoIcon, {}) }))] })), _jsx("div", { className: "flex flex-col relative shadow-sm", children: renderMessageInTooltip ? (_jsx(Tooltip, { content: message, backgroundColor: !valid ? 'bg-red-500' : 'bg-green-500', textColor: "text-white", ref: tooltipRef, disabled: !renderMessageInTooltip || !message, lazy: false, children: _jsx("div", { ...testAttributes, children: isMultiSelect ? (_jsx(ReactSelect, { ...props, ...commonProps, styles: getBaseStyles(), isMulti: true, ref: ref, components: {
128
+ Option: SelectFieldOption,
129
+ MultiValue: getMultiValueComponent,
130
+ } })) : (_jsx(ReactSelect, { ...props, ...commonProps, styles: getBaseStyles(), isMulti: false, ref: ref, components: {
131
+ Option: SelectFieldOption,
132
+ MultiValue: getMultiValueComponent,
133
+ } })) }) })) : (_jsx("div", { ...testAttributes, children: isMultiSelect ? (_jsx(ReactSelect, { ...props, ...commonProps, styles: getBaseStyles(), isMulti: true, ref: ref, components: {
134
+ Option: SelectFieldOption,
135
+ MultiValue: getMultiValueComponent,
136
+ } })) : (_jsx(ReactSelect, { ...props, ...commonProps, styles: getBaseStyles(), isMulti: false, ref: ref, components: {
137
+ Option: SelectFieldOption,
138
+ MultiValue: getMultiValueComponent,
139
+ } })) })) }), !renderMessageInTooltip && renderMessage()] }));
140
+ }
141
+ const SelectField = forwardRef(SelectFieldComponent);
142
+ export default SelectField;
@@ -0,0 +1,4 @@
1
+ import { GroupBase, OptionProps } from 'react-select';
2
+ export type SelectFieldOptionProps<Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> = OptionProps<Option, IsMulti, Group>;
3
+ declare const SelectFieldOption: <Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ children, data, ...props }: SelectFieldOptionProps<Option, IsMulti, Group>) => import("react/jsx-runtime").JSX.Element;
4
+ export default SelectFieldOption;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { components } from 'react-select';
3
+ const SelectFieldOption = ({ children, data, ...props }) => {
4
+ const optionData = data;
5
+ return (_jsx(components.Option, { ...props, data: data, children: _jsx("span", { "data-test-option": JSON.stringify(optionData), "data-test-option-value": optionData.value, "data-test-option-label": optionData.label, children: children }) }));
6
+ };
7
+ export default SelectFieldOption;