@deckai/deck-ui 0.0.15 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +12 -2
  2. package/dist/components/AboutCard.cjs +9 -1
  3. package/dist/components/AboutCard.cjs.map +1 -1
  4. package/dist/components/AboutCard.js +9 -1
  5. package/dist/components/AboutCard.js.map +1 -1
  6. package/dist/components/AddWorkCard.cjs +3 -3
  7. package/dist/components/AddWorkCard.cjs.map +1 -1
  8. package/dist/components/AddWorkCard.js +3 -3
  9. package/dist/components/AddWorkCard.js.map +1 -1
  10. package/dist/components/Breadcrumbs.cjs +1 -1
  11. package/dist/components/Breadcrumbs.cjs.map +1 -1
  12. package/dist/components/Breadcrumbs.d.cts +1 -0
  13. package/dist/components/Breadcrumbs.d.ts +1 -0
  14. package/dist/components/Breadcrumbs.js +1 -1
  15. package/dist/components/Breadcrumbs.js.map +1 -1
  16. package/dist/components/Button.cjs +2 -2
  17. package/dist/components/Button.cjs.map +1 -1
  18. package/dist/components/Button.js +2 -2
  19. package/dist/components/Button.js.map +1 -1
  20. package/dist/components/Carousel.cjs +1 -1
  21. package/dist/components/Carousel.cjs.map +1 -1
  22. package/dist/components/Carousel.d.cts +3 -1
  23. package/dist/components/Carousel.d.ts +3 -1
  24. package/dist/components/Carousel.js +1 -1
  25. package/dist/components/Carousel.js.map +1 -1
  26. package/dist/components/Collapsible.cjs +9 -1
  27. package/dist/components/Collapsible.cjs.map +1 -1
  28. package/dist/components/Collapsible.js +9 -1
  29. package/dist/components/Collapsible.js.map +1 -1
  30. package/dist/components/Combobox.cjs +1 -1
  31. package/dist/components/Combobox.cjs.map +1 -1
  32. package/dist/components/Combobox.js +1 -1
  33. package/dist/components/Combobox.js.map +1 -1
  34. package/dist/components/ContactItem.cjs +1 -1
  35. package/dist/components/ContactItem.cjs.map +1 -1
  36. package/dist/components/ContactItem.js +1 -1
  37. package/dist/components/ContactItem.js.map +1 -1
  38. package/dist/components/EditButton.cjs +2 -2
  39. package/dist/components/EditButton.cjs.map +1 -1
  40. package/dist/components/EditButton.js +2 -2
  41. package/dist/components/EditButton.js.map +1 -1
  42. package/dist/components/IconRenderer.cjs +1 -1
  43. package/dist/components/IconRenderer.cjs.map +1 -1
  44. package/dist/components/IconRenderer.d.cts +1 -1
  45. package/dist/components/IconRenderer.d.ts +1 -1
  46. package/dist/components/IconRenderer.js +1 -1
  47. package/dist/components/IconRenderer.js.map +1 -1
  48. package/dist/components/MultiSelectCombobox.cjs +1 -1
  49. package/dist/components/MultiSelectCombobox.cjs.map +1 -1
  50. package/dist/components/MultiSelectCombobox.js +1 -1
  51. package/dist/components/MultiSelectCombobox.js.map +1 -1
  52. package/dist/components/Navbar.cjs +1 -1
  53. package/dist/components/Navbar.cjs.map +1 -1
  54. package/dist/components/Navbar.js +1 -1
  55. package/dist/components/Navbar.js.map +1 -1
  56. package/dist/components/ProfileCard.cjs +1 -1
  57. package/dist/components/ProfileCard.cjs.map +1 -1
  58. package/dist/components/ProfileCard.js +1 -1
  59. package/dist/components/ProfileCard.js.map +1 -1
  60. package/dist/components/SegmentedTabs.cjs +2 -2
  61. package/dist/components/SegmentedTabs.cjs.map +1 -1
  62. package/dist/components/SegmentedTabs.js +2 -2
  63. package/dist/components/SegmentedTabs.js.map +1 -1
  64. package/dist/components/SocialCard.cjs +1 -1
  65. package/dist/components/SocialCard.cjs.map +1 -1
  66. package/dist/components/SocialCard.js +1 -1
  67. package/dist/components/SocialCard.js.map +1 -1
  68. package/dist/components/Tabs.cjs +2 -2
  69. package/dist/components/Tabs.cjs.map +1 -1
  70. package/dist/components/Tabs.js +2 -2
  71. package/dist/components/Tabs.js.map +1 -1
  72. package/dist/components/Toast.cjs +2 -2
  73. package/dist/components/Toast.cjs.map +1 -1
  74. package/dist/components/Toast.js +2 -2
  75. package/dist/components/Toast.js.map +1 -1
  76. package/dist/components/Tooltip.cjs +1 -1
  77. package/dist/components/Tooltip.cjs.map +1 -1
  78. package/dist/components/Tooltip.d.cts +3 -1
  79. package/dist/components/Tooltip.d.ts +3 -1
  80. package/dist/components/Tooltip.js +1 -1
  81. package/dist/components/Tooltip.js.map +1 -1
  82. package/dist/index.cjs +4 -52
  83. package/dist/index.cjs.map +1 -1
  84. package/dist/index.d.cts +4 -2
  85. package/dist/index.d.ts +4 -2
  86. package/dist/index.js +4 -52
  87. package/dist/index.js.map +1 -1
  88. package/dist/styles/styles.css +1 -1
  89. package/package.json +3 -3
  90. package/dist/components/Illustration.cjs +0 -50
  91. package/dist/components/Illustration.cjs.map +0 -1
  92. package/dist/components/Illustration.d.cts +0 -10
  93. package/dist/components/Illustration.d.ts +0 -10
  94. package/dist/components/Illustration.js +0 -50
  95. package/dist/components/Illustration.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/IconRenderer.tsx","../../src/components/Text.tsx","../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Link.tsx","../../src/components/ContactItem.tsx"],"names":["IconRenderer","icon","size","className","sanitizedSvg","useMemo","svg","viewBox","React","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","fontWeight","processVariants","variants","breakpoint","typographyClass","Text","color","as","children","weight","props","ref","typographyClasses","colorClasses","suggestedElement","baseVariant","cn","inputs","twMerge","clsx","focusRingStyles","Link","href","ContactItem","linkProps"],"mappings":"2FAQO,IAAMA,CAAAA,CAAe,CAAC,CAC3B,KAAAC,CACA,CAAA,IAAA,CAAAC,CAAO,CAAA,EAAA,CACP,SAAAC,CAAAA,CACF,IAAyB,CACvB,IAAMC,CAAeC,CAAAA,OAAAA,CAAQ,IAAM,CAGjC,IAAMC,CAFS,CAAA,IAAI,WACA,CAAA,eAAA,CAAgBL,EAAM,eAAe,CAAA,CACxC,aAAc,CAAA,KAAK,CAEnC,CAAA,GAAI,CAACK,CAAK,CAAA,OAAO,IAGjBA,CAAAA,CAAAA,CAAI,YAAa,CAAA,OAAA,CAAS,MAAM,CAChCA,CAAAA,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,CAAA,SAAA,CAAU,YAAY,CAC5D,CAAA,CACAO,CAAA,CAAA,aAAA,CAAC0B,CAAA,CAAA,CACC,UAAU,iBACV,CAAA,IAAA,CAAMC,CACL,CAAA,GAAGE,CACJ,CAAA,OAAA,CAAS,CAAC,uBAAyB,CAAA,0BAA0B,CAE5DhB,CAAAA,CAAAA,CACH,CACF","file":"ContactItem.js","sourcesContent":["import React, { useMemo } from \"react\";\n\nexport type IconRendererProps = {\n icon: string;\n size?: number;\n className?: string;\n};\n\nexport const IconRenderer = ({\n icon,\n size = 40,\n className\n}: IconRendererProps) => {\n const sanitizedSvg = useMemo(() => {\n const parser = new DOMParser();\n const doc = parser.parseFromString(icon, \"image/svg+xml\");\n const svg = doc.querySelector(\"svg\");\n\n if (!svg) return null;\n\n // Set size attributes but preserve aspect ratio\n svg.setAttribute(\"width\", \"100%\");\n svg.setAttribute(\"height\", \"100%\");\n svg.setAttribute(\"preserveAspectRatio\", \"xMidYMid meet\");\n\n // Get the original viewBox or use the default\n const viewBox = svg.getAttribute(\"viewBox\") || \"0 0 40 40\";\n svg.setAttribute(\"viewBox\", viewBox);\n\n return svg.outerHTML;\n }, [icon]);\n\n if (!sanitizedSvg) return null;\n\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n dangerouslySetInnerHTML={{ __html: sanitizedSvg }}\n />\n );\n};\n\nIconRenderer.displayName = \"IconRenderer\";\n","import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses =\n color === \"inherit\" ? \"text-inherit\" : `text-text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`font-sans antialiased ${typographyClasses} ${colorClasses} ${\n weight ? `!${fontWeight[weight]}` : \"\"\n } ${className ?? \"\"}`}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\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\nexport const noopFn = () => {};\n","import { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import React from \"react\";\nimport { Text, TextProps } from \"./Text\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles } from \"../utils/tailwind\";\n\nexport type LinkProps = {\n href: string;\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n} & Pick<TextProps, \"variant\" | \"color\"> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>;\n\nexport const Link = ({\n children,\n color = \"inherit\",\n variant = \"body-default-semibold\",\n href,\n className,\n ...props\n}: LinkProps) => (\n <Text variant={variant} color={color}>\n <a\n href={href}\n className={cn(\n \"hover:opacity-80 transition-all ease-in-out active:scale-95 hover:underline\",\n focusRingStyles,\n className\n )}\n {...props}\n >\n {children}\n </a>\n </Text>\n);\n","import React, { HTMLAttributes } from \"react\";\nimport { IconRenderer } from \"./IconRenderer\";\nimport { Link } from \"./Link\";\n\nexport type ContactItemProps = {\n // TODO: figure out how to get filled icons to work correctly\n icon: string;\n children: React.ReactNode;\n href: string;\n} & Omit<HTMLAttributes<HTMLAnchorElement>, \"color\">;\n\nexport const ContactItem = ({\n icon,\n children,\n href,\n ...linkProps\n}: ContactItemProps) => (\n <div className=\"row gap-2 flex items-center\">\n <div className=\"bg-secondary-400 rounded-full p-2.5 items-center justify-center\">\n <IconRenderer icon={icon} size={18} className=\"text-text\" />\n </div>\n <Link\n className=\"hover:underline\"\n href={href}\n {...linkProps}\n variant={[\"body-default-semibold\", \"md:body-default-semibold\"]}\n >\n {children}\n </Link>\n </div>\n);\n"]}
