@deckai/deck-ui 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AboutCard.cjs +14 -0
- package/dist/components/AboutCard.cjs.map +1 -0
- package/dist/components/AboutCard.js +14 -0
- package/dist/components/AboutCard.js.map +1 -0
- package/dist/components/Avatar.cjs +2 -0
- package/dist/components/Avatar.cjs.map +1 -0
- package/dist/components/Avatar.js +2 -0
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Badge.cjs +2 -0
- package/dist/components/Badge.cjs.map +1 -0
- package/dist/components/Badge.js +2 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Breadcrumbs.cjs +2 -0
- package/dist/components/Breadcrumbs.cjs.map +1 -0
- package/dist/components/Breadcrumbs.js +2 -0
- package/dist/components/Breadcrumbs.js.map +1 -0
- package/dist/components/Button.cjs +14 -0
- package/dist/components/Button.cjs.map +1 -0
- package/dist/components/Button.js +14 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Combobox.cjs +2 -0
- package/dist/components/Combobox.cjs.map +1 -0
- package/dist/components/Combobox.js +2 -0
- package/dist/components/Combobox.js.map +1 -0
- package/dist/components/ContactItem.cjs +2 -0
- package/dist/components/ContactItem.cjs.map +1 -0
- package/dist/components/ContactItem.js +2 -0
- package/dist/components/ContactItem.js.map +1 -0
- package/dist/components/Icon.cjs +2 -0
- package/dist/components/Icon.cjs.map +1 -0
- package/dist/components/Icon.js +2 -0
- package/dist/components/Icon.js.map +1 -0
- package/dist/components/Input.cjs +2 -0
- package/dist/components/Input.cjs.map +1 -0
- package/dist/components/Input.js +2 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/Link.cjs +2 -0
- package/dist/components/Link.cjs.map +1 -0
- package/dist/components/Link.js +2 -0
- package/dist/components/Link.js.map +1 -0
- package/dist/components/Logo.cjs +3 -0
- package/dist/components/Logo.cjs.map +1 -0
- package/dist/components/Logo.js +3 -0
- package/dist/components/Logo.js.map +1 -0
- package/dist/components/Navbar.cjs +3 -0
- package/dist/components/Navbar.cjs.map +1 -0
- package/dist/components/Navbar.js +3 -0
- package/dist/components/Navbar.js.map +1 -0
- package/dist/components/NavbarItem.cjs +2 -0
- package/dist/components/NavbarItem.cjs.map +1 -0
- package/dist/components/NavbarItem.js +2 -0
- package/dist/components/NavbarItem.js.map +1 -0
- package/dist/components/Option.cjs +2 -0
- package/dist/components/Option.cjs.map +1 -0
- package/dist/components/Option.js +2 -0
- package/dist/components/Option.js.map +1 -0
- package/dist/components/Pressable.cjs +2 -0
- package/dist/components/Pressable.cjs.map +1 -0
- package/dist/components/Pressable.js +2 -0
- package/dist/components/Pressable.js.map +1 -0
- package/dist/components/ProfileCard.cjs +14 -0
- package/dist/components/ProfileCard.cjs.map +1 -0
- package/dist/components/ProfileCard.js +14 -0
- package/dist/components/ProfileCard.js.map +1 -0
- package/dist/components/SocialCard.cjs +2 -0
- package/dist/components/SocialCard.cjs.map +1 -0
- package/dist/components/SocialCard.js +2 -0
- package/dist/components/SocialCard.js.map +1 -0
- package/dist/components/Switch.cjs +2 -0
- package/dist/components/Switch.cjs.map +1 -0
- package/dist/components/Switch.js +2 -0
- package/dist/components/Switch.js.map +1 -0
- package/dist/components/Tabs.cjs +2 -0
- package/dist/components/Tabs.cjs.map +1 -0
- package/dist/components/Tabs.js +2 -0
- package/dist/components/Tabs.js.map +1 -0
- package/dist/components/Tag.cjs +2 -0
- package/dist/components/Tag.cjs.map +1 -0
- package/dist/components/Tag.js +2 -0
- package/dist/components/Tag.js.map +1 -0
- package/dist/components/Text.cjs +2 -0
- package/dist/components/Text.cjs.map +1 -0
- package/dist/components/Text.js +2 -0
- package/dist/components/Text.js.map +1 -0
- package/dist/components/Tooltip.cjs +2 -0
- package/dist/components/Tooltip.cjs.map +1 -0
- package/dist/components/Tooltip.js +2 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/WorkCard.cjs +2 -0
- package/dist/components/WorkCard.cjs.map +1 -0
- package/dist/components/WorkCard.js +2 -0
- package/dist/components/WorkCard.js.map +1 -0
- package/dist/index.cjs +5 -1005
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -954
- package/dist/index.js.map +1 -1
- package/dist/styles/fonts.css +1 -29
- package/dist/styles/fonts.css.map +1 -1
- package/dist/styles/styles.css +1 -1
- package/dist/styles/styles.css.map +1 -1
- package/package.json +7 -2
- package/dist/index.d.cts +0 -337
- package/dist/index.d.ts +0 -337
- package/dist/styles/fonts.d.cts +0 -2
- package/dist/styles/fonts.d.ts +0 -2
- package/dist/styles/styles.d.cts +0 -2
- package/dist/styles/styles.d.ts +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var s=require('react'),icons=require('@deckai/icons'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var s__default=/*#__PURE__*/_interopDefault(s);var g="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var u=({children:e,type:t="button",className:r,...o})=>s__default.default.createElement("button",{type:t,className:`appearance-none hover:opacity-80 transition-all active:scale-95 ${g} ${r}`,...o},e);function h(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var f={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB"},C={sm:"@media (min-width: 640px)",md:"@media (min-width: 768px)",lg:"@media (min-width: 1024px)",xl:"@media (min-width: 1280px)","2xl":"@media (min-width: 1536px)"},$=e=>{if(!e)return {width:"24px",height:"24px"};let t=Array.isArray(e)?e:[e],r=typeof t[0]=="number"?t[0]:24,o={width:`${r}px`,height:`${r}px`},a=t.filter(n=>typeof n=="string"&&n.includes(":")).reduce((n,p)=>{let[l,i]=p.split(":");return n[C[l]]={width:`${i}px`,height:`${i}px`},n},{});return Object.keys(a).length>0&&(o["@media"]=a),o},m=s__default.default.forwardRef(({name:e,size:t=24,color:r="primary",title:o,className:a,style:n={},...p},l)=>{let i=icons.IconMap[e],y=$(t);return s__default.default.createElement("div",{className:h("flex justify-center items-center",a),style:{...y,"--icon-stroke":f[r],...n}},s__default.default.createElement(i,{ref:l,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:f[r],...p}))});m.displayName="Icon";var A={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},S=e=>{let[t,r]=e.split("-");return t==="heading"?A[r]||"p":t==="label"?"label":"p"},R={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},P=e=>e?(Array.isArray(e)?e:[e]).map(r=>{if(r.includes(":")){let[o,a]=r.split(":");return `${o}:text-${a}`}return Array.isArray(e)?`lg:text-${r}`:`text-${r}`}).join(" "):"text-body-default",c=s__default.default.forwardRef(({variant:e="body-default",color:t="text-primary",as:r,className:o,children:a,weight:n,...p},l)=>{let i=P(e),y=t&&t==="inherit"?"inherit":t?`text-${t}`:"",b=s__default.default.useMemo(()=>{let x=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return S(x)},[e]);return s__default.default.createElement(r||b,{ref:l,className:`font-sans antialiased ${i} ${y} ${n?`!${R[n]}`:""} ${o??""}`,...p},a)});c.displayName="Text";var Z=({icon:e,followers:t,engagement:r,...o})=>s__default.default.createElement(u,{...o},s__default.default.createElement("div",{className:"flex gap-4 px-6 py-4 border border-secondary rounded-lg"},s__default.default.createElement(m,{name:e,size:40}),s__default.default.createElement("div",{className:"flex items-center"},s__default.default.createElement(m,{name:"profile",size:20}),s__default.default.createElement(c,{variant:["body-default-medium","md:body-xs-medium"]},t)),s__default.default.createElement("div",{className:"flex items-center"},s__default.default.createElement(m,{name:"arrow-swap-horizontal",className:"rotate-90",size:20}),s__default.default.createElement(c,{variant:["body-default-medium","md:body-xs-medium"]},r))));if (exports.default) module.exports = exports.default;exports.SocialCard=Z;//# sourceMappingURL=SocialCard.cjs.map
|
|
2
|
+
//# sourceMappingURL=SocialCard.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/tailwind.ts","../../src/components/Pressable.tsx","../../src/components/Icon.tsx","../../src/utils/index.ts","../../src/components/Text.tsx","../../src/components/SocialCard.tsx"],"names":["focusRingStyles","Pressable","children","type","className","props","React","cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","baseSize","style","mediaQueries","size","acc","breakpoint","value","Icon","name","color","title","ref","IconComponent","IconMap","sizeStyles","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","fontWeight","processVariants","variants","typographyClass","Text","as","weight","typographyClasses","colorClasses","suggestedElement","baseVariant","SocialCard","icon","followers","engagement","pressableProps"],"mappings":"gPAmEO,IAAMA,CAAAA,CACX,qGC/DK,CAAA,IAAMC,CAAsC,CAAA,CAAC,CAClD,QAAA,CAAAC,EACA,IAAAC,CAAAA,CAAAA,CAAO,QACP,CAAA,SAAA,CAAAC,CACA,CAAA,GAAGC,CACL,CAAA,GACEC,mBAAA,aAAC,CAAA,QAAA,CAAA,CAEC,IAAMH,CAAAA,CAAAA,CACN,SAAW,CAAA,CAAA,gEAAA,EAAmEH,CAAe,CAAA,CAAA,EAAII,CAAS,CACzG,CAAA,CAAA,GAAGC,CAEHH,CAAAA,CAAAA,CACH,CClBF,CCGO,SAASK,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,qBAAAA,CAAQC,UAAKF,CAAM,CAAC,CAC7B,CDWA,IAAMG,CAAAA,CAAwC,CAC5C,OAAA,CAAS,UACT,SAAW,CAAA,SAAA,CACX,KAAO,CAAA,SAAA,CACP,WAAa,CAAA,SACf,CAKMC,CAAAA,CAAAA,CAA6C,CACjD,EAAI,CAAA,2BAAA,CACJ,EAAI,CAAA,2BAAA,CACJ,EAAI,CAAA,4BAAA,CACJ,EAAI,CAAA,4BAAA,CACJ,MAAO,4BACT,CAAA,CAEMC,CACJC,CAAAA,CAAAA,EACwB,CACxB,GAAI,CAAC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S,CACH,CACF,EACA1C,kBAAA,CAAA,aAAA,CAAC,KAAI,CAAA,CAAA,SAAA,CAAU,mBACbA,CAAAA,CAAAA,kBAAAA,CAAA,aAACiB,CAAAA,CAAAA,CAAA,CAAK,IAAK,CAAA,uBAAA,CAAwB,SAAU,CAAA,WAAA,CAAY,IAAM,CAAA,EAAA,CAAI,CACnEjB,CAAAA,kBAAAA,CAAA,cAACiC,CAAA,CAAA,CAAK,OAAS,CAAA,CAAC,sBAAuB,mBAAmB,CAAA,CAAA,CACvDU,CACH,CACF,CACF,CACF","file":"SocialCard.cjs","sourcesContent":["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, { ButtonHTMLAttributes } from \"react\";\nimport { focusRingStyles } from \"../utils/tailwind\";\n\nexport type PressableProps = ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const Pressable: React.FC<PressableProps> = ({\n children,\n type = \"button\",\n className,\n ...props\n}) => (\n <button\n // eslint-disable-next-line react/butt on-has-type\n type={type}\n className={`appearance-none hover:opacity-80 transition-all active:scale-95 ${focusRingStyles} ${className}`}\n {...props}\n >\n {children}\n </button>\n);\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: number | `${Breakpoint}:${number}`;\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};\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"@media (min-width: 640px)\",\n md: \"@media (min-width: 768px)\",\n lg: \"@media (min-width: 1024px)\",\n xl: \"@media (min-width: 1280px)\",\n \"2xl\": \"@media (min-width: 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 baseSize = typeof sizeArray[0] === \"number\" ? sizeArray[0] : 24;\n\n const style: React.CSSProperties = {\n width: `${baseSize}px`,\n height: `${baseSize}px`\n };\n\n // Add media queries for responsive sizes\n const mediaQueries = sizeArray\n .filter(\n (size): size is `${Breakpoint}:${number}` =>\n typeof size === \"string\" && size.includes(\":\")\n )\n .reduce(\n (acc, size) => {\n const [breakpoint, value] = size.split(\":\") as [Breakpoint, string];\n acc[BREAKPOINT_MAP[breakpoint]] = {\n width: `${value}px`,\n height: `${value}px`\n };\n return acc;\n },\n {} as Record<string, React.CSSProperties>\n );\n\n if (Object.keys(mediaQueries).length > 0) {\n (style as any)[\"@media\"] = mediaQueries;\n }\n\n return style;\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 { 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 {\n Colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} 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 ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\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\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\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\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 Array.isArray(variants) ? `lg:text-${variant}` : `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-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 && color === \"inherit\" ? \"inherit\" : color ? `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 React from \"react\";\nimport { Pressable, PressableProps } from \"./Pressable\";\nimport { Icon } from \"./Icon\";\nimport { Text } from \"./Text\";\nimport { IconName } from \"@deckai/icons\";\n\nexport type SocialCardProps = {\n icon: IconName;\n followers: string;\n engagement: string;\n} & PressableProps;\n\nexport const SocialCard = ({\n icon,\n followers,\n engagement,\n ...pressableProps\n}: SocialCardProps) => (\n <Pressable {...pressableProps}>\n <div className=\"flex gap-4 px-6 py-4 border border-secondary rounded-lg\">\n <Icon name={icon} size={40} />\n <div className=\"flex items-center\">\n <Icon name=\"profile\" size={20} />\n <Text variant={[\"body-default-medium\", \"md:body-xs-medium\"]}>\n {followers}\n </Text>\n </div>\n <div className=\"flex items-center\">\n <Icon name=\"arrow-swap-horizontal\" className=\"rotate-90\" size={20} />\n <Text variant={[\"body-default-medium\", \"md:body-xs-medium\"]}>\n {engagement}\n </Text>\n </div>\n </div>\n </Pressable>\n);\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import s from'react';import {IconMap}from'@deckai/icons';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';var g="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var u=({children:e,type:t="button",className:r,...o})=>s.createElement("button",{type:t,className:`appearance-none hover:opacity-80 transition-all active:scale-95 ${g} ${r}`,...o},e);function h(...e){return twMerge(clsx(e))}var f={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB"},C={sm:"@media (min-width: 640px)",md:"@media (min-width: 768px)",lg:"@media (min-width: 1024px)",xl:"@media (min-width: 1280px)","2xl":"@media (min-width: 1536px)"},$=e=>{if(!e)return {width:"24px",height:"24px"};let t=Array.isArray(e)?e:[e],r=typeof t[0]=="number"?t[0]:24,o={width:`${r}px`,height:`${r}px`},a=t.filter(n=>typeof n=="string"&&n.includes(":")).reduce((n,p)=>{let[l,i]=p.split(":");return n[C[l]]={width:`${i}px`,height:`${i}px`},n},{});return Object.keys(a).length>0&&(o["@media"]=a),o},m=s.forwardRef(({name:e,size:t=24,color:r="primary",title:o,className:a,style:n={},...p},l)=>{let i=IconMap[e],y=$(t);return s.createElement("div",{className:h("flex justify-center items-center",a),style:{...y,"--icon-stroke":f[r],...n}},s.createElement(i,{ref:l,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:f[r],...p}))});m.displayName="Icon";var A={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},S=e=>{let[t,r]=e.split("-");return t==="heading"?A[r]||"p":t==="label"?"label":"p"},R={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},P=e=>e?(Array.isArray(e)?e:[e]).map(r=>{if(r.includes(":")){let[o,a]=r.split(":");return `${o}:text-${a}`}return Array.isArray(e)?`lg:text-${r}`:`text-${r}`}).join(" "):"text-body-default",c=s.forwardRef(({variant:e="body-default",color:t="text-primary",as:r,className:o,children:a,weight:n,...p},l)=>{let i=P(e),y=t&&t==="inherit"?"inherit":t?`text-${t}`:"",b=s.useMemo(()=>{let x=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return S(x)},[e]);return s.createElement(r||b,{ref:l,className:`font-sans antialiased ${i} ${y} ${n?`!${R[n]}`:""} ${o??""}`,...p},a)});c.displayName="Text";var Z=({icon:e,followers:t,engagement:r,...o})=>s.createElement(u,{...o},s.createElement("div",{className:"flex gap-4 px-6 py-4 border border-secondary rounded-lg"},s.createElement(m,{name:e,size:40}),s.createElement("div",{className:"flex items-center"},s.createElement(m,{name:"profile",size:20}),s.createElement(c,{variant:["body-default-medium","md:body-xs-medium"]},t)),s.createElement("div",{className:"flex items-center"},s.createElement(m,{name:"arrow-swap-horizontal",className:"rotate-90",size:20}),s.createElement(c,{variant:["body-default-medium","md:body-xs-medium"]},r))));if (exports.default) module.exports = exports.default;export{Z as SocialCard};//# sourceMappingURL=SocialCard.js.map
|
|
2
|
+
//# sourceMappingURL=SocialCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/tailwind.ts","../../src/components/Pressable.tsx","../../src/components/Icon.tsx","../../src/utils/index.ts","../../src/components/Text.tsx","../../src/components/SocialCard.tsx"],"names":["focusRingStyles","Pressable","children","type","className","props","React","cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","baseSize","style","mediaQueries","size","acc","breakpoint","value","Icon","name","color","title","ref","IconComponent","IconMap","sizeStyles","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","fontWeight","processVariants","variants","typographyClass","Text","as","weight","typographyClasses","colorClasses","suggestedElement","baseVariant","SocialCard","icon","followers","engagement","pressableProps"],"mappings":"sHAmEO,IAAMA,CAAAA,CACX,qGC/DK,CAAA,IAAMC,CAAsC,CAAA,CAAC,CAClD,QAAA,CAAAC,EACA,IAAAC,CAAAA,CAAAA,CAAO,QACP,CAA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,CAAa,CAAA,CAAC,CACzB,IAAAC,CAAAA,CAAAA,CACA,SAAAC,CAAAA,CAAAA,CACA,WAAAC,CACA,CAAA,GAAGC,CACL,CAAA,GACE5C,EAAA,aAACL,CAAAA,CAAAA,CAAA,CAAW,GAAGiD,CACb5C,CAAAA,CAAAA,CAAAA,CAAA,aAAC,CAAA,KAAA,CAAA,CAAI,UAAU,yDACbA,CAAAA,CAAAA,CAAAA,CAAA,aAACiB,CAAAA,CAAAA,CAAA,CAAK,IAAA,CAAMwB,CAAM,CAAA,IAAA,CAAM,GAAI,CAC5BzC,CAAAA,CAAAA,CAAA,aAAC,CAAA,KAAA,CAAA,CAAI,SAAU,CAAA,mBAAA,CAAA,CACbA,CAAA,CAAA,aAAA,CAACiB,EAAA,CAAK,IAAA,CAAK,SAAU,CAAA,IAAA,CAAM,EAAI,CAAA,CAAA,CAC/BjB,CAAA,CAAA,aAAA,CAACiC,EAAA,CAAK,OAAA,CAAS,CAAC,qBAAA,CAAuB,mBAAmB,CAAA,CAAA,CACvDS,CACH,CACF,EACA1C,CAAA,CAAA,aAAA,CAAC,KAAI,CAAA,CAAA,SAAA,CAAU,mBACbA,CAAAA,CAAAA,CAAAA,CAAA,aAACiB,CAAAA,CAAAA,CAAA,CAAK,IAAK,CAAA,uBAAA,CAAwB,SAAU,CAAA,WAAA,CAAY,IAAM,CAAA,EAAA,CAAI,CACnEjB,CAAAA,CAAAA,CAAA,cAACiC,CAAA,CAAA,CAAK,OAAS,CAAA,CAAC,sBAAuB,mBAAmB,CAAA,CAAA,CACvDU,CACH,CACF,CACF,CACF","file":"SocialCard.js","sourcesContent":["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, { ButtonHTMLAttributes } from \"react\";\nimport { focusRingStyles } from \"../utils/tailwind\";\n\nexport type PressableProps = ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const Pressable: React.FC<PressableProps> = ({\n children,\n type = \"button\",\n className,\n ...props\n}) => (\n <button\n // eslint-disable-next-line react/butt on-has-type\n type={type}\n className={`appearance-none hover:opacity-80 transition-all active:scale-95 ${focusRingStyles} ${className}`}\n {...props}\n >\n {children}\n </button>\n);\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: number | `${Breakpoint}:${number}`;\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};\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"@media (min-width: 640px)\",\n md: \"@media (min-width: 768px)\",\n lg: \"@media (min-width: 1024px)\",\n xl: \"@media (min-width: 1280px)\",\n \"2xl\": \"@media (min-width: 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 baseSize = typeof sizeArray[0] === \"number\" ? sizeArray[0] : 24;\n\n const style: React.CSSProperties = {\n width: `${baseSize}px`,\n height: `${baseSize}px`\n };\n\n // Add media queries for responsive sizes\n const mediaQueries = sizeArray\n .filter(\n (size): size is `${Breakpoint}:${number}` =>\n typeof size === \"string\" && size.includes(\":\")\n )\n .reduce(\n (acc, size) => {\n const [breakpoint, value] = size.split(\":\") as [Breakpoint, string];\n acc[BREAKPOINT_MAP[breakpoint]] = {\n width: `${value}px`,\n height: `${value}px`\n };\n return acc;\n },\n {} as Record<string, React.CSSProperties>\n );\n\n if (Object.keys(mediaQueries).length > 0) {\n (style as any)[\"@media\"] = mediaQueries;\n }\n\n return style;\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 { 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 {\n Colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} 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 ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\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\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\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\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 Array.isArray(variants) ? `lg:text-${variant}` : `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-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 && color === \"inherit\" ? \"inherit\" : color ? `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 React from \"react\";\nimport { Pressable, PressableProps } from \"./Pressable\";\nimport { Icon } from \"./Icon\";\nimport { Text } from \"./Text\";\nimport { IconName } from \"@deckai/icons\";\n\nexport type SocialCardProps = {\n icon: IconName;\n followers: string;\n engagement: string;\n} & PressableProps;\n\nexport const SocialCard = ({\n icon,\n followers,\n engagement,\n ...pressableProps\n}: SocialCardProps) => (\n <Pressable {...pressableProps}>\n <div className=\"flex gap-4 px-6 py-4 border border-secondary rounded-lg\">\n <Icon name={icon} size={40} />\n <div className=\"flex items-center\">\n <Icon name=\"profile\" size={20} />\n <Text variant={[\"body-default-medium\", \"md:body-xs-medium\"]}>\n {followers}\n </Text>\n </div>\n <div className=\"flex items-center\">\n <Icon name=\"arrow-swap-horizontal\" className=\"rotate-90\" size={20} />\n <Text variant={[\"body-default-medium\", \"md:body-xs-medium\"]}>\n {engagement}\n </Text>\n </div>\n </div>\n </Pressable>\n);\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var t=require('react'),e=require('@radix-ui/react-switch'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');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 t__namespace=/*#__PURE__*/_interopNamespace(t);var e__namespace=/*#__PURE__*/_interopNamespace(e);function i(...s){return tailwindMerge.twMerge(clsx.clsx(s))}var n="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var p=t__namespace.forwardRef(({className:s,label:o,description:r,...a},c)=>t__namespace.createElement("div",{className:"flex items-center gap-2"},t__namespace.createElement(e__namespace.Root,{className:i("peer inline-flex h-6 w-11 shrink-0 cursor-pointer","items-center rounded-full border-2 border-transparent","transition-colors focus-visible:outline-none",n,"disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-primary-50 data-[state=unchecked]:bg-secondary-50",s),...a,ref:c},t__namespace.createElement(e__namespace.Thumb,{className:i("pointer-events-none block h-5 w-5","rounded-full bg-white shadow-lg ring-0","transition-transform","data-[state=checked]:translate-x-5","data-[state=unchecked]:translate-x-0")})),(o||r)&&t__namespace.createElement("div",{className:"flex flex-col"},o&&t__namespace.createElement("label",{className:"text-sm font-medium text-text-primary",htmlFor:a.id},o),r&&t__namespace.createElement("span",{className:"text-xs text-text-secondary"},r))));p.displayName="Switch";if (exports.default) module.exports = exports.default;exports.Switch=p;//# sourceMappingURL=Switch.cjs.map
|
|
2
|
+
//# sourceMappingURL=Switch.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Switch.tsx"],"names":["cn","inputs","twMerge","clsx","focusRingStyles","Switch","t","className","label","description","props","ref","e"],"mappings":"8hBAGO,SAASA,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,qBAAQC,CAAAA,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CC8DO,IAAMG,CACX,CAAA,qGAAA,KCxDWC,CAAe,CAAAC,YAAA,CAAA,UAAA,CAG1B,CAAC,CAAE,SAAA,CAAAC,CAAW,CAAA,KAAA,CAAAC,CAAO,CAAA,WAAA,CAAAC,EAAa,GAAGC,CAAM,CAAGC,CAAAA,CAAAA,GAC9CL,YAAC,CAAA,aAAA,CAAA,KAAA,CAAA,CAAI,UAAU,yBACb,CAAA,CAAAA,YAAA,CAAA,aAAA,CAAiBM,YAAhB,CAAA,IAAA,CAAA,CACC,SAAWZ,CAAAA,CAAAA,CACT,oDACA,uDACA,CAAA,8CAAA,CACAI,EACA,iDACA,CAAA,2EAAA,CACAG,CACF,CACC,CAAA,GAAGG,CACJ,CAAA,GAAA,CAAKC,CAEL,CAAA,CAAAL,YAAA,CAAA,aAAA,CAAiBM,mBAAhB,CACC,SAAA,CAAWZ,CACT,CAAA,mCAAA,CACA,wCACA,CAAA,sBAAA,CACA,qCACA,sCACF,CAAA,CACF,CACF,CAAA,CAAA,CACEQ,CAASC,EAAAA,CAAAA,GACTH,2BAAC,KAAI,CAAA,CAAA,SAAA,CAAU,iBACZE,CACC,EAAAF,YAAA,CAAA,aAAA,CAAC,SACC,SAAU,CAAA,uCAAA,CACV,OAASI,CAAAA,CAAAA,CAAM,EAEdF,CAAAA,CAAAA,CACH,EAEDC,CACC,EAAAH,YAAA,CAAA,aAAA,CAAC,MAAK,CAAA,CAAA,SAAA,CAAU,6BAA+BG,CAAAA,CAAAA,CAAY,CAE/D,CAEJ,CACD,EAEDJ,CAAAA,CAAO,WAAc,CAAA,QAAA","file":"Switch.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 { 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 * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles } from \"../utils/tailwind\";\n\nexport type SwitchProps = React.ComponentPropsWithoutRef<\n typeof SwitchPrimitive.Root\n> & {\n label?: string;\n description?: string;\n};\n\nexport const Switch = React.forwardRef<\n React.ElementRef<typeof SwitchPrimitive.Root>,\n SwitchProps\n>(({ className, label, description, ...props }, ref) => (\n <div className=\"flex items-center gap-2\">\n <SwitchPrimitive.Root\n className={cn(\n \"peer inline-flex h-6 w-11 shrink-0 cursor-pointer\",\n \"items-center rounded-full border-2 border-transparent\",\n \"transition-colors focus-visible:outline-none\",\n focusRingStyles,\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=checked]:bg-primary-50 data-[state=unchecked]:bg-secondary-50\",\n className\n )}\n {...props}\n ref={ref}\n >\n <SwitchPrimitive.Thumb\n className={cn(\n \"pointer-events-none block h-5 w-5\",\n \"rounded-full bg-white shadow-lg ring-0\",\n \"transition-transform\",\n \"data-[state=checked]:translate-x-5\",\n \"data-[state=unchecked]:translate-x-0\"\n )}\n />\n </SwitchPrimitive.Root>\n {(label || description) && (\n <div className=\"flex flex-col\">\n {label && (\n <label\n className=\"text-sm font-medium text-text-primary\"\n htmlFor={props.id}\n >\n {label}\n </label>\n )}\n {description && (\n <span className=\"text-xs text-text-secondary\">{description}</span>\n )}\n </div>\n )}\n </div>\n));\n\nSwitch.displayName = \"Switch\";\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as t from'react';import*as e from'@radix-ui/react-switch';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function i(...s){return twMerge(clsx(s))}var n="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var p=t.forwardRef(({className:s,label:o,description:r,...a},c)=>t.createElement("div",{className:"flex items-center gap-2"},t.createElement(e.Root,{className:i("peer inline-flex h-6 w-11 shrink-0 cursor-pointer","items-center rounded-full border-2 border-transparent","transition-colors focus-visible:outline-none",n,"disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-primary-50 data-[state=unchecked]:bg-secondary-50",s),...a,ref:c},t.createElement(e.Thumb,{className:i("pointer-events-none block h-5 w-5","rounded-full bg-white shadow-lg ring-0","transition-transform","data-[state=checked]:translate-x-5","data-[state=unchecked]:translate-x-0")})),(o||r)&&t.createElement("div",{className:"flex flex-col"},o&&t.createElement("label",{className:"text-sm font-medium text-text-primary",htmlFor:a.id},o),r&&t.createElement("span",{className:"text-xs text-text-secondary"},r))));p.displayName="Switch";if (exports.default) module.exports = exports.default;export{p as Switch};//# sourceMappingURL=Switch.js.map
|
|
2
|
+
//# sourceMappingURL=Switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Switch.tsx"],"names":["cn","inputs","twMerge","clsx","focusRingStyles","Switch","className","label","description","props","ref"],"mappings":"8HAGO,SAASA,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CC8DO,IAAMG,CACX,CAAA,qGAAA,KCxDWC,CAAe,CAAA,CAAA,CAAA,UAAA,CAG1B,CAAC,CAAE,SAAA,CAAAC,CAAW,CAAA,KAAA,CAAAC,CAAO,CAAA,WAAA,CAAAC,EAAa,GAAGC,CAAM,CAAGC,CAAAA,CAAAA,GAC9C,CAAC,CAAA,aAAA,CAAA,KAAA,CAAA,CAAI,UAAU,yBACb,CAAA,CAAA,CAAA,CAAA,aAAA,CAAiB,CAAhB,CAAA,IAAA,CAAA,CACC,SAAWV,CAAAA,CAAAA,CACT,oDACA,uDACA,CAAA,8CAAA,CACAI,EACA,iDACA,CAAA,2EAAA,CACAE,CACF,CACC,CAAA,GAAGG,CACJ,CAAA,GAAA,CAAKC,CAEL,CAAA,CAAA,CAAA,CAAA,aAAA,CAAiB,QAAhB,CACC,SAAA,CAAWV,CACT,CAAA,mCAAA,CACA,wCACA,CAAA,sBAAA,CACA,qCACA,sCACF,CAAA,CACF,CACF,CAAA,CAAA,CACEO,CAASC,EAAAA,CAAAA,GACT,gBAAC,KAAI,CAAA,CAAA,SAAA,CAAU,iBACZD,CACC,EAAA,CAAA,CAAA,aAAA,CAAC,SACC,SAAU,CAAA,uCAAA,CACV,OAASE,CAAAA,CAAAA,CAAM,EAEdF,CAAAA,CAAAA,CACH,EAEDC,CACC,EAAA,CAAA,CAAA,aAAA,CAAC,MAAK,CAAA,CAAA,SAAA,CAAU,6BAA+BA,CAAAA,CAAAA,CAAY,CAE/D,CAEJ,CACD,EAEDH,CAAAA,CAAO,WAAc,CAAA,QAAA","file":"Switch.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 { 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 * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles } from \"../utils/tailwind\";\n\nexport type SwitchProps = React.ComponentPropsWithoutRef<\n typeof SwitchPrimitive.Root\n> & {\n label?: string;\n description?: string;\n};\n\nexport const Switch = React.forwardRef<\n React.ElementRef<typeof SwitchPrimitive.Root>,\n SwitchProps\n>(({ className, label, description, ...props }, ref) => (\n <div className=\"flex items-center gap-2\">\n <SwitchPrimitive.Root\n className={cn(\n \"peer inline-flex h-6 w-11 shrink-0 cursor-pointer\",\n \"items-center rounded-full border-2 border-transparent\",\n \"transition-colors focus-visible:outline-none\",\n focusRingStyles,\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"data-[state=checked]:bg-primary-50 data-[state=unchecked]:bg-secondary-50\",\n className\n )}\n {...props}\n ref={ref}\n >\n <SwitchPrimitive.Thumb\n className={cn(\n \"pointer-events-none block h-5 w-5\",\n \"rounded-full bg-white shadow-lg ring-0\",\n \"transition-transform\",\n \"data-[state=checked]:translate-x-5\",\n \"data-[state=unchecked]:translate-x-0\"\n )}\n />\n </SwitchPrimitive.Root>\n {(label || description) && (\n <div className=\"flex flex-col\">\n {label && (\n <label\n className=\"text-sm font-medium text-text-primary\"\n htmlFor={props.id}\n >\n {label}\n </label>\n )}\n {description && (\n <span className=\"text-xs text-text-secondary\">{description}</span>\n )}\n </div>\n )}\n </div>\n));\n\nSwitch.displayName = \"Switch\";\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var n=require('react'),o=require('@radix-ui/react-tabs');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}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 n__default=/*#__PURE__*/_interopDefault(n);var o__namespace=/*#__PURE__*/_interopNamespace(o);var c={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},u=e=>{let[t,a]=e.split("-");return t==="heading"?c[a]||"p":t==="label"?"label":"p"},h={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},H=e=>e?(Array.isArray(e)?e:[e]).map(a=>{if(a.includes(":")){let[s,l]=a.split(":");return `${s}:text-${l}`}return Array.isArray(e)?`lg:text-${a}`:`text-${a}`}).join(" "):"text-body-default",T=n__default.default.forwardRef(({variant:e="body-default",color:t="text-primary",as:a,className:s,children:l,weight:r,...p},y)=>{let m=H(e),g=t&&t==="inherit"?"inherit":t?`text-${t}`:"",d=n__default.default.useMemo(()=>{let b=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return u(b)},[e]);return n__default.default.createElement(a||d,{ref:y,className:`font-sans antialiased ${m} ${g} ${r?`!${h[r]}`:""} ${s??""}`,...p},l)});T.displayName="Text";var L=n__default.default.forwardRef(({items:e,defaultValue:t,className:a="",onChange:s},l)=>n__default.default.createElement(o__namespace.Root,{defaultValue:t||e[0]?.value,onValueChange:s,className:a},n__default.default.createElement(o__namespace.List,{ref:l,className:"flex gap-8 border-b border-stroke mb-8"},e.map(r=>n__default.default.createElement(o__namespace.Trigger,{key:r.value,value:r.value,className:"group pb-4 relative flex-1"},n__default.default.createElement(T,{variant:"body-lg-semibold",color:"text-secondary",className:"group-data-[state=active]:text-text-primary transition-colors"},r.label),n__default.default.createElement("div",{className:"absolute bottom-0 left-0 right-0 h-1 bg-primary-100 scale-x-0 group-data-[state=active]:scale-x-100 transition-transform"})))),e.map(r=>n__default.default.createElement(o__namespace.Content,{key:r.value,value:r.value},r.content))));L.displayName="Tabs";if (exports.default) module.exports = exports.default;exports.Tabs=L;//# sourceMappingURL=Tabs.cjs.map
|
|
2
|
+
//# sourceMappingURL=Tabs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Text.tsx","../../src/components/Tabs.tsx"],"names":["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","Tabs","items","defaultValue","onChange","o","item"],"mappings":"4hBA4FA,IAAMA,CAAAA,CAAmD,CACvD,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACN,CAEMC,CAAAA,CAAAA,CAAyBC,CAAwC,EAAA,CACrE,GAAM,CAACC,CAAAA,CAAUC,CAAI,CAAA,CAAIF,EAAQ,KAAM,CAAA,GAAG,CAE1C,CAAA,OAAIC,IAAa,SACRH,CAAAA,CAAAA,CAAoBI,CAAI,CAAA,EAAK,IAGlCD,CAAa,GAAA,OAAA,CACR,OAGF,CAAA,GACT,EAIME,CAAqC,CAAA,CACzC,KAAO,CAAA,YAAA,CACP,QAAS,cACT,CAAA,QAAA,CAAU,eACV,CAAA,IAAA,CAAM,WACR,CAiBMC,CAAAA,CAAAA,CACJC,CAEKA,EAAAA,CAAAA,CAAAA,CAEgB,MAAM,OAAQA,CAAAA,CAAQ,CAAIA,CAAAA,CAAAA,CAAW,CAACA,CAAQ,CAAA,EAGhE,GAAKL,CAAAA,CAAAA,EAAY,CAChB,GAAIA,CAAAA,CAAQ,QAAS,CAAA,GAAG,EAAG,CACzB,GAAM,CAACM,CAAAA,CAAYC,CAAe,CAAIP,CAAAA,CAAAA,CAAQ,KAAM,CAAA,GAAG,EACvD,OAAO,CAAA,EAAGM,CAAU,CAAA,MAAA,EAASC,CAAe,CAC9C,CAAA,CACA,OAAO,KAAA,CAAM,QAAQF,CAAQ,CAAA,CAAI,CAAWL,QAAAA,EAAAA,CAAO,GAAK,CAAQA,KAAAA,EAAAA,CAAO,CACzE,CAAA,CAAC,EACA,IAAK,CAAA,GAAG,CAZW,CAAA,mBAAA,CAeXQ,EAAOC,kBAA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,CAAO,CAAA,YAAA,CAAAC,EAAc,SAAAX,CAAAA,CAAAA,CAAY,EAAI,CAAA,QAAA,CAAAY,CAAS,CAAGR,CAAAA,CAAAA,GAEhDP,kBAAA,CAAA,aAAA,CAAWgB,kBAAV,CACC,YAAA,CAAcF,CAAgBD,EAAAA,CAAAA,CAAM,CAAC,CAAG,EAAA,KAAA,CACxC,aAAeE,CAAAA,CAAAA,CACf,UAAWZ,CAEXH,CAAAA,CAAAA,kBAAAA,CAAA,aAAW,CAAAgB,YAAA,CAAA,IAAA,CAAV,CACC,GAAKT,CAAAA,CAAAA,CACL,SAAU,CAAA,wCAAA,CAAA,CAETM,EAAM,GAAKI,CAAAA,CAAAA,EACVjB,kBAAA,CAAA,aAAA,CAAWgB,qBAAV,CACC,GAAA,CAAKC,CAAK,CAAA,KAAA,CACV,MAAOA,CAAK,CAAA,KAAA,CACZ,SAAU,CAAA,4BAAA,CAAA,CAEVjB,mBAAA,aAACD,CAAAA,CAAAA,CAAA,CACC,OAAA,CAAQ,mBACR,KAAM,CAAA,gBAAA,CACN,SAAU,CAAA,+DAAA,CAAA,CAETkB,EAAK,KACR,CAAA,CACAjB,kBAAA,CAAA,aAAA,CAAC,OAAI,SAAU,CAAA,0HAAA,CAA2H,CAC5I,CACD,CACH,CAECa,CAAAA,CAAAA,CAAM,GAAKI,CAAAA,CAAAA,EACVjB,mBAAA,aAAW,CAAAgB,YAAA,CAAA,OAAA,CAAV,CAAkB,GAAA,CAAKC,EAAK,KAAO,CAAA,KAAA,CAAOA,CAAK,CAAA,KAAA,CAAA,CAC7CA,EAAK,OACR,CACD,CACH,CAGN,EAEAL,EAAK,WAAc,CAAA,MAAA","file":"Tabs.cjs","sourcesContent":["import React from \"react\";\nimport {\n Colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} 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 ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\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\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\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\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 Array.isArray(variants) ? `lg:text-${variant}` : `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-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 && color === \"inherit\" ? \"inherit\" : color ? `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 React from \"react\";\nimport * as RadixTabs from \"@radix-ui/react-tabs\";\nimport { Text } from \"./Text\";\n\nexport type TabItem = {\n value: string;\n label: string;\n content: React.ReactNode;\n};\n\nexport type TabsProps = {\n items: TabItem[];\n defaultValue?: string;\n className?: string;\n onChange?: (value: string) => void;\n};\n\nexport const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(\n ({ items, defaultValue, className = \"\", onChange }, ref) => {\n return (\n <RadixTabs.Root\n defaultValue={defaultValue || items[0]?.value}\n onValueChange={onChange}\n className={className}\n >\n <RadixTabs.List\n ref={ref}\n className=\"flex gap-8 border-b border-stroke mb-8\"\n >\n {items.map((item) => (\n <RadixTabs.Trigger\n key={item.value}\n value={item.value}\n className=\"group pb-4 relative flex-1\"\n >\n <Text\n variant=\"body-lg-semibold\"\n color=\"text-secondary\"\n className=\"group-data-[state=active]:text-text-primary transition-colors\"\n >\n {item.label}\n </Text>\n <div className=\"absolute bottom-0 left-0 right-0 h-1 bg-primary-100 scale-x-0 group-data-[state=active]:scale-x-100 transition-transform\" />\n </RadixTabs.Trigger>\n ))}\n </RadixTabs.List>\n\n {items.map((item) => (\n <RadixTabs.Content key={item.value} value={item.value}>\n {item.content}\n </RadixTabs.Content>\n ))}\n </RadixTabs.Root>\n );\n }\n);\n\nTabs.displayName = \"Tabs\";\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import n from'react';import*as o from'@radix-ui/react-tabs';var c={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},u=e=>{let[t,a]=e.split("-");return t==="heading"?c[a]||"p":t==="label"?"label":"p"},h={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},H=e=>e?(Array.isArray(e)?e:[e]).map(a=>{if(a.includes(":")){let[s,l]=a.split(":");return `${s}:text-${l}`}return Array.isArray(e)?`lg:text-${a}`:`text-${a}`}).join(" "):"text-body-default",T=n.forwardRef(({variant:e="body-default",color:t="text-primary",as:a,className:s,children:l,weight:r,...p},y)=>{let m=H(e),g=t&&t==="inherit"?"inherit":t?`text-${t}`:"",d=n.useMemo(()=>{let b=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return u(b)},[e]);return n.createElement(a||d,{ref:y,className:`font-sans antialiased ${m} ${g} ${r?`!${h[r]}`:""} ${s??""}`,...p},l)});T.displayName="Text";var L=n.forwardRef(({items:e,defaultValue:t,className:a="",onChange:s},l)=>n.createElement(o.Root,{defaultValue:t||e[0]?.value,onValueChange:s,className:a},n.createElement(o.List,{ref:l,className:"flex gap-8 border-b border-stroke mb-8"},e.map(r=>n.createElement(o.Trigger,{key:r.value,value:r.value,className:"group pb-4 relative flex-1"},n.createElement(T,{variant:"body-lg-semibold",color:"text-secondary",className:"group-data-[state=active]:text-text-primary transition-colors"},r.label),n.createElement("div",{className:"absolute bottom-0 left-0 right-0 h-1 bg-primary-100 scale-x-0 group-data-[state=active]:scale-x-100 transition-transform"})))),e.map(r=>n.createElement(o.Content,{key:r.value,value:r.value},r.content))));L.displayName="Tabs";if (exports.default) module.exports = exports.default;export{L as Tabs};//# sourceMappingURL=Tabs.js.map
|
|
2
|
+
//# sourceMappingURL=Tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Text.tsx","../../src/components/Tabs.tsx"],"names":["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","Tabs","items","defaultValue","onChange","item"],"mappings":"4DA4FA,IAAMA,CAAAA,CAAmD,CACvD,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACN,CAEMC,CAAAA,CAAAA,CAAyBC,CAAwC,EAAA,CACrE,GAAM,CAACC,CAAAA,CAAUC,CAAI,CAAA,CAAIF,EAAQ,KAAM,CAAA,GAAG,CAE1C,CAAA,OAAIC,IAAa,SACRH,CAAAA,CAAAA,CAAoBI,CAAI,CAAA,EAAK,IAGlCD,CAAa,GAAA,OAAA,CACR,OAGF,CAAA,GACT,EAIME,CAAqC,CAAA,CACzC,KAAO,CAAA,YAAA,CACP,QAAS,cACT,CAAA,QAAA,CAAU,eACV,CAAA,IAAA,CAAM,WACR,CAiBMC,CAAAA,CAAAA,CACJC,CAEKA,EAAAA,CAAAA,CAAAA,CAEgB,MAAM,OAAQA,CAAAA,CAAQ,CAAIA,CAAAA,CAAAA,CAAW,CAACA,CAAQ,CAAA,EAGhE,GAAKL,CAAAA,CAAAA,EAAY,CAChB,GAAIA,CAAAA,CAAQ,QAAS,CAAA,GAAG,EAAG,CACzB,GAAM,CAACM,CAAAA,CAAYC,CAAe,CAAIP,CAAAA,CAAAA,CAAQ,KAAM,CAAA,GAAG,EACvD,OAAO,CAAA,EAAGM,CAAU,CAAA,MAAA,EAASC,CAAe,CAC9C,CAAA,CACA,OAAO,KAAA,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colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} 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 ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\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\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\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\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 Array.isArray(variants) ? `lg:text-${variant}` : `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-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 && color === \"inherit\" ? \"inherit\" : color ? `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 React from \"react\";\nimport * as RadixTabs from \"@radix-ui/react-tabs\";\nimport { Text } from \"./Text\";\n\nexport type TabItem = {\n value: string;\n label: string;\n content: React.ReactNode;\n};\n\nexport type TabsProps = {\n items: TabItem[];\n defaultValue?: string;\n className?: string;\n onChange?: (value: string) => void;\n};\n\nexport const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(\n ({ items, defaultValue, className = \"\", onChange }, ref) => {\n return (\n <RadixTabs.Root\n defaultValue={defaultValue || items[0]?.value}\n onValueChange={onChange}\n className={className}\n >\n <RadixTabs.List\n ref={ref}\n className=\"flex gap-8 border-b border-stroke mb-8\"\n >\n {items.map((item) => (\n <RadixTabs.Trigger\n key={item.value}\n value={item.value}\n className=\"group pb-4 relative flex-1\"\n >\n <Text\n variant=\"body-lg-semibold\"\n color=\"text-secondary\"\n className=\"group-data-[state=active]:text-text-primary transition-colors\"\n >\n {item.label}\n </Text>\n <div className=\"absolute bottom-0 left-0 right-0 h-1 bg-primary-100 scale-x-0 group-data-[state=active]:scale-x-100 transition-transform\" />\n </RadixTabs.Trigger>\n ))}\n </RadixTabs.List>\n\n {items.map((item) => (\n <RadixTabs.Content key={item.value} value={item.value}>\n {item.content}\n </RadixTabs.Content>\n ))}\n </RadixTabs.Root>\n );\n }\n);\n\nTabs.displayName = \"Tabs\";\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var n=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var n__default=/*#__PURE__*/_interopDefault(n);var H={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},h=e=>{let[t,r]=e.split("-");return t==="heading"?H[r]||"p":t==="label"?"label":"p"},c={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},M=e=>e?(Array.isArray(e)?e:[e]).map(r=>{if(r.includes(":")){let[a,o]=r.split(":");return `${a}:text-${o}`}return Array.isArray(e)?`lg:text-${r}`:`text-${r}`}).join(" "):"text-body-default",s=n__default.default.forwardRef(({variant:e="body-default",color:t="text-primary",as:r,className:a,children:o,weight:l,...i},T)=>{let y=M(e),m=t&&t==="inherit"?"inherit":t?`text-${t}`:"",d=n__default.default.useMemo(()=>{let g=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return h(g)},[e]);return n__default.default.createElement(r||d,{ref:T,className:`font-sans antialiased ${y} ${m} ${l?`!${c[l]}`:""} ${a??""}`,...i},o)});s.displayName="Text";var A=({children:e,padded:t,color:r="primary",...a})=>n__default.default.createElement("div",{className:`rounded bg-secondary-400 ${t?"px-3":"px-2"} py-1.5 h-min`,...a},typeof e=="string"?n__default.default.createElement(s,{color:r==="primary"?"primary-100":"text-primary",variant:["body-default-medium","md:body-xs-medium"],className:"truncate"},e):e);if (exports.default) module.exports = exports.default;exports.Tag=A;//# sourceMappingURL=Tag.cjs.map
|
|
2
|
+
//# sourceMappingURL=Tag.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Text.tsx","../../src/components/Tag.tsx"],"names":["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","Tag","padded"],"mappings":"oJA4FA,IAAMA,CAAmD,CAAA,CACvD,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IACN,CAEMC,CAAAA,CAAAA,CAAyBC,CAAwC,EAAA,CACrE,GAAM,CAACC,CAAUC,CAAAA,CAAI,CAAIF,CAAAA,CAAAA,CAAQ,MAAM,GAAG,CAAA,CAE1C,OAAIC,CAAAA,GAAa,SACRH,CAAAA,CAAAA,CAAoBI,CAAI,CAAA,EAAK,GAGlCD,CAAAA,CAAAA,GAAa,OACR,CAAA,OAAA,CAGF,GACT,CAAA,CAIME,CAAqC,CAAA,CACzC,MAAO,YACP,CAAA,OAAA,CAAS,cACT,CAAA,QAAA,CAAU,eACV,CAAA,IAAA,CAAM,WACR,CAAA,CAiBMC,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,CAAA,CAAG,CACzB,GAAM,CAACM,CAAAA,CAAYC,CAAe,CAAA,CAAIP,CAAQ,CAAA,KAAA,CAAM,GAAG,CAAA,CACvD,OAAO,CAAA,EAAGM,CAAU,CAAA,MAAA,EAASC,CAAe,CAAA,CAC9C,CACA,OA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AAAA,CAAWW,CAAM,CAAC,CAAK,CAAA,CAAA,EACtC,CAAIF,CAAAA,EAAAA,CAAAA,EAAa,EAAE,CAAA,CAAA,CAClB,GAAGG,CAAAA,CAAAA,CAEHF,CACH,CAEJ,CACF,CAAA,CAEAL,CAAK,CAAA,WAAA,CAAc,MClMZ,CAAA,IAAMa,CAAM,CAAA,CAAC,CAClB,QAAA,CAAAR,CACA,CAAA,MAAA,CAAAS,CACA,CAAA,KAAA,CAAAZ,CAAQ,CAAA,SAAA,CACR,GAAGK,CACL,CAAA,GACEN,kBAAA,CAAA,aAAA,CAAC,KACC,CAAA,CAAA,SAAA,CAAW,CAA4Ba,yBAAAA,EAAAA,CAAAA,CAAS,MAAS,CAAA,MAAM,CAC9D,aAAA,CAAA,CAAA,GAAGP,CAEH,CAAA,CAAA,OAAOF,CAAa,EAAA,QAAA,CACnBJ,mBAAA,aAACD,CAAAA,CAAAA,CAAA,CACC,KAAA,CAAOE,CAAU,GAAA,SAAA,CAAY,aAAgB,CAAA,cAAA,CAC7C,OAAS,CAAA,CAAC,qBAAuB,CAAA,mBAAmB,CACpD,CAAA,SAAA,CAAU,UAETG,CAAAA,CAAAA,CACH,EAEAA,CAEJ","file":"Tag.cjs","sourcesContent":["import React from \"react\";\nimport {\n Colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} 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 ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\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\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\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\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 Array.isArray(variants) ? `lg:text-${variant}` : `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-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 && color === \"inherit\" ? \"inherit\" : color ? `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 React, { HTMLAttributes } from \"react\";\nimport { Text } from \"./Text\";\n\nexport type TagProps = {\n children: React.ReactNode;\n padded?: boolean;\n color?: \"primary\" | \"text\";\n} & HTMLAttributes<HTMLDivElement>;\n\nexport const Tag = ({\n children,\n padded,\n color = \"primary\",\n ...props\n}: TagProps) => (\n <div\n className={`rounded bg-secondary-400 ${padded ? \"px-3\" : \"px-2\"} py-1.5 h-min`}\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text\n color={color === \"primary\" ? \"primary-100\" : \"text-primary\"}\n variant={[\"body-default-medium\", \"md:body-xs-medium\"]}\n className=\"truncate\"\n >\n {children}\n </Text>\n ) : (\n children\n )}\n </div>\n);\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import n from'react';var H={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},h=e=>{let[t,r]=e.split("-");return t==="heading"?H[r]||"p":t==="label"?"label":"p"},c={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},M=e=>e?(Array.isArray(e)?e:[e]).map(r=>{if(r.includes(":")){let[a,o]=r.split(":");return `${a}:text-${o}`}return Array.isArray(e)?`lg:text-${r}`:`text-${r}`}).join(" "):"text-body-default",s=n.forwardRef(({variant:e="body-default",color:t="text-primary",as:r,className:a,children:o,weight:l,...i},T)=>{let y=M(e),m=t&&t==="inherit"?"inherit":t?`text-${t}`:"",d=n.useMemo(()=>{let g=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return h(g)},[e]);return n.createElement(r||d,{ref:T,className:`font-sans antialiased ${y} ${m} ${l?`!${c[l]}`:""} ${a??""}`,...i},o)});s.displayName="Text";var A=({children:e,padded:t,color:r="primary",...a})=>n.createElement("div",{className:`rounded bg-secondary-400 ${t?"px-3":"px-2"} py-1.5 h-min`,...a},typeof e=="string"?n.createElement(s,{color:r==="primary"?"primary-100":"text-primary",variant:["body-default-medium","md:body-xs-medium"],className:"truncate"},e):e);if (exports.default) module.exports = exports.default;export{A as Tag};//# sourceMappingURL=Tag.js.map
|
|
2
|
+
//# sourceMappingURL=Tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Text.tsx","../../src/components/Tag.tsx"],"names":["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","Tag","padded"],"mappings":"qBA4FA,IAAMA,CAAmD,CAAA,CACvD,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IACN,CAEMC,CAAAA,CAAAA,CAAyBC,CAAwC,EAAA,CACrE,GAAM,CAACC,CAAUC,CAAAA,CAAI,CAAIF,CAAAA,CAAAA,CAAQ,MAAM,GAAG,CAAA,CAE1C,OAAIC,CAAAA,GAAa,SACRH,CAAAA,CAAAA,CAAoBI,CAAI,CAAA,EAAK,GAGlCD,CAAAA,CAAAA,GAAa,OACR,CAAA,OAAA,CAGF,GACT,CAAA,CAIME,CAAqC,CAAA,CACzC,MAAO,YACP,CAAA,OAAA,CAAS,cACT,CAAA,QAAA,CAAU,eACV,CAAA,IAAA,CAAM,WACR,CAAA,CAiBMC,CACJC,CAAAA,CAAAA,EAEKA,CAEgB,CAAA,CAAA,KAAA,CAAM,OAAQA,CAAAA,CAAQ,CAAI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AAOD,CAAAA,CAAsBqB,CAA4B,CAC3D,EAAG,CAACpB,CAAO,CAAC,CAAA,CAIZ,OAEES,CAAAA,CAAA,aAJiBE,CAAAA,CAAAA,EAAMQ,CAItB,CAAA,CACC,GAAKH,CAAAA,CAAAA,CACL,SAAW,CAAA,CAAA,sBAAA,EAAyBC,CAAiB,CAAA,CAAA,EAAIC,CAAY,CACnEJ,CAAAA,EAAAA,CAAAA,CAAS,CAAIX,CAAAA,EAAAA,CAAAA,CAAWW,CAAM,CAAC,CAAK,CAAA,CAAA,EACtC,CAAIF,CAAAA,EAAAA,CAAAA,EAAa,EAAE,CAAA,CAAA,CAClB,GAAGG,CAAAA,CAAAA,CAEHF,CACH,CAEJ,CACF,CAAA,CAEAL,CAAK,CAAA,WAAA,CAAc,MClMZ,CAAA,IAAMa,CAAM,CAAA,CAAC,CAClB,QAAA,CAAAR,CACA,CAAA,MAAA,CAAAS,CACA,CAAA,KAAA,CAAAZ,CAAQ,CAAA,SAAA,CACR,GAAGK,CACL,CAAA,GACEN,CAAA,CAAA,aAAA,CAAC,KACC,CAAA,CAAA,SAAA,CAAW,CAA4Ba,yBAAAA,EAAAA,CAAAA,CAAS,MAAS,CAAA,MAAM,CAC9D,aAAA,CAAA,CAAA,GAAGP,CAEH,CAAA,CAAA,OAAOF,CAAa,EAAA,QAAA,CACnBJ,EAAA,aAACD,CAAAA,CAAAA,CAAA,CACC,KAAA,CAAOE,CAAU,GAAA,SAAA,CAAY,aAAgB,CAAA,cAAA,CAC7C,OAAS,CAAA,CAAC,qBAAuB,CAAA,mBAAmB,CACpD,CAAA,SAAA,CAAU,UAETG,CAAAA,CAAAA,CACH,EAEAA,CAEJ","file":"Tag.js","sourcesContent":["import React from \"react\";\nimport {\n Colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} 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 ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\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\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\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\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 Array.isArray(variants) ? `lg:text-${variant}` : `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-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 && color === \"inherit\" ? \"inherit\" : color ? `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 React, { HTMLAttributes } from \"react\";\nimport { Text } from \"./Text\";\n\nexport type TagProps = {\n children: React.ReactNode;\n padded?: boolean;\n color?: \"primary\" | \"text\";\n} & HTMLAttributes<HTMLDivElement>;\n\nexport const Tag = ({\n children,\n padded,\n color = \"primary\",\n ...props\n}: TagProps) => (\n <div\n className={`rounded bg-secondary-400 ${padded ? \"px-3\" : \"px-2\"} py-1.5 h-min`}\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text\n color={color === \"primary\" ? \"primary-100\" : \"text-primary\"}\n variant={[\"body-default-medium\", \"md:body-xs-medium\"]}\n className=\"truncate\"\n >\n {children}\n </Text>\n ) : (\n children\n )}\n </div>\n);\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var o=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);var g={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},H=e=>{let[t,r]=e.split("-");return t==="heading"?g[r]||"p":t==="label"?"label":"p"},d={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},h=e=>e?(Array.isArray(e)?e:[e]).map(r=>{if(r.includes(":")){let[a,n]=r.split(":");return `${a}:text-${n}`}return Array.isArray(e)?`lg:text-${r}`:`text-${r}`}).join(" "):"text-body-default",M=o__default.default.forwardRef(({variant:e="body-default",color:t="text-primary",as:r,className:a,children:n,weight:l,...s},T)=>{let p=h(e),i=t&&t==="inherit"?"inherit":t?`text-${t}`:"",y=o__default.default.useMemo(()=>{let m=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return H(m)},[e]);return o__default.default.createElement(r||y,{ref:T,className:`font-sans antialiased ${p} ${i} ${l?`!${d[l]}`:""} ${a??""}`,...s},n)});M.displayName="Text";if (exports.default) module.exports = exports.default;exports.Text=M;//# sourceMappingURL=Text.cjs.map
|
|
2
|
+
//# sourceMappingURL=Text.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Text.tsx"],"names":["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"],"mappings":"oJA4FMA,IAAAA,CAAAA,CAAmD,CACvD,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EAAA,CAAI,IACN,CAAA,CAEMC,CAAyBC,CAAAA,CAAAA,EAAwC,CACrE,GAAM,CAACC,CAAUC,CAAAA,CAAI,CAAIF,CAAAA,CAAAA,CAAQ,MAAM,GAAG,CAAA,CAE1C,OAAIC,CAAa,GAAA,SAAA,CACRH,EAAoBI,CAAI,CAAA,EAAK,GAGlCD,CAAAA,CAAAA,GAAa,OACR,CAAA,OAAA,CAGF,GACT,CAIME,CAAAA,CAAAA,CAAqC,CACzC,KAAA,CAAO,YACP,CA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,CAAE,MAAM,GAAG,CAAA,CAAE,GAAI,EAAA,CAC1B,cACR,CAAA,OAAOD,EAAsBqB,CAA4B,CAC3D,CAAG,CAAA,CAACpB,CAAO,CAAC,EAIZ,OAEES,kBAAAA,CAAA,aAJiBE,CAAAA,CAAAA,EAAMQ,CAItB,CAAA,CACC,IAAKH,CACL,CAAA,SAAA,CAAW,CAAyBC,sBAAAA,EAAAA,CAAiB,CAAIC,CAAAA,EAAAA,CAAY,IACnEJ,CAAS,CAAA,CAAA,CAAA,EAAIX,CAAWW,CAAAA,CAAM,CAAC,CAAA,CAAA,CAAK,EACtC,CAAIF,CAAAA,EAAAA,CAAAA,EAAa,EAAE,CAAA,CAAA,CAClB,GAAGG,CAAAA,CAAAA,CAEHF,CACH,CAEJ,CACF,EAEAL,CAAAA,CAAK,WAAc,CAAA,MAAA","file":"Text.cjs","sourcesContent":["import React from \"react\";\nimport {\n Colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} 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 ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\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\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\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\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 Array.isArray(variants) ? `lg:text-${variant}` : `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-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 && color === \"inherit\" ? \"inherit\" : color ? `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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import o from'react';var g={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},H=e=>{let[t,r]=e.split("-");return t==="heading"?g[r]||"p":t==="label"?"label":"p"},d={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},h=e=>e?(Array.isArray(e)?e:[e]).map(r=>{if(r.includes(":")){let[a,n]=r.split(":");return `${a}:text-${n}`}return Array.isArray(e)?`lg:text-${r}`:`text-${r}`}).join(" "):"text-body-default",M=o.forwardRef(({variant:e="body-default",color:t="text-primary",as:r,className:a,children:n,weight:l,...s},T)=>{let p=h(e),i=t&&t==="inherit"?"inherit":t?`text-${t}`:"",y=o.useMemo(()=>{let m=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return H(m)},[e]);return o.createElement(r||y,{ref:T,className:`font-sans antialiased ${p} ${i} ${l?`!${d[l]}`:""} ${a??""}`,...s},n)});M.displayName="Text";if (exports.default) module.exports = exports.default;export{M as Text};//# sourceMappingURL=Text.js.map
|
|
2
|
+
//# sourceMappingURL=Text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Text.tsx"],"names":["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"],"mappings":"qBA4FMA,IAAAA,CAAAA,CAAmD,CACvD,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EAAA,CAAI,IACN,CAAA,CAEMC,CAAyBC,CAAAA,CAAAA,EAAwC,CACrE,GAAM,CAACC,CAAUC,CAAAA,CAAI,CAAIF,CAAAA,CAAAA,CA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AAA,OAAA,CAAQ,IAAM,CAC3C,IAAMW,CACJ,CAAA,OAAOpB,CAAY,EAAA,QAAA,CACfA,EAAQ,KAAM,CAAA,GAAG,CAAE,CAAA,GAAA,EACnB,CAAA,KAAA,CAAM,QAAQA,CAAO,CAAA,CACnBA,EAAQ,CAAC,CAAA,CAAE,MAAM,GAAG,CAAA,CAAE,GAAI,EAAA,CAC1B,cACR,CAAA,OAAOD,EAAsBqB,CAA4B,CAC3D,CAAG,CAAA,CAACpB,CAAO,CAAC,EAIZ,OAEES,CAAAA,CAAA,aAJiBE,CAAAA,CAAAA,EAAMQ,CAItB,CAAA,CACC,IAAKH,CACL,CAAA,SAAA,CAAW,CAAyBC,sBAAAA,EAAAA,CAAiB,CAAIC,CAAAA,EAAAA,CAAY,IACnEJ,CAAS,CAAA,CAAA,CAAA,EAAIX,CAAWW,CAAAA,CAAM,CAAC,CAAA,CAAA,CAAK,EACtC,CAAIF,CAAAA,EAAAA,CAAAA,EAAa,EAAE,CAAA,CAAA,CAClB,GAAGG,CAAAA,CAAAA,CAEHF,CACH,CAEJ,CACF,EAEAL,CAAAA,CAAK,WAAc,CAAA,MAAA","file":"Text.js","sourcesContent":["import React from \"react\";\nimport {\n Colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} 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 ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\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\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\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\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 Array.isArray(variants) ? `lg:text-${variant}` : `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-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 && color === \"inherit\" ? \"inherit\" : color ? `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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var i=require('react'),t=require('@radix-ui/react-tooltip'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');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 i__namespace=/*#__PURE__*/_interopNamespace(i);var t__namespace=/*#__PURE__*/_interopNamespace(t);function e(...o){return tailwindMerge.twMerge(clsx.clsx(o))}var f=({content:o,children:r,side:a="bottom",align:l="center",className:n,delayDuration:m=200})=>i__namespace.createElement(t__namespace.Provider,{delayDuration:m},i__namespace.createElement(t__namespace.Root,null,i__namespace.createElement(t__namespace.Trigger,{asChild:!0},i__namespace.createElement("span",{tabIndex:0},r)),i__namespace.createElement(t__namespace.Portal,null,i__namespace.createElement(t__namespace.Content,{side:a,align:l,sideOffset:4,className:e("z-50 overflow-hidden rounded-lg","bg-text-primary px-3 py-1.5","text-xs text-white","animate-in fade-in-0 zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0","data-[side=bottom]:slide-in-from-top-2","data-[side=top]:slide-in-from-bottom-2","select-none","max-w-60",n)},o,i__namespace.createElement(t__namespace.Arrow,{className:"fill-text-primary",width:10,height:5})))));if (exports.default) module.exports = exports.default;exports.Tooltip=f;//# sourceMappingURL=Tooltip.cjs.map
|
|
2
|
+
//# sourceMappingURL=Tooltip.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Tooltip.tsx"],"names":["cn","inputs","twMerge","clsx","Tooltip","content","children","side","align","className","delayDuration","i","t"],"mappings":"+hBAGO,SAASA,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,qBAAQC,CAAAA,SAAAA,CAAKF,CAAM,CAAC,CAC7B,KCQaG,CAAU,CAAA,CAAC,CACtB,OAAAC,CAAAA,CAAAA,CACA,SAAAC,CACA,CAAA,IAAA,CAAAC,CAAO,CAAA,QAAA,CACP,KAAAC,CAAAA,CAAAA,CAAQ,SACR,SAAAC,CAAAA,CAAAA,CACA,aAAAC,CAAAA,CAAAA,CAAgB,GAClB,CAAA,GACEC,2BAAkBC,YAAjB,CAAA,QAAA,CAAA,CAA0B,aAAeF,CAAAA,CAAAA,CAAAA,CACxCC,YAAkB,CAAA,aAAA,CAAAC,YAAA,CAAA,IAAA,CAAjB,KACCD,YAAkB,CAAA,aAAA,CAAAC,YAAA,CAAA,OAAA,CAAjB,CAAyB,OAAO,CAAA,CAAA,CAAA,CAAA,CAE/BD,2BAAC,MAAK,CAAA,CAAA,QAAA,CAAU,CAAIL,CAAAA,CAAAA,CAAS,CAC/B,CAAA,CACAK,2BAAkBC,YAAjB,CAAA,MAAA,CAAA,IAAA,CACCD,2BAAkBC,YAAjB,CAAA,OAAA,CAAA,CACC,KAAML,CACN,CAAA,KAAA,CAAOC,CACP,CAAA,UAAA,CAAY,CACZ,CAAA,SAAA,CAAWR,EACT,iCACA,CAAA,6BAAA,CACA,qBACA,iCACA,CAAA,gEAAA,CACA,yCACA,wCACA,CAAA,aAAA,CACA,UACAS,CAAAA,CACF,CAECJ,CAAAA,CAAAA,CAAAA,CACDM,2BAAkBC,YAAjB,CAAA,KAAA,CAAA,CACC,SAAU,CAAA,mBAAA,CACV,KAAO,CAAA,EAAA,CACP,OAAQ,CACV,CAAA,CACF,CACF,CACF,CACF","file":"Tooltip.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 * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"../utils\";\n\nexport interface TooltipProps {\n content: React.ReactNode;\n children: React.ReactNode;\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n align?: \"start\" | \"center\" | \"end\";\n className?: string;\n delayDuration?: number;\n}\n\nexport const Tooltip = ({\n content,\n children,\n side = \"bottom\",\n align = \"center\",\n className,\n delayDuration = 200\n}: TooltipProps) => (\n <TooltipPrimitive.Provider delayDuration={delayDuration}>\n <TooltipPrimitive.Root>\n <TooltipPrimitive.Trigger asChild>\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <span tabIndex={0}>{children}</span>\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n side={side}\n align={align}\n sideOffset={4}\n className={cn(\n \"z-50 overflow-hidden rounded-lg\",\n \"bg-text-primary px-3 py-1.5\",\n \"text-xs text-white\",\n \"animate-in fade-in-0 zoom-in-95\",\n \"data-[state=closed]:animate-out data-[state=closed]:fade-out-0\",\n \"data-[side=bottom]:slide-in-from-top-2\",\n \"data-[side=top]:slide-in-from-bottom-2\",\n \"select-none\",\n \"max-w-60\",\n className\n )}\n >\n {content}\n <TooltipPrimitive.Arrow\n className=\"fill-text-primary\"\n width={10}\n height={5}\n />\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.Provider>\n);\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as i from'react';import*as t from'@radix-ui/react-tooltip';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function e(...o){return twMerge(clsx(o))}var f=({content:o,children:r,side:a="bottom",align:l="center",className:n,delayDuration:m=200})=>i.createElement(t.Provider,{delayDuration:m},i.createElement(t.Root,null,i.createElement(t.Trigger,{asChild:!0},i.createElement("span",{tabIndex:0},r)),i.createElement(t.Portal,null,i.createElement(t.Content,{side:a,align:l,sideOffset:4,className:e("z-50 overflow-hidden rounded-lg","bg-text-primary px-3 py-1.5","text-xs text-white","animate-in fade-in-0 zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0","data-[side=bottom]:slide-in-from-top-2","data-[side=top]:slide-in-from-bottom-2","select-none","max-w-60",n)},o,i.createElement(t.Arrow,{className:"fill-text-primary",width:10,height:5})))));if (exports.default) module.exports = exports.default;export{f as Tooltip};//# sourceMappingURL=Tooltip.js.map
|
|
2
|
+
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Tooltip.tsx"],"names":["cn","inputs","twMerge","clsx","Tooltip","content","children","side","align","className","delayDuration"],"mappings":"+HAGO,SAASA,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,KCQaG,CAAU,CAAA,CAAC,CACtB,OAAAC,CAAAA,CAAAA,CACA,SAAAC,CACA,CAAA,IAAA,CAAAC,CAAO,CAAA,QAAA,CACP,KAAAC,CAAAA,CAAAA,CAAQ,SACR,SAAAC,CAAAA,CAAAA,CACA,aAAAC,CAAAA,CAAAA,CAAgB,GAClB,CAAA,GACE,gBAAkB,CAAjB,CAAA,QAAA,CAAA,CAA0B,aAAeA,CAAAA,CAAAA,CAAAA,CACxC,CAAkB,CAAA,aAAA,CAAA,CAAA,CAAA,IAAA,CAAjB,KACC,CAAkB,CAAA,aAAA,CAAA,CAAA,CAAA,OAAA,CAAjB,CAAyB,OAAO,CAAA,CAAA,CAAA,CAAA,CAE/B,gBAAC,MAAK,CAAA,CAAA,QAAA,CAAU,CAAIJ,CAAAA,CAAAA,CAAS,CAC/B,CAAA,CACA,gBAAkB,CAAjB,CAAA,MAAA,CAAA,IAAA,CACC,gBAAkB,CAAjB,CAAA,OAAA,CAAA,CACC,KAAMC,CACN,CAAA,KAAA,CAAOC,CACP,CAAA,UAAA,CAAY,CACZ,CAAA,SAAA,CAAWR,EACT,iCACA,CAAA,6BAAA,CACA,qBACA,iCACA,CAAA,gEAAA,CACA,yCACA,wCACA,CAAA,aAAA,CACA,UACAS,CAAAA,CACF,CAECJ,CAAAA,CAAAA,CAAAA,CACD,gBAAkB,CAAjB,CAAA,KAAA,CAAA,CACC,SAAU,CAAA,mBAAA,CACV,KAAO,CAAA,EAAA,CACP,OAAQ,CACV,CAAA,CACF,CACF,CACF,CACF","file":"Tooltip.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 * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"../utils\";\n\nexport interface TooltipProps {\n content: React.ReactNode;\n children: React.ReactNode;\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n align?: \"start\" | \"center\" | \"end\";\n className?: string;\n delayDuration?: number;\n}\n\nexport const Tooltip = ({\n content,\n children,\n side = \"bottom\",\n align = \"center\",\n className,\n delayDuration = 200\n}: TooltipProps) => (\n <TooltipPrimitive.Provider delayDuration={delayDuration}>\n <TooltipPrimitive.Root>\n <TooltipPrimitive.Trigger asChild>\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <span tabIndex={0}>{children}</span>\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n side={side}\n align={align}\n sideOffset={4}\n className={cn(\n \"z-50 overflow-hidden rounded-lg\",\n \"bg-text-primary px-3 py-1.5\",\n \"text-xs text-white\",\n \"animate-in fade-in-0 zoom-in-95\",\n \"data-[state=closed]:animate-out data-[state=closed]:fade-out-0\",\n \"data-[side=bottom]:slide-in-from-top-2\",\n \"data-[side=top]:slide-in-from-bottom-2\",\n \"select-none\",\n \"max-w-60\",\n className\n )}\n >\n {content}\n <TooltipPrimitive.Arrow\n className=\"fill-text-primary\"\n width={10}\n height={5}\n />\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.Provider>\n);\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var n=require('react'),icons=require('@deckai/icons'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var n__default=/*#__PURE__*/_interopDefault(n);function g(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var u={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB"},E={sm:"@media (min-width: 640px)",md:"@media (min-width: 768px)",lg:"@media (min-width: 1024px)",xl:"@media (min-width: 1280px)","2xl":"@media (min-width: 1536px)"},C=e=>{if(!e)return {width:"24px",height:"24px"};let t=Array.isArray(e)?e:[e],r=typeof t[0]=="number"?t[0]:24,o={width:`${r}px`,height:`${r}px`},i=t.filter(a=>typeof a=="string"&&a.includes(":")).reduce((a,s)=>{let[m,l]=s.split(":");return a[E[m]]={width:`${l}px`,height:`${l}px`},a},{});return Object.keys(i).length>0&&(o["@media"]=i),o},d=n__default.default.forwardRef(({name:e,size:t=24,color:r="primary",title:o,className:i,style:a={},...s},m)=>{let l=icons.IconMap[e],y=C(t);return n__default.default.createElement("div",{className:g("flex justify-center items-center",i),style:{...y,"--icon-stroke":u[r],...a}},n__default.default.createElement(l,{ref:m,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:u[r],...s}))});d.displayName="Icon";var A={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},k=e=>{let[t,r]=e.split("-");return t==="heading"?A[r]||"p":t==="label"?"label":"p"},R={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},S=e=>e?(Array.isArray(e)?e:[e]).map(r=>{if(r.includes(":")){let[o,i]=r.split(":");return `${o}:text-${i}`}return Array.isArray(e)?`lg:text-${r}`:`text-${r}`}).join(" "):"text-body-default",p=n__default.default.forwardRef(({variant:e="body-default",color:t="text-primary",as:r,className:o,children:i,weight:a,...s},m)=>{let l=S(e),y=t&&t==="inherit"?"inherit":t?`text-${t}`:"",f=n__default.default.useMemo(()=>{let b=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return k(b)},[e]);return n__default.default.createElement(r||f,{ref:m,className:`font-sans antialiased ${l} ${y} ${a?`!${R[a]}`:""} ${o??""}`,...s},i)});p.displayName="Text";var x=({children:e,padded:t,color:r="primary",...o})=>n__default.default.createElement("div",{className:`rounded bg-secondary-400 ${t?"px-3":"px-2"} py-1.5 h-min`,...o},typeof e=="string"?n__default.default.createElement(p,{color:r==="primary"?"primary-100":"text-primary",variant:["body-default-medium","md:body-xs-medium"],className:"truncate"},e):e);var U=({socialIconName:e,tags:t,caption:r,playCount:o,backgroundImage:i})=>n__default.default.createElement("div",{className:"flex flex-col justify-between p-4 w-[292px] h-[403px] rounded-2xl relative overflow-hidden",style:{backgroundColor:"#e7e7e7",backgroundImage:`url(${i})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"}},n__default.default.createElement("div",{className:"flex justify-between px-4 py-2 items-center"},n__default.default.createElement("div",{className:"flex items-center justify-center bg-overlay h-10 w-10 rounded-full"},n__default.default.createElement(d,{name:e,size:20,className:"fill-white"})),n__default.default.createElement("div",{className:"flex gap-2 items-center"},t.map((a,s)=>n__default.default.createElement(x,{padded:!0,key:s,color:"text"},a)))),n__default.default.createElement("div",{className:"flex flex-col gap-1 p-2 rounded-lg bg-overlay"},n__default.default.createElement(p,{variant:"body-default-medium",className:"text-white"},r),n__default.default.createElement("div",{className:"flex gap-2"},n__default.default.createElement(d,{name:"play",size:16,color:"white"}),n__default.default.createElement(p,{variant:"body-xs-medium",className:"text-white"},o))));if (exports.default) module.exports = exports.default;exports.WorkCard=U;//# sourceMappingURL=WorkCard.cjs.map
|
|
2
|
+
//# sourceMappingURL=WorkCard.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx","../../src/components/Text.tsx","../../src/components/Tag.tsx","../../src/components/WorkCard.tsx"],"names":["cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","baseSize","style","mediaQueries","size","acc","breakpoint","value","Icon","React","name","color","title","className","props","ref","IconComponent","IconMap","sizeStyles","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","fontWeight","processVariants","variants","typographyClass","Text","as","children","weight","typographyClasses","colorClasses","suggestedElement","baseVariant","Tag","padded","WorkCard","socialIconName","tags","caption","playCount","backgroundImage","tag","index"],"mappings":"gPAGO,SAASA,CAAAA,CAAAA,GAAMC,EAAsB,CAC1C,OAAOC,qBAAQC,CAAAA,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CCWA,IAAMG,EAAwC,CAC5C,OAAA,CAAS,SACT,CAAA,SAAA,CAAW,UACX,KAAO,CAAA,SAAA,CACP,WAAa,CAAA,SACf,EAKMC,CAA6C,CAAA,CACjD,EAAI,CAAA,2BAAA,CACJ,GAAI,2BACJ,CAAA,EAAA,CAAI,4BACJ,CAAA,EAAA,CAAI,6BACJ,KAAO,CAAA,4BACT,CAEMC,CAAAA,CAAAA,CACJC,GACwB,CACxB,GAAI,CAACA,CAAAA,CAAO,OAAO,CAAE,KAAA,CAAO,MAAQ,CAAA,MAAA,CAAQ,MAAO,CAEnD,CAAA,IAAMC,CAAY,CAAA,KAAA,CAAM,QAAQD,CAAK,CAAA,CAAIA,CAAQ,CAAA,CAACA,CAAK,CACjDE,CAAAA,CAAAA,CAAW,OAAOD,CAAAA,CAAU,CAAC,CAAM,EAAA,QAAA,CAAWA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AAA,CAAA,CAAK,IAAM8B,CAAAA,CAAAA,CAAgB,IAAM,CAAA,EAAA,CAAI,UAAU,YAAa,CAAA,CAC/D,CACA7B,CAAAA,kBAAAA,CAAA,cAAC,KAAI,CAAA,CAAA,SAAA,CAAU,yBACZ8B,CAAAA,CAAAA,CAAAA,CAAK,IAAI,CAACI,CAAAA,CAAKC,CACdnC,GAAAA,kBAAAA,CAAA,cAAC0B,CAAA,CAAA,CAAI,MAAM,CAAA,CAAA,CAAA,CAAC,IAAKS,CAAO,CAAA,KAAA,CAAM,MAC3BD,CAAAA,CAAAA,CACH,CACD,CACH,CACF,CACAlC,CAAAA,kBAAAA,CAAA,cAAC,KAAI,CAAA,CAAA,SAAA,CAAU,+CACbA,CAAAA,CAAAA,kBAAAA,CAAA,cAACkB,CAAA,CAAA,CAAK,OAAQ,CAAA,qBAAA,CAAsB,UAAU,YAC3Ca,CAAAA,CAAAA,CACH,CACA/B,CAAAA,kBAAAA,CAAA,cAAC,KAAI,CAAA,CAAA,SAAA,CAAU,YACbA,CAAAA,CAAAA,kBAAAA,CAAA,cAACD,CAAA,CAAA,CAAK,IAAK,CAAA,MAAA,CAAO,KAAM,EAAI,CAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,CAC1CC,mBAAA,aAACkB,CAAAA,CAAAA,CAAA,CAAK,OAAA,CAAQ,iBAAiB,SAAU,CAAA,YAAA,CAAA,CACtCc,CACH,CACF,CACF,CACF","file":"WorkCard.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\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: number | `${Breakpoint}:${number}`;\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};\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"@media (min-width: 640px)\",\n md: \"@media (min-width: 768px)\",\n lg: \"@media (min-width: 1024px)\",\n xl: \"@media (min-width: 1280px)\",\n \"2xl\": \"@media (min-width: 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 baseSize = typeof sizeArray[0] === \"number\" ? sizeArray[0] : 24;\n\n const style: React.CSSProperties = {\n width: `${baseSize}px`,\n height: `${baseSize}px`\n };\n\n // Add media queries for responsive sizes\n const mediaQueries = sizeArray\n .filter(\n (size): size is `${Breakpoint}:${number}` =>\n typeof size === \"string\" && size.includes(\":\")\n )\n .reduce(\n (acc, size) => {\n const [breakpoint, value] = size.split(\":\") as [Breakpoint, string];\n acc[BREAKPOINT_MAP[breakpoint]] = {\n width: `${value}px`,\n height: `${value}px`\n };\n return acc;\n },\n {} as Record<string, React.CSSProperties>\n );\n\n if (Object.keys(mediaQueries).length > 0) {\n (style as any)[\"@media\"] = mediaQueries;\n }\n\n return style;\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 from \"react\";\nimport {\n Colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} 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 ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\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\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\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\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 Array.isArray(variants) ? `lg:text-${variant}` : `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-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 && color === \"inherit\" ? \"inherit\" : color ? `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 React, { HTMLAttributes } from \"react\";\nimport { Text } from \"./Text\";\n\nexport type TagProps = {\n children: React.ReactNode;\n padded?: boolean;\n color?: \"primary\" | \"text\";\n} & HTMLAttributes<HTMLDivElement>;\n\nexport const Tag = ({\n children,\n padded,\n color = \"primary\",\n ...props\n}: TagProps) => (\n <div\n className={`rounded bg-secondary-400 ${padded ? \"px-3\" : \"px-2\"} py-1.5 h-min`}\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text\n color={color === \"primary\" ? \"primary-100\" : \"text-primary\"}\n variant={[\"body-default-medium\", \"md:body-xs-medium\"]}\n className=\"truncate\"\n >\n {children}\n </Text>\n ) : (\n children\n )}\n </div>\n);\n","import React from \"react\";\nimport { Icon } from \"./Icon\";\nimport { Tag } from \"./Tag\";\nimport { Text } from \"./Text\";\n\nexport type WorkCardProps = {\n socialIconName: \"instagram-filled\" | \"tiktok-filled\" | \"youtube-filled\";\n tags: string[];\n caption: string;\n /** play count should already be formatted with k or m */\n playCount: string;\n backgroundImage: string;\n};\n\nexport const WorkCard = ({\n socialIconName,\n tags,\n caption,\n playCount,\n backgroundImage\n}: WorkCardProps) => {\n return (\n <div\n className={`flex flex-col justify-between p-4 w-[292px] h-[403px] rounded-2xl relative overflow-hidden`}\n style={{\n backgroundColor: \"#e7e7e7\",\n backgroundImage: `url(${backgroundImage})`,\n backgroundSize: \"cover\",\n backgroundPosition: \"center\",\n backgroundRepeat: \"no-repeat\"\n }}\n >\n <div className=\"flex justify-between px-4 py-2 items-center\">\n <div className=\"flex items-center justify-center bg-overlay h-10 w-10 rounded-full\">\n <Icon name={socialIconName} size={20} className=\"fill-white\" />\n </div>\n <div className=\"flex gap-2 items-center\">\n {tags.map((tag, index) => (\n <Tag padded key={index} color=\"text\">\n {tag}\n </Tag>\n ))}\n </div>\n </div>\n <div className=\"flex flex-col gap-1 p-2 rounded-lg bg-overlay\">\n <Text variant=\"body-default-medium\" className=\"text-white\">\n {caption}\n </Text>\n <div className=\"flex gap-2\">\n <Icon name=\"play\" size={16} color=\"white\" />\n <Text variant=\"body-xs-medium\" className=\"text-white\">\n {playCount}\n </Text>\n </div>\n </div>\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import n from'react';import {IconMap}from'@deckai/icons';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function g(...e){return twMerge(clsx(e))}var u={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB"},E={sm:"@media (min-width: 640px)",md:"@media (min-width: 768px)",lg:"@media (min-width: 1024px)",xl:"@media (min-width: 1280px)","2xl":"@media (min-width: 1536px)"},C=e=>{if(!e)return {width:"24px",height:"24px"};let t=Array.isArray(e)?e:[e],r=typeof t[0]=="number"?t[0]:24,o={width:`${r}px`,height:`${r}px`},i=t.filter(a=>typeof a=="string"&&a.includes(":")).reduce((a,s)=>{let[m,l]=s.split(":");return a[E[m]]={width:`${l}px`,height:`${l}px`},a},{});return Object.keys(i).length>0&&(o["@media"]=i),o},d=n.forwardRef(({name:e,size:t=24,color:r="primary",title:o,className:i,style:a={},...s},m)=>{let l=IconMap[e],y=C(t);return n.createElement("div",{className:g("flex justify-center items-center",i),style:{...y,"--icon-stroke":u[r],...a}},n.createElement(l,{ref:m,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:u[r],...s}))});d.displayName="Icon";var A={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},k=e=>{let[t,r]=e.split("-");return t==="heading"?A[r]||"p":t==="label"?"label":"p"},R={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},S=e=>e?(Array.isArray(e)?e:[e]).map(r=>{if(r.includes(":")){let[o,i]=r.split(":");return `${o}:text-${i}`}return Array.isArray(e)?`lg:text-${r}`:`text-${r}`}).join(" "):"text-body-default",p=n.forwardRef(({variant:e="body-default",color:t="text-primary",as:r,className:o,children:i,weight:a,...s},m)=>{let l=S(e),y=t&&t==="inherit"?"inherit":t?`text-${t}`:"",f=n.useMemo(()=>{let b=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return k(b)},[e]);return n.createElement(r||f,{ref:m,className:`font-sans antialiased ${l} ${y} ${a?`!${R[a]}`:""} ${o??""}`,...s},i)});p.displayName="Text";var x=({children:e,padded:t,color:r="primary",...o})=>n.createElement("div",{className:`rounded bg-secondary-400 ${t?"px-3":"px-2"} py-1.5 h-min`,...o},typeof e=="string"?n.createElement(p,{color:r==="primary"?"primary-100":"text-primary",variant:["body-default-medium","md:body-xs-medium"],className:"truncate"},e):e);var U=({socialIconName:e,tags:t,caption:r,playCount:o,backgroundImage:i})=>n.createElement("div",{className:"flex flex-col justify-between p-4 w-[292px] h-[403px] rounded-2xl relative overflow-hidden",style:{backgroundColor:"#e7e7e7",backgroundImage:`url(${i})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"}},n.createElement("div",{className:"flex justify-between px-4 py-2 items-center"},n.createElement("div",{className:"flex items-center justify-center bg-overlay h-10 w-10 rounded-full"},n.createElement(d,{name:e,size:20,className:"fill-white"})),n.createElement("div",{className:"flex gap-2 items-center"},t.map((a,s)=>n.createElement(x,{padded:!0,key:s,color:"text"},a)))),n.createElement("div",{className:"flex flex-col gap-1 p-2 rounded-lg bg-overlay"},n.createElement(p,{variant:"body-default-medium",className:"text-white"},r),n.createElement("div",{className:"flex gap-2"},n.createElement(d,{name:"play",size:16,color:"white"}),n.createElement(p,{variant:"body-xs-medium",className:"text-white"},o))));if (exports.default) module.exports = exports.default;export{U as WorkCard};//# sourceMappingURL=WorkCard.js.map
|
|
2
|
+
//# sourceMappingURL=WorkCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx","../../src/components/Text.tsx","../../src/components/Tag.tsx","../../src/components/WorkCard.tsx"],"names":["cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","baseSize","style","mediaQueries","size","acc","breakpoint","value","Icon","React","name","color","title","className","props","ref","IconComponent","IconMap","sizeStyles","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","fontWeight","processVariants","variants","typographyClass","Text","as","children","weight","typographyClasses","colorClasses","suggestedElement","baseVariant","Tag","padded","WorkCard","socialIconName","tags","caption","playCount","backgroundImage","tag","index"],"mappings":"sHAGO,SAASA,CAAAA,CAAAA,GAAMC,EAA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,CAAAA,CAAAA,CAAA,cAACD,CAAA,CAAA,CAAK,IAAK,CAAA,MAAA,CAAO,KAAM,EAAI,CAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,CAC1CC,EAAA,aAACkB,CAAAA,CAAAA,CAAA,CAAK,OAAA,CAAQ,iBAAiB,SAAU,CAAA,YAAA,CAAA,CACtCc,CACH,CACF,CACF,CACF","file":"WorkCard.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, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: number | `${Breakpoint}:${number}`;\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};\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"@media (min-width: 640px)\",\n md: \"@media (min-width: 768px)\",\n lg: \"@media (min-width: 1024px)\",\n xl: \"@media (min-width: 1280px)\",\n \"2xl\": \"@media (min-width: 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 baseSize = typeof sizeArray[0] === \"number\" ? sizeArray[0] : 24;\n\n const style: React.CSSProperties = {\n width: `${baseSize}px`,\n height: `${baseSize}px`\n };\n\n // Add media queries for responsive sizes\n const mediaQueries = sizeArray\n .filter(\n (size): size is `${Breakpoint}:${number}` =>\n typeof size === \"string\" && size.includes(\":\")\n )\n .reduce(\n (acc, size) => {\n const [breakpoint, value] = size.split(\":\") as [Breakpoint, string];\n acc[BREAKPOINT_MAP[breakpoint]] = {\n width: `${value}px`,\n height: `${value}px`\n };\n return acc;\n },\n {} as Record<string, React.CSSProperties>\n );\n\n if (Object.keys(mediaQueries).length > 0) {\n (style as any)[\"@media\"] = mediaQueries;\n }\n\n return style;\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 from \"react\";\nimport {\n Colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} 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 ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\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\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\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\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 Array.isArray(variants) ? `lg:text-${variant}` : `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-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 && color === \"inherit\" ? \"inherit\" : color ? `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 React, { HTMLAttributes } from \"react\";\nimport { Text } from \"./Text\";\n\nexport type TagProps = {\n children: React.ReactNode;\n padded?: boolean;\n color?: \"primary\" | \"text\";\n} & HTMLAttributes<HTMLDivElement>;\n\nexport const Tag = ({\n children,\n padded,\n color = \"primary\",\n ...props\n}: TagProps) => (\n <div\n className={`rounded bg-secondary-400 ${padded ? \"px-3\" : \"px-2\"} py-1.5 h-min`}\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text\n color={color === \"primary\" ? \"primary-100\" : \"text-primary\"}\n variant={[\"body-default-medium\", \"md:body-xs-medium\"]}\n className=\"truncate\"\n >\n {children}\n </Text>\n ) : (\n children\n )}\n </div>\n);\n","import React from \"react\";\nimport { Icon } from \"./Icon\";\nimport { Tag } from \"./Tag\";\nimport { Text } from \"./Text\";\n\nexport type WorkCardProps = {\n socialIconName: \"instagram-filled\" | \"tiktok-filled\" | \"youtube-filled\";\n tags: string[];\n caption: string;\n /** play count should already be formatted with k or m */\n playCount: string;\n backgroundImage: string;\n};\n\nexport const WorkCard = ({\n socialIconName,\n tags,\n caption,\n playCount,\n backgroundImage\n}: WorkCardProps) => {\n return (\n <div\n className={`flex flex-col justify-between p-4 w-[292px] h-[403px] rounded-2xl relative overflow-hidden`}\n style={{\n backgroundColor: \"#e7e7e7\",\n backgroundImage: `url(${backgroundImage})`,\n backgroundSize: \"cover\",\n backgroundPosition: \"center\",\n backgroundRepeat: \"no-repeat\"\n }}\n >\n <div className=\"flex justify-between px-4 py-2 items-center\">\n <div className=\"flex items-center justify-center bg-overlay h-10 w-10 rounded-full\">\n <Icon name={socialIconName} size={20} className=\"fill-white\" />\n </div>\n <div className=\"flex gap-2 items-center\">\n {tags.map((tag, index) => (\n <Tag padded key={index} color=\"text\">\n {tag}\n </Tag>\n ))}\n </div>\n </div>\n <div className=\"flex flex-col gap-1 p-2 rounded-lg bg-overlay\">\n <Text variant=\"body-default-medium\" className=\"text-white\">\n {caption}\n </Text>\n <div className=\"flex gap-2\">\n <Icon name=\"play\" size={16} color=\"white\" />\n <Text variant=\"body-xs-medium\" className=\"text-white\">\n {playCount}\n </Text>\n </div>\n </div>\n </div>\n );\n};\n"]}
|