@sikka/hawa 0.30.11-next → 0.30.13-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/{Radio-MHGhfbpA.d.ts → Radio-uPqJwFGq.d.ts} +2 -2
- package/dist/{Radio-ZM5l4CwH.d.mts → Radio-zXrZBXwJ.d.mts} +2 -2
- package/dist/blocks/auth/index.js +1 -1
- package/dist/blocks/auth/index.mjs +1 -1
- package/dist/blocks/feedback/index.js +179 -177
- package/dist/blocks/feedback/index.mjs +1 -1
- package/dist/blocks/index.d.mts +1 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/index.js +180 -178
- package/dist/blocks/index.mjs +2 -2
- package/dist/blocks/pricing/index.js +179 -177
- package/dist/blocks/pricing/index.mjs +1 -1
- package/dist/card/index.js.map +1 -1
- package/dist/card/index.mjs.map +1 -1
- package/dist/{chunk-3GZMGTI5.mjs → chunk-MPRDKNFN.mjs} +180 -178
- package/dist/chunk-WQK2TN4F.mjs +215 -0
- package/dist/dataTable/index.js.map +1 -1
- package/dist/dataTable/index.mjs.map +1 -1
- package/dist/destroyableCard/index.js.map +1 -1
- package/dist/destroyableCard/index.mjs.map +1 -1
- package/dist/elements/index.d.mts +2 -2
- package/dist/elements/index.d.ts +2 -2
- package/dist/elements/index.js +179 -177
- package/dist/elements/index.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +180 -178
- package/dist/index.mjs +181 -179
- package/dist/input/index.js.map +1 -1
- package/dist/input/index.mjs.map +1 -1
- package/dist/interfaceSettings/index.js +179 -177
- package/dist/interfaceSettings/index.js.map +1 -1
- package/dist/interfaceSettings/index.mjs +180 -178
- package/dist/interfaceSettings/index.mjs.map +1 -1
- package/dist/passwordInput/index.js.map +1 -1
- package/dist/passwordInput/index.mjs.map +1 -1
- package/dist/radio/index.d.mts +2 -2
- package/dist/radio/index.d.ts +2 -2
- package/dist/radio/index.js +179 -177
- package/dist/radio/index.js.map +1 -1
- package/dist/radio/index.mjs +180 -178
- package/dist/radio/index.mjs.map +1 -1
- package/dist/stats/index.js.map +1 -1
- package/dist/stats/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-U42KD2OQ.mjs +0 -213
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../elements/destroyableCard/DestroyableCard.tsx","../../util/index.ts","../../elements/card/Card.tsx"],"sourcesContent":["import React, { FC, useRef, useState } from \"react\";\n\nimport { DirectionType } from \"@_types/commonTypes\";\n\nimport { cn } from \"@util/index\";\nimport { Card, CardContent } from \"../card\";\n\ntype DestroyableCard = {\n position?: \"bottom-right\" | \"bottom-left\";\n direction?: DirectionType;\n fixed?: boolean;\n children?: any;\n};\nexport const DestroyableCard: FC<DestroyableCard> = ({\n position = \"bottom-right\",\n fixed,\n direction,\n ...props\n}) => {\n const [closed, setClosed] = useState(false);\n const popUpRef = useRef<HTMLDivElement>(null);\n\n const boxPosition = {\n \"bottom-right\": \"hawa-right-4 hawa-bottom-4\",\n \"bottom-left\": \"hawa-left-4 hawa-bottom-4\"\n };\n\n return (\n <div\n className={cn(\n \"hawa-transition-all\",\n closed ? \"hawa-opacity-0\" : \"hawa-opacity-100\"\n )}\n ref={popUpRef}\n >\n <Card\n className={cn(\n fixed ? \"hawa-fixed\" : \"hawa-relative\",\n fixed && position && boxPosition[position]\n )}\n dir={direction}\n >\n <button\n type=\"button\"\n className={cn(\n direction === \"rtl\" ? \"hawa-left-2\" : \"hawa-right-2\",\n \"hawa-absolute hawa-top-2 hawa-inline-flex hawa-h-8 hawa-w-8 hawa-rounded hawa-p-1.5 hawa-text-gray-400 hawa-transition-all hover:hawa-bg-gray-100 hover:hawa-text-gray-900 focus:hawa-ring-2 focus:hawa-ring-gray-300 dark:hawa-bg-gray-800 dark:hawa-text-gray-500 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-white\"\n )}\n data-dismiss-target=\"#destroyable-card\"\n aria-label=\"Close\"\n onClick={() => {\n setClosed(true);\n setTimeout(() => {\n if (popUpRef?.current) {\n popUpRef?.current.removeChild(popUpRef?.current.children[0]);\n }\n }, 200);\n }}\n >\n <svg\n aria-hidden=\"true\"\n className=\"hawa-h-5 hawa-w-5\"\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z\"\n clipRule=\"evenodd\"\n ></path>\n </svg>\n </button>\n <CardContent headless>{props.children}</CardContent>\n </Card>\n </div>\n );\n};\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\ntype Palette = {\n name: string;\n colors: {\n [key: number]: string;\n };\n};\ntype Rgb = {\n r: number;\n g: number;\n b: number;\n};\nfunction hexToRgb(hex: string): Rgb | null {\n const sanitizedHex = hex.replaceAll(\"##\", \"#\");\n const colorParts = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(\n sanitizedHex\n );\n\n if (!colorParts) {\n return null;\n }\n\n const [, r, g, b] = colorParts;\n\n return {\n r: parseInt(r, 16),\n g: parseInt(g, 16),\n b: parseInt(b, 16)\n } as Rgb;\n}\n\nfunction rgbToHex(r: number, g: number, b: number): string {\n const toHex = (c: number) => `0${c.toString(16)}`.slice(-2);\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}\n\nexport function getTextColor(color: string): \"#FFF\" | \"#333\" {\n const rgbColor = hexToRgb(color);\n\n if (!rgbColor) {\n return \"#333\";\n }\n\n const { r, g, b } = rgbColor;\n const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n return luma < 120 ? \"#FFF\" : \"#333\";\n}\n\nfunction lighten(hex: string, intensity: number): string {\n const color = hexToRgb(`#${hex}`);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r + (255 - color.r) * intensity);\n const g = Math.round(color.g + (255 - color.g) * intensity);\n const b = Math.round(color.b + (255 - color.b) * intensity);\n\n return rgbToHex(r, g, b);\n}\n\nfunction darken(hex: string, intensity: number): string {\n const color = hexToRgb(hex);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r * intensity);\n const g = Math.round(color.g * intensity);\n const b = Math.round(color.b * intensity);\n\n return rgbToHex(r, g, b);\n}\nconst parseColor = (color: any) => {\n if (color.startsWith(\"#\")) {\n // Convert hex to RGB\n let r = parseInt(color.slice(1, 3), 16);\n let g = parseInt(color.slice(3, 5), 16);\n let b = parseInt(color.slice(5, 7), 16);\n return [r, g, b];\n } else if (color.startsWith(\"rgb\")) {\n // Extract RGB values from rgb() format\n return color.match(/\\d+/g).map(Number);\n }\n // Default to white if format is unrecognized\n return [255, 255, 255];\n};\nexport const calculateLuminance = (color: any) => {\n const [r, g, b] = parseColor(color)?.map((c: any) => {\n c /= 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nfunction getPallette(baseColor: string): Palette {\n const name = baseColor;\n\n const response: Palette = {\n name,\n colors: {\n 500: `#${baseColor}`.replace(\"##\", \"#\")\n }\n };\n\n const intensityMap: {\n [key: number]: number;\n } = {\n 50: 0.95,\n 100: 0.9,\n 200: 0.75,\n 300: 0.6,\n 400: 0.3,\n 600: 0.9,\n 700: 0.75,\n 800: 0.6,\n 900: 0.49\n };\n\n [50, 100, 200, 300, 400].forEach((level) => {\n response.colors[level] = lighten(baseColor, intensityMap[level]);\n });\n [600, 700, 800, 900].forEach((level) => {\n response.colors[level] = darken(baseColor, intensityMap[level]);\n });\n\n return response as Palette;\n}\n\nexport { getPallette };\n\n// const hexToRgb = (hex) => {\n// let d = hex?.split(\"#\")[1];\n// var aRgbHex = d?.match(/.{1,2}/g);\n// var aRgb = [\n// parseInt(aRgbHex[0], 16),\n// parseInt(aRgbHex[1], 16),\n// parseInt(aRgbHex[2], 16)\n// ];\n// return aRgb;\n// };\n// const getTextColor = (backColor) => {\n// let rgbArray = hexToRgb(backColor);\n// if (rgbArray[0] * 0.299 + rgbArray[1] * 0.587 + rgbArray[2] * 0.114 > 186) {\n// return \"#000000\";\n// } else {\n// return \"#ffffff\";\n// }\n// };\n// const replaceAt = function (string, index, replacement) {\n// // if (replacement == \"\" || replacement == \" \") {\n// // return (\n// // string.substring(0, index) +\n// // string.substring(index + replacement.length )\n// // );\n// // }\n// const replaced = string.substring(0, index) + replacement + string.substring(index + 1)\n// return replaced\n// };\n\n// export { hexToRgb, getTextColor, replaceAt };\n","import * as React from \"react\";\n\nimport { cn } from \"@util/index\";\n\ninterface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n clickable?: boolean;\n variant?: \"default\" | \"neoBrutalism\";\n}\n\ntype CardContentProps = {\n headless?: boolean;\n noPadding?: boolean;\n} & React.HTMLAttributes<HTMLDivElement>;\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(\n ({ className, variant = \"default\", clickable = false, ...props }, ref) => {\n let variantStyles = {\n default: cn(\n \"hawa-rounded-lg hawa-border hawa-bg-card hawa-text-card-foreground hawa-shadow-sm\",\n clickable &&\n \"hawa-cursor-pointer hawa-transition-all hover:hawa-drop-shadow-md dark:hover:dark-shadow\"\n ),\n neoBrutalism: cn(\n \"neo-brutalism\",\n // \"hawa-transition-all hawa-uppercase hawa-font-mono dark:hawa-bg-black hawa-font-bold hawa-py-2 hawa-px-4 hawa-rounded hawa-border-2 hawa-border-primary hawa-shadow-color-primary hawa-transition-[hawa-transform_50ms, hawa-box-shadow_50ms] transition-all uppercase font-mono dark:bg-black font-bold py-2 px-4 rounded border-2 border-primary shadow-color-primary transition-[transform_50ms, box-shadow_50ms]\",\n clickable &&\n \"hawa-cursor-pointer active:hawa-translate-x-0.5 active:hawa-translate-y-0.5 active:hawa-shadow-color-primary-active active:translate-x-0.5 active:translate-y-0.5 active:shadow-color-primary-active\"\n )\n };\n return (\n <div\n ref={ref}\n className={cn(className, variantStyles[variant])}\n {...props}\n />\n );\n }\n);\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"hawa-flex hawa-flex-col hawa-space-y-1.5 hawa-p-6\",\n className\n )}\n {...props}\n />\n));\nconst CardTitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h3\n ref={ref}\n className={cn(\"hawa-text-2xl hawa-font-semibold \", className)}\n {...props}\n />\n));\nconst CardDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(\"hawa-text-sm hawa-text-muted-foreground\", className)}\n {...props}\n />\n));\nconst CardContent = React.forwardRef<HTMLDivElement, CardContentProps>(\n ({ headless, noPadding, className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n noPadding ? \"hawa-p-0\" : \"hawa-p-6\",\n headless ? \"hawa-pt-6\" : \"hawa-pt-0\",\n className\n )}\n {...props}\n />\n )\n);\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & { noPadding?: boolean }\n>(({ className, noPadding, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n noPadding ? \"hawa-p-0\" : \"hawa-p-6\",\n \"hawa-flex hawa-items-center hawa-pt-0\",\n className\n )}\n {...props}\n />\n));\n\nCardDescription.displayName = \"CardDescription\";\nCardContent.displayName = \"CardContent\";\nCardHeader.displayName = \"CardHeader\";\nCardFooter.displayName = \"CardFooter\";\nCardTitle.displayName = \"CardTitle\";\nCard.displayName = \"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,sBAAU,IAAI;AACd,uBAAW,MAAM;AACf,kBAAI,qCAAU,SAAS;AACrB,qDAAU,QAAQ,YAAY,qCAAU,QAAQ,SAAS;AAAA,cAC3D;AAAA,YACF,GAAG,GAAG;AAAA,UACR;AAAA;AAAA,QAEA,gBAAAA,OAAA;AAAA,UAAC;AAAA;AAAA,YACC,eAAY;AAAA,YACZ,WAAU;AAAA,YACV,MAAK;AAAA,YACL,SAAQ;AAAA;AAAA,UAER,gBAAAA,OAAA;AAAA,YAAC;AAAA;AAAA,cACC,UAAS;AAAA,cACT,GAAE;AAAA,cACF,UAAS;AAAA;AAAA,UACV;AAAA,QACH;AAAA,MACF;AAAA,MACA,gBAAAA,OAAA,cAAC,eAAY,UAAQ,QAAE,MAAM,QAAS;AAAA,IACxC;AAAA,EACF;AAEJ;","names":["React","React"]}
|
1
|
+
{"version":3,"sources":["../../elements/destroyableCard/DestroyableCard.tsx","../../util/index.ts","../../elements/card/Card.tsx"],"sourcesContent":["import React, { FC, useRef, useState } from \"react\";\n\nimport { DirectionType } from \"@_types/commonTypes\";\n\nimport { cn } from \"@util/index\";\nimport { Card, CardContent } from \"../card\";\n\ntype DestroyableCard = {\n position?: \"bottom-right\" | \"bottom-left\";\n direction?: DirectionType;\n fixed?: boolean;\n children?: any;\n};\nexport const DestroyableCard: FC<DestroyableCard> = ({\n position = \"bottom-right\",\n fixed,\n direction,\n ...props\n}) => {\n const [closed, setClosed] = useState(false);\n const popUpRef = useRef<HTMLDivElement>(null);\n\n const boxPosition = {\n \"bottom-right\": \"hawa-right-4 hawa-bottom-4\",\n \"bottom-left\": \"hawa-left-4 hawa-bottom-4\"\n };\n\n return (\n <div\n className={cn(\n \"hawa-transition-all\",\n closed ? \"hawa-opacity-0\" : \"hawa-opacity-100\"\n )}\n ref={popUpRef}\n >\n <Card\n className={cn(\n fixed ? \"hawa-fixed\" : \"hawa-relative\",\n fixed && position && boxPosition[position]\n )}\n dir={direction}\n >\n <button\n type=\"button\"\n className={cn(\n direction === \"rtl\" ? \"hawa-left-2\" : \"hawa-right-2\",\n \"hawa-absolute hawa-top-2 hawa-inline-flex hawa-h-8 hawa-w-8 hawa-rounded hawa-p-1.5 hawa-text-gray-400 hawa-transition-all hover:hawa-bg-gray-100 hover:hawa-text-gray-900 focus:hawa-ring-2 focus:hawa-ring-gray-300 dark:hawa-bg-gray-800 dark:hawa-text-gray-500 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-white\"\n )}\n data-dismiss-target=\"#destroyable-card\"\n aria-label=\"Close\"\n onClick={() => {\n setClosed(true);\n setTimeout(() => {\n if (popUpRef?.current) {\n popUpRef?.current.removeChild(popUpRef?.current.children[0]);\n }\n }, 200);\n }}\n >\n <svg\n aria-hidden=\"true\"\n className=\"hawa-h-5 hawa-w-5\"\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z\"\n clipRule=\"evenodd\"\n ></path>\n </svg>\n </button>\n <CardContent headless>{props.children}</CardContent>\n </Card>\n </div>\n );\n};\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\ntype Palette = {\n name: string;\n colors: {\n [key: number]: string;\n };\n};\ntype Rgb = {\n r: number;\n g: number;\n b: number;\n};\nfunction hexToRgb(hex: string): Rgb | null {\n const sanitizedHex = hex.replaceAll(\"##\", \"#\");\n const colorParts = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(\n sanitizedHex\n );\n\n if (!colorParts) {\n return null;\n }\n\n const [, r, g, b] = colorParts;\n\n return {\n r: parseInt(r, 16),\n g: parseInt(g, 16),\n b: parseInt(b, 16)\n } as Rgb;\n}\n\nfunction rgbToHex(r: number, g: number, b: number): string {\n const toHex = (c: number) => `0${c.toString(16)}`.slice(-2);\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}\n\nexport function getTextColor(color: string): \"#FFF\" | \"#333\" {\n const rgbColor = hexToRgb(color);\n\n if (!rgbColor) {\n return \"#333\";\n }\n\n const { r, g, b } = rgbColor;\n const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n return luma < 120 ? \"#FFF\" : \"#333\";\n}\n\nfunction lighten(hex: string, intensity: number): string {\n const color = hexToRgb(`#${hex}`);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r + (255 - color.r) * intensity);\n const g = Math.round(color.g + (255 - color.g) * intensity);\n const b = Math.round(color.b + (255 - color.b) * intensity);\n\n return rgbToHex(r, g, b);\n}\n\nfunction darken(hex: string, intensity: number): string {\n const color = hexToRgb(hex);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r * intensity);\n const g = Math.round(color.g * intensity);\n const b = Math.round(color.b * intensity);\n\n return rgbToHex(r, g, b);\n}\nconst parseColor = (color: any) => {\n if (color.startsWith(\"#\")) {\n // Convert hex to RGB\n let r = parseInt(color.slice(1, 3), 16);\n let g = parseInt(color.slice(3, 5), 16);\n let b = parseInt(color.slice(5, 7), 16);\n return [r, g, b];\n } else if (color.startsWith(\"rgb\")) {\n // Extract RGB values from rgb() format\n return color.match(/\\d+/g).map(Number);\n }\n // Default to white if format is unrecognized\n return [255, 255, 255];\n};\nexport const calculateLuminance = (color: any) => {\n const [r, g, b] = parseColor(color)?.map((c: any) => {\n c /= 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nfunction getPallette(baseColor: string): Palette {\n const name = baseColor;\n\n const response: Palette = {\n name,\n colors: {\n 500: `#${baseColor}`.replace(\"##\", \"#\")\n }\n };\n\n const intensityMap: {\n [key: number]: number;\n } = {\n 50: 0.95,\n 100: 0.9,\n 200: 0.75,\n 300: 0.6,\n 400: 0.3,\n 600: 0.9,\n 700: 0.75,\n 800: 0.6,\n 900: 0.49\n };\n\n [50, 100, 200, 300, 400].forEach((level) => {\n response.colors[level] = lighten(baseColor, intensityMap[level]);\n });\n [600, 700, 800, 900].forEach((level) => {\n response.colors[level] = darken(baseColor, intensityMap[level]);\n });\n\n return response as Palette;\n}\n\nexport { getPallette };\n\n// const hexToRgb = (hex) => {\n// let d = hex?.split(\"#\")[1];\n// var aRgbHex = d?.match(/.{1,2}/g);\n// var aRgb = [\n// parseInt(aRgbHex[0], 16),\n// parseInt(aRgbHex[1], 16),\n// parseInt(aRgbHex[2], 16)\n// ];\n// return aRgb;\n// };\n// const getTextColor = (backColor) => {\n// let rgbArray = hexToRgb(backColor);\n// if (rgbArray[0] * 0.299 + rgbArray[1] * 0.587 + rgbArray[2] * 0.114 > 186) {\n// return \"#000000\";\n// } else {\n// return \"#ffffff\";\n// }\n// };\n// const replaceAt = function (string, index, replacement) {\n// // if (replacement == \"\" || replacement == \" \") {\n// // return (\n// // string.substring(0, index) +\n// // string.substring(index + replacement.length )\n// // );\n// // }\n// const replaced = string.substring(0, index) + replacement + string.substring(index + 1)\n// return replaced\n// };\n\n// export { hexToRgb, getTextColor, replaceAt };\n","import * as React from \"react\";\n\nimport { cn } from \"@util/index\";\n\ninterface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n clickable?: boolean;\n variant?: \"default\" | \"neoBrutalism\";\n}\n\ntype CardContentProps = {\n headless?: boolean;\n noPadding?: boolean;\n} & React.HTMLAttributes<HTMLDivElement>;\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(\n ({ className, variant = \"default\", clickable = false, ...props }, ref) => {\n let variantStyles = {\n default: cn(\n \"hawa-rounded-lg hawa-border hawa-bg-card hawa-text-card-foreground hawa-shadow-sm\",\n clickable &&\n \"hawa-cursor-pointer hawa-transition-all hover:hawa-drop-shadow-md dark:hover:dark-shadow\",\n ),\n neoBrutalism: cn(\n \"neo-brutalism\",\n // \"hawa-transition-all hawa-uppercase hawa-font-mono dark:hawa-bg-black hawa-font-bold hawa-py-2 hawa-px-4 hawa-rounded hawa-border-2 hawa-border-primary hawa-shadow-color-primary hawa-transition-[hawa-transform_50ms, hawa-box-shadow_50ms] transition-all uppercase font-mono dark:bg-black font-bold py-2 px-4 rounded border-2 border-primary shadow-color-primary transition-[transform_50ms, box-shadow_50ms]\",\n clickable &&\n \"hawa-cursor-pointer active:hawa-translate-x-0.5 active:hawa-translate-y-0.5 active:hawa-shadow-color-primary-active active:translate-x-0.5 active:translate-y-0.5 active:shadow-color-primary-active\",\n ),\n };\n return (\n <div\n ref={ref}\n className={cn(className, variantStyles[variant])}\n {...props}\n />\n );\n },\n);\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"hawa-flex hawa-flex-col hawa-space-y-1.5 hawa-p-6\",\n className,\n )}\n {...props}\n />\n));\nconst CardTitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h3\n ref={ref}\n className={cn(\"hawa-text-2xl hawa-font-semibold \", className)}\n {...props}\n />\n));\nconst CardDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(\"hawa-text-sm hawa-text-muted-foreground\", className)}\n {...props}\n />\n));\nconst CardContent = React.forwardRef<HTMLDivElement, CardContentProps>(\n ({ headless, noPadding, className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n noPadding ? \"hawa-p-0\" : \"hawa-p-6\",\n headless ? \"hawa-pt-6\" : \"hawa-pt-0\",\n className,\n )}\n {...props}\n />\n ),\n);\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & { noPadding?: boolean }\n>(({ className, noPadding, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n noPadding ? \"hawa-p-0\" : \"hawa-p-6\",\n \"hawa-flex hawa-items-center hawa-pt-0\",\n className,\n )}\n {...props}\n />\n));\n\nCardDescription.displayName = \"CardDescription\";\nCardContent.displayName = \"CardContent\";\nCardHeader.displayName = \"CardHeader\";\nCardFooter.displayName = \"CardFooter\";\nCardTitle.displayName = \"CardTitle\";\nCard.displayName = \"Card\";\n\nexport {\n CardDescription,\n CardContent,\n CardHeader,\n CardFooter,\n CardTitle,\n Card,\n};\n"],"mappings":";;;AAAA,OAAOA,UAAa,QAAQ,gBAAgB;;;ACA5C,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACLA,YAAY,WAAW;AAcvB,IAAM,OAAa;AAAA,EACjB,CAAC,EAAE,WAAW,UAAU,WAAW,YAAY,OAAO,GAAG,MAAM,GAAG,QAAQ;AACxE,QAAI,gBAAgB;AAAA,MAClB,SAAS;AAAA,QACP;AAAA,QACA,aACE;AAAA,MACJ;AAAA,MACA,cAAc;AAAA,QACZ;AAAA;AAAA,QAEA,aACE;AAAA,MACJ;AAAA,IACF;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,WAAW,cAAc,OAAO,CAAC;AAAA,QAC9C,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AACA,IAAM,aAAmB,iBAGvB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,IAAM,YAAkB,iBAGtB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;A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AAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT,QAAQ,eAAe;AAAA,UACvB,SAAS,YAAY,YAAY,QAAQ;AAAA,QAC3C;AAAA,QACA,KAAK;AAAA;AAAA,MAEL,gBAAAA,OAAA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAW;AAAA,YACT,cAAc,QAAQ,gBAAgB;AAAA,YACtC;AAAA,UACF;AAAA,UACA,uBAAoB;AAAA,UACpB,cAAW;AAAA,UACX,SAAS,MAAM;AACb,sBAAU,IAAI;AACd,uBAAW,MAAM;AACf,kBAAI,qCAAU,SAAS;AACrB,qDAAU,QAAQ,YAAY,qCAAU,QAAQ,SAAS;AAAA,cAC3D;AAAA,YACF,GAAG,GAAG;AAAA,UACR;AAAA;AAAA,QAEA,gBAAAA,OAAA;AAAA,UAAC;AAAA;AAAA,YACC,eAAY;AAAA,YACZ,WAAU;AAAA,YACV,MAAK;AAAA,YACL,SAAQ;AAAA;AAAA,UAER,gBAAAA,OAAA;AAAA,YAAC;AAAA;AAAA,cACC,UAAS;AAAA,cACT,GAAE;AAAA,cACF,UAAS;AAAA;AAAA,UACV;AAAA,QACH;AAAA,MACF;AAAA,MACA,gBAAAA,OAAA,cAAC,eAAY,UAAQ,QAAE,MAAM,QAAS;AAAA,IACxC;AAAA,EACF;AAEJ;","names":["React","React"]}
|
@@ -13,8 +13,8 @@ import { DialogProps } from '@radix-ui/react-dialog';
|
|
13
13
|
import { VariantProps } from 'class-variance-authority';
|
14
14
|
import { RowData, ColumnDef } from '@tanstack/react-table';
|
15
15
|
export { ColumnDef } from '@tanstack/react-table';
|
16
|
-
import { L as LabelProps } from '../Radio-
|
17
|
-
export { b as Label, a as Radio, R as RadioOptionsTypes, c as Select, S as SelectOptionProps } from '../Radio-
|
16
|
+
import { L as LabelProps } from '../Radio-zXrZBXwJ.mjs';
|
17
|
+
export { b as Label, a as Radio, R as RadioOptionsTypes, c as Select, S as SelectOptionProps } from '../Radio-zXrZBXwJ.mjs';
|
18
18
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
19
19
|
import { Command as Command$1 } from 'cmdk';
|
20
20
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
package/dist/elements/index.d.ts
CHANGED
@@ -13,8 +13,8 @@ import { DialogProps } from '@radix-ui/react-dialog';
|
|
13
13
|
import { VariantProps } from 'class-variance-authority';
|
14
14
|
import { RowData, ColumnDef } from '@tanstack/react-table';
|
15
15
|
export { ColumnDef } from '@tanstack/react-table';
|
16
|
-
import { L as LabelProps } from '../Radio-
|
17
|
-
export { b as Label, a as Radio, R as RadioOptionsTypes, c as Select, S as SelectOptionProps } from '../Radio-
|
16
|
+
import { L as LabelProps } from '../Radio-uPqJwFGq.js';
|
17
|
+
export { b as Label, a as Radio, R as RadioOptionsTypes, c as Select, S as SelectOptionProps } from '../Radio-uPqJwFGq.js';
|
18
18
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
19
19
|
import { Command as Command$1 } from 'cmdk';
|
20
20
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
package/dist/elements/index.js
CHANGED
@@ -3193,207 +3193,209 @@ var BackToTop = ({ ...props }) => {
|
|
3193
3193
|
|
3194
3194
|
// elements/radio/Radio.tsx
|
3195
3195
|
var import_react11 = __toESM(require("react"));
|
3196
|
-
var Radio = (
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3196
|
+
var Radio = (0, import_react11.forwardRef)(
|
3197
|
+
({
|
3198
|
+
design = "default",
|
3199
|
+
width = "default",
|
3200
|
+
size = "default",
|
3201
|
+
orientation = "horizontal",
|
3202
|
+
name,
|
3203
|
+
labelProps,
|
3204
|
+
tabsContainerClassName,
|
3205
|
+
forceHideHelperText = false,
|
3206
|
+
onChange,
|
3207
|
+
...props
|
3208
|
+
}, ref) => {
|
3209
|
+
var _a, _b, _c;
|
3210
|
+
const [selectedOption, setSelectedOption] = (0, import_react11.useState)(
|
3211
|
+
props.defaultValue || props.value
|
3212
|
+
);
|
3213
|
+
let activeTabStyle = "hawa-inline-block hawa-w-full hawa-text-primary-foreground hawa-bg-primary hawa-active dark:hawa-bg-primary";
|
3214
|
+
let inactiveTabStyle = `hawa-inline-block hawa-w-full hawa-transition-all hawa-bg-primary-foreground dark:hover:hawa-text-white
|
3214
3215
|
${props.disabled ? "" : "hover:hawa-bg-muted"}`;
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
{
|
3255
|
-
ref: parentRef,
|
3256
|
-
className: cn(
|
3257
|
-
props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
|
3258
|
-
"hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium",
|
3259
|
-
orientationStyle[orientation],
|
3260
|
-
widthStyle[width],
|
3261
|
-
tabsContainerClassName
|
3262
|
-
)
|
3263
|
-
},
|
3264
|
-
(_b = props.options) == null ? void 0 : _b.map((opt, o) => /* @__PURE__ */ import_react11.default.createElement(
|
3265
|
-
"li",
|
3216
|
+
let orientationStyle = {
|
3217
|
+
horizontal: "hawa-flex hawa-flex-row",
|
3218
|
+
vertical: "hawa-flex hawa-flex-col"
|
3219
|
+
};
|
3220
|
+
let tabSizeStyle = {
|
3221
|
+
default: "hawa-py-2 hawa-px-4 hawa-text-sm",
|
3222
|
+
lg: "hawa-py-2 hawa-px-4",
|
3223
|
+
sm: "hawa-p-1.5 hawa-text-xs",
|
3224
|
+
xs: "hawa-p-1 hawa-text-[10px]"
|
3225
|
+
};
|
3226
|
+
let widthStyle = {
|
3227
|
+
none: "",
|
3228
|
+
default: "hawa-max-w-fit",
|
3229
|
+
full: "hawa-w-full"
|
3230
|
+
};
|
3231
|
+
const [parentDirection, setParentDirection] = import_react11.default.useState(
|
3232
|
+
null
|
3233
|
+
);
|
3234
|
+
const parentRef = (0, import_react11.useRef)(null);
|
3235
|
+
(0, import_react11.useEffect)(() => {
|
3236
|
+
var _a2;
|
3237
|
+
const parentNode = (_a2 = parentRef.current) == null ? void 0 : _a2.parentNode;
|
3238
|
+
if (parentNode) {
|
3239
|
+
const dir = window.getComputedStyle(parentNode).direction;
|
3240
|
+
setParentDirection(dir);
|
3241
|
+
}
|
3242
|
+
});
|
3243
|
+
const handleChange = (opt) => {
|
3244
|
+
setSelectedOption(opt.value);
|
3245
|
+
if (onChange) {
|
3246
|
+
onChange(opt.value);
|
3247
|
+
} else {
|
3248
|
+
console.log("onChange was not provided");
|
3249
|
+
}
|
3250
|
+
};
|
3251
|
+
switch (design) {
|
3252
|
+
case "tabs":
|
3253
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", { className: "hawa-gap-2 hawa-flex hawa-flex-col" }, props.label && /* @__PURE__ */ import_react11.default.createElement(Label2, { ...labelProps }, props.label), /* @__PURE__ */ import_react11.default.createElement(
|
3254
|
+
"ul",
|
3266
3255
|
{
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3256
|
+
ref: parentRef,
|
3257
|
+
className: cn(
|
3258
|
+
props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
|
3259
|
+
"hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium",
|
3260
|
+
orientationStyle[orientation],
|
3261
|
+
widthStyle[width],
|
3262
|
+
tabsContainerClassName
|
3263
|
+
)
|
3264
|
+
},
|
3265
|
+
(_b = props.options) == null ? void 0 : _b.map((opt, o) => /* @__PURE__ */ import_react11.default.createElement(
|
3266
|
+
"li",
|
3267
|
+
{
|
3268
|
+
"aria-current": "page",
|
3269
|
+
onClick: () => {
|
3270
|
+
if (props.disabled)
|
3271
|
+
return;
|
3272
|
+
handleChange(opt);
|
3273
|
+
},
|
3274
|
+
className: cn(
|
3275
|
+
"hawa-w-full hawa-last hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2 ",
|
3276
|
+
!props.disabled && "hawa-cursor-pointer",
|
3277
|
+
orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
|
3278
|
+
orientation === "horizontal" && parentDirection === "rtl" && "hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l",
|
3279
|
+
orientation === "vertical" && "hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b",
|
3280
|
+
tabSizeStyle[size],
|
3281
|
+
selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
|
3282
|
+
),
|
3283
|
+
key: o
|
3272
3284
|
},
|
3285
|
+
opt.icon && opt.icon,
|
3286
|
+
opt.label
|
3287
|
+
))
|
3288
|
+
), !forceHideHelperText && /* @__PURE__ */ import_react11.default.createElement(
|
3289
|
+
"p",
|
3290
|
+
{
|
3291
|
+
className: cn(
|
3292
|
+
"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all",
|
3293
|
+
props.helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0"
|
3294
|
+
)
|
3295
|
+
},
|
3296
|
+
props.helperText
|
3297
|
+
));
|
3298
|
+
case "bordered":
|
3299
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ import_react11.default.createElement("div", { key: i, className: "hawa-w-full hawa-rounded hawa-border" }, /* @__PURE__ */ import_react11.default.createElement(
|
3300
|
+
"div",
|
3301
|
+
{
|
3273
3302
|
className: cn(
|
3274
|
-
"
|
3275
|
-
|
3276
|
-
orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
|
3277
|
-
orientation === "horizontal" && parentDirection === "rtl" && "hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l",
|
3278
|
-
orientation === "vertical" && "hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b",
|
3279
|
-
tabSizeStyle[size],
|
3280
|
-
selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
|
3303
|
+
"radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all",
|
3304
|
+
props.direction === "rtl" ? "margin-left right-19px" : "margin-right left-23px"
|
3281
3305
|
),
|
3282
|
-
key:
|
3306
|
+
key: i + 1
|
3283
3307
|
},
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3292
|
-
|
3293
|
-
|
3294
|
-
},
|
3295
|
-
props.helperText
|
3296
|
-
));
|
3297
|
-
case "bordered":
|
3298
|
-
return /* @__PURE__ */ import_react11.default.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ import_react11.default.createElement("div", { key: i, className: "hawa-w-full hawa-rounded hawa-border" }, /* @__PURE__ */ import_react11.default.createElement(
|
3299
|
-
"div",
|
3300
|
-
{
|
3301
|
-
className: cn(
|
3302
|
-
"radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all",
|
3303
|
-
props.direction === "rtl" ? "margin-left right-19px" : "margin-right left-23px"
|
3308
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
3309
|
+
"input",
|
3310
|
+
{
|
3311
|
+
disabled: opt.disabled,
|
3312
|
+
id: opt.value.toString(),
|
3313
|
+
type: "radio",
|
3314
|
+
value: opt.value,
|
3315
|
+
name,
|
3316
|
+
onChange: () => handleChange(opt)
|
3317
|
+
}
|
3304
3318
|
),
|
3305
|
-
|
3306
|
-
|
3307
|
-
|
3319
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
3320
|
+
"label",
|
3321
|
+
{
|
3322
|
+
htmlFor: opt.value.toString(),
|
3323
|
+
className: cn(
|
3324
|
+
"hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium hawa-text-black dark:hawa-text-white",
|
3325
|
+
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
|
3326
|
+
)
|
3327
|
+
},
|
3328
|
+
opt.label
|
3329
|
+
)
|
3330
|
+
))));
|
3331
|
+
case "cards":
|
3332
|
+
return /* @__PURE__ */ import_react11.default.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ import_react11.default.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ import_react11.default.createElement(
|
3308
3333
|
"input",
|
3309
3334
|
{
|
3310
|
-
disabled: opt.disabled,
|
3311
|
-
id: opt.value.toString(),
|
3312
3335
|
type: "radio",
|
3313
|
-
|
3336
|
+
id: opt.value.toString(),
|
3314
3337
|
name,
|
3315
|
-
|
3338
|
+
value: opt.value.toString(),
|
3339
|
+
className: "hawa-peer hawa-hidden",
|
3340
|
+
required: true,
|
3341
|
+
disabled: opt.disabled
|
3316
3342
|
}
|
3317
|
-
),
|
3318
|
-
/* @__PURE__ */ import_react11.default.createElement(
|
3343
|
+
), /* @__PURE__ */ import_react11.default.createElement(
|
3319
3344
|
"label",
|
3320
3345
|
{
|
3321
3346
|
htmlFor: opt.value.toString(),
|
3322
3347
|
className: cn(
|
3323
|
-
"hawa-
|
3324
|
-
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-
|
3348
|
+
"hawa-inline-flex hawa-h-full hawa-w-full hawa-items-center hawa-justify-between hawa-rounded-lg hawa-border hawa-border-gray-200 hawa-bg-white hawa-p-5 hawa-text-gray-500 peer-checked:hawa-border-primary peer-checked:hawa-text-primary dark:hawa-border-gray-700 dark:hawa-bg-gray-800 dark:hawa-text-gray-400 dark:peer-checked:hawa-text-primary",
|
3349
|
+
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hover:hawa-bg-gray-100 hover:hawa-text-gray-600 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-gray-300"
|
3325
3350
|
)
|
3326
3351
|
},
|
3327
|
-
opt.label
|
3328
|
-
)
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3332
|
-
"input",
|
3333
|
-
{
|
3334
|
-
type: "radio",
|
3335
|
-
id: opt.value.toString(),
|
3336
|
-
name,
|
3337
|
-
value: opt.value.toString(),
|
3338
|
-
className: "hawa-peer hawa-hidden",
|
3339
|
-
required: true,
|
3340
|
-
disabled: opt.disabled
|
3341
|
-
}
|
3342
|
-
), /* @__PURE__ */ import_react11.default.createElement(
|
3343
|
-
"label",
|
3344
|
-
{
|
3345
|
-
htmlFor: opt.value.toString(),
|
3346
|
-
className: cn(
|
3347
|
-
"hawa-inline-flex hawa-h-full hawa-w-full hawa-items-center hawa-justify-between hawa-rounded-lg hawa-border hawa-border-gray-200 hawa-bg-white hawa-p-5 hawa-text-gray-500 peer-checked:hawa-border-primary peer-checked:hawa-text-primary dark:hawa-border-gray-700 dark:hawa-bg-gray-800 dark:hawa-text-gray-400 dark:peer-checked:hawa-text-primary",
|
3348
|
-
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hover:hawa-bg-gray-100 hover:hawa-text-gray-600 dark:hover:hawa-bg-gray-700 dark:hover:hawa-text-gray-300"
|
3349
|
-
)
|
3350
|
-
},
|
3351
|
-
/* @__PURE__ */ import_react11.default.createElement("div", { className: "hawa-block hawa-h-full hawa-w-full" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "hawa-w-full hawa-text-lg hawa-font-semibold" }, opt.label), /* @__PURE__ */ import_react11.default.createElement("div", { className: "hawa-w-full" }, opt.sublabel))
|
3352
|
-
))));
|
3353
|
-
default:
|
3354
|
-
return /* @__PURE__ */ import_react11.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, props.label && /* @__PURE__ */ import_react11.default.createElement(Label2, { ...labelProps }, props.label), /* @__PURE__ */ import_react11.default.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-2") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ import_react11.default.createElement(
|
3355
|
-
"div",
|
3356
|
-
{
|
3357
|
-
className: cn(
|
3358
|
-
"radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all",
|
3359
|
-
props.direction === "rtl" ? "margin-left right-3px" : "margin-right left-3px"
|
3360
|
-
),
|
3361
|
-
key: i + 1
|
3362
|
-
},
|
3363
|
-
/* @__PURE__ */ import_react11.default.createElement(
|
3364
|
-
"input",
|
3352
|
+
/* @__PURE__ */ import_react11.default.createElement("div", { className: "hawa-block hawa-h-full hawa-w-full" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "hawa-w-full hawa-text-lg hawa-font-semibold" }, opt.label), /* @__PURE__ */ import_react11.default.createElement("div", { className: "hawa-w-full" }, opt.sublabel))
|
3353
|
+
))));
|
3354
|
+
default:
|
3355
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, props.label && /* @__PURE__ */ import_react11.default.createElement(Label2, { ...labelProps }, props.label), /* @__PURE__ */ import_react11.default.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-2") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ import_react11.default.createElement(
|
3356
|
+
"div",
|
3365
3357
|
{
|
3366
|
-
|
3367
|
-
|
3368
|
-
|
3369
|
-
|
3370
|
-
|
3371
|
-
|
3372
|
-
|
3373
|
-
|
3374
|
-
|
3375
|
-
|
3358
|
+
className: cn(
|
3359
|
+
"radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all",
|
3360
|
+
props.direction === "rtl" ? "margin-left right-3px" : "margin-right left-3px"
|
3361
|
+
),
|
3362
|
+
key: i + 1
|
3363
|
+
},
|
3364
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
3365
|
+
"input",
|
3366
|
+
{
|
3367
|
+
disabled: opt.disabled,
|
3368
|
+
id: opt.value.toString(),
|
3369
|
+
type: "radio",
|
3370
|
+
value: opt.value,
|
3371
|
+
name,
|
3372
|
+
onChange: () => handleChange(opt)
|
3373
|
+
}
|
3374
|
+
),
|
3375
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
3376
|
+
"label",
|
3377
|
+
{
|
3378
|
+
htmlFor: opt.value.toString(),
|
3379
|
+
className: cn(
|
3380
|
+
"hawa-text-sm hawa-font-medium dark:hawa-text-white",
|
3381
|
+
opt.disabled ? "hawa-text-gray-400" : "hawa-cursor-pointer hawa-text-gray-900"
|
3382
|
+
)
|
3383
|
+
},
|
3384
|
+
opt.label
|
3385
|
+
)
|
3386
|
+
))), /* @__PURE__ */ import_react11.default.createElement(
|
3387
|
+
"p",
|
3376
3388
|
{
|
3377
|
-
htmlFor: opt.value.toString(),
|
3378
3389
|
className: cn(
|
3379
|
-
"hawa-text-
|
3380
|
-
|
3390
|
+
"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all",
|
3391
|
+
props.helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0"
|
3381
3392
|
)
|
3382
3393
|
},
|
3383
|
-
|
3384
|
-
)
|
3385
|
-
|
3386
|
-
"p",
|
3387
|
-
{
|
3388
|
-
className: cn(
|
3389
|
-
"hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all",
|
3390
|
-
props.helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0"
|
3391
|
-
)
|
3392
|
-
},
|
3393
|
-
props.helperText
|
3394
|
-
));
|
3394
|
+
props.helperText
|
3395
|
+
));
|
3396
|
+
}
|
3395
3397
|
}
|
3396
|
-
|
3398
|
+
);
|
3397
3399
|
|
3398
3400
|
// elements/combobox/Combobox.tsx
|
3399
3401
|
var React27 = __toESM(require("react"));
|
package/dist/elements/index.mjs
CHANGED
package/dist/index.d.mts
CHANGED
@@ -518,7 +518,7 @@ type RadioTypes = {
|
|
518
518
|
tabsContainerClassName?: string;
|
519
519
|
forceHideHelperText?: boolean;
|
520
520
|
};
|
521
|
-
declare const Radio:
|
521
|
+
declare const Radio: React__default.ForwardRefExoticComponent<RadioTypes & React__default.RefAttributes<HTMLInputElement>>;
|
522
522
|
|
523
523
|
interface TableHeadProps extends React$1.ThHTMLAttributes<HTMLTableCellElement> {
|
524
524
|
clickable?: boolean;
|
package/dist/index.d.ts
CHANGED
@@ -518,7 +518,7 @@ type RadioTypes = {
|
|
518
518
|
tabsContainerClassName?: string;
|
519
519
|
forceHideHelperText?: boolean;
|
520
520
|
};
|
521
|
-
declare const Radio:
|
521
|
+
declare const Radio: React__default.ForwardRefExoticComponent<RadioTypes & React__default.RefAttributes<HTMLInputElement>>;
|
522
522
|
|
523
523
|
interface TableHeadProps extends React$1.ThHTMLAttributes<HTMLTableCellElement> {
|
524
524
|
clickable?: boolean;
|