1
+ {"version":3,"sources":["../../src/components/IconRenderer.tsx","../../src/components/Text.tsx","../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Link.tsx","../../src/components/ContactItem.tsx"],"names":["IconRenderer","icon","size","className","svgMatch","React","attributesMatch","viewBoxMatch","viewBox","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","fontWeight","processVariants","variants","breakpoint","typographyClass","Text","color","as","children","weight","props","ref","typographyClasses","colorClasses","suggestedElement","baseVariant","cn","inputs","twMerge","clsx","focusRingStyles","Link","href","ContactItem","linkProps"],"mappings":"kFAQO,IAAMA,CAAAA,CAAe,CAAC,CAC3B,IAAAC,CAAAA,CAAAA,CACA,KAAAC,CAAO,CAAA,EAAA,CACP,SAAAC,CAAAA,CACF,CAAyB,GAAA,CAEvB,IAAMC,CAAWH,CAAAA,CAAAA,CAAK,KAAM,CAAA,6BAA6B,CAEzD,CAAA,GAAI,CAACG,CACH,CAAA,OACEC,CAAA,CAAA,aAAA,CAAC,KACC,CAAA,CAAA,KAAA,CAAO,CACL,KAAOH,CAAAA,CAAAA,CACP,MAAQA,CAAAA,CAAAA,CACR,OAAS,CAAA,MAAA,CACT,WAAY,QACZ,CAAA,cAAA,CAAgB,QAClB,CAAA,CACA,SAAWC,CAAAA,CAAAA,CACb,EAKJ,IAAMG,CAAAA,CAAkBL,CAAK,CAAA,KAAA,CAAM,cAAc,CAAA,CAI3CM,GAHmBD,CAAkBA,CAAAA,CAAAA,CAAgB,CAAC,CAAI,CAAA,EAAA,EAG1B,MAAM,0BAA0B,CAAA,CAChEE,CAAUD,CAAAA,CAAAA,CAAeA,CAAa,CAAA,CAAC,EAAI,WAEjD,CAAA,OACEF,CAAA,CAAA,aAAA,CAAC,KACC,CAAA,CAAA,KAAA,CAAO,CACL,KAAOH,CAAAA,CAAAA,CACP,MAAQA,CAAAA,CAAAA,CACR,OAAS,CAAA,MAAA,CACT,WAAY,QACZ,CAAA,cAAA,CAAgB,QAClB,CAAA,CACA,SAAWC,CAAAA,CAAAA,CAAAA,CAEXE,EAAA,aAAC,CAAA,KAAA,C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CAAAA,CACX,sGCvDK,IAAMC,CAAAA,CAAO,CAAC,CACnB,QAAAb,CAAAA,CAAAA,CACA,MAAAF,CAAQ,CAAA,SAAA,CACR,OAAAR,CAAAA,CAAAA,CAAU,uBACV,CAAA,IAAA,CAAAwB,EACA,SAAAhC,CAAAA,CAAAA,CACA,GAAGoB,CACL,CACElB,GAAAA,CAAAA,CAAA,cAACa,CAAA,CAAA,CAAK,OAASP,CAAAA,CAAAA,CAAS,KAAOQ,CAAAA,CAAAA,CAAAA,CAC7Bd,EAAA,aAAC,CAAA,GAAA,CAAA,CACC,IAAM8B,CAAAA,CAAAA,CACN,SAAWN,CAAAA,CAAAA,CACT,8EACAI,CACA9B,CAAAA,CACF,CACC,CAAA,GAAGoB,CAEHF,CAAAA,CAAAA,CACH,CACF,CCtBK,CAAA,IAAMe,EAAc,CAAC,CAC1B,KAAAnC,CACA,CAAA,QAAA,CAAAoB,CACA,CAAA,IAAA,CAAAc,CACA,CAAA,GAAGE,CACL,CACEhC,GAAAA,CAAAA,CAAA,aAAC,CAAA,KAAA,CAAA,CAAI,SAAU,CAAA,6BAAA,CAAA,CACbA,EAAA,aAAC,CAAA,KAAA,CAAA,CAAI,SAAU,CAAA,iEAAA,CAAA,CACbA,CAAA,CAAA,aAAA,CAACL,EAAA,CAAa,IAAA,CAAMC,CAAM,CAAA,IAAA,CAAM,EAAI,CAAA,SAAA,CAAU,YAAY,CAC5D,CAAA,CACAI,CAAA,CAAA,aAAA,CAAC6B,CAAA,CAAA,CACC,UAAU,iBACV,CAAA,IAAA,CAAMC,CACL,CAAA,GAAGE,CACJ,CAAA,OAAA,CAAS,CAAC,uBAAyB,CAAA,0BAA0B,CAE5DhB,CAAAA,CAAAA,CACH,CACF","file":"ContactItem.js","sourcesContent":["import React from \"react\";\n\nexport type IconRendererProps = {\n icon: string;\n size?: number;\n className?: string;\n};\n\nexport const IconRenderer = ({\n icon,\n size = 40,\n className\n}: IconRendererProps) => {\n // Extract SVG content from the string (everything between <svg> and </svg>)\n const svgMatch = icon.match(/<svg[^>]*>([\\s\\S]*?)<\\/svg>/);\n\n if (!svgMatch) {\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n />\n );\n }\n\n // Extract attributes from the SVG tag\n const attributesMatch = icon.match(/<svg([^>]*)>/);\n const attributesString = attributesMatch ? attributesMatch[1] : \"\";\n\n // Parse viewBox\n const viewBoxMatch = attributesString.match(/viewBox=[\"']([^\"']*)[\"']/);\n const viewBox = viewBoxMatch ? viewBoxMatch[1] : \"0 0 40 40\";\n\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n >\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox={viewBox}\n preserveAspectRatio=\"xMidYMid meet\"\n dangerouslySetInnerHTML={{ __html: svgMatch[1] }}\n />\n </div>\n );\n};\n\nIconRenderer.displayName = \"IconRenderer\";\n","import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses =\n color === \"inherit\" ? \"text-inherit\" : `text-text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`font-sans antialiased ${typographyClasses} ${colorClasses} ${\n weight ? `!${fontWeight[weight]}` : \"\"\n } ${className ?? \"\"}`}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\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\nexport const noopFn = () => {};\n","import { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import React from \"react\";\nimport { Text, TextProps } from \"./Text\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles } from \"../utils/tailwind\";\n\nexport type LinkProps = {\n href: string;\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n} & Pick<TextProps, \"variant\" | \"color\"> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>;\n\nexport const Link = ({\n children,\n color = \"inherit\",\n variant = \"body-default-semibold\",\n href,\n className,\n ...props\n}: LinkProps) => (\n <Text variant={variant} color={color}>\n <a\n href={href}\n className={cn(\n \"hover:opacity-80 transition-all ease-in-out active:scale-95 hover:underline\",\n focusRingStyles,\n className\n )}\n {...props}\n >\n {children}\n </a>\n </Text>\n);\n","import React, { HTMLAttributes } from \"react\";\nimport { IconRenderer } from \"./IconRenderer\";\nimport { Link } from \"./Link\";\n\nexport type ContactItemProps = {\n // TODO: figure out how to get filled icons to work correctly\n icon: string;\n children: React.ReactNode;\n href: string;\n} & Omit<HTMLAttributes<HTMLAnchorElement>, \"color\">;\n\nexport const ContactItem = ({\n icon,\n children,\n href,\n ...linkProps\n}: ContactItemProps) => (\n <div className=\"row gap-2 flex items-center\">\n <div className=\"bg-secondary-400 rounded-full p-2.5 items-center justify-center\">\n <IconRenderer icon={icon} size={18} className=\"text-text\" />\n </div>\n <Link\n className=\"hover:underline\"\n href={href}\n {...linkProps}\n variant={[\"body-default-semibold\", \"md:body-default-semibold\"]}\n >\n {children}\n </Link>\n </div>\n);\n"]}
@@ -1,4 +1,4 @@
1
- 'use strict';var y=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),icons=require('@deckai/icons');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var y__namespace=/*#__PURE__*/_interopNamespace(y);function i(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var $={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},A=e=>{let[o,t]=e.split("-");return o==="heading"?$[t]||"p":o==="label"?"label":"p"},C={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},P=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[n,r]=t.split(":");return `${n}:text-${r}`}return `text-${t}`}).join(" "):"text-body-default",u=y__namespace.default.forwardRef(({variant:e="body-default",color:o="primary",as:t,className:n,children:r,weight:s,...a},p)=>{let m=P(e),d=o==="inherit"?"text-inherit":`text-text-${o}`,M=y__namespace.default.useMemo(()=>{let E=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return A(E)},[e]);return y__namespace.default.createElement(t||M,{ref:p,className:`font-sans antialiased ${m} ${d} ${s?`!${C[s]}`:""} ${n??""}`,...a},r)});u.displayName="Text";var c="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var k={black:"bg-text-text text-white",accent:"bg-primary-100 text-white",secondary:"bg-secondary-100 text-secondary"},g={black:"border border-text text-text",accent:"border border-primary-100 text-primary-100",secondary:"border border-text-secondary text-secondary"},B=y__namespace.forwardRef(({className:e,variant:o="filled",color:t="black",isLoading:n=!1,children:r,disabled:s,...a},p)=>y__namespace.createElement("button",{ref:p,className:i(`
1
+ 'use strict';var y=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),icons=require('@deckai/icons');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var y__namespace=/*#__PURE__*/_interopNamespace(y);function i(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var $={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},A=e=>{let[o,t]=e.split("-");return o==="heading"?$[t]||"p":o==="label"?"label":"p"},C={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},P=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[n,r]=t.split(":");return `${n}:text-${r}`}return `text-${t}`}).join(" "):"text-body-default",u=y__namespace.default.forwardRef(({variant:e="body-default",color:o="primary",as:t,className:n,children:r,weight:s,...a},p)=>{let l=P(e),d=o==="inherit"?"text-inherit":`text-text-${o}`,M=y__namespace.default.useMemo(()=>{let E=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return A(E)},[e]);return y__namespace.default.createElement(t||M,{ref:p,className:`font-sans antialiased ${l} ${d} ${s?`!${C[s]}`:""} ${n??""}`,...a},r)});u.displayName="Text";var m="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var k={black:"bg-text-text text-white",accent:"bg-primary-100 text-white",secondary:"bg-secondary-100 text-secondary"},g={black:"border border-text text-text",accent:"border border-primary-100 text-primary-100",secondary:"border border-text-secondary text-secondary"},B=y__namespace.forwardRef(({className:e,variant:o="filled",color:t="black",isLoading:n=!1,children:r,disabled:s,end:a,...p},l)=>y__namespace.createElement("button",{ref:l,className:i(`
2
2
  sm:px-7 px-4
3
3
  py-2
4
4
  inline-flex items-center justify-center
@@ -6,5 +6,5 @@
6
6
  transition-colors duration-200
7
7
  disabled:opacity-50 disabled:pointer-events-none
8
8
  hover:opacity-80 active:scale-95
