@sikka/hawa 0.30.23-next → 0.30.24-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/{DropdownMenu-sSnQc6fT.d.ts → DropdownMenu-o_-MnT5h.d.mts} +6 -6
- package/dist/{DropdownMenu-arqV1gRt.d.mts → DropdownMenu-p-Ha-y2R.d.ts} +6 -6
- package/dist/appLayout/index.d.mts +8 -1
- package/dist/appLayout/index.d.ts +8 -1
- package/dist/appLayout/index.js +31 -0
- package/dist/appLayout/index.js.map +1 -1
- package/dist/appLayout/index.mjs +35 -4
- package/dist/appLayout/index.mjs.map +1 -1
- package/dist/appTopbar/index.d.mts +5 -2
- package/dist/appTopbar/index.d.ts +5 -2
- package/dist/appTopbar/index.js +31 -0
- package/dist/appTopbar/index.js.map +1 -1
- package/dist/appTopbar/index.mjs +31 -0
- package/dist/appTopbar/index.mjs.map +1 -1
- package/dist/blocks/index.d.mts +1 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/index.js +31 -0
- package/dist/blocks/index.mjs +2 -2
- package/dist/blocks/pricing/index.mjs +3 -3
- package/dist/{chunk-CXBN42TF.mjs → chunk-7LAUVLVZ.mjs} +1 -1
- package/dist/{chunk-HOE4FCIF.mjs → chunk-DGOT2FVH.mjs} +30 -0
- package/dist/{chunk-MH5K6NEO.mjs → chunk-TKSAYWDH.mjs} +1 -1
- package/dist/combobox/index.js +44 -35
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs +44 -35
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/commonTypes-52DloiYq.d.mts +7 -0
- package/dist/commonTypes-52DloiYq.d.ts +7 -0
- package/dist/dataTable/index.js +31 -0
- package/dist/dataTable/index.js.map +1 -1
- package/dist/dataTable/index.mjs +31 -0
- package/dist/dataTable/index.mjs.map +1 -1
- package/dist/docsLayout/index.d.mts +1 -1
- package/dist/docsLayout/index.d.ts +1 -1
- package/dist/dropdownMenu/index.d.mts +9 -5
- package/dist/dropdownMenu/index.d.ts +9 -5
- package/dist/dropdownMenu/index.js +30 -0
- package/dist/dropdownMenu/index.js.map +1 -1
- package/dist/dropdownMenu/index.mjs +30 -0
- package/dist/dropdownMenu/index.mjs.map +1 -1
- package/dist/elements/index.d.mts +1 -1
- package/dist/elements/index.d.ts +1 -1
- package/dist/elements/index.js +74 -35
- package/dist/elements/index.mjs +47 -38
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +74 -35
- package/dist/index.mjs +179 -140
- package/dist/layout/index.d.mts +1 -1
- package/dist/layout/index.d.ts +1 -1
- package/dist/layout/index.js +31 -0
- package/dist/layout/index.mjs +2 -2
- package/dist/splitButton/index.d.mts +8 -1
- package/dist/splitButton/index.d.ts +8 -1
- package/dist/splitButton/index.js +31 -0
- package/dist/splitButton/index.js.map +1 -1
- package/dist/splitButton/index.mjs +31 -0
- package/dist/splitButton/index.mjs.map +1 -1
- package/package.json +1 -1
@@ -273,6 +273,9 @@ var DropdownMenu = ({
|
|
273
273
|
default: "hawa-px-2 hawa-py-3 ",
|
274
274
|
sm: "hawa-text-xs hawa-px-1.5 hawa-py-1.5 "
|
275
275
|
};
|
276
|
+
let [values, setValues] = React.useState(
|
277
|
+
items.map((item) => item.currentOption)
|
278
|
+
);
|
276
279
|
return /* @__PURE__ */ React.createElement(
|
277
280
|
DropdownMenuRoot,
|
278
281
|
{
|
@@ -300,11 +303,38 @@ var DropdownMenu = ({
|
|
300
303
|
},
|
301
304
|
header && header,
|
302
305
|
items && items.map((item, index) => {
|
306
|
+
var _a;
|
303
307
|
const ItemLinkComponent = item.slug ? LinkComponent : "a";
|
304
308
|
if (item.itemType === "separator") {
|
305
309
|
return /* @__PURE__ */ React.createElement(DropdownMenuSeparator, { key: index });
|
306
310
|
} else if (item.itemType === "label") {
|
307
311
|
return /* @__PURE__ */ React.createElement(DropdownMenuLabel, { key: index }, item.label);
|
312
|
+
} else if (item.itemType === "radio") {
|
313
|
+
let dd = item.currentOption;
|
314
|
+
return /* @__PURE__ */ React.createElement(DropdownMenuSub, { key: index }, /* @__PURE__ */ React.createElement(
|
315
|
+
DropdownMenuSubTrigger,
|
316
|
+
{
|
317
|
+
dir: direction,
|
318
|
+
className: cn(sizeStyles[size])
|
319
|
+
},
|
320
|
+
item.icon && item.icon,
|
321
|
+
item.label && item.label
|
322
|
+
), /* @__PURE__ */ React.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React.createElement(
|
323
|
+
DropdownMenuRadioGroup,
|
324
|
+
{
|
325
|
+
value: values[index],
|
326
|
+
onValueChange: (e) => {
|
327
|
+
let newValues = [...values];
|
328
|
+
newValues[index] = e;
|
329
|
+
setValues(newValues);
|
330
|
+
console.log("changing to ", e);
|
331
|
+
if (item.onOptionChange) {
|
332
|
+
item.onOptionChange(e);
|
333
|
+
}
|
334
|
+
}
|
335
|
+
},
|
336
|
+
(_a = item.options) == null ? void 0 : _a.map((opt, i) => /* @__PURE__ */ React.createElement(DropdownMenuRadioItem, { key: i, value: opt.value }, opt.label))
|
337
|
+
)));
|
308
338
|
} else if (item.itemType === "custom") {
|
309
339
|
return /* @__PURE__ */ React.createElement("div", { key: index }, item.content);
|
310
340
|
} else {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../elements/dropdownMenu/index.ts","../../elements/dropdownMenu/DropdownMenu.tsx","../../util/index.ts"],"sourcesContent":["export * from \"./DropdownMenu\";\n","import * as React from \"react\";\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { cn } from \"@util/index\";\n\nimport { DirectionType } from \"../../types/commonTypes\";\n\nconst DropdownMenuRoot = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none focus:hawa-bg-accent data-[state=open]:hawa-bg-accent\",\n inset && \"hawa-pl-8\",\n className,\n )}\n {...props}\n >\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-2\">\n {children}\n </div>{\" \"}\n <svg\n aria-label=\"Chevron Right Icon\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 16 16\"\n height=\"1em\"\n width=\"1em\"\n className={cn(props.dir === \"rtl\" ? \"hawa-rotate-180\" : \"\")}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z\"\n ></path>\n </svg>\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"hawa-z-50 hawa-min-w-[8rem] hawa-gap-1 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-p-1 hawa-text-popover-foreground hawa-shadow-lg data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-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));\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.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-p-1 hawa-text-popover-foreground hawa-shadow-md data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-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 </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n end?: any;\n shortcut?: React.ReactNode;\n badged?: boolean;\n slug?: string;\n LinkComponent?: any;\n }\n>(({ className, inset, badged, slug, LinkComponent, ...props }, ref) => {\n return (\n <LinkComponent href={slug}>\n <DropdownMenuPrimitive.Item\n disabled={props.disabled}\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n inset && \"hawa-pl-8\",\n props.end &&\n Array.isArray(props.children) &&\n props.children[1] &&\n \"hawa-gap-6\",\n className,\n )}\n {...props}\n >\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-2 \">\n {props.children}\n </div>\n\n {props.end && props.end}\n {!props.end && props.shortcut && (\n <DropdownMenuShortcut>{props.shortcut}</DropdownMenuShortcut>\n )}\n {!props.end && badged && (\n <div className=\"hawa-h-3 hawa-w-3 hawa-rounded-full hawa-bg-red-500\" />\n )}\n </DropdownMenuPrimitive.Item>\n </LinkComponent>\n );\n});\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n {/* <Check className=\"h-4 w-4\" /> */}\n <svg\n aria-label=\"Check Mark\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 512 512\"\n height=\"0.60em\"\n width=\"0.60em\"\n >\n <path d=\"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z\"></path>\n </svg>{\" \"}\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName =\n DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n aria-label=\"Circle\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"hawa-h-2 hawa-w-2 hawa-fill-current\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n </svg>\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"hawa-px-2 hawa-py-1.5 hawa-text-sm hawa-font-semibold\",\n inset && \"hawa-pl-8\",\n className,\n )}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"hawa--mx-1 hawa-my-1 hawa-h-px hawa-bg-muted\", className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"hawa-text-xs hawa-tracking-widest hawa-opacity-60\",\n className,\n )}\n {...props}\n />\n );\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\ntype ExtendedDropdownMenuContentProps = Partial<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n> & {\n // Add any additional types or overrides here, for example:\n // side?: \"left\" | \"right\" | \"top\" | \"bottom\"\n};\ntype ExtendedDropdownMenuTriggerProps = Partial<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Trigger>\n> & {\n // Add any additional types or overrides here, for example:\n // side?: \"left\" | \"right\" | \"top\" | \"bottom\"\n};\n\nexport type SubItem = {\n label?: string;\n value?: any;\n icon?: any;\n action?: () => void;\n onMiddleClick?: (e: any) => void;\n highlighted?: boolean;\n disabled?: boolean;\n slug?: string;\n};\nexport type MenuItemType = {\n icon?: React.ReactNode;\n label?: string;\n shortcut?: React.ReactNode;\n badged?: boolean;\n value?: any;\n content?: any;\n slug?: string;\n end?: any;\n presist?: boolean;\n itemType?: \"separator\" | \"label\" | \"custom\";\n action?: () => void;\n highlighted?: boolean;\n subitems?: SubItem[];\n disabled?: boolean;\n onMiddleClick?: (e: any) => void;\n onClick?: any;\n};\ninterface DropdownMenuProps {\n trigger?: any;\n items: MenuItemType[];\n direction?: DirectionType;\n className?: ExtendedDropdownMenuContentProps[\"className\"];\n triggerClassname?: ExtendedDropdownMenuTriggerProps[\"className\"];\n sideOffset?: ExtendedDropdownMenuContentProps[\"sideOffset\"];\n side?: ExtendedDropdownMenuContentProps[\"side\"];\n align?: ExtendedDropdownMenuContentProps[\"align\"];\n alignOffset?: ExtendedDropdownMenuContentProps[\"alignOffset\"];\n width?: \"default\" | \"sm\" | \"lg\" | \"parent\";\n size?: \"default\" | \"sm\";\n onItemSelect?: any;\n onOpenChange?: any;\n header?: React.ReactNode;\n open?: any;\n LinkComponent?: any;\n}\nconst DropdownMenu: React.FC<DropdownMenuProps> = ({\n trigger,\n items,\n direction,\n sideOffset,\n side,\n className,\n triggerClassname,\n align,\n alignOffset,\n onItemSelect,\n size = \"default\",\n width = \"default\",\n header,\n onOpenChange,\n open,\n LinkComponent,\n}) => {\n const widthStyles = {\n default: \"hawa-min-w-[8rem]\",\n sm: \"hawa-w-fit\",\n lg: \"hawa-w-[200px]\",\n parent: \"ddm-w-parent\",\n };\n const sizeStyles = {\n default: \"hawa-px-2 hawa-py-3 \",\n sm: \"hawa-text-xs hawa-px-1.5 hawa-py-1.5 \",\n };\n\n return (\n <DropdownMenuRoot\n onOpenChange={onOpenChange}\n open={open}\n modal={false}\n dir={direction}\n >\n <DropdownMenuTrigger asChild className={triggerClassname}>\n {trigger}\n </DropdownMenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuContent\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n className={cn(\n className,\n widthStyles[width],\n \"hawa-flex hawa-flex-col hawa-gap-1 hawa-overflow-y-auto\",\n )}\n style={{\n maxHeight: \"var(--radix-dropdown-menu-content-available-height)\",\n }}\n >\n {header && header}\n {items &&\n items.map((item, index) => {\n const ItemLinkComponent = item.slug ? LinkComponent : \"a\";\n if (item.itemType === \"separator\") {\n return <DropdownMenuSeparator key={index} />;\n } else if (item.itemType === \"label\") {\n return (\n <DropdownMenuLabel key={index}>\n {item.label}\n </DropdownMenuLabel>\n );\n } else if (item.itemType === \"custom\") {\n return <div key={index}>{item.content}</div>;\n } else {\n return item.subitems ? (\n <DropdownMenuSub key={index}>\n <DropdownMenuSubTrigger\n dir={direction}\n className={cn(sizeStyles[size])}\n >\n {item.icon && item.icon}\n {item.label && item.label}\n </DropdownMenuSubTrigger>\n <DropdownMenuPortal>\n <DropdownMenuSubContent>\n {item.subitems.map((subitem, subIndex) => {\n const SubitemLinkComponent = subitem.slug\n ? LinkComponent\n : \"a\";\n return (\n <DropdownMenuItem\n key={subIndex}\n LinkComponent={SubitemLinkComponent}\n slug={subitem.slug}\n disabled={subitem.disabled}\n className={cn(\n sizeStyles[size],\n !item.icon && !item.label\n ? \"hawa-px-0 hawa-py-0 focus:hawa-bg-transparent\"\n : \"focus:hawa-bg-accent\",\n )}\n onMouseDown={(event: any) => {\n if (\n event.button === 1 ||\n (event.button === 0 && event.ctrlKey)\n ) {\n event.preventDefault(); // This line prevents the default behavior of the middle button\n if (subitem.onMiddleClick) {\n subitem.onMiddleClick(item.value);\n }\n }\n }}\n onSelect={() => {\n subitem.action && subitem.action();\n if (onItemSelect) {\n onItemSelect(subitem.value);\n }\n }}\n >\n {subitem.icon && subitem.icon}\n {subitem.label && subitem.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuSubContent>\n </DropdownMenuPortal>\n </DropdownMenuSub>\n ) : (\n <DropdownMenuItem\n LinkComponent={ItemLinkComponent}\n slug={item.slug}\n key={index}\n disabled={item.disabled}\n onMouseDown={(event: any) => {\n if (\n event.button === 1 ||\n (event.button === 0 && event.ctrlKey)\n ) {\n event.preventDefault(); // This line prevents the default behavior of the middle button\n if (item.onMiddleClick) {\n item.onMiddleClick(item.value);\n }\n }\n }}\n onClick={(event: any) => {\n if (item.onClick) {\n item.onClick(item.value);\n }\n }}\n onSelect={(e) => {\n if (item.presist) {\n e.preventDefault();\n }\n if (item.action) {\n item.action();\n if (onItemSelect) {\n onItemSelect(item.value);\n }\n } else {\n if (onItemSelect) {\n onItemSelect(item.value);\n }\n }\n }}\n end={item.end}\n shortcut={item.shortcut}\n badged={item.badged}\n className={cn(\n sizeStyles[size],\n !item.icon && !item.label\n ? \"hawa-px-0 hawa-py-0 focus:hawa-bg-transparent \"\n : \"focus:hawa-bg-accent \",\n item.presist && \"focus:hawa-bg-transparent\",\n )}\n >\n {item.icon && item.icon}\n {item.label && item.label}\n </DropdownMenuItem>\n );\n }\n })}\n </DropdownMenuContent>\n </DropdownMenuPortal>\n </DropdownMenuRoot>\n );\n};\ninterface DropdownMenuRadioProps {\n trigger?: React.ReactNode;\n side?: ExtendedDropdownMenuContentProps[\"side\"];\n align?: ExtendedDropdownMenuContentProps[\"align\"];\n options: { label?: any; value: string }[];\n value: string;\n onValueChange: any;\n label?: string;\n}\nconst DropdownMenuRadio: React.FC<DropdownMenuRadioProps> = (props) => {\n return (\n <DropdownMenuRoot>\n <DropdownMenuTrigger asChild>{props.trigger}</DropdownMenuTrigger>\n <DropdownMenuContent align={props.align} side={props.side}>\n {props.label && (\n <>\n <DropdownMenuLabel>{props.label}</DropdownMenuLabel>\n <DropdownMenuSeparator />\n </>\n )}\n <DropdownMenuRadioGroup\n value={props.value}\n onValueChange={props.onValueChange}\n >\n {props.options.map((opt, i) => (\n <DropdownMenuRadioItem key={i} value={opt.value}>\n {opt.label}\n </DropdownMenuRadioItem>\n ))}\n {/* \n <DropdownMenuRadioItem value=\"en\">English</DropdownMenuRadioItem> */}\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenuRoot>\n );\n};\n\nexport {\n DropdownMenu,\n DropdownMenuRoot,\n DropdownMenuRadio,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AAEvB,4BAAuC;;;ACFvC,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADEA,IAAM,mBAAyC;AAC/C,IAAM,sBAA4C;AAClD,IAAM,oBAA0C;AAChD,IAAM,qBAA2C;AACjD,IAAM,kBAAwC;AAC9C,IAAM,yBAA+C;AAErD,IAAM,yBAA+B,iBAKnC,CAAC,EAAE,WAAW,OAAO,UAAU,GAAG,MAAM,GAAG,QAC3C;AAAA,EAAuB;AAAA,EAAtB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA,SAAS;AAAA,MACT;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AAAA,EAEJ,oCAAC,SAAI,WAAU,0DACZ,QACH;AAAA,EAAO;AAAA,EACP;AAAA,IAAC;AAAA;AAAA,MACC,cAAW;AAAA,MACX,QAAO;AAAA,MACP,MAAK;AAA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KAAK,WAAW;AAAA,cAClB;AAAA;AAAA,YAEC,KAAK,QAAQ,KAAK;AAAA,YAClB,KAAK,SAAS,KAAK;AAAA,UACtB;AAAA,QAEJ;AAAA,MACF,CAAC;AAAA,IACL,CACF;AAAA,EACF;AAEJ;AAUA,IAAM,oBAAsD,CAAC,UAAU;AACrE,SACE,oCAAC,wBACC,oCAAC,uBAAoB,SAAO,QAAE,MAAM,OAAQ,GAC5C,oCAAC,uBAAoB,OAAO,MAAM,OAAO,MAAM,MAAM,QAClD,MAAM,SACL,0DACE,oCAAC,yBAAmB,MAAM,KAAM,GAChC,oCAAC,2BAAsB,CACzB,GAEF;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,MAAM;AAAA,MACb,eAAe,MAAM;AAAA;AAAA,IAEpB,MAAM,QAAQ,IAAI,CAAC,KAAK,MACvB,oCAAC,yBAAsB,KAAK,GAAG,OAAO,IAAI,SACvC,IAAI,KACP,CACD;AAAA,EAGH,CACF,CACF;AAEJ;","names":[]}
|
1
|
+
{"version":3,"sources":["../../elements/dropdownMenu/index.ts","../../elements/dropdownMenu/DropdownMenu.tsx","../../util/index.ts"],"sourcesContent":["export * from \"./DropdownMenu\";\n","import * as React from \"react\";\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { cn } from \"@util/index\";\n\nimport { DirectionType, RadioOptionType } from \"../../types/commonTypes\";\n\nconst DropdownMenuRoot = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none focus:hawa-bg-accent data-[state=open]:hawa-bg-accent\",\n inset && \"hawa-pl-8\",\n className,\n )}\n {...props}\n >\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-2\">\n {children}\n </div>{\" \"}\n <svg\n aria-label=\"Chevron Right Icon\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 16 16\"\n height=\"1em\"\n width=\"1em\"\n className={cn(props.dir === \"rtl\" ? \"hawa-rotate-180\" : \"\")}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z\"\n ></path>\n </svg>\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"hawa-z-50 hawa-min-w-[8rem] hawa-gap-1 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-p-1 hawa-text-popover-foreground hawa-shadow-lg data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-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));\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.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-p-1 hawa-text-popover-foreground hawa-shadow-md data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-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 </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n end?: any;\n shortcut?: React.ReactNode;\n badged?: boolean;\n slug?: string;\n LinkComponent?: any;\n }\n>(({ className, inset, badged, slug, LinkComponent, ...props }, ref) => {\n return (\n <LinkComponent href={slug}>\n <DropdownMenuPrimitive.Item\n disabled={props.disabled}\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n inset && \"hawa-pl-8\",\n props.end &&\n Array.isArray(props.children) &&\n props.children[1] &&\n \"hawa-gap-6\",\n className,\n )}\n {...props}\n >\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-2 \">\n {props.children}\n </div>\n\n {props.end && props.end}\n {!props.end && props.shortcut && (\n <DropdownMenuShortcut>{props.shortcut}</DropdownMenuShortcut>\n )}\n {!props.end && badged && (\n <div className=\"hawa-h-3 hawa-w-3 hawa-rounded-full hawa-bg-red-500\" />\n )}\n </DropdownMenuPrimitive.Item>\n </LinkComponent>\n );\n});\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n {/* <Check className=\"h-4 w-4\" /> */}\n <svg\n aria-label=\"Check Mark\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 512 512\"\n height=\"0.60em\"\n width=\"0.60em\"\n >\n <path d=\"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z\"></path>\n </svg>{\" \"}\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName =\n DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n aria-label=\"Circle\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"hawa-h-2 hawa-w-2 hawa-fill-current\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n </svg>\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"hawa-px-2 hawa-py-1.5 hawa-text-sm hawa-font-semibold\",\n inset && \"hawa-pl-8\",\n className,\n )}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"hawa--mx-1 hawa-my-1 hawa-h-px hawa-bg-muted\", className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"hawa-text-xs hawa-tracking-widest hawa-opacity-60\",\n className,\n )}\n {...props}\n />\n );\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\ntype ExtendedDropdownMenuContentProps = Partial<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n> & {\n // Add any additional types or overrides here, for example:\n // side?: \"left\" | \"right\" | \"top\" | \"bottom\"\n};\ntype ExtendedDropdownMenuTriggerProps = Partial<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Trigger>\n> & {\n // Add any additional types or overrides here, for example:\n // side?: \"left\" | \"right\" | \"top\" | \"bottom\"\n};\n\nexport type SubItem = {\n label?: string;\n value?: any;\n icon?: any;\n action?: () => void;\n onMiddleClick?: (e: any) => void;\n highlighted?: boolean;\n disabled?: boolean;\n slug?: string;\n};\nexport type MenuItemType = {\n icon?: React.ReactNode;\n label?: string;\n shortcut?: React.ReactNode;\n badged?: boolean;\n value?: any;\n content?: any;\n slug?: string;\n end?: any;\n presist?: boolean;\n itemType?: \"separator\" | \"label\" | \"custom\" | \"radio\";\n action?: () => void;\n highlighted?: boolean;\n subitems?: SubItem[];\n options?: RadioOptionType[];\n currentOption?: string;\n onOptionChange?: (value: string) => void;\n disabled?: boolean;\n onMiddleClick?: (e: any) => void;\n onClick?: any;\n};\ninterface DropdownMenuProps {\n trigger?: any;\n items: MenuItemType[];\n direction?: DirectionType;\n className?: ExtendedDropdownMenuContentProps[\"className\"];\n triggerClassname?: ExtendedDropdownMenuTriggerProps[\"className\"];\n sideOffset?: ExtendedDropdownMenuContentProps[\"sideOffset\"];\n side?: ExtendedDropdownMenuContentProps[\"side\"];\n align?: ExtendedDropdownMenuContentProps[\"align\"];\n alignOffset?: ExtendedDropdownMenuContentProps[\"alignOffset\"];\n width?: \"default\" | \"sm\" | \"lg\" | \"parent\";\n size?: \"default\" | \"sm\";\n onItemSelect?: any;\n onOpenChange?: any;\n header?: React.ReactNode;\n open?: any;\n LinkComponent?: any;\n}\nconst DropdownMenu: React.FC<DropdownMenuProps> = ({\n trigger,\n items,\n direction,\n sideOffset,\n side,\n className,\n triggerClassname,\n align,\n alignOffset,\n onItemSelect,\n size = \"default\",\n width = \"default\",\n header,\n onOpenChange,\n open,\n LinkComponent,\n}) => {\n const widthStyles = {\n default: \"hawa-min-w-[8rem]\",\n sm: \"hawa-w-fit\",\n lg: \"hawa-w-[200px]\",\n parent: \"ddm-w-parent\",\n };\n const sizeStyles = {\n default: \"hawa-px-2 hawa-py-3 \",\n sm: \"hawa-text-xs hawa-px-1.5 hawa-py-1.5 \",\n };\n let [values, setValues] = React.useState(\n items.map((item) => item.currentOption),\n );\n\n return (\n <DropdownMenuRoot\n onOpenChange={onOpenChange}\n open={open}\n modal={false}\n dir={direction}\n >\n <DropdownMenuTrigger asChild className={triggerClassname}>\n {trigger}\n </DropdownMenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuContent\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n className={cn(\n className,\n widthStyles[width],\n \"hawa-flex hawa-flex-col hawa-gap-1 hawa-overflow-y-auto\",\n )}\n style={{\n maxHeight: \"var(--radix-dropdown-menu-content-available-height)\",\n }}\n >\n {header && header}\n {items &&\n items.map((item, index) => {\n const ItemLinkComponent = item.slug ? LinkComponent : \"a\";\n if (item.itemType === \"separator\") {\n return <DropdownMenuSeparator key={index} />;\n } else if (item.itemType === \"label\") {\n return (\n <DropdownMenuLabel key={index}>\n {item.label}\n </DropdownMenuLabel>\n );\n } else if (item.itemType === \"radio\") {\n let dd = item.currentOption;\n return (\n <DropdownMenuSub key={index}>\n <DropdownMenuSubTrigger\n dir={direction}\n className={cn(sizeStyles[size])}\n >\n {item.icon && item.icon}\n {item.label && item.label}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuRadioGroup\n value={values[index]}\n onValueChange={(e) => {\n let newValues = [...values];\n newValues[index] = e;\n setValues(newValues);\n console.log(\"changing to \", e);\n if (item.onOptionChange) {\n item.onOptionChange(e);\n }\n }}\n >\n {item.options?.map((opt, i) => (\n <DropdownMenuRadioItem key={i} value={opt.value}>\n {opt.label}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n } else if (item.itemType === \"custom\") {\n return <div key={index}>{item.content}</div>;\n } else {\n return item.subitems ? (\n <DropdownMenuSub key={index}>\n <DropdownMenuSubTrigger\n dir={direction}\n className={cn(sizeStyles[size])}\n >\n {item.icon && item.icon}\n {item.label && item.label}\n </DropdownMenuSubTrigger>\n <DropdownMenuPortal>\n <DropdownMenuSubContent>\n {item.subitems.map((subitem, subIndex) => {\n const SubitemLinkComponent = subitem.slug\n ? LinkComponent\n : \"a\";\n return (\n <DropdownMenuItem\n key={subIndex}\n LinkComponent={SubitemLinkComponent}\n slug={subitem.slug}\n disabled={subitem.disabled}\n className={cn(\n sizeStyles[size],\n !item.icon && !item.label\n ? \"hawa-px-0 hawa-py-0 focus:hawa-bg-transparent\"\n : \"focus:hawa-bg-accent\",\n )}\n onMouseDown={(event: any) => {\n if (\n event.button === 1 ||\n (event.button === 0 && event.ctrlKey)\n ) {\n event.preventDefault(); // This line prevents the default behavior of the middle button\n if (subitem.onMiddleClick) {\n subitem.onMiddleClick(item.value);\n }\n }\n }}\n onSelect={() => {\n subitem.action && subitem.action();\n if (onItemSelect) {\n onItemSelect(subitem.value);\n }\n }}\n >\n {subitem.icon && subitem.icon}\n {subitem.label && subitem.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuSubContent>\n </DropdownMenuPortal>\n </DropdownMenuSub>\n ) : (\n <DropdownMenuItem\n LinkComponent={ItemLinkComponent}\n slug={item.slug}\n key={index}\n disabled={item.disabled}\n onMouseDown={(event: any) => {\n if (\n event.button === 1 ||\n (event.button === 0 && event.ctrlKey)\n ) {\n event.preventDefault(); // This line prevents the default behavior of the middle button\n if (item.onMiddleClick) {\n item.onMiddleClick(item.value);\n }\n }\n }}\n onClick={(event: any) => {\n if (item.onClick) {\n item.onClick(item.value);\n }\n }}\n onSelect={(e) => {\n if (item.presist) {\n e.preventDefault();\n }\n if (item.action) {\n item.action();\n if (onItemSelect) {\n onItemSelect(item.value);\n }\n } else {\n if (onItemSelect) {\n onItemSelect(item.value);\n }\n }\n }}\n end={item.end}\n shortcut={item.shortcut}\n badged={item.badged}\n className={cn(\n sizeStyles[size],\n !item.icon && !item.label\n ? \"hawa-px-0 hawa-py-0 focus:hawa-bg-transparent \"\n : \"focus:hawa-bg-accent \",\n item.presist && \"focus:hawa-bg-transparent\",\n )}\n >\n {item.icon && item.icon}\n {item.label && item.label}\n </DropdownMenuItem>\n );\n }\n })}\n </DropdownMenuContent>\n </DropdownMenuPortal>\n </DropdownMenuRoot>\n );\n};\ninterface DropdownMenuRadioProps {\n trigger?: React.ReactNode;\n side?: ExtendedDropdownMenuContentProps[\"side\"];\n align?: ExtendedDropdownMenuContentProps[\"align\"];\n options: RadioOptionType[];\n value: string;\n onValueChange: any;\n label?: string;\n}\nconst DropdownMenuRadio: React.FC<DropdownMenuRadioProps> = (props) => {\n return (\n <DropdownMenuRoot>\n <DropdownMenuTrigger asChild>{props.trigger}</DropdownMenuTrigger>\n <DropdownMenuContent align={props.align} side={props.side}>\n {props.label && (\n <>\n <DropdownMenuLabel>{props.label}</DropdownMenuLabel>\n <DropdownMenuSeparator />\n </>\n )}\n <DropdownMenuRadioGroup\n value={props.value}\n onValueChange={props.onValueChange}\n >\n {props.options.map((opt, i) => (\n <DropdownMenuRadioItem key={i} value={opt.value}>\n {opt.label}\n </DropdownMenuRadioItem>\n ))}\n {/* \n <DropdownMenuRadioItem value=\"en\">English</DropdownMenuRadioItem> */}\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenuRoot>\n );\n};\n\nexport {\n DropdownMenu,\n DropdownMenuRoot,\n DropdownMenuRadio,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AAEvB,4BAAuC;;;ACFvC,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADEA,IAAM,mBAAyC;AAC/C,IAAM,sBAA4C;AAClD,IAAM,oB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cAClB;AAAA;AAAA,YAEC,KAAK,QAAQ,KAAK;AAAA,YAClB,KAAK,SAAS,KAAK;AAAA,UACtB;AAAA,QAEJ;AAAA,MACF,CAAC;AAAA,IACL,CACF;AAAA,EACF;AAEJ;AAUA,IAAM,oBAAsD,CAAC,UAAU;AACrE,SACE,oCAAC,wBACC,oCAAC,uBAAoB,SAAO,QAAE,MAAM,OAAQ,GAC5C,oCAAC,uBAAoB,OAAO,MAAM,OAAO,MAAM,MAAM,QAClD,MAAM,SACL,0DACE,oCAAC,yBAAmB,MAAM,KAAM,GAChC,oCAAC,2BAAsB,CACzB,GAEF;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,MAAM;AAAA,MACb,eAAe,MAAM;AAAA;AAAA,IAEpB,MAAM,QAAQ,IAAI,CAAC,KAAK,MACvB,oCAAC,yBAAsB,KAAK,GAAG,OAAO,IAAI,SACvC,IAAI,KACP,CACD;AAAA,EAGH,CACF,CACF;AAEJ;","names":[]}
|
@@ -222,6 +222,9 @@ var DropdownMenu = ({
|
|
222
222
|
default: "hawa-px-2 hawa-py-3 ",
|
223
223
|
sm: "hawa-text-xs hawa-px-1.5 hawa-py-1.5 "
|
224
224
|
};
|
225
|
+
let [values, setValues] = React.useState(
|
226
|
+
items.map((item) => item.currentOption)
|
227
|
+
);
|
225
228
|
return /* @__PURE__ */ React.createElement(
|
226
229
|
DropdownMenuRoot,
|
227
230
|
{
|
@@ -249,11 +252,38 @@ var DropdownMenu = ({
|
|
249
252
|
},
|
250
253
|
header && header,
|
251
254
|
items && items.map((item, index) => {
|
255
|
+
var _a;
|
252
256
|
const ItemLinkComponent = item.slug ? LinkComponent : "a";
|
253
257
|
if (item.itemType === "separator") {
|
254
258
|
return /* @__PURE__ */ React.createElement(DropdownMenuSeparator, { key: index });
|
255
259
|
} else if (item.itemType === "label") {
|
256
260
|
return /* @__PURE__ */ React.createElement(DropdownMenuLabel, { key: index }, item.label);
|
261
|
+
} else if (item.itemType === "radio") {
|
262
|
+
let dd = item.currentOption;
|
263
|
+
return /* @__PURE__ */ React.createElement(DropdownMenuSub, { key: index }, /* @__PURE__ */ React.createElement(
|
264
|
+
DropdownMenuSubTrigger,
|
265
|
+
{
|
266
|
+
dir: direction,
|
267
|
+
className: cn(sizeStyles[size])
|
268
|
+
},
|
269
|
+
item.icon && item.icon,
|
270
|
+
item.label && item.label
|
271
|
+
), /* @__PURE__ */ React.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React.createElement(
|
272
|
+
DropdownMenuRadioGroup,
|
273
|
+
{
|
274
|
+
value: values[index],
|
275
|
+
onValueChange: (e) => {
|
276
|
+
let newValues = [...values];
|
277
|
+
newValues[index] = e;
|
278
|
+
setValues(newValues);
|
279
|
+
console.log("changing to ", e);
|
280
|
+
if (item.onOptionChange) {
|
281
|
+
item.onOptionChange(e);
|
282
|
+
}
|
283
|
+
}
|
284
|
+
},
|
285
|
+
(_a = item.options) == null ? void 0 : _a.map((opt, i) => /* @__PURE__ */ React.createElement(DropdownMenuRadioItem, { key: i, value: opt.value }, opt.label))
|
286
|
+
)));
|
257
287
|
} else if (item.itemType === "custom") {
|
258
288
|
return /* @__PURE__ */ React.createElement("div", { key: index }, item.content);
|
259
289
|
} else {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../elements/dropdownMenu/DropdownMenu.tsx","../../util/index.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { cn } from \"@util/index\";\n\nimport { DirectionType } from \"../../types/commonTypes\";\n\nconst DropdownMenuRoot = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none focus:hawa-bg-accent data-[state=open]:hawa-bg-accent\",\n inset && \"hawa-pl-8\",\n className,\n )}\n {...props}\n >\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-2\">\n {children}\n </div>{\" \"}\n <svg\n aria-label=\"Chevron Right Icon\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 16 16\"\n height=\"1em\"\n width=\"1em\"\n className={cn(props.dir === \"rtl\" ? \"hawa-rotate-180\" : \"\")}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z\"\n ></path>\n </svg>\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"hawa-z-50 hawa-min-w-[8rem] hawa-gap-1 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-p-1 hawa-text-popover-foreground hawa-shadow-lg data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-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));\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.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-p-1 hawa-text-popover-foreground hawa-shadow-md data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-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 </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n end?: any;\n shortcut?: React.ReactNode;\n badged?: boolean;\n slug?: string;\n LinkComponent?: any;\n }\n>(({ className, inset, badged, slug, LinkComponent, ...props }, ref) => {\n return (\n <LinkComponent href={slug}>\n <DropdownMenuPrimitive.Item\n disabled={props.disabled}\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n inset && \"hawa-pl-8\",\n props.end &&\n Array.isArray(props.children) &&\n props.children[1] &&\n \"hawa-gap-6\",\n className,\n )}\n {...props}\n >\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-2 \">\n {props.children}\n </div>\n\n {props.end && props.end}\n {!props.end && props.shortcut && (\n <DropdownMenuShortcut>{props.shortcut}</DropdownMenuShortcut>\n )}\n {!props.end && badged && (\n <div className=\"hawa-h-3 hawa-w-3 hawa-rounded-full hawa-bg-red-500\" />\n )}\n </DropdownMenuPrimitive.Item>\n </LinkComponent>\n );\n});\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n {/* <Check className=\"h-4 w-4\" /> */}\n <svg\n aria-label=\"Check Mark\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 512 512\"\n height=\"0.60em\"\n width=\"0.60em\"\n >\n <path d=\"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z\"></path>\n </svg>{\" \"}\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName =\n DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n aria-label=\"Circle\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"hawa-h-2 hawa-w-2 hawa-fill-current\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n </svg>\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"hawa-px-2 hawa-py-1.5 hawa-text-sm hawa-font-semibold\",\n inset && \"hawa-pl-8\",\n className,\n )}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"hawa--mx-1 hawa-my-1 hawa-h-px hawa-bg-muted\", className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"hawa-text-xs hawa-tracking-widest hawa-opacity-60\",\n className,\n )}\n {...props}\n />\n );\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\ntype ExtendedDropdownMenuContentProps = Partial<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n> & {\n // Add any additional types or overrides here, for example:\n // side?: \"left\" | \"right\" | \"top\" | \"bottom\"\n};\ntype ExtendedDropdownMenuTriggerProps = Partial<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Trigger>\n> & {\n // Add any additional types or overrides here, for example:\n // side?: \"left\" | \"right\" | \"top\" | \"bottom\"\n};\n\nexport type SubItem = {\n label?: string;\n value?: any;\n icon?: any;\n action?: () => void;\n onMiddleClick?: (e: any) => void;\n highlighted?: boolean;\n disabled?: boolean;\n slug?: string;\n};\nexport type MenuItemType = {\n icon?: React.ReactNode;\n label?: string;\n shortcut?: React.ReactNode;\n badged?: boolean;\n value?: any;\n content?: any;\n slug?: string;\n end?: any;\n presist?: boolean;\n itemType?: \"separator\" | \"label\" | \"custom\";\n action?: () => void;\n highlighted?: boolean;\n subitems?: SubItem[];\n disabled?: boolean;\n onMiddleClick?: (e: any) => void;\n onClick?: any;\n};\ninterface DropdownMenuProps {\n trigger?: any;\n items: MenuItemType[];\n direction?: DirectionType;\n className?: ExtendedDropdownMenuContentProps[\"className\"];\n triggerClassname?: ExtendedDropdownMenuTriggerProps[\"className\"];\n sideOffset?: ExtendedDropdownMenuContentProps[\"sideOffset\"];\n side?: ExtendedDropdownMenuContentProps[\"side\"];\n align?: ExtendedDropdownMenuContentProps[\"align\"];\n alignOffset?: ExtendedDropdownMenuContentProps[\"alignOffset\"];\n width?: \"default\" | \"sm\" | \"lg\" | \"parent\";\n size?: \"default\" | \"sm\";\n onItemSelect?: any;\n onOpenChange?: any;\n header?: React.ReactNode;\n open?: any;\n LinkComponent?: any;\n}\nconst DropdownMenu: React.FC<DropdownMenuProps> = ({\n trigger,\n items,\n direction,\n sideOffset,\n side,\n className,\n triggerClassname,\n align,\n alignOffset,\n onItemSelect,\n size = \"default\",\n width = \"default\",\n header,\n onOpenChange,\n open,\n LinkComponent,\n}) => {\n const widthStyles = {\n default: \"hawa-min-w-[8rem]\",\n sm: \"hawa-w-fit\",\n lg: \"hawa-w-[200px]\",\n parent: \"ddm-w-parent\",\n };\n const sizeStyles = {\n default: \"hawa-px-2 hawa-py-3 \",\n sm: \"hawa-text-xs hawa-px-1.5 hawa-py-1.5 \",\n };\n\n return (\n <DropdownMenuRoot\n onOpenChange={onOpenChange}\n open={open}\n modal={false}\n dir={direction}\n >\n <DropdownMenuTrigger asChild className={triggerClassname}>\n {trigger}\n </DropdownMenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuContent\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n className={cn(\n className,\n widthStyles[width],\n \"hawa-flex hawa-flex-col hawa-gap-1 hawa-overflow-y-auto\",\n )}\n style={{\n maxHeight: \"var(--radix-dropdown-menu-content-available-height)\",\n }}\n >\n {header && header}\n {items &&\n items.map((item, index) => {\n const ItemLinkComponent = item.slug ? LinkComponent : \"a\";\n if (item.itemType === \"separator\") {\n return <DropdownMenuSeparator key={index} />;\n } else if (item.itemType === \"label\") {\n return (\n <DropdownMenuLabel key={index}>\n {item.label}\n </DropdownMenuLabel>\n );\n } else if (item.itemType === \"custom\") {\n return <div key={index}>{item.content}</div>;\n } else {\n return item.subitems ? (\n <DropdownMenuSub key={index}>\n <DropdownMenuSubTrigger\n dir={direction}\n className={cn(sizeStyles[size])}\n >\n {item.icon && item.icon}\n {item.label && item.label}\n </DropdownMenuSubTrigger>\n <DropdownMenuPortal>\n <DropdownMenuSubContent>\n {item.subitems.map((subitem, subIndex) => {\n const SubitemLinkComponent = subitem.slug\n ? LinkComponent\n : \"a\";\n return (\n <DropdownMenuItem\n key={subIndex}\n LinkComponent={SubitemLinkComponent}\n slug={subitem.slug}\n disabled={subitem.disabled}\n className={cn(\n sizeStyles[size],\n !item.icon && !item.label\n ? \"hawa-px-0 hawa-py-0 focus:hawa-bg-transparent\"\n : \"focus:hawa-bg-accent\",\n )}\n onMouseDown={(event: any) => {\n if (\n event.button === 1 ||\n (event.button === 0 && event.ctrlKey)\n ) {\n event.preventDefault(); // This line prevents the default behavior of the middle button\n if (subitem.onMiddleClick) {\n subitem.onMiddleClick(item.value);\n }\n }\n }}\n onSelect={() => {\n subitem.action && subitem.action();\n if (onItemSelect) {\n onItemSelect(subitem.value);\n }\n }}\n >\n {subitem.icon && subitem.icon}\n {subitem.label && subitem.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuSubContent>\n </DropdownMenuPortal>\n </DropdownMenuSub>\n ) : (\n <DropdownMenuItem\n LinkComponent={ItemLinkComponent}\n slug={item.slug}\n key={index}\n disabled={item.disabled}\n onMouseDown={(event: any) => {\n if (\n event.button === 1 ||\n (event.button === 0 && event.ctrlKey)\n ) {\n event.preventDefault(); // This line prevents the default behavior of the middle button\n if (item.onMiddleClick) {\n item.onMiddleClick(item.value);\n }\n }\n }}\n onClick={(event: any) => {\n if (item.onClick) {\n item.onClick(item.value);\n }\n }}\n onSelect={(e) => {\n if (item.presist) {\n e.preventDefault();\n }\n if (item.action) {\n item.action();\n if (onItemSelect) {\n onItemSelect(item.value);\n }\n } else {\n if (onItemSelect) {\n onItemSelect(item.value);\n }\n }\n }}\n end={item.end}\n shortcut={item.shortcut}\n badged={item.badged}\n className={cn(\n sizeStyles[size],\n !item.icon && !item.label\n ? \"hawa-px-0 hawa-py-0 focus:hawa-bg-transparent \"\n : \"focus:hawa-bg-accent \",\n item.presist && \"focus:hawa-bg-transparent\",\n )}\n >\n {item.icon && item.icon}\n {item.label && item.label}\n </DropdownMenuItem>\n );\n }\n })}\n </DropdownMenuContent>\n </DropdownMenuPortal>\n </DropdownMenuRoot>\n );\n};\ninterface DropdownMenuRadioProps {\n trigger?: React.ReactNode;\n side?: ExtendedDropdownMenuContentProps[\"side\"];\n align?: ExtendedDropdownMenuContentProps[\"align\"];\n options: { label?: any; value: string }[];\n value: string;\n onValueChange: any;\n label?: string;\n}\nconst DropdownMenuRadio: React.FC<DropdownMenuRadioProps> = (props) => {\n return (\n <DropdownMenuRoot>\n <DropdownMenuTrigger asChild>{props.trigger}</DropdownMenuTrigger>\n <DropdownMenuContent align={props.align} side={props.side}>\n {props.label && (\n <>\n <DropdownMenuLabel>{props.label}</DropdownMenuLabel>\n <DropdownMenuSeparator />\n </>\n )}\n <DropdownMenuRadioGroup\n value={props.value}\n onValueChange={props.onValueChange}\n >\n {props.options.map((opt, i) => (\n <DropdownMenuRadioItem key={i} value={opt.value}>\n {opt.label}\n </DropdownMenuRadioItem>\n ))}\n {/* \n <DropdownMenuRadioItem value=\"en\">English</DropdownMenuRadioItem> */}\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenuRoot>\n );\n};\n\nexport {\n DropdownMenu,\n DropdownMenuRoot,\n DropdownMenuRadio,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\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"],"mappings":";;;AAAA,YAAY,WAAW;AAEvB,YAAY,2BAA2B;;;ACFvC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADEA,IAAM,mBAAyC;AAC/C,IAAM,sBAA4C;AAClD,IAAM,oBAA0C;AAChD,IAAM,qBAA2C;AACjD,IAAM,kBAAwC;AAC9C,IAAM,yBAA+C;AAErD,IAAM,yBAA+B,iBAKnC,CAAC,EAAE,WAAW,OAAO,UAAU,GAAG,MAAM,GAAG,QAC3C;AAAA,EAAuB;AAAA,EAAtB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA,SAAS;AAAA,MACT;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AAAA,EAEJ,oCAAC,SAAI,WAAU,0DACZ,QACH;AAAA,EAAO;AAAA,EACP;AAAA,IAAC;AAAA;AAAA,MACC,cAAW;AAAA,MACX,QAAO;AAAA,MACP,MAAK;AAAA,MACL,aAAY;AAAA,MACZ,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,OAAM;AAAA,MACN,WAAW,GAAG,MAAM,QAAQ,QAAQ,oBAAoB,EAAE;AAAA;AAAA,IAE1D;AAAA,MAAC;AAAA;AAAA,QACC,UAAS;AAAA,QACT,GAAE;AAAA;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ACrE,SACE,oCAAC,wBACC,oCAAC,uBAAoB,SAAO,QAAE,MAAM,OAAQ,GAC5C,oCAAC,uBAAoB,OAAO,MAAM,OAAO,MAAM,MAAM,QAClD,MAAM,SACL,0DACE,oCAAC,yBAAmB,MAAM,KAAM,GAChC,oCAAC,2BAAsB,CACzB,GAEF;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,MAAM;AAAA,MACb,eAAe,MAAM;AAAA;AAAA,IAEpB,MAAM,QAAQ,IAAI,CAAC,KAAK,MACvB,oCAAC,yBAAsB,KAAK,GAAG,OAAO,IAAI,SACvC,IAAI,KACP,CACD;AAAA,EAGH,CACF,CACF;AAEJ;","names":[]}
|
1
|
+
{"version":3,"sources":["../../elements/dropdownMenu/DropdownMenu.tsx","../../util/index.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { cn } from \"@util/index\";\n\nimport { DirectionType, RadioOptionType } from \"../../types/commonTypes\";\n\nconst DropdownMenuRoot = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none focus:hawa-bg-accent data-[state=open]:hawa-bg-accent\",\n inset && \"hawa-pl-8\",\n className,\n )}\n {...props}\n >\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-2\">\n {children}\n </div>{\" \"}\n <svg\n aria-label=\"Chevron Right Icon\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 16 16\"\n height=\"1em\"\n width=\"1em\"\n className={cn(props.dir === \"rtl\" ? \"hawa-rotate-180\" : \"\")}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z\"\n ></path>\n </svg>\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"hawa-z-50 hawa-min-w-[8rem] hawa-gap-1 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-p-1 hawa-text-popover-foreground hawa-shadow-lg data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-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));\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.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-p-1 hawa-text-popover-foreground hawa-shadow-md data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-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 </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n end?: any;\n shortcut?: React.ReactNode;\n badged?: boolean;\n slug?: string;\n LinkComponent?: any;\n }\n>(({ className, inset, badged, slug, LinkComponent, ...props }, ref) => {\n return (\n <LinkComponent href={slug}>\n <DropdownMenuPrimitive.Item\n disabled={props.disabled}\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-justify-between hawa-rounded-sm hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n inset && \"hawa-pl-8\",\n props.end &&\n Array.isArray(props.children) &&\n props.children[1] &&\n \"hawa-gap-6\",\n className,\n )}\n {...props}\n >\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-2 \">\n {props.children}\n </div>\n\n {props.end && props.end}\n {!props.end && props.shortcut && (\n <DropdownMenuShortcut>{props.shortcut}</DropdownMenuShortcut>\n )}\n {!props.end && badged && (\n <div className=\"hawa-h-3 hawa-w-3 hawa-rounded-full hawa-bg-red-500\" />\n )}\n </DropdownMenuPrimitive.Item>\n </LinkComponent>\n );\n});\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n {/* <Check className=\"h-4 w-4\" /> */}\n <svg\n aria-label=\"Check Mark\"\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 512 512\"\n height=\"0.60em\"\n width=\"0.60em\"\n >\n <path d=\"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z\"></path>\n </svg>{\" \"}\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName =\n DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"hawa-relative hawa-flex hawa-cursor-pointer hawa-select-none hawa-items-center hawa-rounded-sm hawa-py-1.5 hawa-pl-8 hawa-pr-2 hawa-text-sm hawa-outline-none hawa-transition-colors focus:hawa-bg-accent focus:hawa-text-accent-foreground data-[disabled]:hawa-pointer-events-none data-[disabled]:hawa-opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"hawa-absolute hawa-left-2 hawa-flex hawa-h-3.5 hawa-w-3.5 hawa-items-center hawa-justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n aria-label=\"Circle\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"hawa-h-2 hawa-w-2 hawa-fill-current\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\"></circle>\n </svg>\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"hawa-px-2 hawa-py-1.5 hawa-text-sm hawa-font-semibold\",\n inset && \"hawa-pl-8\",\n className,\n )}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"hawa--mx-1 hawa-my-1 hawa-h-px hawa-bg-muted\", className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"hawa-text-xs hawa-tracking-widest hawa-opacity-60\",\n className,\n )}\n {...props}\n />\n );\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\ntype ExtendedDropdownMenuContentProps = Partial<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n> & {\n // Add any additional types or overrides here, for example:\n // side?: \"left\" | \"right\" | \"top\" | \"bottom\"\n};\ntype ExtendedDropdownMenuTriggerProps = Partial<\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Trigger>\n> & {\n // Add any additional types or overrides here, for example:\n // side?: \"left\" | \"right\" | \"top\" | \"bottom\"\n};\n\nexport type SubItem = {\n label?: string;\n value?: any;\n icon?: any;\n action?: () => void;\n onMiddleClick?: (e: any) => void;\n highlighted?: boolean;\n disabled?: boolean;\n slug?: string;\n};\nexport type MenuItemType = {\n icon?: React.ReactNode;\n label?: string;\n shortcut?: React.ReactNode;\n badged?: boolean;\n value?: any;\n content?: any;\n slug?: string;\n end?: any;\n presist?: boolean;\n itemType?: \"separator\" | \"label\" | \"custom\" | \"radio\";\n action?: () => void;\n highlighted?: boolean;\n subitems?: SubItem[];\n options?: RadioOptionType[];\n currentOption?: string;\n onOptionChange?: (value: string) => void;\n disabled?: boolean;\n onMiddleClick?: (e: any) => void;\n onClick?: any;\n};\ninterface DropdownMenuProps {\n trigger?: any;\n items: MenuItemType[];\n direction?: DirectionType;\n className?: ExtendedDropdownMenuContentProps[\"className\"];\n triggerClassname?: ExtendedDropdownMenuTriggerProps[\"className\"];\n sideOffset?: ExtendedDropdownMenuContentProps[\"sideOffset\"];\n side?: ExtendedDropdownMenuContentProps[\"side\"];\n align?: ExtendedDropdownMenuContentProps[\"align\"];\n alignOffset?: ExtendedDropdownMenuContentProps[\"alignOffset\"];\n width?: \"default\" | \"sm\" | \"lg\" | \"parent\";\n size?: \"default\" | \"sm\";\n onItemSelect?: any;\n onOpenChange?: any;\n header?: React.ReactNode;\n open?: any;\n LinkComponent?: any;\n}\nconst DropdownMenu: React.FC<DropdownMenuProps> = ({\n trigger,\n items,\n direction,\n sideOffset,\n side,\n className,\n triggerClassname,\n align,\n alignOffset,\n onItemSelect,\n size = \"default\",\n width = \"default\",\n header,\n onOpenChange,\n open,\n LinkComponent,\n}) => {\n const widthStyles = {\n default: \"hawa-min-w-[8rem]\",\n sm: \"hawa-w-fit\",\n lg: \"hawa-w-[200px]\",\n parent: \"ddm-w-parent\",\n };\n const sizeStyles = {\n default: \"hawa-px-2 hawa-py-3 \",\n sm: \"hawa-text-xs hawa-px-1.5 hawa-py-1.5 \",\n };\n let [values, setValues] = React.useState(\n items.map((item) => item.currentOption),\n );\n\n return (\n <DropdownMenuRoot\n onOpenChange={onOpenChange}\n open={open}\n modal={false}\n dir={direction}\n >\n <DropdownMenuTrigger asChild className={triggerClassname}>\n {trigger}\n </DropdownMenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuContent\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n className={cn(\n className,\n widthStyles[width],\n \"hawa-flex hawa-flex-col hawa-gap-1 hawa-overflow-y-auto\",\n )}\n style={{\n maxHeight: \"var(--radix-dropdown-menu-content-available-height)\",\n }}\n >\n {header && header}\n {items &&\n items.map((item, index) => {\n const ItemLinkComponent = item.slug ? LinkComponent : \"a\";\n if (item.itemType === \"separator\") {\n return <DropdownMenuSeparator key={index} />;\n } else if (item.itemType === \"label\") {\n return (\n <DropdownMenuLabel key={index}>\n {item.label}\n </DropdownMenuLabel>\n );\n } else if (item.itemType === \"radio\") {\n let dd = item.currentOption;\n return (\n <DropdownMenuSub key={index}>\n <DropdownMenuSubTrigger\n dir={direction}\n className={cn(sizeStyles[size])}\n >\n {item.icon && item.icon}\n {item.label && item.label}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuRadioGroup\n value={values[index]}\n onValueChange={(e) => {\n let newValues = [...values];\n newValues[index] = e;\n setValues(newValues);\n console.log(\"changing to \", e);\n if (item.onOptionChange) {\n item.onOptionChange(e);\n }\n }}\n >\n {item.options?.map((opt, i) => (\n <DropdownMenuRadioItem key={i} value={opt.value}>\n {opt.label}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n } else if (item.itemType === \"custom\") {\n return <div key={index}>{item.content}</div>;\n } else {\n return item.subitems ? (\n <DropdownMenuSub key={index}>\n <DropdownMenuSubTrigger\n dir={direction}\n className={cn(sizeStyles[size])}\n >\n {item.icon && item.icon}\n {item.label && item.label}\n </DropdownMenuSubTrigger>\n <DropdownMenuPortal>\n <DropdownMenuSubContent>\n {item.subitems.map((subitem, subIndex) => {\n const SubitemLinkComponent = subitem.slug\n ? LinkComponent\n : \"a\";\n return (\n <DropdownMenuItem\n key={subIndex}\n LinkComponent={SubitemLinkComponent}\n slug={subitem.slug}\n disabled={subitem.disabled}\n className={cn(\n sizeStyles[size],\n !item.icon && !item.label\n ? \"hawa-px-0 hawa-py-0 focus:hawa-bg-transparent\"\n : \"focus:hawa-bg-accent\",\n )}\n onMouseDown={(event: any) => {\n if (\n event.button === 1 ||\n (event.button === 0 && event.ctrlKey)\n ) {\n event.preventDefault(); // This line prevents the default behavior of the middle button\n if (subitem.onMiddleClick) {\n subitem.onMiddleClick(item.value);\n }\n }\n }}\n onSelect={() => {\n subitem.action && subitem.action();\n if (onItemSelect) {\n onItemSelect(subitem.value);\n }\n }}\n >\n {subitem.icon && subitem.icon}\n {subitem.label && subitem.label}\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuSubContent>\n </DropdownMenuPortal>\n </DropdownMenuSub>\n ) : (\n <DropdownMenuItem\n LinkComponent={ItemLinkComponent}\n slug={item.slug}\n key={index}\n disabled={item.disabled}\n onMouseDown={(event: any) => {\n if (\n event.button === 1 ||\n (event.button === 0 && event.ctrlKey)\n ) {\n event.preventDefault(); // This line prevents the default behavior of the middle button\n if (item.onMiddleClick) {\n item.onMiddleClick(item.value);\n }\n }\n }}\n onClick={(event: any) => {\n if (item.onClick) {\n item.onClick(item.value);\n }\n }}\n onSelect={(e) => {\n if (item.presist) {\n e.preventDefault();\n }\n if (item.action) {\n item.action();\n if (onItemSelect) {\n onItemSelect(item.value);\n }\n } else {\n if (onItemSelect) {\n onItemSelect(item.value);\n }\n }\n }}\n end={item.end}\n shortcut={item.shortcut}\n badged={item.badged}\n className={cn(\n sizeStyles[size],\n !item.icon && !item.label\n ? \"hawa-px-0 hawa-py-0 focus:hawa-bg-transparent \"\n : \"focus:hawa-bg-accent \",\n item.presist && \"focus:hawa-bg-transparent\",\n )}\n >\n {item.icon && item.icon}\n {item.label && item.label}\n </DropdownMenuItem>\n );\n }\n })}\n </DropdownMenuContent>\n </DropdownMenuPortal>\n </DropdownMenuRoot>\n );\n};\ninterface DropdownMenuRadioProps {\n trigger?: React.ReactNode;\n side?: ExtendedDropdownMenuContentProps[\"side\"];\n align?: ExtendedDropdownMenuContentProps[\"align\"];\n options: RadioOptionType[];\n value: string;\n onValueChange: any;\n label?: string;\n}\nconst DropdownMenuRadio: React.FC<DropdownMenuRadioProps> = (props) => {\n return (\n <DropdownMenuRoot>\n <DropdownMenuTrigger asChild>{props.trigger}</DropdownMenuTrigger>\n <DropdownMenuContent align={props.align} side={props.side}>\n {props.label && (\n <>\n <DropdownMenuLabel>{props.label}</DropdownMenuLabel>\n <DropdownMenuSeparator />\n </>\n )}\n <DropdownMenuRadioGroup\n value={props.value}\n onValueChange={props.onValueChange}\n >\n {props.options.map((opt, i) => (\n <DropdownMenuRadioItem key={i} value={opt.value}>\n {opt.label}\n </DropdownMenuRadioItem>\n ))}\n {/* \n <DropdownMenuRadioItem value=\"en\">English</DropdownMenuRadioItem> */}\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenuRoot>\n );\n};\n\nexport {\n DropdownMenu,\n DropdownMenuRoot,\n DropdownMenuRadio,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\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"],"mappings":";;;AAAA,YAAY,WAAW;AAEvB,YAAY,2BAA2B;;;ACFvC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADEA,IAAM,mBAAyC;AAC/C,IAAM,sBAA4C;AAClD,IAAM,oBAA0C;AAChD,IAAM,qBAA2C;AACjD,IAAM,kBAAwC;AAC9C,IAAM,yBAA+C;AAErD,IAAM,yBAA+B,iBAKnC,CAAC,EAAE,WAAW,OAAO,UAAU,GAAG,MAAM,GAAG,QAC3C;AAAA,EAAuB;AAAA,EAAtB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA,SAAS;AAAA,MACT;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AAAA,EAEJ,oCAAC,SAAI,WAAU,0DACZ,QACH;AAAA,EAAO;AAAA,EACP;AAAA,IAAC;AAAA;AAAA,MACC,cAAW;AAAA,MAC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IAAC;AAAA;AAAA,MACC,OAAO,MAAM;AAAA,MACb,eAAe,MAAM;AAAA;AAAA,IAEpB,MAAM,QAAQ,IAAI,CAAC,KAAK,MACvB,oCAAC,yBAAsB,KAAK,GAAG,OAAO,IAAI,SACvC,IAAI,KACP,CACD;AAAA,EAGH,CACF,CACF;AAEJ;","names":[]}
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
2
2
|
import React__default, { FC, RefObject, ReactNode, ChangeEvent, InputHTMLAttributes } from 'react';
|
3
3
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
4
4
|
import { P as PositionType, D as DirectionType, S as SeverityType, R as RadiusType, O as OrientationType } from '../commonTypes-CKtkuNFH.mjs';
|
5
|
-
export { D as DropdownMenu, f as DropdownMenuCheckboxItem, d as DropdownMenuContent, k as DropdownMenuGroup, e as DropdownMenuItem, h as DropdownMenuLabel, l as DropdownMenuPortal, b as DropdownMenuRadio, p as DropdownMenuRadioGroup, g as DropdownMenuRadioItem, a as DropdownMenuRoot, i as DropdownMenuSeparator, j as DropdownMenuShortcut, m as DropdownMenuSub, n as DropdownMenuSubContent, o as DropdownMenuSubTrigger, c as DropdownMenuTrigger, M as MenuItemType, S as SubItem } from '../DropdownMenu-
|
5
|
+
export { D as DropdownMenu, f as DropdownMenuCheckboxItem, d as DropdownMenuContent, k as DropdownMenuGroup, e as DropdownMenuItem, h as DropdownMenuLabel, l as DropdownMenuPortal, b as DropdownMenuRadio, p as DropdownMenuRadioGroup, g as DropdownMenuRadioItem, a as DropdownMenuRoot, i as DropdownMenuSeparator, j as DropdownMenuShortcut, m as DropdownMenuSub, n as DropdownMenuSubContent, o as DropdownMenuSubTrigger, c as DropdownMenuTrigger, M as MenuItemType, S as SubItem } from '../DropdownMenu-o_-MnT5h.mjs';
|
6
6
|
import { a as ChipTypes } from '../Chip-hr2gRBJ-.mjs';
|
7
7
|
export { b as Chip, C as ChipColors } from '../Chip-hr2gRBJ-.mjs';
|
8
8
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
package/dist/elements/index.d.ts
CHANGED
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
2
2
|
import React__default, { FC, RefObject, ReactNode, ChangeEvent, InputHTMLAttributes } from 'react';
|
3
3
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
4
4
|
import { P as PositionType, D as DirectionType, S as SeverityType, R as RadiusType, O as OrientationType } from '../commonTypes-CKtkuNFH.js';
|
5
|
-
export { D as DropdownMenu, f as DropdownMenuCheckboxItem, d as DropdownMenuContent, k as DropdownMenuGroup, e as DropdownMenuItem, h as DropdownMenuLabel, l as DropdownMenuPortal, b as DropdownMenuRadio, p as DropdownMenuRadioGroup, g as DropdownMenuRadioItem, a as DropdownMenuRoot, i as DropdownMenuSeparator, j as DropdownMenuShortcut, m as DropdownMenuSub, n as DropdownMenuSubContent, o as DropdownMenuSubTrigger, c as DropdownMenuTrigger, M as MenuItemType, S as SubItem } from '../DropdownMenu-
|
5
|
+
export { D as DropdownMenu, f as DropdownMenuCheckboxItem, d as DropdownMenuContent, k as DropdownMenuGroup, e as DropdownMenuItem, h as DropdownMenuLabel, l as DropdownMenuPortal, b as DropdownMenuRadio, p as DropdownMenuRadioGroup, g as DropdownMenuRadioItem, a as DropdownMenuRoot, i as DropdownMenuSeparator, j as DropdownMenuShortcut, m as DropdownMenuSub, n as DropdownMenuSubContent, o as DropdownMenuSubTrigger, c as DropdownMenuTrigger, M as MenuItemType, S as SubItem } from '../DropdownMenu-p-Ha-y2R.js';
|
6
6
|
import { a as ChipTypes } from '../Chip-H5BnuDdx.js';
|
7
7
|
export { b as Chip, C as ChipColors } from '../Chip-H5BnuDdx.js';
|
8
8
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
package/dist/elements/index.js
CHANGED
@@ -825,6 +825,9 @@ var DropdownMenu = ({
|
|
825
825
|
default: "hawa-px-2 hawa-py-3 ",
|
826
826
|
sm: "hawa-text-xs hawa-px-1.5 hawa-py-1.5 "
|
827
827
|
};
|
828
|
+
let [values, setValues] = React5.useState(
|
829
|
+
items.map((item) => item.currentOption)
|
830
|
+
);
|
828
831
|
return /* @__PURE__ */ React5.createElement(
|
829
832
|
DropdownMenuRoot,
|
830
833
|
{
|
@@ -852,11 +855,38 @@ var DropdownMenu = ({
|
|
852
855
|
},
|
853
856
|
header && header,
|
854
857
|
items && items.map((item, index) => {
|
858
|
+
var _a;
|
855
859
|
const ItemLinkComponent = item.slug ? LinkComponent : "a";
|
856
860
|
if (item.itemType === "separator") {
|
857
861
|
return /* @__PURE__ */ React5.createElement(DropdownMenuSeparator, { key: index });
|
858
862
|
} else if (item.itemType === "label") {
|
859
863
|
return /* @__PURE__ */ React5.createElement(DropdownMenuLabel, { key: index }, item.label);
|
864
|
+
} else if (item.itemType === "radio") {
|
865
|
+
let dd = item.currentOption;
|
866
|
+
return /* @__PURE__ */ React5.createElement(DropdownMenuSub, { key: index }, /* @__PURE__ */ React5.createElement(
|
867
|
+
DropdownMenuSubTrigger,
|
868
|
+
{
|
869
|
+
dir: direction,
|
870
|
+
className: cn(sizeStyles2[size])
|
871
|
+
},
|
872
|
+
item.icon && item.icon,
|
873
|
+
item.label && item.label
|
874
|
+
), /* @__PURE__ */ React5.createElement(DropdownMenuSubContent, null, /* @__PURE__ */ React5.createElement(
|
875
|
+
DropdownMenuRadioGroup,
|
876
|
+
{
|
877
|
+
value: values[index],
|
878
|
+
onValueChange: (e) => {
|
879
|
+
let newValues = [...values];
|
880
|
+
newValues[index] = e;
|
881
|
+
setValues(newValues);
|
882
|
+
console.log("changing to ", e);
|
883
|
+
if (item.onOptionChange) {
|
884
|
+
item.onOptionChange(e);
|
885
|
+
}
|
886
|
+
}
|
887
|
+
},
|
888
|
+
(_a = item.options) == null ? void 0 : _a.map((opt, i) => /* @__PURE__ */ React5.createElement(DropdownMenuRadioItem, { key: i, value: opt.value }, opt.label))
|
889
|
+
)));
|
860
890
|
} else if (item.itemType === "custom") {
|
861
891
|
return /* @__PURE__ */ React5.createElement("div", { key: index }, item.content);
|
862
892
|
} else {
|
@@ -3704,46 +3734,55 @@ var Combobox = React27.forwardRef(
|
|
3704
3734
|
}
|
3705
3735
|
),
|
3706
3736
|
/* @__PURE__ */ React27.createElement(CommandEmpty, null, ((_c = props.texts) == null ? void 0 : _c.noItems) || "No items found."),
|
3707
|
-
/* @__PURE__ */ React27.createElement(CommandList, null, /* @__PURE__ */ React27.createElement(
|
3708
|
-
|
3737
|
+
/* @__PURE__ */ React27.createElement(CommandList, null, /* @__PURE__ */ React27.createElement(
|
3738
|
+
CommandGroup,
|
3709
3739
|
{
|
3710
|
-
|
3711
|
-
|
3712
|
-
|
3713
|
-
|
3714
|
-
|
3715
|
-
|
3716
|
-
|
3717
|
-
|
3740
|
+
className: cn(
|
3741
|
+
"hawa-max-h-[200px]",
|
3742
|
+
data.length > 0 && "hawa-overflow-y-scroll"
|
3743
|
+
)
|
3744
|
+
},
|
3745
|
+
data.map((item, i) => /* @__PURE__ */ React27.createElement(
|
3746
|
+
CommandItem,
|
3747
|
+
{
|
3748
|
+
key: i,
|
3749
|
+
onSelect: () => {
|
3750
|
+
const newValue = getProperty(item, valueKey);
|
3751
|
+
setValue(
|
3718
3752
|
newValue === value ? "" : newValue
|
3719
3753
|
);
|
3754
|
+
if (props.onChange) {
|
3755
|
+
props.onChange(
|
3756
|
+
newValue === value ? "" : newValue
|
3757
|
+
);
|
3758
|
+
}
|
3759
|
+
setOpen(false);
|
3720
3760
|
}
|
3721
|
-
setOpen(false);
|
3722
|
-
}
|
3723
|
-
},
|
3724
|
-
/* @__PURE__ */ React27.createElement(
|
3725
|
-
"svg",
|
3726
|
-
{
|
3727
|
-
"aria-label": "Check Icon",
|
3728
|
-
xmlns: "http://www.w3.org/2000/svg",
|
3729
|
-
width: "24",
|
3730
|
-
height: "24",
|
3731
|
-
viewBox: "0 0 24 24",
|
3732
|
-
fill: "none",
|
3733
|
-
stroke: "currentColor",
|
3734
|
-
strokeWidth: "2",
|
3735
|
-
strokeLinecap: "round",
|
3736
|
-
strokeLinejoin: "round",
|
3737
|
-
className: cn(
|
3738
|
-
"hawa-icon",
|
3739
|
-
value === getProperty(item, valueKey) ? "hawa-opacity-100" : "hawa-opacity-0"
|
3740
|
-
),
|
3741
|
-
style: { marginInlineEnd: "0.5rem" }
|
3742
3761
|
},
|
3743
|
-
/* @__PURE__ */ React27.createElement(
|
3744
|
-
|
3745
|
-
|
3746
|
-
|
3762
|
+
/* @__PURE__ */ React27.createElement(
|
3763
|
+
"svg",
|
3764
|
+
{
|
3765
|
+
"aria-label": "Check Icon",
|
3766
|
+
xmlns: "http://www.w3.org/2000/svg",
|
3767
|
+
width: "24",
|
3768
|
+
height: "24",
|
3769
|
+
viewBox: "0 0 24 24",
|
3770
|
+
fill: "none",
|
3771
|
+
stroke: "currentColor",
|
3772
|
+
strokeWidth: "2",
|
3773
|
+
strokeLinecap: "round",
|
3774
|
+
strokeLinejoin: "round",
|
3775
|
+
className: cn(
|
3776
|
+
"hawa-icon",
|
3777
|
+
value === getProperty(item, valueKey) ? "hawa-opacity-100" : "hawa-opacity-0"
|
3778
|
+
),
|
3779
|
+
style: { marginInlineEnd: "0.5rem" }
|
3780
|
+
},
|
3781
|
+
/* @__PURE__ */ React27.createElement("polyline", { points: "20 6 9 17 4 12" })
|
3782
|
+
),
|
3783
|
+
renderOption ? renderOption(item) : getProperty(item, labelKey)
|
3784
|
+
))
|
3785
|
+
))
|
3747
3786
|
)
|
3748
3787
|
))
|
3749
3788
|
);
|