@deckai/deck-ui 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AboutCard.cjs +8 -2
- package/dist/components/AboutCard.cjs.map +1 -1
- package/dist/components/AboutCard.js +8 -2
- package/dist/components/AboutCard.js.map +1 -1
- package/dist/components/Accordion.cjs +7 -1
- package/dist/components/Accordion.cjs.map +1 -1
- package/dist/components/Accordion.js +7 -1
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/AddWorkCard.cjs +9 -3
- package/dist/components/AddWorkCard.cjs.map +1 -1
- package/dist/components/AddWorkCard.js +9 -3
- package/dist/components/AddWorkCard.js.map +1 -1
- package/dist/components/AutocompleteInput.cjs +8 -0
- package/dist/components/AutocompleteInput.cjs.map +1 -0
- package/dist/components/AutocompleteInput.d.cts +28 -0
- package/dist/components/AutocompleteInput.d.ts +28 -0
- package/dist/components/AutocompleteInput.js +8 -0
- package/dist/components/AutocompleteInput.js.map +1 -0
- package/dist/components/Avatar.cjs +1 -1
- package/dist/components/Avatar.cjs.map +1 -1
- package/dist/components/Avatar.d.cts +3 -1
- package/dist/components/Avatar.d.ts +3 -1
- package/dist/components/Avatar.js +1 -1
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Badge.cjs +7 -1
- package/dist/components/Badge.cjs.map +1 -1
- package/dist/components/Badge.js +7 -1
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Breadcrumbs.cjs +7 -1
- package/dist/components/Breadcrumbs.cjs.map +1 -1
- package/dist/components/Breadcrumbs.js +7 -1
- package/dist/components/Breadcrumbs.js.map +1 -1
- package/dist/components/Button.cjs +8 -2
- package/dist/components/Button.cjs.map +1 -1
- package/dist/components/Button.d.cts +2 -2
- package/dist/components/Button.d.ts +2 -2
- package/dist/components/Button.js +8 -2
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Carousel.cjs +1 -1
- package/dist/components/Carousel.cjs.map +1 -1
- package/dist/components/Carousel.d.cts +1 -3
- package/dist/components/Carousel.d.ts +1 -3
- package/dist/components/Carousel.js +1 -1
- package/dist/components/Carousel.js.map +1 -1
- package/dist/components/Collapsible.cjs +8 -2
- package/dist/components/Collapsible.cjs.map +1 -1
- package/dist/components/Collapsible.js +8 -2
- package/dist/components/Collapsible.js.map +1 -1
- package/dist/components/Combobox.cjs +7 -1
- package/dist/components/Combobox.cjs.map +1 -1
- package/dist/components/Combobox.d.cts +10 -1
- package/dist/components/Combobox.d.ts +10 -1
- package/dist/components/Combobox.js +7 -1
- package/dist/components/Combobox.js.map +1 -1
- package/dist/components/ContactItem.cjs +7 -1
- package/dist/components/ContactItem.cjs.map +1 -1
- package/dist/components/ContactItem.js +7 -1
- package/dist/components/ContactItem.js.map +1 -1
- package/dist/components/Dropdown.cjs +7 -1
- package/dist/components/Dropdown.cjs.map +1 -1
- package/dist/components/Dropdown.js +7 -1
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/EditButton.cjs +8 -2
- package/dist/components/EditButton.cjs.map +1 -1
- package/dist/components/EditButton.js +8 -2
- package/dist/components/EditButton.js.map +1 -1
- package/dist/components/Icon.cjs +1 -1
- package/dist/components/Icon.cjs.map +1 -1
- package/dist/components/Icon.d.cts +1 -1
- package/dist/components/Icon.d.ts +1 -1
- package/dist/components/Icon.js +1 -1
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/IconRenderer.cjs +1 -1
- package/dist/components/IconRenderer.cjs.map +1 -1
- package/dist/components/IconRenderer.d.cts +1 -1
- package/dist/components/IconRenderer.d.ts +1 -1
- package/dist/components/IconRenderer.js +1 -1
- package/dist/components/IconRenderer.js.map +1 -1
- package/dist/components/Input.cjs +7 -1
- package/dist/components/Input.cjs.map +1 -1
- package/dist/components/Input.d.cts +33 -2
- package/dist/components/Input.d.ts +33 -2
- package/dist/components/Input.js +7 -1
- package/dist/components/Input.js.map +1 -1
- package/dist/components/Link.cjs +7 -1
- package/dist/components/Link.cjs.map +1 -1
- package/dist/components/Link.d.cts +1 -1
- package/dist/components/Link.d.ts +1 -1
- package/dist/components/Link.js +7 -1
- package/dist/components/Link.js.map +1 -1
- package/dist/components/MultiSelectCombobox.cjs +7 -1
- package/dist/components/MultiSelectCombobox.cjs.map +1 -1
- package/dist/components/MultiSelectCombobox.d.cts +25 -4
- package/dist/components/MultiSelectCombobox.d.ts +25 -4
- package/dist/components/MultiSelectCombobox.js +7 -1
- package/dist/components/MultiSelectCombobox.js.map +1 -1
- package/dist/components/Navbar.cjs +8 -2
- package/dist/components/Navbar.cjs.map +1 -1
- package/dist/components/Navbar.d.cts +1 -1
- package/dist/components/Navbar.d.ts +1 -1
- package/dist/components/Navbar.js +8 -2
- package/dist/components/Navbar.js.map +1 -1
- package/dist/components/NavbarItem.cjs +1 -1
- package/dist/components/NavbarItem.cjs.map +1 -1
- package/dist/components/NavbarItem.d.cts +1 -1
- package/dist/components/NavbarItem.d.ts +1 -1
- package/dist/components/NavbarItem.js +1 -1
- package/dist/components/NavbarItem.js.map +1 -1
- package/dist/components/Option.cjs +7 -1
- package/dist/components/Option.cjs.map +1 -1
- package/dist/components/Option.d.cts +13 -2
- package/dist/components/Option.d.ts +13 -2
- package/dist/components/Option.js +7 -1
- package/dist/components/Option.js.map +1 -1
- package/dist/components/Pressable.cjs +1 -1
- package/dist/components/Pressable.cjs.map +1 -1
- package/dist/components/Pressable.js +1 -1
- package/dist/components/Pressable.js.map +1 -1
- package/dist/components/ProfileCard.cjs +7 -1
- package/dist/components/ProfileCard.cjs.map +1 -1
- package/dist/components/ProfileCard.js +7 -1
- package/dist/components/ProfileCard.js.map +1 -1
- package/dist/components/ProgressBar.cjs +7 -1
- package/dist/components/ProgressBar.cjs.map +1 -1
- package/dist/components/ProgressBar.d.cts +4 -0
- package/dist/components/ProgressBar.d.ts +4 -0
- package/dist/components/ProgressBar.js +7 -1
- package/dist/components/ProgressBar.js.map +1 -1
- package/dist/components/RadioGroup.cjs +8 -0
- package/dist/components/RadioGroup.cjs.map +1 -0
- package/dist/components/RadioGroup.d.cts +38 -0
- package/dist/components/RadioGroup.d.ts +38 -0
- package/dist/components/RadioGroup.js +8 -0
- package/dist/components/RadioGroup.js.map +1 -0
- package/dist/components/SegmentedTabs.cjs +8 -2
- package/dist/components/SegmentedTabs.cjs.map +1 -1
- package/dist/components/SegmentedTabs.js +8 -2
- package/dist/components/SegmentedTabs.js.map +1 -1
- package/dist/components/Sidebar.cjs +1 -1
- package/dist/components/Sidebar.cjs.map +1 -1
- package/dist/components/Sidebar.js +1 -1
- package/dist/components/Sidebar.js.map +1 -1
- package/dist/components/SlideButton.cjs +7 -1
- package/dist/components/SlideButton.cjs.map +1 -1
- package/dist/components/SlideButton.js +7 -1
- package/dist/components/SlideButton.js.map +1 -1
- package/dist/components/SocialCard.cjs +7 -1
- package/dist/components/SocialCard.cjs.map +1 -1
- package/dist/components/SocialCard.d.cts +1 -1
- package/dist/components/SocialCard.d.ts +1 -1
- package/dist/components/SocialCard.js +7 -1
- package/dist/components/SocialCard.js.map +1 -1
- package/dist/components/Switch.cjs +1 -1
- package/dist/components/Switch.cjs.map +1 -1
- package/dist/components/Switch.js +1 -1
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Tabs.cjs +8 -2
- package/dist/components/Tabs.cjs.map +1 -1
- package/dist/components/Tabs.js +8 -2
- package/dist/components/Tabs.js.map +1 -1
- package/dist/components/Tag.cjs +7 -1
- package/dist/components/Tag.cjs.map +1 -1
- package/dist/components/Tag.js +7 -1
- package/dist/components/Tag.js.map +1 -1
- package/dist/components/Text.cjs +7 -1
- package/dist/components/Text.cjs.map +1 -1
- package/dist/components/Text.d.cts +3 -3
- package/dist/components/Text.d.ts +3 -3
- package/dist/components/Text.js +7 -1
- package/dist/components/Text.js.map +1 -1
- package/dist/components/TextArea.cjs +7 -1
- package/dist/components/TextArea.cjs.map +1 -1
- package/dist/components/TextArea.d.cts +5 -1
- package/dist/components/TextArea.d.ts +5 -1
- package/dist/components/TextArea.js +7 -1
- package/dist/components/TextArea.js.map +1 -1
- package/dist/components/Toast.cjs +8 -2
- package/dist/components/Toast.cjs.map +1 -1
- package/dist/components/Toast.d.cts +24 -12
- package/dist/components/Toast.d.ts +24 -12
- package/dist/components/Toast.js +8 -2
- package/dist/components/Toast.js.map +1 -1
- package/dist/components/WorkCard.cjs +7 -1
- package/dist/components/WorkCard.cjs.map +1 -1
- package/dist/components/WorkCard.js +7 -1
- package/dist/components/WorkCard.js.map +1 -1
- package/dist/index.cjs +10 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +10 -52
- package/dist/index.js.map +1 -1
- package/dist/styles/styles.css +1 -1
- package/dist/{tailwind-CuJn6tv4.d.cts → tailwind-Cl3vNM6S.d.cts} +9 -7
- package/dist/{tailwind-CuJn6tv4.d.ts → tailwind-Cl3vNM6S.d.ts} +9 -7
- package/package.json +3 -3
- package/dist/components/Illustration.cjs +0 -50
- package/dist/components/Illustration.cjs.map +0 -1
- package/dist/components/Illustration.d.cts +0 -10
- package/dist/components/Illustration.d.ts +0 -10
- package/dist/components/Illustration.js +0 -50
- package/dist/components/Illustration.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx"],"names":["cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","size","breakpoint","valueStr","value","acc","query","Icon","React","name","color","title","className","style","props","ref","IconComponent","IconMap","sizeStyles"],"mappings":"sHAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CCcA,IAAMG,CAAwC,CAAA,CAC5C,QAAS,SACT,CAAA,SAAA,CAAW,SACX,CAAA,KAAA,CAAO,SACP,CAAA,WAAA,CAAa,SACb,CAAA,QAAA,CAAU,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx"],"names":["cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","size","breakpoint","valueStr","value","acc","query","Icon","React","name","color","title","className","style","props","ref","IconComponent","IconMap","sizeStyles"],"mappings":"sHAGO,SAASA,CAAAA,CAAAA,GAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CCcA,IAAMG,CAAwC,CAAA,CAC5C,QAAS,SACT,CAAA,SAAA,CAAW,SACX,CAAA,KAAA,CAAO,SACP,CAAA,WAAA,CAAa,SACb,CAAA,QAAA,CAAU,SACV,CAAA,MAAA,CAAQ,SACV,CAAA,CAEMC,CAA6C,CAAA,CACjD,EAAI,CAAA,OAAA,CACJ,EAAI,CAAA,OAAA,CACJ,EAAI,CAAA,QAAA,CACJ,EAAI,CAAA,QAAA,CACJ,KAAO,CAAA,QACT,CAEMC,CAAAA,CAAAA,CACJC,CACwB,EAAA,CACxB,GAAI,CAACA,EAAO,OAAO,CAAE,KAAO,CAAA,MAAA,CAAQ,MAAQ,CAAA,MAAO,CAEnD,CAAA,IAAMC,CAAY,CAAA,KAAA,CAAM,OAAQD,CAAAA,CAAK,CAAIA,CAAAA,CAAAA,CAAQ,CAACA,CAAK,CAAA,CACjDE,CAAuC,CAAA,EACzCC,CAAAA,CAAAA,CAGJ,OAAAF,CAAAA,CAAU,OAASG,CAAAA,CAAAA,EAAS,CAC1B,GAAI,OAAOA,CAAAA,EAAS,SAClBD,CAAW,CAAA,CAAA,EAAGC,CAAI,CAAA,EAAA,CAAA,CAAA,KACb,CACL,GAAM,CAACC,CAAAA,CAAYC,CAAQ,CAAA,CAAIF,CAAK,CAAA,KAAA,CAAM,GAAG,CAAA,CACvCG,CAAQ,CAAA,QAAA,CAASD,CAAU,CAAA,EAAE,CACnCJ,CAAAA,CAAAA,CAAa,CAAsBJ,mBA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AAA,CAAK,QAAS,CAAA,QAAQ,CAAI,CAAA,KAAA,CAAA,CAAYf,CAAUgB,CAAAA,CAAK,CAC5D,CAAA,GAAGI,CACN,CAAA,CACF,CAEJ,CACF,EAEAP,CAAAA,CAAK,WAAc,CAAA,MAAA","file":"Icon.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\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: ResponsiveSize | ResponsiveSize[];\n /** @default primary */\n color?: IconColors;\n title?: string;\n className?: string;\n style?: React.CSSProperties;\n} & Omit<SVGProps<SVGSVGElement>, \"aria-hidden\" | \"aria-label\">;\n\nconst COLOR_MAP: Record<IconColors, string> = {\n primary: \"#080808\",\n secondary: \"#666666\",\n white: \"#ffffff\",\n primaryBlue: \"#089CCB\",\n disabled: \"#888888\",\n danger: \"#FF0000\"\n};\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"640px\",\n md: \"768px\",\n lg: \"1024px\",\n xl: \"1280px\",\n \"2xl\": \"1536px\"\n};\n\nconst processSizes = (\n sizes: ResponsiveSize | ResponsiveSize[] | undefined\n): React.CSSProperties => {\n if (!sizes) return { width: \"24px\", height: \"24px\" };\n\n const sizeArray = Array.isArray(sizes) ? sizes : [sizes];\n const mediaQueries: Record<string, string> = {};\n let baseSize: string | undefined;\n\n // Process each size\n sizeArray.forEach((size) => {\n if (typeof size === \"number\") {\n baseSize = `${size}px`;\n } else {\n const [breakpoint, valueStr] = size.split(\":\") as [Breakpoint, string];\n const value = parseInt(valueStr, 10);\n mediaQueries[`@media (min-width: ${BREAKPOINT_MAP[breakpoint]})`] =\n `${value}px`;\n }\n });\n\n // Create the style object with the correct structure\n return {\n width: baseSize || \"24px\",\n height: baseSize || \"24px\",\n ...Object.entries(mediaQueries).reduce(\n (acc, [query, size]) => ({\n ...acc,\n [query]: {\n width: size,\n height: size\n }\n }),\n {}\n )\n };\n};\n\nexport const Icon = React.forwardRef<SVGSVGElement, IconProps>(\n (\n {\n name,\n size = 24,\n color = \"primary\",\n title,\n className,\n style = {},\n ...props\n },\n ref\n ) => {\n const IconComponent = IconMap[name];\n const sizeStyles = processSizes(size);\n\n return (\n <div\n className={cn(\"flex justify-center items-center\", className)}\n style={{\n ...sizeStyles,\n [\"--icon-stroke\" as string]: COLOR_MAP[color],\n ...style\n }}\n >\n <IconComponent\n ref={ref}\n aria-hidden={!title}\n aria-label={title}\n stroke={name.includes(\"filled\") ? undefined : COLOR_MAP[color]}\n {...props}\n />\n </div>\n );\n }\n);\n\nIcon.displayName = \"Icon\";\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var e=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var e__default=/*#__PURE__*/_interopDefault(e);var a=({icon:n,size:t=40,className:r})=>{let s=n.match(/<svg[^>]*>([\s\S]*?)<\/svg>/);if(!s)return e__default.default.createElement("div",{style:{width:t,height:t,display:"flex",alignItems:"center",justifyContent:"center"},className:r});let i=n.match(/<svg([^>]*)>/),o=(i?i[1]:"").match(/viewBox=["']([^"']*)["']/),c=o?o[1]:"0 0 40 40";return e__default.default.createElement("div",{style:{width:t,height:t,display:"flex",alignItems:"center",justifyContent:"center"},className:r},e__default.default.createElement("svg",{width:"100%",height:"100%",viewBox:c,preserveAspectRatio:"xMidYMid meet",dangerouslySetInnerHTML:{__html:s[1]}}))};a.displayName="IconRenderer";exports.IconRenderer=a;//# sourceMappingURL=IconRenderer.cjs.map
|
|
2
2
|
//# sourceMappingURL=IconRenderer.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/IconRenderer.tsx"],"names":["IconRenderer","icon","size","className","
|
|
1
|
+
{"version":3,"sources":["../../src/components/IconRenderer.tsx"],"names":["IconRenderer","icon","size","className","svgMatch","React","attributesMatch","viewBoxMatch","viewBox"],"mappings":"oJAQaA,IAAAA,CAAAA,CAAe,CAAC,CAC3B,IAAA,CAAAC,CACA,CAAA,IAAA,CAAAC,CAAO,CAAA,EAAA,CACP,UAAAC,CACF,CAAA,GAAyB,CAEvB,IAAMC,CAAWH,CAAAA,CAAAA,CAAK,MAAM,6BAA6B,CAAA,CAEzD,GAAI,CAACG,CACH,CAAA,OACEC,mBAAA,aAAC,CAAA,KAAA,CAAA,CACC,KAAO,CAAA,CACL,KAAOH,CAAAA,CAAAA,CACP,OAAQA,CACR,CAAA,OAAA,CAAS,MACT,CAAA,UAAA,CAAY,QACZ,CAAA,cAAA,CAAgB,QAClB,CACA,CAAA,SAAA,CAAWC,CACb,CAAA,CAAA,CAKJ,IAAMG,CAAAA,CAAkBL,EAAK,KAAM,CAAA,cAAc,CAI3CM,CAAAA,CAAAA,CAAAA,CAHmBD,CAAkBA,CAAAA,CAAAA,CAAgB,CAAC,CAAI,CAAA,EAAA,EAG1B,MAAM,0BAA0B,CAAA,CAChEE,EAAUD,CAAeA,CAAAA,CAAAA,CAAa,CAAC,CAAA,CAAI,WAEjD,CAAA,OACEF,mBAAA,aAAC,CAAA,KAAA,CAAA,CACC,KAAO,CAAA,CACL,KAAOH,CAAAA,CAAAA,CACP,OAAQA,CACR,CAAA,OAAA,CAAS,MACT,CAAA,UAAA,CAAY,QACZ,CAAA,cAAA,CAAgB,QAClB,CACA,CAAA,SAAA,CAAWC,CAEXE,CAAAA,CAAAA,kBAAAA,CAAA,aAAC,CAAA,KAAA,CAAA,CACC,MAAM,MACN,CAAA,MAAA,CAAO,MACP,CAAA,OAAA,CAASG,CACT,CAAA,mBAAA,CAAoB,gBACpB,uBAAyB,CAAA,CAAE,MAAQJ,CAAAA,CAAAA,CAAS,CAAC,CAAE,EACjD,CACF,CAEJ,EAEAJ,CAAAA,CAAa,WAAc,CAAA,cAAA","file":"IconRenderer.cjs","sourcesContent":["import React from \"react\";\n\nexport type IconRendererProps = {\n icon: string;\n size?: number;\n className?: string;\n};\n\nexport const IconRenderer = ({\n icon,\n size = 40,\n className\n}: IconRendererProps) => {\n // Extract SVG content from the string (everything between <svg> and </svg>)\n const svgMatch = icon.match(/<svg[^>]*>([\\s\\S]*?)<\\/svg>/);\n\n if (!svgMatch) {\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n />\n );\n }\n\n // Extract attributes from the SVG tag\n const attributesMatch = icon.match(/<svg([^>]*)>/);\n const attributesString = attributesMatch ? attributesMatch[1] : \"\";\n\n // Parse viewBox\n const viewBoxMatch = attributesString.match(/viewBox=[\"']([^\"']*)[\"']/);\n const viewBox = viewBoxMatch ? viewBoxMatch[1] : \"0 0 40 40\";\n\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n >\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox={viewBox}\n preserveAspectRatio=\"xMidYMid meet\"\n dangerouslySetInnerHTML={{ __html: svgMatch[1] }}\n />\n </div>\n );\n};\n\nIconRenderer.displayName = \"IconRenderer\";\n"]}
|
|
@@ -6,7 +6,7 @@ type IconRendererProps = {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
};
|
|
8
8
|
declare const IconRenderer: {
|
|
9
|
-
({ icon, size, className }: IconRendererProps): React__default.JSX.Element
|
|
9
|
+
({ icon, size, className }: IconRendererProps): React__default.JSX.Element;
|
|
10
10
|
displayName: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ type IconRendererProps = {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
};
|
|
8
8
|
declare const IconRenderer: {
|
|
9
|
-
({ icon, size, className }: IconRendererProps): React__default.JSX.Element
|
|
9
|
+
({ icon, size, className }: IconRendererProps): React__default.JSX.Element;
|
|
10
10
|
displayName: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from'react';var a=({icon:n,size:t=40,className:r})=>{let s=n.match(/<svg[^>]*>([\s\S]*?)<\/svg>/);if(!s)return e.createElement("div",{style:{width:t,height:t,display:"flex",alignItems:"center",justifyContent:"center"},className:r});let i=n.match(/<svg([^>]*)>/),o=(i?i[1]:"").match(/viewBox=["']([^"']*)["']/),c=o?o[1]:"0 0 40 40";return e.createElement("div",{style:{width:t,height:t,display:"flex",alignItems:"center",justifyContent:"center"},className:r},e.createElement("svg",{width:"100%",height:"100%",viewBox:c,preserveAspectRatio:"xMidYMid meet",dangerouslySetInnerHTML:{__html:s[1]}}))};a.displayName="IconRenderer";export{a as IconRenderer};//# sourceMappingURL=IconRenderer.js.map
|
|
2
2
|
//# sourceMappingURL=IconRenderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/IconRenderer.tsx"],"names":["IconRenderer","icon","size","className","
|
|
1
|
+
{"version":3,"sources":["../../src/components/IconRenderer.tsx"],"names":["IconRenderer","icon","size","className","svgMatch","React","attributesMatch","viewBoxMatch","viewBox"],"mappings":"qBAQaA,IAAAA,CAAAA,CAAe,CAAC,CAC3B,IAAA,CAAAC,CACA,CAAA,IAAA,CAAAC,CAAO,CAAA,EAAA,CACP,UAAAC,CACF,CAAA,GAAyB,CAEvB,IAAMC,CAAWH,CAAAA,CAAAA,CAAK,MAAM,6BAA6B,CAAA,CAEzD,GAAI,CAACG,CACH,CAAA,OACEC,EAAA,aAAC,CAAA,KAAA,CAAA,CACC,KAAO,CAAA,CACL,KAAOH,CAAAA,CAAAA,CACP,OAAQA,CACR,CAAA,OAAA,CAAS,MACT,CAAA,UAAA,CAAY,QACZ,CAAA,cAAA,CAAgB,QAClB,CACA,CAAA,SAAA,CAAWC,CACb,CAAA,CAAA,CAKJ,IAAMG,CAAAA,CAAkBL,EAAK,KAAM,CAAA,cAAc,CAI3CM,CAAAA,CAAAA,CAAAA,CAHmBD,CAAkBA,CAAAA,CAAAA,CAAgB,CAAC,CAAI,CAAA,EAAA,EAG1B,MAAM,0BAA0B,CAAA,CAChEE,EAAUD,CAAeA,CAAAA,CAAAA,CAAa,CAAC,CAAA,CAAI,WAEjD,CAAA,OACEF,EAAA,aAAC,CAAA,KAAA,CAAA,CACC,KAAO,CAAA,CACL,KAAOH,CAAAA,CAAAA,CACP,OAAQA,CACR,CAAA,OAAA,CAAS,MACT,CAAA,UAAA,CAAY,QACZ,CAAA,cAAA,CAAgB,QAClB,CACA,CAAA,SAAA,CAAWC,CAEXE,CAAAA,CAAAA,CAAAA,CAAA,aAAC,CAAA,KAAA,CAAA,CACC,MAAM,MACN,CAAA,MAAA,CAAO,MACP,CAAA,OAAA,CAASG,CACT,CAAA,mBAAA,CAAoB,gBACpB,uBAAyB,CAAA,CAAE,MAAQJ,CAAAA,CAAAA,CAAS,CAAC,CAAE,EACjD,CACF,CAEJ,EAEAJ,CAAAA,CAAa,WAAc,CAAA,cAAA","file":"IconRenderer.js","sourcesContent":["import React from \"react\";\n\nexport type IconRendererProps = {\n icon: string;\n size?: number;\n className?: string;\n};\n\nexport const IconRenderer = ({\n icon,\n size = 40,\n className\n}: IconRendererProps) => {\n // Extract SVG content from the string (everything between <svg> and </svg>)\n const svgMatch = icon.match(/<svg[^>]*>([\\s\\S]*?)<\\/svg>/);\n\n if (!svgMatch) {\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n />\n );\n }\n\n // Extract attributes from the SVG tag\n const attributesMatch = icon.match(/<svg([^>]*)>/);\n const attributesString = attributesMatch ? attributesMatch[1] : \"\";\n\n // Parse viewBox\n const viewBoxMatch = attributesString.match(/viewBox=[\"']([^\"']*)[\"']/);\n const viewBox = viewBoxMatch ? viewBoxMatch[1] : \"0 0 40 40\";\n\n return (\n <div\n style={{\n width: size,\n height: size,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\"\n }}\n className={className}\n >\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox={viewBox}\n preserveAspectRatio=\"xMidYMid meet\"\n dangerouslySetInnerHTML={{ __html: svgMatch[1] }}\n />\n </div>\n );\n};\n\nIconRenderer.displayName = \"IconRenderer\";\n"]}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var t=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 t__namespace=/*#__PURE__*/_interopNamespace(t);function m(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var $="border-2 border-primary-100";var C={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888",danger:"#FF0000"},B={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},G=e=>{if(!e)return {width:"24px",height:"24px"};let o=Array.isArray(e)?e:[e],r={},a;return o.forEach(n=>{if(typeof n=="number")a=`${n}px`;else {let[i,s]=n.split(":"),p=parseInt(s,10);r[`@media (min-width: ${B[i]})`]=`${p}px`;}}),{width:a||"24px",height:a||"24px",...Object.entries(r).reduce((n,[i,s])=>({...n,[i]:{width:s,height:s}}),{})}},b=t__namespace.default.forwardRef(({name:e,size:o=24,color:r="primary",title:a,className:n,style:i={},...s},p)=>{let c=icons.IconMap[e],y=G(o);return t__namespace.default.createElement("div",{className:m("flex justify-center items-center",n),style:{...y,"--icon-stroke":C[r],...i}},t__namespace.default.createElement(c,{ref:p,"aria-hidden":!a,"aria-label":a,stroke:e.includes("filled")?void 0:C[r],...s}))});b.displayName="Icon";var z={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},F=e=>{let[o,r]=e.split("-");return o==="heading"?z[r]||"p":o==="label"?"label":"p"},K={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},W=e=>e?(Array.isArray(e)?e:[e]).map(r=>{if(r.includes(":")){let[a,n]=r.split(":");return `${a}:text-${n}`}return `text-${r}`}).join(" "):"text-body-default",d=t__namespace.default.forwardRef(({variant:e="body-default",color:o="primary",as:r,className:a,children:n,weight:i,...s},p)=>{let c=W(e),y=o==="inherit"?"text-inherit":`text-${o}`,u=t__namespace.default.useMemo(()=>{let g=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return F(g)},[e]);return t__namespace.default.createElement(r||u,{ref:p,className:`
|
|
2
|
+
font-sans antialiased
|
|
3
|
+
${c}
|
|
4
|
+
${y}
|
|
5
|
+
${i&&`!${K[i]}`}
|
|
6
|
+
${a}
|
|
7
|
+
`,...s},n)});d.displayName="Text";var pe=t__namespace.forwardRef(({className:e,end:o,iconName:r,color:a,size:n,title:i,label:s,labelClassName:p,id:c,children:y,forceShowFocusRing:u,error:l,errorMessage:g,helperText:H,showCharacterCount:A,maxLength:f,value:T,defaultValue:v,onChange:M,...S},I)=>{let[E,L]=t__namespace.useState(T?.toString()||v?.toString()||"");t__namespace.useEffect(()=>{T!==void 0&&L(T.toString());},[T]);let k=t__namespace.useCallback(R=>{let V=R.target.value;L(V),M?.(R);},[M]),P=E.length,N=A||!!f;return t__namespace.createElement("div",{className:"gap-1 flex flex-col"},s&&t__namespace.createElement(d,{variant:"label-default",htmlFor:c,as:"label",color:l?"danger":"primary",className:m(p)},s),t__namespace.createElement("div",{className:m("relative flex flex-col gap-2 w-full rounded-lg border bg-background-0 px-3 md:py-3 py-2 text-secondary transition-colors duration-150",{"border-secondary-50":!l&&!u,"border-tertiary-10":l,[$]:u})},t__namespace.createElement("div",{className:"flex relative"},t__namespace.createElement("input",{ref:I,id:c,className:m("font-sans text-sm flex w-full file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-primary disabled:cursor-not-allowed focus:outline-none rounded-lg",o&&"pr-10",e),value:E,maxLength:f,onChange:k,"aria-invalid":l,...S}),(o||r)&&t__namespace.createElement("div",{className:"absolute inset-y-0 right-0 flex items-center"},r?t__namespace.createElement(b,{name:r,color:l?"danger":"secondary",size:n,title:i}):o)),y),t__namespace.createElement("div",{className:"flex justify-between gap-2"},l&&g||H?t__namespace.createElement(d,{variant:"body-xxs",color:l?"danger":"secondary",className:"mt-1"},l?g:H):null,N&&t__namespace.createElement(d,{variant:"body-xxs",color:l?"danger":"secondary",className:"text-right mt-1"},t__namespace.createElement(d,{variant:"body-xxs",as:"span",color:"primary-100",className:"font-bold"},P),f&&`/${f}`," characters")))});exports.Input=pe;//# sourceMappingURL=Input.cjs.map
|
|
2
8
|
//# sourceMappingURL=Input.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx","../../src/components/Input.tsx"],"names":["cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","size","breakpoint","valueStr","value","acc","query","Icon","React","name","color","title","className","style","props","ref","IconComponent","IconMap","sizeStyles","Input","end","iconName","label","labelClassName","id","children","forceShowFocusRing","n"],"mappings":"seAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,qBAAAA,CAAQC,UAAKF,CAAM,CAAC,CAC7B,CCcA,IAAMG,CAAAA,CAAwC,CAC5C,OAAA,CAAS,UACT,SAAW,CAAA,SAAA,CACX,MAAO,SACP,CAAA,WAAA,CAAa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,CACF,GAECD,CACH,CAAA,CAEFK,YAAC,CAAA,aAAA,CAAA,KAAA,CAAA,CACC,UAAWrC,CACT,CAAA,uKAAA,CACA,CACE,mCAAqCoC,CAAAA,CAAAA,CACrC,2EACE,CAACA,CACL,CACF,CAAA,CAAA,CAEAC,2BAAC,KAAI,CAAA,CAAA,SAAA,CAAU,iBACbA,YAAC,CAAA,aAAA,CAAA,OAAA,CAAA,CACC,GAAIH,CACJ,CAAA,SAAA,CAAWlC,CACT,CAAA,wOAAA,CACA8B,GAAO,OACPR,CAAAA,CACF,EACC,GAAGE,CAAAA,CACN,EACCM,CACC,EAAAO,YAAA,CAAA,aAAA,CAAC,KAAI,CAAA,CAAA,SAAA,CAAU,gDACZN,CACC,CAAAM,YAAA,CAAA,aAAA,CAACpB,EAAA,CAAK,IAAA,CAAMc,EAAU,KAAOX,CAAAA,CAAAA,CAAO,IAAMT,CAAAA,CAAAA,CAAM,MAAOU,CAAO,CAAA,CAAA,CAE9DS,CAEJ,CAEJ,CAAA,CACCK,CACH,CACF","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 React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: ResponsiveSize | ResponsiveSize[];\n /** @default primary */\n color?: IconColors;\n title?: string;\n className?: string;\n style?: React.CSSProperties;\n} & Omit<SVGProps<SVGSVGElement>, \"aria-hidden\" | \"aria-label\">;\n\nconst COLOR_MAP: Record<IconColors, string> = {\n primary: \"#080808\",\n secondary: \"#666666\",\n white: \"#ffffff\",\n primaryBlue: \"#089CCB\",\n disabled: \"#888888\"\n};\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"640px\",\n md: \"768px\",\n lg: \"1024px\",\n xl: \"1280px\",\n \"2xl\": \"1536px\"\n};\n\nconst processSizes = (\n sizes: ResponsiveSize | ResponsiveSize[] | undefined\n): React.CSSProperties => {\n if (!sizes) return { width: \"24px\", height: \"24px\" };\n\n const sizeArray = Array.isArray(sizes) ? sizes : [sizes];\n const mediaQueries: Record<string, string> = {};\n let baseSize: string | undefined;\n\n // Process each size\n sizeArray.forEach((size) => {\n if (typeof size === \"number\") {\n baseSize = `${size}px`;\n } else {\n const [breakpoint, valueStr] = size.split(\":\") as [Breakpoint, string];\n const value = parseInt(valueStr, 10);\n mediaQueries[`@media (min-width: ${BREAKPOINT_MAP[breakpoint]})`] =\n `${value}px`;\n }\n });\n\n // Create the style object with the correct structure\n return {\n width: baseSize || \"24px\",\n height: baseSize || \"24px\",\n ...Object.entries(mediaQueries).reduce(\n (acc, [query, size]) => ({\n ...acc,\n [query]: {\n width: size,\n height: size\n }\n }),\n {}\n )\n };\n};\n\nexport const Icon = React.forwardRef<SVGSVGElement, IconProps>(\n (\n {\n name,\n size = 24,\n color = \"primary\",\n title,\n className,\n style = {},\n ...props\n },\n ref\n ) => {\n const IconComponent = IconMap[name];\n const sizeStyles = processSizes(size);\n\n return (\n <div\n className={cn(\"flex justify-center items-center\", className)}\n style={{\n ...sizeStyles,\n [\"--icon-stroke\" as string]: COLOR_MAP[color],\n ...style\n }}\n >\n <IconComponent\n ref={ref}\n aria-hidden={!title}\n aria-label={title}\n stroke={name.includes(\"filled\") ? undefined : COLOR_MAP[color]}\n {...props}\n />\n </div>\n );\n }\n);\n\nIcon.displayName = \"Icon\";\n","import * 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 /** Label text for the input */\n label?: string;\n /** Additional classes for the label */\n labelClassName?: string;\n /** Forces the focus ring to show regardless of focus state */\n forceShowFocusRing?: boolean;\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 label,\n labelClassName,\n id,\n children,\n forceShowFocusRing,\n ...props\n}: InputProps) => (\n <div className=\"py-2\">\n {label && (\n <label\n htmlFor={id}\n className={cn(\n \"block text-sm font-medium text-text-primary\",\n labelClassName\n )}\n >\n {label}\n </label>\n )}\n <div\n className={cn(\n \"relative flex flex-col gap-2 w-full rounded-lg border border-secondary-50 bg-background-0 px-3 md:py-3 py-2 text-secondary ring-offset-background disabled:opacity-50\",\n {\n \"ring-2 ring-primary ring-offset-2\": forceShowFocusRing,\n \"focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2\":\n !forceShowFocusRing\n }\n )}\n >\n <div className=\"flex relative\">\n <input\n id={id}\n className={cn(\n \"font-sans lg:text-body-default text-xs flex w-full file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text disabled:cursor-not-allowed md:text-md focus:outline-none\",\n end && \"pr-10\",\n className\n )}\n {...props}\n />\n {end && (\n <div className=\"absolute inset-y-0 right-0 flex items-center\">\n {iconName ? (\n <Icon name={iconName} color={color} size={size} title={title} />\n ) : (\n end\n )}\n </div>\n )}\n </div>\n {children}\n </div>\n </div>\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Icon.tsx","../../src/components/Text.tsx","../../src/components/Input.tsx"],"names":["cn","inputs","twMerge","clsx","focusRingStylesCoerced","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","size","breakpoint","valueStr","value","acc","query","Icon","React","name","color","title","className","style","props","ref","IconComponent","IconMap","sizeStyles","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","fontWeight","processVariants","variants","typographyClass","Text","as","children","weight","typographyClasses","colorClasses","suggestedElement","baseVariant","Input","t","end","iconName","label","labelClassName","id","forceShowFocusRing","error","errorMessage","helperText","showCharacterCount","maxLength","defaultValue","onChange","currentValue","setCurrentValue","handleChange","e","newValue","characterCount","showCount"],"mappings":"seAGO,SAASA,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,qBAAAA,CAAQC,SAAKF,CAAAA,CAAM,CAAC,CAC7B,CCiEO,IAAMG,CAAAA,CAAyB,6BCtEtC,CAmBA,IAAMC,CAAwC,CAAA,CAC5C,OAAS,CAAA,SAAA,CACT,SAAW,CAAA,SAAA,CACX,MAAO,SACP,CAAA,WAAA,CAAa,SACb,CAAA,QAAA,CAAU,SACV,CAAA,MAAA,CAAQ,SACV,CAEMC,CAAAA,CAAAA,CAA6C,CACjD,EAAA,CAAI,OACJ,CAAA,EAAA,CAAI,QACJ,EAAI,CAAA,QAAA,CACJ,GAAI,QACJ,CAAA,KAAA,CAAO,QACT,CAEMC,CAAAA,CAAAA,CACJC,CACwB,EAAA,CACxB,GAAI,CAACA,EAAO,OAAO,CAAE,KAAO,CAAA,MAAA,CAAQ,MAAQ,CAAA,MAAO,EAEnD,IAAMC,CAAAA,CAAY,KAAM,CAAA,OAAA,CAAQD,CAAK,CAAA,CAAIA,EAAQ,CAACA,CAAK,EACjDE,CAAuC,CAAA,GACzCC,CAGJ,CAAA,OAAAF,CAAU,CAAA,OAAA,CAASG,CAAS,EAAA,CAC1B,GAAI,OAAOA,CAAAA,EAAS,QAClBD,CAAAA,CAAAA,CAAW,CAAGC,EAAAA,CAAI,UACb,CACL,GAAM,CAACC,CAAAA,CAAYC,CAAQ,CAAA,CAAIF,EAAK,KAAM,CAAA,GAAG,EACvCG,CAAQ,CAAA,QAAA,CAASD,EAAU,EAAE,CAAA,CACnCJ,CAAa,CAAA,CAAA,m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A,MAAA,CAAA,CAETA,CAAQC,CAAAA,CAAAA,CAAeC,CAC1B,CACE,CAAA,IAAA,CACHW,CACC,EAAApB,YAAA,CAAA,aAAA,CAACT,CAAA,CAAA,CACC,OAAQ,CAAA,UAAA,CACR,KAAOgB,CAAAA,CAAAA,CAAQ,QAAW,CAAA,WAAA,CAC1B,SAAU,CAAA,iBAAA,CAAA,CAEVP,YAACT,CAAAA,aAAAA,CAAAA,CAAAA,CAAA,CACC,OAAQ,CAAA,UAAA,CACR,EAAG,CAAA,MAAA,CACH,KAAM,CAAA,aAAA,CACN,SAAU,CAAA,WAAA,CAAA,CAET4B,CACH,CACCR,CAAAA,CAAAA,EAAa,CAAIA,CAAAA,EAAAA,CAAS,CAAG,CAAA,CAAA,aAChC,CAEJ,CACF,CAEJ,CACF","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:border-2 focus-visible:border-primary-100\";\n\nexport const focusRingStylesCoerced = \"border-2 border-primary-100\";\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: ResponsiveSize | ResponsiveSize[];\n /** @default primary */\n color?: IconColors;\n title?: string;\n className?: string;\n style?: React.CSSProperties;\n} & Omit<SVGProps<SVGSVGElement>, \"aria-hidden\" | \"aria-label\">;\n\nconst COLOR_MAP: Record<IconColors, string> = {\n primary: \"#080808\",\n secondary: \"#666666\",\n white: \"#ffffff\",\n primaryBlue: \"#089CCB\",\n disabled: \"#888888\",\n danger: \"#FF0000\"\n};\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"640px\",\n md: \"768px\",\n lg: \"1024px\",\n xl: \"1280px\",\n \"2xl\": \"1536px\"\n};\n\nconst processSizes = (\n sizes: ResponsiveSize | ResponsiveSize[] | undefined\n): React.CSSProperties => {\n if (!sizes) return { width: \"24px\", height: \"24px\" };\n\n const sizeArray = Array.isArray(sizes) ? sizes : [sizes];\n const mediaQueries: Record<string, string> = {};\n let baseSize: string | undefined;\n\n // Process each size\n sizeArray.forEach((size) => {\n if (typeof size === \"number\") {\n baseSize = `${size}px`;\n } else {\n const [breakpoint, valueStr] = size.split(\":\") as [Breakpoint, string];\n const value = parseInt(valueStr, 10);\n mediaQueries[`@media (min-width: ${BREAKPOINT_MAP[breakpoint]})`] =\n `${value}px`;\n }\n });\n\n // Create the style object with the correct structure\n return {\n width: baseSize || \"24px\",\n height: baseSize || \"24px\",\n ...Object.entries(mediaQueries).reduce(\n (acc, [query, size]) => ({\n ...acc,\n [query]: {\n width: size,\n height: size\n }\n }),\n {}\n )\n };\n};\n\nexport const Icon = React.forwardRef<SVGSVGElement, IconProps>(\n (\n {\n name,\n size = 24,\n color = \"primary\",\n title,\n className,\n style = {},\n ...props\n },\n ref\n ) => {\n const IconComponent = IconMap[name];\n const sizeStyles = processSizes(size);\n\n return (\n <div\n className={cn(\"flex justify-center items-center\", className)}\n style={{\n ...sizeStyles,\n [\"--icon-stroke\" as string]: COLOR_MAP[color],\n ...style\n }}\n >\n <IconComponent\n ref={ref}\n aria-hidden={!title}\n aria-label={title}\n stroke={name.includes(\"filled\") ? undefined : COLOR_MAP[color]}\n {...props}\n />\n </div>\n );\n }\n);\n\nIcon.displayName = \"Icon\";\n","import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\"\n | \"primary-100\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses = color === \"inherit\" ? \"text-inherit\" : `text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`\n font-sans antialiased\n ${typographyClasses}\n ${colorClasses}\n ${weight && `!${fontWeight[weight]}`}\n ${className}\n `}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import * as React from \"react\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles, focusRingStylesCoerced } from \"../utils/tailwind\";\nimport { IconName } from \"@deckai/icons\";\nimport { Icon, IconProps } from \"./Icon\";\nimport { Text } from \"./Text\";\n\nexport type InputProps = {\n className?: string;\n end?: React.ReactNode;\n /** renders an icon in the end slot */\n iconName?: IconName;\n /** Label text for the input */\n label?: string;\n /** Additional classes for the label */\n labelClassName?: string;\n /** Forces the focus ring to show regardless of focus state */\n forceShowFocusRing?: boolean;\n /** Error state for the input */\n error?: boolean;\n /** Error message to display below the input */\n errorMessage?: string;\n /** Helper text displayed below the input */\n helperText?: string;\n /** Character count display */\n showCharacterCount?: boolean;\n /** Maximum number of characters */\n maxLength?: number;\n} & React.InputHTMLAttributes<HTMLInputElement> &\n Pick<IconProps, \"color\" | \"size\" | \"title\">;\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n end,\n iconName,\n color,\n size,\n title,\n label,\n labelClassName,\n id,\n children,\n forceShowFocusRing,\n error,\n errorMessage,\n helperText,\n showCharacterCount,\n maxLength,\n value,\n defaultValue,\n onChange,\n ...props\n },\n ref\n ) => {\n const [currentValue, setCurrentValue] = React.useState(\n value?.toString() || defaultValue?.toString() || \"\"\n );\n\n // Update internal value when prop changes\n React.useEffect(() => {\n if (value !== undefined) {\n setCurrentValue(value.toString());\n }\n }, [value]);\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n setCurrentValue(newValue);\n onChange?.(e);\n },\n [onChange]\n );\n\n const characterCount = currentValue.length;\n const showCount = showCharacterCount || !!maxLength;\n\n return (\n <div className=\"gap-1 flex flex-col\">\n {label && (\n <Text\n variant=\"label-default\"\n htmlFor={id}\n as=\"label\"\n color={error ? \"danger\" : \"primary\"}\n className={cn(labelClassName)}\n >\n {label}\n </Text>\n )}\n <div\n className={cn(\n \"relative flex flex-col gap-2 w-full rounded-lg border bg-background-0 px-3 md:py-3 py-2 text-secondary transition-colors duration-150\",\n {\n \"border-secondary-50\": !error && !forceShowFocusRing,\n \"border-tertiary-10\": error,\n [focusRingStylesCoerced]: forceShowFocusRing\n }\n )}\n >\n <div className=\"flex relative\">\n <input\n ref={ref}\n id={id}\n className={cn(\n \"font-sans text-sm flex w-full file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-primary disabled:cursor-not-allowed focus:outline-none rounded-lg\",\n end && \"pr-10\",\n className\n )}\n value={currentValue}\n maxLength={maxLength}\n onChange={handleChange}\n aria-invalid={error}\n {...props}\n />\n {(end || iconName) && (\n <div className=\"absolute inset-y-0 right-0 flex items-center\">\n {iconName ? (\n <Icon\n name={iconName}\n color={error ? \"danger\" : \"secondary\"}\n size={size}\n title={title}\n />\n ) : (\n end\n )}\n </div>\n )}\n </div>\n {children}\n </div>\n <div className=\"flex justify-between gap-2\">\n {(error && errorMessage) || helperText ? (\n <Text\n variant=\"body-xxs\"\n color={error ? \"danger\" : \"secondary\"}\n className=\"mt-1\"\n >\n {error ? errorMessage : helperText}\n </Text>\n ) : null}\n {showCount && (\n <Text\n variant=\"body-xxs\"\n color={error ? \"danger\" : \"secondary\"}\n className=\"text-right mt-1\"\n >\n <Text\n variant=\"body-xxs\"\n as=\"span\"\n color=\"primary-100\"\n className=\"font-bold\"\n >\n {characterCount}\n </Text>\n {maxLength && `/${maxLength}`} characters\n </Text>\n )}\n </div>\n </div>\n );\n }\n);\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IconName } from '@deckai/icons';
|
|
3
3
|
import { IconProps } from './Icon.cjs';
|
|
4
|
-
import '../tailwind-
|
|
4
|
+
import '../tailwind-Cl3vNM6S.cjs';
|
|
5
5
|
|
|
6
6
|
type InputProps = {
|
|
7
7
|
className?: string;
|
|
@@ -14,7 +14,38 @@ type InputProps = {
|
|
|
14
14
|
labelClassName?: string;
|
|
15
15
|
/** Forces the focus ring to show regardless of focus state */
|
|
16
16
|
forceShowFocusRing?: boolean;
|
|
17
|
+
/** Error state for the input */
|
|
18
|
+
error?: boolean;
|
|
19
|
+
/** Error message to display below the input */
|
|
20
|
+
errorMessage?: string;
|
|
21
|
+
/** Helper text displayed below the input */
|
|
22
|
+
helperText?: string;
|
|
23
|
+
/** Character count display */
|
|
24
|
+
showCharacterCount?: boolean;
|
|
25
|
+
/** Maximum number of characters */
|
|
26
|
+
maxLength?: number;
|
|
17
27
|
} & React.InputHTMLAttributes<HTMLInputElement> & Pick<IconProps, "color" | "size" | "title">;
|
|
18
|
-
declare const Input:
|
|
28
|
+
declare const Input: React.ForwardRefExoticComponent<{
|
|
29
|
+
className?: string;
|
|
30
|
+
end?: React.ReactNode;
|
|
31
|
+
/** renders an icon in the end slot */
|
|
32
|
+
iconName?: IconName;
|
|
33
|
+
/** Label text for the input */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Additional classes for the label */
|
|
36
|
+
labelClassName?: string;
|
|
37
|
+
/** Forces the focus ring to show regardless of focus state */
|
|
38
|
+
forceShowFocusRing?: boolean;
|
|
39
|
+
/** Error state for the input */
|
|
40
|
+
error?: boolean;
|
|
41
|
+
/** Error message to display below the input */
|
|
42
|
+
errorMessage?: string;
|
|
43
|
+
/** Helper text displayed below the input */
|
|
44
|
+
helperText?: string;
|
|
45
|
+
/** Character count display */
|
|
46
|
+
showCharacterCount?: boolean;
|
|
47
|
+
/** Maximum number of characters */
|
|
48
|
+
maxLength?: number;
|
|
49
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & Pick<IconProps, "color" | "title" | "size"> & React.RefAttributes<HTMLInputElement>>;
|
|
19
50
|
|
|
20
51
|
export { Input, type InputProps };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IconName } from '@deckai/icons';
|
|
3
3
|
import { IconProps } from './Icon.js';
|
|
4
|
-
import '../tailwind-
|
|
4
|
+
import '../tailwind-Cl3vNM6S.js';
|
|
5
5
|
|
|
6
6
|
type InputProps = {
|
|
7
7
|
className?: string;
|
|
@@ -14,7 +14,38 @@ type InputProps = {
|
|
|
14
14
|
labelClassName?: string;
|
|
15
15
|
/** Forces the focus ring to show regardless of focus state */
|
|
16
16
|
forceShowFocusRing?: boolean;
|
|
17
|
+
/** Error state for the input */
|
|
18
|
+
error?: boolean;
|
|
19
|
+
/** Error message to display below the input */
|
|
20
|
+
errorMessage?: string;
|
|
21
|
+
/** Helper text displayed below the input */
|
|
22
|
+
helperText?: string;
|
|
23
|
+
/** Character count display */
|
|
24
|
+
showCharacterCount?: boolean;
|
|
25
|
+
/** Maximum number of characters */
|
|
26
|
+
maxLength?: number;
|
|
17
27
|
} & React.InputHTMLAttributes<HTMLInputElement> & Pick<IconProps, "color" | "size" | "title">;
|
|
18
|
-
declare const Input:
|
|
28
|
+
declare const Input: React.ForwardRefExoticComponent<{
|
|
29
|
+
className?: string;
|
|
30
|
+
end?: React.ReactNode;
|
|
31
|
+
/** renders an icon in the end slot */
|
|
32
|
+
iconName?: IconName;
|
|
33
|
+
/** Label text for the input */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Additional classes for the label */
|
|
36
|
+
labelClassName?: string;
|
|
37
|
+
/** Forces the focus ring to show regardless of focus state */
|
|
38
|
+
forceShowFocusRing?: boolean;
|
|
39
|
+
/** Error state for the input */
|
|
40
|
+
error?: boolean;
|
|
41
|
+
/** Error message to display below the input */
|
|
42
|
+
errorMessage?: string;
|
|
43
|
+
/** Helper text displayed below the input */
|
|
44
|
+
helperText?: string;
|
|
45
|
+
/** Character count display */
|
|
46
|
+
showCharacterCount?: boolean;
|
|
47
|
+
/** Maximum number of characters */
|
|
48
|
+
maxLength?: number;
|
|
49
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & Pick<IconProps, "color" | "title" | "size"> & React.RefAttributes<HTMLInputElement>>;
|
|
19
50
|
|
|
20
51
|
export { Input, type InputProps };
|
package/dist/components/Input.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as t from'react';import t__default from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {IconMap}from'@deckai/icons';function m(...e){return twMerge(clsx(e))}var $="border-2 border-primary-100";var C={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888",danger:"#FF0000"},B={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},G=e=>{if(!e)return {width:"24px",height:"24px"};let o=Array.isArray(e)?e:[e],r={},a;return o.forEach(n=>{if(typeof n=="number")a=`${n}px`;else {let[i,s]=n.split(":"),p=parseInt(s,10);r[`@media (min-width: ${B[i]})`]=`${p}px`;}}),{width:a||"24px",height:a||"24px",...Object.entries(r).reduce((n,[i,s])=>({...n,[i]:{width:s,height:s}}),{})}},b=t__default.forwardRef(({name:e,size:o=24,color:r="primary",title:a,className:n,style:i={},...s},p)=>{let c=IconMap[e],y=G(o);return t__default.createElement("div",{className:m("flex justify-center items-center",n),style:{...y,"--icon-stroke":C[r],...i}},t__default.createElement(c,{ref:p,"aria-hidden":!a,"aria-label":a,stroke:e.includes("filled")?void 0:C[r],...s}))});b.displayName="Icon";var z={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},F=e=>{let[o,r]=e.split("-");return o==="heading"?z[r]||"p":o==="label"?"label":"p"},K={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},W=e=>e?(Array.isArray(e)?e:[e]).map(r=>{if(r.includes(":")){let[a,n]=r.split(":");return `${a}:text-${n}`}return `text-${r}`}).join(" "):"text-body-default",d=t__default.forwardRef(({variant:e="body-default",color:o="primary",as:r,className:a,children:n,weight:i,...s},p)=>{let c=W(e),y=o==="inherit"?"text-inherit":`text-${o}`,u=t__default.useMemo(()=>{let g=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return F(g)},[e]);return t__default.createElement(r||u,{ref:p,className:`
|
|
2
|
+
font-sans antialiased
|
|
3
|
+
${c}
|
|
4
|
+
${y}
|
|
5
|
+
${i&&`!${K[i]}`}
|
|
6
|
+
${a}
|
|
7
|
+
`,...s},n)});d.displayName="Text";var pe=t.forwardRef(({className:e,end:o,iconName:r,color:a,size:n,title:i,label:s,labelClassName:p,id:c,children:y,forceShowFocusRing:u,error:l,errorMessage:g,helperText:H,showCharacterCount:A,maxLength:f,value:T,defaultValue:v,onChange:M,...S},I)=>{let[E,L]=t.useState(T?.toString()||v?.toString()||"");t.useEffect(()=>{T!==void 0&&L(T.toString());},[T]);let k=t.useCallback(R=>{let V=R.target.value;L(V),M?.(R);},[M]),P=E.length,N=A||!!f;return t.createElement("div",{className:"gap-1 flex flex-col"},s&&t.createElement(d,{variant:"label-default",htmlFor:c,as:"label",color:l?"danger":"primary",className:m(p)},s),t.createElement("div",{className:m("relative flex flex-col gap-2 w-full rounded-lg border bg-background-0 px-3 md:py-3 py-2 text-secondary transition-colors duration-150",{"border-secondary-50":!l&&!u,"border-tertiary-10":l,[$]:u})},t.createElement("div",{className:"flex relative"},t.createElement("input",{ref:I,id:c,className:m("font-sans text-sm flex w-full file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-primary disabled:cursor-not-allowed focus:outline-none rounded-lg",o&&"pr-10",e),value:E,maxLength:f,onChange:k,"aria-invalid":l,...S}),(o||r)&&t.createElement("div",{className:"absolute inset-y-0 right-0 flex items-center"},r?t.createElement(b,{name:r,color:l?"danger":"secondary",size:n,title:i}):o)),y),t.createElement("div",{className:"flex justify-between gap-2"},l&&g||H?t.createElement(d,{variant:"body-xxs",color:l?"danger":"secondary",className:"mt-1"},l?g:H):null,N&&t.createElement(d,{variant:"body-xxs",color:l?"danger":"secondary",className:"text-right mt-1"},t.createElement(d,{variant:"body-xxs",as:"span",color:"primary-100",className:"font-bold"},P),f&&`/${f}`," characters")))});export{pe as Input};//# sourceMappingURL=Input.js.map
|
|
2
8
|
//# sourceMappingURL=Input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx","../../src/components/Input.tsx"],"names":["cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","size","breakpoint","valueStr","value","acc","query","Icon","React","name","color","title","className","style","props","ref","IconComponent","IconMap","sizeStyles","Input","end","iconName","label","labelClassName","id","children","forceShowFocusRing"],"mappings":"uJAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,OAAAA,CAAQC,KAAKF,CAAM,CAAC,CAC7B,CCcA,IAAMG,CAAAA,CAAwC,CAC5C,OAAA,CAAS,UACT,SAAW,CAAA,SAAA,CACX,MAAO,SACP,CAAA,WAAA,CAAa,UACb,QAAU,CAAA,SACZ,CAEMC,CAAAA,CAAAA,CAA6C,CACjD,EAAI,CAAA,OAAA,CACJ,EAAI,CAAA,OAAA,CACJ,GAAI,QACJ,CAAA,EAAA,CAAI,QACJ,CAAA,KAAA,CAAO,QACT,CAEMC,CAAAA,CAAAA,CACJC,GACwB,CACxB,GAAI,CAACA,CAAO,CAAA,OAAO,CAAE,KAAA,CAAO,OAAQ,MAAQ,CAAA,MAAO,EAEnD,IAAMC,CAAAA,CAAY,MAAM,OAAQD,CAAAA,CAAK,CAAIA,CAAAA,CAAAA,CAAQ,CAACA,CAAK,CAAA,CACjDE,EAAuC,EAAC,CAC1CC,EAGJ,OAAAF,CAAAA,CAAU,OAASG,CAAAA,CAAAA,EAAS,CAC1B,GAAI,OAAOA,CAAS,EAAA,QAAA,CAClBD,EAAW,CAAGC,EAAAA,CAAI,CACb,EAAA,CAAA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AAA,CAAM,MAAOU,CAAO,CAAA,CAAA,CAE9DS,CAEJ,CAEJ,CAAA,CACCK,CACH,CACF","file":"Input.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\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: ResponsiveSize | ResponsiveSize[];\n /** @default primary */\n color?: IconColors;\n title?: string;\n className?: string;\n style?: React.CSSProperties;\n} & Omit<SVGProps<SVGSVGElement>, \"aria-hidden\" | \"aria-label\">;\n\nconst COLOR_MAP: Record<IconColors, string> = {\n primary: \"#080808\",\n secondary: \"#666666\",\n white: \"#ffffff\",\n primaryBlue: \"#089CCB\",\n disabled: \"#888888\"\n};\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"640px\",\n md: \"768px\",\n lg: \"1024px\",\n xl: \"1280px\",\n \"2xl\": \"1536px\"\n};\n\nconst processSizes = (\n sizes: ResponsiveSize | ResponsiveSize[] | undefined\n): React.CSSProperties => {\n if (!sizes) return { width: \"24px\", height: \"24px\" };\n\n const sizeArray = Array.isArray(sizes) ? sizes : [sizes];\n const mediaQueries: Record<string, string> = {};\n let baseSize: string | undefined;\n\n // Process each size\n sizeArray.forEach((size) => {\n if (typeof size === \"number\") {\n baseSize = `${size}px`;\n } else {\n const [breakpoint, valueStr] = size.split(\":\") as [Breakpoint, string];\n const value = parseInt(valueStr, 10);\n mediaQueries[`@media (min-width: ${BREAKPOINT_MAP[breakpoint]})`] =\n `${value}px`;\n }\n });\n\n // Create the style object with the correct structure\n return {\n width: baseSize || \"24px\",\n height: baseSize || \"24px\",\n ...Object.entries(mediaQueries).reduce(\n (acc, [query, size]) => ({\n ...acc,\n [query]: {\n width: size,\n height: size\n }\n }),\n {}\n )\n };\n};\n\nexport const Icon = React.forwardRef<SVGSVGElement, IconProps>(\n (\n {\n name,\n size = 24,\n color = \"primary\",\n title,\n className,\n style = {},\n ...props\n },\n ref\n ) => {\n const IconComponent = IconMap[name];\n const sizeStyles = processSizes(size);\n\n return (\n <div\n className={cn(\"flex justify-center items-center\", className)}\n style={{\n ...sizeStyles,\n [\"--icon-stroke\" as string]: COLOR_MAP[color],\n ...style\n }}\n >\n <IconComponent\n ref={ref}\n aria-hidden={!title}\n aria-label={title}\n stroke={name.includes(\"filled\") ? undefined : COLOR_MAP[color]}\n {...props}\n />\n </div>\n );\n }\n);\n\nIcon.displayName = \"Icon\";\n","import * 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 /** Label text for the input */\n label?: string;\n /** Additional classes for the label */\n labelClassName?: string;\n /** Forces the focus ring to show regardless of focus state */\n forceShowFocusRing?: boolean;\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 label,\n labelClassName,\n id,\n children,\n forceShowFocusRing,\n ...props\n}: InputProps) => (\n <div className=\"py-2\">\n {label && (\n <label\n htmlFor={id}\n className={cn(\n \"block text-sm font-medium text-text-primary\",\n labelClassName\n )}\n >\n {label}\n </label>\n )}\n <div\n className={cn(\n \"relative flex flex-col gap-2 w-full rounded-lg border border-secondary-50 bg-background-0 px-3 md:py-3 py-2 text-secondary ring-offset-background disabled:opacity-50\",\n {\n \"ring-2 ring-primary ring-offset-2\": forceShowFocusRing,\n \"focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2\":\n !forceShowFocusRing\n }\n )}\n >\n <div className=\"flex relative\">\n <input\n id={id}\n className={cn(\n \"font-sans lg:text-body-default text-xs flex w-full file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text disabled:cursor-not-allowed md:text-md focus:outline-none\",\n end && \"pr-10\",\n className\n )}\n {...props}\n />\n {end && (\n <div className=\"absolute inset-y-0 right-0 flex items-center\">\n {iconName ? (\n <Icon name={iconName} color={color} size={size} title={title} />\n ) : (\n end\n )}\n </div>\n )}\n </div>\n {children}\n </div>\n </div>\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Icon.tsx","../../src/components/Text.tsx","../../src/components/Input.tsx"],"names":["cn","inputs","twMerge","clsx","focusRingStylesCoerced","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","size","breakpoint","valueStr","value","acc","query","Icon","React","name","color","title","className","style","props","ref","IconComponent","IconMap","sizeStyles","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","fontWeight","processVariants","variants","typographyClass","Text","as","children","weight","typographyClasses","colorClasses","suggestedElement","baseVariant","Input","end","iconName","label","labelClassName","id","forceShowFocusRing","error","errorMessage","helperText","showCharacterCount","maxLength","defaultValue","onChange","currentValue","setCurrentValue","handleChange","e","newValue","characterCount","showCount"],"mappings":"uJAGO,SAASA,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CCiEO,IAAMG,CAAAA,CAAyB,6BCtEtC,CAmBA,IAAMC,CAAwC,CAAA,CAC5C,OAAS,CAAA,SAAA,CACT,SAAW,CAAA,SAAA,CACX,MAAO,SACP,CAAA,WAAA,CAAa,SACb,CAAA,QAAA,CAAU,SACV,CAAA,MAAA,CAAQ,SACV,CAEMC,CA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AAAA,CACV,eAAcT,CACb,CAAA,GAAG5B,CACN,CAAA,CAAA,CAAA,CACEsB,CAAOC,EAAAA,CAAAA,GACP,CAAC,CAAA,aAAA,CAAA,KAAA,CAAA,CAAI,SAAU,CAAA,8CAAA,CAAA,CACZA,CACC,CAAA,CAAA,CAAA,aAAA,CAAC9B,CAAA,CAAA,CACC,IAAM8B,CAAAA,CAAAA,CACN,MAAOK,CAAQ,CAAA,QAAA,CAAW,WAC1B,CAAA,IAAA,CAAMzC,CACN,CAAA,KAAA,CAAOU,CACT,CAAA,CAAA,CAEAyB,CAEJ,CAEJ,CACCP,CAAAA,CACH,CACA,CAAA,CAAA,CAAA,aAAA,CAAC,KAAI,CAAA,CAAA,SAAA,CAAU,8BACXa,CAASC,EAAAA,CAAAA,EAAiBC,CAC1B,CAAA,CAAA,CAAA,aAAA,CAACjB,CAAA,CAAA,CACC,OAAQ,CAAA,UAAA,CACR,KAAOe,CAAAA,CAAAA,CAAQ,QAAW,CAAA,WAAA,CAC1B,SAAU,CAAA,MAAA,CAAA,CAETA,CAAQC,CAAAA,CAAAA,CAAeC,CAC1B,CACE,CAAA,IAAA,CACHW,CACC,EAAA,CAAA,CAAA,aAAA,CAAC5B,CAAA,CAAA,CACC,OAAQ,CAAA,UAAA,CACR,KAAOe,CAAAA,CAAAA,CAAQ,QAAW,CAAA,WAAA,CAC1B,SAAU,CAAA,iBAAA,CAAA,CAEV,CAACf,CAAAA,aAAAA,CAAAA,CAAAA,CAAA,CACC,OAAQ,CAAA,UAAA,CACR,EAAG,CAAA,MAAA,CACH,KAAM,CAAA,aAAA,CACN,SAAU,CAAA,WAAA,CAAA,CAET2B,CACH,CACCR,CAAAA,CAAAA,EAAa,CAAIA,CAAAA,EAAAA,CAAS,CAAG,CAAA,CAAA,aAChC,CAEJ,CACF,CAEJ,CACF","file":"Input.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:border-2 focus-visible:border-primary-100\";\n\nexport const focusRingStylesCoerced = \"border-2 border-primary-100\";\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: ResponsiveSize | ResponsiveSize[];\n /** @default primary */\n color?: IconColors;\n title?: string;\n className?: string;\n style?: React.CSSProperties;\n} & Omit<SVGProps<SVGSVGElement>, \"aria-hidden\" | \"aria-label\">;\n\nconst COLOR_MAP: Record<IconColors, string> = {\n primary: \"#080808\",\n secondary: \"#666666\",\n white: \"#ffffff\",\n primaryBlue: \"#089CCB\",\n disabled: \"#888888\",\n danger: \"#FF0000\"\n};\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"640px\",\n md: \"768px\",\n lg: \"1024px\",\n xl: \"1280px\",\n \"2xl\": \"1536px\"\n};\n\nconst processSizes = (\n sizes: ResponsiveSize | ResponsiveSize[] | undefined\n): React.CSSProperties => {\n if (!sizes) return { width: \"24px\", height: \"24px\" };\n\n const sizeArray = Array.isArray(sizes) ? sizes : [sizes];\n const mediaQueries: Record<string, string> = {};\n let baseSize: string | undefined;\n\n // Process each size\n sizeArray.forEach((size) => {\n if (typeof size === \"number\") {\n baseSize = `${size}px`;\n } else {\n const [breakpoint, valueStr] = size.split(\":\") as [Breakpoint, string];\n const value = parseInt(valueStr, 10);\n mediaQueries[`@media (min-width: ${BREAKPOINT_MAP[breakpoint]})`] =\n `${value}px`;\n }\n });\n\n // Create the style object with the correct structure\n return {\n width: baseSize || \"24px\",\n height: baseSize || \"24px\",\n ...Object.entries(mediaQueries).reduce(\n (acc, [query, size]) => ({\n ...acc,\n [query]: {\n width: size,\n height: size\n }\n }),\n {}\n )\n };\n};\n\nexport const Icon = React.forwardRef<SVGSVGElement, IconProps>(\n (\n {\n name,\n size = 24,\n color = \"primary\",\n title,\n className,\n style = {},\n ...props\n },\n ref\n ) => {\n const IconComponent = IconMap[name];\n const sizeStyles = processSizes(size);\n\n return (\n <div\n className={cn(\"flex justify-center items-center\", className)}\n style={{\n ...sizeStyles,\n [\"--icon-stroke\" as string]: COLOR_MAP[color],\n ...style\n }}\n >\n <IconComponent\n ref={ref}\n aria-hidden={!title}\n aria-label={title}\n stroke={name.includes(\"filled\") ? undefined : COLOR_MAP[color]}\n {...props}\n />\n </div>\n );\n }\n);\n\nIcon.displayName = \"Icon\";\n","import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\"\n | \"primary-100\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses = color === \"inherit\" ? \"text-inherit\" : `text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`\n font-sans antialiased\n ${typographyClasses}\n ${colorClasses}\n ${weight && `!${fontWeight[weight]}`}\n ${className}\n `}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import * as React from \"react\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles, focusRingStylesCoerced } from \"../utils/tailwind\";\nimport { IconName } from \"@deckai/icons\";\nimport { Icon, IconProps } from \"./Icon\";\nimport { Text } from \"./Text\";\n\nexport type InputProps = {\n className?: string;\n end?: React.ReactNode;\n /** renders an icon in the end slot */\n iconName?: IconName;\n /** Label text for the input */\n label?: string;\n /** Additional classes for the label */\n labelClassName?: string;\n /** Forces the focus ring to show regardless of focus state */\n forceShowFocusRing?: boolean;\n /** Error state for the input */\n error?: boolean;\n /** Error message to display below the input */\n errorMessage?: string;\n /** Helper text displayed below the input */\n helperText?: string;\n /** Character count display */\n showCharacterCount?: boolean;\n /** Maximum number of characters */\n maxLength?: number;\n} & React.InputHTMLAttributes<HTMLInputElement> &\n Pick<IconProps, \"color\" | \"size\" | \"title\">;\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n end,\n iconName,\n color,\n size,\n title,\n label,\n labelClassName,\n id,\n children,\n forceShowFocusRing,\n error,\n errorMessage,\n helperText,\n showCharacterCount,\n maxLength,\n value,\n defaultValue,\n onChange,\n ...props\n },\n ref\n ) => {\n const [currentValue, setCurrentValue] = React.useState(\n value?.toString() || defaultValue?.toString() || \"\"\n );\n\n // Update internal value when prop changes\n React.useEffect(() => {\n if (value !== undefined) {\n setCurrentValue(value.toString());\n }\n }, [value]);\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n setCurrentValue(newValue);\n onChange?.(e);\n },\n [onChange]\n );\n\n const characterCount = currentValue.length;\n const showCount = showCharacterCount || !!maxLength;\n\n return (\n <div className=\"gap-1 flex flex-col\">\n {label && (\n <Text\n variant=\"label-default\"\n htmlFor={id}\n as=\"label\"\n color={error ? \"danger\" : \"primary\"}\n className={cn(labelClassName)}\n >\n {label}\n </Text>\n )}\n <div\n className={cn(\n \"relative flex flex-col gap-2 w-full rounded-lg border bg-background-0 px-3 md:py-3 py-2 text-secondary transition-colors duration-150\",\n {\n \"border-secondary-50\": !error && !forceShowFocusRing,\n \"border-tertiary-10\": error,\n [focusRingStylesCoerced]: forceShowFocusRing\n }\n )}\n >\n <div className=\"flex relative\">\n <input\n ref={ref}\n id={id}\n className={cn(\n \"font-sans text-sm flex w-full file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-primary disabled:cursor-not-allowed focus:outline-none rounded-lg\",\n end && \"pr-10\",\n className\n )}\n value={currentValue}\n maxLength={maxLength}\n onChange={handleChange}\n aria-invalid={error}\n {...props}\n />\n {(end || iconName) && (\n <div className=\"absolute inset-y-0 right-0 flex items-center\">\n {iconName ? (\n <Icon\n name={iconName}\n color={error ? \"danger\" : \"secondary\"}\n size={size}\n title={title}\n />\n ) : (\n end\n )}\n </div>\n )}\n </div>\n {children}\n </div>\n <div className=\"flex justify-between gap-2\">\n {(error && errorMessage) || helperText ? (\n <Text\n variant=\"body-xxs\"\n color={error ? \"danger\" : \"secondary\"}\n className=\"mt-1\"\n >\n {error ? errorMessage : helperText}\n </Text>\n ) : null}\n {showCount && (\n <Text\n variant=\"body-xxs\"\n color={error ? \"danger\" : \"secondary\"}\n className=\"text-right mt-1\"\n >\n <Text\n variant=\"body-xxs\"\n as=\"span\"\n color=\"primary-100\"\n className=\"font-bold\"\n >\n {characterCount}\n </Text>\n {maxLength && `/${maxLength}`} characters\n </Text>\n )}\n </div>\n </div>\n );\n }\n);\n"]}
|
package/dist/components/Link.cjs
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var s=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var s__default=/*#__PURE__*/_interopDefault(s);var d={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},H=e=>{let[r,t]=e.split("-");return r==="heading"?d[t]||"p":r==="label"?"label":"p"},b={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},M=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[o,n]=t.split(":");return `${o}:text-${n}`}return `text-${t}`}).join(" "):"text-body-default",i=s__default.default.forwardRef(({variant:e="body-default",color:r="primary",as:t,className:o,children:n,weight:a,...T},m)=>{let y=M(e),h=r==="inherit"?"text-inherit":`text-${r}`,g=s__default.default.useMemo(()=>{let u=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return H(u)},[e]);return s__default.default.createElement(t||g,{ref:m,className:`
|
|
2
|
+
font-sans antialiased
|
|
3
|
+
${y}
|
|
4
|
+
${h}
|
|
5
|
+
${a&&`!${b[a]}`}
|
|
6
|
+
${o}
|
|
7
|
+
`,...T},n)});i.displayName="Text";function p(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var l="focus-visible:outline-none focus-visible:border-2 focus-visible:border-primary-100";var O=({children:e,color:r="inherit",variant:t="body-default-semibold",href:o,className:n,...a})=>s__default.default.createElement(i,{variant:t,color:r},s__default.default.createElement("a",{href:o,className:p("hover:opacity-80 transition-all ease-in-out active:scale-95 hover:underline",l,n),...a},e));exports.Link=O;//# sourceMappingURL=Link.cjs.map
|
|
2
8
|
//# sourceMappingURL=Link.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Text.tsx","../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Link.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","cn","inputs","twMerge","clsx","focusRingStyles","Link","href"],"mappings":"iNAsEA,IAAMA,CAAmD,CAAA,CACvD,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EAAA,CAAI,IACJ,CAAA,EAAA,CAAI,IACN,CAAA,CAEMC,CAAyBC,CAAAA,CAAAA,EAAwC,CACrE,GAAM,CAACC,CAAAA,CAAUC,CAAI,CAAA,CAAIF,CAAQ,CAAA,KAAA,CAAM,GAAG,CAE1C,CAAA,OAAIC,CAAa,GAAA,SAAA,CACRH,CAAoBI,CAAAA,CAAI,CAAK,EAAA,GAAA,CAGlCD,CAAa,GAAA,OAAA,CACR,OAGF,CAAA,GACT,CAIME,CAAAA,CAAAA,CAAqC,CACzC,KAAA,CAAO,aACP,OAAS,CAAA,cAAA,CACT,QAAU,CAAA,eAAA,CACV,IAAM,CAAA,WACR,CA0BMC,CAAAA,CAAAA,CACJC,CAEKA,EAAAA,CAAAA,CAAAA,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Z,CAAA,OAEES,kBAAA,CAAA,aAAA,CAJiBE,CAAMQ,EAAAA,CAAAA,CAItB,CACC,GAAA,CAAKH,CACL,CAAA,SAAA,CAAW,yBAAyBC,CAAiB,CAAA,CAAA,EAAIC,CAAY,CAAA,CAAA,EACnEJ,CAAS,CAAA,CAAA,CAAA,EAAIX,CAAWW,CAAAA,CAAM,CAAC,CAAK,CAAA,CAAA,EACtC,CAAIF,CAAAA,EAAAA,CAAAA,EAAa,EAAE,CAAA,CAAA,CAClB,GAAGG,CAAAA,CAAAA,CAEHF,CACH,CAEJ,CACF,CAEAL,CAAAA,CAAAA,CAAK,WAAc,CAAA,MAAA,CC3LZ,SAASa,CAAAA,CAAAA,GAAMC,EAAsB,CAC1C,OAAOC,qBAAQC,CAAAA,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CC8DO,IAAMG,CAAAA,CACX,qGCvDK,CAAA,IAAMC,CAAO,CAAA,CAAC,CACnB,QAAA,CAAAb,EACA,KAAAH,CAAAA,CAAAA,CAAQ,SACR,CAAA,OAAA,CAAAV,CAAU,CAAA,uBAAA,CACV,IAAA2B,CAAAA,CAAAA,CACA,SAAAf,CAAAA,CAAAA,CACA,GAAGG,CACL,CACEN,GAAAA,kBAAAA,CAAA,aAACD,CAAAA,CAAAA,CAAA,CAAK,OAASR,CAAAA,CAAAA,CAAS,KAAOU,CAAAA,CAAAA,CAAAA,CAC7BD,kBAAA,CAAA,aAAA,CAAC,GACC,CAAA,CAAA,IAAA,CAAMkB,EACN,SAAWN,CAAAA,CAAAA,CACT,6EACAI,CAAAA,CAAAA,CACAb,CACF,CAAA,CACC,GAAGG,CAAAA,CAAAA,CAEHF,CACH,CACF","file":"Link.cjs","sourcesContent":["import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses =\n color === \"inherit\" ? \"text-inherit\" : `text-text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`font-sans antialiased ${typographyClasses} ${colorClasses} ${\n weight ? `!${fontWeight[weight]}` : \"\"\n } ${className ?? \"\"}`}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const noopFn = () => {};\n","import { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import React from \"react\";\nimport { Text, TextProps } from \"./Text\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles } from \"../utils/tailwind\";\n\nexport type LinkProps = {\n href: string;\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n} & Pick<TextProps, \"variant\" | \"color\"> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>;\n\nexport const Link = ({\n children,\n color = \"inherit\",\n variant = \"body-default-semibold\",\n href,\n className,\n ...props\n}: LinkProps) => (\n <Text variant={variant} color={color}>\n <a\n href={href}\n className={cn(\n \"hover:opacity-80 transition-all ease-in-out active:scale-95 hover:underline\",\n focusRingStyles,\n className\n )}\n {...props}\n >\n {children}\n </a>\n </Text>\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/Text.tsx","../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Link.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","cn","inputs","twMerge","clsx","focusRingStyles","Link","href"],"mappings":"iNAuEA,IAAMA,EAAmD,CACvD,EAAA,CAAI,KACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EAAA,CAAI,KACJ,E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CAAAA,CAAAA,CAEHF,CACH,CACF","file":"Link.cjs","sourcesContent":["import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\"\n | \"primary-100\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses = color === \"inherit\" ? \"text-inherit\" : `text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`\n font-sans antialiased\n ${typographyClasses}\n ${colorClasses}\n ${weight && `!${fontWeight[weight]}`}\n ${className}\n `}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import { 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:border-2 focus-visible:border-primary-100\";\n\nexport const focusRingStylesCoerced = \"border-2 border-primary-100\";\n","import React from \"react\";\nimport { Text, TextProps } from \"./Text\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles } from \"../utils/tailwind\";\n\nexport type LinkProps = {\n href: string;\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n} & Pick<TextProps, \"variant\" | \"color\"> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>;\n\nexport const Link = ({\n children,\n color = \"inherit\",\n variant = \"body-default-semibold\",\n href,\n className,\n ...props\n}: LinkProps) => (\n <Text variant={variant} color={color}>\n <a\n href={href}\n className={cn(\n \"hover:opacity-80 transition-all ease-in-out active:scale-95 hover:underline\",\n focusRingStyles,\n className\n )}\n {...props}\n >\n {children}\n </a>\n </Text>\n);\n"]}
|
package/dist/components/Link.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';var d={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},H=e=>{let[r,t]=e.split("-");return r==="heading"?d[t]||"p":r==="label"?"label":"p"},b={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},M=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[o,n]=t.split(":");return `${o}:text-${n}`}return `text-${t}`}).join(" "):"text-body-default",i=s.forwardRef(({variant:e="body-default",color:r="primary",as:t,className:o,children:n,weight:a,...T},m)=>{let y=M(e),h=r==="inherit"?"text-inherit":`text-${r}`,g=s.useMemo(()=>{let u=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return H(u)},[e]);return s.createElement(t||g,{ref:m,className:`
|
|
2
|
+
font-sans antialiased
|
|
3
|
+
${y}
|
|
4
|
+
${h}
|
|
5
|
+
${a&&`!${b[a]}`}
|
|
6
|
+
${o}
|
|
7
|
+
`,...T},n)});i.displayName="Text";function p(...e){return twMerge(clsx(e))}var l="focus-visible:outline-none focus-visible:border-2 focus-visible:border-primary-100";var O=({children:e,color:r="inherit",variant:t="body-default-semibold",href:o,className:n,...a})=>s.createElement(i,{variant:t,color:r},s.createElement("a",{href:o,className:p("hover:opacity-80 transition-all ease-in-out active:scale-95 hover:underline",l,n),...a},e));export{O as Link};//# sourceMappingURL=Link.js.map
|
|
2
8
|
//# sourceMappingURL=Link.js.map
|