9
- truncate`,c,o==="filled"?k[t]:g[t],e),disabled:s||n,type:"button",...a},typeof r=="string"?y__namespace.createElement(u,{variant:["sm:body-default-bold","body-xxs-semibold"],color:"inherit"},r):r));B.displayName="Button";var h={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},v={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},N=e=>{if(!e)return {width:"24px",height:"24px"};let o=Array.isArray(e)?e:[e],t={},n;return o.forEach(r=>{if(typeof r=="number")n=`${r}px`;else {let[s,a]=r.split(":"),p=parseInt(a,10);t[`@media (min-width: ${v[s]})`]=`${p}px`;}}),{width:n||"24px",height:n||"24px",...Object.entries(t).reduce((r,[s,a])=>({...r,[s]:{width:a,height:a}}),{})}},f=y__namespace.default.forwardRef(({name:e,size:o=24,color:t="primary",title:n,className:r,style:s={},...a},p)=>{let m=icons.IconMap[e],d=N(o);return y__namespace.default.createElement("div",{className:i("flex justify-center items-center",r),style:{...d,"--icon-stroke":h[t],...s}},y__namespace.default.createElement(m,{ref:p,"aria-hidden":!n,"aria-label":n,stroke:e.includes("filled")?void 0:h[t],...a}))});f.displayName="Icon";var T=y__namespace.default.forwardRef(({children:e,type:o="button",className:t,disabled:n,...r},s)=>y__namespace.default.createElement("button",{ref:s,type:o,disabled:n,className:i("appearance-none hover:opacity-80 transition-all active:scale-95",c,n&&"opacity-50 cursor-not-allowed",t),...r},e));T.displayName="Pressable";var V=({className:e,onClick:o})=>y__namespace.default.createElement(T,{className:i("absolute lg:top-10 md:top-8 top-4 lg:right-10 md:right-8 right-4 lg:px-2 lg:py-2 px-1 py-1 rounded-lg",g.black,e),onClick:o},y__namespace.default.createElement(f,{color:"primary",name:"edit-2"}));V.displayName="EditButton";exports.EditButton=V;//# sourceMappingURL=EditButton.cjs.map
9
+ truncate`,m,o==="filled"?k[t]:g[t],e),disabled:s||n,type:"button",...p},typeof r=="string"?y__namespace.createElement(u,{variant:["sm:body-default-bold","body-xxs-semibold"],color:"inherit"},r):r,a));B.displayName="Button";var h={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},v={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},N=e=>{if(!e)return {width:"24px",height:"24px"};let o=Array.isArray(e)?e:[e],t={},n;return o.forEach(r=>{if(typeof r=="number")n=`${r}px`;else {let[s,a]=r.split(":"),p=parseInt(a,10);t[`@media (min-width: ${v[s]})`]=`${p}px`;}}),{width:n||"24px",height:n||"24px",...Object.entries(t).reduce((r,[s,a])=>({...r,[s]:{width:a,height:a}}),{})}},f=y__namespace.default.forwardRef(({name:e,size:o=24,color:t="primary",title:n,className:r,style:s={},...a},p)=>{let l=icons.IconMap[e],d=N(o);return y__namespace.default.createElement("div",{className:i("flex justify-center items-center",r),style:{...d,"--icon-stroke":h[t],...s}},y__namespace.default.createElement(l,{ref:p,"aria-hidden":!n,"aria-label":n,stroke:e.includes("filled")?void 0:h[t],...a}))});f.displayName="Icon";var T=y__namespace.default.forwardRef(({children:e,type:o="button",className:t,disabled:n,...r},s)=>y__namespace.default.createElement("button",{ref:s,type:o,disabled:n,className:i("appearance-none hover:opacity-80 transition-all active:scale-95",m,n&&"opacity-50 cursor-not-allowed",t),...r},e));T.displayName="Pressable";var V=({className:e,onClick:o})=>y__namespace.default.createElement(T,{className:i("absolute lg:top-10 md:top-8 top-4 lg:right-10 md:right-8 right-4 lg:px-2 lg:py-2 px-1 py-1 rounded-lg",g.black,e),onClick:o},y__namespace.default.createElement(f,{color:"primary",name:"edit-2"}));V.displayName="EditButton";exports.EditButton=V;//# sourceMappingURL=EditButton.cjs.map
10
10
  //# sourceMappingURL=EditButton.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts","../../src/components/Text.tsx","../../src/utils/tailwind.ts","../../src/components/Button.tsx","../../src/components/Icon.tsx","../../src/components/Pressable.tsx","../../src/components/EditButton.tsx"],"names":["cn","inputs","twMerge","clsx","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","size","fontWeight","processVariants","variants","breakpoint","typographyClass","Text","React","color","as","className","children","weight","props","ref","typographyClasses","colorClasses","suggestedElement","baseVariant","focusRingStyles","filled","outlined","Button","l","isLoading","disabled","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","valueStr","value","acc","query","Icon","name","title","style","IconComponent","IconMap","sizeStyles","Pressable","type","EditButton","onClick"],"mappings":"seAGO,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,CAAA,IAAA,CAAK,SAAS,CACtC,EAIJS,EAAW,WAAc,CAAA,YAAA","file":"EditButton.cjs","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const noopFn = () => {};\n","import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses =\n color === \"inherit\" ? \"text-inherit\" : `text-text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`font-sans antialiased ${typographyClasses} ${colorClasses} ${\n weight ? `!${fontWeight[weight]}` : \"\"\n } ${className ?? \"\"}`}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import * as React from \"react\";\nimport { Text } from \"./Text\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type ButtonProps = {\n /** @default filled */\n variant?: \"filled\" | \"outlined\";\n /** @default primary */\n color?: \"black\" | \"accent\" | \"secondary\";\n isLoading?: boolean;\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n start?: React.ReactNode;\n end?: React.ReactNode;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const filled = {\n black: \"bg-text-text text-white\",\n // fade it slightly\n accent: \"bg-primary-100 text-white\",\n secondary: \"bg-secondary-100 text-secondary\"\n};\n\nexport const outlined = {\n black: \"border border-text text-text\",\n accent: \"border border-primary-100 text-primary-100\",\n secondary: \"border border-text-secondary text-secondary\"\n};\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"filled\",\n color = \"black\",\n isLoading = false,\n children,\n disabled,\n ...props\n },\n ref\n ) => (\n <button\n ref={ref}\n className={cn(\n `\n sm:px-7 px-4\n py-2\n inline-flex items-center justify-center\n rounded-lg \n transition-colors duration-200\n disabled:opacity-50 disabled:pointer-events-none\n hover:opacity-80 active:scale-95 \n truncate`,\n focusRingStyles,\n variant === \"filled\" ? filled[color] : outlined[color],\n className\n )}\n disabled={disabled || isLoading}\n type=\"button\"\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text\n variant={[\"sm:body-default-bold\", \"body-xxs-semibold\"]}\n color=\"inherit\"\n >\n {children}\n </Text>\n ) : (\n children\n )}\n </button>\n )\n);\n\nButton.displayName = \"Button\";\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: ResponsiveSize | ResponsiveSize[];\n /** @default primary */\n color?: IconColors;\n title?: string;\n className?: string;\n style?: React.CSSProperties;\n} & Omit<SVGProps<SVGSVGElement>, \"aria-hidden\" | \"aria-label\">;\n\nconst COLOR_MAP: Record<IconColors, string> = {\n primary: \"#080808\",\n secondary: \"#666666\",\n white: \"#ffffff\",\n primaryBlue: \"#089CCB\",\n disabled: \"#888888\"\n};\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"640px\",\n md: \"768px\",\n lg: \"1024px\",\n xl: \"1280px\",\n \"2xl\": \"1536px\"\n};\n\nconst processSizes = (\n sizes: ResponsiveSize | ResponsiveSize[] | undefined\n): React.CSSProperties => {\n if (!sizes) return { width: \"24px\", height: \"24px\" };\n\n const sizeArray = Array.isArray(sizes) ? sizes : [sizes];\n const mediaQueries: Record<string, string> = {};\n let baseSize: string | undefined;\n\n // Process each size\n sizeArray.forEach((size) => {\n if (typeof size === \"number\") {\n baseSize = `${size}px`;\n } else {\n const [breakpoint, valueStr] = size.split(\":\") as [Breakpoint, string];\n const value = parseInt(valueStr, 10);\n mediaQueries[`@media (min-width: ${BREAKPOINT_MAP[breakpoint]})`] =\n `${value}px`;\n }\n });\n\n // Create the style object with the correct structure\n return {\n width: baseSize || \"24px\",\n height: baseSize || \"24px\",\n ...Object.entries(mediaQueries).reduce(\n (acc, [query, size]) => ({\n ...acc,\n [query]: {\n width: size,\n height: size\n }\n }),\n {}\n )\n };\n};\n\nexport const Icon = React.forwardRef<SVGSVGElement, IconProps>(\n (\n {\n name,\n size = 24,\n color = \"primary\",\n title,\n className,\n style = {},\n ...props\n },\n ref\n ) => {\n const IconComponent = IconMap[name];\n const sizeStyles = processSizes(size);\n\n return (\n <div\n className={cn(\"flex justify-center items-center\", className)}\n style={{\n ...sizeStyles,\n [\"--icon-stroke\" as string]: COLOR_MAP[color],\n ...style\n }}\n >\n <IconComponent\n ref={ref}\n aria-hidden={!title}\n aria-label={title}\n stroke={name.includes(\"filled\") ? undefined : COLOR_MAP[color]}\n {...props}\n />\n </div>\n );\n }\n);\n\nIcon.displayName = \"Icon\";\n","import React, { ButtonHTMLAttributes } from \"react\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type PressableProps = ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const Pressable = React.forwardRef<HTMLButtonElement, PressableProps>(\n ({ children, type = \"button\", className, disabled, ...props }, ref) => (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n className={cn(\n \"appearance-none hover:opacity-80 transition-all active:scale-95\",\n focusRingStyles,\n disabled && \"opacity-50 cursor-not-allowed\",\n className\n )}\n {...props}\n >\n {children}\n </button>\n )\n);\n\nPressable.displayName = \"Pressable\";\n","import React from \"react\";\nimport { cn } from \"../utils\";\nimport { outlined } from \"./Button\";\nimport { Icon } from \"./Icon\";\nimport { Pressable } from \"./Pressable\";\n\nexport type EditButtonProps = {\n className?: string;\n onClick?: () => void;\n};\n\nexport const EditButton = ({ className, onClick }: EditButtonProps) => {\n return (\n <Pressable\n className={cn(\n \"absolute lg:top-10 md:top-8 top-4 lg:right-10 md:right-8 right-4 lg:px-2 lg:py-2 px-1 py-1 rounded-lg\",\n outlined.black,\n className\n )}\n onClick={onClick}\n >\n <Icon color=\"primary\" name=\"edit-2\" />\n </Pressable>\n );\n};\n\nEditButton.displayName = \"EditButton\";\n"]}
1
+ {"version":3,"sources":["../../src/utils/index.ts","../../src/components/Text.tsx","../../src/utils/tailwind.ts","../../src/components/Button.tsx","../../src/components/Icon.tsx","../../src/components/Pressable.tsx","../../src/components/EditButton.tsx"],"names":["cn","inputs","twMerge","clsx","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","size","fontWeight","processVariants","variants","breakpoint","typographyClass","Text","React","color","as","className","children","weight","props","ref","typographyClasses","colorClasses","suggestedElement","baseVariant","focusRingStyles","filled","outlined","Button","c","isLoading","disabled","end","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","valueStr","value","acc","query","Icon","name","title","style","IconComponent","IconMap","sizeStyles","Pressable","type","EditButton","onClick"],"mappings":"seAGO,SAASA,CAAAA,CAAAA,GAAMC,EAAsB,CAC1C,OAAOC,qBAAQC,CAAAA,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CCiEA,IAAMG,CAAmD,CAAA,CACvD,GAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACN,CAEMC,CAAAA,CAAAA,CAAyBC,CAAwC,EAAA,CACrE,GAAM,CAACC,CAAUC,CAAAA,CAAI,EAAIF,CAAQ,CAAA,KAAA,CAAM,GAAG,CAAA,CAE1C,OAAIC,CAAAA,GAAa,SACRH,CAAAA,CAAAA,CAAoBI,CAAI,CAAK,EAAA,GAAA,CAGlCD,CAAa,GAAA,OAA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yB,EAAK,WAAc,CAAA,MAAA,CCxGZ,IAAMO,CAAAA,CAAYtC,oBAAM,CAAA,UAAA,CAC7B,CAAC,CAAE,QAAA,CAAAI,EAAU,IAAAmC,CAAAA,CAAAA,CAAO,SAAU,SAAApC,CAAAA,CAAAA,CAAW,QAAAe,CAAAA,CAAAA,CAAU,GAAGZ,CAAM,CAAA,CAAGC,IAC7DP,oBAAA,CAAA,aAAA,CAAC,UACC,GAAKO,CAAAA,CAAAA,CACL,IAAMgC,CAAAA,CAAAA,CACN,SAAUrB,CACV,CAAA,SAAA,CAAWjC,EACT,iEACA2B,CAAAA,CAAAA,CACAM,GAAY,+BACZf,CAAAA,CACF,CACC,CAAA,GAAGG,GAEHF,CACH,CAEJ,EAEAkC,CAAU,CAAA,WAAA,CAAc,YCdXE,IAAAA,CAAAA,CAAa,CAAC,CAAE,UAAArC,CAAW,CAAA,OAAA,CAAAsC,CAAQ,CAE5CzC,GAAAA,oBAAAA,CAAA,cAACsC,CAAA,CAAA,CACC,SAAWrD,CAAAA,CAAAA,CACT,wGACA6B,CAAS,CAAA,KAAA,CACTX,CACF,CACA,CAAA,OAAA,CAASsC,GAETzC,oBAAA,CAAA,aAAA,CAAC+B,CAAA,CAAA,CAAK,MAAM,SAAU,CAAA,IAAA,CAAK,SAAS,CACtC,EAIJS,EAAW,WAAc,CAAA,YAAA","file":"EditButton.cjs","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const noopFn = () => {};\n","import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses =\n color === \"inherit\" ? \"text-inherit\" : `text-text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`font-sans antialiased ${typographyClasses} ${colorClasses} ${\n weight ? `!${fontWeight[weight]}` : \"\"\n } ${className ?? \"\"}`}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import * as React from \"react\";\nimport { Text } from \"./Text\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type ButtonProps = {\n /** @default filled */\n variant?: \"filled\" | \"outlined\";\n /** @default primary */\n color?: \"black\" | \"accent\" | \"secondary\";\n isLoading?: boolean;\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n start?: React.ReactNode;\n end?: React.ReactNode;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const filled = {\n black: \"bg-text-text text-white\",\n // fade it slightly\n accent: \"bg-primary-100 text-white\",\n secondary: \"bg-secondary-100 text-secondary\"\n};\n\nexport const outlined = {\n black: \"border border-text text-text\",\n accent: \"border border-primary-100 text-primary-100\",\n secondary: \"border border-text-secondary text-secondary\"\n};\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"filled\",\n color = \"black\",\n isLoading = false,\n children,\n disabled,\n end,\n ...props\n },\n ref\n ) => (\n <button\n ref={ref}\n className={cn(\n `\n sm:px-7 px-4\n py-2\n inline-flex items-center justify-center\n rounded-lg \n transition-colors duration-200\n disabled:opacity-50 disabled:pointer-events-none\n hover:opacity-80 active:scale-95 \n truncate`,\n focusRingStyles,\n variant === \"filled\" ? filled[color] : outlined[color],\n className\n )}\n disabled={disabled || isLoading}\n type=\"button\"\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text\n variant={[\"sm:body-default-bold\", \"body-xxs-semibold\"]}\n color=\"inherit\"\n >\n {children}\n </Text>\n ) : (\n children\n )}\n {end}\n </button>\n )\n);\n\nButton.displayName = \"Button\";\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: ResponsiveSize | ResponsiveSize[];\n /** @default primary */\n color?: IconColors;\n title?: string;\n className?: string;\n style?: React.CSSProperties;\n} & Omit<SVGProps<SVGSVGElement>, \"aria-hidden\" | \"aria-label\">;\n\nconst COLOR_MAP: Record<IconColors, string> = {\n primary: \"#080808\",\n secondary: \"#666666\",\n white: \"#ffffff\",\n primaryBlue: \"#089CCB\",\n disabled: \"#888888\"\n};\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"640px\",\n md: \"768px\",\n lg: \"1024px\",\n xl: \"1280px\",\n \"2xl\": \"1536px\"\n};\n\nconst processSizes = (\n sizes: ResponsiveSize | ResponsiveSize[] | undefined\n): React.CSSProperties => {\n if (!sizes) return { width: \"24px\", height: \"24px\" };\n\n const sizeArray = Array.isArray(sizes) ? sizes : [sizes];\n const mediaQueries: Record<string, string> = {};\n let baseSize: string | undefined;\n\n // Process each size\n sizeArray.forEach((size) => {\n if (typeof size === \"number\") {\n baseSize = `${size}px`;\n } else {\n const [breakpoint, valueStr] = size.split(\":\") as [Breakpoint, string];\n const value = parseInt(valueStr, 10);\n mediaQueries[`@media (min-width: ${BREAKPOINT_MAP[breakpoint]})`] =\n `${value}px`;\n }\n });\n\n // Create the style object with the correct structure\n return {\n width: baseSize || \"24px\",\n height: baseSize || \"24px\",\n ...Object.entries(mediaQueries).reduce(\n (acc, [query, size]) => ({\n ...acc,\n [query]: {\n width: size,\n height: size\n }\n }),\n {}\n )\n };\n};\n\nexport const Icon = React.forwardRef<SVGSVGElement, IconProps>(\n (\n {\n name,\n size = 24,\n color = \"primary\",\n title,\n className,\n style = {},\n ...props\n },\n ref\n ) => {\n const IconComponent = IconMap[name];\n const sizeStyles = processSizes(size);\n\n return (\n <div\n className={cn(\"flex justify-center items-center\", className)}\n style={{\n ...sizeStyles,\n [\"--icon-stroke\" as string]: COLOR_MAP[color],\n ...style\n }}\n >\n <IconComponent\n ref={ref}\n aria-hidden={!title}\n aria-label={title}\n stroke={name.includes(\"filled\") ? undefined : COLOR_MAP[color]}\n {...props}\n />\n </div>\n );\n }\n);\n\nIcon.displayName = \"Icon\";\n","import React, { ButtonHTMLAttributes } from \"react\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type PressableProps = ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const Pressable = React.forwardRef<HTMLButtonElement, PressableProps>(\n ({ children, type = \"button\", className, disabled, ...props }, ref) => (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n className={cn(\n \"appearance-none hover:opacity-80 transition-all active:scale-95\",\n focusRingStyles,\n disabled && \"opacity-50 cursor-not-allowed\",\n className\n )}\n {...props}\n >\n {children}\n </button>\n )\n);\n\nPressable.displayName = \"Pressable\";\n","import React from \"react\";\nimport { cn } from \"../utils\";\nimport { outlined } from \"./Button\";\nimport { Icon } from \"./Icon\";\nimport { Pressable } from \"./Pressable\";\n\nexport type EditButtonProps = {\n className?: string;\n onClick?: () => void;\n};\n\nexport const EditButton = ({ className, onClick }: EditButtonProps) => {\n return (\n <Pressable\n className={cn(\n \"absolute lg:top-10 md:top-8 top-4 lg:right-10 md:right-8 right-4 lg:px-2 lg:py-2 px-1 py-1 rounded-lg\",\n outlined.black,\n className\n )}\n onClick={onClick}\n >\n <Icon color=\"primary\" name=\"edit-2\" />\n </Pressable>\n );\n};\n\nEditButton.displayName = \"EditButton\";\n"]}
@@ -1,4 +1,4 @@
1
- import*as y from'react';import y__default from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {IconMap}from'@deckai/icons';function i(...e){return twMerge(clsx(e))}var $={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},A=e=>{let[o,t]=e.split("-");return o==="heading"?$[t]||"p":o==="label"?"label":"p"},C={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},P=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[n,r]=t.split(":");return `${n}:text-${r}`}return `text-${t}`}).join(" "):"text-body-default",u=y__default.forwardRef(({variant:e="body-default",color:o="primary",as:t,className:n,children:r,weight:s,...a},p)=>{let m=P(e),d=o==="inherit"?"text-inherit":`text-text-${o}`,M=y__default.useMemo(()=>{let E=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return A(E)},[e]);return y__default.createElement(t||M,{ref:p,className:`font-sans antialiased ${m} ${d} ${s?`!${C[s]}`:""} ${n??""}`,...a},r)});u.displayName="Text";var c="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var k={black:"bg-text-text text-white",accent:"bg-primary-100 text-white",secondary:"bg-secondary-100 text-secondary"},g={black:"border border-text text-text",accent:"border border-primary-100 text-primary-100",secondary:"border border-text-secondary text-secondary"},B=y.forwardRef(({className:e,variant:o="filled",color:t="black",isLoading:n=!1,children:r,disabled:s,...a},p)=>y.createElement("button",{ref:p,className:i(`
1
+ import*as y from'react';import y__default from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {IconMap}from'@deckai/icons';function i(...e){return twMerge(clsx(e))}var $={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},A=e=>{let[o,t]=e.split("-");return o==="heading"?$[t]||"p":o==="label"?"label":"p"},C={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},P=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[n,r]=t.split(":");return `${n}:text-${r}`}return `text-${t}`}).join(" "):"text-body-default",u=y__default.forwardRef(({variant:e="body-default",color:o="primary",as:t,className:n,children:r,weight:s,...a},p)=>{let l=P(e),d=o==="inherit"?"text-inherit":`text-text-${o}`,M=y__default.useMemo(()=>{let E=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return A(E)},[e]);return y__default.createElement(t||M,{ref:p,className:`font-sans antialiased ${l} ${d} ${s?`!${C[s]}`:""} ${n??""}`,...a},r)});u.displayName="Text";var m="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var k={black:"bg-text-text text-white",accent:"bg-primary-100 text-white",secondary:"bg-secondary-100 text-secondary"},g={black:"border border-text text-text",accent:"border border-primary-100 text-primary-100",secondary:"border border-text-secondary text-secondary"},B=y.forwardRef(({className:e,variant:o="filled",color:t="black",isLoading:n=!1,children:r,disabled:s,end:a,...p},l)=>y.createElement("button",{ref:l,className:i(`
2
2
  sm:px-7 px-4
