@sikka/hawa 0.26.37-next → 0.26.39-next
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.
- package/dist/alert/index.js +4 -4
- package/dist/alert/index.js.map +1 -1
- package/dist/alert/index.mjs +4 -4
- package/dist/alert/index.mjs.map +1 -1
- package/dist/appLayout/index.js +4 -4
- package/dist/appLayout/index.js.map +1 -1
- package/dist/appLayout/index.mjs +4 -4
- package/dist/appLayout/index.mjs.map +1 -1
- package/dist/backToTop/index.js +4 -4
- package/dist/backToTop/index.js.map +1 -1
- package/dist/backToTop/index.mjs +4 -4
- package/dist/backToTop/index.mjs.map +1 -1
- package/dist/blocks/auth/index.d.mts +1 -2
- package/dist/blocks/auth/index.d.ts +1 -2
- package/dist/blocks/auth/index.js +4 -4
- package/dist/blocks/auth/index.mjs +4 -5
- package/dist/blocks/feedback/index.d.mts +1 -2
- package/dist/blocks/feedback/index.d.ts +1 -2
- package/dist/blocks/feedback/index.js +4 -4
- package/dist/blocks/feedback/index.mjs +5 -6
- package/dist/blocks/index.d.mts +10 -0
- package/dist/blocks/index.d.ts +10 -0
- package/dist/blocks/index.js +77 -12
- package/dist/blocks/index.mjs +75 -10
- package/dist/blocks/misc/index.d.mts +11 -1
- package/dist/blocks/misc/index.d.ts +11 -1
- package/dist/blocks/misc/index.js +249 -30
- package/dist/blocks/misc/index.mjs +80 -13
- package/dist/blocks/pricing/index.d.mts +1 -2
- package/dist/blocks/pricing/index.d.ts +1 -2
- package/dist/blocks/pricing/index.js +4 -4
- package/dist/blocks/pricing/index.mjs +4 -4
- package/dist/button/index.js +4 -4
- package/dist/button/index.js.map +1 -1
- package/dist/button/index.mjs +4 -4
- package/dist/button/index.mjs.map +1 -1
- package/dist/{chunk-SF6KYQ2D.mjs → chunk-AXTPTA3S.mjs} +1 -1
- package/dist/{chunk-AJUOAC6L.mjs → chunk-D3KUSRHL.mjs} +4 -4
- package/dist/{chunk-JTOXNQTS.mjs → chunk-LKPRTTIX.mjs} +1 -1
- package/dist/{chunk-7NRPNLHB.mjs → chunk-P7MJOYGC.mjs} +4 -4
- package/dist/{chunk-CLYZEJKB.mjs → chunk-PRSC2G4S.mjs} +1 -1
- package/dist/{chunk-RFLJK4HZ.mjs → chunk-PYUPF6LY.mjs} +1 -1
- package/dist/{chunk-JALRAL32.mjs → chunk-SUEL7HXM.mjs} +1 -1
- package/dist/{chunk-UGUBB57K.mjs → chunk-VCCUBQFI.mjs} +1 -1
- package/dist/{chunk-JCEW7MBG.mjs → chunk-YBMQJF4S.mjs} +1 -1
- package/dist/{chunk-HDFIGN6S.mjs → chunk-ZPB64CEL.mjs} +1 -1
- package/dist/codeBlock/index.js +4 -4
- package/dist/codeBlock/index.js.map +1 -1
- package/dist/codeBlock/index.mjs +4 -4
- package/dist/codeBlock/index.mjs.map +1 -1
- package/dist/dataTable/index.js +4 -4
- package/dist/dataTable/index.js.map +1 -1
- package/dist/dataTable/index.mjs +4 -4
- package/dist/dataTable/index.mjs.map +1 -1
- package/dist/docsLayout/index.js +4 -4
- package/dist/docsLayout/index.js.map +1 -1
- package/dist/docsLayout/index.mjs +4 -4
- package/dist/docsLayout/index.mjs.map +1 -1
- package/dist/elements/index.d.mts +31 -1
- package/dist/elements/index.d.ts +31 -1
- package/dist/elements/index.js +4 -4
- package/dist/elements/index.mjs +3 -3
- package/dist/fileDropzone/index.js +4 -4
- package/dist/fileDropzone/index.js.map +1 -1
- package/dist/fileDropzone/index.mjs +4 -4
- package/dist/fileDropzone/index.mjs.map +1 -1
- package/dist/index.d.mts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +77 -12
- package/dist/index.mjs +77 -12
- package/dist/input/index.d.mts +31 -1
- package/dist/input/index.d.ts +31 -1
- package/dist/input/index.js.map +1 -1
- package/dist/input/index.mjs.map +1 -1
- package/dist/layout/index.js +4 -4
- package/dist/layout/index.mjs +2 -2
- package/dist/loading/index.js +4 -4
- package/dist/loading/index.js.map +1 -1
- package/dist/loading/index.mjs +4 -4
- package/dist/loading/index.mjs.map +1 -1
- package/dist/passwordInput/index.js.map +1 -1
- package/dist/passwordInput/index.mjs.map +1 -1
- package/dist/sortButton/index.js +4 -4
- package/dist/sortButton/index.js.map +1 -1
- package/dist/sortButton/index.mjs +4 -4
- package/dist/sortButton/index.mjs.map +1 -1
- package/dist/splitButton/index.js +4 -4
- package/dist/splitButton/index.js.map +1 -1
- package/dist/splitButton/index.mjs +4 -4
- package/dist/splitButton/index.mjs.map +1 -1
- package/dist/{textTypes-559CaoOV.d.ts → textTypes-u4OSE-rn.d.mts} +8 -1
- package/dist/{textTypes-559CaoOV.d.mts → textTypes-u4OSE-rn.d.ts} +8 -1
- package/package.json +1 -1
- package/dist/chunk-WUHNPHD5.mjs +0 -0
- package/dist/commonTypes-MxCJyrHv.d.mts +0 -8
- package/dist/commonTypes-MxCJyrHv.d.ts +0 -8
package/dist/index.d.ts
CHANGED
@@ -612,6 +612,36 @@ declare const TabsTrigger: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.
|
|
612
612
|
} & React$1.RefAttributes<HTMLButtonElement>>;
|
613
613
|
declare const TabsContent: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
614
614
|
|
615
|
+
type TextFieldTypes = React__default.InputHTMLAttributes<HTMLInputElement> & {
|
616
|
+
isLoading?: boolean;
|
617
|
+
containerClassName?: string;
|
618
|
+
margin?: "none" | "normal" | "large";
|
619
|
+
width?: "small" | "normal" | "full" | "auto";
|
620
|
+
/** The label of the input field */
|
621
|
+
label?: any;
|
622
|
+
labelProps?: LabelProps;
|
623
|
+
hideSeparator?: boolean;
|
624
|
+
/** The small red text under the input field to show validation. */
|
625
|
+
helperText?: any;
|
626
|
+
forceHideHelperText?: boolean;
|
627
|
+
inputProps?: React__default.InputHTMLAttributes<HTMLInputElement>;
|
628
|
+
/** The icon inside the input field */
|
629
|
+
icon?: any;
|
630
|
+
/** Boolean to enable/disable editing the input field and using it as a text field */
|
631
|
+
preview?: boolean;
|
632
|
+
iconInside?: React__default.ReactNode;
|
633
|
+
endIcon?: React__default.ReactNode;
|
634
|
+
endIconProps?: {
|
635
|
+
className?: string;
|
636
|
+
};
|
637
|
+
startIcon?: React__default.ReactNode;
|
638
|
+
placeholder?: React__default.ReactNode;
|
639
|
+
/** Show the count of characters left in the input field. Works along with maxLength prop. */
|
640
|
+
showCount?: boolean;
|
641
|
+
countPosition?: "top" | "bottom" | "center";
|
642
|
+
popup?: boolean;
|
643
|
+
popupContent?: React__default.ReactNode;
|
644
|
+
};
|
615
645
|
declare const Input: React__default.ForwardRefExoticComponent<React__default.InputHTMLAttributes<HTMLInputElement> & {
|
616
646
|
isLoading?: boolean | undefined;
|
617
647
|
containerClassName?: string | undefined;
|
@@ -1694,6 +1724,15 @@ type ContactFormData = {
|
|
1694
1724
|
name: string;
|
1695
1725
|
email: string;
|
1696
1726
|
message: string;
|
1727
|
+
} & {
|
1728
|
+
[key: string]: string;
|
1729
|
+
};
|
1730
|
+
type CustomField = {
|
1731
|
+
label: string;
|
1732
|
+
type: "text" | "number" | "select";
|
1733
|
+
name: string;
|
1734
|
+
placeholder?: string;
|
1735
|
+
options?: RadioOptionType[];
|
1697
1736
|
};
|
1698
1737
|
type ContactFormProps = {
|
1699
1738
|
cardless?: boolean;
|
@@ -1707,6 +1746,7 @@ type ContactFormProps = {
|
|
1707
1746
|
email: TextInputType;
|
1708
1747
|
message: TextInputType;
|
1709
1748
|
};
|
1749
|
+
customFields?: CustomField[];
|
1710
1750
|
};
|
1711
1751
|
declare const ContactForm: React__default.FC<ContactFormProps>;
|
1712
1752
|
|
@@ -1934,4 +1974,4 @@ declare function useTabs(initialTab?: string): {
|
|
1934
1974
|
handleTabChange: (index: any) => void;
|
1935
1975
|
};
|
1936
1976
|
|
1937
|
-
export { Accordion, AccordionContent, AccordionItem, type AccordionItemProps, AccordionRoot, AccordionTrigger, ActionCard, AdCard, Alert, Announcement, AppLanding, AppLayout, type AppSidebarItemProps, AppStores, AppTabs, AppTopbar, Avatar, BackToTop, Badge, BadgedComponent, Breadcrumb, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CheckEmail, Checkbox, Chip, type ChipColors, type ChipTypes, CodeBlock, CodeConfirmation, ColorPicker, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ComparingPlans, ContactForm, Copyrights, Count, DataTable, DestroyableCard, Dialog, DialogBody, DialogCarousel, DialogCarouselContent, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogPortal, DialogStep, DialogSteps, DialogTitle, DialogTrigger, DocsLayout, DocsSidebar, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadio, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FeedbackEmoji, FeedbackForm, FeedbackRating, FileDropzone, FileUploader, HorizontalPricing, Input, InterfaceSettings, ItemCard, Label, type LabelProps, LandingCard, LeadGenerator, LegalTexts, Loading, LoginForm, Logos, type MenuItemType, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Navbar, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem$1 as NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, NewPasswordForm, NoPermission, NotFound, Pagination, PasswordInput, PasswordStrengthIndicator, PhoneInput, PinInput, Popover, PopoverContent, PopoverTrigger, PricingCard, PricingPlans, Progress, ProgressCircle, Radio, type RadioOptionsTypes, RegisterForm, ResetPasswordForm, ScrollArea, ScrollBar, ScrollIndicator, Select, type SelectOptionProps, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarGroup, SidebarItem, SimpleTable, Skeleton, Slider, SortButton, StandardNavigationMenuItem, Stats, StopPropagationWrapper, type SubItem$1 as SubItem, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Testimonial, Textarea, type TextareaProps, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, type ToasterToastProps, Tooltip, Usage, type UseFocusWithinOptions, type UseMediaQueryOptions, UserReferralSource, buttonVariants, navigationMenuTriggerStyle, reducer, toast, useBreakpoint, useClipboard, useDialogCarousel, useFocusWithin, useIsomorphicEffect, useMediaQuery, useMultiStepDialog, useTabs, useToast, useWindowSize };
|
1977
|
+
export { Accordion, AccordionContent, AccordionItem, type AccordionItemProps, AccordionRoot, AccordionTrigger, ActionCard, AdCard, Alert, Announcement, AppLanding, AppLayout, type AppSidebarItemProps, AppStores, AppTabs, AppTopbar, Avatar, BackToTop, Badge, BadgedComponent, Breadcrumb, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CheckEmail, Checkbox, Chip, type ChipColors, type ChipTypes, CodeBlock, CodeConfirmation, ColorPicker, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ComparingPlans, ContactForm, Copyrights, Count, DataTable, DestroyableCard, Dialog, DialogBody, DialogCarousel, DialogCarouselContent, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogPortal, DialogStep, DialogSteps, DialogTitle, DialogTrigger, DocsLayout, DocsSidebar, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadio, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FeedbackEmoji, FeedbackForm, FeedbackRating, FileDropzone, FileUploader, HorizontalPricing, Input, InterfaceSettings, ItemCard, Label, type LabelProps, LandingCard, LeadGenerator, LegalTexts, Loading, LoginForm, Logos, type MenuItemType, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Navbar, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem$1 as NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuRoot, NavigationMenuTrigger, NavigationMenuViewport, NewPasswordForm, NoPermission, NotFound, Pagination, PasswordInput, PasswordStrengthIndicator, PhoneInput, PinInput, Popover, PopoverContent, PopoverTrigger, PricingCard, PricingPlans, Progress, ProgressCircle, Radio, type RadioOptionsTypes, RegisterForm, ResetPasswordForm, ScrollArea, ScrollBar, ScrollIndicator, Select, type SelectOptionProps, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarGroup, SidebarItem, SimpleTable, Skeleton, Slider, SortButton, StandardNavigationMenuItem, Stats, StopPropagationWrapper, type SubItem$1 as SubItem, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Testimonial, type TextFieldTypes, Textarea, type TextareaProps, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, type ToasterToastProps, Tooltip, Usage, type UseFocusWithinOptions, type UseMediaQueryOptions, UserReferralSource, buttonVariants, navigationMenuTriggerStyle, reducer, toast, useBreakpoint, useClipboard, useDialogCarousel, useFocusWithin, useIsomorphicEffect, useMediaQuery, useMultiStepDialog, useTabs, useToast, useWindowSize };
|
package/dist/index.js
CHANGED
@@ -472,7 +472,7 @@ var Loading = ({
|
|
472
472
|
/* @__PURE__ */ import_react.default.createElement(
|
473
473
|
"path",
|
474
474
|
{
|
475
|
-
className: "squircle-track",
|
475
|
+
className: cn("squircle-track", classNames == null ? void 0 : classNames.track),
|
476
476
|
fill: "none",
|
477
477
|
strokeWidth: "5",
|
478
478
|
pathLength: "100",
|
@@ -482,7 +482,7 @@ var Loading = ({
|
|
482
482
|
/* @__PURE__ */ import_react.default.createElement(
|
483
483
|
"path",
|
484
484
|
{
|
485
|
-
className: "squircle-car",
|
485
|
+
className: cn("squircle-car", classNames == null ? void 0 : classNames.car),
|
486
486
|
fill: "none",
|
487
487
|
strokeWidth: "5",
|
488
488
|
pathLength: "100",
|
@@ -491,9 +491,9 @@ var Loading = ({
|
|
491
491
|
)
|
492
492
|
);
|
493
493
|
case "progress":
|
494
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: "progress-loading" });
|
494
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: cn("progress-loading", classNames == null ? void 0 : classNames.container) });
|
495
495
|
case "orbit":
|
496
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: "orbit-container" });
|
496
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: cn("orbit-container", classNames == null ? void 0 : classNames.container) });
|
497
497
|
default:
|
498
498
|
return /* @__PURE__ */ import_react.default.createElement(
|
499
499
|
"svg",
|
@@ -10756,25 +10756,56 @@ var ContactForm = ({
|
|
10756
10756
|
texts,
|
10757
10757
|
formId,
|
10758
10758
|
formAutoComplete,
|
10759
|
-
onSubmit
|
10759
|
+
onSubmit,
|
10760
|
+
customFields
|
10760
10761
|
}) => {
|
10761
10762
|
var _a, _b, _c;
|
10763
|
+
const customFieldsSchema = z8.object({
|
10764
|
+
...customFields == null ? void 0 : customFields.reduce(
|
10765
|
+
(acc, curr) => {
|
10766
|
+
switch (curr.type) {
|
10767
|
+
case "text":
|
10768
|
+
acc[curr.name] = z8.string().optional().default("");
|
10769
|
+
break;
|
10770
|
+
case "number":
|
10771
|
+
acc[curr.name] = z8.string().optional().default("");
|
10772
|
+
break;
|
10773
|
+
case "select":
|
10774
|
+
acc[curr.name] = z8.string().optional().default("");
|
10775
|
+
break;
|
10776
|
+
default:
|
10777
|
+
break;
|
10778
|
+
}
|
10779
|
+
return acc;
|
10780
|
+
},
|
10781
|
+
{}
|
10782
|
+
)
|
10783
|
+
});
|
10762
10784
|
const contactFormSchema = z8.object({
|
10763
10785
|
name: z8.string({ required_error: texts == null ? void 0 : texts.name.required }).min(1, texts == null ? void 0 : texts.name.required).default(""),
|
10764
10786
|
email: z8.string({ required_error: (_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required }).email({ message: (_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid }).default(""),
|
10765
10787
|
message: z8.string({ required_error: texts == null ? void 0 : texts.message.required }).min(10, texts == null ? void 0 : texts.message.invalid).default("")
|
10766
10788
|
});
|
10789
|
+
const customFieldsDefaultValues = customFields == null ? void 0 : customFields.reduce(
|
10790
|
+
(acc, curr) => {
|
10791
|
+
acc[curr.name] = "";
|
10792
|
+
return acc;
|
10793
|
+
},
|
10794
|
+
{}
|
10795
|
+
);
|
10796
|
+
const MainSchema = contactFormSchema.merge(customFieldsSchema);
|
10767
10797
|
const {
|
10768
10798
|
control,
|
10769
10799
|
handleSubmit,
|
10770
10800
|
formState: { errors },
|
10771
10801
|
reset
|
10772
10802
|
} = (0, import_react_hook_form9.useForm)({
|
10773
|
-
resolver: (0, import_zod8.zodResolver)(
|
10803
|
+
resolver: (0, import_zod8.zodResolver)(MainSchema),
|
10774
10804
|
defaultValues: {
|
10775
10805
|
name: "",
|
10776
10806
|
email: "",
|
10777
|
-
message: ""
|
10807
|
+
message: "",
|
10808
|
+
...customFieldsDefaultValues
|
10778
10809
|
}
|
10779
10810
|
});
|
10780
10811
|
const handleFormSubmit = (data) => {
|
@@ -10785,15 +10816,10 @@ var ContactForm = ({
|
|
10785
10816
|
console.log("Form is submitted but onSubmit prop is missing");
|
10786
10817
|
}
|
10787
10818
|
};
|
10788
|
-
let sizeStyle = {
|
10789
|
-
sm: "hawa-max-w-sm",
|
10790
|
-
default: "hawa-w-full"
|
10791
|
-
};
|
10792
10819
|
return /* @__PURE__ */ import_react64.default.createElement(
|
10793
10820
|
Card,
|
10794
10821
|
{
|
10795
10822
|
className: cn(
|
10796
|
-
// sizeStyle[size],
|
10797
10823
|
"hawa-w-full",
|
10798
10824
|
cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none"
|
10799
10825
|
),
|
@@ -10860,6 +10886,45 @@ var ContactForm = ({
|
|
10860
10886
|
}
|
10861
10887
|
)
|
10862
10888
|
),
|
10889
|
+
customFields && customFields.map((customField) => {
|
10890
|
+
console.log("custom", customField);
|
10891
|
+
return /* @__PURE__ */ import_react64.default.createElement(
|
10892
|
+
import_react_hook_form9.Controller,
|
10893
|
+
{
|
10894
|
+
control,
|
10895
|
+
name: customField.name,
|
10896
|
+
render: ({ field }) => {
|
10897
|
+
const { type, label, placeholder } = customField;
|
10898
|
+
switch (type) {
|
10899
|
+
case "text":
|
10900
|
+
case "number":
|
10901
|
+
return /* @__PURE__ */ import_react64.default.createElement(
|
10902
|
+
Input,
|
10903
|
+
{
|
10904
|
+
id: customField.name,
|
10905
|
+
type,
|
10906
|
+
label,
|
10907
|
+
placeholder,
|
10908
|
+
...field
|
10909
|
+
}
|
10910
|
+
);
|
10911
|
+
case "select":
|
10912
|
+
return /* @__PURE__ */ import_react64.default.createElement(
|
10913
|
+
Select,
|
10914
|
+
{
|
10915
|
+
label,
|
10916
|
+
options: customField.options,
|
10917
|
+
value: field.value,
|
10918
|
+
onChange: (option) => field.onChange(option.value)
|
10919
|
+
}
|
10920
|
+
);
|
10921
|
+
default:
|
10922
|
+
return /* @__PURE__ */ import_react64.default.createElement("div", null, "Unknown type");
|
10923
|
+
}
|
10924
|
+
}
|
10925
|
+
}
|
10926
|
+
);
|
10927
|
+
}),
|
10863
10928
|
/* @__PURE__ */ import_react64.default.createElement(
|
10864
10929
|
import_react_hook_form9.Controller,
|
10865
10930
|
{
|
package/dist/index.mjs
CHANGED
@@ -239,7 +239,7 @@ var Loading = ({
|
|
239
239
|
/* @__PURE__ */ React2.createElement(
|
240
240
|
"path",
|
241
241
|
{
|
242
|
-
className: "squircle-track",
|
242
|
+
className: cn("squircle-track", classNames == null ? void 0 : classNames.track),
|
243
243
|
fill: "none",
|
244
244
|
strokeWidth: "5",
|
245
245
|
pathLength: "100",
|
@@ -249,7 +249,7 @@ var Loading = ({
|
|
249
249
|
/* @__PURE__ */ React2.createElement(
|
250
250
|
"path",
|
251
251
|
{
|
252
|
-
className: "squircle-car",
|
252
|
+
className: cn("squircle-car", classNames == null ? void 0 : classNames.car),
|
253
253
|
fill: "none",
|
254
254
|
strokeWidth: "5",
|
255
255
|
pathLength: "100",
|
@@ -258,9 +258,9 @@ var Loading = ({
|
|
258
258
|
)
|
259
259
|
);
|
260
260
|
case "progress":
|
261
|
-
return /* @__PURE__ */ React2.createElement("div", { className: "progress-loading" });
|
261
|
+
return /* @__PURE__ */ React2.createElement("div", { className: cn("progress-loading", classNames == null ? void 0 : classNames.container) });
|
262
262
|
case "orbit":
|
263
|
-
return /* @__PURE__ */ React2.createElement("div", { className: "orbit-container" });
|
263
|
+
return /* @__PURE__ */ React2.createElement("div", { className: cn("orbit-container", classNames == null ? void 0 : classNames.container) });
|
264
264
|
default:
|
265
265
|
return /* @__PURE__ */ React2.createElement(
|
266
266
|
"svg",
|
@@ -10542,25 +10542,56 @@ var ContactForm = ({
|
|
10542
10542
|
texts,
|
10543
10543
|
formId,
|
10544
10544
|
formAutoComplete,
|
10545
|
-
onSubmit
|
10545
|
+
onSubmit,
|
10546
|
+
customFields
|
10546
10547
|
}) => {
|
10547
10548
|
var _a, _b, _c;
|
10549
|
+
const customFieldsSchema = z8.object({
|
10550
|
+
...customFields == null ? void 0 : customFields.reduce(
|
10551
|
+
(acc, curr) => {
|
10552
|
+
switch (curr.type) {
|
10553
|
+
case "text":
|
10554
|
+
acc[curr.name] = z8.string().optional().default("");
|
10555
|
+
break;
|
10556
|
+
case "number":
|
10557
|
+
acc[curr.name] = z8.string().optional().default("");
|
10558
|
+
break;
|
10559
|
+
case "select":
|
10560
|
+
acc[curr.name] = z8.string().optional().default("");
|
10561
|
+
break;
|
10562
|
+
default:
|
10563
|
+
break;
|
10564
|
+
}
|
10565
|
+
return acc;
|
10566
|
+
},
|
10567
|
+
{}
|
10568
|
+
)
|
10569
|
+
});
|
10548
10570
|
const contactFormSchema = z8.object({
|
10549
10571
|
name: z8.string({ required_error: texts == null ? void 0 : texts.name.required }).min(1, texts == null ? void 0 : texts.name.required).default(""),
|
10550
10572
|
email: z8.string({ required_error: (_a = texts == null ? void 0 : texts.email) == null ? void 0 : _a.required }).min(1, { message: (_b = texts == null ? void 0 : texts.email) == null ? void 0 : _b.required }).email({ message: (_c = texts == null ? void 0 : texts.email) == null ? void 0 : _c.invalid }).default(""),
|
10551
10573
|
message: z8.string({ required_error: texts == null ? void 0 : texts.message.required }).min(10, texts == null ? void 0 : texts.message.invalid).default("")
|
10552
10574
|
});
|
10575
|
+
const customFieldsDefaultValues = customFields == null ? void 0 : customFields.reduce(
|
10576
|
+
(acc, curr) => {
|
10577
|
+
acc[curr.name] = "";
|
10578
|
+
return acc;
|
10579
|
+
},
|
10580
|
+
{}
|
10581
|
+
);
|
10582
|
+
const MainSchema = contactFormSchema.merge(customFieldsSchema);
|
10553
10583
|
const {
|
10554
10584
|
control,
|
10555
10585
|
handleSubmit,
|
10556
10586
|
formState: { errors },
|
10557
10587
|
reset
|
10558
10588
|
} = useForm9({
|
10559
|
-
resolver: zodResolver8(
|
10589
|
+
resolver: zodResolver8(MainSchema),
|
10560
10590
|
defaultValues: {
|
10561
10591
|
name: "",
|
10562
10592
|
email: "",
|
10563
|
-
message: ""
|
10593
|
+
message: "",
|
10594
|
+
...customFieldsDefaultValues
|
10564
10595
|
}
|
10565
10596
|
});
|
10566
10597
|
const handleFormSubmit = (data) => {
|
@@ -10571,15 +10602,10 @@ var ContactForm = ({
|
|
10571
10602
|
console.log("Form is submitted but onSubmit prop is missing");
|
10572
10603
|
}
|
10573
10604
|
};
|
10574
|
-
let sizeStyle = {
|
10575
|
-
sm: "hawa-max-w-sm",
|
10576
|
-
default: "hawa-w-full"
|
10577
|
-
};
|
10578
10605
|
return /* @__PURE__ */ React91.createElement(
|
10579
10606
|
Card,
|
10580
10607
|
{
|
10581
10608
|
className: cn(
|
10582
|
-
// sizeStyle[size],
|
10583
10609
|
"hawa-w-full",
|
10584
10610
|
cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none"
|
10585
10611
|
),
|
@@ -10646,6 +10672,45 @@ var ContactForm = ({
|
|
10646
10672
|
}
|
10647
10673
|
)
|
10648
10674
|
),
|
10675
|
+
customFields && customFields.map((customField) => {
|
10676
|
+
console.log("custom", customField);
|
10677
|
+
return /* @__PURE__ */ React91.createElement(
|
10678
|
+
Controller9,
|
10679
|
+
{
|
10680
|
+
control,
|
10681
|
+
name: customField.name,
|
10682
|
+
render: ({ field }) => {
|
10683
|
+
const { type, label, placeholder } = customField;
|
10684
|
+
switch (type) {
|
10685
|
+
case "text":
|
10686
|
+
case "number":
|
10687
|
+
return /* @__PURE__ */ React91.createElement(
|
10688
|
+
Input,
|
10689
|
+
{
|
10690
|
+
id: customField.name,
|
10691
|
+
type,
|
10692
|
+
label,
|
10693
|
+
placeholder,
|
10694
|
+
...field
|
10695
|
+
}
|
10696
|
+
);
|
10697
|
+
case "select":
|
10698
|
+
return /* @__PURE__ */ React91.createElement(
|
10699
|
+
Select,
|
10700
|
+
{
|
10701
|
+
label,
|
10702
|
+
options: customField.options,
|
10703
|
+
value: field.value,
|
10704
|
+
onChange: (option) => field.onChange(option.value)
|
10705
|
+
}
|
10706
|
+
);
|
10707
|
+
default:
|
10708
|
+
return /* @__PURE__ */ React91.createElement("div", null, "Unknown type");
|
10709
|
+
}
|
10710
|
+
}
|
10711
|
+
}
|
10712
|
+
);
|
10713
|
+
}),
|
10649
10714
|
/* @__PURE__ */ React91.createElement(
|
10650
10715
|
Controller9,
|
10651
10716
|
{
|
package/dist/input/index.d.mts
CHANGED
@@ -9,6 +9,36 @@ type LabelProps = {
|
|
9
9
|
required?: boolean;
|
10
10
|
};
|
11
11
|
|
12
|
+
type TextFieldTypes = React__default.InputHTMLAttributes<HTMLInputElement> & {
|
13
|
+
isLoading?: boolean;
|
14
|
+
containerClassName?: string;
|
15
|
+
margin?: "none" | "normal" | "large";
|
16
|
+
width?: "small" | "normal" | "full" | "auto";
|
17
|
+
/** The label of the input field */
|
18
|
+
label?: any;
|
19
|
+
labelProps?: LabelProps;
|
20
|
+
hideSeparator?: boolean;
|
21
|
+
/** The small red text under the input field to show validation. */
|
22
|
+
helperText?: any;
|
23
|
+
forceHideHelperText?: boolean;
|
24
|
+
inputProps?: React__default.InputHTMLAttributes<HTMLInputElement>;
|
25
|
+
/** The icon inside the input field */
|
26
|
+
icon?: any;
|
27
|
+
/** Boolean to enable/disable editing the input field and using it as a text field */
|
28
|
+
preview?: boolean;
|
29
|
+
iconInside?: React__default.ReactNode;
|
30
|
+
endIcon?: React__default.ReactNode;
|
31
|
+
endIconProps?: {
|
32
|
+
className?: string;
|
33
|
+
};
|
34
|
+
startIcon?: React__default.ReactNode;
|
35
|
+
placeholder?: React__default.ReactNode;
|
36
|
+
/** Show the count of characters left in the input field. Works along with maxLength prop. */
|
37
|
+
showCount?: boolean;
|
38
|
+
countPosition?: "top" | "bottom" | "center";
|
39
|
+
popup?: boolean;
|
40
|
+
popupContent?: React__default.ReactNode;
|
41
|
+
};
|
12
42
|
declare const Input: React__default.ForwardRefExoticComponent<React__default.InputHTMLAttributes<HTMLInputElement> & {
|
13
43
|
isLoading?: boolean | undefined;
|
14
44
|
containerClassName?: string | undefined;
|
@@ -40,4 +70,4 @@ declare const Input: React__default.ForwardRefExoticComponent<React__default.Inp
|
|
40
70
|
popupContent?: React__default.ReactNode;
|
41
71
|
} & React__default.RefAttributes<HTMLInputElement>>;
|
42
72
|
|
43
|
-
export { Input };
|
73
|
+
export { Input, type TextFieldTypes };
|
package/dist/input/index.d.ts
CHANGED
@@ -9,6 +9,36 @@ type LabelProps = {
|
|
9
9
|
required?: boolean;
|
10
10
|
};
|
11
11
|
|
12
|
+
type TextFieldTypes = React__default.InputHTMLAttributes<HTMLInputElement> & {
|
13
|
+
isLoading?: boolean;
|
14
|
+
containerClassName?: string;
|
15
|
+
margin?: "none" | "normal" | "large";
|
16
|
+
width?: "small" | "normal" | "full" | "auto";
|
17
|
+
/** The label of the input field */
|
18
|
+
label?: any;
|
19
|
+
labelProps?: LabelProps;
|
20
|
+
hideSeparator?: boolean;
|
21
|
+
/** The small red text under the input field to show validation. */
|
22
|
+
helperText?: any;
|
23
|
+
forceHideHelperText?: boolean;
|
24
|
+
inputProps?: React__default.InputHTMLAttributes<HTMLInputElement>;
|
25
|
+
/** The icon inside the input field */
|
26
|
+
icon?: any;
|
27
|
+
/** Boolean to enable/disable editing the input field and using it as a text field */
|
28
|
+
preview?: boolean;
|
29
|
+
iconInside?: React__default.ReactNode;
|
30
|
+
endIcon?: React__default.ReactNode;
|
31
|
+
endIconProps?: {
|
32
|
+
className?: string;
|
33
|
+
};
|
34
|
+
startIcon?: React__default.ReactNode;
|
35
|
+
placeholder?: React__default.ReactNode;
|
36
|
+
/** Show the count of characters left in the input field. Works along with maxLength prop. */
|
37
|
+
showCount?: boolean;
|
38
|
+
countPosition?: "top" | "bottom" | "center";
|
39
|
+
popup?: boolean;
|
40
|
+
popupContent?: React__default.ReactNode;
|
41
|
+
};
|
12
42
|
declare const Input: React__default.ForwardRefExoticComponent<React__default.InputHTMLAttributes<HTMLInputElement> & {
|
13
43
|
isLoading?: boolean | undefined;
|
14
44
|
containerClassName?: string | undefined;
|
@@ -40,4 +70,4 @@ declare const Input: React__default.ForwardRefExoticComponent<React__default.Inp
|
|
40
70
|
popupContent?: React__default.ReactNode;
|
41
71
|
} & React__default.RefAttributes<HTMLInputElement>>;
|
42
72
|
|
43
|
-
export { Input };
|
73
|
+
export { Input, type TextFieldTypes };
|
package/dist/input/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../elements/input/index.ts","../../elements/input/Input.tsx","../../util/index.ts","../../elements/label/Label.tsx","../../elements/tooltip/Tooltip.tsx","../../elements/skeleton/Skeleton.tsx"],"sourcesContent":["export * from \"./Input\";\n","import React, { forwardRef } from \"react\";\n\nimport { cn } from \"@util/index\";\nimport { Label, LabelProps } from \"../label/Label\";\nimport { Skeleton } from \"../skeleton/Skeleton\";\n\ntype TextFieldTypes = React.InputHTMLAttributes<HTMLInputElement> & {\n isLoading?: boolean;\n containerClassName?: string;\n margin?: \"none\" | \"normal\" | \"large\";\n width?: \"small\" | \"normal\" | \"full\" | \"auto\";\n /** The label of the input field */\n label?: any;\n labelProps?: LabelProps;\n\n hideSeparator?: boolean;\n /** The small red text under the input field to show validation. */\n helperText?: any;\n forceHideHelperText?: boolean;\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /** The icon inside the input field */\n icon?: any;\n /** Boolean to enable/disable editing the input field and using it as a text field */\n preview?: boolean;\n // maxLength?: any;\n iconInside?: React.ReactNode;\n endIcon?: React.ReactNode;\n endIconProps?: { className?: string };\n startIcon?: React.ReactNode;\n placeholder?: React.ReactNode;\n /** Show the count of characters left in the input field. Works along with maxLength prop. */\n showCount?: boolean;\n countPosition?: \"top\" | \"bottom\" | \"center\";\n popup?: boolean;\n popupContent?: React.ReactNode;\n};\nexport const Input = forwardRef<HTMLInputElement, TextFieldTypes>(\n (\n {\n margin = \"none\",\n width = \"full\",\n preview = false,\n forceHideHelperText = false,\n labelProps,\n placeholder,\n showCount,\n inputProps,\n countPosition = \"bottom\",\n ...props\n },\n ref\n ) => {\n let marginStyles = {\n none: \"hawa-mb-0\",\n normal: \"hawa-mb-3\",\n large: \"hawa-mb-5\"\n };\n let widthStyles = {\n small: \"hawa-w-full hawa-max-w-2xs\",\n normal: \"hawa-w-1/2\",\n full: \"hawa-w-full\",\n auto: \"\"\n };\n\n let defaultStyle =\n \"hawa-flex hawa-max-h-fit hawa-h-fit hawa-relative hawa-flex-col hawa-justify-center hawa-gap-0\";\n let defaultInputStyle =\n \"hawa-block hawa-w-full hawa-rounded hawa-border hawa-transition-all hawa-bg-background hawa-p-3 hawa-text-sm \";\n\n return (\n <div\n className={cn(\n defaultStyle,\n marginStyles[margin],\n widthStyles[width],\n props.containerClassName,\n \"hawa-w-full hawa-gap-2\"\n )}\n >\n {props.label && <Label {...labelProps}>{props.label}</Label>}\n {props.isLoading ? (\n <div className=\"hawa-pb-2\">\n <Skeleton className=\"hawa-h-[40px] hawa-w-full\" />\n </div>\n ) : (\n <>\n {!props.hideSeparator && (\n <div\n className={cn(\n \"hawa-absolute hawa-top-[22px] hawa-h-[0.8px] hawa-w-full hawa-bg-gray-200 hawa-transition-all dark:hawa-bg-gray-800\",\n preview ? \"hawa-opacity-100\" : \"hawa-opacity-0\"\n )}\n ></div>\n )}\n <>\n <div className={\"hawa-relative\"}>\n {props.startIcon && (\n <div className=\"hawa-absolute hawa-start-3 hawa-top-1/2 hawa--translate-y-1/2\">\n {props.startIcon}\n </div>\n )}\n {props.endIcon && (\n <div\n className={cn(\n \"hawa-absolute hawa-end-3 hawa-top-1/2 hawa--translate-y-1/2\",\n props.endIconProps?.className\n )}\n >\n {props.endIcon}\n </div>\n )}\n <input\n required\n dir={props.dir}\n type={props.type}\n value={props.value}\n onChange={props.onChange}\n autoComplete={props.autoComplete}\n defaultValue={props.defaultValue}\n placeholder={placeholder}\n disabled={props.disabled || preview}\n style={{ height: 40 }}\n {...inputProps}\n className={cn(\n defaultInputStyle,\n \" focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-0 dark:hawa-text-white\",\n {\n \"hawa-pe-9\": props.endIcon,\n \"hawa-ps-9\": props.startIcon,\n \"hawa-pe-[60px]\": countPosition === \"center\"\n },\n preview &&\n \"hawa-border-transparent hawa-bg-transparent hawa-px-0\",\n inputProps?.className\n )}\n />\n </div>\n\n {/* Regular helper text */}\n {!forceHideHelperText && (\n <p\n className={cn(\n \"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all\",\n props.helperText\n ? \"hawa-h-4 hawa-opacity-100\"\n : \"hawa-h-0 hawa-opacity-0\"\n )}\n >\n {props.helperText}\n </p>\n )}\n {/* Popover helper text */}\n {!props.disabled && forceHideHelperText && (\n <div\n className={cn(\n \"hawa-absolute hawa-end-0 hawa-top-[47px] hawa-z-20 hawa-translate-y-1/2 hawa-rounded hawa-bg-background hawa-text-start hawa-text-xs hawa-text-helper-color hawa-drop-shadow-md hawa-transition-all\",\n props.helperText\n ? \"hawa-border hawa-p-1\"\n : \"hawa-border-none hawa-p-0\"\n )}\n >\n {props.helperText}\n </div>\n )}\n {/* Character Counter */}\n {showCount && (\n <div\n className={cn(\n \"hawa-absolute hawa-translate-y-1/2 hawa-text-start hawa-text-xs hawa-transition-all\",\n {\n \"hawa-end-0 hawa-top-[62px]\": countPosition === \"bottom\",\n \"hawa-bottom-[62px] hawa-end-0\": countPosition === \"top\",\n \"hawa-end-2\": countPosition === \"center\"\n }\n )}\n >\n {props.value ? String(props.value).length : 0}/\n {props.maxLength}\n </div>\n )}\n\n {/* Popover helper text */}\n {/* {props.popup && (\n <div\n className={cn(\n \"hawa-absolute hawa-top-[47px] hawa-min-h-fit hawa-w-full hawa-text-xs hawa-text-helper-color hawa-transition-all hawa-text-start hawa-rounded hawa-end-0 hawa-z-20 hawa-drop-shadow-md hawa-bg-background hawa-translate-y-1/2\",\n props.helperText\n ? \"hawa-border hawa-p-1\"\n : \"hawa-border-none hawa-p-0\"\n )}\n >\n {props.popupContent}\n </div>\n )} */}\n </>\n </>\n )}\n </div>\n );\n }\n);\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\ntype Palette = {\n name: string;\n colors: {\n [key: number]: string;\n };\n};\ntype Rgb = {\n r: number;\n g: number;\n b: number;\n};\nfunction hexToRgb(hex: string): Rgb | null {\n const sanitizedHex = hex.replaceAll(\"##\", \"#\");\n const colorParts = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(\n sanitizedHex\n );\n\n if (!colorParts) {\n return null;\n }\n\n const [, r, g, b] = colorParts;\n\n return {\n r: parseInt(r, 16),\n g: parseInt(g, 16),\n b: parseInt(b, 16)\n } as Rgb;\n}\n\nfunction rgbToHex(r: number, g: number, b: number): string {\n const toHex = (c: number) => `0${c.toString(16)}`.slice(-2);\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}\n\nexport function getTextColor(color: string): \"#FFF\" | \"#333\" {\n const rgbColor = hexToRgb(color);\n\n if (!rgbColor) {\n return \"#333\";\n }\n\n const { r, g, b } = rgbColor;\n const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n return luma < 120 ? \"#FFF\" : \"#333\";\n}\n\nfunction lighten(hex: string, intensity: number): string {\n const color = hexToRgb(`#${hex}`);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r + (255 - color.r) * intensity);\n const g = Math.round(color.g + (255 - color.g) * intensity);\n const b = Math.round(color.b + (255 - color.b) * intensity);\n\n return rgbToHex(r, g, b);\n}\n\nfunction darken(hex: string, intensity: number): string {\n const color = hexToRgb(hex);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r * intensity);\n const g = Math.round(color.g * intensity);\n const b = Math.round(color.b * intensity);\n\n return rgbToHex(r, g, b);\n}\nconst parseColor = (color: any) => {\n if (color.startsWith(\"#\")) {\n // Convert hex to RGB\n let r = parseInt(color.slice(1, 3), 16);\n let g = parseInt(color.slice(3, 5), 16);\n let b = parseInt(color.slice(5, 7), 16);\n return [r, g, b];\n } else if (color.startsWith(\"rgb\")) {\n // Extract RGB values from rgb() format\n return color.match(/\\d+/g).map(Number);\n }\n // Default to white if format is unrecognized\n return [255, 255, 255];\n};\nexport const calculateLuminance = (color: any) => {\n const [r, g, b] = parseColor(color)?.map((c: any) => {\n c /= 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nfunction getPallette(baseColor: string): Palette {\n const name = baseColor;\n\n const response: Palette = {\n name,\n colors: {\n 500: `#${baseColor}`.replace(\"##\", \"#\")\n }\n };\n\n const intensityMap: {\n [key: number]: number;\n } = {\n 50: 0.95,\n 100: 0.9,\n 200: 0.75,\n 300: 0.6,\n 400: 0.3,\n 600: 0.9,\n 700: 0.75,\n 800: 0.6,\n 900: 0.49\n };\n\n [50, 100, 200, 300, 400].forEach((level) => {\n response.colors[level] = lighten(baseColor, intensityMap[level]);\n });\n [600, 700, 800, 900].forEach((level) => {\n response.colors[level] = darken(baseColor, intensityMap[level]);\n });\n\n return response as Palette;\n}\n\nexport { getPallette };\n\n// const hexToRgb = (hex) => {\n// let d = hex?.split(\"#\")[1];\n// var aRgbHex = d?.match(/.{1,2}/g);\n// var aRgb = [\n// parseInt(aRgbHex[0], 16),\n// parseInt(aRgbHex[1], 16),\n// parseInt(aRgbHex[2], 16)\n// ];\n// return aRgb;\n// };\n// const getTextColor = (backColor) => {\n// let rgbArray = hexToRgb(backColor);\n// if (rgbArray[0] * 0.299 + rgbArray[1] * 0.587 + rgbArray[2] * 0.114 > 186) {\n// return \"#000000\";\n// } else {\n// return \"#ffffff\";\n// }\n// };\n// const replaceAt = function (string, index, replacement) {\n// // if (replacement == \"\" || replacement == \" \") {\n// // return (\n// // string.substring(0, index) +\n// // string.substring(index + replacement.length )\n// // );\n// // }\n// const replaced = string.substring(0, index) + replacement + string.substring(index + 1)\n// return replaced\n// };\n\n// export { hexToRgb, getTextColor, replaceAt };\n","import * as React from \"react\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nimport { cn } from \"@util/index\";\nimport { Tooltip } from \"../tooltip\";\n\nexport type LabelProps = {\n hint?: React.ReactNode;\n hintSide?: PositionType;\n htmlFor?: string;\n required?: boolean;\n};\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement> & LabelProps\n>(({ className, hint, hintSide, required, children, ...props }, ref) => (\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-1 hawa-transition-all\">\n <label\n ref={ref}\n className={cn(\n \"hawa-text-sm hawa-font-medium hawa-leading-none peer-disabled:hawa-cursor-not-allowed peer-disabled:hawa-opacity-70\",\n className\n )}\n {...props}\n >\n {children}\n {required && <span className=\"hawa-mx-0.5 hawa-text-red-500\">*</span>}\n </label>\n {hint && (\n <Tooltip\n content={hint}\n side={hintSide}\n triggerProps={{\n tabIndex: -1,\n onClick: (event) => event.preventDefault()\n }}\n >\n <div>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"hawa-h-[14px] hawa-w-[14px] hawa-cursor-help\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n </div>\n </Tooltip>\n )}\n </div>\n));\n\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import React from \"react\";\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nimport { cn } from \"@util/index\";\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nconst TooltipArrow = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <TooltipPrimitive.Arrow ref={ref} className={cn(className)} {...props} />\n));\nTooltipArrow.displayName = TooltipPrimitive.Arrow.displayName;\n\ntype TooltipTypes = {\n /** Controls the open state of the tooltip. */\n open?: any;\n /** Specifies the side where the tooltip will appear. */\n side?: PositionType;\n /** Content to be displayed within the tooltip. */\n content?: any;\n /** Elements to which the tooltip is anchored. */\n children?: any;\n /** Sets the default open state of the tooltip. */\n defaultOpen?: any;\n /** Event handler for open state changes. */\n onOpenChange?: any;\n /** Duration of the delay before the tooltip appears. */\n delayDuration?: any;\n triggerProps?: TooltipPrimitive.TooltipTriggerProps;\n contentProps?: TooltipPrimitive.TooltipContentProps;\n providerProps?: TooltipPrimitive.TooltipProviderProps;\n};\n\nconst Tooltip: React.FunctionComponent<TooltipTypes> = ({\n side,\n open,\n content,\n children,\n defaultOpen,\n onOpenChange,\n triggerProps,\n contentProps,\n providerProps,\n delayDuration = 300,\n ...props\n}) => {\n return (\n <TooltipPrimitive.TooltipProvider\n delayDuration={delayDuration}\n {...providerProps}\n >\n <TooltipPrimitive.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n {...props}\n >\n <TooltipPrimitive.Trigger {...triggerProps}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipContent side={side} align=\"center\" {...contentProps}>\n {content}\n </TooltipContent>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.TooltipProvider>\n );\n};\n\nexport { Tooltip };\n","import React from \"react\";\n\nimport { cn } from \"@util/index\";\n\ninterface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n className?: string;\n animation?: \"none\" | \"pulse\" | \"shimmer\";\n content?: any;\n}\n\nfunction Skeleton({\n className,\n content,\n animation = \"pulse\",\n ...props\n}: SkeletonProps) {\n const animationStyles = {\n none: \"hawa-rounded hawa-bg-muted\",\n pulse: \"hawa-animate-pulse hawa-rounded hawa-bg-muted\",\n shimmer:\n \"hawa-space-y-5 hawa-rounded hawa-bg-muted hawa-p-4 hawa-relative before:hawa-absolute before:hawa-inset-0 before:hawa--translate-x-full before:hawa-animate-[shimmer_2s_infinite] before:hawa-bg-gradient-to-r before:hawa-from-transparent before:hawa-via-gray-300/40 dark:before:hawa-via-white/10 before:hawa-to-transparent hawa-isolate hawa-overflow-hidden before:hawa-border-t before:hawa-border-rose-100/10\"\n };\n return (\n <div\n className={cn(\n animationStyles[animation],\n content &&\n \"hawa-flex hawa-flex-col hawa-items-center hawa-justify-center\",\n className\n )}\n {...props}\n >\n {content && content}\n </div>\n );\n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
{"version":3,"sources":["../../elements/input/index.ts","../../elements/input/Input.tsx","../../util/index.ts","../../elements/label/Label.tsx","../../elements/tooltip/Tooltip.tsx","../../elements/skeleton/Skeleton.tsx"],"sourcesContent":["export * from \"./Input\";\n","import React, { forwardRef } from \"react\";\n\nimport { cn } from \"@util/index\";\n\nimport { Label, LabelProps } from \"../label/Label\";\nimport { Skeleton } from \"../skeleton/Skeleton\";\n\nexport type TextFieldTypes = React.InputHTMLAttributes<HTMLInputElement> & {\n isLoading?: boolean;\n containerClassName?: string;\n margin?: \"none\" | \"normal\" | \"large\";\n width?: \"small\" | \"normal\" | \"full\" | \"auto\";\n /** The label of the input field */\n label?: any;\n labelProps?: LabelProps;\n hideSeparator?: boolean;\n /** The small red text under the input field to show validation. */\n helperText?: any;\n forceHideHelperText?: boolean;\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /** The icon inside the input field */\n icon?: any;\n /** Boolean to enable/disable editing the input field and using it as a text field */\n preview?: boolean;\n // maxLength?: any;\n iconInside?: React.ReactNode;\n endIcon?: React.ReactNode;\n endIconProps?: { className?: string };\n startIcon?: React.ReactNode;\n placeholder?: React.ReactNode;\n /** Show the count of characters left in the input field. Works along with maxLength prop. */\n showCount?: boolean;\n countPosition?: \"top\" | \"bottom\" | \"center\";\n popup?: boolean;\n popupContent?: React.ReactNode;\n};\nexport const Input = forwardRef<HTMLInputElement, TextFieldTypes>(\n (\n {\n margin = \"none\",\n width = \"full\",\n preview = false,\n forceHideHelperText = false,\n labelProps,\n placeholder,\n showCount,\n inputProps,\n countPosition = \"bottom\",\n ...props\n },\n ref\n ) => {\n let marginStyles = {\n none: \"hawa-mb-0\",\n normal: \"hawa-mb-3\",\n large: \"hawa-mb-5\"\n };\n let widthStyles = {\n small: \"hawa-w-full hawa-max-w-2xs\",\n normal: \"hawa-w-1/2\",\n full: \"hawa-w-full\",\n auto: \"\"\n };\n\n let defaultStyle =\n \"hawa-flex hawa-max-h-fit hawa-h-fit hawa-relative hawa-flex-col hawa-justify-center hawa-gap-0\";\n let defaultInputStyle =\n \"hawa-block hawa-w-full hawa-rounded hawa-border hawa-transition-all hawa-bg-background hawa-p-3 hawa-text-sm \";\n\n return (\n <div\n className={cn(\n defaultStyle,\n marginStyles[margin],\n widthStyles[width],\n props.containerClassName,\n \"hawa-w-full hawa-gap-2\"\n )}\n >\n {props.label && <Label {...labelProps}>{props.label}</Label>}\n {props.isLoading ? (\n <div className=\"hawa-pb-2\">\n <Skeleton className=\"hawa-h-[40px] hawa-w-full\" />\n </div>\n ) : (\n <>\n {!props.hideSeparator && (\n <div\n className={cn(\n \"hawa-absolute hawa-top-[22px] hawa-h-[0.8px] hawa-w-full hawa-bg-gray-200 hawa-transition-all dark:hawa-bg-gray-800\",\n preview ? \"hawa-opacity-100\" : \"hawa-opacity-0\"\n )}\n ></div>\n )}\n <>\n <div className={\"hawa-relative\"}>\n {props.startIcon && (\n <div className=\"hawa-absolute hawa-start-3 hawa-top-1/2 hawa--translate-y-1/2\">\n {props.startIcon}\n </div>\n )}\n {props.endIcon && (\n <div\n className={cn(\n \"hawa-absolute hawa-end-3 hawa-top-1/2 hawa--translate-y-1/2\",\n props.endIconProps?.className\n )}\n >\n {props.endIcon}\n </div>\n )}\n <input\n required\n dir={props.dir}\n type={props.type}\n value={props.value}\n onChange={props.onChange}\n autoComplete={props.autoComplete}\n defaultValue={props.defaultValue}\n placeholder={placeholder}\n disabled={props.disabled || preview}\n style={{ height: 40 }}\n {...inputProps}\n className={cn(\n defaultInputStyle,\n \" focus-visible:hawa-outline-none focus-visible:hawa-ring-2 focus-visible:hawa-ring-ring focus-visible:hawa-ring-offset-0 dark:hawa-text-white\",\n {\n \"hawa-pe-9\": props.endIcon,\n \"hawa-ps-9\": props.startIcon,\n \"hawa-pe-[60px]\": countPosition === \"center\"\n },\n preview &&\n \"hawa-border-transparent hawa-bg-transparent hawa-px-0\",\n inputProps?.className\n )}\n />\n </div>\n\n {/* Regular helper text */}\n {!forceHideHelperText && (\n <p\n className={cn(\n \"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all\",\n props.helperText\n ? \"hawa-h-4 hawa-opacity-100\"\n : \"hawa-h-0 hawa-opacity-0\"\n )}\n >\n {props.helperText}\n </p>\n )}\n {/* Popover helper text */}\n {!props.disabled && forceHideHelperText && (\n <div\n className={cn(\n \"hawa-absolute hawa-end-0 hawa-top-[47px] hawa-z-20 hawa-translate-y-1/2 hawa-rounded hawa-bg-background hawa-text-start hawa-text-xs hawa-text-helper-color hawa-drop-shadow-md hawa-transition-all\",\n props.helperText\n ? \"hawa-border hawa-p-1\"\n : \"hawa-border-none hawa-p-0\"\n )}\n >\n {props.helperText}\n </div>\n )}\n {/* Character Counter */}\n {showCount && (\n <div\n className={cn(\n \"hawa-absolute hawa-translate-y-1/2 hawa-text-start hawa-text-xs hawa-transition-all\",\n {\n \"hawa-end-0 hawa-top-[62px]\": countPosition === \"bottom\",\n \"hawa-bottom-[62px] hawa-end-0\": countPosition === \"top\",\n \"hawa-end-2\": countPosition === \"center\"\n }\n )}\n >\n {props.value ? String(props.value).length : 0}/\n {props.maxLength}\n </div>\n )}\n\n {/* Popover helper text */}\n {/* {props.popup && (\n <div\n className={cn(\n \"hawa-absolute hawa-top-[47px] hawa-min-h-fit hawa-w-full hawa-text-xs hawa-text-helper-color hawa-transition-all hawa-text-start hawa-rounded hawa-end-0 hawa-z-20 hawa-drop-shadow-md hawa-bg-background hawa-translate-y-1/2\",\n props.helperText\n ? \"hawa-border hawa-p-1\"\n : \"hawa-border-none hawa-p-0\"\n )}\n >\n {props.popupContent}\n </div>\n )} */}\n </>\n </>\n )}\n </div>\n );\n }\n);\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\ntype Palette = {\n name: string;\n colors: {\n [key: number]: string;\n };\n};\ntype Rgb = {\n r: number;\n g: number;\n b: number;\n};\nfunction hexToRgb(hex: string): Rgb | null {\n const sanitizedHex = hex.replaceAll(\"##\", \"#\");\n const colorParts = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(\n sanitizedHex\n );\n\n if (!colorParts) {\n return null;\n }\n\n const [, r, g, b] = colorParts;\n\n return {\n r: parseInt(r, 16),\n g: parseInt(g, 16),\n b: parseInt(b, 16)\n } as Rgb;\n}\n\nfunction rgbToHex(r: number, g: number, b: number): string {\n const toHex = (c: number) => `0${c.toString(16)}`.slice(-2);\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}\n\nexport function getTextColor(color: string): \"#FFF\" | \"#333\" {\n const rgbColor = hexToRgb(color);\n\n if (!rgbColor) {\n return \"#333\";\n }\n\n const { r, g, b } = rgbColor;\n const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n return luma < 120 ? \"#FFF\" : \"#333\";\n}\n\nfunction lighten(hex: string, intensity: number): string {\n const color = hexToRgb(`#${hex}`);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r + (255 - color.r) * intensity);\n const g = Math.round(color.g + (255 - color.g) * intensity);\n const b = Math.round(color.b + (255 - color.b) * intensity);\n\n return rgbToHex(r, g, b);\n}\n\nfunction darken(hex: string, intensity: number): string {\n const color = hexToRgb(hex);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r * intensity);\n const g = Math.round(color.g * intensity);\n const b = Math.round(color.b * intensity);\n\n return rgbToHex(r, g, b);\n}\nconst parseColor = (color: any) => {\n if (color.startsWith(\"#\")) {\n // Convert hex to RGB\n let r = parseInt(color.slice(1, 3), 16);\n let g = parseInt(color.slice(3, 5), 16);\n let b = parseInt(color.slice(5, 7), 16);\n return [r, g, b];\n } else if (color.startsWith(\"rgb\")) {\n // Extract RGB values from rgb() format\n return color.match(/\\d+/g).map(Number);\n }\n // Default to white if format is unrecognized\n return [255, 255, 255];\n};\nexport const calculateLuminance = (color: any) => {\n const [r, g, b] = parseColor(color)?.map((c: any) => {\n c /= 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nfunction getPallette(baseColor: string): Palette {\n const name = baseColor;\n\n const response: Palette = {\n name,\n colors: {\n 500: `#${baseColor}`.replace(\"##\", \"#\")\n }\n };\n\n const intensityMap: {\n [key: number]: number;\n } = {\n 50: 0.95,\n 100: 0.9,\n 200: 0.75,\n 300: 0.6,\n 400: 0.3,\n 600: 0.9,\n 700: 0.75,\n 800: 0.6,\n 900: 0.49\n };\n\n [50, 100, 200, 300, 400].forEach((level) => {\n response.colors[level] = lighten(baseColor, intensityMap[level]);\n });\n [600, 700, 800, 900].forEach((level) => {\n response.colors[level] = darken(baseColor, intensityMap[level]);\n });\n\n return response as Palette;\n}\n\nexport { getPallette };\n\n// const hexToRgb = (hex) => {\n// let d = hex?.split(\"#\")[1];\n// var aRgbHex = d?.match(/.{1,2}/g);\n// var aRgb = [\n// parseInt(aRgbHex[0], 16),\n// parseInt(aRgbHex[1], 16),\n// parseInt(aRgbHex[2], 16)\n// ];\n// return aRgb;\n// };\n// const getTextColor = (backColor) => {\n// let rgbArray = hexToRgb(backColor);\n// if (rgbArray[0] * 0.299 + rgbArray[1] * 0.587 + rgbArray[2] * 0.114 > 186) {\n// return \"#000000\";\n// } else {\n// return \"#ffffff\";\n// }\n// };\n// const replaceAt = function (string, index, replacement) {\n// // if (replacement == \"\" || replacement == \" \") {\n// // return (\n// // string.substring(0, index) +\n// // string.substring(index + replacement.length )\n// // );\n// // }\n// const replaced = string.substring(0, index) + replacement + string.substring(index + 1)\n// return replaced\n// };\n\n// export { hexToRgb, getTextColor, replaceAt };\n","import * as React from \"react\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nimport { cn } from \"@util/index\";\nimport { Tooltip } from \"../tooltip\";\n\nexport type LabelProps = {\n hint?: React.ReactNode;\n hintSide?: PositionType;\n htmlFor?: string;\n required?: boolean;\n};\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement> & LabelProps\n>(({ className, hint, hintSide, required, children, ...props }, ref) => (\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-1 hawa-transition-all\">\n <label\n ref={ref}\n className={cn(\n \"hawa-text-sm hawa-font-medium hawa-leading-none peer-disabled:hawa-cursor-not-allowed peer-disabled:hawa-opacity-70\",\n className\n )}\n {...props}\n >\n {children}\n {required && <span className=\"hawa-mx-0.5 hawa-text-red-500\">*</span>}\n </label>\n {hint && (\n <Tooltip\n content={hint}\n side={hintSide}\n triggerProps={{\n tabIndex: -1,\n onClick: (event) => event.preventDefault()\n }}\n >\n <div>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"hawa-h-[14px] hawa-w-[14px] hawa-cursor-help\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n </div>\n </Tooltip>\n )}\n </div>\n));\n\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import React from \"react\";\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nimport { cn } from \"@util/index\";\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nconst TooltipArrow = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <TooltipPrimitive.Arrow ref={ref} className={cn(className)} {...props} />\n));\nTooltipArrow.displayName = TooltipPrimitive.Arrow.displayName;\n\ntype TooltipTypes = {\n /** Controls the open state of the tooltip. */\n open?: any;\n /** Specifies the side where the tooltip will appear. */\n side?: PositionType;\n /** Content to be displayed within the tooltip. */\n content?: any;\n /** Elements to which the tooltip is anchored. */\n children?: any;\n /** Sets the default open state of the tooltip. */\n defaultOpen?: any;\n /** Event handler for open state changes. */\n onOpenChange?: any;\n /** Duration of the delay before the tooltip appears. */\n delayDuration?: any;\n triggerProps?: TooltipPrimitive.TooltipTriggerProps;\n contentProps?: TooltipPrimitive.TooltipContentProps;\n providerProps?: TooltipPrimitive.TooltipProviderProps;\n};\n\nconst Tooltip: React.FunctionComponent<TooltipTypes> = ({\n side,\n open,\n content,\n children,\n defaultOpen,\n onOpenChange,\n triggerProps,\n contentProps,\n providerProps,\n delayDuration = 300,\n ...props\n}) => {\n return (\n <TooltipPrimitive.TooltipProvider\n delayDuration={delayDuration}\n {...providerProps}\n >\n <TooltipPrimitive.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n {...props}\n >\n <TooltipPrimitive.Trigger {...triggerProps}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipContent side={side} align=\"center\" {...contentProps}>\n {content}\n </TooltipContent>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.TooltipProvider>\n );\n};\n\nexport { Tooltip };\n","import React from \"react\";\n\nimport { cn } from \"@util/index\";\n\ninterface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n className?: string;\n animation?: \"none\" | \"pulse\" | \"shimmer\";\n content?: any;\n}\n\nfunction Skeleton({\n className,\n content,\n animation = \"pulse\",\n ...props\n}: SkeletonProps) {\n const animationStyles = {\n none: \"hawa-rounded hawa-bg-muted\",\n pulse: \"hawa-animate-pulse hawa-rounded hawa-bg-muted\",\n shimmer:\n \"hawa-space-y-5 hawa-rounded hawa-bg-muted hawa-p-4 hawa-relative before:hawa-absolute before:hawa-inset-0 before:hawa--translate-x-full before:hawa-animate-[shimmer_2s_infinite] before:hawa-bg-gradient-to-r before:hawa-from-transparent before:hawa-via-gray-300/40 dark:before:hawa-via-white/10 before:hawa-to-transparent hawa-isolate hawa-overflow-hidden before:hawa-border-t before:hawa-border-rose-100/10\"\n };\n return (\n <div\n className={cn(\n animationStyles[animation],\n content &&\n \"hawa-flex hawa-flex-col hawa-items-center hawa-justify-center\",\n className\n )}\n {...props}\n >\n {content && content}\n </div>\n );\n}\n\nexport { Skeleton };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAkC;;;ACAlC,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACLA,IAAAC,SAAuB;;;ACAvB,mBAAkB;AAElB,uBAAkC;AAMlC,IAAM,iBAAiB,aAAAC,QAAM,WAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,GAAG,MAAM,GAAG,QAC1C,6BAAAA,QAAA;AAAA,EAAkB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GA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