@deckai/deck-ui 0.0.16 → 0.0.18

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 (202) hide show
  1. package/dist/components/AboutCard.cjs +8 -2
  2. package/dist/components/AboutCard.cjs.map +1 -1
  3. package/dist/components/AboutCard.js +8 -2
  4. package/dist/components/AboutCard.js.map +1 -1
  5. package/dist/components/Accordion.cjs +7 -1
  6. package/dist/components/Accordion.cjs.map +1 -1
  7. package/dist/components/Accordion.js +7 -1
  8. package/dist/components/Accordion.js.map +1 -1
  9. package/dist/components/AddWorkCard.cjs +9 -3
  10. package/dist/components/AddWorkCard.cjs.map +1 -1
  11. package/dist/components/AddWorkCard.js +9 -3
  12. package/dist/components/AddWorkCard.js.map +1 -1
  13. package/dist/components/AutocompleteInput.cjs +8 -0
  14. package/dist/components/AutocompleteInput.cjs.map +1 -0
  15. package/dist/components/AutocompleteInput.d.cts +28 -0
  16. package/dist/components/AutocompleteInput.d.ts +28 -0
  17. package/dist/components/AutocompleteInput.js +8 -0
  18. package/dist/components/AutocompleteInput.js.map +1 -0
  19. package/dist/components/Avatar.cjs +1 -1
  20. package/dist/components/Avatar.cjs.map +1 -1
  21. package/dist/components/Avatar.d.cts +3 -1
  22. package/dist/components/Avatar.d.ts +3 -1
  23. package/dist/components/Avatar.js +1 -1
  24. package/dist/components/Avatar.js.map +1 -1
  25. package/dist/components/Badge.cjs +7 -1
  26. package/dist/components/Badge.cjs.map +1 -1
  27. package/dist/components/Badge.js +7 -1
  28. package/dist/components/Badge.js.map +1 -1
  29. package/dist/components/Breadcrumbs.cjs +7 -1
  30. package/dist/components/Breadcrumbs.cjs.map +1 -1
  31. package/dist/components/Breadcrumbs.js +7 -1
  32. package/dist/components/Breadcrumbs.js.map +1 -1
  33. package/dist/components/Button.cjs +8 -2
  34. package/dist/components/Button.cjs.map +1 -1
  35. package/dist/components/Button.d.cts +2 -2
  36. package/dist/components/Button.d.ts +2 -2
  37. package/dist/components/Button.js +8 -2
  38. package/dist/components/Button.js.map +1 -1
  39. package/dist/components/Carousel.cjs +1 -1
  40. package/dist/components/Carousel.cjs.map +1 -1
  41. package/dist/components/Carousel.d.cts +1 -3
  42. package/dist/components/Carousel.d.ts +1 -3
  43. package/dist/components/Carousel.js +1 -1
  44. package/dist/components/Carousel.js.map +1 -1
  45. package/dist/components/Collapsible.cjs +8 -2
  46. package/dist/components/Collapsible.cjs.map +1 -1
  47. package/dist/components/Collapsible.js +8 -2
  48. package/dist/components/Collapsible.js.map +1 -1
  49. package/dist/components/Combobox.cjs +7 -1
  50. package/dist/components/Combobox.cjs.map +1 -1
  51. package/dist/components/Combobox.d.cts +10 -1
  52. package/dist/components/Combobox.d.ts +10 -1
  53. package/dist/components/Combobox.js +7 -1
  54. package/dist/components/Combobox.js.map +1 -1
  55. package/dist/components/ContactItem.cjs +7 -1
  56. package/dist/components/ContactItem.cjs.map +1 -1
  57. package/dist/components/ContactItem.js +7 -1
  58. package/dist/components/ContactItem.js.map +1 -1
  59. package/dist/components/Dropdown.cjs +7 -1
  60. package/dist/components/Dropdown.cjs.map +1 -1
  61. package/dist/components/Dropdown.js +7 -1
  62. package/dist/components/Dropdown.js.map +1 -1
  63. package/dist/components/EditButton.cjs +8 -2
  64. package/dist/components/EditButton.cjs.map +1 -1
  65. package/dist/components/EditButton.js +8 -2
  66. package/dist/components/EditButton.js.map +1 -1
  67. package/dist/components/Icon.cjs +1 -1
  68. package/dist/components/Icon.cjs.map +1 -1
  69. package/dist/components/Icon.d.cts +1 -1
  70. package/dist/components/Icon.d.ts +1 -1
  71. package/dist/components/Icon.js +1 -1
  72. package/dist/components/Icon.js.map +1 -1
  73. package/dist/components/IconRenderer.cjs +1 -1
  74. package/dist/components/IconRenderer.cjs.map +1 -1
  75. package/dist/components/IconRenderer.d.cts +1 -1
  76. package/dist/components/IconRenderer.d.ts +1 -1
  77. package/dist/components/IconRenderer.js +1 -1
  78. package/dist/components/IconRenderer.js.map +1 -1
  79. package/dist/components/Input.cjs +7 -1
  80. package/dist/components/Input.cjs.map +1 -1
  81. package/dist/components/Input.d.cts +33 -2
  82. package/dist/components/Input.d.ts +33 -2
  83. package/dist/components/Input.js +7 -1
  84. package/dist/components/Input.js.map +1 -1
  85. package/dist/components/Link.cjs +7 -1
  86. package/dist/components/Link.cjs.map +1 -1
  87. package/dist/components/Link.d.cts +1 -1
  88. package/dist/components/Link.d.ts +1 -1
  89. package/dist/components/Link.js +7 -1
  90. package/dist/components/Link.js.map +1 -1
  91. package/dist/components/MultiSelectCombobox.cjs +7 -1
  92. package/dist/components/MultiSelectCombobox.cjs.map +1 -1
  93. package/dist/components/MultiSelectCombobox.d.cts +25 -4
  94. package/dist/components/MultiSelectCombobox.d.ts +25 -4
  95. package/dist/components/MultiSelectCombobox.js +7 -1
  96. package/dist/components/MultiSelectCombobox.js.map +1 -1
  97. package/dist/components/Navbar.cjs +8 -2
  98. package/dist/components/Navbar.cjs.map +1 -1
  99. package/dist/components/Navbar.d.cts +1 -1
  100. package/dist/components/Navbar.d.ts +1 -1
  101. package/dist/components/Navbar.js +8 -2
  102. package/dist/components/Navbar.js.map +1 -1
  103. package/dist/components/NavbarItem.cjs +1 -1
  104. package/dist/components/NavbarItem.cjs.map +1 -1
  105. package/dist/components/NavbarItem.d.cts +1 -1
  106. package/dist/components/NavbarItem.d.ts +1 -1
  107. package/dist/components/NavbarItem.js +1 -1
  108. package/dist/components/NavbarItem.js.map +1 -1
  109. package/dist/components/Option.cjs +7 -1
  110. package/dist/components/Option.cjs.map +1 -1
  111. package/dist/components/Option.d.cts +13 -2
  112. package/dist/components/Option.d.ts +13 -2
  113. package/dist/components/Option.js +7 -1
  114. package/dist/components/Option.js.map +1 -1
  115. package/dist/components/Pressable.cjs +1 -1
  116. package/dist/components/Pressable.cjs.map +1 -1
  117. package/dist/components/Pressable.js +1 -1
  118. package/dist/components/Pressable.js.map +1 -1
  119. package/dist/components/ProfileCard.cjs +7 -1
  120. package/dist/components/ProfileCard.cjs.map +1 -1
  121. package/dist/components/ProfileCard.js +7 -1
  122. package/dist/components/ProfileCard.js.map +1 -1
  123. package/dist/components/ProgressBar.cjs +7 -1
  124. package/dist/components/ProgressBar.cjs.map +1 -1
  125. package/dist/components/ProgressBar.d.cts +4 -0
  126. package/dist/components/ProgressBar.d.ts +4 -0
  127. package/dist/components/ProgressBar.js +7 -1
  128. package/dist/components/ProgressBar.js.map +1 -1
  129. package/dist/components/RadioGroup.cjs +8 -0
  130. package/dist/components/RadioGroup.cjs.map +1 -0
  131. package/dist/components/RadioGroup.d.cts +38 -0
  132. package/dist/components/RadioGroup.d.ts +38 -0
  133. package/dist/components/RadioGroup.js +8 -0
  134. package/dist/components/RadioGroup.js.map +1 -0
  135. package/dist/components/SegmentedTabs.cjs +8 -2
  136. package/dist/components/SegmentedTabs.cjs.map +1 -1
  137. package/dist/components/SegmentedTabs.js +8 -2
  138. package/dist/components/SegmentedTabs.js.map +1 -1
  139. package/dist/components/Sidebar.cjs +1 -1
  140. package/dist/components/Sidebar.cjs.map +1 -1
  141. package/dist/components/Sidebar.js +1 -1
  142. package/dist/components/Sidebar.js.map +1 -1
  143. package/dist/components/SlideButton.cjs +7 -1
  144. package/dist/components/SlideButton.cjs.map +1 -1
  145. package/dist/components/SlideButton.js +7 -1
  146. package/dist/components/SlideButton.js.map +1 -1
  147. package/dist/components/SocialCard.cjs +7 -1
  148. package/dist/components/SocialCard.cjs.map +1 -1
  149. package/dist/components/SocialCard.d.cts +1 -1
  150. package/dist/components/SocialCard.d.ts +1 -1
  151. package/dist/components/SocialCard.js +7 -1
  152. package/dist/components/SocialCard.js.map +1 -1
  153. package/dist/components/Switch.cjs +1 -1
  154. package/dist/components/Switch.cjs.map +1 -1
  155. package/dist/components/Switch.js +1 -1
  156. package/dist/components/Switch.js.map +1 -1
  157. package/dist/components/Tabs.cjs +8 -2
  158. package/dist/components/Tabs.cjs.map +1 -1
  159. package/dist/components/Tabs.js +8 -2
  160. package/dist/components/Tabs.js.map +1 -1
  161. package/dist/components/Tag.cjs +7 -1
  162. package/dist/components/Tag.cjs.map +1 -1
  163. package/dist/components/Tag.js +7 -1
  164. package/dist/components/Tag.js.map +1 -1
  165. package/dist/components/Text.cjs +7 -1
  166. package/dist/components/Text.cjs.map +1 -1
  167. package/dist/components/Text.d.cts +3 -3
  168. package/dist/components/Text.d.ts +3 -3
  169. package/dist/components/Text.js +7 -1
  170. package/dist/components/Text.js.map +1 -1
  171. package/dist/components/TextArea.cjs +7 -1
  172. package/dist/components/TextArea.cjs.map +1 -1
  173. package/dist/components/TextArea.d.cts +5 -1
  174. package/dist/components/TextArea.d.ts +5 -1
  175. package/dist/components/TextArea.js +7 -1
  176. package/dist/components/TextArea.js.map +1 -1
  177. package/dist/components/Toast.cjs +8 -2
  178. package/dist/components/Toast.cjs.map +1 -1
  179. package/dist/components/Toast.d.cts +24 -12
  180. package/dist/components/Toast.d.ts +24 -12
  181. package/dist/components/Toast.js +8 -2
  182. package/dist/components/Toast.js.map +1 -1
  183. package/dist/components/WorkCard.cjs +7 -1
  184. package/dist/components/WorkCard.cjs.map +1 -1
  185. package/dist/components/WorkCard.js +7 -1
  186. package/dist/components/WorkCard.js.map +1 -1
  187. package/dist/index.cjs +10 -52
  188. package/dist/index.cjs.map +1 -1
  189. package/dist/index.d.cts +3 -2
  190. package/dist/index.d.ts +3 -2
  191. package/dist/index.js +10 -52
  192. package/dist/index.js.map +1 -1
  193. package/dist/styles/styles.css +1 -1
  194. package/dist/{tailwind-CuJn6tv4.d.cts → tailwind-Cl3vNM6S.d.cts} +9 -7
  195. package/dist/{tailwind-CuJn6tv4.d.ts → tailwind-Cl3vNM6S.d.ts} +9 -7
  196. package/package.json +3 -3
  197. package/dist/components/Illustration.cjs +0 -50
  198. package/dist/components/Illustration.cjs.map +0 -1
  199. package/dist/components/Illustration.d.cts +0 -10
  200. package/dist/components/Illustration.d.ts +0 -10
  201. package/dist/components/Illustration.js +0 -50
  202. package/dist/components/Illustration.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts","../../src/components/Text.tsx","../../src/utils/tailwind.ts","../../src/components/Option.tsx","../../src/components/Dropdown.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","Option","value","label","onChange","selected","disabled","Dropdown","o","trigger","items","onSelect","align","handleSelect","n","item"],"mappings":"qiBAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,qBAAAA,CAAQC,SAAKF,CAAAA,CAAM,CAAC,CAC7B,CCiEA,IAAMG,CAAAA,CAAmD,CACvD,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EAAA,CAAI,KACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACN,CAAA,CAEMC,CAAyBC,CAAAA,CAAAA,EAAwC,CACrE,GAAM,CAACC,CAAUC,CAAAA,CAAI,EAAIF,CAAQ,CAAA,KAAA,CAAM,GAAG,CAE1C,CAAA,OAAIC,IAAa,SACRH,CAAAA,CAAAA,CAAoBI,CAAI,CAAK,EAAA,GAAA,CAGlCD,IAAa,OACR,CAAA,OAAA,CAGF,GACT,CAIME,CAAAA,CAAAA,CAAqC,CACzC,KAAA,CAAO,YACP,CAAA,OAAA,CAAS,eACT,QAAU,CAAA,eAAA,CACV,KAAM,WACR,CAAA,CA0BMC,EACJC,CAEKA,EAAAA,CAAAA,CAAAA,CAEgB,MAAM,OAAQA,CAAAA,CAAQ,EAAIA,CAAW,CAAA,CAACA,CAAQ,CAGhE,EAAA,GAAA,CAAKL,GAAY,CAChB,GAAIA,CAAQ,CAAA,QAAA,CAAS,GAAG,CAAA,CAAG,CACzB,GAAM,CAACM,EAAYC,CAAe,CAAA,CAAIP,EAAQ,KAAM,CAAA,GAAG,EACvD,OAAO,CAAA,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AA,CAAOiB,CACP,CAAA,UAAA,CAAY,EACZ,SAAWvC,CAAAA,CAAAA,CACT,qBACA,yBACA,CAAA,kCAAA,CACA,kCACAkB,CACF,CAAA,CAAA,CAECmB,EAAM,GAAKK,CAAAA,CAAAA,EACVP,2BAAcM,YAAb,CAAA,IAAA,CAAA,CACC,IAAKC,CAAK,CAAA,KAAA,CACV,SAAUA,CAAK,CAAA,QAAA,CACf,QAAU,CAAA,IAAMF,CAAaE,CAAAA,CAAAA,CAAK,KAAK,CACvC,CAAA,SAAA,CAAU,eACV,OAAO,CAAA,CAAA,CAAA,CAAA,CAEPP,2BAACP,CAAA,CAAA,CACE,GAAGc,CAAAA,CACJ,SAAU,CAAA,WAAA,CACV,SAAUF,CACZ,CAAA,CACF,CACD,CACH,CACF,CACF,CAEJ,CACF,EAEAN,CAAAA,CAAS,WAAc,CAAA,UAAA","file":"Dropdown.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 React from \"react\";\nimport { cn } from \"../utils\";\nimport { Text } from \"./Text\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nexport type OptionProps = {\n label: React.ReactNode;\n value: string;\n /** Optional color override for specific items like \"Logout\" in red */\n color?: \"default\" | \"danger\";\n /** Optional disabled state */\n disabled?: boolean;\n onChange?: (value: string) => void;\n selected?: boolean;\n className?: string;\n};\n\nexport const Option = ({\n value,\n label,\n onChange,\n selected,\n color,\n disabled,\n className\n}: OptionProps) => (\n <button\n type=\"button\"\n disabled={disabled}\n className={cn(\n \"relative w-full text-left px-2 py-1.5 text-sm rounded\",\n \"cursor-pointer hover:bg-gray-100\",\n \"disabled:opacity-50 disabled:cursor-not-allowed\",\n selected && \"bg-gray-100\",\n \"flex items-center gap-2\",\n focusRingStyles,\n className\n )}\n onClick={() => {\n onChange?.(value);\n }}\n >\n <Text\n variant=\"body-default-medium\"\n color={color === \"danger\" ? \"danger\" : \"inherit\"}\n >\n {label}\n </Text>\n </button>\n);\n","import * as React from \"react\";\nimport * as DropdownMenu from \"@radix-ui/react-dropdown-menu\";\nimport { cn } from \"../utils\";\nimport { Option, type OptionProps } from \"./Option\";\n\nexport type DropdownProps = {\n /** The trigger element that opens the dropdown */\n trigger: React.ReactNode;\n /** Array of items to show in the dropdown */\n items: Omit<OptionProps, \"onChange\" | \"selected\">[];\n /** Optional className for the content */\n className?: string;\n /** Callback when an item is selected */\n onSelect?: (value: string) => void;\n /** Optional side alignment */\n align?: \"start\" | \"center\" | \"end\";\n};\n\nexport const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(\n ({ trigger, items, className, onSelect, align = \"end\" }, ref) => {\n const handleSelect = React.useCallback(\n (value: string) => {\n onSelect?.(value);\n },\n [onSelect]\n );\n\n return (\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>{trigger}</DropdownMenu.Trigger>\n\n <DropdownMenu.Portal>\n <DropdownMenu.Content\n ref={ref}\n align={align}\n sideOffset={8}\n className={cn(\n \"z-50 min-w-[220px]\",\n \"bg-white rounded-lg p-1\",\n \"shadow-lg border border-gray-100\",\n \"animate-in fade-in-0 zoom-in-95\",\n className\n )}\n >\n {items.map((item) => (\n <DropdownMenu.Item\n key={item.value}\n disabled={item.disabled}\n onSelect={() => handleSelect(item.value)}\n className=\"outline-none\"\n asChild\n >\n <Option\n {...item}\n className=\"py-3 px-6\"\n onChange={handleSelect}\n />\n </DropdownMenu.Item>\n ))}\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n );\n }\n);\n\nDropdown.displayName = \"Dropdown\";\n"]}