3
3
  py-2
4
4
  inline-flex items-center justify-center
@@ -6,5 +6,5 @@ import*as y from'react';import y__default from'react';import {clsx}from'clsx';im
6
6
  transition-colors duration-200
7
7
  disabled:opacity-50 disabled:pointer-events-none
8
8
  hover:opacity-80 active:scale-95
9
- truncate`,c,o==="filled"?k[t]:g[t],e),disabled:s||n,type:"button",...a},typeof r=="string"?y.createElement(u,{variant:["sm:body-default-bold","body-xxs-semibold"],color:"inherit"},r):r));B.displayName="Button";var h={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},v={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},N=e=>{if(!e)return {width:"24px",height:"24px"};let o=Array.isArray(e)?e:[e],t={},n;return o.forEach(r=>{if(typeof r=="number")n=`${r}px`;else {let[s,a]=r.split(":"),p=parseInt(a,10);t[`@media (min-width: ${v[s]})`]=`${p}px`;}}),{width:n||"24px",height:n||"24px",...Object.entries(t).reduce((r,[s,a])=>({...r,[s]:{width:a,height:a}}),{})}},f=y__default.forwardRef(({name:e,size:o=24,color:t="primary",title:n,className:r,style:s={},...a},p)=>{let m=IconMap[e],d=N(o);return y__default.createElement("div",{className:i("flex justify-center items-center",r),style:{...d,"--icon-stroke":h[t],...s}},y__default.createElement(m,{ref:p,"aria-hidden":!n,"aria-label":n,stroke:e.includes("filled")?void 0:h[t],...a}))});f.displayName="Icon";var T=y__default.forwardRef(({children:e,type:o="button",className:t,disabled:n,...r},s)=>y__default.createElement("button",{ref:s,type:o,disabled:n,className:i("appearance-none hover:opacity-80 transition-all active:scale-95",c,n&&"opacity-50 cursor-not-allowed",t),...r},e));T.displayName="Pressable";var V=({className:e,onClick:o})=>y__default.createElement(T,{className:i("absolute lg:top-10 md:top-8 top-4 lg:right-10 md:right-8 right-4 lg:px-2 lg:py-2 px-1 py-1 rounded-lg",g.black,e),onClick:o},y__default.createElement(f,{color:"primary",name:"edit-2"}));V.displayName="EditButton";export{V as EditButton};//# sourceMappingURL=EditButton.js.map
9
+ truncate`,m,o==="filled"?k[t]:g[t],e),disabled:s||n,type:"button",...p},typeof r=="string"?y.createElement(u,{variant:["sm:body-default-bold","body-xxs-semibold"],color:"inherit"},r):r,a));B.displayName="Button";var h={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},v={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},N=e=>{if(!e)return {width:"24px",height:"24px"};let o=Array.isArray(e)?e:[e],t={},n;return o.forEach(r=>{if(typeof r=="number")n=`${r}px`;else {let[s,a]=r.split(":"),p=parseInt(a,10);t[`@media (min-width: ${v[s]})`]=`${p}px`;}}),{width:n||"24px",height:n||"24px",...Object.entries(t).reduce((r,[s,a])=>({...r,[s]:{width:a,height:a}}),{})}},f=y__default.forwardRef(({name:e,size:o=24,color:t="primary",title:n,className:r,style:s={},...a},p)=>{let l=IconMap[e],d=N(o);return y__default.createElement("div",{className:i("flex justify-center items-center",r),style:{...d,"--icon-stroke":h[t],...s}},y__default.createElement(l,{ref:p,"aria-hidden":!n,"aria-label":n,stroke:e.includes("filled")?void 0:h[t],...a}))});f.displayName="Icon";var T=y__default.forwardRef(({children:e,type:o="button",className:t,disabled:n,...r},s)=>y__default.createElement("button",{ref:s,type:o,disabled:n,className:i("appearance-none hover:opacity-80 transition-all active:scale-95",m,n&&"opacity-50 cursor-not-allowed",t),...r},e));T.displayName="Pressable";var V=({className:e,onClick:o})=>y__default.createElement(T,{className:i("absolute lg:top-10 md:top-8 top-4 lg:right-10 md:right-8 right-4 lg:px-2 lg:py-2 px-1 py-1 rounded-lg",g.black,e),onClick:o},y__default.createElement(f,{color:"primary",name:"edit-2"}));V.displayName="EditButton";export{V as EditButton};//# sourceMappingURL=EditButton.js.map
10
10
  //# sourceMappingURL=EditButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts","../../src/components/Text.tsx","../../src/utils/tailwind.ts","../../src/components/Button.tsx","../../src/components/Icon.tsx","../../src/components/Pressable.tsx","../../src/components/EditButton.tsx"],"names":["cn","inputs","twMerge","clsx","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","size","fontWeight","processVariants","variants","breakpoint","typographyClass","Text","React","color","as","className","children","weight","props","ref","typographyClasses","colorClasses","suggestedElement","baseVariant","focusRingStyles","filled","outlined","Button","l","isLoading","disabled","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","valueStr","value","acc","query","Icon","name","title","style","IconComponent","IconMap","sizeStyles","Pressable","type","EditButton","onClick"],"mappings":"uJAGO,SAASA,CAAAA,CAAAA,GAAMC,EAAsB,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCiEA,IAAMG,CAAmD,CAAA,CACvD,GAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACN,CAEMC,CAAAA,CAAAA,CAAyBC,CAAwC,EAAA,CACrE,GAAM,CAACC,CAAUC,CAAAA,CAAI,EAAIF,CAAQ,CAAA,KAAA,CA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AYZ,CAAAA,CAAAA,CAAAA,CAAUlB,CAAK,CAC5D,CAAA,GAAGK,EACN,CACF,CAEJ,CACF,CAAA,CAEAwB,EAAK,WAAc,CAAA,MAAA,CCxGZ,IAAMO,CAAAA,CAAYrC,UAAM,CAAA,UAAA,CAC7B,CAAC,CAAE,QAAA,CAAAI,EAAU,IAAAkC,CAAAA,CAAAA,CAAO,SAAU,SAAAnC,CAAAA,CAAAA,CAAW,QAAAe,CAAAA,CAAAA,CAAU,GAAGZ,CAAM,CAAA,CAAGC,IAC7DP,UAAA,CAAA,aAAA,CAAC,UACC,GAAKO,CAAAA,CAAAA,CACL,IAAM+B,CAAAA,CAAAA,CACN,SAAUpB,CACV,CAAA,SAAA,CAAWjC,EACT,iEACA2B,CAAAA,CAAAA,CACAM,GAAY,+BACZf,CAAAA,CACF,CACC,CAAA,GAAGG,GAEHF,CACH,CAEJ,EAEAiC,CAAU,CAAA,WAAA,CAAc,YCdXE,IAAAA,CAAAA,CAAa,CAAC,CAAE,UAAApC,CAAW,CAAA,OAAA,CAAAqC,CAAQ,CAE5CxC,GAAAA,UAAAA,CAAA,cAACqC,CAAA,CAAA,CACC,SAAWpD,CAAAA,CAAAA,CACT,wGACA6B,CAAS,CAAA,KAAA,CACTX,CACF,CACA,CAAA,OAAA,CAASqC,GAETxC,UAAA,CAAA,aAAA,CAAC8B,CAAA,CAAA,CAAK,MAAM,SAAU,CAAA,IAAA,CAAK,SAAS,CACtC,EAIJS,EAAW,WAAc,CAAA,YAAA","file":"EditButton.js","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const noopFn = () => {};\n","import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses =\n color === \"inherit\" ? \"text-inherit\" : `text-text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`font-sans antialiased ${typographyClasses} ${colorClasses} ${\n weight ? `!${fontWeight[weight]}` : \"\"\n } ${className ?? \"\"}`}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import * as React from \"react\";\nimport { Text } from \"./Text\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type ButtonProps = {\n /** @default filled */\n variant?: \"filled\" | \"outlined\";\n /** @default primary */\n color?: \"black\" | \"accent\" | \"secondary\";\n isLoading?: boolean;\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n start?: React.ReactNode;\n end?: React.ReactNode;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const filled = {\n black: \"bg-text-text text-white\",\n // fade it slightly\n accent: \"bg-primary-100 text-white\",\n secondary: \"bg-secondary-100 text-secondary\"\n};\n\nexport const outlined = {\n black: \"border border-text text-text\",\n accent: \"border border-primary-100 text-primary-100\",\n secondary: \"border border-text-secondary text-secondary\"\n};\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"filled\",\n color = \"black\",\n isLoading = false,\n children,\n disabled,\n ...props\n },\n ref\n ) => (\n <button\n ref={ref}\n className={cn(\n `\n sm:px-7 px-4\n py-2\n inline-flex items-center justify-center\n rounded-lg \n transition-colors duration-200\n disabled:opacity-50 disabled:pointer-events-none\n hover:opacity-80 active:scale-95 \n truncate`,\n focusRingStyles,\n variant === \"filled\" ? filled[color] : outlined[color],\n className\n )}\n disabled={disabled || isLoading}\n type=\"button\"\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text\n variant={[\"sm:body-default-bold\", \"body-xxs-semibold\"]}\n color=\"inherit\"\n >\n {children}\n </Text>\n ) : (\n children\n )}\n </button>\n )\n);\n\nButton.displayName = \"Button\";\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: ResponsiveSize | ResponsiveSize[];\n /** @default primary */\n color?: IconColors;\n title?: string;\n className?: string;\n style?: React.CSSProperties;\n} & Omit<SVGProps<SVGSVGElement>, \"aria-hidden\" | \"aria-label\">;\n\nconst COLOR_MAP: Record<IconColors, string> = {\n primary: \"#080808\",\n secondary: \"#666666\",\n white: \"#ffffff\",\n primaryBlue: \"#089CCB\",\n disabled: \"#888888\"\n};\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"640px\",\n md: \"768px\",\n lg: \"1024px\",\n xl: \"1280px\",\n \"2xl\": \"1536px\"\n};\n\nconst processSizes = (\n sizes: ResponsiveSize | ResponsiveSize[] | undefined\n): React.CSSProperties => {\n if (!sizes) return { width: \"24px\", height: \"24px\" };\n\n const sizeArray = Array.isArray(sizes) ? sizes : [sizes];\n const mediaQueries: Record<string, string> = {};\n let baseSize: string | undefined;\n\n // Process each size\n sizeArray.forEach((size) => {\n if (typeof size === \"number\") {\n baseSize = `${size}px`;\n } else {\n const [breakpoint, valueStr] = size.split(\":\") as [Breakpoint, string];\n const value = parseInt(valueStr, 10);\n mediaQueries[`@media (min-width: ${BREAKPOINT_MAP[breakpoint]})`] =\n `${value}px`;\n }\n });\n\n // Create the style object with the correct structure\n return {\n width: baseSize || \"24px\",\n height: baseSize || \"24px\",\n ...Object.entries(mediaQueries).reduce(\n (acc, [query, size]) => ({\n ...acc,\n [query]: {\n width: size,\n height: size\n }\n }),\n {}\n )\n };\n};\n\nexport const Icon = React.forwardRef<SVGSVGElement, IconProps>(\n (\n {\n name,\n size = 24,\n color = \"primary\",\n title,\n className,\n style = {},\n ...props\n },\n ref\n ) => {\n const IconComponent = IconMap[name];\n const sizeStyles = processSizes(size);\n\n return (\n <div\n className={cn(\"flex justify-center items-center\", className)}\n style={{\n ...sizeStyles,\n [\"--icon-stroke\" as string]: COLOR_MAP[color],\n ...style\n }}\n >\n <IconComponent\n ref={ref}\n aria-hidden={!title}\n aria-label={title}\n stroke={name.includes(\"filled\") ? undefined : COLOR_MAP[color]}\n {...props}\n />\n </div>\n );\n }\n);\n\nIcon.displayName = \"Icon\";\n","import React, { ButtonHTMLAttributes } from \"react\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type PressableProps = ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const Pressable = React.forwardRef<HTMLButtonElement, PressableProps>(\n ({ children, type = \"button\", className, disabled, ...props }, ref) => (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n className={cn(\n \"appearance-none hover:opacity-80 transition-all active:scale-95\",\n focusRingStyles,\n disabled && \"opacity-50 cursor-not-allowed\",\n className\n )}\n {...props}\n >\n {children}\n </button>\n )\n);\n\nPressable.displayName = \"Pressable\";\n","import React from \"react\";\nimport { cn } from \"../utils\";\nimport { outlined } from \"./Button\";\nimport { Icon } from \"./Icon\";\nimport { Pressable } from \"./Pressable\";\n\nexport type EditButtonProps = {\n className?: string;\n onClick?: () => void;\n};\n\nexport const EditButton = ({ className, onClick }: EditButtonProps) => {\n return (\n <Pressable\n className={cn(\n \"absolute lg:top-10 md:top-8 top-4 lg:right-10 md:right-8 right-4 lg:px-2 lg:py-2 px-1 py-1 rounded-lg\",\n outlined.black,\n className\n )}\n onClick={onClick}\n >\n <Icon color=\"primary\" name=\"edit-2\" />\n </Pressable>\n );\n};\n\nEditButton.displayName = \"EditButton\";\n"]}
