@deckai/deck-ui 0.0.7 → 0.0.9
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.d.cts +12 -0
- package/dist/components/AboutCard.d.ts +12 -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.d.cts +10 -0
- package/dist/components/Avatar.d.ts +10 -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.d.cts +13 -0
- package/dist/components/Badge.d.ts +13 -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.d.cts +15 -0
- package/dist/components/Breadcrumbs.d.ts +15 -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.d.cts +28 -0
- package/dist/components/Button.d.ts +28 -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.d.cts +14 -0
- package/dist/components/Combobox.d.ts +14 -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.d.cts +11 -0
- package/dist/components/ContactItem.d.ts +11 -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.d.cts +18 -0
- package/dist/components/Icon.d.ts +18 -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.d.cts +14 -0
- package/dist/components/Input.d.ts +14 -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.d.cts +13 -0
- package/dist/components/Link.d.ts +13 -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.d.cts +11 -0
- package/dist/components/Logo.d.ts +11 -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.d.cts +19 -0
- package/dist/components/Navbar.d.ts +19 -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.d.cts +13 -0
- package/dist/components/NavbarItem.d.ts +13 -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.d.cts +11 -0
- package/dist/components/Option.d.ts +11 -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.d.cts +6 -0
- package/dist/components/Pressable.d.ts +6 -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.d.cts +15 -0
- package/dist/components/ProfileCard.d.ts +15 -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.d.cts +12 -0
- package/dist/components/SocialCard.d.ts +12 -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.d.cts +13 -0
- package/dist/components/Switch.d.ts +13 -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.d.cts +16 -0
- package/dist/components/Tabs.d.ts +16 -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.d.cts +10 -0
- package/dist/components/Tag.d.ts +10 -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.d.cts +46 -0
- package/dist/components/Text.d.ts +46 -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.d.cts +13 -0
- package/dist/components/Tooltip.d.ts +13 -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.d.cts +13 -0
- package/dist/components/WorkCard.d.ts +13 -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.d.cts +29 -288
- package/dist/index.d.ts +29 -288
- 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/dist/tailwind-DJFscIlV.d.cts +35 -0
- package/dist/tailwind-DJFscIlV.d.ts +35 -0
- package/package.json +10 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Text.tsx","../../src/utils/tailwind.ts","../../src/components/Button.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","focusRingStyles","filled","outlined","Button","n","isLoading","disabled"],"mappings":"0YA4FA,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,C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Ae;AAAA;AAAA;AAAA;AAAA,UAAA,EAIfrB,IAAY,QAAWsB,CAAAA,CAAAA,CAAOZ,CAAK,CAAIa,CAAAA,CAAAA,CAASb,CAAK,CAAC;AAAA,UAAA,EACtDE,CAAS;AAAA,QAEf,CAAA,CAAA,QAAA,CAAUe,GAAYD,CACtB,CAAA,IAAA,CAAK,SACJ,GAAGX,CAAAA,CAAAA,CAEH,OAAOF,CAAAA,EAAa,QACnB,CAAAY,YAAA,CAAA,aAAA,CAACjB,EAAA,CAAK,OAAA,CAAQ,mBAAoB,CAAA,KAAA,CAAM,SACrCK,CAAAA,CAAAA,CACH,EAEAA,CAEJ,CAEJ,EAEAW,CAAAA,CAAO,WAAc,CAAA,QAAA","file":"Button.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 { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import * as React from \"react\";\nimport { Text } from \"./Text\";\nimport { focusRingStyles } from \"../utils/tailwind\";\n\nexport type ButtonProps = {\n /** @default filled */\n variant?: \"filled\" | \"outlined\";\n /** @default primary */\n color?: \"black\" | \"accent\" | \"secondary\";\n isLoading?: boolean;\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n start?: React.ReactNode;\n end?: React.ReactNode;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nconst filled = {\n black: \"bg-text-primary text-white\",\n // fade it slightly\n accent: \"bg-primary-100 text-white\",\n secondary: \"bg-secondary-100 text-secondary\"\n};\n\nconst outlined = {\n black: \"border border-text-primary text-text-primary\",\n accent: \"border border-primary-100 text-primary-100\",\n secondary: \"border border-text-secondary text-secondary\"\n};\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"filled\",\n color = \"black\",\n isLoading = false,\n children,\n disabled,\n ...props\n },\n ref\n ) => (\n <button\n ref={ref}\n className={`\n px-7\n py-2\n inline-flex items-center justify-center\n rounded-lg \n transition-colors duration-200\n ${focusRingStyles}\n disabled:opacity-50 disabled:pointer-events-none\n hover:opacity-80 active:scale-95 \n truncate\n ${variant === \"filled\" ? filled[color] : outlined[color]}\n ${className}\n `}\n disabled={disabled || isLoading}\n type=\"button\"\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text variant=\"body-default-bold\" color=\"inherit\">\n {children}\n </Text>\n ) : (\n children\n )}\n </button>\n )\n);\n\nButton.displayName = \"Button\";\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type ButtonProps = {
|
|
4
|
+
/** @default filled */
|
|
5
|
+
variant?: "filled" | "outlined";
|
|
6
|
+
/** @default primary */
|
|
7
|
+
color?: "black" | "accent" | "secondary";
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
start?: React.ReactNode;
|
|
13
|
+
end?: React.ReactNode;
|
|
14
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
15
|
+
declare const Button: React.ForwardRefExoticComponent<{
|
|
16
|
+
/** @default filled */
|
|
17
|
+
variant?: "filled" | "outlined";
|
|
18
|
+
/** @default primary */
|
|
19
|
+
color?: "black" | "accent" | "secondary";
|
|
20
|
+
isLoading?: boolean;
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
className?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
start?: React.ReactNode;
|
|
25
|
+
end?: React.ReactNode;
|
|
26
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
27
|
+
|
|
28
|
+
export { Button, type ButtonProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type ButtonProps = {
|
|
4
|
+
/** @default filled */
|
|
5
|
+
variant?: "filled" | "outlined";
|
|
6
|
+
/** @default primary */
|
|
7
|
+
color?: "black" | "accent" | "secondary";
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
start?: React.ReactNode;
|
|
13
|
+
end?: React.ReactNode;
|
|
14
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
15
|
+
declare const Button: React.ForwardRefExoticComponent<{
|
|
16
|
+
/** @default filled */
|
|
17
|
+
variant?: "filled" | "outlined";
|
|
18
|
+
/** @default primary */
|
|
19
|
+
color?: "black" | "accent" | "secondary";
|
|
20
|
+
isLoading?: boolean;
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
className?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
start?: React.ReactNode;
|
|
25
|
+
end?: React.ReactNode;
|
|
26
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
27
|
+
|
|
28
|
+
export { Button, type ButtonProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import*as p from'react';import p__default from'react';var h={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},b=e=>{let[r,t]=e.split("-");return r==="heading"?h[t]||"p":r==="label"?"label":"p"},u={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},f=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[a,o]=t.split(":");return `${a}:text-${o}`}return Array.isArray(e)?`lg:text-${t}`:`text-${t}`}).join(" "):"text-body-default",y=p__default.forwardRef(({variant:e="body-default",color:r="text-primary",as:t,className:a,children:o,weight:s,...i},l)=>{let T=f(e),d=r&&r==="inherit"?"inherit":r?`text-${r}`:"",g=p__default.useMemo(()=>{let m=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return b(m)},[e]);return p__default.createElement(t||g,{ref:l,className:`font-sans antialiased ${T} ${d} ${s?`!${u[s]}`:""} ${a??""}`,...i},o)});y.displayName="Text";var c="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var H={black:"bg-text-primary text-white",accent:"bg-primary-100 text-white",secondary:"bg-secondary-100 text-secondary"},M={black:"border border-text-primary text-text-primary",accent:"border border-primary-100 text-primary-100",secondary:"border border-text-secondary text-secondary"},L=p.forwardRef(({className:e,variant:r="filled",color:t="black",isLoading:a=!1,children:o,disabled:s,...i},l)=>p.createElement("button",{ref:l,className:`
|
|
2
|
+
px-7
|
|
3
|
+
py-2
|
|
4
|
+
inline-flex items-center justify-center
|
|
5
|
+
rounded-lg
|
|
6
|
+
transition-colors duration-200
|
|
7
|
+
${c}
|
|
8
|
+
disabled:opacity-50 disabled:pointer-events-none
|
|
9
|
+
hover:opacity-80 active:scale-95
|
|
10
|
+
truncate
|
|
11
|
+
${r==="filled"?H[t]:M[t]}
|
|
12
|
+
${e}
|
|
13
|
+
`,disabled:s||a,type:"button",...i},typeof o=="string"?p.createElement(y,{variant:"body-default-bold",color:"inherit"},o):o));L.displayName="Button";if (exports.default) module.exports = exports.default;export{L as Button};//# sourceMappingURL=Button.js.map
|
|
14
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Text.tsx","../../src/utils/tailwind.ts","../../src/components/Button.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","focusRingStyles","filled","outlined","Button","n","isLoading","disabled"],"mappings":"sDA4FA,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,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CAAAA,EAAa,QACnB,CAAAY,CAAA,CAAA,aAAA,CAACjB,EAAA,CAAK,OAAA,CAAQ,mBAAoB,CAAA,KAAA,CAAM,SACrCK,CAAAA,CAAAA,CACH,EAEAA,CAEJ,CAEJ,EAEAW,CAAAA,CAAO,WAAc,CAAA,QAAA","file":"Button.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 { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import * as React from \"react\";\nimport { Text } from \"./Text\";\nimport { focusRingStyles } from \"../utils/tailwind\";\n\nexport type ButtonProps = {\n /** @default filled */\n variant?: \"filled\" | \"outlined\";\n /** @default primary */\n color?: \"black\" | \"accent\" | \"secondary\";\n isLoading?: boolean;\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n start?: React.ReactNode;\n end?: React.ReactNode;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nconst filled = {\n black: \"bg-text-primary text-white\",\n // fade it slightly\n accent: \"bg-primary-100 text-white\",\n secondary: \"bg-secondary-100 text-secondary\"\n};\n\nconst outlined = {\n black: \"border border-text-primary text-text-primary\",\n accent: \"border border-primary-100 text-primary-100\",\n secondary: \"border border-text-secondary text-secondary\"\n};\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"filled\",\n color = \"black\",\n isLoading = false,\n children,\n disabled,\n ...props\n },\n ref\n ) => (\n <button\n ref={ref}\n className={`\n px-7\n py-2\n inline-flex items-center justify-center\n rounded-lg \n transition-colors duration-200\n ${focusRingStyles}\n disabled:opacity-50 disabled:pointer-events-none\n hover:opacity-80 active:scale-95 \n truncate\n ${variant === \"filled\" ? filled[color] : outlined[color]}\n ${className}\n `}\n disabled={disabled || isLoading}\n type=\"button\"\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text variant=\"body-default-bold\" color=\"inherit\">\n {children}\n </Text>\n ) : (\n children\n )}\n </button>\n )\n);\n\nButton.displayName = \"Button\";\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var n=require('react'),c=require('@radix-ui/react-popover'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),icons=require('@deckai/icons');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var n__namespace=/*#__PURE__*/_interopNamespace(n);var c__namespace=/*#__PURE__*/_interopNamespace(c);function d(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var h="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",y="ring-2 ring-ring ring-offset-2";var C={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)"},V=e=>{if(!e)return {width:"24px",height:"24px"};let o=Array.isArray(e)?e:[e],t=typeof o[0]=="number"?o[0]:24,r={width:`${t}px`,height:`${t}px`},l=o.filter(s=>typeof s=="string"&&s.includes(":")).reduce((s,a)=>{let[m,i]=a.split(":");return s[E[m]]={width:`${i}px`,height:`${i}px`},s},{});return Object.keys(l).length>0&&(r["@media"]=l),r},x=n__namespace.default.forwardRef(({name:e,size:o=24,color:t="primary",title:r,className:l,style:s={},...a},m)=>{let i=icons.IconMap[e],u=V(o);return n__namespace.default.createElement("div",{className:d("flex justify-center items-center",l),style:{...u,"--icon-stroke":C[t],...s}},n__namespace.default.createElement(i,{ref:m,"aria-hidden":!r,"aria-label":r,stroke:e.includes("filled")?void 0:C[t],...a}))});x.displayName="Icon";var P=({className:e,end:o,iconName:t,color:r,size:l,title:s,...a})=>n__namespace.createElement("div",{className:"relative"},n__namespace.createElement("input",{className:d(`font-sans flex w-full rounded-lg border border-secondary-50 bg-background px-3 py-3 text-secondary ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text-primary ${h} disabled:cursor-not-allowed disabled:opacity-50 md:text-md`,o&&"pr-10",e),...a}),o&&n__namespace.createElement("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3"},t?n__namespace.createElement(x,{name:t,color:r,size:l,title:s}):o));var $=({value:e,label:o,onChange:t,selected:r})=>n__namespace.default.createElement("button",{type:"button",className:d("relative w-full h-full text-left px-2 py-1.5 text-sm cursor-pointer hover:bg-gray-100 rounded",r&&"bg-gray-100"),onClick:()=>{t?.(e);}},o);var ne=({options:e,placeholder:o="Select an item...",value:t,onChange:r,end:l,className:s})=>{let[a,m]=n.useState(!1),[i,u]=n.useState(t),b=n.useMemo(()=>e.find(p=>p.value===i),[i,e]),v=e.filter(p=>i?p.label.toLowerCase().includes(i.toLowerCase()):e),I=n.useCallback(p=>{r(p),m(!1),u(b?.label);},[r,b?.label]);return console.log({open:a},"wtf"),n__namespace.default.createElement(c__namespace.Root,{open:a,onOpenChange:m},n__namespace.default.createElement("div",{className:`relative w-full font-sans text-text-secondary ${s}`},n__namespace.default.createElement(c__namespace.Trigger,{asChild:!0},n__namespace.default.createElement("div",{className:"flex"},n__namespace.default.createElement("div",{className:"relative flex-1"},n__namespace.default.createElement(P,{placeholder:o,value:i,onChange:p=>u(p.target.value),end:l,className:`flex-1 ${a&&y}`})))),n__namespace.default.createElement(c__namespace.Portal,null,n__namespace.default.createElement(c__namespace.Content,{className:"w-[--radix-popover-trigger-width] p-1 bg-white rounded-md shadow-lg border mt-1",sideOffset:5},n__namespace.default.createElement("div",{className:"max-h-60 overflow-auto flex flex-col items-start"},v.length>0?v.map(({label:p,value:w},O)=>n__namespace.default.createElement($,{onChange:I,value:w,key:O,label:p})):n__namespace.default.createElement("div",{className:"px-2 py-1.5 text-sm text-gray-500"},"No results found"))))))};if (exports.default) module.exports = exports.default;exports.Combobox=ne;//# sourceMappingURL=Combobox.cjs.map
|
|
2
|
+
//# sourceMappingURL=Combobox.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Icon.tsx","../../src/components/Input.tsx","../../src/components/Option.tsx","../../src/components/Combobox.tsx"],"names":["cn","inputs","twMerge","clsx","focusRingStyles","focusRingStylesCoerced","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","Input","end","iconName","f","Option","label","onChange","selected","Combobox","options","placeholder","open","setOpen","useState","inputValue","setInputValue","selectedOption","useMemo","option","filteredItems","handleOptionChange","useCallback","c","e","optionValue","index"],"mappings":"8jBAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,qBAAAA,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AA,KAAA,CAAA,CAAI,SAAU,CAAA,iBAAA,CAAA,CACbA,qBAAA,aAACU,CAAAA,CAAAA,CAAA,CACC,WAAA,CAAaU,CACb,CAAA,KAAA,CAAOI,CACP,CAAA,QAAA,CAAWS,GAAMR,CAAcQ,CAAAA,CAAAA,CAAE,MAAO,CAAA,KAAK,CAC7C,CAAA,GAAA,CAAKtB,CACL,CAAA,SAAA,CAAW,CAAUU,OAAAA,EAAAA,CAAAA,EAAQnC,CAAsB,CAAA,CAAA,CACrD,CACF,CACF,CACF,CAAA,CAEAc,qBAAA,aAAS,CAAAgC,YAAA,CAAA,MAAA,CAAR,IACChC,CAAAA,oBAAAA,CAAA,aAAS,CAAAgC,YAAA,CAAA,OAAA,CAAR,CACC,SAAA,CAAU,kFACV,UAAY,CAAA,CAAA,CAAA,CAEZhC,oBAAA,CAAA,aAAA,CAAC,KAAI,CAAA,CAAA,SAAA,CAAU,kDACZ6B,CAAAA,CAAAA,CAAAA,CAAc,OAAS,CACtBA,CAAAA,CAAAA,CAAc,GAAI,CAAA,CAAC,CAAE,KAAA,CAAAd,CAAO,CAAA,KAAA,CAAOmB,CAAY,CAAGC,CAAAA,CAAAA,GAChDnC,oBAAA,CAAA,aAAA,CAACc,CAAA,CAAA,CACC,QAAUgB,CAAAA,CAAAA,CACV,MAAOI,CACP,CAAA,GAAA,CAAKC,CACL,CAAA,KAAA,CAAOpB,CACT,CAAA,CACD,CAEDf,CAAAA,oBAAAA,CAAA,cAAC,KAAI,CAAA,CAAA,SAAA,CAAU,mCAAoC,CAAA,CAAA,kBAEnD,CAEJ,CACF,CACF,CACF,CACF,CAEJ","file":"Combobox.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 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 * as React from \"react\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { IconName } from \"@deckai/icons\";\nimport { Icon, IconProps } from \"./Icon\";\n\nexport type InputProps = {\n className?: string;\n end?: React.ReactNode;\n /** renders an icon in the end slot */\n iconName?: IconName;\n} & React.InputHTMLAttributes<HTMLInputElement> &\n Pick<IconProps, \"color\" | \"size\" | \"title\">;\n\nexport const Input = ({\n className,\n end,\n iconName,\n color,\n size,\n title,\n ...props\n}: InputProps) => (\n <div className=\"relative\">\n <input\n className={cn(\n `font-sans flex w-full rounded-lg border border-secondary-50 bg-background px-3 py-3 text-secondary ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text-primary ${focusRingStyles} disabled:cursor-not-allowed disabled:opacity-50 md:text-md`,\n end && \"pr-10\",\n className\n )}\n {...props}\n />\n {end && (\n <div className=\"absolute inset-y-0 right-0 flex items-center pr-3\">\n {iconName ? (\n <Icon name={iconName} color={color} size={size} title={title} />\n ) : (\n end\n )}\n </div>\n )}\n </div>\n);\n","import React from \"react\";\nimport { cn } from \"../utils\";\nimport { Icon } from \"./Icon\";\n\nexport type OptionProps = {\n label: string;\n value: string;\n onChange?: (value: string) => void;\n selected?: boolean;\n};\n\nexport const Option = ({ value, label, onChange, selected }: OptionProps) => (\n <button\n type=\"button\"\n className={cn(\n \"relative w-full h-full text-left px-2 py-1.5 text-sm cursor-pointer hover:bg-gray-100 rounded\",\n selected && \"bg-gray-100\"\n )}\n onClick={() => {\n onChange?.(value);\n }}\n >\n {label}\n </button>\n);\n","import React, { useCallback, useMemo, useState } from \"react\";\nimport * as Popover from \"@radix-ui/react-popover\";\nimport { Input } from \"./Input\";\nimport { OptionProps, Option } from \"./Option\";\nimport { focusRingStylesCoerced } from \"../utils/tailwind\";\n\nexport type ComboboxProps = {\n options: OptionProps[];\n placeholder?: string;\n value?: string;\n onChange: (value: string) => void;\n end?: React.ReactNode;\n className?: string;\n};\n\nexport const Combobox = ({\n options,\n placeholder = \"Select an item...\",\n value,\n onChange,\n end,\n className\n}: ComboboxProps) => {\n const [open, setOpen] = useState(false);\n const [inputValue, setInputValue] = useState<string | undefined>(value);\n\n const selectedOption: OptionProps | undefined = useMemo(\n () => options.find((option) => option.value === inputValue),\n [inputValue, options]\n );\n\n const filteredItems = options.filter((option) =>\n inputValue\n ? option.label.toLowerCase().includes(inputValue.toLowerCase())\n : options\n );\n\n const handleOptionChange = useCallback(\n (option: string) => {\n onChange(option);\n setOpen(false);\n setInputValue(selectedOption?.label);\n },\n [onChange, selectedOption?.label]\n );\n\n console.log({ open }, \"wtf\");\n\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <div\n className={`relative w-full font-sans text-text-secondary ${className}`}\n >\n <Popover.Trigger asChild>\n <div className=\"flex\">\n <div className=\"relative flex-1\">\n <Input\n placeholder={placeholder}\n value={inputValue}\n onChange={(e) => setInputValue(e.target.value)}\n end={end}\n className={`flex-1 ${open && focusRingStylesCoerced}`}\n />\n </div>\n </div>\n </Popover.Trigger>\n\n <Popover.Portal>\n <Popover.Content\n className=\"w-[--radix-popover-trigger-width] p-1 bg-white rounded-md shadow-lg border mt-1\"\n sideOffset={5}\n >\n <div className=\"max-h-60 overflow-auto flex flex-col items-start\">\n {filteredItems.length > 0 ? (\n filteredItems.map(({ label, value: optionValue }, index) => (\n <Option\n onChange={handleOptionChange}\n value={optionValue}\n key={index}\n label={label}\n />\n ))\n ) : (\n <div className=\"px-2 py-1.5 text-sm text-gray-500\">\n No results found\n </div>\n )}\n </div>\n </Popover.Content>\n </Popover.Portal>\n </div>\n </Popover.Root>\n );\n};\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { OptionProps } from './Option.cjs';
|
|
3
|
+
|
|
4
|
+
type ComboboxProps = {
|
|
5
|
+
options: OptionProps[];
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
end?: React__default.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const Combobox: ({ options, placeholder, value, onChange, end, className }: ComboboxProps) => React__default.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Combobox, type ComboboxProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { OptionProps } from './Option.js';
|
|
3
|
+
|
|
4
|
+
type ComboboxProps = {
|
|
5
|
+
options: OptionProps[];
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
end?: React__default.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const Combobox: ({ options, placeholder, value, onChange, end, className }: ComboboxProps) => React__default.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Combobox, type ComboboxProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as n from'react';import n__default,{useState,useMemo,useCallback}from'react';import*as c from'@radix-ui/react-popover';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {IconMap}from'@deckai/icons';function d(...e){return twMerge(clsx(e))}var h="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",y="ring-2 ring-ring ring-offset-2";var C={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)"},V=e=>{if(!e)return {width:"24px",height:"24px"};let o=Array.isArray(e)?e:[e],t=typeof o[0]=="number"?o[0]:24,r={width:`${t}px`,height:`${t}px`},l=o.filter(s=>typeof s=="string"&&s.includes(":")).reduce((s,a)=>{let[m,i]=a.split(":");return s[E[m]]={width:`${i}px`,height:`${i}px`},s},{});return Object.keys(l).length>0&&(r["@media"]=l),r},x=n__default.forwardRef(({name:e,size:o=24,color:t="primary",title:r,className:l,style:s={},...a},m)=>{let i=IconMap[e],u=V(o);return n__default.createElement("div",{className:d("flex justify-center items-center",l),style:{...u,"--icon-stroke":C[t],...s}},n__default.createElement(i,{ref:m,"aria-hidden":!r,"aria-label":r,stroke:e.includes("filled")?void 0:C[t],...a}))});x.displayName="Icon";var P=({className:e,end:o,iconName:t,color:r,size:l,title:s,...a})=>n.createElement("div",{className:"relative"},n.createElement("input",{className:d(`font-sans flex w-full rounded-lg border border-secondary-50 bg-background px-3 py-3 text-secondary ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text-primary ${h} disabled:cursor-not-allowed disabled:opacity-50 md:text-md`,o&&"pr-10",e),...a}),o&&n.createElement("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3"},t?n.createElement(x,{name:t,color:r,size:l,title:s}):o));var $=({value:e,label:o,onChange:t,selected:r})=>n__default.createElement("button",{type:"button",className:d("relative w-full h-full text-left px-2 py-1.5 text-sm cursor-pointer hover:bg-gray-100 rounded",r&&"bg-gray-100"),onClick:()=>{t?.(e);}},o);var ne=({options:e,placeholder:o="Select an item...",value:t,onChange:r,end:l,className:s})=>{let[a,m]=useState(!1),[i,u]=useState(t),b=useMemo(()=>e.find(p=>p.value===i),[i,e]),v=e.filter(p=>i?p.label.toLowerCase().includes(i.toLowerCase()):e),I=useCallback(p=>{r(p),m(!1),u(b?.label);},[r,b?.label]);return console.log({open:a},"wtf"),n__default.createElement(c.Root,{open:a,onOpenChange:m},n__default.createElement("div",{className:`relative w-full font-sans text-text-secondary ${s}`},n__default.createElement(c.Trigger,{asChild:!0},n__default.createElement("div",{className:"flex"},n__default.createElement("div",{className:"relative flex-1"},n__default.createElement(P,{placeholder:o,value:i,onChange:p=>u(p.target.value),end:l,className:`flex-1 ${a&&y}`})))),n__default.createElement(c.Portal,null,n__default.createElement(c.Content,{className:"w-[--radix-popover-trigger-width] p-1 bg-white rounded-md shadow-lg border mt-1",sideOffset:5},n__default.createElement("div",{className:"max-h-60 overflow-auto flex flex-col items-start"},v.length>0?v.map(({label:p,value:w},O)=>n__default.createElement($,{onChange:I,value:w,key:O,label:p})):n__default.createElement("div",{className:"px-2 py-1.5 text-sm text-gray-500"},"No results found"))))))};if (exports.default) module.exports = exports.default;export{ne as Combobox};//# sourceMappingURL=Combobox.js.map
|
|
2
|
+
//# sourceMappingURL=Combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Icon.tsx","../../src/components/Input.tsx","../../src/components/Option.tsx","../../src/components/Combobox.tsx"],"names":["cn","inputs","twMerge","clsx","focusRingStyles","focusRingStylesCoerced","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","Input","end","iconName","f","Option","label","onChange","selected","Combobox","options","placeholder","open","setOpen","useState","inputValue","setInputValue","selectedOption","useMemo","option","filteredItems","handleOptionChange","useCallback","e","optionValue","index"],"mappings":"+NAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CC8DO,IAAMG,CAAAA,CACX,qGAEWC,CAAAA,CAAAA,CAAyB,gCCtEtC,CAgBA,IAAMC,CAAAA,CAAwC,CAC5C,OAAS,CAAA,SAA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CAAAA,CAAE,MAAO,CAAA,KAAK,CAC7C,CAAA,GAAA,CAAKrB,CACL,CAAA,SAAA,CAAW,CAAUU,OAAAA,EAAAA,CAAAA,EAAQnC,CAAsB,CAAA,CAAA,CACrD,CACF,CACF,CACF,CAAA,CAEAc,WAAA,aAAS,CAAA,CAAA,CAAA,MAAA,CAAR,IACCA,CAAAA,UAAAA,CAAA,aAAS,CAAA,CAAA,CAAA,OAAA,CAAR,CACC,SAAA,CAAU,kFACV,UAAY,CAAA,CAAA,CAAA,CAEZA,UAAA,CAAA,aAAA,CAAC,KAAI,CAAA,CAAA,SAAA,CAAU,kDACZ6B,CAAAA,CAAAA,CAAAA,CAAc,OAAS,CACtBA,CAAAA,CAAAA,CAAc,GAAI,CAAA,CAAC,CAAE,KAAA,CAAAd,CAAO,CAAA,KAAA,CAAOkB,CAAY,CAAGC,CAAAA,CAAAA,GAChDlC,UAAA,CAAA,aAAA,CAACc,CAAA,CAAA,CACC,QAAUgB,CAAAA,CAAAA,CACV,MAAOG,CACP,CAAA,GAAA,CAAKC,CACL,CAAA,KAAA,CAAOnB,CACT,CAAA,CACD,CAEDf,CAAAA,UAAAA,CAAA,cAAC,KAAI,CAAA,CAAA,SAAA,CAAU,mCAAoC,CAAA,CAAA,kBAEnD,CAEJ,CACF,CACF,CACF,CACF,CAEJ","file":"Combobox.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 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 * as React from \"react\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { IconName } from \"@deckai/icons\";\nimport { Icon, IconProps } from \"./Icon\";\n\nexport type InputProps = {\n className?: string;\n end?: React.ReactNode;\n /** renders an icon in the end slot */\n iconName?: IconName;\n} & React.InputHTMLAttributes<HTMLInputElement> &\n Pick<IconProps, \"color\" | \"size\" | \"title\">;\n\nexport const Input = ({\n className,\n end,\n iconName,\n color,\n size,\n title,\n ...props\n}: InputProps) => (\n <div className=\"relative\">\n <input\n className={cn(\n `font-sans flex w-full rounded-lg border border-secondary-50 bg-background px-3 py-3 text-secondary ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text-primary ${focusRingStyles} disabled:cursor-not-allowed disabled:opacity-50 md:text-md`,\n end && \"pr-10\",\n className\n )}\n {...props}\n />\n {end && (\n <div className=\"absolute inset-y-0 right-0 flex items-center pr-3\">\n {iconName ? (\n <Icon name={iconName} color={color} size={size} title={title} />\n ) : (\n end\n )}\n </div>\n )}\n </div>\n);\n","import React from \"react\";\nimport { cn } from \"../utils\";\nimport { Icon } from \"./Icon\";\n\nexport type OptionProps = {\n label: string;\n value: string;\n onChange?: (value: string) => void;\n selected?: boolean;\n};\n\nexport const Option = ({ value, label, onChange, selected }: OptionProps) => (\n <button\n type=\"button\"\n className={cn(\n \"relative w-full h-full text-left px-2 py-1.5 text-sm cursor-pointer hover:bg-gray-100 rounded\",\n selected && \"bg-gray-100\"\n )}\n onClick={() => {\n onChange?.(value);\n }}\n >\n {label}\n </button>\n);\n","import React, { useCallback, useMemo, useState } from \"react\";\nimport * as Popover from \"@radix-ui/react-popover\";\nimport { Input } from \"./Input\";\nimport { OptionProps, Option } from \"./Option\";\nimport { focusRingStylesCoerced } from \"../utils/tailwind\";\n\nexport type ComboboxProps = {\n options: OptionProps[];\n placeholder?: string;\n value?: string;\n onChange: (value: string) => void;\n end?: React.ReactNode;\n className?: string;\n};\n\nexport const Combobox = ({\n options,\n placeholder = \"Select an item...\",\n value,\n onChange,\n end,\n className\n}: ComboboxProps) => {\n const [open, setOpen] = useState(false);\n const [inputValue, setInputValue] = useState<string | undefined>(value);\n\n const selectedOption: OptionProps | undefined = useMemo(\n () => options.find((option) => option.value === inputValue),\n [inputValue, options]\n );\n\n const filteredItems = options.filter((option) =>\n inputValue\n ? option.label.toLowerCase().includes(inputValue.toLowerCase())\n : options\n );\n\n const handleOptionChange = useCallback(\n (option: string) => {\n onChange(option);\n setOpen(false);\n setInputValue(selectedOption?.label);\n },\n [onChange, selectedOption?.label]\n );\n\n console.log({ open }, \"wtf\");\n\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <div\n className={`relative w-full font-sans text-text-secondary ${className}`}\n >\n <Popover.Trigger asChild>\n <div className=\"flex\">\n <div className=\"relative flex-1\">\n <Input\n placeholder={placeholder}\n value={inputValue}\n onChange={(e) => setInputValue(e.target.value)}\n end={end}\n className={`flex-1 ${open && focusRingStylesCoerced}`}\n />\n </div>\n </div>\n </Popover.Trigger>\n\n <Popover.Portal>\n <Popover.Content\n className=\"w-[--radix-popover-trigger-width] p-1 bg-white rounded-md shadow-lg border mt-1\"\n sideOffset={5}\n >\n <div className=\"max-h-60 overflow-auto flex flex-col items-start\">\n {filteredItems.length > 0 ? (\n filteredItems.map(({ label, value: optionValue }, index) => (\n <Option\n onChange={handleOptionChange}\n value={optionValue}\n key={index}\n label={label}\n />\n ))\n ) : (\n <div className=\"px-2 py-1.5 text-sm text-gray-500\">\n No results found\n </div>\n )}\n </div>\n </Popover.Content>\n </Popover.Portal>\n </div>\n </Popover.Root>\n );\n};\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var p=require('react'),icons=require('@deckai/icons'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var p__default=/*#__PURE__*/_interopDefault(p);function g(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var h={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB"},x={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)"},b=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,s)=>{let[l,i]=s.split(":");return n[x[l]]={width:`${i}px`,height:`${i}px`},n},{});return Object.keys(a).length>0&&(o["@media"]=a),o},d=p__default.default.forwardRef(({name:e,size:t=24,color:r="primary",title:o,className:a,style:n={},...s},l)=>{let i=icons.IconMap[e],m=b(t);return p__default.default.createElement("div",{className:g("flex justify-center items-center",a),style:{...m,"--icon-stroke":h[r],...n}},p__default.default.createElement(i,{ref:l,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:h[r],...s}))});d.displayName="Icon";var E={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},C=e=>{let[t,r]=e.split("-");return t==="heading"?E[r]||"p":t==="label"?"label":"p"},R={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},A=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",T=p__default.default.forwardRef(({variant:e="body-default",color:t="text-primary",as:r,className:o,children:a,weight:n,...s},l)=>{let i=A(e),m=t&&t==="inherit"?"inherit":t?`text-${t}`:"",u=p__default.default.useMemo(()=>{let H=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return C(H)},[e]);return p__default.default.createElement(r||u,{ref:l,className:`font-sans antialiased ${i} ${m} ${n?`!${R[n]}`:""} ${o??""}`,...s},a)});T.displayName="Text";var j=({iconName:e,children:t,href:r,...o})=>p__default.default.createElement("div",{className:"row gap-2 flex items-center"},p__default.default.createElement("div",{className:"bg-secondary-400 rounded-full p-2.5"},p__default.default.createElement(d,{name:e,color:"primaryBlue",size:18})),p__default.default.createElement(T,{className:"hover:underline",as:"a",href:r,...o,variant:["body-lg","md:body-default-medium"]},t));if (exports.default) module.exports = exports.default;exports.ContactItem=j;//# sourceMappingURL=ContactItem.cjs.map
|
|
2
|
+
//# sourceMappingURL=ContactItem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx","../../src/components/Text.tsx","../../src/components/ContactItem.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","ContactItem","iconName","href","linkProps"],"mappings":"gPAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,qBAAQC,CAAAA,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CCWA,IAAMG,CAAAA,CAAwC,CAC5C,OAAA,CAAS,SACT,CAAA,SAAA,CAAW,SACX,CAAA,KAAA,CAAO,SACP,CAAA,WAAA,CAAa,SACf,CAAA,CAKMC,CAA6C,CAAA,CACjD,EAAI,CAAA,2BAAA,CACJ,EAAI,CAAA,2BAAA,CACJ,EAAI,CAAA,4BAAA,CACJ,EAAI,CAAA,4BAAA,CACJ,KAAO,CAAA,4BACT,CAEMC,CAAAA,CAAAA,CACJC,CACwB,EAAA,CACxB,GAAI,CAACA,CAAO,CAAA,O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AAA,CAAG,GACH,CAAA,IAAA,CAAMU,CACL,CAAA,GAAGC,CACJ,CAAA,OAAA,CAAS,CAAC,SAAA,CAAW,wBAAwB,CAAA,CAAA,CAE5CT,CACH,CACF","file":"ContactItem.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 { IconName } from \"@deckai/icons/src/types/icon-names\";\nimport React, { HTMLAttributes } from \"react\";\nimport { Icon } from \"./Icon\";\nimport { Text } from \"./Text\";\n\nexport type ContactItemProps = {\n iconName: IconName;\n children: React.ReactNode;\n href: string;\n} & Omit<HTMLAttributes<HTMLAnchorElement>, \"color\">;\n\nexport const ContactItem = ({\n iconName,\n children,\n href,\n ...linkProps\n}: ContactItemProps) => (\n <div className=\"row gap-2 flex items-center\">\n <div className=\"bg-secondary-400 rounded-full p-2.5\">\n <Icon name={iconName} color=\"primaryBlue\" size={18} />\n </div>\n <Text\n className=\"hover:underline\"\n as=\"a\"\n href={href}\n {...linkProps}\n variant={[\"body-lg\", \"md:body-default-medium\"]}\n >\n {children}\n </Text>\n </div>\n);\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IconName } from '@deckai/icons/src/types/icon-names';
|
|
2
|
+
import React__default, { HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
type ContactItemProps = {
|
|
5
|
+
iconName: IconName;
|
|
6
|
+
children: React__default.ReactNode;
|
|
7
|
+
href: string;
|
|
8
|
+
} & Omit<HTMLAttributes<HTMLAnchorElement>, "color">;
|
|
9
|
+
declare const ContactItem: ({ iconName, children, href, ...linkProps }: ContactItemProps) => React__default.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { ContactItem, type ContactItemProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IconName } from '@deckai/icons/src/types/icon-names';
|
|
2
|
+
import React__default, { HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
type ContactItemProps = {
|
|
5
|
+
iconName: IconName;
|
|
6
|
+
children: React__default.ReactNode;
|
|
7
|
+
href: string;
|
|
8
|
+
} & Omit<HTMLAttributes<HTMLAnchorElement>, "color">;
|
|
9
|
+
declare const ContactItem: ({ iconName, children, href, ...linkProps }: ContactItemProps) => React__default.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { ContactItem, type ContactItemProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import p from'react';import {IconMap}from'@deckai/icons';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function g(...e){return twMerge(clsx(e))}var h={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB"},x={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)"},b=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,s)=>{let[l,i]=s.split(":");return n[x[l]]={width:`${i}px`,height:`${i}px`},n},{});return Object.keys(a).length>0&&(o["@media"]=a),o},d=p.forwardRef(({name:e,size:t=24,color:r="primary",title:o,className:a,style:n={},...s},l)=>{let i=IconMap[e],m=b(t);return p.createElement("div",{className:g("flex justify-center items-center",a),style:{...m,"--icon-stroke":h[r],...n}},p.createElement(i,{ref:l,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:h[r],...s}))});d.displayName="Icon";var E={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},C=e=>{let[t,r]=e.split("-");return t==="heading"?E[r]||"p":t==="label"?"label":"p"},R={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},A=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",T=p.forwardRef(({variant:e="body-default",color:t="text-primary",as:r,className:o,children:a,weight:n,...s},l)=>{let i=A(e),m=t&&t==="inherit"?"inherit":t?`text-${t}`:"",u=p.useMemo(()=>{let H=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return C(H)},[e]);return p.createElement(r||u,{ref:l,className:`font-sans antialiased ${i} ${m} ${n?`!${R[n]}`:""} ${o??""}`,...s},a)});T.displayName="Text";var j=({iconName:e,children:t,href:r,...o})=>p.createElement("div",{className:"row gap-2 flex items-center"},p.createElement("div",{className:"bg-secondary-400 rounded-full p-2.5"},p.createElement(d,{name:e,color:"primaryBlue",size:18})),p.createElement(T,{className:"hover:underline",as:"a",href:r,...o,variant:["body-lg","md:body-default-medium"]},t));if (exports.default) module.exports = exports.default;export{j as ContactItem};//# sourceMappingURL=ContactItem.js.map
|
|
2
|
+
//# sourceMappingURL=ContactItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx","../../src/components/Text.tsx","../../src/components/ContactItem.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","ContactItem","iconName","href","linkProps"],"mappings":"sHAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,OAAQC,CAAAA,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCWA,IAAMG,CAAAA,CAAwC,CAC5C,OAAA,CAAS,SACT,CAAA,SAAA,CAAW,SACX,CAAA,KAAA,CAAO,SACP,CAAA,WAAA,CAAa,SACf,CAAA,CAKMC,CAA6C,CAAA,CACjD,EAAI,CAAA,2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AAA,CAAM4B,CAAU,CAAA,KAAA,CAAM,aAAc,CAAA,IAAA,CAAM,EAAI,CAAA,CACtD,CACA3B,CAAAA,CAAAA,CAAA,aAACkB,CAAAA,CAAAA,CAAA,CACC,SAAA,CAAU,iBACV,CAAA,EAAA,CAAG,GACH,CAAA,IAAA,CAAMU,CACL,CAAA,GAAGC,CACJ,CAAA,OAAA,CAAS,CAAC,SAAA,CAAW,wBAAwB,CAAA,CAAA,CAE5CT,CACH,CACF","file":"ContactItem.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 { IconName } from \"@deckai/icons/src/types/icon-names\";\nimport React, { HTMLAttributes } from \"react\";\nimport { Icon } from \"./Icon\";\nimport { Text } from \"./Text\";\n\nexport type ContactItemProps = {\n iconName: IconName;\n children: React.ReactNode;\n href: string;\n} & Omit<HTMLAttributes<HTMLAnchorElement>, \"color\">;\n\nexport const ContactItem = ({\n iconName,\n children,\n href,\n ...linkProps\n}: ContactItemProps) => (\n <div className=\"row gap-2 flex items-center\">\n <div className=\"bg-secondary-400 rounded-full p-2.5\">\n <Icon name={iconName} color=\"primaryBlue\" size={18} />\n </div>\n <Text\n className=\"hover:underline\"\n as=\"a\"\n href={href}\n {...linkProps}\n variant={[\"body-lg\", \"md:body-default-medium\"]}\n >\n {children}\n </Text>\n </div>\n);\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var m=require('react'),icons=require('@deckai/icons'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var m__default=/*#__PURE__*/_interopDefault(m);function c(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var d={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB"},y={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)"},S=e=>{if(!e)return {width:"24px",height:"24px"};let t=Array.isArray(e)?e:[e],i=typeof t[0]=="number"?t[0]:24,n={width:`${i}px`,height:`${i}px`},o=t.filter(r=>typeof r=="string"&&r.includes(":")).reduce((r,a)=>{let[p,s]=a.split(":");return r[y[p]]={width:`${s}px`,height:`${s}px`},r},{});return Object.keys(o).length>0&&(n["@media"]=o),n},h=m__default.default.forwardRef(({name:e,size:t=24,color:i="primary",title:n,className:o,style:r={},...a},p)=>{let s=icons.IconMap[e],l=S(t);return m__default.default.createElement("div",{className:c("flex justify-center items-center",o),style:{...l,"--icon-stroke":d[i],...r}},m__default.default.createElement(s,{ref:p,"aria-hidden":!n,"aria-label":n,stroke:e.includes("filled")?void 0:d[i],...a}))});h.displayName="Icon";if (exports.default) module.exports = exports.default;exports.Icon=h;//# sourceMappingURL=Icon.cjs.map
|
|
2
|
+
//# sourceMappingURL=Icon.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx"],"names":["cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","baseSize","style","mediaQueries","size","acc","breakpoint","value","Icon","React","name","color","title","className","props","ref","IconComponent","IconMap","sizeStyles"],"mappings":"gPAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,qBAAAA,CAAQC,SAAKF,CAAAA,CAAM,CAAC,CAC7B,CCWA,IAAMG,CAAwC,CAAA,CAC5C,QAAS,SACT,CAAA,SAAA,CAAW,SACX,CAAA,KAAA,CAAO,SACP,CAAA,WAAA,CAAa,SACf,CAAA,CAKMC,CAA6C,CAAA,CACjD,EAAI,CAAA,2BAAA,CACJ,EAAI,CAAA,2BAAA,CACJ,GAAI,4BACJ,CAAA,EAAA,CAAI,4BACJ,CAAA,KAAA,CAAO,4BACT,CAAA,CAEMC,CACJC,CAAAA,CAAAA,EACwB,CACxB,GAAI,CAACA,CAAAA,CAAO,OAAO,CAAE,MAAO,MA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AAA,GAAGY,CACL,CAAA,CACAC,IACG,CACH,IAAMC,CAAgBC,CAAAA,aAAAA,CAAQP,CAAI,CAAA,CAC5BQ,CAAapB,CAAAA,CAAAA,CAAaM,CAAI,CAAA,CAEpC,OACEK,kBAAAA,CAAA,aAAC,CAAA,KAAA,CAAA,CACC,UAAWjB,CAAG,CAAA,kCAAA,CAAoCqB,CAAS,CAAA,CAC3D,KAAO,CAAA,CACL,GAAGK,CAAAA,CACF,eAA4BtB,CAAAA,CAAAA,CAAUe,CAAK,CAAA,CAC5C,GAAGT,CACL,GAEAO,kBAAA,CAAA,aAAA,CAACO,CAAA,CAAA,CACC,GAAKD,CAAAA,CAAAA,CACL,aAAa,CAAA,CAACH,CACd,CAAA,YAAA,CAAYA,CACZ,CAAA,MAAA,CAAQF,CAAK,CAAA,QAAA,CAAS,QAAQ,CAAI,CAAA,KAAA,CAAA,CAAYd,CAAUe,CAAAA,CAAK,CAC5D,CAAA,GAAGG,CACN,CAAA,CACF,CAEJ,CACF,EAEAN,CAAAA,CAAK,WAAc,CAAA,MAAA","file":"Icon.cjs","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const noopFn = () => {};\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\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"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React__default, { SVGProps } from 'react';
|
|
2
|
+
import { IconName } from '@deckai/icons';
|
|
3
|
+
import { I as IconColors } from '../tailwind-DJFscIlV.cjs';
|
|
4
|
+
|
|
5
|
+
type IconProps = {
|
|
6
|
+
name: IconName;
|
|
7
|
+
/** @default 24 */
|
|
8
|
+
size?: number | `${Breakpoint}:${number}`;
|
|
9
|
+
/** @default primary */
|
|
10
|
+
color?: IconColors;
|
|
11
|
+
title?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: React__default.CSSProperties;
|
|
14
|
+
} & Omit<SVGProps<SVGSVGElement>, "aria-hidden" | "aria-label">;
|
|
15
|
+
type Breakpoint = "sm" | "md" | "lg" | "xl" | "2xl";
|
|
16
|
+
declare const Icon: React__default.ForwardRefExoticComponent<Omit<IconProps, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
|
|
17
|
+
|
|
18
|
+
export { Icon, type IconProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React__default, { SVGProps } from 'react';
|
|
2
|
+
import { IconName } from '@deckai/icons';
|
|
3
|
+
import { I as IconColors } from '../tailwind-DJFscIlV.js';
|
|
4
|
+
|
|
5
|
+
type IconProps = {
|
|
6
|
+
name: IconName;
|
|
7
|
+
/** @default 24 */
|
|
8
|
+
size?: number | `${Breakpoint}:${number}`;
|
|
9
|
+
/** @default primary */
|
|
10
|
+
color?: IconColors;
|
|
11
|
+
title?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: React__default.CSSProperties;
|
|
14
|
+
} & Omit<SVGProps<SVGSVGElement>, "aria-hidden" | "aria-label">;
|
|
15
|
+
type Breakpoint = "sm" | "md" | "lg" | "xl" | "2xl";
|
|
16
|
+
declare const Icon: React__default.ForwardRefExoticComponent<Omit<IconProps, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
|
|
17
|
+
|
|
18
|
+
export { Icon, type IconProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import m from'react';import {IconMap}from'@deckai/icons';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function c(...e){return twMerge(clsx(e))}var d={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB"},y={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)"},S=e=>{if(!e)return {width:"24px",height:"24px"};let t=Array.isArray(e)?e:[e],i=typeof t[0]=="number"?t[0]:24,n={width:`${i}px`,height:`${i}px`},o=t.filter(r=>typeof r=="string"&&r.includes(":")).reduce((r,a)=>{let[p,s]=a.split(":");return r[y[p]]={width:`${s}px`,height:`${s}px`},r},{});return Object.keys(o).length>0&&(n["@media"]=o),n},h=m.forwardRef(({name:e,size:t=24,color:i="primary",title:n,className:o,style:r={},...a},p)=>{let s=IconMap[e],l=S(t);return m.createElement("div",{className:c("flex justify-center items-center",o),style:{...l,"--icon-stroke":d[i],...r}},m.createElement(s,{ref:p,"aria-hidden":!n,"aria-label":n,stroke:e.includes("filled")?void 0:d[i],...a}))});h.displayName="Icon";if (exports.default) module.exports = exports.default;export{h as Icon};//# sourceMappingURL=Icon.js.map
|
|
2
|
+
//# sourceMappingURL=Icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx"],"names":["cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","baseSize","style","mediaQueries","size","acc","breakpoint","value","Icon","React","name","color","title","className","props","ref","IconComponent","IconMap","sizeStyles"],"mappings":"sHAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CCWA,IAAMG,CAAwC,CAAA,CAC5C,QAAS,SACT,CAAA,SAAA,CAAW,SACX,CAAA,KAAA,CAAO,SACP,CAAA,WAAA,CAAa,SACf,CAAA,CAK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AAAA,CAAOC,CAAM,CAAA,UAAA,CACxB,CACE,CACE,IAAAC,CAAAA,CAAAA,CACA,IAAAN,CAAAA,CAAAA,CAAO,GACP,KAAAO,CAAAA,CAAAA,CAAQ,SACR,CAAA,KAAA,CAAAC,CACA,CAAA,SAAA,CAAAC,CACA,CAAA,KAAA,CAAAX,CAAQ,CAAA,EACR,CAAA,GAAGY,CACL,CAAA,CACAC,IACG,CACH,IAAMC,CAAgBC,CAAAA,OAAAA,CAAQP,CAAI,CAAA,CAC5BQ,CAAapB,CAAAA,CAAAA,CAAaM,CAAI,CAAA,CAEpC,OACEK,CAAAA,CAAA,aAAC,CAAA,KAAA,CAAA,CACC,UAAWjB,CAAG,CAAA,kCAAA,CAAoCqB,CAAS,CAAA,CAC3D,KAAO,CAAA,CACL,GAAGK,CAAAA,CACF,eAA4BtB,CAAAA,CAAAA,CAAUe,CAAK,CAAA,CAC5C,GAAGT,CACL,GAEAO,CAAA,CAAA,aAAA,CAACO,CAAA,CAAA,CACC,GAAKD,CAAAA,CAAAA,CACL,aAAa,CAAA,CAACH,CACd,CAAA,YAAA,CAAYA,CACZ,CAAA,MAAA,CAAQF,CAAK,CAAA,QAAA,CAAS,QAAQ,CAAI,CAAA,KAAA,CAAA,CAAYd,CAAUe,CAAAA,CAAK,CAC5D,CAAA,GAAGG,CACN,CAAA,CACF,CAEJ,CACF,EAEAN,CAAAA,CAAK,WAAc,CAAA,MAAA","file":"Icon.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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var a=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),icons=require('@deckai/icons');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var a__namespace=/*#__PURE__*/_interopNamespace(a);function c(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var d="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var u={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB"},b={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],o=typeof t[0]=="number"?t[0]:24,s={width:`${o}px`,height:`${o}px`},i=t.filter(r=>typeof r=="string"&&r.includes(":")).reduce((r,n)=>{let[l,p]=n.split(":");return r[b[l]]={width:`${p}px`,height:`${p}px`},r},{});return Object.keys(i).length>0&&(s["@media"]=i),s},f=a__namespace.default.forwardRef(({name:e,size:t=24,color:o="primary",title:s,className:i,style:r={},...n},l)=>{let p=icons.IconMap[e],g=$(t);return a__namespace.default.createElement("div",{className:c("flex justify-center items-center",i),style:{...g,"--icon-stroke":u[o],...r}},a__namespace.default.createElement(p,{ref:l,"aria-hidden":!s,"aria-label":s,stroke:e.includes("filled")?void 0:u[o],...n}))});f.displayName="Icon";var V=({className:e,end:t,iconName:o,color:s,size:i,title:r,...n})=>a__namespace.createElement("div",{className:"relative"},a__namespace.createElement("input",{className:c(`font-sans flex w-full rounded-lg border border-secondary-50 bg-background px-3 py-3 text-secondary ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text-primary ${d} disabled:cursor-not-allowed disabled:opacity-50 md:text-md`,t&&"pr-10",e),...n}),t&&a__namespace.createElement("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3"},o?a__namespace.createElement(f,{name:o,color:s,size:i,title:r}):t));if (exports.default) module.exports = exports.default;exports.Input=V;//# sourceMappingURL=Input.cjs.map
|
|
2
|
+
//# sourceMappingURL=Input.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Icon.tsx","../../src/components/Input.tsx"],"names":["cn","inputs","twMerge","clsx","focusRingStyles","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","Input","end","iconName","a"],"mappings":"seAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,qBAAQC,CAAAA,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CC8DO,IAAMG,CAAAA,CACX,sGCpDF,IAAMC,CAAAA,CAAwC,CAC5C,OAAS,CAAA,SAAA,CACT,SAAW,CAAA,SAAA,CACX,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,CACwB,EAAA,CACxB,GAAI,CAACA,EAAO,OAAO,CAAE,KAAO,CAAA,MAAA,CA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,CAAK,IAAMa,CAAAA,CAAAA,CAAU,KAAOV,CAAAA,CAAAA,CAAO,KAAMP,CAAM,CAAA,KAAA,CAAOQ,CAAO,CAAA,CAAA,CAE9DQ,CAEJ,CAEJ","file":"Input.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 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 * as React from \"react\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { IconName } from \"@deckai/icons\";\nimport { Icon, IconProps } from \"./Icon\";\n\nexport type InputProps = {\n className?: string;\n end?: React.ReactNode;\n /** renders an icon in the end slot */\n iconName?: IconName;\n} & React.InputHTMLAttributes<HTMLInputElement> &\n Pick<IconProps, \"color\" | \"size\" | \"title\">;\n\nexport const Input = ({\n className,\n end,\n iconName,\n color,\n size,\n title,\n ...props\n}: InputProps) => (\n <div className=\"relative\">\n <input\n className={cn(\n `font-sans flex w-full rounded-lg border border-secondary-50 bg-background px-3 py-3 text-secondary ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text-primary ${focusRingStyles} disabled:cursor-not-allowed disabled:opacity-50 md:text-md`,\n end && \"pr-10\",\n className\n )}\n {...props}\n />\n {end && (\n <div className=\"absolute inset-y-0 right-0 flex items-center pr-3\">\n {iconName ? (\n <Icon name={iconName} color={color} size={size} title={title} />\n ) : (\n end\n )}\n </div>\n )}\n </div>\n);\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { IconName } from '@deckai/icons';
|
|
3
|
+
import { IconProps } from './Icon.cjs';
|
|
4
|
+
import '../tailwind-DJFscIlV.cjs';
|
|
5
|
+
|
|
6
|
+
type InputProps = {
|
|
7
|
+
className?: string;
|
|
8
|
+
end?: React.ReactNode;
|
|
9
|
+
/** renders an icon in the end slot */
|
|
10
|
+
iconName?: IconName;
|
|
11
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & Pick<IconProps, "color" | "size" | "title">;
|
|
12
|
+
declare const Input: ({ className, end, iconName, color, size, title, ...props }: InputProps) => React.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Input, type InputProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { IconName } from '@deckai/icons';
|
|
3
|
+
import { IconProps } from './Icon.js';
|
|
4
|
+
import '../tailwind-DJFscIlV.js';
|
|
5
|
+
|
|
6
|
+
type InputProps = {
|
|
7
|
+
className?: string;
|
|
8
|
+
end?: React.ReactNode;
|
|
9
|
+
/** renders an icon in the end slot */
|
|
10
|
+
iconName?: IconName;
|
|
11
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & Pick<IconProps, "color" | "size" | "title">;
|
|
12
|
+
declare const Input: ({ className, end, iconName, color, size, title, ...props }: InputProps) => React.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Input, type InputProps };
|