1
+ {"version":3,"sources":["../../src/utils/index.ts","../../src/components/Text.tsx","../../src/components/Option.tsx","../../src/components/Dropdown.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","HighlightedText","text","highlight","parts","part","i","Option","value","label","onChange","onKeyDown","onMouseEnter","onMouseLeave","selected","disabled","id","role","ariaSelected","searchValue","Dropdown","r","trigger","items","onSelect","align","handleSelect","s","item"],"mappings":"qiBAGO,SAASA,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,qBAAQC,CAAAA,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CCkEA,IAAMG,CAAmD,CAAA,CACvD,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EAAA,CAAI,KACJ,EAAI,CAAA,IACN,EAEMC,CAAyBC,CAAAA,CAAAA,EAAwC,CACrE,GAAM,CAACC,CAAAA,CAAUC,CAAI,CAAIF,CAAAA,CAAAA,CAAQ,MAAM,GAAG,CAAA,CAE1C,OAAIC,CAAa,GAAA,SAAA,CACRH,CAAoBI,CAAAA,CAAI,CAAK,EAAA,GAAA,CAGlCD,IAAa,OACR,CAAA,OAAA,CAGF,GACT,CAIME,CAAAA,CAAAA,CAAqC,CACzC,KAAO,CAAA,YAAA,CACP,OAAS,CAAA,cAAA,CACT,QAAU,CAAA,eAAA,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,CAAAC,EAAQ,KAAM,CAAA,CAAG7B,CAAQ,GAAA,CAC/D,IAAM8B,CAAAA,CAAqBL,YACxBb,CAAAA,WAAAA,CAAAA,CAAAA,EAAkB,CACjBgB,CAAWhB,GAAAA,CAAK,EAClB,CAAA,CACA,CAACgB,CAAQ,CACX,CAAA,CAEA,OACEH,YAAc,CAAA,aAAA,CAAAM,YAAA,CAAA,IAAA,CAAb,IACC,CAAAN,YAAA,CAAA,aAAA,CAAcM,YAAb,CAAA,OAAA,CAAA,CAAqB,OAAO,CAAA,CAAA,CAAA,CAAA,CAAEL,CAAQ,CAAA,CAEvCD,YAAc,CAAA,aAAA,CAAAM,YAAA,CAAA,MAAA,CAAb,IACC,CAAAN,YAAA,CAAA,aAAA,CAAcM,YAAb,CAAA,OAAA,CAAA,CACC,IAAK/B,CACL,CAAA,KAAA,CAAO6B,CACP,CAAA,UAAA,CAAY,CACZ,CAAA,SAAA,CAAWnD,CACT,CAAA,oBAAA,CACA,0BACA,kCACA,CAAA,iCAAA,CACAkB,CACF,CAAA,CAAA,CAEC+B,CAAM,CAAA,GAAA,CAAKK,CACV,EAAAP,YAAA,CAAA,aAAA,CAAcM,kBAAb,CACC,GAAA,CAAKC,CAAK,CAAA,KAAA,CACV,QAAUA,CAAAA,CAAAA,CAAK,QACf,CAAA,QAAA,CAAU,IAAMF,CAAAA,CAAaE,CAAK,CAAA,KAAK,CACvC,CAAA,SAAA,CAAU,cACV,CAAA,OAAA,CAAO,IAEPP,YAACd,CAAAA,aAAAA,CAAAA,CAAAA,CAAA,CACE,GAAGqB,CACJ,CAAA,SAAA,CAAU,WACV,CAAA,QAAA,CAAUF,EACZ,CACF,CACD,CACH,CACF,CACF,CAEJ,CACF,EAEAN,EAAS,WAAc,CAAA,UAAA","file":"Dropdown.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 | \"primary-100\";\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 = color === \"inherit\" ? \"text-inherit\" : `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={`\n font-sans antialiased\n ${typographyClasses}\n ${colorClasses}\n ${weight && `!${fontWeight[weight]}`}\n ${className}\n `}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import React, { KeyboardEvent } from \"react\";\nimport { cn } from \"../utils\";\nimport { Text } from \"./Text\";\n\nexport type OptionProps = {\n label: React.ReactNode;\n value: string;\n /** Optional color override for specific items like \"Logout\" in red */\n color?: \"default\" | \"danger\";\n /** Optional disabled state */\n disabled?: boolean;\n onChange?: (value: string) => void;\n onKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n selected?: boolean;\n className?: string;\n /** ID for accessibility */\n id?: string;\n /** ARIA role */\n role?: string;\n /** ARIA selected state */\n \"aria-selected\"?: boolean;\n /** Current search value for highlighting matches */\n searchValue?: string;\n};\n\nconst HighlightedText = ({\n text,\n highlight\n}: {\n text: string;\n highlight: string;\n}) => {\n if (!highlight) return <>{text}</>;\n\n const parts = text.split(new RegExp(`(${highlight})`, \"i\"));\n return (\n <>\n {parts.map((part, i) =>\n part.toLowerCase() === highlight.toLowerCase() ? (\n <span key={i} className=\"font-bold\">\n {part}\n </span>\n ) : (\n part\n )\n )}\n </>\n );\n};\n\nexport const Option = React.forwardRef<HTMLButtonElement, OptionProps>(\n (\n {\n value,\n label,\n onChange,\n onKeyDown,\n onMouseEnter,\n onMouseLeave,\n selected,\n color,\n disabled,\n className,\n id,\n role,\n \"aria-selected\": ariaSelected,\n searchValue = \"\"\n },\n ref\n ) => (\n <button\n ref={ref}\n type=\"button\"\n id={id}\n role={role}\n aria-selected={ariaSelected}\n disabled={disabled}\n className={cn(\n \"relative w-full text-left px-2 py-1.5 text-sm rounded outline-none\",\n \"cursor-pointer hover:bg-gray-100\",\n \"disabled:opacity-50 disabled:cursor-not-allowed\",\n selected && \"bg-gray-100\",\n \"flex items-center gap-2\",\n className\n )}\n onClick={() => {\n onChange?.(value);\n }}\n onKeyDown={onKeyDown}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n <Text\n variant=\"body-default-medium\"\n color={color === \"danger\" ? \"danger\" : \"inherit\"}\n >\n {typeof label === \"string\" ? (\n <HighlightedText text={label} highlight={searchValue} />\n ) : (\n label\n )}\n </Text>\n </button>\n )\n);\n","import * as React from \"react\";\nimport * as DropdownMenu from \"@radix-ui/react-dropdown-menu\";\nimport { cn } from \"../utils\";\nimport { Option, type OptionProps } from \"./Option\";\n\nexport type DropdownProps = {\n /** The trigger element that opens the dropdown */\n trigger: React.ReactNode;\n /** Array of items to show in the dropdown */\n items: Omit<OptionProps, \"onChange\" | \"selected\">[];\n /** Optional className for the content */\n className?: string;\n /** Callback when an item is selected */\n onSelect?: (value: string) => void;\n /** Optional side alignment */\n align?: \"start\" | \"center\" | \"end\";\n};\n\nexport const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(\n ({ trigger, items, className, onSelect, align = \"end\" }, ref) => {\n const handleSelect = React.useCallback(\n (value: string) => {\n onSelect?.(value);\n },\n [onSelect]\n );\n\n return (\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>{trigger}</DropdownMenu.Trigger>\n\n <DropdownMenu.Portal>\n <DropdownMenu.Content\n ref={ref}\n align={align}\n sideOffset={8}\n className={cn(\n \"z-50 min-w-[220px]\",\n \"bg-white rounded-lg p-1\",\n \"shadow-lg border border-gray-100\",\n \"animate-in fade-in-0 zoom-in-95\",\n className\n )}\n >\n {items.map((item) => (\n <DropdownMenu.Item\n key={item.value}\n disabled={item.disabled}\n onSelect={() => handleSelect(item.value)}\n className=\"outline-none\"\n asChild\n >\n <Option\n {...item}\n className=\"py-3 px-6\"\n onChange={handleSelect}\n />\n </DropdownMenu.Item>\n ))}\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n );\n }\n);\n\nDropdown.displayName = \"Dropdown\";\n"]}
@@ -1,2 +1,8 @@
1
- import*as o from'react';import o__default from'react';import*as n from'@radix-ui/react-dropdown-menu';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function c(...e){return twMerge(clsx(e))}var L={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},E=e=>{let[r,t]=e.split("-");return r==="heading"?L[t]||"p":r==="label"?"label":"p"},x={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},R=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[a,i]=t.split(":");return `${a}:text-${i}`}return `text-${t}`}).join(" "):"text-body-default",g=o__default.forwardRef(({variant:e="body-default",color:r="primary",as:t,className:a,children:i,weight:p,...l},s)=>{let u=R(e),h=r==="inherit"?"text-inherit":`text-text-${r}`,b=o__default.useMemo(()=>{let f=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return E(f)},[e]);return o__default.createElement(t||b,{ref:s,className:`font-sans antialiased ${u} ${h} ${p?`!${x[p]}`:""} ${a??""}`,...l},i)});g.displayName="Text";var m="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var y=({value:e,label:r,onChange:t,selected:a,color:i,disabled:p,className:l})=>o__default.createElement("button",{type:"button",disabled:p,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",a&&"bg-gray-100","flex items-center gap-2",m,l),onClick:()=>{t?.(e);}},o__default.createElement(g,{variant:"body-default-medium",color:i==="danger"?"danger":"inherit"},r));var $=o.forwardRef(({trigger:e,items:r,className:t,onSelect:a,align:i="end"},p)=>{let l=o.useCallback(s=>{a?.(s);},[a]);return o.createElement(n.Root,null,o.createElement(n.Trigger,{asChild:!0},e),o.createElement(n.Portal,null,o.createElement(n.Content,{ref:p,align:i,sideOffset:8,className:c("z-50 min-w-[220px]","bg-white rounded-lg p-1","shadow-lg border border-gray-100","animate-in fade-in-0 zoom-in-95",t)},r.map(s=>o.createElement(n.Item,{key:s.value,disabled:s.disabled,onSelect:()=>l(s.value),className:"outline-none",asChild:!0},o.createElement(y,{...s,className:"py-3 px-6",onChange:l}))))))});$.displayName="Dropdown";export{$ as Dropdown};//# sourceMappingURL=Dropdown.js.map
1
+ import*as i from'react';import i__default from'react';import*as s from'@radix-ui/react-dropdown-menu';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function m(...e){return twMerge(clsx(e))}var x={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},R=e=>{let[t,o]=e.split("-");return t==="heading"?x[o]||"p":t==="label"?"label":"p"},w={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},A=e=>e?(Array.isArray(e)?e:[e]).map(o=>{if(o.includes(":")){let[n,l]=o.split(":");return `${n}:text-${l}`}return `text-${o}`}).join(" "):"text-body-default",M=i__default.forwardRef(({variant:e="body-default",color:t="primary",as:o,className:n,children:l,weight:p,...d},a)=>{let g=A(e),T=t==="inherit"?"text-inherit":`text-${t}`,y=i__default.useMemo(()=>{let u=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return R(u)},[e]);return i__default.createElement(o||y,{ref:a,className:`
2
+ font-sans antialiased
3
+ ${g}
4
+ ${T}
5
+ ${p&&`!${w[p]}`}
6
+ ${n}
7
+ `,...d},l)});M.displayName="Text";var C=({text:e,highlight:t})=>{if(!t)return i__default.createElement(i__default.Fragment,null,e);let o=e.split(new RegExp(`(${t})`,"i"));return i__default.createElement(i__default.Fragment,null,o.map((n,l)=>n.toLowerCase()===t.toLowerCase()?i__default.createElement("span",{key:l,className:"font-bold"},n):n))},H=i__default.forwardRef(({value:e,label:t,onChange:o,onKeyDown:n,onMouseEnter:l,onMouseLeave:p,selected:d,color:a,disabled:g,className:T,id:y,role:h,"aria-selected":u,searchValue:b=""},L)=>i__default.createElement("button",{ref:L,type:"button",id:y,role:h,"aria-selected":u,disabled:g,className:m("relative w-full text-left px-2 py-1.5 text-sm rounded outline-none","cursor-pointer hover:bg-gray-100","disabled:opacity-50 disabled:cursor-not-allowed",d&&"bg-gray-100","flex items-center gap-2",T),onClick:()=>{o?.(e);},onKeyDown:n,onMouseEnter:l,onMouseLeave:p},i__default.createElement(M,{variant:"body-default-medium",color:a==="danger"?"danger":"inherit"},typeof t=="string"?i__default.createElement(C,{text:t,highlight:b}):t)));var D=i.forwardRef(({trigger:e,items:t,className:o,onSelect:n,align:l="end"},p)=>{let d=i.useCallback(a=>{n?.(a);},[n]);return i.createElement(s.Root,null,i.createElement(s.Trigger,{asChild:!0},e),i.createElement(s.Portal,null,i.createElement(s.Content,{ref:p,align:l,sideOffset:8,className:m("z-50 min-w-[220px]","bg-white rounded-lg p-1","shadow-lg border border-gray-100","animate-in fade-in-0 zoom-in-95",o)},t.map(a=>i.createElement(s.Item,{key:a.value,disabled:a.disabled,onSelect:()=>d(a.value),className:"outline-none",asChild:!0},i.createElement(H,{...a,className:"py-3 px-6",onChange:d}))))))});D.displayName="Dropdown";export{D as Dropdown};//# sourceMappingURL=Dropdown.js.map
2
8
  //# sourceMappingURL=Dropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts","../../src/components/Text.tsx","../../src/utils/tailwind.ts","../../src/components/Option.tsx","../../src/components/Dropdown.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","Option","value","label","onChange","selected","disabled","Dropdown","trigger","items","onSelect","align","handleSelect","item"],"mappings":"mKAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CCiEA,IAAMG,CAAAA,CAAmD,CACvD,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EAAA,CAAI,KACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACN,CAAA,CAEMC,CAAyBC,CAAAA,CAAAA,EAAwC,CACrE,GAAM,CAACC,CAAUC,CAAAA,CAAI,EAAIF,CAAQ,CAAA,KAAA,CAAM,GAAG,CAE1C,CAAA,OAAIC,IAAa,SACRH,CAAAA,CAAAA,CAAoBI,CAAI,CAAK,EAAA,GAAA,CAGlCD,IAAa,OACR,CAAA,OAAA,CAGF,GACT,CAIME,CAAAA,CAAAA,CAAqC,CACzC,KAAA,CAAO,YACP,CAAA,OAAA,CAAS,eACT,QAAU,CAAA,eAAA,CACV,KAAM,WACR,CAAA,CA0BMC,EACJC,CAEKA,EAAAA,CAAAA,CAAAA,CAEgB,MAAM,OAAQA,CAAAA,CAAQ,EAAIA,CAAW,CAAA,CAACA,CAAQ,CAGhE,EAAA,GAAA,CAAKL,GAAY,CAChB,GAAIA,CAAQ,CAAA,QAAA,CAAS,GAAG,CAAA,CAAG,CACzB,GAAM,CAACM,EAAYC,CAAe,CAAA,CAAIP,EAAQ,KAAM,CAAA,GAAG,EACvD,OAAO,CAAA,EAAGM,CAAU,CAASC,MAAAA,EAAAA,CAAe,EAC9C,CACA,OAAO,QAAQP,CAAO,CAAA,CACxB,CAAC,CAAA,CACA,IAAK,CAAA,GAAG,EAZW,mBAeXQ,CAAAA,CAAAA,CAAOC,WAAM,UACxB,CAAA,CACE,CACE,OAAAT,C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K,CAAA,KAAA,CACV,SAAUA,CAAK,CAAA,QAAA,CACf,QAAU,CAAA,IAAMD,CAAaC,CAAAA,CAAAA,CAAK,KAAK,CACvC,CAAA,SAAA,CAAU,eACV,OAAO,CAAA,CAAA,CAAA,CAAA,CAEP,gBAACZ,CAAA,CAAA,CACE,GAAGY,CAAAA,CACJ,SAAU,CAAA,WAAA,CACV,SAAUD,CACZ,CAAA,CACF,CACD,CACH,CACF,CACF,CAEJ,CACF,EAEAL,CAAAA,CAAS,WAAc,CAAA,UAAA","file":"Dropdown.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 React from \"react\";\nimport { cn } from \"../utils\";\nimport { Text } from \"./Text\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nexport type OptionProps = {\n label: React.ReactNode;\n value: string;\n /** Optional color override for specific items like \"Logout\" in red */\n color?: \"default\" | \"danger\";\n /** Optional disabled state */\n disabled?: boolean;\n onChange?: (value: string) => void;\n selected?: boolean;\n className?: string;\n};\n\nexport const Option = ({\n value,\n label,\n onChange,\n selected,\n color,\n disabled,\n className\n}: OptionProps) => (\n <button\n type=\"button\"\n disabled={disabled}\n className={cn(\n \"relative w-full text-left px-2 py-1.5 text-sm rounded\",\n \"cursor-pointer hover:bg-gray-100\",\n \"disabled:opacity-50 disabled:cursor-not-allowed\",\n selected && \"bg-gray-100\",\n \"flex items-center gap-2\",\n focusRingStyles,\n className\n )}\n onClick={() => {\n onChange?.(value);\n }}\n >\n <Text\n variant=\"body-default-medium\"\n color={color === \"danger\" ? \"danger\" : \"inherit\"}\n >\n {label}\n </Text>\n </button>\n);\n","import * as React from \"react\";\nimport * as DropdownMenu from \"@radix-ui/react-dropdown-menu\";\nimport { cn } from \"../utils\";\nimport { Option, type OptionProps } from \"./Option\";\n\nexport type DropdownProps = {\n /** The trigger element that opens the dropdown */\n trigger: React.ReactNode;\n /** Array of items to show in the dropdown */\n items: Omit<OptionProps, \"onChange\" | \"selected\">[];\n /** Optional className for the content */\n className?: string;\n /** Callback when an item is selected */\n onSelect?: (value: string) => void;\n /** Optional side alignment */\n align?: \"start\" | \"center\" | \"end\";\n};\n\nexport const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(\n ({ trigger, items, className, onSelect, align = \"end\" }, ref) => {\n const handleSelect = React.useCallback(\n (value: string) => {\n onSelect?.(value);\n },\n [onSelect]\n );\n\n return (\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>{trigger}</DropdownMenu.Trigger>\n\n <DropdownMenu.Portal>\n <DropdownMenu.Content\n ref={ref}\n align={align}\n sideOffset={8}\n className={cn(\n \"z-50 min-w-[220px]\",\n \"bg-white rounded-lg p-1\",\n \"shadow-lg border border-gray-100\",\n \"animate-in fade-in-0 zoom-in-95\",\n className\n )}\n >\n {items.map((item) => (\n <DropdownMenu.Item\n key={item.value}\n disabled={item.disabled}\n onSelect={() => handleSelect(item.value)}\n className=\"outline-none\"\n asChild\n >\n <Option\n {...item}\n className=\"py-3 px-6\"\n onChange={handleSelect}\n />\n </DropdownMenu.Item>\n ))}\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n );\n }\n);\n\nDropdown.displayName = \"Dropdown\";\n"]}