1
+ {"version":3,"sources":["../../src/utils/index.ts","../../src/components/Text.tsx","../../src/utils/tailwind.ts","../../src/components/Button.tsx","../../src/components/Icon.tsx","../../src/components/Pressable.tsx","../../src/components/EditButton.tsx"],"names":["cn","inputs","twMerge","clsx","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","size","fontWeight","processVariants","variants","breakpoint","typographyClass","Text","React","color","as","className","children","weight","props","ref","typographyClasses","colorClasses","suggestedElement","baseVariant","focusRingStyles","filled","outlined","Button","c","isLoading","disabled","end","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","valueStr","value","acc","query","Icon","name","title","style","IconComponent","IconMap","sizeStyles","Pressable","type","EditButton","onClick"],"mappings":"uJAGO,SAASA,CAAAA,CAAAA,GAAMC,EAAsB,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCiEA,IAAMG,CAAmD,CAAA,CACvD,GAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACN,CAEMC,CAAAA,CAAAA,CAAyBC,CAAwC,EAAA,CACrE,GAAM,CAACC,CAAUC,CAAAA,CAAI,EAAIF,CAAQ,CAAA,KAAA,CAAM,GAAG,CAAA,CAE1C,OAAIC,CAAAA,GAAa,SACRH,CAAAA,CAAAA,CAAoBI,CAAI,CAAK,EAAA,GAAA,CAGlCD,CAAa,GAAA,OAAA,CACR,OAGF,CAAA,GACT,CAIME,CAAAA,CAAAA,CAAqC,CACzC,KAAO,CAAA,YAAA,CACP,OAAS,CAAA,cAAA,CACT,QAAU,CAAA,eAAA,CACV,IAAM,CAAA,WACR,EA0BMC,CACJC,CAAAA,CAAAA,EAEKA,CAEgB,CAAA,CAAA,KAAA,CAAM,OAAQA,CAAAA,CAAQ,CAAIA,CAAAA,CAAAA,CAAW,CAACA,CAAQ,CAAA,EAGhE,GAAKL,CAAAA,CAAAA,EAAY,CAChB,GAAIA,CAAQ,CAAA,QAAA,CAAS,GAAG,CAAG,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CAAAA,CAAAA,CACAM,GAAY,+BACZf,CAAAA,CACF,CACC,CAAA,GAAGG,GAEHF,CACH,CAEJ,EAEAkC,CAAU,CAAA,WAAA,CAAc,YCdXE,IAAAA,CAAAA,CAAa,CAAC,CAAE,UAAArC,CAAW,CAAA,OAAA,CAAAsC,CAAQ,CAE5CzC,GAAAA,UAAAA,CAAA,cAACsC,CAAA,CAAA,CACC,SAAWrD,CAAAA,CAAAA,CACT,wGACA6B,CAAS,CAAA,KAAA,CACTX,CACF,CACA,CAAA,OAAA,CAASsC,GAETzC,UAAA,CAAA,aAAA,CAAC+B,CAAA,CAAA,CAAK,MAAM,SAAU,CAAA,IAAA,CAAK,SAAS,CACtC,EAIJS,EAAW,WAAc,CAAA,YAAA","file":"EditButton.js","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const noopFn = () => {};\n","import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses =\n color === \"inherit\" ? \"text-inherit\" : `text-text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`font-sans antialiased ${typographyClasses} ${colorClasses} ${\n weight ? `!${fontWeight[weight]}` : \"\"\n } ${className ?? \"\"}`}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import * as React from \"react\";\nimport { Text } from \"./Text\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type ButtonProps = {\n /** @default filled */\n variant?: \"filled\" | \"outlined\";\n /** @default primary */\n color?: \"black\" | \"accent\" | \"secondary\";\n isLoading?: boolean;\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n start?: React.ReactNode;\n end?: React.ReactNode;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const filled = {\n black: \"bg-text-text text-white\",\n // fade it slightly\n accent: \"bg-primary-100 text-white\",\n secondary: \"bg-secondary-100 text-secondary\"\n};\n\nexport const outlined = {\n black: \"border border-text text-text\",\n accent: \"border border-primary-100 text-primary-100\",\n secondary: \"border border-text-secondary text-secondary\"\n};\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"filled\",\n color = \"black\",\n isLoading = false,\n children,\n disabled,\n end,\n ...props\n },\n ref\n ) => (\n <button\n ref={ref}\n className={cn(\n `\n sm:px-7 px-4\n py-2\n inline-flex items-center justify-center\n rounded-lg \n transition-colors duration-200\n disabled:opacity-50 disabled:pointer-events-none\n hover:opacity-80 active:scale-95 \n truncate`,\n focusRingStyles,\n variant === \"filled\" ? filled[color] : outlined[color],\n className\n )}\n disabled={disabled || isLoading}\n type=\"button\"\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text\n variant={[\"sm:body-default-bold\", \"body-xxs-semibold\"]}\n color=\"inherit\"\n >\n {children}\n </Text>\n ) : (\n children\n )}\n {end}\n </button>\n )\n);\n\nButton.displayName = \"Button\";\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: ResponsiveSize | ResponsiveSize[];\n /** @default primary */\n color?: IconColors;\n title?: string;\n className?: string;\n style?: React.CSSProperties;\n} & Omit<SVGProps<SVGSVGElement>, \"aria-hidden\" | \"aria-label\">;\n\nconst COLOR_MAP: Record<IconColors, string> = {\n primary: \"#080808\",\n secondary: \"#666666\",\n white: \"#ffffff\",\n primaryBlue: \"#089CCB\",\n disabled: \"#888888\"\n};\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"640px\",\n md: \"768px\",\n lg: \"1024px\",\n xl: \"1280px\",\n \"2xl\": \"1536px\"\n};\n\nconst processSizes = (\n sizes: ResponsiveSize | ResponsiveSize[] | undefined\n): React.CSSProperties => {\n if (!sizes) return { width: \"24px\", height: \"24px\" };\n\n const sizeArray = Array.isArray(sizes) ? sizes : [sizes];\n const mediaQueries: Record<string, string> = {};\n let baseSize: string | undefined;\n\n // Process each size\n sizeArray.forEach((size) => {\n if (typeof size === \"number\") {\n baseSize = `${size}px`;\n } else {\n const [breakpoint, valueStr] = size.split(\":\") as [Breakpoint, string];\n const value = parseInt(valueStr, 10);\n mediaQueries[`@media (min-width: ${BREAKPOINT_MAP[breakpoint]})`] =\n `${value}px`;\n }\n });\n\n // Create the style object with the correct structure\n return {\n width: baseSize || \"24px\",\n height: baseSize || \"24px\",\n ...Object.entries(mediaQueries).reduce(\n (acc, [query, size]) => ({\n ...acc,\n [query]: {\n width: size,\n height: size\n }\n }),\n {}\n )\n };\n};\n\nexport const Icon = React.forwardRef<SVGSVGElement, IconProps>(\n (\n {\n name,\n size = 24,\n color = \"primary\",\n title,\n className,\n style = {},\n ...props\n },\n ref\n ) => {\n const IconComponent = IconMap[name];\n const sizeStyles = processSizes(size);\n\n return (\n <div\n className={cn(\"flex justify-center items-center\", className)}\n style={{\n ...sizeStyles,\n [\"--icon-stroke\" as string]: COLOR_MAP[color],\n ...style\n }}\n >\n <IconComponent\n ref={ref}\n aria-hidden={!title}\n aria-label={title}\n stroke={name.includes(\"filled\") ? undefined : COLOR_MAP[color]}\n {...props}\n />\n </div>\n );\n }\n);\n\nIcon.displayName = \"Icon\";\n","import React, { ButtonHTMLAttributes } from \"react\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type PressableProps = ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const Pressable = React.forwardRef<HTMLButtonElement, PressableProps>(\n ({ children, type = \"button\", className, disabled, ...props }, ref) => (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n className={cn(\n \"appearance-none hover:opacity-80 transition-all active:scale-95\",\n focusRingStyles,\n disabled && \"opacity-50 cursor-not-allowed\",\n className\n )}\n {...props}\n >\n {children}\n </button>\n )\n);\n\nPressable.displayName = \"Pressable\";\n","import React from \"react\";\nimport { cn } from \"../utils\";\nimport { outlined } from \"./Button\";\nimport { Icon } from \"./Icon\";\nimport { Pressable } from \"./Pressable\";\n\nexport type EditButtonProps = {\n className?: string;\n onClick?: () => void;\n};\n\nexport const EditButton = ({ className, onClick }: EditButtonProps) => {\n return (\n <Pressable\n className={cn(\n \"absolute lg:top-10 md:top-8 top-4 lg:right-10 md:right-8 right-4 lg:px-2 lg:py-2 px-1 py-1 rounded-lg\",\n outlined.black,\n className\n )}\n onClick={onClick}\n >\n <Icon color=\"primary\" name=\"edit-2\" />\n </Pressable>\n );\n};\n\nEditButton.displayName = \"EditButton\";\n"]}
@@ -1,2 +1,2 @@
1
- 'use strict';var o=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);var u=({icon:t,size:r=40,className:n})=>{let s=o.useMemo(()=>{let e=new DOMParser().parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return null;e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("preserveAspectRatio","xMidYMid meet");let i=e.getAttribute("viewBox")||"0 0 40 40";return e.setAttribute("viewBox",i),e.outerHTML},[t]);return s?o__default.default.createElement("div",{style:{width:r,height:r,display:"flex",alignItems:"center",justifyContent:"center"},className:n,dangerouslySetInnerHTML:{__html:s}}):null};u.displayName="IconRenderer";exports.IconRenderer=u;//# sourceMappingURL=IconRenderer.cjs.map
1
+ 'use strict';var e=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var e__default=/*#__PURE__*/_interopDefault(e);var a=({icon:n,size:t=40,className:r})=>{let s=n.match(/<svg[^>]*>([\s\S]*?)<\/svg>/);if(!s)return e__default.default.createElement("div",{style:{width:t,height:t,display:"flex",alignItems:"center",justifyContent:"center"},className:r});let i=n.match(/<svg([^>]*)>/),o=(i?i[1]:"").match(/viewBox=["']([^"']*)["']/),c=o?o[1]:"0 0 40 40";return e__default.default.createElement("div",{style:{width:t,height:t,display:"flex",alignItems:"center",justifyContent:"center"},className:r},e__default.default.createElement("svg",{width:"100%",height:"100%",viewBox:c,preserveAspectRatio:"xMidYMid meet",dangerouslySetInnerHTML:{__html:s[1]}}))};a.displayName="IconRenderer";exports.IconRenderer=a;//# sourceMappingURL=IconRenderer.cjs.map
2
2
  //# sourceMappingURL=IconRenderer.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/IconRenderer.tsx"],"names":["IconRenderer","icon","size","className","sanitizedSvg","useMemo","svg","viewBox","React"],"mappings":"wJAQaA,CAAe,CAAA,CAAC,CAC3B,IAAA,CAAAC,CACA,CAAA,IAAA,CAAAC,EAAO,EACP,CAAA,SAAA,CAAAC,CACF,CAAyB,GAAA,CACvB,IAAMC,CAAeC,CAAAA,SAAAA,CAAQ,IAAM,CAGjC,IAAMC,CAAAA,CAFS,IAAI,SAAU,EAAA,CACV,gBAAgBL,CAAM,CAAA,eAAe,EACxC,aAAc,CAAA,KAAK,CAEnC,CAAA,GAAI,CAACK,CAAAA,CAAK,OAAO,IAGjBA,CAAAA,CAAAA,CAAI,YAAa,CAAA,OAAA,CAAS,MAAM,CAAA,CAChCA,EAAI,YAAa,CAAA,QAAA,CAAU,MAAM,CAAA,CACjCA,CAAI,CAAA,YAAA,CAAa,sBAAuB,eAAe,CAAA,CAGvD,IAAMC,CAAUD,CAAAA,CAAAA,CAAI,aAAa,SAAS,CAAA,EAAK,WAC/C,CAAA,OAAAA,CAAI,CAAA,YAAA,CAAa,UAAWC,CAAO,CAAA,CAE5BD,CAAI,CAAA,SACb,CAAG,CAAA,CAACL,CAAI,CAAC,CAAA,CAET,OAAKG,CAAAA,CAGHI,kBAAA,CAAA,aAAA,CAAC,OACC,KAAO,CAAA,CACL,MAAON,CACP,CAAA,MAAA,CAAQA,EACR,OAAS,CAAA,MAAA,CACT,UAAY,CAAA,QAAA,CACZ,cAAgB,CAAA,QAClB,EACA,SAAWC,CAAAA,CAAAA,CACX,uBAAyB,CAAA,CAAE,MAAQC,CAAAA,CAAa,EAClD,CAbwB,CAAA,IAe5B,EAEAJ,CAAAA,CAAa,WAAc,CAAA,cAAA","file":"IconRenderer.cjs","sourcesContent":["import React, { useMemo } from \"react\";\n\nexport type IconRendererProps = {\n icon: string;\n size?: number;\n className?: string;\n};\n\nexport const IconRenderer = ({\n icon,\n size = 40,\n className\n}: IconRendererProps) => {\n const sanitizedSvg = useMemo(() => {\n const parser = new DOMParser();\n const doc = parser.parseFromString(icon, \"image/svg+xml\");\n const svg = doc.querySelector(\"svg\");\n\n if (!svg) return null;\n\n // Set size attributes but preserve aspect ratio\n svg.setAttribute(\"width\", \"100%\");\n svg.setAttribute(\"height\", \"100%\");\n svg.setAttribute(\"preserveAspectRatio\", \"xMidYMid meet\");\n\n // Get the original viewBox or use the default\n const viewBox = svg.getAttribute(\"viewBox\") || \"0 0 40 40\";\n svg.setAttribute(\"viewBox\", viewBox);\n\n return svg.outerHTML;\n }, [icon]);\n\n if (!sanitizedSvg) return null;\n\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n dangerouslySetInnerHTML={{ __html: sanitizedSvg }}\n />\n );\n};\n\nIconRenderer.displayName = \"IconRenderer\";\n"]}
