@q2devel/q2-storybook 1.0.0 → 1.0.2

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.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { SVGProps } from 'react';
3
+ export declare const CloseIcon: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
@@ -0,0 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React from 'react';
13
+ export var CloseIcon = function (props) { return (React.createElement("svg", __assign({ width: 16, height: 16, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", className: props.className, onClick: props.onClick, onMouseDown: props.onMouseDown }, props),
14
+ React.createElement("path", { d: "M6 18L18 6M6 6l12 12", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }))); };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { SVGProps } from 'react';
3
+ export declare const InfoIcon: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
@@ -0,0 +1,15 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React from 'react';
13
+ export var InfoIcon = function (props) { return (React.createElement("svg", __assign({ className: "w-4 h-4 text-blue-600 ".concat(props.className || ''), fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24" }, props),
14
+ React.createElement("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor" }),
15
+ React.createElement("path", { d: "M12 8v4m0 4h.01", stroke: "currentColor" }))); };
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ interface LabelProps {
3
+ text?: string;
4
+ i18nKey?: string;
5
+ isRequired?: boolean;
6
+ htmlFor?: string;
7
+ subtitle?: string;
8
+ srOnly?: boolean;
9
+ className?: string;
10
+ }
11
+ declare const Label: ({ text, i18nKey, isRequired, htmlFor, subtitle, srOnly, className, }: LabelProps) => React.JSX.Element | null;
12
+ export default Label;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ var Label = function (_a) {
3
+ var text = _a.text, i18nKey = _a.i18nKey, isRequired = _a.isRequired, htmlFor = _a.htmlFor, subtitle = _a.subtitle, srOnly = _a.srOnly, _b = _a.className, className = _b === void 0 ? '' : _b;
4
+ if (!text && !i18nKey)
5
+ return null;
6
+ return (React.createElement("label", { htmlFor: htmlFor, className: "text-sm font-medium text-gray-700 flex flex-col ".concat(srOnly ? 'sr-only' : '', " ").concat(className) },
7
+ React.createElement("span", null, text || i18nKey),
8
+ isRequired && React.createElement("span", { className: "ml-1 text-red-500" }, "*"),
9
+ subtitle && React.createElement("span", { className: "text-xs text-gray-500" }, subtitle)));
10
+ };
11
+ export default Label;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ export type NavItem = {
3
+ name: string;
4
+ href: string;
5
+ };
6
+ export type NavBarProps = {
7
+ items?: NavItem[];
8
+ logo?: React.ReactNode;
9
+ rightContent?: React.ReactNode;
10
+ backgroundColor?: string;
11
+ textColor?: string;
12
+ activeColor?: string;
13
+ mobileMenuBgColor?: string;
14
+ containerClassName?: string;
15
+ navClassName?: string;
16
+ itemClassName?: string;
17
+ mobileItemClassName?: string;
18
+ };
19
+ export declare const NavBar: ({ items, logo, rightContent, backgroundColor, textColor, activeColor, mobileMenuBgColor, containerClassName, navClassName, itemClassName, mobileItemClassName }: NavBarProps) => React.JSX.Element;
@@ -0,0 +1,36 @@
1
+ 'use client';
2
+ import { useState } from 'react';
3
+ import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline';
4
+ import React from 'react';
5
+ export var NavBar = function (_a) {
6
+ var
7
+ // Structure
8
+ _b = _a.items,
9
+ // Structure
10
+ items = _b === void 0 ? [] : _b,
11
+ // Logo
12
+ _c = _a.logo,
13
+ // Logo
14
+ logo = _c === void 0 ? React.createElement("div", { className: "h-8 w-8 bg-indigo-600 rounded-md" }) : _c,
15
+ // Right side elements
16
+ rightContent = _a.rightContent,
17
+ // Styling
18
+ _d = _a.backgroundColor,
19
+ // Styling
20
+ backgroundColor = _d === void 0 ? "bg-white" : _d, _e = _a.textColor, textColor = _e === void 0 ? "text-gray-600" : _e, _f = _a.activeColor, activeColor = _f === void 0 ? "text-indigo-600" : _f, _g = _a.mobileMenuBgColor, mobileMenuBgColor = _g === void 0 ? "bg-white" : _g, _h = _a.containerClassName, containerClassName = _h === void 0 ? "" : _h, _j = _a.navClassName, navClassName = _j === void 0 ? "" : _j, _k = _a.itemClassName, itemClassName = _k === void 0 ? "" : _k, _l = _a.mobileItemClassName, mobileItemClassName = _l === void 0 ? "" : _l;
21
+ var _m = useState(false), mobileMenuOpen = _m[0], setMobileMenuOpen = _m[1];
22
+ return (React.createElement("header", { className: "".concat(backgroundColor, " ").concat(containerClassName) },
23
+ React.createElement("nav", { className: "mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 ".concat(navClassName) },
24
+ React.createElement("div", { className: "flex h-16 items-center justify-between" },
25
+ React.createElement("div", { className: "flex-shrink-0" }, logo),
26
+ React.createElement("div", { className: "flex md:hidden" },
27
+ React.createElement("button", { type: "button", className: "inline-flex items-center justify-center rounded-md p-2 ".concat(textColor, " hover:").concat(activeColor, " hover:bg-gray-100"), onClick: function () { return setMobileMenuOpen(!mobileMenuOpen); } },
28
+ React.createElement("span", { className: "sr-only" }, "Open main menu"),
29
+ mobileMenuOpen ? (React.createElement(XMarkIcon, { className: "block h-6 w-6", "aria-hidden": "true" })) : (React.createElement(Bars3Icon, { className: "block h-6 w-6", "aria-hidden": "true" })))),
30
+ React.createElement("div", { className: "hidden md:flex md:flex-1 md:items-center md:justify-center md:space-x-8" }, items.map(function (item) { return (React.createElement("a", { key: item.name, href: item.href, className: "text-sm font-medium ".concat(textColor, " hover:").concat(activeColor, " ").concat(itemClassName) }, item.name)); })),
31
+ rightContent && (React.createElement("div", { className: "hidden md:flex md:items-center" }, rightContent)))),
32
+ mobileMenuOpen && (React.createElement("div", { className: "md:hidden ".concat(mobileMenuBgColor) },
33
+ React.createElement("div", { className: "space-y-1 px-2 pb-3 pt-2" }, items.map(function (item) { return (React.createElement("a", { key: item.name, href: item.href, className: "block rounded-md px-3 py-2 text-base font-medium ".concat(textColor, " hover:").concat(activeColor, " hover:bg-gray-100 ").concat(mobileItemClassName) }, item.name)); })),
34
+ rightContent && (React.createElement("div", { className: "border-t border-gray-200 pb-3 pt-4" },
35
+ React.createElement("div", { className: "flex items-center px-5" }, rightContent)))))));
36
+ };
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ export type Product = {
3
+ id: string;
4
+ imageSrc: string;
5
+ imageAlt: string;
6
+ href: string;
7
+ name: string;
8
+ color?: string;
9
+ price: string;
10
+ description?: string;
11
+ badges?: Array<{
12
+ text: string;
13
+ color: string;
14
+ }>;
15
+ };
16
+ export type QuantityControlProps = {
17
+ quantity: number;
18
+ onIncrement: (e: React.MouseEvent) => void;
19
+ onDecrement: (e: React.MouseEvent) => void;
20
+ minQuantity?: number;
21
+ maxQuantity?: number;
22
+ controlsClassName?: string;
23
+ buttonClassName?: string;
24
+ quantityClassName?: string;
25
+ };
26
+ export type ProductCardProps = {
27
+ product: Product;
28
+ className?: string;
29
+ imageClassName?: string;
30
+ contentClassName?: string;
31
+ titleClassName?: string;
32
+ colorClassName?: string;
33
+ priceClassName?: string;
34
+ descriptionClassName?: string;
35
+ badgeClassName?: string;
36
+ aspectRatio?: 'square' | 'auto' | 'video' | 'wide';
37
+ imagePosition?: 'top' | 'bottom' | 'center';
38
+ imageObjectFit?: 'cover' | 'contain' | 'fill' | 'none';
39
+ layout?: 'default' | 'compact' | 'horizontal';
40
+ hoverEffect?: 'opacity' | 'scale' | 'shadow' | 'border' | 'none';
41
+ renderBadges?: boolean;
42
+ renderColor?: boolean;
43
+ renderDescription?: boolean;
44
+ elevationLevel?: 0 | 1 | 2 | 3;
45
+ rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';
46
+ titleLines?: 1 | 2 | 3;
47
+ onCardClick?: (product: Product) => void;
48
+ onImageClick?: (product: Product) => void;
49
+ renderFooter?: (product: Product) => React.ReactNode;
50
+ renderHeader?: (product: Product) => React.ReactNode;
51
+ actionButton?: React.ReactNode;
52
+ showAddButton?: boolean;
53
+ initialQuantity?: number;
54
+ onQuantityChange?: (product: Product, quantity: number) => void;
55
+ addButtonIcon?: React.ReactNode;
56
+ maxQuantity?: number;
57
+ quantityControlProps?: Partial<QuantityControlProps>;
58
+ customAddButton?: React.ReactNode;
59
+ customQuantityControl?: React.ReactNode;
60
+ };
61
+ export declare const ProductCard: ({ product, className, imageClassName, contentClassName, titleClassName, colorClassName, priceClassName, descriptionClassName, badgeClassName, aspectRatio, imagePosition, imageObjectFit, layout, hoverEffect, renderBadges, renderColor, renderDescription, elevationLevel, rounded, titleLines, onCardClick, onImageClick, renderFooter, renderHeader, actionButton, showAddButton, initialQuantity, onQuantityChange, addButtonIcon, maxQuantity, quantityControlProps, customAddButton, customQuantityControl, }: ProductCardProps) => React.JSX.Element;
@@ -0,0 +1,148 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { MinusIcon, PlusIcon } from '@heroicons/react/24/solid';
13
+ import React, { useState } from 'react';
14
+ import { buildClassesByJoining } from '../../utils/StyleHelper';
15
+ // Quantity Control Component
16
+ var QuantityControl = function (_a) {
17
+ var quantity = _a.quantity, onIncrement = _a.onIncrement, onDecrement = _a.onDecrement, _b = _a.minQuantity, minQuantity = _b === void 0 ? 0 : _b, _c = _a.maxQuantity, maxQuantity = _c === void 0 ? 99 : _c, _d = _a.controlsClassName, controlsClassName = _d === void 0 ? '' : _d, _e = _a.buttonClassName, buttonClassName = _e === void 0 ? '' : _e, _f = _a.quantityClassName, quantityClassName = _f === void 0 ? '' : _f;
18
+ return (React.createElement("div", { className: "flex items-center gap-2 ".concat(controlsClassName) },
19
+ React.createElement("button", { onClick: onDecrement, disabled: quantity <= minQuantity, className: "w-8 h-8 flex items-center justify-center rounded-full bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:bg-red-300 disabled:cursor-not-allowed shadow-sm transition-all duration-200 ".concat(buttonClassName), "aria-label": "Decrease quantity" },
20
+ React.createElement(MinusIcon, { className: "h-4 w-4" })),
21
+ React.createElement("div", { className: "w-8 h-8 rounded-full bg-white flex items-center justify-center text-sm font-medium shadow-sm transition-all duration-200 ".concat(quantityClassName) }, quantity),
22
+ React.createElement("button", { onClick: onIncrement, disabled: quantity >= maxQuantity, className: "w-8 h-8 flex items-center justify-center rounded-full bg-green-500 text-white hover:bg-green-600 disabled:opacity-50 disabled:bg-green-300 disabled:cursor-not-allowed shadow-sm transition-all duration-200 ".concat(buttonClassName), "aria-label": "Increase quantity" },
23
+ React.createElement(PlusIcon, { className: "h-4 w-4" }))));
24
+ };
25
+ export var ProductCard = function (_a) {
26
+ var product = _a.product, className = _a.className, imageClassName = _a.imageClassName, contentClassName = _a.contentClassName, titleClassName = _a.titleClassName, colorClassName = _a.colorClassName, priceClassName = _a.priceClassName, descriptionClassName = _a.descriptionClassName, badgeClassName = _a.badgeClassName, _b = _a.aspectRatio, aspectRatio = _b === void 0 ? 'square' : _b, _c = _a.imagePosition, imagePosition = _c === void 0 ? 'center' : _c, _d = _a.imageObjectFit, imageObjectFit = _d === void 0 ? 'cover' : _d, _e = _a.layout, layout = _e === void 0 ? 'default' : _e, _f = _a.hoverEffect, hoverEffect = _f === void 0 ? 'opacity' : _f, _g = _a.renderBadges, renderBadges = _g === void 0 ? true : _g, _h = _a.renderColor, renderColor = _h === void 0 ? true : _h, _j = _a.renderDescription, renderDescription = _j === void 0 ? false : _j, _k = _a.elevationLevel, elevationLevel = _k === void 0 ? 0 : _k, _l = _a.rounded, rounded = _l === void 0 ? 'md' : _l, _m = _a.titleLines, titleLines = _m === void 0 ? 1 : _m, onCardClick = _a.onCardClick, onImageClick = _a.onImageClick, renderFooter = _a.renderFooter, renderHeader = _a.renderHeader, actionButton = _a.actionButton,
27
+ // Add to cart functionality
28
+ _o = _a.showAddButton,
29
+ // Add to cart functionality
30
+ showAddButton = _o === void 0 ? false : _o, _p = _a.initialQuantity, initialQuantity = _p === void 0 ? 0 : _p, onQuantityChange = _a.onQuantityChange, _q = _a.addButtonIcon, addButtonIcon = _q === void 0 ? React.createElement(PlusIcon, { className: "h-4 w-4" }) : _q, _r = _a.maxQuantity, maxQuantity = _r === void 0 ? 99 : _r, _s = _a.quantityControlProps, quantityControlProps = _s === void 0 ? {} : _s, customAddButton = _a.customAddButton, customQuantityControl = _a.customQuantityControl;
31
+ var _t = useState(initialQuantity), quantity = _t[0], setQuantity = _t[1];
32
+ var _u = useState(initialQuantity > 0), showQuantityControls = _u[0], setShowQuantityControls = _u[1];
33
+ // Create aspect ratio class
34
+ var aspectRatioClass = {
35
+ square: 'aspect-square',
36
+ auto: 'aspect-auto',
37
+ video: 'aspect-video',
38
+ wide: 'aspect-[16/9]',
39
+ }[aspectRatio];
40
+ // Create object-fit class
41
+ var objectFitClass = {
42
+ cover: 'object-cover',
43
+ contain: 'object-contain',
44
+ fill: 'object-fill',
45
+ none: 'object-none',
46
+ }[imageObjectFit];
47
+ // Create object-position class
48
+ var objectPositionClass = {
49
+ top: 'object-top',
50
+ center: 'object-center',
51
+ bottom: 'object-bottom',
52
+ }[imagePosition];
53
+ // Create hover effect class
54
+ var hoverClass = {
55
+ opacity: 'group-hover:opacity-75',
56
+ scale: 'transform transition-transform group-hover:scale-105',
57
+ shadow: 'transition-shadow group-hover:shadow-lg',
58
+ border: 'border border-transparent group-hover:border-primary-500',
59
+ none: '',
60
+ }[hoverEffect];
61
+ // Create shadow elevation class
62
+ var elevationClass = {
63
+ 0: '',
64
+ 1: 'shadow-sm',
65
+ 2: 'shadow',
66
+ 3: 'shadow-md',
67
+ }[elevationLevel];
68
+ // Create rounded class
69
+ var roundedClass = {
70
+ none: 'rounded-none',
71
+ sm: 'rounded-sm',
72
+ md: 'rounded-md',
73
+ lg: 'rounded-lg',
74
+ full: 'rounded-full',
75
+ }[rounded];
76
+ // Create title line clamp class
77
+ var titleLineClampClass = {
78
+ 1: 'line-clamp-1',
79
+ 2: 'line-clamp-2',
80
+ 3: 'line-clamp-3',
81
+ }[titleLines];
82
+ // Create layout class
83
+ var layoutClass = layout === 'horizontal' ? 'flex gap-4' : '';
84
+ var imageLayoutClass = layout === 'horizontal' ? 'w-1/3' : 'w-full';
85
+ var contentLayoutClass = layout === 'horizontal' ? 'w-2/3' : 'w-full';
86
+ var compactClass = layout === 'compact' ? 'space-y-1' : 'space-y-2';
87
+ var handleCardClick = function () {
88
+ onCardClick && onCardClick(product);
89
+ };
90
+ var handleImageClick = function (e) {
91
+ if (onImageClick) {
92
+ e.stopPropagation();
93
+ onImageClick(product);
94
+ }
95
+ };
96
+ var handleAddToCart = function (e) {
97
+ e.stopPropagation(); // Prevent card click
98
+ setShowQuantityControls(true);
99
+ setQuantity(1);
100
+ onQuantityChange && onQuantityChange(product, 1);
101
+ };
102
+ var handleIncrement = function (e) {
103
+ e.stopPropagation(); // Prevent card click
104
+ var newQuantity = Math.min(quantity + 1, maxQuantity);
105
+ setQuantity(newQuantity);
106
+ onQuantityChange && onQuantityChange(product, newQuantity);
107
+ };
108
+ var handleDecrement = function (e) {
109
+ e.stopPropagation(); // Prevent card click
110
+ var newQuantity = Math.max(quantity - 1, 0);
111
+ if (newQuantity === 0) {
112
+ setQuantity(0);
113
+ // Use timeout to allow animation to play before hiding
114
+ setTimeout(function () {
115
+ setShowQuantityControls(false);
116
+ }, 300);
117
+ }
118
+ else {
119
+ setQuantity(newQuantity);
120
+ }
121
+ onQuantityChange && onQuantityChange(product, newQuantity);
122
+ };
123
+ return (React.createElement("div", { key: product.id, className: buildClassesByJoining('group relative', layoutClass, elevationClass, onCardClick ? 'cursor-pointer' : '', className), onClick: handleCardClick },
124
+ renderHeader && renderHeader(product),
125
+ React.createElement("div", { className: "".concat(imageLayoutClass, " relative") },
126
+ product.badges && renderBadges && (React.createElement("div", { className: "absolute top-2 left-2 z-10 flex flex-wrap gap-1" }, product.badges.map(function (badge, index) { return (React.createElement("span", { key: index, className: buildClassesByJoining("inline-flex items-center px-2 py-1 text-xs font-medium ".concat(badge.color), roundedClass, badgeClassName) }, badge.text)); }))),
127
+ React.createElement("img", { alt: product.imageAlt, src: product.imageSrc, className: buildClassesByJoining(aspectRatioClass, objectFitClass, objectPositionClass, hoverEffect !== 'none' ? hoverClass : '', roundedClass, 'bg-gray-200', onImageClick ? 'cursor-pointer' : '', imageClassName), onClick: handleImageClick }),
128
+ (showAddButton || showQuantityControls) && (React.createElement("div", { className: "absolute bottom-2 right-2 z-10", onClick: function (e) { return e.stopPropagation(); } },
129
+ React.createElement("div", { className: "relative" },
130
+ React.createElement("div", { className: "transition-all duration-300 ease-in-out transform\n ".concat(showQuantityControls
131
+ ? 'scale-0 opacity-0'
132
+ : 'scale-100 opacity-100') }, customAddButton || (React.createElement("button", { onClick: handleAddToCart, className: "p-2 w-10 h-10 flex items-center justify-center rounded-full bg-green-500 text-white shadow-md hover:bg-green-600 transition-colors duration-200", "aria-label": "Add to cart" }, addButtonIcon))),
133
+ React.createElement("div", { className: "absolute top-0 right-0 transition-all duration-300 ease-in-out transform origin-right\n ".concat(!showQuantityControls
134
+ ? 'scale-0 opacity-0'
135
+ : 'scale-100 opacity-100') }, customQuantityControl || (React.createElement(QuantityControl, __assign({ quantity: quantity, onIncrement: handleIncrement, onDecrement: handleDecrement, minQuantity: 0, maxQuantity: maxQuantity }, quantityControlProps)))))))),
136
+ React.createElement("div", { className: buildClassesByJoining('mt-4', contentLayoutClass, compactClass, contentClassName) },
137
+ React.createElement("div", { className: "flex justify-between" },
138
+ React.createElement("div", null,
139
+ React.createElement("h3", { className: buildClassesByJoining('text-sm text-gray-700', titleLineClampClass, titleClassName) },
140
+ React.createElement("a", { href: product.href },
141
+ !onCardClick && (React.createElement("span", { "aria-hidden": "true", className: "absolute inset-0" })),
142
+ product.name)),
143
+ renderColor && product.color && (React.createElement("p", { className: buildClassesByJoining('mt-1 text-sm text-gray-500', colorClassName) }, product.color)),
144
+ renderDescription && product.description && (React.createElement("p", { className: buildClassesByJoining('mt-1 text-sm text-gray-500 line-clamp-2', descriptionClassName) }, product.description))),
145
+ React.createElement("p", { className: buildClassesByJoining('text-sm font-medium text-gray-900', priceClassName) }, product.price)),
146
+ actionButton && React.createElement("div", { className: "mt-2" }, actionButton),
147
+ renderFooter && renderFooter(product))));
148
+ };
@@ -0,0 +1,27 @@
1
+ import React, { ReactNode, Ref } from 'react';
2
+ import { GroupBase, Props, SelectInstance } from 'react-select';
3
+ import { TooltipRef } from '../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
+ };
25
+ export type SelectFieldRefType<Option, Group extends GroupBase<Option>, IsMulti extends boolean = false> = SelectInstance<Option, IsMulti, Group>;
26
+ 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;
27
+ export default SelectField;
@@ -0,0 +1,131 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { buildClassesByJoining } from '../../utils/StyleHelper';
24
+ import React, { forwardRef, isValidElement, useId } from 'react';
25
+ import ReactSelect from 'react-select';
26
+ import Badge from '../badge/Badge';
27
+ import { CloseIcon } from '../icon/CloseIcon';
28
+ import { InfoIcon } from '../icon/InfoIcon';
29
+ import Label from '../label/Label';
30
+ import Tooltip from '../tooltip/Tooltip';
31
+ import SelectFieldOption from './SelectFieldOption';
32
+ function SelectFieldComponent(_a, ref) {
33
+ var _b;
34
+ var _c, _d;
35
+ var id = _a.id, label = _a.label, isRequired = _a.isRequired, srOnlyLabel = _a.srOnlyLabel, _e = _a.selectFieldType, selectFieldType = _e === void 0 ? 'default' : _e, subtitle = _a.subtitle, _f = _a.size, size = _f === void 0 ? 'md' : _f, _g = _a.color, color = _g === void 0 ? 'primary' : _g, _h = _a.valid, valid = _h === void 0 ? true : _h, className = _a.className, message = _a.message, _j = _a.placeholder, placeholder = _j === void 0 ? selectFieldType === 'table' ? '...' : '' : _j, _k = _a.isSearchable, isSearchable = _k === void 0 ? false : _k, removePaddingTop = _a.removePaddingTop, _l = _a.menuPosition, menuPosition = _l === void 0 ? 'fixed' : _l, renderMessageInTooltip = _a.renderMessageInTooltip, tooltipRef = _a.tooltipRef, disablePortal = _a.disablePortal, tooltipMessage = _a.tooltipMessage, isMulti = _a.isMulti, _m = _a.typeSelect, typeSelect = _m === void 0 ? isMulti ? 'multi' : 'single' : _m, badgeLabelClassName = _a.badgeLabelClassName, customStyles = _a.styles, props = __rest(_a, ["id", "label", "isRequired", "srOnlyLabel", "selectFieldType", "subtitle", "size", "color", "valid", "className", "message", "placeholder", "isSearchable", "removePaddingTop", "menuPosition", "renderMessageInTooltip", "tooltipRef", "disablePortal", "tooltipMessage", "isMulti", "typeSelect", "badgeLabelClassName", "styles"]);
36
+ var randomId = useId();
37
+ var isMultiSelect = typeSelect === 'multi';
38
+ var renderMessage = function () {
39
+ return message && React.createElement("span", { className: "text-xs mt-1 block text-gray-500" }, message);
40
+ };
41
+ var containerClassName = buildClassesByJoining((_b = {
42
+ invalid: !valid
43
+ },
44
+ _b[color] = true,
45
+ _b[size] = true,
46
+ _b.selector = true,
47
+ _b['!pt-0'] = removePaddingTop,
48
+ _b['shadow-sm'] = selectFieldType === 'table',
49
+ _b['font-medium'] = selectFieldType === 'table',
50
+ _b), className, 'flex flex-col gap-2');
51
+ var testAttributes = {
52
+ 'data-test-element': 'select',
53
+ 'data-test-element-type': typeSelect === 'multi' ? 'multi-select' : 'single-select',
54
+ 'data-test-name': props === null || props === void 0 ? void 0 : props.name,
55
+ 'data-test-selected-label': (_c = props === null || props === void 0 ? void 0 : props.value) === null || _c === void 0 ? void 0 : _c.label,
56
+ 'data-test-selected-value': (_d = props === null || props === void 0 ? void 0 : props.value) === null || _d === void 0 ? void 0 : _d.value,
57
+ 'data-test-is-disabled': props === null || props === void 0 ? void 0 : props.isDisabled,
58
+ };
59
+ var renderOptionBadge = function (_a) {
60
+ var children = _a.children, removeProps = _a.removeProps;
61
+ return (React.createElement(Badge, { color: "bg-blue-100 text-blue-800", rightIcon: React.createElement(CloseIcon, { onMouseDown: function (event) {
62
+ event.preventDefault();
63
+ event.stopPropagation();
64
+ }, onClick: function (event) {
65
+ event.preventDefault();
66
+ event.stopPropagation();
67
+ if (removeProps && typeof removeProps.onClick === 'function') {
68
+ removeProps.onClick(event);
69
+ }
70
+ }, className: "w-4 h-4 cursor-pointer" }), className: "m-1", labelClassName: badgeLabelClassName }, children));
71
+ };
72
+ var getMultiValueComponent = function (props) {
73
+ var selectedValues = props.getValue();
74
+ if (selectFieldType === 'table') {
75
+ return (props.index === 0 && (React.createElement(React.Fragment, null,
76
+ renderOptionBadge(props),
77
+ selectedValues.length > 1 && (React.createElement(Badge, { color: "bg-blue-100 text-blue-800", className: "m-1" },
78
+ React.createElement("span", null,
79
+ "+",
80
+ selectedValues.length - 1))))));
81
+ }
82
+ return renderOptionBadge(props);
83
+ };
84
+ var renderInput = function () {
85
+ var _a;
86
+ var getBaseStyles = function () { return (__assign(__assign({}, customStyles), { indicatorSeparator: function (base) { return (__assign(__assign({}, base), { display: 'none' })); }, placeholder: function (base) { return (__assign(__assign({}, base), { opacity: 0.4, fontWeight: 'normal', fontSize: selectFieldType === 'table' ? '1rem' : '0.75rem' })); }, control: function (base) { return (__assign(__assign({}, base), { paddingLeft: selectFieldType === 'table' ? '4px' : '0' })); }, dropdownIndicator: function (base, state) { return (__assign(__assign({}, base), { opacity: state.isFocused || state.selectProps.menuIsOpen ? 1 : 0.4 })); }, singleValue: function (base) {
87
+ if (typeSelect !== 'single-badges') {
88
+ return base;
89
+ }
90
+ return __assign(__assign({}, base), { backgroundColor: '#E5EFFE', border: '0.063rem solid #A0AEC0', color: '#374151 !important', padding: '0.125rem 0.625rem', fontSize: '0.75rem', borderRadius: '6px', width: 'fit-content' });
91
+ } })); };
92
+ var commonProps = {
93
+ id: id || randomId,
94
+ instanceId: id || randomId,
95
+ isSearchable: isSearchable,
96
+ className: buildClassesByJoining((_a = {},
97
+ _a[size] = true,
98
+ _a), 'selector-container'),
99
+ menuPortalTarget: typeof document !== 'undefined' && menuPosition === 'fixed' && !disablePortal
100
+ ? document.body
101
+ : undefined,
102
+ classNamePrefix: 'selector',
103
+ placeholder: placeholder,
104
+ menuPosition: menuPosition,
105
+ openMenuOnFocus: true,
106
+ openMenuOnClick: true,
107
+ noOptionsMessage: function () { return (React.createElement("div", { className: "text-gray-500 text-sm" }, "No options available")); },
108
+ };
109
+ return (React.createElement(React.Fragment, null,
110
+ React.createElement("div", __assign({}, testAttributes), isMultiSelect ? (React.createElement(ReactSelect, __assign({}, props, commonProps, { styles: getBaseStyles(), isMulti: true, ref: ref, components: {
111
+ Option: SelectFieldOption,
112
+ MultiValue: getMultiValueComponent,
113
+ } }))) : (React.createElement(ReactSelect, __assign({}, props, commonProps, { styles: getBaseStyles(), isMulti: false, ref: ref, components: {
114
+ Option: SelectFieldOption,
115
+ MultiValue: getMultiValueComponent,
116
+ } })))),
117
+ !renderMessageInTooltip && renderMessage()));
118
+ };
119
+ var renderTooltip = function () {
120
+ return (React.createElement("span", { className: "flex items-center gap-1 pb-1" },
121
+ React.createElement(Tooltip, { placement: "top", content: tooltipMessage, contentClassName: "max-w-64" },
122
+ React.createElement(InfoIcon, null))));
123
+ };
124
+ return (React.createElement("div", { className: containerClassName },
125
+ (!!(label === null || label === void 0 ? void 0 : label.length) || isValidElement(tooltipMessage)) && (React.createElement("div", { className: "flex gap-1" },
126
+ React.createElement(Label, { text: label, isRequired: isRequired, htmlFor: randomId, subtitle: subtitle, srOnly: srOnlyLabel }),
127
+ tooltipMessage && renderTooltip())),
128
+ React.createElement("div", { className: "flex flex-col relative" }, renderMessageInTooltip ? (React.createElement(Tooltip, { content: message, backgroundColor: !valid ? 'bg-red-500' : 'bg-blue-500', textColor: "text-white", ref: tooltipRef, disabled: !renderMessageInTooltip || !message, lazy: false }, renderInput())) : (renderInput()))));
129
+ }
130
+ var SelectField = forwardRef(SelectFieldComponent);
131
+ export default SelectField;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { GroupBase, OptionProps } from 'react-select';
3
+ export type SelectFieldOptionProps<Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> = OptionProps<Option, IsMulti, Group>;
4
+ declare const SelectFieldOption: <Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ children, data, ...props }: SelectFieldOptionProps<Option, IsMulti, Group>) => React.JSX.Element;
5
+ export default SelectFieldOption;
@@ -0,0 +1,31 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React from 'react';
24
+ import { components } from 'react-select';
25
+ var SelectFieldOption = function (_a) {
26
+ var children = _a.children, data = _a.data, props = __rest(_a, ["children", "data"]);
27
+ var optionData = data;
28
+ return (React.createElement(components.Option, __assign({}, props, { data: data }),
29
+ React.createElement("span", { "data-test-option": JSON.stringify(optionData), "data-test-option-value": optionData.value, "data-test-option-label": optionData.label }, children)));
30
+ };
31
+ export default SelectFieldOption;
@@ -0,0 +1,21 @@
1
+ import { MouseEvent } from 'react';
2
+ import { TextFieldType } from './TextField.types';
3
+ import React from 'react';
4
+ declare const _default: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "type" | "size"> & {
5
+ label?: string | React.ReactNode;
6
+ labelColor?: string;
7
+ variant?: import("./TextField.types").TextFieldVariant;
8
+ labelType?: import("./TextField.types").TextFieldLabelType;
9
+ type?: TextFieldType;
10
+ size?: import("./TextField.types").TextFieldSize;
11
+ valid?: boolean;
12
+ message?: string | React.ReactNode;
13
+ messageColor?: string;
14
+ background?: string;
15
+ leftIcon?: React.ReactNode;
16
+ rightIcon?: React.ReactNode;
17
+ onLeftIconClick?: (event: MouseEvent<HTMLButtonElement>) => void;
18
+ onRightIconClick?: (event: MouseEvent<HTMLButtonElement>) => void;
19
+ showPasswordEyeIcon?: boolean;
20
+ } & React.RefAttributes<HTMLInputElement>>;
21
+ export default _default;
@@ -0,0 +1,87 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ import { buildClassesByJoining } from '../../utils/StyleHelper';
25
+ import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline';
26
+ import { forwardRef, useCallback, useId, useMemo, useState } from 'react';
27
+ import React from 'react';
28
+ var TextField = function (_a, ref) {
29
+ var idProp = _a.id, _b = _a.type, typeProp = _b === void 0 ? 'text' : _b, label = _a.label, _c = _a.labelColor, labelColor = _c === void 0 ? 'text-gray-700' : _c, _d = _a.labelType, labelType = _d === void 0 ? 'outside' : _d, _e = _a.variant, variant = _e === void 0 ? 'rounded' : _e, _f = _a.size, size = _f === void 0 ? 'md' : _f, _g = _a.color, color = _g === void 0 ? 'primary' : _g, _h = _a.background, background = _h === void 0 ? 'bg-white' : _h, _j = _a.autoComplete, autoComplete = _j === void 0 ? 'off' : _j, _k = _a.valid, valid = _k === void 0 ? true : _k, message = _a.message, _l = _a.messageColor, messageColor = _l === void 0 ? 'text-gray-500' : _l, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, onLeftIconClick = _a.onLeftIconClick, onRightIconClick = _a.onRightIconClick, _m = _a.showPasswordEyeIcon, showPasswordEyeIcon = _m === void 0 ? true : _m, props = __rest(_a, ["id", "type", "label", "labelColor", "labelType", "variant", "size", "color", "background", "autoComplete", "valid", "message", "messageColor", "leftIcon", "rightIcon", "onLeftIconClick", "onRightIconClick", "showPasswordEyeIcon"]);
30
+ var id = useId();
31
+ var errorColor = 'text-red-500';
32
+ var _o = useState(false), showPassword = _o[0], setShowPassword = _o[1];
33
+ var type = useMemo(function () { return (typeProp === 'password' && showPassword ? 'text' : typeProp); }, [typeProp, showPassword]);
34
+ var toggleShowPassword = useCallback(function (event) {
35
+ setShowPassword(function (prev) { return !prev; });
36
+ if (onRightIconClick)
37
+ onRightIconClick(event);
38
+ }, [onRightIconClick]);
39
+ var variantClasses = {
40
+ normal: 'border',
41
+ rounded: 'border rounded-md',
42
+ flat: 'border-b focus-within:border-b-2 focus-within:ring-0 shadow-none',
43
+ };
44
+ var sizeClasses = {
45
+ sm: 'py-0.5 px-3',
46
+ md: 'py-2 px-3',
47
+ };
48
+ var labelTypeClasses = {
49
+ outside: 'block text-sm font-medium',
50
+ inside: 'block text-xs font-medium text-gray-900',
51
+ overlapping: 'absolute -top-2 left-2 -mt-px inline-block px-1 bg-white text-xs font-medium text-gray-900',
52
+ hidden: 'sr-only',
53
+ };
54
+ var containerClasses = buildClassesByJoining('relative border-gray-300 shadow-sm focus-within:ring-1', !valid
55
+ ? 'border-red-500 focus-within:ring-red-500'
56
+ : "focus-within:ring-".concat(color, "-500 focus-within:border-").concat(color, "-500"), variantClasses[variant], sizeClasses[size], background, labelType === 'outside' && 'mt-1');
57
+ var renderLeftIcon = function () {
58
+ if (!leftIcon)
59
+ return null;
60
+ return (React.createElement("span", { className: buildClassesByJoining('absolute inset-y-0 left-0 pl-3 flex items-center', labelType === 'inside' && 'mt-4'), onClick: onLeftIconClick ? onLeftIconClick : undefined }, leftIcon));
61
+ };
62
+ var renderRightIcon = function () {
63
+ if (!rightIcon && !(typeProp === 'password' && showPasswordEyeIcon))
64
+ return null;
65
+ var icon = rightIcon;
66
+ if (typeProp === 'password' && showPasswordEyeIcon) {
67
+ var IconComponent = showPassword ? EyeIcon : EyeSlashIcon;
68
+ icon = (React.createElement(IconComponent, { className: buildClassesByJoining('h-5 w-5', !valid ? 'text-red-500' : 'text-gray-400') }));
69
+ }
70
+ return (React.createElement("span", { className: "absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer", onClick: toggleShowPassword }, icon));
71
+ };
72
+ var renderLabel = function () {
73
+ if (!label)
74
+ return null;
75
+ return (React.createElement("label", { htmlFor: id, className: buildClassesByJoining(labelTypeClasses[labelType], !valid ? errorColor : labelColor) }, label));
76
+ };
77
+ return (React.createElement("div", { className: "min-h-[80px]" },
78
+ labelType === 'outside' && renderLabel(),
79
+ React.createElement("div", { className: containerClasses },
80
+ (labelType === 'overlapping' || labelType === 'inside' || labelType === 'hidden') &&
81
+ renderLabel(),
82
+ renderLeftIcon(),
83
+ renderRightIcon(),
84
+ React.createElement("input", __assign({}, 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') }))),
85
+ message && (React.createElement("p", { className: buildClassesByJoining('mt-1.5 text-sm', !valid ? errorColor : messageColor) }, message))));
86
+ };
87
+ export default forwardRef(TextField);
@@ -0,0 +1,22 @@
1
+ import React, { MouseEvent } from 'react';
2
+ export type TextFieldSize = 'sm' | 'md';
3
+ export type TextFieldLabelType = 'outside' | 'inside' | 'overlapping' | 'hidden';
4
+ export type TextFieldVariant = 'normal' | 'rounded' | 'flat';
5
+ export type TextFieldType = 'text' | 'password' | 'email' | 'number' | 'date' | 'file';
6
+ export type TextFieldProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'children' | 'type' | 'size'> & {
7
+ label?: string | React.ReactNode;
8
+ labelColor?: string;
9
+ variant?: TextFieldVariant;
10
+ labelType?: TextFieldLabelType;
11
+ type?: TextFieldType;
12
+ size?: TextFieldSize;
13
+ valid?: boolean;
14
+ message?: string | React.ReactNode;
15
+ messageColor?: string;
16
+ background?: string;
17
+ leftIcon?: React.ReactNode;
18
+ rightIcon?: React.ReactNode;
19
+ onLeftIconClick?: (event: MouseEvent<HTMLButtonElement>) => void;
20
+ onRightIconClick?: (event: MouseEvent<HTMLButtonElement>) => void;
21
+ showPasswordEyeIcon?: boolean;
22
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { ReactNode } from 'react';
3
+ export interface TooltipRef {
4
+ show: () => void;
5
+ hide: () => void;
6
+ }
7
+ interface TooltipProps {
8
+ content?: ReactNode;
9
+ children: ReactNode;
10
+ backgroundColor?: string;
11
+ textColor?: string;
12
+ placement?: 'top' | 'bottom' | 'left' | 'right';
13
+ contentClassName?: string;
14
+ disabled?: boolean;
15
+ lazy?: boolean;
16
+ }
17
+ declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<TooltipRef>>;
18
+ export default Tooltip;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { forwardRef } from 'react';
3
+ var Tooltip = forwardRef(function (_a, ref) {
4
+ var content = _a.content, children = _a.children, _b = _a.backgroundColor, backgroundColor = _b === void 0 ? 'bg-black' : _b, _c = _a.textColor, textColor = _c === void 0 ? 'text-white' : _c, _d = _a.placement, placement = _d === void 0 ? 'bottom' : _d, _e = _a.contentClassName, contentClassName = _e === void 0 ? '' : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.lazy, lazy = _g === void 0 ? true : _g;
5
+ if (disabled)
6
+ return React.createElement(React.Fragment, null, children);
7
+ return (React.createElement("span", { className: "relative group cursor-pointer" },
8
+ children,
9
+ content && (React.createElement("span", { className: "absolute z-10 hidden group-hover:block\n ".concat(placement === 'top'
10
+ ? 'bottom-full mb-2'
11
+ : placement === 'bottom'
12
+ ? 'top-full mt-2'
13
+ : placement === 'left'
14
+ ? 'right-full mr-2'
15
+ : 'left-full ml-2', "\n left-1/2 -translate-x-1/2 px-3 py-2 rounded ").concat(backgroundColor, " ").concat(textColor, "\n text-xs whitespace-pre-wrap ").concat(contentClassName) }, content))));
16
+ });
17
+ Tooltip.displayName = 'Tooltip';
18
+ export default Tooltip;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export { default as Button } from './components/button/Button';
2
1
  export { default as Badge } from './components/badge/Badge';
2
+ export { default as Button } from './components/button/Button';
3
3
  export { default as ImageWithText } from './components/text-with-image/ImageWithText';
4
+ export { buildClassesByJoining } from './utils/StyleHelper';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // src/index.ts
2
- export { default as Button } from './components/button/Button';
3
2
  export { default as Badge } from './components/badge/Badge';
3
+ export { default as Button } from './components/button/Button';
4
4
  export { default as ImageWithText } from './components/text-with-image/ImageWithText';
5
+ export { buildClassesByJoining } from './utils/StyleHelper';
@@ -0,0 +1,4 @@
1
+ import { twMerge } from 'tailwind-merge';
2
+ export declare const buildClassesByJoining: (...args: any[]) => string;
3
+ export { twMerge };
4
+ export default buildClassesByJoining;
@@ -0,0 +1,12 @@
1
+ import classNames from 'classnames';
2
+ import { twMerge } from 'tailwind-merge';
3
+ export var buildClassesByJoining = function () {
4
+ var args = [];
5
+ for (var _i = 0; _i < arguments.length; _i++) {
6
+ args[_i] = arguments[_i];
7
+ }
8
+ var combinedClasses = classNames.apply(void 0, args);
9
+ return twMerge(combinedClasses);
10
+ };
11
+ export { twMerge };
12
+ export default buildClassesByJoining;
package/package.json CHANGED
@@ -1,55 +1,60 @@
1
- {
2
- "name": "@q2devel/q2-storybook",
3
- "version": "1.0.0",
4
- "main": "dist/index.js",
5
- "module": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "import": "./dist/index.js",
10
- "require": "./dist/index.js"
11
- }
12
- },
13
- "files": [
14
- "dist"
15
- ],
16
- "scripts": {
17
- "test": "echo \"Error: no test specified\" && exit 1",
18
- "storybook": "storybook dev -p 6006",
19
- "build-storybook": "storybook build",
20
- "build": "tsc"
21
- },
22
- "keywords": [],
23
- "author": "Q2",
24
- "license": "ISC",
25
- "description": "Komponenty nebo konfigurace pro storybook",
26
- "devDependencies": {
27
- "@storybook/addon-actions": "^8.6.12",
28
- "@storybook/addon-essentials": "^8.6.12",
29
- "@storybook/addon-interactions": "^8.6.12",
30
- "@storybook/addon-links": "^8.6.12",
31
- "@storybook/addon-onboarding": "^8.6.12",
32
- "@storybook/blocks": "^8.6.12",
33
- "@storybook/react": "^8.6.12",
34
- "@storybook/react-vite": "^8.6.12",
35
- "@storybook/test": "^8.6.12",
36
- "@types/node": "^22.14.1",
37
- "@types/react": "^19.1.2",
38
- "@types/react-dom": "^19.1.2",
39
- "autoprefixer": "^10.4.21",
40
- "postcss": "^8.5.3",
41
- "react": "^19.1.0",
42
- "react-dom": "^19.1.0",
43
- "storybook": "^8.6.12",
44
- "tailwindcss": "^4.1.4",
45
- "typescript": "^5.8.3"
46
- },
47
- "peerDependencies": {
48
- "react": "^19.0.0",
49
- "react-dom": "^19.0.0"
50
- },
51
- "dependencies": {
52
- "@tailwindcss/postcss": "^4.1.4",
53
- "html-react-parser": "^5.2.3"
54
- }
55
- }
1
+ {
2
+ "name": "@q2devel/q2-storybook",
3
+ "version": "1.0.2",
4
+ "main": "dist/index.js",
5
+ "module": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "require": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "test": "echo \"Error: no test specified\" && exit 1",
18
+ "storybook": "storybook dev -p 6006",
19
+ "build-storybook": "storybook build",
20
+ "build": "tsc"
21
+ },
22
+ "keywords": [],
23
+ "author": "Q2",
24
+ "license": "ISC",
25
+ "description": "Komponenty nebo konfigurace pro storybook",
26
+ "devDependencies": {
27
+ "@storybook/addon-actions": "^8.6.12",
28
+ "@storybook/addon-essentials": "^8.6.12",
29
+ "@storybook/addon-interactions": "^8.6.12",
30
+ "@storybook/addon-links": "^8.6.12",
31
+ "@storybook/addon-onboarding": "^8.6.12",
32
+ "@storybook/blocks": "^8.6.12",
33
+ "@storybook/react": "^8.6.12",
34
+ "@storybook/react-vite": "^8.6.12",
35
+ "@storybook/test": "^8.6.12",
36
+ "@types/classnames": "^2.3.0",
37
+ "@types/node": "^22.14.1",
38
+ "@types/react": "^19.1.2",
39
+ "@types/react-dom": "^19.1.2",
40
+ "autoprefixer": "^10.4.21",
41
+ "postcss": "^8.5.3",
42
+ "react": "^19.1.0",
43
+ "react-dom": "^19.1.0",
44
+ "storybook": "^8.6.12",
45
+ "tailwindcss": "^4.1.4",
46
+ "typescript": "^5.8.3"
47
+ },
48
+ "peerDependencies": {
49
+ "react": "^19.0.0",
50
+ "react-dom": "^19.0.0"
51
+ },
52
+ "dependencies": {
53
+ "@heroicons/react": "^2.2.0",
54
+ "@tailwindcss/postcss": "^4.1.4",
55
+ "classnames": "^2.5.1",
56
+ "html-react-parser": "^5.2.3",
57
+ "react-select": "^5.10.1",
58
+ "tailwind-merge": "^3.2.0"
59
+ }
60
+ }