1
+ {"version":3,"sources":["../../src/utils/index.ts","../../src/components/Text.tsx","../../src/components/Option.tsx","../../src/components/Dropdown.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","HighlightedText","text","highlight","parts","part","i","Option","value","label","onChange","onKeyDown","onMouseEnter","onMouseLeave","selected","disabled","id","role","ariaSelected","searchValue","Dropdown","r","trigger","items","onSelect","align","handleSelect","item"],"mappings":"mKAGO,SAASA,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCkEA,IAAMG,CAAmD,CAAA,CACvD,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EAAA,CAAI,KACJ,EAAI,CAAA,IACN,EAEMC,CAAyBC,CAAAA,CAAAA,EAAwC,CACrE,GAAM,CAACC,CAAAA,CAAUC,CAAI,CAAIF,CAAAA,CAAAA,CAAQ,MAAM,GAAG,CAAA,CAE1C,OAAIC,CAAa,GAAA,SAAA,CACRH,CAAoBI,CAAAA,CAAI,CAAK,EAAA,GAAA,CAGlCD,IAAa,OACR,CAAA,OAAA,CAGF,GACT,CAIME,CAAAA,CAAAA,CAAqC,CACzC,KAAO,CAAA,YAAA,CACP,OAAS,CAAA,cAAA,CACT,QAAU,CAAA,eAAA,CACV,KAAM,WACR,CAAA,CA0BMC,EACJC,CAEKA,EAAAA,CAAAA,CAAAA,CAEgB,MAAM,OAAQA,CAAAA,CAAQ,CAAIA,CAAAA,CAAAA,CAAW,CAACA,CAAQ,GAGhE,GAAKL,CAAAA,CAAAA,EAAY,CAChB,GAAIA,CAAQ,CAAA,QAAA,CAAS,GAAG,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AA,CAAA,IAAA,CAAb,IACC,CAAAA,CAAA,CAAA,aAAA,CAAc,CAAb,CAAA,OAAA,CAAA,CAAqB,OAAO,CAAA,CAAA,CAAA,CAAA,CAAEC,CAAQ,CAAA,CAEvCD,CAAc,CAAA,aAAA,CAAA,CAAA,CAAA,MAAA,CAAb,IACC,CAAAA,CAAA,CAAA,aAAA,CAAc,CAAb,CAAA,OAAA,CAAA,CACC,IAAKzB,CACL,CAAA,KAAA,CAAO6B,CACP,CAAA,UAAA,CAAY,CACZ,CAAA,SAAA,CAAWnD,CACT,CAAA,oBAAA,CACA,0BACA,kCACA,CAAA,iCAAA,CACAkB,CACF,CAAA,CAAA,CAEC+B,CAAM,CAAA,GAAA,CAAKI,CACV,EAAAN,CAAA,CAAA,aAAA,CAAc,OAAb,CACC,GAAA,CAAKM,CAAK,CAAA,KAAA,CACV,QAAUA,CAAAA,CAAAA,CAAK,QACf,CAAA,QAAA,CAAU,IAAMD,CAAAA,CAAaC,CAAK,CAAA,KAAK,CACvC,CAAA,SAAA,CAAU,cACV,CAAA,OAAA,CAAO,IAEPN,CAACd,CAAAA,aAAAA,CAAAA,CAAAA,CAAA,CACE,GAAGoB,CACJ,CAAA,SAAA,CAAU,WACV,CAAA,QAAA,CAAUD,EACZ,CACF,CACD,CACH,CACF,CACF,CAEJ,CACF,EAEAN,EAAS,WAAc,CAAA,UAAA","file":"Dropdown.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 | \"primary-100\";\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 = color === \"inherit\" ? \"text-inherit\" : `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={`\n font-sans antialiased\n ${typographyClasses}\n ${colorClasses}\n ${weight && `!${fontWeight[weight]}`}\n ${className}\n `}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import React, { KeyboardEvent } from \"react\";\nimport { cn } from \"../utils\";\nimport { Text } from \"./Text\";\n\nexport type OptionProps = {\n label: React.ReactNode;\n value: string;\n /** Optional color override for specific items like \"Logout\" in red */\n color?: \"default\" | \"danger\";\n /** Optional disabled state */\n disabled?: boolean;\n onChange?: (value: string) => void;\n onKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n selected?: boolean;\n className?: string;\n /** ID for accessibility */\n id?: string;\n /** ARIA role */\n role?: string;\n /** ARIA selected state */\n \"aria-selected\"?: boolean;\n /** Current search value for highlighting matches */\n searchValue?: string;\n};\n\nconst HighlightedText = ({\n text,\n highlight\n}: {\n text: string;\n highlight: string;\n}) => {\n if (!highlight) return <>{text}</>;\n\n const parts = text.split(new RegExp(`(${highlight})`, \"i\"));\n return (\n <>\n {parts.map((part, i) =>\n part.toLowerCase() === highlight.toLowerCase() ? (\n <span key={i} className=\"font-bold\">\n {part}\n </span>\n ) : (\n part\n )\n )}\n </>\n );\n};\n\nexport const Option = React.forwardRef<HTMLButtonElement, OptionProps>(\n (\n {\n value,\n label,\n onChange,\n onKeyDown,\n onMouseEnter,\n onMouseLeave,\n selected,\n color,\n disabled,\n className,\n id,\n role,\n \"aria-selected\": ariaSelected,\n searchValue = \"\"\n },\n ref\n ) => (\n <button\n ref={ref}\n type=\"button\"\n id={id}\n role={role}\n aria-selected={ariaSelected}\n disabled={disabled}\n className={cn(\n \"relative w-full text-left px-2 py-1.5 text-sm rounded outline-none\",\n \"cursor-pointer hover:bg-gray-100\",\n \"disabled:opacity-50 disabled:cursor-not-allowed\",\n selected && \"bg-gray-100\",\n \"flex items-center gap-2\",\n className\n )}\n onClick={() => {\n onChange?.(value);\n }}\n onKeyDown={onKeyDown}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n >\n <Text\n variant=\"body-default-medium\"\n color={color === \"danger\" ? \"danger\" : \"inherit\"}\n >\n {typeof label === \"string\" ? (\n <HighlightedText text={label} highlight={searchValue} />\n ) : (\n label\n )}\n </Text>\n </button>\n )\n);\n","import * as React from \"react\";\nimport * as DropdownMenu from \"@radix-ui/react-dropdown-menu\";\nimport { cn } from \"../utils\";\nimport { Option, type OptionProps } from \"./Option\";\n\nexport type DropdownProps = {\n /** The trigger element that opens the dropdown */\n trigger: React.ReactNode;\n /** Array of items to show in the dropdown */\n items: Omit<OptionProps, \"onChange\" | \"selected\">[];\n /** Optional className for the content */\n className?: string;\n /** Callback when an item is selected */\n onSelect?: (value: string) => void;\n /** Optional side alignment */\n align?: \"start\" | \"center\" | \"end\";\n};\n\nexport const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(\n ({ trigger, items, className, onSelect, align = \"end\" }, ref) => {\n const handleSelect = React.useCallback(\n (value: string) => {\n onSelect?.(value);\n },\n [onSelect]\n );\n\n return (\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>{trigger}</DropdownMenu.Trigger>\n\n <DropdownMenu.Portal>\n <DropdownMenu.Content\n ref={ref}\n align={align}\n sideOffset={8}\n className={cn(\n \"z-50 min-w-[220px]\",\n \"bg-white rounded-lg p-1\",\n \"shadow-lg border border-gray-100\",\n \"animate-in fade-in-0 zoom-in-95\",\n className\n )}\n >\n {items.map((item) => (\n <DropdownMenu.Item\n key={item.value}\n disabled={item.disabled}\n onSelect={() => handleSelect(item.value)}\n className=\"outline-none\"\n asChild\n >\n <Option\n {...item}\n className=\"py-3 px-6\"\n onChange={handleSelect}\n />\n </DropdownMenu.Item>\n ))}\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n );\n }\n);\n\nDropdown.displayName = \"Dropdown\";\n"]}
@@ -1,4 +1,10 @@
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(`
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[r,t]=e.split("-");return r==="heading"?$[t]||"p":r==="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,o]=t.split(":");return `${n}:text-${o}`}return `text-${t}`}).join(" "):"text-body-default",u=y__namespace.default.forwardRef(({variant:e="body-default",color:r="primary",as:t,className:n,children:o,weight:s,...a},p)=>{let l=P(e),d=r==="inherit"?"text-inherit":`text-${r}`,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:`
2
+ font-sans antialiased
3
+ ${l}
4
+ ${d}
5
+ ${s&&`!${C[s]}`}
6
+ ${n}
7
+ `,...a},o)});u.displayName="Text";var m="focus-visible:outline-none focus-visible:border-2 focus-visible:border-primary-100";var k={black:"bg-primary text-white",accent:"bg-primary-100 text-white",secondary:"bg-secondary-100 text-secondary"},b={black:"border border-text text-primary",accent:"border border-primary-100 text-primary-100",secondary:"border border-text-secondary text-secondary"},B=y__namespace.forwardRef(({className:e,variant:r="filled",color:t="black",isLoading:n=!1,children:o,disabled:s,end:a,...p},l)=>y__namespace.createElement("button",{ref:l,className:i(`
2
8
  sm:px-7 px-4
3
9
  py-2
4
10
  inline-flex items-center justify-center
@@ -6,5 +12,5 @@
6
12
  transition-colors duration-200
7
13
  disabled:opacity-50 disabled:pointer-events-none
8
14
  hover:opacity-80 active:scale-95
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
15
+ truncate`,m,r==="filled"?k[t]:r==="transparent"?"bg-transparent text-text":b[t],e),disabled:s||n,type:"button",...p},typeof o=="string"?y__namespace.createElement(u,{variant:["sm:body-default-bold","body-xxs-semibold"],color:"inherit"},o):o,a));B.displayName="Button";var h={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888",danger:"#FF0000"},v={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},N=e=>{if(!e)return {width:"24px",height:"24px"};let r=Array.isArray(e)?e:[e],t={},n;return r.forEach(o=>{if(typeof o=="number")n=`${o}px`;else {let[s,a]=o.split(":"),p=parseInt(a,10);t[`@media (min-width: ${v[s]})`]=`${p}px`;}}),{width:n||"24px",height:n||"24px",...Object.entries(t).reduce((o,[s,a])=>({...o,[s]:{width:a,height:a}}),{})}},T=y__namespace.default.forwardRef(({name:e,size:r=24,color:t="primary",title:n,className:o,style:s={},...a},p)=>{let l=icons.IconMap[e],d=N(r);return y__namespace.default.createElement("div",{className:i("flex justify-center items-center",o),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}))});T.displayName="Icon";var f=y__namespace.default.forwardRef(({children:e,type:r="button",className:t,disabled:n,...o},s)=>y__namespace.default.createElement("button",{ref:s,type:r,disabled:n,className:i("appearance-none hover:opacity-80 transition-all active:scale-95",m,n&&"opacity-50 cursor-not-allowed",t),...o},e));f.displayName="Pressable";var V=({className:e,onClick:r})=>y__namespace.default.createElement(f,{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",b.black,e),onClick:r},y__namespace.default.createElement(T,{color:"primary",name:"edit-2"}));V.displayName="EditButton";exports.EditButton=V;//# sourceMappingURL=EditButton.cjs.map
10
16
  //# 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","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,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,CA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AKO,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
+ {"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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C,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 | \"primary-100\";\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 = color === \"inherit\" ? \"text-inherit\" : `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={`\n font-sans antialiased\n ${typographyClasses}\n ${colorClasses}\n ${weight && `!${fontWeight[weight]}`}\n ${className}\n `}\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:border-2 focus-visible:border-primary-100\";\n\nexport const focusRingStylesCoerced = \"border-2 border-primary-100\";\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\" | \"transparent\";\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-primary 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-primary\",\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\"\n ? filled[color]\n : variant === \"transparent\"\n ? \"bg-transparent text-text\"\n : 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 danger: \"#FF0000\"\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,10 @@
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(`
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[r,t]=e.split("-");return r==="heading"?$[t]||"p":r==="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,o]=t.split(":");return `${n}:text-${o}`}return `text-${t}`}).join(" "):"text-body-default",u=y__default.forwardRef(({variant:e="body-default",color:r="primary",as:t,className:n,children:o,weight:s,...a},p)=>{let l=P(e),d=r==="inherit"?"text-inherit":`text-${r}`,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:`
2
+ font-sans antialiased
3
+ ${l}
4
+ ${d}
5
+ ${s&&`!${C[s]}`}
6
+ ${n}
7
+ `,...a},o)});u.displayName="Text";var m="focus-visible:outline-none focus-visible:border-2 focus-visible:border-primary-100";var k={black:"bg-primary text-white",accent:"bg-primary-100 text-white",secondary:"bg-secondary-100 text-secondary"},b={black:"border border-text text-primary",accent:"border border-primary-100 text-primary-100",secondary:"border border-text-secondary text-secondary"},B=y.forwardRef(({className:e,variant:r="filled",color:t="black",isLoading:n=!1,children:o,disabled:s,end:a,...p},l)=>y.createElement("button",{ref:l,className:i(`
2
8
  sm:px-7 px-4
3
9
  py-2
4
10
  inline-flex items-center justify-center
@@ -6,5 +12,5 @@ import*as y from'react';import y__default from'react';import {clsx}from'clsx';im
6
12
  transition-colors duration-200
7
13
  disabled:opacity-50 disabled:pointer-events-none
8
14
  hover:opacity-80 active:scale-95
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
15
+ truncate`,m,r==="filled"?k[t]:r==="transparent"?"bg-transparent text-text":b[t],e),disabled:s||n,type:"button",...p},typeof o=="string"?y.createElement(u,{variant:["sm:body-default-bold","body-xxs-semibold"],color:"inherit"},o):o,a));B.displayName="Button";var h={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888",danger:"#FF0000"},v={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},N=e=>{if(!e)return {width:"24px",height:"24px"};let r=Array.isArray(e)?e:[e],t={},n;return r.forEach(o=>{if(typeof o=="number")n=`${o}px`;else {let[s,a]=o.split(":"),p=parseInt(a,10);t[`@media (min-width: ${v[s]})`]=`${p}px`;}}),{width:n||"24px",height:n||"24px",...Object.entries(t).reduce((o,[s,a])=>({...o,[s]:{width:a,height:a}}),{})}},T=y__default.forwardRef(({name:e,size:r=24,color:t="primary",title:n,className:o,style:s={},...a},p)=>{let l=IconMap[e],d=N(r);return y__default.createElement("div",{className:i("flex justify-center items-center",o),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}))});T.displayName="Icon";var f=y__default.forwardRef(({children:e,type:r="button",className:t,disabled:n,...o},s)=>y__default.createElement("button",{ref:s,type:r,disabled:n,className:i("appearance-none hover:opacity-80 transition-all active:scale-95",m,n&&"opacity-50 cursor-not-allowed",t),...o},e));f.displayName="Pressable";var V=({className:e,onClick:r})=>y__default.createElement(f,{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",b.black,e),onClick:r},y__default.createElement(T,{color:"primary",name:"edit-2"}));V.displayName="EditButton";export{V as EditButton};//# sourceMappingURL=EditButton.js.map
10
16
  //# 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","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,CAAA,CACzB,GAAM,CAACM,CAAYC,CAAAA,CAAe,CAAIP,CAAAA,CAAAA,CAAQ,MAAM,GAAG,CAAA,CACvD,OAAO,CAAA,EAAGM,CAAU,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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
+ {"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,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCkEA,IAAMG,CAAmD,CAAA,CACvD,GAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACJ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CAEAlC,CAAAA,CAAAA,UAAAA,CAAA,aAACmC,CAAAA,CAAAA,CAAA,CACC,GAAK5B,CAAAA,CAAAA,CACL,cAAa,CAAC0B,CAAAA,CACd,aAAYA,CACZ,CAAA,MAAA,CAAQD,CAAK,CAAA,QAAA,CAAS,QAAQ,CAAI,CAAA,KAAA,CAAA,CAAYZ,EAAUnB,CAAK,CAAA,CAC5D,GAAGK,CACN,CAAA,CACF,CAEJ,CACF,EAEAyB,CAAK,CAAA,WAAA,CAAc,OCzGZ,IAAMO,CAAAA,CAAYtC,UAAM,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,UAAA,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,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 | \"primary-100\";\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 = color === \"inherit\" ? \"text-inherit\" : `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={`\n font-sans antialiased\n ${typographyClasses}\n ${colorClasses}\n ${weight && `!${fontWeight[weight]}`}\n ${className}\n `}\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:border-2 focus-visible:border-primary-100\";\n\nexport const focusRingStylesCoerced = \"border-2 border-primary-100\";\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\" | \"transparent\";\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-primary 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-primary\",\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\"\n ? filled[color]\n : variant === \"transparent\"\n ? \"bg-transparent text-text\"\n : 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 danger: \"#FF0000\"\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 a=require('react'),icons=require('@deckai/icons'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var a__default=/*#__PURE__*/_interopDefault(a);function c(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var l={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},S={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},y=e=>{if(!e)return {width:"24px",height:"24px"};let s=Array.isArray(e)?e:[e],n={},o;return s.forEach(r=>{if(typeof r=="number")o=`${r}px`;else {let[i,t]=r.split(":"),p=parseInt(t,10);n[`@media (min-width: ${S[i]})`]=`${p}px`;}}),{width:o||"24px",height:o||"24px",...Object.entries(n).reduce((r,[i,t])=>({...r,[i]:{width:t,height:t}}),{})}},g=a__default.default.forwardRef(({name:e,size:s=24,color:n="primary",title:o,className:r,style:i={},...t},p)=>{let m=icons.IconMap[e],d=y(s);return a__default.default.createElement("div",{className:c("flex justify-center items-center",r),style:{...d,"--icon-stroke":l[n],...i}},a__default.default.createElement(m,{ref:p,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:l[n],...t}))});g.displayName="Icon";exports.Icon=g;//# sourceMappingURL=Icon.cjs.map
1
+ 'use strict';var a=require('react'),icons=require('@deckai/icons'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var a__default=/*#__PURE__*/_interopDefault(a);function c(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var l={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888",danger:"#FF0000"},S={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},y=e=>{if(!e)return {width:"24px",height:"24px"};let s=Array.isArray(e)?e:[e],n={},o;return s.forEach(r=>{if(typeof r=="number")o=`${r}px`;else {let[i,t]=r.split(":"),p=parseInt(t,10);n[`@media (min-width: ${S[i]})`]=`${p}px`;}}),{width:o||"24px",height:o||"24px",...Object.entries(n).reduce((r,[i,t])=>({...r,[i]:{width:t,height:t}}),{})}},g=a__default.default.forwardRef(({name:e,size:s=24,color:n="primary",title:o,className:r,style:i={},...t},p)=>{let m=icons.IconMap[e],d=y(s);return a__default.default.createElement("div",{className:c("flex justify-center items-center",r),style:{...d,"--icon-stroke":l[n],...i}},a__default.default.createElement(m,{ref:p,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:l[n],...t}))});g.displayName="Icon";exports.Icon=g;//# sourceMappingURL=Icon.cjs.map
2
2
  //# sourceMappingURL=Icon.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx"],"names":["cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","size","breakpoint","valueStr","value","acc","query","Icon","React","name","color","title","className","style","props","ref","IconComponent","IconMap","sizeStyles"],"mappings":"gPAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,qBAAAA,CAAQC,SAAKF,CAAAA,CAAM,CAAC,CAC7B,CCcA,IAAMG,CAAwC,CAAA,CAC5C,QAAS,SACT,CAAA,SAAA,CAAW,SACX,CAAA,KAAA,CAAO,SACP,CAAA,WAAA,CAAa,SACb,CAAA,QAAA,CAAU,SACZ,CAAA,CAEMC,CAA6C,CAAA,CACjD,EAAI,CAAA,OAAA,CACJ,GAAI,OACJ,CAAA,EAAA,CAAI,QACJ,CAAA,EAAA,CAAI,QACJ,CAAA,KAAA,CAAO,QACT,CAAA,CA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CAAAA,CACA,SAAAC,CAAAA,CAAAA,CACA,KAAAC,CAAAA,CAAAA,CAAQ,EAAC,CACT,GAAGC,CACL,EACAC,CACG,GAAA,CACH,IAAMC,CAAAA,CAAgBC,aAAQR,CAAAA,CAAI,CAC5BS,CAAAA,CAAAA,CAAatB,CAAaK,CAAAA,CAAI,CAEpC,CAAA,OACEO,kBAAA,CAAA,aAAA,CAAC,OACC,SAAWlB,CAAAA,CAAAA,CAAG,kCAAoCsB,CAAAA,CAAS,CAC3D,CAAA,KAAA,CAAO,CACL,GAAGM,CACF,CAAA,eAAA,CAA4BxB,CAAUgB,CAAAA,CAAK,CAC5C,CAAA,GAAGG,CACL,CAEAL,CAAAA,CAAAA,kBAAAA,CAAA,aAACQ,CAAAA,CAAAA,CAAA,CACC,GAAA,CAAKD,CACL,CAAA,aAAA,CAAa,CAACJ,CAAAA,CACd,YAAYA,CAAAA,CAAAA,CACZ,MAAQF,CAAAA,CAAAA,CAAK,QAAS,CAAA,QAAQ,CAAI,CAAA,KAAA,CAAA,CAAYf,CAAUgB,CAAAA,CAAK,CAC5D,CAAA,GAAGI,CACN,CAAA,CACF,CAEJ,CACF,EAEAP,CAAAA,CAAK,WAAc,CAAA,MAAA","file":"Icon.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, { 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"]}
1
+ {"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx"],"names":["cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","size","breakpoint","valueStr","value","acc","query","Icon","React","name","color","title","className","style","props","ref","IconComponent","IconMap","sizeStyles"],"mappings":"gPAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,qBAAAA,CAAQC,SAAKF,CAAAA,CAAM,CAAC,CAC7B,CCcA,IAAMG,CAAwC,CAAA,CAC5C,QAAS,SACT,CAAA,SAAA,CAAW,SACX,CAAA,KAAA,CAAO,SACP,CAAA,WAAA,CAAa,SACb,CAAA,QAAA,CAAU,SACV,CAAA,MAAA,CAAQ,SACV,CAAA,CAEMC,CAA6C,CAAA,CACjD,EAAI,CAAA,OAAA,CACJ,EAAI,CAAA,OAAA,CACJ,EAAI,CAAA,QAAA,CACJ,EAAI,CAAA,QAAA,CACJ,KAAO,CAAA,QACT,CAEMC,CAAAA,CAAAA,CACJC,CACwB,EAAA,CACxB,GAAI,CAACA,EAAO,OAAO,CAAE,KAAO,CAAA,MAAA,CAAQ,MAAQ,CAAA,MAAO,CAEnD,CAAA,IAAMC,CAAY,CAAA,KAAA,CAAM,OAAQD,CAAAA,CAAK,CAAIA,CAAAA,CAAAA,CAAQ,CAACA,CAAK,CAAA,CACjDE,CAAuC,CAAA,EACzCC,CAAAA,CAAAA,CAGJ,OAAAF,CAAAA,CAAU,OAASG,CAAAA,CAAAA,EAAS,CAC1B,GAAI,OAAOA,CAAAA,EAAS,SAClBD,CAAW,CAAA,CAAA,EAAGC,CAAI,CAAA,EAAA,CAAA,CAAA,KACb,CACL,GAAM,CAACC,CAAAA,CAAYC,CAAQ,CAAA,CAAIF,CAAK,CAAA,KAAA,CAAM,GAAG,CAAA,CACvCG,CAAQ,CAAA,QAAA,CAASD,CAAU,CAAA,EAAE,CACnCJ,CAAAA,CAAAA,CAAa,CAAsBJ,mBAAAA,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AA,CAAK,QAAS,CAAA,QAAQ,CAAI,CAAA,KAAA,CAAA,CAAYf,CAAUgB,CAAAA,CAAK,CAC5D,CAAA,GAAGI,CACN,CAAA,CACF,CAEJ,CACF,EAEAP,CAAAA,CAAK,WAAc,CAAA,MAAA","file":"Icon.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, { 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 danger: \"#FF0000\"\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"]}
@@ -1,6 +1,6 @@
1
1
  import React__default, { SVGProps } from 'react';
2
2
  import { IconName } from '@deckai/icons';
3
- import { I as IconColors } from '../tailwind-CuJn6tv4.cjs';
3
+ import { I as IconColors } from '../tailwind-Cl3vNM6S.cjs';
4
4
 
5
5
  type Breakpoint = "sm" | "md" | "lg" | "xl" | "2xl";
6
6
  type ResponsiveSize = number | `${Breakpoint}:${number}`;
@@ -1,6 +1,6 @@
1
1
  import React__default, { SVGProps } from 'react';
2
2
  import { IconName } from '@deckai/icons';
3
- import { I as IconColors } from '../tailwind-CuJn6tv4.js';
3
+ import { I as IconColors } from '../tailwind-Cl3vNM6S.js';
4
4
 
5
5
  type Breakpoint = "sm" | "md" | "lg" | "xl" | "2xl";
6
6
  type ResponsiveSize = number | `${Breakpoint}:${number}`;
@@ -1,2 +1,2 @@
1
- import a from'react';import {IconMap}from'@deckai/icons';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function c(...e){return twMerge(clsx(e))}var l={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},S={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},y=e=>{if(!e)return {width:"24px",height:"24px"};let s=Array.isArray(e)?e:[e],n={},o;return s.forEach(r=>{if(typeof r=="number")o=`${r}px`;else {let[i,t]=r.split(":"),p=parseInt(t,10);n[`@media (min-width: ${S[i]})`]=`${p}px`;}}),{width:o||"24px",height:o||"24px",...Object.entries(n).reduce((r,[i,t])=>({...r,[i]:{width:t,height:t}}),{})}},g=a.forwardRef(({name:e,size:s=24,color:n="primary",title:o,className:r,style:i={},...t},p)=>{let m=IconMap[e],d=y(s);return a.createElement("div",{className:c("flex justify-center items-center",r),style:{...d,"--icon-stroke":l[n],...i}},a.createElement(m,{ref:p,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:l[n],...t}))});g.displayName="Icon";export{g as Icon};//# sourceMappingURL=Icon.js.map
1
+ import a from'react';import {IconMap}from'@deckai/icons';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function c(...e){return twMerge(clsx(e))}var l={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888",danger:"#FF0000"},S={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},y=e=>{if(!e)return {width:"24px",height:"24px"};let s=Array.isArray(e)?e:[e],n={},o;return s.forEach(r=>{if(typeof r=="number")o=`${r}px`;else {let[i,t]=r.split(":"),p=parseInt(t,10);n[`@media (min-width: ${S[i]})`]=`${p}px`;}}),{width:o||"24px",height:o||"24px",...Object.entries(n).reduce((r,[i,t])=>({...r,[i]:{width:t,height:t}}),{})}},g=a.forwardRef(({name:e,size:s=24,color:n="primary",title:o,className:r,style:i={},...t},p)=>{let m=IconMap[e],d=y(s);return a.createElement("div",{className:c("flex justify-center items-center",r),style:{...d,"--icon-stroke":l[n],...i}},a.createElement(m,{ref:p,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:l[n],...t}))});g.displayName="Icon";export{g as Icon};//# sourceMappingURL=Icon.js.map
2
2
  //# sourceMappingURL=Icon.js.map