1
+ {"version":3,"sources":["../../src/components/IconRenderer.tsx"],"names":["IconRenderer","icon","size","className","svgMatch","React","attributesMatch","viewBoxMatch","viewBox"],"mappings":"oJAQaA,IAAAA,CAAAA,CAAe,CAAC,CAC3B,IAAA,CAAAC,CACA,CAAA,IAAA,CAAAC,CAAO,CAAA,EAAA,CACP,UAAAC,CACF,CAAA,GAAyB,CAEvB,IAAMC,CAAWH,CAAAA,CAAAA,CAAK,MAAM,6BAA6B,CAAA,CAEzD,GAAI,CAACG,CACH,CAAA,OACEC,mBAAA,aAAC,CAAA,KAAA,CAAA,CACC,KAAO,CAAA,CACL,KAAOH,CAAAA,CAAAA,CACP,OAAQA,CACR,CAAA,OAAA,CAAS,MACT,CAAA,UAAA,CAAY,QACZ,CAAA,cAAA,CAAgB,QAClB,CACA,CAAA,SAAA,CAAWC,CACb,CAAA,CAAA,CAKJ,IAAMG,CAAAA,CAAkBL,EAAK,KAAM,CAAA,cAAc,CAI3CM,CAAAA,CAAAA,CAAAA,CAHmBD,CAAkBA,CAAAA,CAAAA,CAAgB,CAAC,CAAI,CAAA,EAAA,EAG1B,MAAM,0BAA0B,CAAA,CAChEE,EAAUD,CAAeA,CAAAA,CAAAA,CAAa,CAAC,CAAA,CAAI,WAEjD,CAAA,OACEF,mBAAA,aAAC,CAAA,KAAA,CAAA,CACC,KAAO,CAAA,CACL,KAAOH,CAAAA,CAAAA,CACP,OAAQA,CACR,CAAA,OAAA,CAAS,MACT,CAAA,UAAA,CAAY,QACZ,CAAA,cAAA,CAAgB,QAClB,CACA,CAAA,SAAA,CAAWC,CAEXE,CAAAA,CAAAA,kBAAAA,CAAA,aAAC,CAAA,KAAA,CAAA,CACC,MAAM,MACN,CAAA,MAAA,CAAO,MACP,CAAA,OAAA,CAASG,CACT,CAAA,mBAAA,CAAoB,gBACpB,uBAAyB,CAAA,CAAE,MAAQJ,CAAAA,CAAAA,CAAS,CAAC,CAAE,EACjD,CACF,CAEJ,EAEAJ,CAAAA,CAAa,WAAc,CAAA,cAAA","file":"IconRenderer.cjs","sourcesContent":["import React from \"react\";\n\nexport type IconRendererProps = {\n icon: string;\n size?: number;\n className?: string;\n};\n\nexport const IconRenderer = ({\n icon,\n size = 40,\n className\n}: IconRendererProps) => {\n // Extract SVG content from the string (everything between <svg> and </svg>)\n const svgMatch = icon.match(/<svg[^>]*>([\\s\\S]*?)<\\/svg>/);\n\n if (!svgMatch) {\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n />\n );\n }\n\n // Extract attributes from the SVG tag\n const attributesMatch = icon.match(/<svg([^>]*)>/);\n const attributesString = attributesMatch ? attributesMatch[1] : \"\";\n\n // Parse viewBox\n const viewBoxMatch = attributesString.match(/viewBox=[\"']([^\"']*)[\"']/);\n const viewBox = viewBoxMatch ? viewBoxMatch[1] : \"0 0 40 40\";\n\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n >\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox={viewBox}\n preserveAspectRatio=\"xMidYMid meet\"\n dangerouslySetInnerHTML={{ __html: svgMatch[1] }}\n />\n </div>\n );\n};\n\nIconRenderer.displayName = \"IconRenderer\";\n"]}
@@ -6,7 +6,7 @@ type IconRendererProps = {
6
6
  className?: string;
7
7
  };
8
8
  declare const IconRenderer: {
9
- ({ icon, size, className }: IconRendererProps): React__default.JSX.Element | null;
9
+ ({ icon, size, className }: IconRendererProps): React__default.JSX.Element;
10
10
  displayName: string;
11
11
  };
12
12
 
@@ -6,7 +6,7 @@ type IconRendererProps = {
6
6
  className?: string;
7
7
  };
8
8
  declare const IconRenderer: {
9
- ({ icon, size, className }: IconRendererProps): React__default.JSX.Element | null;
9
+ ({ icon, size, className }: IconRendererProps): React__default.JSX.Element;
10
10
  displayName: string;
11
11
  };
12
12
 
@@ -1,2 +1,2 @@
1
- import o,{useMemo}from'react';var u=({icon:t,size:r=40,className:n})=>{let s=useMemo(()=>{let e=new DOMParser().parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return null;e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("preserveAspectRatio","xMidYMid meet");let i=e.getAttribute("viewBox")||"0 0 40 40";return e.setAttribute("viewBox",i),e.outerHTML},[t]);return s?o.createElement("div",{style:{width:r,height:r,display:"flex",alignItems:"center",justifyContent:"center"},className:n,dangerouslySetInnerHTML:{__html:s}}):null};u.displayName="IconRenderer";export{u as IconRenderer};//# sourceMappingURL=IconRenderer.js.map
1
+ import e from'react';var a=({icon:n,size:t=40,className:r})=>{let s=n.match(/<svg[^>]*>([\s\S]*?)<\/svg>/);if(!s)return e.createElement("div",{style:{width:t,height:t,display:"flex",alignItems:"center",justifyContent:"center"},className:r});let i=n.match(/<svg([^>]*)>/),o=(i?i[1]:"").match(/viewBox=["']([^"']*)["']/),c=o?o[1]:"0 0 40 40";return e.createElement("div",{style:{width:t,height:t,display:"flex",alignItems:"center",justifyContent:"center"},className:r},e.createElement("svg",{width:"100%",height:"100%",viewBox:c,preserveAspectRatio:"xMidYMid meet",dangerouslySetInnerHTML:{__html:s[1]}}))};a.displayName="IconRenderer";export{a as IconRenderer};//# sourceMappingURL=IconRenderer.js.map
2
2
  //# sourceMappingURL=IconRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/IconRenderer.tsx"],"names":["IconRenderer","icon","size","className","sanitizedSvg","useMemo","svg","viewBox","React"],"mappings":"kCAQaA,CAAe,CAAA,CAAC,CAC3B,IAAA,CAAAC,CACA,CAAA,IAAA,CAAAC,EAAO,EACP,CAAA,SAAA,CAAAC,CACF,CAAyB,GAAA,CACvB,IAAMC,CAAeC,CAAAA,OAAAA,CAAQ,IAAM,CAGjC,IAAMC,CAAAA,CAFS,IAAI,SAAU,EAAA,CACV,gBAAgBL,CAAM,CAAA,eAAe,EACxC,aAAc,CAAA,KAAK,CAEnC,CAAA,GAAI,CAACK,CAAAA,CAAK,OAAO,IAGjBA,CAAAA,CAAAA,CAAI,YAAa,CAAA,OAAA,CAAS,MAAM,CAAA,CAChCA,EAAI,YAAa,CAAA,QAAA,CAAU,MAAM,CAAA,CACjCA,CAAI,CAAA,YAAA,CAAa,sBAAuB,eAAe,CAAA,CAGvD,IAAMC,CAAUD,CAAAA,CAAAA,CAAI,aAAa,SAAS,CAAA,EAAK,WAC/C,CAAA,OAAAA,CAAI,CAAA,YAAA,CAAa,UAAWC,CAAO,CAAA,CAE5BD,CAAI,CAAA,SACb,CAAG,CAAA,CAACL,CAAI,CAAC,CAAA,CAET,OAAKG,CAAAA,CAGHI,CAAA,CAAA,aAAA,CAAC,OACC,KAAO,CAAA,CACL,MAAON,CACP,CAAA,MAAA,CAAQA,EACR,OAAS,CAAA,MAAA,CACT,UAAY,CAAA,QAAA,CACZ,cAAgB,CAAA,QAClB,EACA,SAAWC,CAAAA,CAAAA,CACX,uBAAyB,CAAA,CAAE,MAAQC,CAAAA,CAAa,EAClD,CAbwB,CAAA,IAe5B,EAEAJ,CAAAA,CAAa,WAAc,CAAA,cAAA","file":"IconRenderer.js","sourcesContent":["import React, { useMemo } from \"react\";\n\nexport type IconRendererProps = {\n icon: string;\n size?: number;\n className?: string;\n};\n\nexport const IconRenderer = ({\n icon,\n size = 40,\n className\n}: IconRendererProps) => {\n const sanitizedSvg = useMemo(() => {\n const parser = new DOMParser();\n const doc = parser.parseFromString(icon, \"image/svg+xml\");\n const svg = doc.querySelector(\"svg\");\n\n if (!svg) return null;\n\n // Set size attributes but preserve aspect ratio\n svg.setAttribute(\"width\", \"100%\");\n svg.setAttribute(\"height\", \"100%\");\n svg.setAttribute(\"preserveAspectRatio\", \"xMidYMid meet\");\n\n // Get the original viewBox or use the default\n const viewBox = svg.getAttribute(\"viewBox\") || \"0 0 40 40\";\n svg.setAttribute(\"viewBox\", viewBox);\n\n return svg.outerHTML;\n }, [icon]);\n\n if (!sanitizedSvg) return null;\n\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n dangerouslySetInnerHTML={{ __html: sanitizedSvg }}\n />\n );\n};\n\nIconRenderer.displayName = \"IconRenderer\";\n"]}
1
+ {"version":3,"sources":["../../src/components/IconRenderer.tsx"],"names":["IconRenderer","icon","size","className","svgMatch","React","attributesMatch","viewBoxMatch","viewBox"],"mappings":"qBAQaA,IAAAA,CAAAA,CAAe,CAAC,CAC3B,IAAA,CAAAC,CACA,CAAA,IAAA,CAAAC,CAAO,CAAA,EAAA,CACP,UAAAC,CACF,CAAA,GAAyB,CAEvB,IAAMC,CAAWH,CAAAA,CAAAA,CAAK,MAAM,6BAA6B,CAAA,CAEzD,GAAI,CAACG,CACH,CAAA,OACEC,EAAA,aAAC,CAAA,KAAA,CAAA,CACC,KAAO,CAAA,CACL,KAAOH,CAAAA,CAAAA,CACP,OAAQA,CACR,CAAA,OAAA,CAAS,MACT,CAAA,UAAA,CAAY,QACZ,CAAA,cAAA,CAAgB,QAClB,CACA,CAAA,SAAA,CAAWC,CACb,CAAA,CAAA,CAKJ,IAAMG,CAAAA,CAAkBL,EAAK,KAAM,CAAA,cAAc,CAI3CM,CAAAA,CAAAA,CAAAA,CAHmBD,CAAkBA,CAAAA,CAAAA,CAAgB,CAAC,CAAI,CAAA,EAAA,EAG1B,MAAM,0BAA0B,CAAA,CAChEE,EAAUD,CAAeA,CAAAA,CAAAA,CAAa,CAAC,CAAA,CAAI,WAEjD,CAAA,OACEF,EAAA,aAAC,CAAA,KAAA,CAAA,CACC,KAAO,CAAA,CACL,KAAOH,CAAAA,CAAAA,CACP,OAAQA,CACR,CAAA,OAAA,CAAS,MACT,CAAA,UAAA,CAAY,QACZ,CAAA,cAAA,CAAgB,QAClB,CACA,CAAA,SAAA,CAAWC,CAEXE,CAAAA,CAAAA,CAAAA,CAAA,aAAC,CAAA,KAAA,CAAA,CACC,MAAM,MACN,CAAA,MAAA,CAAO,MACP,CAAA,OAAA,CAASG,CACT,CAAA,mBAAA,CAAoB,gBACpB,uBAAyB,CAAA,CAAE,MAAQJ,CAAAA,CAAAA,CAAS,CAAC,CAAE,EACjD,CACF,CAEJ,EAEAJ,CAAAA,CAAa,WAAc,CAAA,cAAA","file":"IconRenderer.js","sourcesContent":["import React from \"react\";\n\nexport type IconRendererProps = {\n icon: string;\n size?: number;\n className?: string;\n};\n\nexport const IconRenderer = ({\n icon,\n size = 40,\n className\n}: IconRendererProps) => {\n // Extract SVG content from the string (everything between <svg> and </svg>)\n const svgMatch = icon.match(/<svg[^>]*>([\\s\\S]*?)<\\/svg>/);\n\n if (!svgMatch) {\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n />\n );\n }\n\n // Extract attributes from the SVG tag\n const attributesMatch = icon.match(/<svg([^>]*)>/);\n const attributesString = attributesMatch ? attributesMatch[1] : \"\";\n\n // Parse viewBox\n const viewBoxMatch = attributesString.match(/viewBox=[\"']([^\"']*)[\"']/);\n const viewBox = viewBoxMatch ? viewBoxMatch[1] : \"0 0 40 40\";\n\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n >\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox={viewBox}\n preserveAspectRatio=\"xMidYMid meet\"\n dangerouslySetInnerHTML={{ __html: svgMatch[1] }}\n />\n </div>\n );\n};\n\nIconRenderer.displayName = \"IconRenderer\";\n"]}
@@ -1,2 +1,2 @@
1
- 'use strict';var a=require('react'),v=require('@radix-ui/react-popover'),H=require('@radix-ui/react-collapsible'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),icons=require('@deckai/icons');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var a__namespace=/*#__PURE__*/_interopNamespace(a);var v__namespace=/*#__PURE__*/_interopNamespace(v);var H__namespace=/*#__PURE__*/_interopNamespace(H);function c(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var _={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},ie={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},le=e=>{if(!e)return {width:"24px",height:"24px"};let r=Array.isArray(e)?e:[e],t={},n;return r.forEach(s=>{if(typeof s=="number")n=`${s}px`;else {let[i,d]=s.split(":"),u=parseInt(d,10);t[`@media (min-width: ${ie[i]})`]=`${u}px`;}}),{width:n||"24px",height:n||"24px",...Object.entries(t).reduce((s,[i,d])=>({...s,[i]:{width:d,height:d}}),{})}},x=a__namespace.default.forwardRef(({name:e,size:r=24,color:t="primary",title:n,className:s,style:i={},...d},u)=>{let m=icons.IconMap[e],l=le(r);return a__namespace.default.createElement("div",{className:c("flex justify-center items-center",s),style:{...l,"--icon-stroke":_[t],...i}},a__namespace.default.createElement(m,{ref:u,"aria-hidden":!n,"aria-label":n,stroke:e.includes("filled")?void 0:_[t],...d}))});x.displayName="Icon";var F=({className:e,end:r,iconName:t,color:n,size:s,title:i,label:d,labelClassName:u,id:m,children:l,forceShowFocusRing:f,...y})=>a__namespace.createElement("div",{className:"py-2"},d&&a__namespace.createElement("label",{htmlFor:m,className:c("block text-sm font-medium text-text-primary",u)},d),a__namespace.createElement("div",{className:c("relative flex flex-col gap-2 w-full rounded-lg border border-secondary-50 bg-background-0 px-3 md:py-3 py-2 text-secondary ring-offset-background disabled:opacity-50",{"ring-2 ring-primary ring-offset-2":f,"focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2":!f})},a__namespace.createElement("div",{className:"flex relative"},a__namespace.createElement("input",{id:m,className:c("font-sans lg:text-body-default text-xs flex w-full file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text disabled:cursor-not-allowed md:text-md focus:outline-none",r&&"pr-10",e),...y}),r&&a__namespace.createElement("div",{className:"absolute inset-y-0 right-0 flex items-center"},t?a__namespace.createElement(x,{name:t,color:n,size:s,title:i}):r)),l));var pe={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},me=e=>{let[r,t]=e.split("-");return r==="heading"?pe[t]||"p":r==="label"?"label":"p"},de={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},ce=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[n,s]=t.split(":");return `${n}:text-${s}`}return `text-${t}`}).join(" "):"text-body-default",b=a__namespace.default.forwardRef(({variant:e="body-default",color:r="primary",as:t,className:n,children:s,weight:i,...d},u)=>{let m=ce(e),l=r==="inherit"?"text-inherit":`text-text-${r}`,f=a__namespace.default.useMemo(()=>{let g=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return me(g)},[e]);return a__namespace.default.createElement(t||f,{ref:u,className:`font-sans antialiased ${m} ${l} ${i?`!${de[i]}`:""} ${n??""}`,...d},s)});b.displayName="Text";var $="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var D=({value:e,label:r,onChange:t,selected:n,color:s,disabled:i,className:d})=>a__namespace.default.createElement("button",{type:"button",disabled:i,className:c("relative w-full text-left px-2 py-1.5 text-sm rounded","cursor-pointer hover:bg-gray-100","disabled:opacity-50 disabled:cursor-not-allowed",n&&"bg-gray-100","flex items-center gap-2",$,d),onClick:()=>{t?.(e);}},a__namespace.default.createElement(b,{variant:"body-default-medium",color:s==="danger"?"danger":"inherit"},r));var A=a__namespace.default.forwardRef(({children:e,type:r="button",className:t,disabled:n,...s},i)=>a__namespace.default.createElement("button",{ref:i,type:r,disabled:n,className:c("appearance-none hover:opacity-80 transition-all active:scale-95",$,n&&"opacity-50 cursor-not-allowed",t),...s},e));A.displayName="Pressable";var J=({children:e,color:r="primary",className:t,onClose:n,...s})=>{let[i,d]=a.useState(!1),u=a.useCallback(()=>{d(!0);},[]),m=a.useCallback(()=>{d(!1);},[]),l=a__namespace.default.createElement("div",{className:c("flex gap-2",n?"justify-between items-center":"items-center justify-center","hover:bg-primary-100 rounded bg-secondary-400 px-2 py-1 sm:px-3 sm:py-1.5 h-min hover:text-white",r==="primary"?"text-primary-100":"text-text",t),onMouseEnter:u,onMouseLeave:m},typeof e=="string"?a__namespace.default.createElement(b,{color:"inherit",variant:["md:body-default-medium","body-xxs-medium"],className:"truncate pt-0.5"},e):e,n&&a__namespace.default.createElement(A,{...s,onClick:n,className:"flex items-center justify-center"},a__namespace.default.createElement(x,{name:"close",size:10,color:i?"white":"primaryBlue"})));return n?l:a__namespace.default.createElement(A,{...s},l)};var X=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Y=clsx.clsx,Z=(e,r)=>t=>{var n;if(r?.variants==null)return Y(e,t?.class,t?.className);let{variants:s,defaultVariants:i}=r,d=Object.keys(s).map(l=>{let f=t?.[l],y=i?.[l];if(f===null)return null;let g=X(f)||X(y);return s[l][g]}),u=t&&Object.entries(t).reduce((l,f)=>{let[y,g]=f;return g===void 0||(l[y]=g),l},{}),m=r==null||(n=r.compoundVariants)===null||n===void 0?void 0:n.reduce((l,f)=>{let{class:y,className:g,...k}=f;return Object.entries(k).every(C=>{let[N,h]=C;return Array.isArray(h)?h.includes({...i,...u}[N]):{...i,...u}[N]===h})?[...l,y,g]:l},[]);return Y(e,d,m,t?.class,t?.className)};var be=Z("animate-spin rounded-full border-current border-t-transparent",{variants:{size:{sm:"h-4 w-4 border-3",md:"h-6 w-6 border-4",lg:"h-8 w-8 border-8"}},defaultVariants:{size:"md"}}),I=a__namespace.forwardRef(({size:e,className:r,customSize:t,...n},s)=>{let i=t?{width:t,height:t,borderWidth:Math.max(2,Math.floor(t/16))}:{};return a__namespace.createElement("div",{role:"status","aria-label":"Loading",ref:s,className:c(be({size:e}),"text-primary-100",r),style:i,...n},a__namespace.createElement("span",{className:"sr-only"},"Loading..."))});I.displayName="Spinner";var mt=({options:e,selectedValues:r,onSelectionChange:t,placeholder:n="Select items...",className:s,label:i,labelClassName:d,id:u,maxSelections:m,disabled:l,noOptionsMessage:f,loading:y,errorMessage:g,container:k})=>{let[C,N]=a.useState(!1),[h,L]=a.useState(""),[G,B]=a.useState({});a__namespace.default.useEffect(()=>{L("");},[r]);let M=a.useMemo(()=>e.length>0&&"options"in e[0],[e]),z=a.useMemo(()=>M?e.reduce((o,p)=>[...o,...p.options],[]):e,[M,e]),K=a.useMemo(()=>{if(!M){let o=e.filter(p=>!r.includes(p.value)&&(typeof p.label=="string"?p.label.toLowerCase().includes(h.toLowerCase()):typeof p.label=="number"?p.label.toString().includes(h):!1));return o.length>0?[{label:"",options:o}]:[]}return e.map(o=>({...o,options:o.options.filter(p=>!r.includes(p.value)&&(typeof p.label=="string"?p.label.toLowerCase().includes(h.toLowerCase()):typeof p.label=="number"?p.label.toString().includes(h):!1))})).filter(o=>o.options.length>0)},[M,e,r,h]),W=a.useMemo(()=>z.filter(o=>r.includes(o.value)),[z,r]),ee=a.useCallback(o=>{(!m||r.length<m)&&(t([...r,o]),L(""));},[m,t,r]),te=a.useCallback(o=>{t(r.filter(p=>p!==o)),L("");},[t,r]),re=a.useCallback(o=>{B(p=>({...p,[o]:!p[o]}));},[]);return a__namespace.default.useEffect(()=>{if(M){let o=e.reduce((p,w)=>({...p,[w.label]:!0}),{});B(o);}},[M,e]),a__namespace.default.createElement("div",{className:"py-2"},a__namespace.default.createElement(v__namespace.Root,{open:C&&!l,onOpenChange:o=>{l||(N(o),o||L(""));}},a__namespace.default.createElement("div",{className:`relative w-full font-sans text-text-secondary ${s}`},i&&a__namespace.default.createElement("div",{className:"flex justify-between items-center mb-1"},a__namespace.default.createElement(b,{variant:"label-default",className:d},i),m&&a__namespace.default.createElement(b,{variant:"body-xxs-medium",color:"secondary"},a__namespace.default.createElement(b,{as:"span",variant:"body-xxs-medium"},r.length),"/",m)),a__namespace.default.createElement(v__namespace.Trigger,{asChild:!0},a__namespace.default.createElement("div",{className:"relative flex-1"},a__namespace.default.createElement(F,{id:u,placeholder:m&&r.length>=m?`Maximum ${m} items selected`:n,value:h,onChange:o=>L(o.target.value),className:"flex-1 bg-background-0",disabled:l||!!m&&r.length>=m,end:y?a__namespace.default.createElement(I,{size:"sm"}):a__namespace.default.createElement(x,{name:"search-normal",size:["lg:24",18]}),forceShowFocusRing:C},W.length>0?a__namespace.default.createElement("div",{className:"flex flex-wrap gap-2"},W.map(o=>a__namespace.default.createElement(J,{key:o.value,onClose:()=>te(o.value)},o.label))):null))),a__namespace.default.createElement(v__namespace.Portal,{container:k},a__namespace.default.createElement(v__namespace.Content,{className:"w-[--radix-popover-trigger-width] p-1 bg-white rounded-md shadow-lg border z-[9999] data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out",sideOffset:5,side:"bottom",align:"start"},a__namespace.default.createElement("div",{className:"max-h-60 overflow-auto flex flex-col items-start"},K.length>0?K.map((o,p)=>a__namespace.default.createElement(H__namespace.Root,{key:o.label||p,className:"w-full",open:G[o.label]??!0,onOpenChange:()=>o.label&&re(o.label)},o.label&&a__namespace.default.createElement(H__namespace.Trigger,{asChild:!0},a__namespace.default.createElement("button",{className:"w-full flex items-center justify-between px-2 py-1.5 hover:bg-gray-50"},a__namespace.default.createElement(b,{variant:"body-default-bold",color:"secondary"},o.label),a__namespace.default.createElement(x,{name:"arrow-down",className:c("transition-transform",G[o.label]&&"rotate-180"),size:16}))),a__namespace.default.createElement(H__namespace.Content,{className:"data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up"},o.options.map((w,oe)=>a__namespace.default.createElement(D,{key:`${p}-${oe}`,label:w.label,value:w.value,onChange:ee,className:"pl-4"}))))):a__namespace.default.createElement(b,{variant:"label-default",className:"text-text-secondary"},f||"No results found")))))),g&&a__namespace.default.createElement(b,{variant:"label-default",color:"danger",className:"mt-2"},g))};exports.MultiSelectCombobox=mt;//# sourceMappingURL=MultiSelectCombobox.cjs.map
1
+ 'use strict';var a=require('react'),v=require('@radix-ui/react-popover'),H=require('@radix-ui/react-collapsible'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),icons=require('@deckai/icons');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var a__namespace=/*#__PURE__*/_interopNamespace(a);var v__namespace=/*#__PURE__*/_interopNamespace(v);var H__namespace=/*#__PURE__*/_interopNamespace(H);function c(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var _={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},ie={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},le=e=>{if(!e)return {width:"24px",height:"24px"};let r=Array.isArray(e)?e:[e],t={},n;return r.forEach(s=>{if(typeof s=="number")n=`${s}px`;else {let[i,d]=s.split(":"),u=parseInt(d,10);t[`@media (min-width: ${ie[i]})`]=`${u}px`;}}),{width:n||"24px",height:n||"24px",...Object.entries(t).reduce((s,[i,d])=>({...s,[i]:{width:d,height:d}}),{})}},x=a__namespace.default.forwardRef(({name:e,size:r=24,color:t="primary",title:n,className:s,style:i={},...d},u)=>{let m=icons.IconMap[e],l=le(r);return a__namespace.default.createElement("div",{className:c("flex justify-center items-center",s),style:{...l,"--icon-stroke":_[t],...i}},a__namespace.default.createElement(m,{ref:u,"aria-hidden":!n,"aria-label":n,stroke:e.includes("filled")?void 0:_[t],...d}))});x.displayName="Icon";var F=({className:e,end:r,iconName:t,color:n,size:s,title:i,label:d,labelClassName:u,id:m,children:l,forceShowFocusRing:f,...y})=>a__namespace.createElement("div",{className:"py-2"},d&&a__namespace.createElement("label",{htmlFor:m,className:c("block text-sm font-medium text-text-primary",u)},d),a__namespace.createElement("div",{className:c("relative flex flex-col gap-2 w-full rounded-lg border border-secondary-50 bg-background-0 px-3 md:py-3 py-2 text-secondary ring-offset-background disabled:opacity-50",{"ring-2 ring-primary ring-offset-2":f,"focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2":!f})},a__namespace.createElement("div",{className:"flex relative"},a__namespace.createElement("input",{id:m,className:c("font-sans lg:text-body-default text-xs flex w-full file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text disabled:cursor-not-allowed md:text-md focus:outline-none",r&&"pr-10",e),...y}),r&&a__namespace.createElement("div",{className:"absolute inset-y-0 right-0 flex items-center"},t?a__namespace.createElement(x,{name:t,color:n,size:s,title:i}):r)),l));var pe={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},me=e=>{let[r,t]=e.split("-");return r==="heading"?pe[t]||"p":r==="label"?"label":"p"},de={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},ce=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[n,s]=t.split(":");return `${n}:text-${s}`}return `text-${t}`}).join(" "):"text-body-default",b=a__namespace.default.forwardRef(({variant:e="body-default",color:r="primary",as:t,className:n,children:s,weight:i,...d},u)=>{let m=ce(e),l=r==="inherit"?"text-inherit":`text-text-${r}`,f=a__namespace.default.useMemo(()=>{let g=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return me(g)},[e]);return a__namespace.default.createElement(t||f,{ref:u,className:`font-sans antialiased ${m} ${l} ${i?`!${de[i]}`:""} ${n??""}`,...d},s)});b.displayName="Text";var $="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var D=({value:e,label:r,onChange:t,selected:n,color:s,disabled:i,className:d})=>a__namespace.default.createElement("button",{type:"button",disabled:i,className:c("relative w-full text-left px-2 py-1.5 text-sm rounded","cursor-pointer hover:bg-gray-100","disabled:opacity-50 disabled:cursor-not-allowed",n&&"bg-gray-100","flex items-center gap-2",$,d),onClick:()=>{t?.(e);}},a__namespace.default.createElement(b,{variant:"body-default-medium",color:s==="danger"?"danger":"inherit"},r));var A=a__namespace.default.forwardRef(({children:e,type:r="button",className:t,disabled:n,...s},i)=>a__namespace.default.createElement("button",{ref:i,type:r,disabled:n,className:c("appearance-none hover:opacity-80 transition-all active:scale-95",$,n&&"opacity-50 cursor-not-allowed",t),...s},e));A.displayName="Pressable";var J=({children:e,color:r="primary",className:t,onClose:n,...s})=>{let[i,d]=a.useState(!1),u=a.useCallback(()=>{d(!0);},[]),m=a.useCallback(()=>{d(!1);},[]),l=a__namespace.default.createElement("div",{className:c("flex gap-2",n?"justify-between items-center":"items-center justify-center","hover:bg-primary-100 rounded bg-secondary-400 px-2 py-1 sm:px-3 sm:py-1.5 h-min hover:text-white",r==="primary"?"text-primary-100":"text-text",t),onMouseEnter:u,onMouseLeave:m},typeof e=="string"?a__namespace.default.createElement(b,{color:"inherit",variant:["md:body-default-medium","body-xxs-medium"],className:"truncate pt-0.5"},e):e,n&&a__namespace.default.createElement(A,{...s,onClick:n,className:"flex items-center justify-center"},a__namespace.default.createElement(x,{name:"close",size:10,color:i?"white":"primaryBlue"})));return n?l:a__namespace.default.createElement(A,{...s},l)};var X=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Y=clsx.clsx,Z=(e,r)=>t=>{var n;if(r?.variants==null)return Y(e,t?.class,t?.className);let{variants:s,defaultVariants:i}=r,d=Object.keys(s).map(l=>{let f=t?.[l],y=i?.[l];if(f===null)return null;let g=X(f)||X(y);return s[l][g]}),u=t&&Object.entries(t).reduce((l,f)=>{let[y,g]=f;return g===void 0||(l[y]=g),l},{}),m=r==null||(n=r.compoundVariants)===null||n===void 0?void 0:n.reduce((l,f)=>{let{class:y,className:g,...O}=f;return Object.entries(O).every(C=>{let[N,h]=C;return Array.isArray(h)?h.includes({...i,...u}[N]):{...i,...u}[N]===h})?[...l,y,g]:l},[]);return Y(e,d,m,t?.class,t?.className)};var be=Z("animate-spin rounded-full border-current border-t-transparent",{variants:{size:{sm:"h-4 w-4 border-3",md:"h-6 w-6 border-4",lg:"h-8 w-8 border-8"}},defaultVariants:{size:"md"}}),I=a__namespace.forwardRef(({size:e,className:r,customSize:t,...n},s)=>{let i=t?{width:t,height:t,borderWidth:Math.max(2,Math.floor(t/16))}:{};return a__namespace.createElement("div",{role:"status","aria-label":"Loading",ref:s,className:c(be({size:e}),"text-primary-100",r),style:i,...n},a__namespace.createElement("span",{className:"sr-only"},"Loading..."))});I.displayName="Spinner";var mt=({options:e,selectedValues:r,onSelectionChange:t,placeholder:n="Select items...",className:s,label:i,labelClassName:d,id:u,maxSelections:m,disabled:l,noOptionsMessage:f,loading:y,errorMessage:g,container:O})=>{let[C,N]=a.useState(!1),[h,L]=a.useState(""),[G,B]=a.useState({});a__namespace.default.useEffect(()=>{L("");},[r]);let M=a.useMemo(()=>e.length>0&&"options"in e[0],[e]),z=a.useMemo(()=>M?e.reduce((o,p)=>[...o,...p.options],[]):e,[M,e]),K=a.useMemo(()=>{if(!M){let o=e.filter(p=>!r.includes(p.value)&&(typeof p.label=="string"?p.label.toLowerCase().includes(h.toLowerCase()):typeof p.label=="number"?p.label.toString().includes(h):!1));return o.length>0?[{label:"",options:o}]:[]}return e.map(o=>({...o,options:o.options.filter(p=>!r.includes(p.value)&&(typeof p.label=="string"?p.label.toLowerCase().includes(h.toLowerCase()):typeof p.label=="number"?p.label.toString().includes(h):!1))})).filter(o=>o.options.length>0)},[M,e,r,h]),W=a.useMemo(()=>z.filter(o=>r.includes(o.value)),[z,r]),ee=a.useCallback(o=>{(!m||r.length<m)&&(t([...r,o]),L(""));},[m,t,r]),te=a.useCallback(o=>{t(r.filter(p=>p!==o)),L("");},[t,r]),re=a.useCallback(o=>{B(p=>({...p,[o]:!p[o]}));},[]);return a__namespace.default.useEffect(()=>{if(M){let o=e.reduce((p,w)=>({...p,[w.label]:!0}),{});B(o);}},[M,e]),a__namespace.default.createElement("div",{className:"py-2"},a__namespace.default.createElement(v__namespace.Root,{open:C&&!l,onOpenChange:o=>{l||(N(o),o||L(""));}},a__namespace.default.createElement("div",{className:`relative w-full font-sans text-text-secondary ${s}`},i&&a__namespace.default.createElement("div",{className:"flex justify-between items-center mb-1"},a__namespace.default.createElement(b,{variant:"label-default",className:d},i),m&&a__namespace.default.createElement(b,{variant:"body-xxs-medium",color:"secondary"},a__namespace.default.createElement(b,{as:"span",variant:"body-xxs-medium"},r.length),"/",m)),a__namespace.default.createElement(v__namespace.Trigger,{asChild:!0},a__namespace.default.createElement("div",{className:"relative flex-1"},a__namespace.default.createElement(F,{id:u,placeholder:m&&r.length>=m?`Maximum ${m} items selected`:n,value:h,onChange:o=>L(o.target.value),className:"flex-1 bg-background-0",disabled:l||!!m&&r.length>=m,end:y?a__namespace.default.createElement(I,{size:"sm"}):a__namespace.default.createElement(x,{name:"search-normal",size:["lg:24",18]}),forceShowFocusRing:C},W.length>0?a__namespace.default.createElement("div",{className:"flex flex-wrap gap-2"},W.map(o=>a__namespace.default.createElement(J,{key:o.value,onClose:()=>te(o.value)},o.label))):null))),a__namespace.default.createElement(v__namespace.Portal,{container:O},a__namespace.default.createElement(v__namespace.Content,{className:"w-[--radix-popover-trigger-width] p-1 bg-white rounded-md shadow-lg border z-[9999] data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out",side:"bottom",align:"start"},a__namespace.default.createElement("div",{className:"max-h-60 overflow-auto flex flex-col items-start"},K.length>0?K.map((o,p)=>a__namespace.default.createElement(H__namespace.Root,{key:o.label||p,className:"w-full",open:G[o.label]??!0,onOpenChange:()=>o.label&&re(o.label)},o.label&&a__namespace.default.createElement(H__namespace.Trigger,{asChild:!0},a__namespace.default.createElement("button",{className:"w-full flex items-center justify-between px-2 py-1.5 hover:bg-gray-50"},a__namespace.default.createElement(b,{variant:"body-default-bold",color:"secondary"},o.label),a__namespace.default.createElement(x,{name:"arrow-down",className:c("transition-transform",G[o.label]&&"rotate-180"),size:16}))),a__namespace.default.createElement(H__namespace.Content,{className:"data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up"},o.options.map((w,oe)=>a__namespace.default.createElement(D,{key:`${p}-${oe}`,label:w.label,value:w.value,onChange:ee,className:"pl-4"}))))):a__namespace.default.createElement(b,{variant:"label-default",className:"text-text-secondary"},f||"No results found")))))),g&&a__namespace.default.createElement(b,{variant:"label-default",color:"danger",className:"mt-2"},g))};exports.MultiSelectCombobox=mt;//# sourceMappingURL=MultiSelectCombobox.cjs.map
2
2
  //# sourceMappingURL=MultiSelectCombobox.cjs.map