@deckai/deck-ui 0.0.13 → 0.0.15
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/README.md +22 -4
- package/dist/components/AboutCard.cjs +1 -9
- package/dist/components/AboutCard.cjs.map +1 -1
- package/dist/components/AboutCard.d.cts +1 -2
- package/dist/components/AboutCard.d.ts +1 -2
- package/dist/components/AboutCard.js +1 -9
- package/dist/components/AboutCard.js.map +1 -1
- package/dist/components/Accordion.cjs +2 -0
- package/dist/components/Accordion.cjs.map +1 -0
- package/dist/components/Accordion.d.cts +26 -0
- package/dist/components/Accordion.d.ts +26 -0
- package/dist/components/Accordion.js +2 -0
- package/dist/components/Accordion.js.map +1 -0
- package/dist/components/AddWorkCard.cjs +117 -0
- package/dist/components/AddWorkCard.cjs.map +1 -0
- package/dist/components/AddWorkCard.d.cts +9 -0
- package/dist/components/AddWorkCard.d.ts +9 -0
- package/dist/components/AddWorkCard.js +117 -0
- package/dist/components/AddWorkCard.js.map +1 -0
- package/dist/components/Avatar.cjs +1 -1
- package/dist/components/Avatar.cjs.map +1 -1
- package/dist/components/Avatar.js +1 -1
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Badge.cjs +1 -1
- package/dist/components/Badge.cjs.map +1 -1
- package/dist/components/Badge.js +1 -1
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs.cjs.map +1 -1
- package/dist/components/Breadcrumbs.js +1 -1
- package/dist/components/Breadcrumbs.js.map +1 -1
- package/dist/components/Button.cjs +2 -2
- package/dist/components/Button.cjs.map +1 -1
- package/dist/components/Button.js +2 -2
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Carousel.cjs +2 -0
- package/dist/components/Carousel.cjs.map +1 -0
- package/dist/components/Carousel.d.cts +12 -0
- package/dist/components/Carousel.d.ts +12 -0
- package/dist/components/Carousel.js +2 -0
- package/dist/components/Carousel.js.map +1 -0
- package/dist/components/Collapsible.cjs +1 -1
- package/dist/components/Collapsible.cjs.map +1 -1
- package/dist/components/Collapsible.js +1 -1
- package/dist/components/Collapsible.js.map +1 -1
- package/dist/components/Combobox.cjs +1 -1
- package/dist/components/Combobox.cjs.map +1 -1
- package/dist/components/Combobox.d.cts +12 -3
- package/dist/components/Combobox.d.ts +12 -3
- package/dist/components/Combobox.js +1 -1
- package/dist/components/Combobox.js.map +1 -1
- package/dist/components/ContactItem.cjs +1 -1
- package/dist/components/ContactItem.cjs.map +1 -1
- package/dist/components/ContactItem.js +1 -1
- package/dist/components/ContactItem.js.map +1 -1
- package/dist/components/Dropdown.cjs +2 -0
- package/dist/components/Dropdown.cjs.map +1 -0
- package/dist/components/Dropdown.d.cts +18 -0
- package/dist/components/Dropdown.d.ts +18 -0
- package/dist/components/Dropdown.js +2 -0
- package/dist/components/Dropdown.js.map +1 -0
- package/dist/components/EditButton.cjs +2 -2
- package/dist/components/EditButton.cjs.map +1 -1
- package/dist/components/EditButton.js +2 -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.js +1 -1
- package/dist/components/Illustration.cjs +1 -1
- package/dist/components/Illustration.js +1 -1
- package/dist/components/Input.cjs +1 -1
- package/dist/components/Input.cjs.map +1 -1
- package/dist/components/Input.d.cts +4 -2
- package/dist/components/Input.d.ts +4 -2
- package/dist/components/Input.js +1 -1
- package/dist/components/Input.js.map +1 -1
- package/dist/components/Link.cjs +1 -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 +1 -1
- package/dist/components/Link.js.map +1 -1
- package/dist/components/Logo.cjs +1 -1
- package/dist/components/Logo.js +1 -1
- package/dist/components/MultiSelectCombobox.cjs +1 -1
- package/dist/components/MultiSelectCombobox.cjs.map +1 -1
- package/dist/components/MultiSelectCombobox.d.cts +6 -2
- package/dist/components/MultiSelectCombobox.d.ts +6 -2
- package/dist/components/MultiSelectCombobox.js +1 -1
- package/dist/components/MultiSelectCombobox.js.map +1 -1
- package/dist/components/Navbar.cjs +2 -2
- package/dist/components/Navbar.cjs.map +1 -1
- package/dist/components/Navbar.d.cts +6 -3
- package/dist/components/Navbar.d.ts +6 -3
- package/dist/components/Navbar.js +2 -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 +1 -1
- package/dist/components/Option.cjs.map +1 -1
- package/dist/components/Option.d.cts +7 -2
- package/dist/components/Option.d.ts +7 -2
- package/dist/components/Option.js +1 -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.d.cts +1 -1
- package/dist/components/Pressable.d.ts +1 -1
- package/dist/components/Pressable.js +1 -1
- package/dist/components/Pressable.js.map +1 -1
- package/dist/components/ProfileCard.cjs +1 -9
- package/dist/components/ProfileCard.cjs.map +1 -1
- package/dist/components/ProfileCard.d.cts +1 -1
- package/dist/components/ProfileCard.d.ts +1 -1
- package/dist/components/ProfileCard.js +1 -9
- package/dist/components/ProfileCard.js.map +1 -1
- package/dist/components/ProgressBar.cjs +2 -0
- package/dist/components/ProgressBar.cjs.map +1 -0
- package/dist/components/ProgressBar.d.cts +21 -0
- package/dist/components/ProgressBar.d.ts +21 -0
- package/dist/components/ProgressBar.js +2 -0
- package/dist/components/ProgressBar.js.map +1 -0
- package/dist/components/SegmentedTabs.cjs +10 -0
- package/dist/components/SegmentedTabs.cjs.map +1 -0
- package/dist/components/SegmentedTabs.d.cts +16 -0
- package/dist/components/SegmentedTabs.d.ts +16 -0
- package/dist/components/SegmentedTabs.js +10 -0
- package/dist/components/SegmentedTabs.js.map +1 -0
- 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 +3 -0
- package/dist/components/SlideButton.cjs.map +1 -0
- package/dist/components/SlideButton.d.cts +21 -0
- package/dist/components/SlideButton.d.ts +21 -0
- package/dist/components/SlideButton.js +3 -0
- package/dist/components/SlideButton.js.map +1 -0
- package/dist/components/SocialCard.cjs +1 -1
- package/dist/components/SocialCard.cjs.map +1 -1
- package/dist/components/SocialCard.js +1 -1
- package/dist/components/SocialCard.js.map +1 -1
- package/dist/components/Spinner.cjs +1 -1
- package/dist/components/Spinner.cjs.map +1 -1
- package/dist/components/Spinner.d.cts +36 -1
- package/dist/components/Spinner.d.ts +36 -1
- package/dist/components/Spinner.js +1 -1
- package/dist/components/Spinner.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 +9 -1
- package/dist/components/Tabs.cjs.map +1 -1
- package/dist/components/Tabs.d.cts +1 -0
- package/dist/components/Tabs.d.ts +1 -0
- package/dist/components/Tabs.js +9 -1
- package/dist/components/Tabs.js.map +1 -1
- package/dist/components/Tag.cjs +1 -1
- package/dist/components/Tag.cjs.map +1 -1
- package/dist/components/Tag.js +1 -1
- package/dist/components/Tag.js.map +1 -1
- package/dist/components/Text.cjs +1 -1
- package/dist/components/Text.cjs.map +1 -1
- package/dist/components/Text.d.cts +6 -10
- package/dist/components/Text.d.ts +6 -10
- package/dist/components/Text.js +1 -1
- package/dist/components/Text.js.map +1 -1
- package/dist/components/TextArea.cjs +1 -1
- package/dist/components/TextArea.cjs.map +1 -1
- package/dist/components/TextArea.js +1 -1
- package/dist/components/TextArea.js.map +1 -1
- package/dist/components/Toast.cjs +10 -0
- package/dist/components/Toast.cjs.map +1 -0
- package/dist/components/Toast.d.cts +35 -0
- package/dist/components/Toast.d.ts +35 -0
- package/dist/components/Toast.js +10 -0
- package/dist/components/Toast.js.map +1 -0
- package/dist/components/ToastProvider.cjs +2 -0
- package/dist/components/ToastProvider.cjs.map +1 -0
- package/dist/components/ToastProvider.d.cts +8 -0
- package/dist/components/ToastProvider.d.ts +8 -0
- package/dist/components/ToastProvider.js +2 -0
- package/dist/components/ToastProvider.js.map +1 -0
- package/dist/components/Tooltip.cjs +1 -1
- package/dist/components/Tooltip.cjs.map +1 -1
- package/dist/components/Tooltip.d.cts +4 -1
- package/dist/components/Tooltip.d.ts +4 -1
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/WorkCard.cjs +1 -1
- package/dist/components/WorkCard.cjs.map +1 -1
- package/dist/components/WorkCard.d.cts +4 -3
- package/dist/components/WorkCard.d.ts +4 -3
- package/dist/components/WorkCard.js +1 -1
- package/dist/components/WorkCard.js.map +1 -1
- package/dist/index.cjs +111 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -4
- package/dist/index.d.ts +42 -4
- package/dist/index.js +111 -3
- package/dist/index.js.map +1 -1
- package/dist/styles/styles.css +1 -1
- package/dist/{tailwind-CIZ10fKA.d.cts → tailwind-CuJn6tv4.d.cts} +4 -4
- package/dist/{tailwind-CIZ10fKA.d.ts → tailwind-CuJn6tv4.d.ts} +4 -4
- package/package.json +20 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { SVGProps } from 'react';
|
|
2
2
|
import { IconName } from '@deckai/icons';
|
|
3
|
-
import { I as IconColors } from '../tailwind-
|
|
3
|
+
import { I as IconColors } from '../tailwind-CuJn6tv4.js';
|
|
4
4
|
|
|
5
5
|
type Breakpoint = "sm" | "md" | "lg" | "xl" | "2xl";
|
|
6
6
|
type ResponsiveSize = number | `${Breakpoint}:${number}`;
|
package/dist/components/Icon.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import a from'react';import {IconMap}from'@deckai/icons';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function c(...e){return twMerge(clsx(e))}var l={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB"},S={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},y=e=>{if(!e)return {width:"24px",height:"24px"};let s=Array.isArray(e)?e:[e],n={},o;return s.forEach(r=>{if(typeof r=="number")o=`${r}px`;else {let[i,t]=r.split(":"),p=parseInt(t,10);n[`@media (min-width: ${S[i]})`]=`${p}px`;}}),{width:o||"24px",height:o||"24px",...Object.entries(n).reduce((r,[i,t])=>({...r,[i]:{width:t,height:t}}),{})}},g=a.forwardRef(({name:e,size:s=24,color:n="primary",title:o,className:r,style:i={},...t},p)=>{let m=IconMap[e],d=y(s);return a.createElement("div",{className:c("flex justify-center items-center",r),style:{...d,"--icon-stroke":l[n],...i}},a.createElement(m,{ref:p,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:l[n],...t}))});g.displayName="Icon";
|
|
1
|
+
import a from'react';import {IconMap}from'@deckai/icons';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function c(...e){return twMerge(clsx(e))}var l={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},S={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},y=e=>{if(!e)return {width:"24px",height:"24px"};let s=Array.isArray(e)?e:[e],n={},o;return s.forEach(r=>{if(typeof r=="number")o=`${r}px`;else {let[i,t]=r.split(":"),p=parseInt(t,10);n[`@media (min-width: ${S[i]})`]=`${p}px`;}}),{width:o||"24px",height:o||"24px",...Object.entries(n).reduce((r,[i,t])=>({...r,[i]:{width:t,height:t}}),{})}},g=a.forwardRef(({name:e,size:s=24,color:n="primary",title:o,className:r,style:i={},...t},p)=>{let m=IconMap[e],d=y(s);return a.createElement("div",{className:c("flex justify-center items-center",r),style:{...d,"--icon-stroke":l[n],...i}},a.createElement(m,{ref:p,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:l[n],...t}))});g.displayName="Icon";export{g as Icon};//# sourceMappingURL=Icon.js.map
|
|
2
2
|
//# sourceMappingURL=Icon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx"],"names":["cn","inputs","twMerge","clsx","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","mediaQueries","baseSize","size","breakpoint","valueStr","value","acc","query","Icon","React","name","color","title","className","style","props","ref","IconComponent","IconMap","sizeStyles"],"mappings":"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,
|
|
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,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aM,CAAAA,CAAAA,CAAOC,CAAM,CAAA,UAAA,CACxB,CACE,CACE,IAAAC,CAAAA,CAAAA,CACA,IAAAR,CAAAA,CAAAA,CAAO,EACP,CAAA,KAAA,CAAAS,CAAQ,CAAA,SAAA,CACR,KAAAC,CAAAA,CAAAA,CACA,SAAAC,CAAAA,CAAAA,CACA,KAAAC,CAAAA,CAAAA,CAAQ,EAAC,CACT,GAAGC,CACL,EACAC,CACG,GAAA,CACH,IAAMC,CAAAA,CAAgBC,OAAQR,CAAAA,CAAI,CAC5BS,CAAAA,CAAAA,CAAatB,CAAaK,CAAAA,CAAI,CAEpC,CAAA,OACEO,CAAA,CAAA,aAAA,CAAC,OACC,SAAWlB,CAAAA,CAAAA,CAAG,kCAAoCsB,CAAAA,CAAS,CAC3D,CAAA,KAAA,CAAO,CACL,GAAGM,CACF,CAAA,eAAA,CAA4BxB,CAAUgB,CAAAA,CAAK,CAC5C,CAAA,GAAGG,CACL,CAEAL,CAAAA,CAAAA,CAAAA,CAAA,aAACQ,CAAAA,CAAAA,CAAA,CACC,GAAA,CAAKD,CACL,CAAA,aAAA,CAAa,CAACJ,CAAAA,CACd,YAAYA,CAAAA,CAAAA,CACZ,MAAQF,CAAAA,CAAAA,CAAK,QAAS,CAAA,QAAQ,CAAI,CAAA,KAAA,CAAA,CAAYf,CAAUgB,CAAAA,CAAK,CAC5D,CAAA,GAAGI,CACN,CAAA,CACF,CAEJ,CACF,EAEAP,CAAAA,CAAK,WAAc,CAAA,MAAA","file":"Icon.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"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var o=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);var u=({icon:t,size:r=40,className:n})=>{let s=o.useMemo(()=>{let e=new DOMParser().parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return null;e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("preserveAspectRatio","xMidYMid meet");let i=e.getAttribute("viewBox")||"0 0 40 40";return e.setAttribute("viewBox",i),e.outerHTML},[t]);return s?o__default.default.createElement("div",{style:{width:r,height:r,display:"flex",alignItems:"center",justifyContent:"center"},className:n,dangerouslySetInnerHTML:{__html:s}}):null};u.displayName="IconRenderer";
|
|
1
|
+
'use strict';var o=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);var u=({icon:t,size:r=40,className:n})=>{let s=o.useMemo(()=>{let e=new DOMParser().parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return null;e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("preserveAspectRatio","xMidYMid meet");let i=e.getAttribute("viewBox")||"0 0 40 40";return e.setAttribute("viewBox",i),e.outerHTML},[t]);return s?o__default.default.createElement("div",{style:{width:r,height:r,display:"flex",alignItems:"center",justifyContent:"center"},className:n,dangerouslySetInnerHTML:{__html:s}}):null};u.displayName="IconRenderer";exports.IconRenderer=u;//# sourceMappingURL=IconRenderer.cjs.map
|
|
2
2
|
//# sourceMappingURL=IconRenderer.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o,{useMemo}from'react';var u=({icon:t,size:r=40,className:n})=>{let s=useMemo(()=>{let e=new DOMParser().parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return null;e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("preserveAspectRatio","xMidYMid meet");let i=e.getAttribute("viewBox")||"0 0 40 40";return e.setAttribute("viewBox",i),e.outerHTML},[t]);return s?o.createElement("div",{style:{width:r,height:r,display:"flex",alignItems:"center",justifyContent:"center"},className:n,dangerouslySetInnerHTML:{__html:s}}):null};u.displayName="IconRenderer";
|
|
1
|
+
import o,{useMemo}from'react';var u=({icon:t,size:r=40,className:n})=>{let s=useMemo(()=>{let e=new DOMParser().parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return null;e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("preserveAspectRatio","xMidYMid meet");let i=e.getAttribute("viewBox")||"0 0 40 40";return e.setAttribute("viewBox",i),e.outerHTML},[t]);return s?o.createElement("div",{style:{width:r,height:r,display:"flex",alignItems:"center",justifyContent:"center"},className:n,dangerouslySetInnerHTML:{__html:s}}):null};u.displayName="IconRenderer";export{u as IconRenderer};//# sourceMappingURL=IconRenderer.js.map
|
|
2
2
|
//# sourceMappingURL=IconRenderer.js.map
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
<path d="M107.805 45.6205H126.669V50.2815H107.805V45.6205Z" fill="white" stroke="#080808" stroke-width="0.1" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
47
47
|
<path d="M107.805 55.134H126.669V59.795H107.805V55.134Z" fill="#089CCB" stroke="#080808" stroke-width="0.1" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
48
48
|
<path d="M64.5945 73.0401C64.5945 73.0401 70.7295 72.3605 71.199 71.5656L65.0595 72.335L64.5945 73.0401ZM77.6825 38.1845L75.5815 37.9355C75.5815 37.9355 77.278 38.923 77.6825 38.878V38.1845Z" fill="#080808" stroke="#080808" stroke-width="0.05" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
49
|
-
</svg>`;
|
|
49
|
+
</svg>`;exports.Illustration=p;//# sourceMappingURL=Illustration.cjs.map
|
|
50
50
|
//# sourceMappingURL=Illustration.cjs.map
|
|
@@ -46,5 +46,5 @@ import s from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge
|
|
|
46
46
|
<path d="M107.805 45.6205H126.669V50.2815H107.805V45.6205Z" fill="white" stroke="#080808" stroke-width="0.1" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
47
47
|
<path d="M107.805 55.134H126.669V59.795H107.805V55.134Z" fill="#089CCB" stroke="#080808" stroke-width="0.1" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
48
48
|
<path d="M64.5945 73.0401C64.5945 73.0401 70.7295 72.3605 71.199 71.5656L65.0595 72.335L64.5945 73.0401ZM77.6825 38.1845L75.5815 37.9355C75.5815 37.9355 77.278 38.923 77.6825 38.878V38.1845Z" fill="#080808" stroke="#080808" stroke-width="0.05" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
49
|
-
</svg>`;
|
|
49
|
+
</svg>`;export{p as Illustration};//# sourceMappingURL=Illustration.js.map
|
|
50
50
|
//# sourceMappingURL=Illustration.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var n=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 n__namespace=/*#__PURE__*/_interopNamespace(n);function l(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var x={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},h={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},S=e=>{if(!e)return {width:"24px",height:"24px"};let s=Array.isArray(e)?e:[e],o={},i;return s.forEach(t=>{if(typeof t=="number")i=`${t}px`;else {let[a,r]=t.split(":"),p=parseInt(r,10);o[`@media (min-width: ${h[a]})`]=`${p}px`;}}),{width:i||"24px",height:i||"24px",...Object.entries(o).reduce((t,[a,r])=>({...t,[a]:{width:r,height:r}}),{})}},f=n__namespace.default.forwardRef(({name:e,size:s=24,color:o="primary",title:i,className:t,style:a={},...r},p)=>{let c=icons.IconMap[e],m=S(s);return n__namespace.default.createElement("div",{className:l("flex justify-center items-center",t),style:{...m,"--icon-stroke":x[o],...a}},n__namespace.default.createElement(c,{ref:p,"aria-hidden":!i,"aria-label":i,stroke:e.includes("filled")?void 0:x[o],...r}))});f.displayName="Icon";var M=({className:e,end:s,iconName:o,color:i,size:t,title:a,label:r,labelClassName:p,id:c,children:m,forceShowFocusRing:u,...g})=>n__namespace.createElement("div",{className:"py-2"},r&&n__namespace.createElement("label",{htmlFor:c,className:l("block text-sm font-medium text-text-primary",p)},r),n__namespace.createElement("div",{className:l("relative flex flex-col gap-2 w-full rounded-lg border border-secondary-50 bg-background-0 px-3 md:py-3 py-2 text-secondary ring-offset-background disabled:opacity-50",{"ring-2 ring-primary ring-offset-2":u,"focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2":!u})},n__namespace.createElement("div",{className:"flex relative"},n__namespace.createElement("input",{id:c,className:l("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",s&&"pr-10",e),...g}),s&&n__namespace.createElement("div",{className:"absolute inset-y-0 right-0 flex items-center"},o?n__namespace.createElement(f,{name:o,color:i,size:t,title:a}):s)),m));exports.Input=M;//# sourceMappingURL=Input.cjs.map
|
|
2
2
|
//# sourceMappingURL=Input.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Icon.tsx","../../src/components/Input.tsx"],"names":["cn","inputs","twMerge","clsx","focusRingStyles","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","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","a"],"mappings":"seAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,sBAAQC,SAAKF,CAAAA,CAAM,CAAC,CAC7B,CC8DO,IAAMG,CAAAA,CACX,qGCpEF,CAmBA,IAAMC,CAAAA,CAAwC,CAC5C,OAAS,CAAA,SAAA,CACT,UAAW,SACX,CAAA,KAAA,CAAO,SACP,CAAA,WAAA,CAAa,SACf,CAEMC,CAAAA,CAAAA,CAA6C,CACjD,EAAA,CAAI,QACJ,EAAI,CAAA,OAAA,CACJ,EAAI,CAAA,QAAA,CACJ,GAAI,QACJ,CAAA,KAAA,CAAO,QACT,CAAA,CAEMC,EACJC,CACwB,EAAA,CACxB,GAAI,CAACA,EAAO,OAAO,CAAE,KAAO,CAAA,MAAA,CAAQ,OAAQ,MAAO,CAAA,CAEnD,IAAMC,CAAAA,CAAY,MAAM,OAAQD,CAAAA,CAAK,EAAIA,CAAQ,CAAA,CAACA,CAAK,CACjDE,CAAAA,CAAAA,CAAuC,EAAC,CAC1CC,EAGJ,OAAAF,CAAAA,CAAU,OAASG,CAAAA,CAAAA,EAAS,CAC1B,GAAI,OAAOA,CAAS,EAAA,QAAA,CAClBD,EAAW,CAAGC,EAAAA,CAAI,CACb,EAAA,CAAA,CAAA,KAAA,CACL,GAAM,CAACC,CAAAA,CAAYC,CAAQ,CAAA,CAAIF,EAAK,KAAM,CAAA,GAAG,CACvCG,CAAAA,CAAAA,CAAQ,SAASD,CAAU,CAAA,EAAE,CACnCJ,CAAAA,CAAAA,CAAa,sBAAsBJ,CAAeO,CA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CAAA,CACF,CAEJ,CACF,CAAA,CAEAP,EAAK,WAAc,CAAA,MAAA,CC3FNY,IAAAA,CAAAA,CAAQ,CAAC,CACpB,SAAA,CAAAP,CACA,CAAA,GAAA,CAAAQ,EACA,QAAAC,CAAAA,CAAAA,CACA,KAAAX,CAAAA,CAAAA,CACA,KAAAT,CACA,CAAA,KAAA,CAAAU,CACA,CAAA,KAAA,CAAAW,EACA,cAAAC,CAAAA,CAAAA,CACA,EAAAC,CAAAA,CAAAA,CACA,GAAGV,CACL,CAAA,GACEW,YAAC,CAAA,aAAA,CAAA,KAAA,CAAA,CAAI,UAAU,WACZH,CAAAA,CAAAA,CAAAA,EACCG,YAAC,CAAA,aAAA,CAAA,OAAA,CAAA,CACC,QAASD,CACT,CAAA,SAAA,CAAWnC,EACT,6CACAkC,CAAAA,CACF,GAECD,CACH,CAAA,CAEFG,YAAC,CAAA,aAAA,CAAA,KAAA,CAAA,CAAI,UAAU,UACb,CAAA,CAAAA,YAAA,CAAA,aAAA,CAAC,OACC,CAAA,CAAA,EAAA,CAAID,EACJ,SAAWnC,CAAAA,CAAAA,CACT,CAAsSI,mSAAAA,EAAAA,CAAe,8DACrT2B,CAAO,EAAA,OAAA,CACPR,CACF,CACC,CAAA,GAAGE,EACN,CACCM,CAAAA,CAAAA,EACCK,YAAC,CAAA,aAAA,CAAA,KAAA,CAAA,CAAI,UAAU,mDACZJ,CAAAA,CAAAA,CAAAA,CACCI,YAAClB,CAAAA,aAAAA,CAAAA,CAAAA,CAAA,CAAK,IAAMc,CAAAA,CAAAA,CAAU,KAAOX,CAAAA,CAAAA,CAAO,KAAMT,CAAM,CAAA,KAAA,CAAOU,EAAO,CAE9DS,CAAAA,CAEJ,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:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\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};\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} & 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 ...props\n}: InputProps) => (\n <div className=\"space-y-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 className=\"relative\">\n <input\n id={id}\n className={cn(\n `font-sans lg:text-body-default text-xs flex w-full rounded-lg border border-secondary-50 bg-background-0 px-3 md:py-3 py-2 text-secondary ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text-primary ${focusRingStyles} disabled:cursor-not-allowed disabled:opacity-50 md:text-md`,\n end && \"pr-10\",\n className\n )}\n {...props}\n />\n {end && (\n <div className=\"absolute inset-y-0 right-0 flex items-center pr-3\">\n {iconName ? (\n <Icon name={iconName} color={color} size={size} title={title} />\n ) : (\n end\n )}\n </div>\n )}\n </div>\n </div>\n);\n"]}
|
|
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,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,CAAA,KAAA,CACL,GAAM,CAACC,CAAAA,CAAYC,CAAQ,CAAIF,CAAAA,CAAAA,CAAK,MAAM,GAAG,CAAA,CACvCG,CAAQ,CAAA,QAAA,CAASD,EAAU,EAAE,CAAA,CACnCJ,EAAa,CAAsBJ,mBAAAA,EAAAA,CAAAA,CAAeO,CAAU,CAAC,CAAA,CAAA,CAAG,CAC9D,CAAA,CAAA,EAAGE,CAAK,CACZ,EAAA,EAAA,CAC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,QAAAC,CAAAA,CAAAA,CACA,MAAAX,CACA,CAAA,IAAA,CAAAT,CACA,CAAA,KAAA,CAAAU,EACA,KAAAW,CAAAA,CAAAA,CACA,cAAAC,CAAAA,CAAAA,CACA,GAAAC,CACA,CAAA,QAAA,CAAAC,CACA,CAAA,kBAAA,CAAAC,EACA,GAAGZ,CACL,IACEa,YAAC,CAAA,aAAA,CAAA,KAAA,CAAA,CAAI,UAAU,MACZL,CAAAA,CAAAA,CAAAA,EACCK,YAAC,CAAA,aAAA,CAAA,OAAA,CAAA,CACC,QAASH,CACT,CAAA,SAAA,CAAWlC,EACT,6CACAiC,CAAAA,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,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-CuJn6tv4.cjs';
|
|
5
5
|
|
|
6
6
|
type InputProps = {
|
|
7
7
|
className?: string;
|
|
@@ -12,7 +12,9 @@ type InputProps = {
|
|
|
12
12
|
label?: string;
|
|
13
13
|
/** Additional classes for the label */
|
|
14
14
|
labelClassName?: string;
|
|
15
|
+
/** Forces the focus ring to show regardless of focus state */
|
|
16
|
+
forceShowFocusRing?: boolean;
|
|
15
17
|
} & React.InputHTMLAttributes<HTMLInputElement> & Pick<IconProps, "color" | "size" | "title">;
|
|
16
|
-
declare const Input: ({ className, end, iconName, color, size, title, label, labelClassName, id, ...props }: InputProps) => React.JSX.Element;
|
|
18
|
+
declare const Input: ({ className, end, iconName, color, size, title, label, labelClassName, id, children, forceShowFocusRing, ...props }: InputProps) => React.JSX.Element;
|
|
17
19
|
|
|
18
20
|
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-CuJn6tv4.js';
|
|
5
5
|
|
|
6
6
|
type InputProps = {
|
|
7
7
|
className?: string;
|
|
@@ -12,7 +12,9 @@ type InputProps = {
|
|
|
12
12
|
label?: string;
|
|
13
13
|
/** Additional classes for the label */
|
|
14
14
|
labelClassName?: string;
|
|
15
|
+
/** Forces the focus ring to show regardless of focus state */
|
|
16
|
+
forceShowFocusRing?: boolean;
|
|
15
17
|
} & React.InputHTMLAttributes<HTMLInputElement> & Pick<IconProps, "color" | "size" | "title">;
|
|
16
|
-
declare const Input: ({ className, end, iconName, color, size, title, label, labelClassName, id, ...props }: InputProps) => React.JSX.Element;
|
|
18
|
+
declare const Input: ({ className, end, iconName, color, size, title, label, labelClassName, id, children, forceShowFocusRing, ...props }: InputProps) => React.JSX.Element;
|
|
17
19
|
|
|
18
20
|
export { Input, type InputProps };
|
package/dist/components/Input.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as n from'react';import n__default from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {IconMap}from'@deckai/icons';function l(...e){return twMerge(clsx(e))}var x={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},h={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},S=e=>{if(!e)return {width:"24px",height:"24px"};let s=Array.isArray(e)?e:[e],o={},i;return s.forEach(t=>{if(typeof t=="number")i=`${t}px`;else {let[a,r]=t.split(":"),p=parseInt(r,10);o[`@media (min-width: ${h[a]})`]=`${p}px`;}}),{width:i||"24px",height:i||"24px",...Object.entries(o).reduce((t,[a,r])=>({...t,[a]:{width:r,height:r}}),{})}},f=n__default.forwardRef(({name:e,size:s=24,color:o="primary",title:i,className:t,style:a={},...r},p)=>{let c=IconMap[e],m=S(s);return n__default.createElement("div",{className:l("flex justify-center items-center",t),style:{...m,"--icon-stroke":x[o],...a}},n__default.createElement(c,{ref:p,"aria-hidden":!i,"aria-label":i,stroke:e.includes("filled")?void 0:x[o],...r}))});f.displayName="Icon";var M=({className:e,end:s,iconName:o,color:i,size:t,title:a,label:r,labelClassName:p,id:c,children:m,forceShowFocusRing:u,...g})=>n.createElement("div",{className:"py-2"},r&&n.createElement("label",{htmlFor:c,className:l("block text-sm font-medium text-text-primary",p)},r),n.createElement("div",{className:l("relative flex flex-col gap-2 w-full rounded-lg border border-secondary-50 bg-background-0 px-3 md:py-3 py-2 text-secondary ring-offset-background disabled:opacity-50",{"ring-2 ring-primary ring-offset-2":u,"focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2":!u})},n.createElement("div",{className:"flex relative"},n.createElement("input",{id:c,className:l("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",s&&"pr-10",e),...g}),s&&n.createElement("div",{className:"absolute inset-y-0 right-0 flex items-center"},o?n.createElement(f,{name:o,color:i,size:t,title:a}):s)),m));export{M as Input};//# sourceMappingURL=Input.js.map
|
|
2
2
|
//# sourceMappingURL=Input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Icon.tsx","../../src/components/Input.tsx"],"names":["cn","inputs","twMerge","clsx","focusRingStyles","COLOR_MAP","BREAKPOINT_MAP","processSizes","sizes","sizeArray","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"],"mappings":"uJAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,QAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CC8DO,IAAMG,CAAAA,CACX,qGCpEF,CAmBA,IAAMC,CAAAA,CAAwC,CAC5C,OAAS,CAAA,SAAA,CACT,UAAW,SACX,CAAA,KAAA,CAAO,SACP,CAAA,WAAA,CAAa,SACf,CAEMC,CAAAA,CAAAA,CAA6C,CACjD,EAAA,CAAI,QACJ,EAAI,CAAA,OAAA,CACJ,EAAI,CAAA,QAAA,CACJ,GAAI,QACJ,CAAA,KAAA,CAAO,QACT,CAAA,CAEMC,EACJC,CACwB,EAAA,CACxB,GAAI,CAACA,EAAO,OAAO,CAAE,KAAO,CAAA,MAAA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A,CACPR,CACF,CACC,CAAA,GAAGE,EACN,CACCM,CAAAA,CAAAA,EACC,CAAC,CAAA,aAAA,CAAA,KAAA,CAAA,CAAI,UAAU,mDACZC,CAAAA,CAAAA,CAAAA,CACC,CAACd,CAAAA,aAAAA,CAAAA,CAAAA,CAAA,CAAK,IAAMc,CAAAA,CAAAA,CAAU,KAAOX,CAAAA,CAAAA,CAAO,KAAMT,CAAM,CAAA,KAAA,CAAOU,EAAO,CAE9DS,CAAAA,CAEJ,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:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\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};\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} & 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 ...props\n}: InputProps) => (\n <div className=\"space-y-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 className=\"relative\">\n <input\n id={id}\n className={cn(\n `font-sans lg:text-body-default text-xs flex w-full rounded-lg border border-secondary-50 bg-background-0 px-3 md:py-3 py-2 text-secondary ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text-primary ${focusRingStyles} disabled:cursor-not-allowed disabled:opacity-50 md:text-md`,\n end && \"pr-10\",\n className\n )}\n {...props}\n />\n {end && (\n <div className=\"absolute inset-y-0 right-0 flex items-center pr-3\">\n {iconName ? (\n <Icon name={iconName} color={color} size={size} title={title} />\n ) : (\n end\n )}\n </div>\n )}\n </div>\n </div>\n);\n"]}
|
|
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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,EACCM,CACC,EAAA,CAAA,CAAA,aAAA,CAAC,KAAI,CAAA,CAAA,SAAA,CAAU,gDACZC,CACC,CAAA,CAAA,CAAA,aAAA,CAACd,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.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"]}
|
package/dist/components/Link.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var a=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var a__default=/*#__PURE__*/_interopDefault(a);var H={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},d=e=>{let[r,t]=e.split("-");return r==="heading"?H[t]||"p":r==="label"?"label":"p"},f={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=a__default.default.forwardRef(({variant:e="body-default",color:r="primary",as:t,className:o,children:n,weight:s,...T},m)=>{let y=M(e),g=r==="inherit"?"text-inherit":`text-text-${r}`,h=a__default.default.useMemo(()=>{let u=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return d(u)},[e]);return a__default.default.createElement(t||h,{ref:m,className:`font-sans antialiased ${y} ${g} ${s?`!${f[s]}`:""} ${o??""}`,...T},n)});i.displayName="Text";function l(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var p="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var O=({children:e,color:r="inherit",variant:t="body-default-semibold",href:o,className:n,...s})=>a__default.default.createElement(i,{variant:t,color:r},a__default.default.createElement("a",{href:o,className:l("hover:opacity-80 transition-all ease-in-out active:scale-95 hover:underline",p,n),...s},e));exports.Link=O;//# sourceMappingURL=Link.cjs.map
|
|
2
2
|
//# 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":"iNA4FA,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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AA,EACtB,CAAA,cAAA,CACR,OAAOD,CAAsBqB,CAAAA,CAA4B,CAC3D,CAAA,CAAG,CAACpB,CAAO,CAAC,CAAA,CAIZ,OAEES,kBAAAA,CAAA,aAJiBE,CAAAA,CAAAA,EAAMQ,CAItB,CAAA,CACC,GAAKH,CAAAA,CAAAA,CACL,UAAW,CAAyBC,sBAAAA,EAAAA,CAAiB,CAAIC,CAAAA,EAAAA,CAAY,CACnEJ,CAAAA,EAAAA,CAAAA,CAAS,CAAIX,CAAAA,EAAAA,CAAAA,CAAWW,CAAM,CAAC,CAAA,CAAA,CAAK,EACtC,CAAA,CAAA,EAAIF,CAAa,EAAA,EAAE,CAClB,CAAA,CAAA,GAAGG,GAEHF,CACH,CAEJ,CACF,CAAA,CAEAL,CAAK,CAAA,WAAA,CAAc,MC3MnB,CAGO,SAASa,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,qBAAAA,CAAQC,SAAKF,CAAAA,CAAM,CAAC,CAC7B,CC8DO,IAAMG,CAAAA,CACX,qGCvDK,CAAA,IAAMC,CAAO,CAAA,CAAC,CACnB,QAAA,CAAAb,EACA,KAAAH,CAAAA,CAAAA,CAAQ,cACR,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,iEACAI,CAAAA,CAAAA,CACAb,CACF,CAAA,CACC,GAAGG,CAAAA,CAAAA,CAEHF,CACH,CACF","file":"Link.cjs","sourcesContent":["import React from \"react\";\nimport {\n Colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses =\n color && color === \"inherit\" ? \"inherit\" : color ? `text-${color}` : \"\";\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`font-sans antialiased ${typographyClasses} ${colorClasses} ${\n weight ? `!${fontWeight[weight]}` : \"\"\n } ${className ?? \"\"}`}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import { 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 = \"text-primary\",\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 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":"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,CAEgB,KAAM,CAAA,OAAA,CAAQA,CAAQ,CAAA,CAAIA,CAAW,CAAA,CAACA,CAAQ,CAGhE,EAAA,GAAA,CAAKL,CAAY,EAAA,CAChB,GAAIA,CAAAA,CAAQ,QAAS,CAAA,GAAG,CAAG,CAAA,CACzB,GAAM,CAACM,CAAYC,CAAAA,CAAe,CAAIP,CAAAA,CAAAA,CAAQ,MAAM,GAAG,CAAA,CACvD,OAAO,CAAA,EAAGM,CAAU,CAAA,MAAA,EAASC,CAAe,CAAA,CAC9C,CACA,OAAO,CAAQP,KAAAA,EAAAA,CAAO,CACxB,CAAA,CAAC,CACA,CAAA,IAAA,CAAK,GAAG,CAZW,CAAA,mBAAA,CAeX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AAMC,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"]}
|
package/dist/components/Link.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';var H={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},d=e=>{let[r,t]=e.split("-");return r==="heading"?H[t]||"p":r==="label"?"label":"p"},f={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=a.forwardRef(({variant:e="body-default",color:r="primary",as:t,className:o,children:n,weight:s,...T},m)=>{let y=M(e),g=r==="inherit"?"text-inherit":`text-text-${r}`,h=a.useMemo(()=>{let u=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return d(u)},[e]);return a.createElement(t||h,{ref:m,className:`font-sans antialiased ${y} ${g} ${s?`!${f[s]}`:""} ${o??""}`,...T},n)});i.displayName="Text";function l(...e){return twMerge(clsx(e))}var p="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var O=({children:e,color:r="inherit",variant:t="body-default-semibold",href:o,className:n,...s})=>a.createElement(i,{variant:t,color:r},a.createElement("a",{href:o,className:l("hover:opacity-80 transition-all ease-in-out active:scale-95 hover:underline",p,n),...s},e));export{O as Link};//# sourceMappingURL=Link.js.map
|
|
2
2
|
//# sourceMappingURL=Link.js.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":"kFA4FA,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,CAiBMC,CAAAA,CAAAA,CACJC,GAEKA,CAEgB,CAAA,CAAA,KAAA,CAAM,OAAQA,CAAAA,CAAQ,CAAIA,CAAAA,CAAAA,CAAW,CAACA,CAAQ,GAGhE,GAAKL,CAAAA,CAAAA,EAAY,CAChB,GAAIA,CAAQ,CAAA,QAAA,CAAS,GAAG,CAAA,CAAG,CACzB,GAAM,CAACM,CAAAA,CAAYC,CAAe,CAAA,CAAIP,CAAQ,CAAA,KAAA,CAAM,GAAG,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EAAAA,CAAAA,CAAWW,CAAM,CAAC,CAAA,CAAA,CAAK,EACtC,CAAA,CAAA,EAAIF,CAAa,EAAA,EAAE,CAClB,CAAA,CAAA,GAAGG,GAEHF,CACH,CAEJ,CACF,CAAA,CAEAL,CAAK,CAAA,WAAA,CAAc,MC3MnB,CAGO,SAASa,KAAMC,CAAsB,CAAA,CAC1C,OAAOC,OAAAA,CAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CC8DO,IAAMG,CAAAA,CACX,qGCvDK,CAAA,IAAMC,CAAO,CAAA,CAAC,CACnB,QAAA,CAAAb,EACA,KAAAH,CAAAA,CAAAA,CAAQ,cACR,CAAA,OAAA,CAAAV,CAAU,CAAA,uBAAA,CACV,IAAA2B,CAAAA,CAAAA,CACA,SAAAf,CAAAA,CAAAA,CACA,GAAGG,CACL,CACEN,GAAAA,CAAAA,CAAA,aAACD,CAAAA,CAAAA,CAAA,CAAK,OAASR,CAAAA,CAAAA,CAAS,KAAOU,CAAAA,CAAAA,CAAAA,CAC7BD,CAAA,CAAA,aAAA,CAAC,GACC,CAAA,CAAA,IAAA,CAAMkB,EACN,SAAWN,CAAAA,CAAAA,CACT,iEACAI,CAAAA,CAAAA,CACAb,CACF,CAAA,CACC,GAAGG,CAAAA,CAAAA,CAEHF,CACH,CACF","file":"Link.js","sourcesContent":["import React from \"react\";\nimport {\n Colors,\n TextColorVariant,\n PrimaryShades,\n SecondaryShades,\n TertiaryShades,\n Typography\n} from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype ColorCategory = keyof Omit<Colors, \"stroke\" | \"background\">;\ntype ColorValue<T extends ColorCategory> = T extends \"text\"\n ? TextColorVariant\n : T extends \"primary\"\n ? keyof PrimaryShades\n : T extends \"secondary\"\n ? keyof SecondaryShades\n : T extends \"tertiary\"\n ? keyof TertiaryShades\n : never;\n\ntype ColorKey = {\n [T in ColorCategory]: `${T}-${ColorValue<T>}`;\n}[ColorCategory];\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: ColorKey | \"inherit\";\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"text-primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses =\n color && color === \"inherit\" ? \"inherit\" : color ? `text-${color}` : \"\";\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`font-sans antialiased ${typographyClasses} ${colorClasses} ${\n weight ? `!${fontWeight[weight]}` : \"\"\n } ${className ?? \"\"}`}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import { 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 = \"text-primary\",\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 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":"kFAsEA,IAAMA,CAAmD,CAAA,CACvD,EAAI,CAAA,IAAA,CACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EA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CAAA,aAACD,CAAAA,CAAAA,CAAA,CAAK,OAASR,CAAAA,CAAAA,CAAS,KAAOU,CAAAA,CAAAA,CAAAA,CAC7BD,CAAA,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.js","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"]}
|
package/dist/components/Logo.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var o=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);function p(...C){return tailwindMerge.twMerge(clsx.clsx(C))}var g=({className:C})=>o__default.default.createElement("div",{className:p("lg:w-[76px] lg:h-[25px] w-[58px] h-[19px]",C)},o__default.default.createElement("svg",{width:"100%",height:"100%",viewBox:"0 0 76 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o__default.default.createElement("path",{d:"M0.8 15.584C0.8 13.9413 1.12 12.4693 1.76 11.168C2.4 9.84533 3.27467 8.8 4.384 8.032C5.49333 7.264 6.77333 6.88 8.224 6.88C9.39733 6.88 10.464 7.168 11.424 7.744C12.384 8.29867 13.1093 9.03467 13.6 9.952V0.639999H18.72V18.304C18.72 18.816 18.8053 19.1787 18.976 19.392C19.1467 19.584 19.424 19.7013 19.808 19.744V24C18.912 24.1707 18.1867 24.256 17.632 24.256C16.7573 24.256 16.0427 24.064 15.488 23.68C14.9547 23.296 14.624 22.7627 14.496 22.08L14.4 21.216C13.8027 22.2613 12.992 23.04 11.968 23.552C10.944 24.064 9.86667 24.32 8.736 24.32C7.584 24.32 6.51733 24.1067 5.536 23.68C4.576 23.232 3.73333 22.6133 3.008 21.824C2.304 21.0347 1.76 20.1067 1.376 19.04C0.992 17.9733 0.8 16.8213 0.8 15.584ZM13.632 17.664V14.144C13.4187 13.568 13.1093 13.0667 12.704 12.64C12.32 12.2133 11.872 11.872 11.36 11.616C10.8693 11.36 10.368 11.232 9.856 11.232C9.30133 11.232 8.78933 11.3493 8.32 11.584C7.872 11.8187 7.47733 12.1493 7.136 12.576C6.79467 12.9813 6.528 13.4507 6.336 13.984C6.16533 14.5173 6.08 15.0827 6.08 15.68C6.08 16.2987 6.176 16.8747 6.368 17.408C6.58133 17.92 6.86933 18.3787 7.232 18.784C7.59467 19.168 8.02133 19.4667 8.512 19.68C9.00267 19.8933 9.536 20 10.112 20C10.4747 20 10.8267 19.9467 11.168 19.84C11.5093 19.712 11.8293 19.552 12.128 19.36C12.448 19.168 12.736 18.9227 12.992 18.624C13.248 18.3253 13.4613 18.0053 13.632 17.664ZM30.0895 24.32C28.6602 24.32 27.3908 24.096 26.2815 23.648C25.1722 23.1787 24.2228 22.5493 23.4335 21.76C22.6655 20.9707 22.0788 20.064 21.6735 19.04C21.2682 17.9947 21.0655 16.9067 21.0655 15.776C21.0655 14.1547 21.4175 12.6827 22.1215 11.36C22.8468 10.016 23.8815 8.93867 25.2255 8.128C26.5695 7.296 28.1908 6.88 30.0895 6.88C31.9882 6.88 33.5988 7.28533 34.9215 8.096C36.2655 8.90667 37.2895 9.97333 37.9935 11.296C38.6975 12.5973 39.0495 14.016 39.0495 15.552C39.0495 15.8507 39.0282 16.1493 38.9855 16.448C38.9642 16.7253 38.9428 16.9707 38.9215 17.184H26.5055C26.5695 17.9307 26.7722 18.56 27.1135 19.072C27.4762 19.584 27.9348 19.9787 28.4895 20.256C29.0442 20.512 29.6308 20.64 30.2495 20.64C31.0175 20.64 31.7322 20.4587 32.3935 20.096C33.0762 19.7333 33.5455 19.2427 33.8015 18.624L38.1535 19.84C37.7268 20.7147 37.1188 21.4933 36.3295 22.176C35.5615 22.8373 34.6442 23.36 33.5775 23.744C32.5322 24.128 31.3695 24.32 30.0895 24.32ZM26.3775 14.048H33.6735C33.5882 13.344 33.3855 12.736 33.0655 12.224C32.7455 11.6907 32.3188 11.2853 31.7855 11.008C31.2522 10.7093 30.6655 10.56 30.0255 10.56C29.3642 10.56 28.7668 10.7093 28.2335 11.008C27.7215 11.2853 27.3055 11.6907 26.9855 12.224C26.6655 12.736 26.4628 13.344 26.3775 14.048ZM48.762 24.32C47.3327 24.32 46.0633 24.0853 44.954 23.616C43.8447 23.1467 42.8953 22.5067 42.106 21.696C41.338 20.8853 40.7513 19.9573 40.346 18.912C39.9407 17.8667 39.738 16.7573 39.738 15.584C39.738 14.048 40.09 12.6187 40.794 11.296C41.5193 9.97333 42.554 8.90667 43.898 8.096C45.242 7.28533 46.8633 6.88 48.762 6.88C50.682 6.88 52.3033 7.296 53.626 8.128C54.97 8.93867 55.9727 10.0053 56.634 11.328L51.642 12.832C51.322 12.32 50.906 11.9253 50.394 11.648C49.9033 11.3707 49.3487 11.232 48.73 11.232C48.026 11.232 47.386 11.4133 46.81 11.776C46.2553 12.1387 45.8073 12.64 45.466 13.28C45.146 13.92 44.986 14.688 44.986 15.584C44.986 16.4587 45.1567 17.2267 45.498 17.888C45.8393 18.5493 46.2873 19.072 46.842 19.456C47.3967 19.8187 48.026 20 48.73 20C49.1567 20 49.5513 19.936 49.914 19.808C50.298 19.6587 50.6393 19.456 50.938 19.2C51.258 18.944 51.5033 18.656 51.674 18.336L56.666 19.872C56.2607 20.7253 55.674 21.4933 54.906 22.176C54.1593 22.8373 53.274 23.36 52.25 23.744C51.226 24.128 50.0633 24.32 48.762 24.32ZM69.636 24L65.252 17.28L63.46 19.104V24H58.34V0.639999H63.46V14.144L69.156 7.2H74.564L68.516 14.432L75.076 24H69.636Z",fill:"#080808"})));
|
|
1
|
+
'use strict';var o=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);function p(...C){return tailwindMerge.twMerge(clsx.clsx(C))}var g=({className:C})=>o__default.default.createElement("div",{className:p("lg:w-[76px] lg:h-[25px] w-[58px] h-[19px]",C)},o__default.default.createElement("svg",{width:"100%",height:"100%",viewBox:"0 0 76 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o__default.default.createElement("path",{d:"M0.8 15.584C0.8 13.9413 1.12 12.4693 1.76 11.168C2.4 9.84533 3.27467 8.8 4.384 8.032C5.49333 7.264 6.77333 6.88 8.224 6.88C9.39733 6.88 10.464 7.168 11.424 7.744C12.384 8.29867 13.1093 9.03467 13.6 9.952V0.639999H18.72V18.304C18.72 18.816 18.8053 19.1787 18.976 19.392C19.1467 19.584 19.424 19.7013 19.808 19.744V24C18.912 24.1707 18.1867 24.256 17.632 24.256C16.7573 24.256 16.0427 24.064 15.488 23.68C14.9547 23.296 14.624 22.7627 14.496 22.08L14.4 21.216C13.8027 22.2613 12.992 23.04 11.968 23.552C10.944 24.064 9.86667 24.32 8.736 24.32C7.584 24.32 6.51733 24.1067 5.536 23.68C4.576 23.232 3.73333 22.6133 3.008 21.824C2.304 21.0347 1.76 20.1067 1.376 19.04C0.992 17.9733 0.8 16.8213 0.8 15.584ZM13.632 17.664V14.144C13.4187 13.568 13.1093 13.0667 12.704 12.64C12.32 12.2133 11.872 11.872 11.36 11.616C10.8693 11.36 10.368 11.232 9.856 11.232C9.30133 11.232 8.78933 11.3493 8.32 11.584C7.872 11.8187 7.47733 12.1493 7.136 12.576C6.79467 12.9813 6.528 13.4507 6.336 13.984C6.16533 14.5173 6.08 15.0827 6.08 15.68C6.08 16.2987 6.176 16.8747 6.368 17.408C6.58133 17.92 6.86933 18.3787 7.232 18.784C7.59467 19.168 8.02133 19.4667 8.512 19.68C9.00267 19.8933 9.536 20 10.112 20C10.4747 20 10.8267 19.9467 11.168 19.84C11.5093 19.712 11.8293 19.552 12.128 19.36C12.448 19.168 12.736 18.9227 12.992 18.624C13.248 18.3253 13.4613 18.0053 13.632 17.664ZM30.0895 24.32C28.6602 24.32 27.3908 24.096 26.2815 23.648C25.1722 23.1787 24.2228 22.5493 23.4335 21.76C22.6655 20.9707 22.0788 20.064 21.6735 19.04C21.2682 17.9947 21.0655 16.9067 21.0655 15.776C21.0655 14.1547 21.4175 12.6827 22.1215 11.36C22.8468 10.016 23.8815 8.93867 25.2255 8.128C26.5695 7.296 28.1908 6.88 30.0895 6.88C31.9882 6.88 33.5988 7.28533 34.9215 8.096C36.2655 8.90667 37.2895 9.97333 37.9935 11.296C38.6975 12.5973 39.0495 14.016 39.0495 15.552C39.0495 15.8507 39.0282 16.1493 38.9855 16.448C38.9642 16.7253 38.9428 16.9707 38.9215 17.184H26.5055C26.5695 17.9307 26.7722 18.56 27.1135 19.072C27.4762 19.584 27.9348 19.9787 28.4895 20.256C29.0442 20.512 29.6308 20.64 30.2495 20.64C31.0175 20.64 31.7322 20.4587 32.3935 20.096C33.0762 19.7333 33.5455 19.2427 33.8015 18.624L38.1535 19.84C37.7268 20.7147 37.1188 21.4933 36.3295 22.176C35.5615 22.8373 34.6442 23.36 33.5775 23.744C32.5322 24.128 31.3695 24.32 30.0895 24.32ZM26.3775 14.048H33.6735C33.5882 13.344 33.3855 12.736 33.0655 12.224C32.7455 11.6907 32.3188 11.2853 31.7855 11.008C31.2522 10.7093 30.6655 10.56 30.0255 10.56C29.3642 10.56 28.7668 10.7093 28.2335 11.008C27.7215 11.2853 27.3055 11.6907 26.9855 12.224C26.6655 12.736 26.4628 13.344 26.3775 14.048ZM48.762 24.32C47.3327 24.32 46.0633 24.0853 44.954 23.616C43.8447 23.1467 42.8953 22.5067 42.106 21.696C41.338 20.8853 40.7513 19.9573 40.346 18.912C39.9407 17.8667 39.738 16.7573 39.738 15.584C39.738 14.048 40.09 12.6187 40.794 11.296C41.5193 9.97333 42.554 8.90667 43.898 8.096C45.242 7.28533 46.8633 6.88 48.762 6.88C50.682 6.88 52.3033 7.296 53.626 8.128C54.97 8.93867 55.9727 10.0053 56.634 11.328L51.642 12.832C51.322 12.32 50.906 11.9253 50.394 11.648C49.9033 11.3707 49.3487 11.232 48.73 11.232C48.026 11.232 47.386 11.4133 46.81 11.776C46.2553 12.1387 45.8073 12.64 45.466 13.28C45.146 13.92 44.986 14.688 44.986 15.584C44.986 16.4587 45.1567 17.2267 45.498 17.888C45.8393 18.5493 46.2873 19.072 46.842 19.456C47.3967 19.8187 48.026 20 48.73 20C49.1567 20 49.5513 19.936 49.914 19.808C50.298 19.6587 50.6393 19.456 50.938 19.2C51.258 18.944 51.5033 18.656 51.674 18.336L56.666 19.872C56.2607 20.7253 55.674 21.4933 54.906 22.176C54.1593 22.8373 53.274 23.36 52.25 23.744C51.226 24.128 50.0633 24.32 48.762 24.32ZM69.636 24L65.252 17.28L63.46 19.104V24H58.34V0.639999H63.46V14.144L69.156 7.2H74.564L68.516 14.432L75.076 24H69.636Z",fill:"#080808"})));
|
|
2
2
|
exports.Logo=g;//# sourceMappingURL=Logo.cjs.map
|
|
3
3
|
//# sourceMappingURL=Logo.cjs.map
|
package/dist/components/Logo.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import o from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function p(...C){return twMerge(clsx(C))}var g=({className:C})=>o.createElement("div",{className:p("lg:w-[76px] lg:h-[25px] w-[58px] h-[19px]",C)},o.createElement("svg",{width:"100%",height:"100%",viewBox:"0 0 76 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o.createElement("path",{d:"M0.8 15.584C0.8 13.9413 1.12 12.4693 1.76 11.168C2.4 9.84533 3.27467 8.8 4.384 8.032C5.49333 7.264 6.77333 6.88 8.224 6.88C9.39733 6.88 10.464 7.168 11.424 7.744C12.384 8.29867 13.1093 9.03467 13.6 9.952V0.639999H18.72V18.304C18.72 18.816 18.8053 19.1787 18.976 19.392C19.1467 19.584 19.424 19.7013 19.808 19.744V24C18.912 24.1707 18.1867 24.256 17.632 24.256C16.7573 24.256 16.0427 24.064 15.488 23.68C14.9547 23.296 14.624 22.7627 14.496 22.08L14.4 21.216C13.8027 22.2613 12.992 23.04 11.968 23.552C10.944 24.064 9.86667 24.32 8.736 24.32C7.584 24.32 6.51733 24.1067 5.536 23.68C4.576 23.232 3.73333 22.6133 3.008 21.824C2.304 21.0347 1.76 20.1067 1.376 19.04C0.992 17.9733 0.8 16.8213 0.8 15.584ZM13.632 17.664V14.144C13.4187 13.568 13.1093 13.0667 12.704 12.64C12.32 12.2133 11.872 11.872 11.36 11.616C10.8693 11.36 10.368 11.232 9.856 11.232C9.30133 11.232 8.78933 11.3493 8.32 11.584C7.872 11.8187 7.47733 12.1493 7.136 12.576C6.79467 12.9813 6.528 13.4507 6.336 13.984C6.16533 14.5173 6.08 15.0827 6.08 15.68C6.08 16.2987 6.176 16.8747 6.368 17.408C6.58133 17.92 6.86933 18.3787 7.232 18.784C7.59467 19.168 8.02133 19.4667 8.512 19.68C9.00267 19.8933 9.536 20 10.112 20C10.4747 20 10.8267 19.9467 11.168 19.84C11.5093 19.712 11.8293 19.552 12.128 19.36C12.448 19.168 12.736 18.9227 12.992 18.624C13.248 18.3253 13.4613 18.0053 13.632 17.664ZM30.0895 24.32C28.6602 24.32 27.3908 24.096 26.2815 23.648C25.1722 23.1787 24.2228 22.5493 23.4335 21.76C22.6655 20.9707 22.0788 20.064 21.6735 19.04C21.2682 17.9947 21.0655 16.9067 21.0655 15.776C21.0655 14.1547 21.4175 12.6827 22.1215 11.36C22.8468 10.016 23.8815 8.93867 25.2255 8.128C26.5695 7.296 28.1908 6.88 30.0895 6.88C31.9882 6.88 33.5988 7.28533 34.9215 8.096C36.2655 8.90667 37.2895 9.97333 37.9935 11.296C38.6975 12.5973 39.0495 14.016 39.0495 15.552C39.0495 15.8507 39.0282 16.1493 38.9855 16.448C38.9642 16.7253 38.9428 16.9707 38.9215 17.184H26.5055C26.5695 17.9307 26.7722 18.56 27.1135 19.072C27.4762 19.584 27.9348 19.9787 28.4895 20.256C29.0442 20.512 29.6308 20.64 30.2495 20.64C31.0175 20.64 31.7322 20.4587 32.3935 20.096C33.0762 19.7333 33.5455 19.2427 33.8015 18.624L38.1535 19.84C37.7268 20.7147 37.1188 21.4933 36.3295 22.176C35.5615 22.8373 34.6442 23.36 33.5775 23.744C32.5322 24.128 31.3695 24.32 30.0895 24.32ZM26.3775 14.048H33.6735C33.5882 13.344 33.3855 12.736 33.0655 12.224C32.7455 11.6907 32.3188 11.2853 31.7855 11.008C31.2522 10.7093 30.6655 10.56 30.0255 10.56C29.3642 10.56 28.7668 10.7093 28.2335 11.008C27.7215 11.2853 27.3055 11.6907 26.9855 12.224C26.6655 12.736 26.4628 13.344 26.3775 14.048ZM48.762 24.32C47.3327 24.32 46.0633 24.0853 44.954 23.616C43.8447 23.1467 42.8953 22.5067 42.106 21.696C41.338 20.8853 40.7513 19.9573 40.346 18.912C39.9407 17.8667 39.738 16.7573 39.738 15.584C39.738 14.048 40.09 12.6187 40.794 11.296C41.5193 9.97333 42.554 8.90667 43.898 8.096C45.242 7.28533 46.8633 6.88 48.762 6.88C50.682 6.88 52.3033 7.296 53.626 8.128C54.97 8.93867 55.9727 10.0053 56.634 11.328L51.642 12.832C51.322 12.32 50.906 11.9253 50.394 11.648C49.9033 11.3707 49.3487 11.232 48.73 11.232C48.026 11.232 47.386 11.4133 46.81 11.776C46.2553 12.1387 45.8073 12.64 45.466 13.28C45.146 13.92 44.986 14.688 44.986 15.584C44.986 16.4587 45.1567 17.2267 45.498 17.888C45.8393 18.5493 46.2873 19.072 46.842 19.456C47.3967 19.8187 48.026 20 48.73 20C49.1567 20 49.5513 19.936 49.914 19.808C50.298 19.6587 50.6393 19.456 50.938 19.2C51.258 18.944 51.5033 18.656 51.674 18.336L56.666 19.872C56.2607 20.7253 55.674 21.4933 54.906 22.176C54.1593 22.8373 53.274 23.36 52.25 23.744C51.226 24.128 50.0633 24.32 48.762 24.32ZM69.636 24L65.252 17.28L63.46 19.104V24H58.34V0.639999H63.46V14.144L69.156 7.2H74.564L68.516 14.432L75.076 24H69.636Z",fill:"#080808"})));
|
|
1
|
+
import o from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function p(...C){return twMerge(clsx(C))}var g=({className:C})=>o.createElement("div",{className:p("lg:w-[76px] lg:h-[25px] w-[58px] h-[19px]",C)},o.createElement("svg",{width:"100%",height:"100%",viewBox:"0 0 76 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o.createElement("path",{d:"M0.8 15.584C0.8 13.9413 1.12 12.4693 1.76 11.168C2.4 9.84533 3.27467 8.8 4.384 8.032C5.49333 7.264 6.77333 6.88 8.224 6.88C9.39733 6.88 10.464 7.168 11.424 7.744C12.384 8.29867 13.1093 9.03467 13.6 9.952V0.639999H18.72V18.304C18.72 18.816 18.8053 19.1787 18.976 19.392C19.1467 19.584 19.424 19.7013 19.808 19.744V24C18.912 24.1707 18.1867 24.256 17.632 24.256C16.7573 24.256 16.0427 24.064 15.488 23.68C14.9547 23.296 14.624 22.7627 14.496 22.08L14.4 21.216C13.8027 22.2613 12.992 23.04 11.968 23.552C10.944 24.064 9.86667 24.32 8.736 24.32C7.584 24.32 6.51733 24.1067 5.536 23.68C4.576 23.232 3.73333 22.6133 3.008 21.824C2.304 21.0347 1.76 20.1067 1.376 19.04C0.992 17.9733 0.8 16.8213 0.8 15.584ZM13.632 17.664V14.144C13.4187 13.568 13.1093 13.0667 12.704 12.64C12.32 12.2133 11.872 11.872 11.36 11.616C10.8693 11.36 10.368 11.232 9.856 11.232C9.30133 11.232 8.78933 11.3493 8.32 11.584C7.872 11.8187 7.47733 12.1493 7.136 12.576C6.79467 12.9813 6.528 13.4507 6.336 13.984C6.16533 14.5173 6.08 15.0827 6.08 15.68C6.08 16.2987 6.176 16.8747 6.368 17.408C6.58133 17.92 6.86933 18.3787 7.232 18.784C7.59467 19.168 8.02133 19.4667 8.512 19.68C9.00267 19.8933 9.536 20 10.112 20C10.4747 20 10.8267 19.9467 11.168 19.84C11.5093 19.712 11.8293 19.552 12.128 19.36C12.448 19.168 12.736 18.9227 12.992 18.624C13.248 18.3253 13.4613 18.0053 13.632 17.664ZM30.0895 24.32C28.6602 24.32 27.3908 24.096 26.2815 23.648C25.1722 23.1787 24.2228 22.5493 23.4335 21.76C22.6655 20.9707 22.0788 20.064 21.6735 19.04C21.2682 17.9947 21.0655 16.9067 21.0655 15.776C21.0655 14.1547 21.4175 12.6827 22.1215 11.36C22.8468 10.016 23.8815 8.93867 25.2255 8.128C26.5695 7.296 28.1908 6.88 30.0895 6.88C31.9882 6.88 33.5988 7.28533 34.9215 8.096C36.2655 8.90667 37.2895 9.97333 37.9935 11.296C38.6975 12.5973 39.0495 14.016 39.0495 15.552C39.0495 15.8507 39.0282 16.1493 38.9855 16.448C38.9642 16.7253 38.9428 16.9707 38.9215 17.184H26.5055C26.5695 17.9307 26.7722 18.56 27.1135 19.072C27.4762 19.584 27.9348 19.9787 28.4895 20.256C29.0442 20.512 29.6308 20.64 30.2495 20.64C31.0175 20.64 31.7322 20.4587 32.3935 20.096C33.0762 19.7333 33.5455 19.2427 33.8015 18.624L38.1535 19.84C37.7268 20.7147 37.1188 21.4933 36.3295 22.176C35.5615 22.8373 34.6442 23.36 33.5775 23.744C32.5322 24.128 31.3695 24.32 30.0895 24.32ZM26.3775 14.048H33.6735C33.5882 13.344 33.3855 12.736 33.0655 12.224C32.7455 11.6907 32.3188 11.2853 31.7855 11.008C31.2522 10.7093 30.6655 10.56 30.0255 10.56C29.3642 10.56 28.7668 10.7093 28.2335 11.008C27.7215 11.2853 27.3055 11.6907 26.9855 12.224C26.6655 12.736 26.4628 13.344 26.3775 14.048ZM48.762 24.32C47.3327 24.32 46.0633 24.0853 44.954 23.616C43.8447 23.1467 42.8953 22.5067 42.106 21.696C41.338 20.8853 40.7513 19.9573 40.346 18.912C39.9407 17.8667 39.738 16.7573 39.738 15.584C39.738 14.048 40.09 12.6187 40.794 11.296C41.5193 9.97333 42.554 8.90667 43.898 8.096C45.242 7.28533 46.8633 6.88 48.762 6.88C50.682 6.88 52.3033 7.296 53.626 8.128C54.97 8.93867 55.9727 10.0053 56.634 11.328L51.642 12.832C51.322 12.32 50.906 11.9253 50.394 11.648C49.9033 11.3707 49.3487 11.232 48.73 11.232C48.026 11.232 47.386 11.4133 46.81 11.776C46.2553 12.1387 45.8073 12.64 45.466 13.28C45.146 13.92 44.986 14.688 44.986 15.584C44.986 16.4587 45.1567 17.2267 45.498 17.888C45.8393 18.5493 46.2873 19.072 46.842 19.456C47.3967 19.8187 48.026 20 48.73 20C49.1567 20 49.5513 19.936 49.914 19.808C50.298 19.6587 50.6393 19.456 50.938 19.2C51.258 18.944 51.5033 18.656 51.674 18.336L56.666 19.872C56.2607 20.7253 55.674 21.4933 54.906 22.176C54.1593 22.8373 53.274 23.36 52.25 23.744C51.226 24.128 50.0633 24.32 48.762 24.32ZM69.636 24L65.252 17.28L63.46 19.104V24H58.34V0.639999H63.46V14.144L69.156 7.2H74.564L68.516 14.432L75.076 24H69.636Z",fill:"#080808"})));
|
|
2
2
|
export{g as Logo};//# sourceMappingURL=Logo.js.map
|
|
3
3
|
//# sourceMappingURL=Logo.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var p=require('react'),g=require('@radix-ui/react-popover'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),icons=require('@deckai/icons');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var p__namespace=/*#__PURE__*/_interopNamespace(p);var g__namespace=/*#__PURE__*/_interopNamespace(g);var P="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",R="ring-2 ring-ring ring-offset-2";function u(...t){return tailwindMerge.twMerge(clsx.clsx(t))}var w={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB"},X={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},Y=t=>{if(!t)return {width:"24px",height:"24px"};let r=Array.isArray(t)?t:[t],e={},o;return r.forEach(n=>{if(typeof n=="number")o=`${n}px`;else {let[s,i]=n.split(":"),d=parseInt(i,10);e[`@media (min-width: ${X[s]})`]=`${d}px`;}}),{width:o||"24px",height:o||"24px",...Object.entries(e).reduce((n,[s,i])=>({...n,[s]:{width:i,height:i}}),{})}},b=p__namespace.default.forwardRef(({name:t,size:r=24,color:e="primary",title:o,className:n,style:s={},...i},d)=>{let l=icons.IconMap[t],a=Y(r);return p__namespace.default.createElement("div",{className:u("flex justify-center items-center",n),style:{...a,"--icon-stroke":w[e],...s}},p__namespace.default.createElement(l,{ref:d,"aria-hidden":!o,"aria-label":o,stroke:t.includes("filled")?void 0:w[e],...i}))});b.displayName="Icon";var I=({className:t,end:r,iconName:e,color:o,size:n,title:s,label:i,labelClassName:d,id:l,...a})=>p__namespace.createElement("div",{className:"space-y-2"},i&&p__namespace.createElement("label",{htmlFor:l,className:u("block text-sm font-medium text-text-primary",d)},i),p__namespace.createElement("div",{className:"relative"},p__namespace.createElement("input",{id:l,className:u(`font-sans lg:text-body-default text-xs flex w-full rounded-lg border border-secondary-50 bg-background-0 px-3 md:py-3 py-2 text-secondary ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text-primary ${P} disabled:cursor-not-allowed disabled:opacity-50 md:text-md`,r&&"pr-10",t),...a}),r&&p__namespace.createElement("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3"},e?p__namespace.createElement(b,{name:e,color:o,size:n,title:s}):r)));var O=({value:t,label:r,onChange:e,selected:o})=>p__namespace.default.createElement("button",{type:"button",className:u("relative w-full h-full text-left px-2 py-1.5 text-sm cursor-pointer hover:bg-gray-100 rounded",o&&"bg-gray-100"),onClick:()=>{e?.(t);}},r);var ee={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},te=t=>{let[r,e]=t.split("-");return r==="heading"?ee[e]||"p":r==="label"?"label":"p"},re={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},oe=t=>t?(Array.isArray(t)?t:[t]).map(e=>{if(e.includes(":")){let[o,n]=e.split(":");return `${o}:text-${n}`}return `text-${e}`}).join(" "):"text-body-default",v=p__namespace.default.forwardRef(({variant:t="body-default",color:r="text-primary",as:e,className:o,children:n,weight:s,...i},d)=>{let l=oe(t),a=r&&r==="inherit"?"inherit":r?`text-${r}`:"",y=p__namespace.default.useMemo(()=>{let c=typeof t=="string"?t.split(":").pop():Array.isArray(t)?t[0].split(":").pop():"body-default";return te(c)},[t]);return p__namespace.default.createElement(e||y,{ref:d,className:`font-sans antialiased ${l} ${a} ${s?`!${re[s]}`:""} ${o??""}`,...i},n)});v.displayName="Text";var k=({children:t,type:r="button",className:e,disabled:o,...n})=>p__namespace.default.createElement("button",{type:r,disabled:o,className:`appearance-none hover:opacity-80 transition-all active:scale-95 ${P} ${e} ${o?"opacity-50 cursor-not-allowed":""}`,...n},t);var j=({children:t,color:r="primary",className:e,onClose:o,...n})=>{let[s,i]=p.useState(!1),d=p.useCallback(()=>{i(!0);},[]),l=p.useCallback(()=>{i(!1);},[]),a=p__namespace.default.createElement("div",{className:u("flex gap-2",o?"justify-between items-center":"items-center justify-center","hover:bg-primary-100 rounded bg-secondary-400 px-2 py-1 sm:px-3 sm:py-1.5 h-min hover:text-white",r==="primary"?"text-primary-100":"text-primary",e),onMouseEnter:d,onMouseLeave:l},typeof t=="string"?p__namespace.default.createElement(v,{color:"inherit",variant:["md:body-default-medium","body-xxs-medium"],className:"truncate pt-0.5"},t):t,o&&p__namespace.default.createElement(k,{...n,onClick:o,className:"flex items-center justify-center"},p__namespace.default.createElement(b,{name:"close",size:10,color:s?"white":"primaryBlue"})));return o?a:p__namespace.default.createElement(k,{...n},a)};var B=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,z=clsx.clsx,K=(t,r)=>e=>{var o;if(r?.variants==null)return z(t,e?.class,e?.className);let{variants:n,defaultVariants:s}=r,i=Object.keys(n).map(a=>{let y=e?.[a],f=s?.[a];if(y===null)return null;let c=B(y)||B(f);return n[a][c]}),d=e&&Object.entries(e).reduce((a,y)=>{let[f,c]=y;return c===void 0||(a[f]=c),a},{}),l=r==null||(o=r.compoundVariants)===null||o===void 0?void 0:o.reduce((a,y)=>{let{class:f,className:c,...L}=y;return Object.entries(L).every(C=>{let[x,T]=C;return Array.isArray(T)?T.includes({...s,...d}[x]):{...s,...d}[x]===T})?[...a,f,c]:a},[]);return z(t,i,l,e?.class,e?.className)};var ie=K("animate-spin rounded-full border-current border-t-transparent",{variants:{size:{sm:"h-4 w-4 border-4",md:"h-6 w-6 border-4",lg:"h-8 w-8 border-8"}},defaultVariants:{size:"md"}}),A=p__namespace.forwardRef(({size:t,className:r,customSize:e,...o},n)=>{let s=e?{width:e,height:e,borderWidth:Math.max(2,Math.floor(e/16))}:{};return p__namespace.createElement("div",{role:"status","aria-label":"Loading",ref:n,className:u(ie({size:t}),"text-primary-100",r),style:s,...o},p__namespace.createElement("span",{className:"sr-only"},"Loading..."))});A.displayName="Spinner";var et=({options:t,selectedValues:r,onSelectionChange:e,placeholder:o="Select items...",className:n,label:s,labelClassName:i,id:d,maxSelections:l,disabled:a,noOptionsMessage:y,loading:f,errorMessage:c})=>{let[L,C]=p.useState(!1),[x,T]=p.useState(""),F=p.useMemo(()=>t.filter(m=>r.includes(m.value)),[t,r]),S=p.useMemo(()=>t.filter(m=>!r.includes(m.value)&&m.label.toLowerCase().includes(x.toLowerCase())),[t,r,x]),q=p.useCallback(m=>{e([...r,m]),T(""),C(!1);},[l,e,r]),D=p.useCallback(m=>{e(r.filter(E=>E!==m));},[e,r]);return p__namespace.default.createElement("div",{className:"py-2"},p__namespace.default.createElement(g__namespace.Root,{open:L,onOpenChange:C},p__namespace.default.createElement("div",{className:`relative w-full font-sans text-text-secondary ${n}`},p__namespace.default.createElement(g__namespace.Trigger,{asChild:!0},p__namespace.default.createElement("div",{className:"relative flex-1"},p__namespace.default.createElement(I,{id:d,label:s,labelClassName:i,placeholder:l&&r.length>=l?`Maximum ${l} items selected`:o,value:x,onChange:m=>T(m.target.value),className:`flex-1 ${L&&R}`,disabled:a||!!l&&r.length>=l,end:f?p__namespace.default.createElement(A,{size:"sm"}):p__namespace.default.createElement(b,{name:"search-normal",size:["lg:24",18]})}))),p__namespace.default.createElement(g__namespace.Portal,null,p__namespace.default.createElement(g__namespace.Content,{className:"w-[--radix-popover-trigger-width] p-1 bg-white rounded-md shadow-lg border z-20",sideOffset:5},p__namespace.default.createElement("div",{className:"max-h-60 overflow-auto flex flex-col items-start"},S.length>0?S.map(({label:m,value:E})=>p__namespace.default.createElement(O,{key:E,label:m,value:E,onChange:q})):p__namespace.default.createElement(v,{variant:"label-default",className:"text-text-secondary"},y||"No results found")))))),p__namespace.default.createElement("div",{className:"flex flex-col gap-1 pt-2"},c&&p__namespace.default.createElement(v,{variant:"label-default",color:"tertiary-20"},c),p__namespace.default.createElement("div",{className:"flex flex-wrap gap-2"},F.map(m=>p__namespace.default.createElement(j,{key:m.value,onClose:()=>D(m.value)},m.label)))))};if (exports.default) module.exports = exports.default;exports.MultiSelectCombobox=et;//# sourceMappingURL=MultiSelectCombobox.cjs.map
|
|
1
|
+
'use strict';var a=require('react'),v=require('@radix-ui/react-popover'),H=require('@radix-ui/react-collapsible'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),icons=require('@deckai/icons');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var a__namespace=/*#__PURE__*/_interopNamespace(a);var v__namespace=/*#__PURE__*/_interopNamespace(v);var H__namespace=/*#__PURE__*/_interopNamespace(H);function c(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var _={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888"},ie={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},le=e=>{if(!e)return {width:"24px",height:"24px"};let r=Array.isArray(e)?e:[e],t={},n;return r.forEach(s=>{if(typeof s=="number")n=`${s}px`;else {let[i,d]=s.split(":"),u=parseInt(d,10);t[`@media (min-width: ${ie[i]})`]=`${u}px`;}}),{width:n||"24px",height:n||"24px",...Object.entries(t).reduce((s,[i,d])=>({...s,[i]:{width:d,height:d}}),{})}},x=a__namespace.default.forwardRef(({name:e,size:r=24,color:t="primary",title:n,className:s,style:i={},...d},u)=>{let m=icons.IconMap[e],l=le(r);return a__namespace.default.createElement("div",{className:c("flex justify-center items-center",s),style:{...l,"--icon-stroke":_[t],...i}},a__namespace.default.createElement(m,{ref:u,"aria-hidden":!n,"aria-label":n,stroke:e.includes("filled")?void 0:_[t],...d}))});x.displayName="Icon";var F=({className:e,end:r,iconName:t,color:n,size:s,title:i,label:d,labelClassName:u,id:m,children:l,forceShowFocusRing:f,...y})=>a__namespace.createElement("div",{className:"py-2"},d&&a__namespace.createElement("label",{htmlFor:m,className:c("block text-sm font-medium text-text-primary",u)},d),a__namespace.createElement("div",{className:c("relative flex flex-col gap-2 w-full rounded-lg border border-secondary-50 bg-background-0 px-3 md:py-3 py-2 text-secondary ring-offset-background disabled:opacity-50",{"ring-2 ring-primary ring-offset-2":f,"focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2":!f})},a__namespace.createElement("div",{className:"flex relative"},a__namespace.createElement("input",{id:m,className:c("font-sans lg:text-body-default text-xs flex w-full file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-secondary text-text disabled:cursor-not-allowed md:text-md focus:outline-none",r&&"pr-10",e),...y}),r&&a__namespace.createElement("div",{className:"absolute inset-y-0 right-0 flex items-center"},t?a__namespace.createElement(x,{name:t,color:n,size:s,title:i}):r)),l));var pe={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},me=e=>{let[r,t]=e.split("-");return r==="heading"?pe[t]||"p":r==="label"?"label":"p"},de={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},ce=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[n,s]=t.split(":");return `${n}:text-${s}`}return `text-${t}`}).join(" "):"text-body-default",b=a__namespace.default.forwardRef(({variant:e="body-default",color:r="primary",as:t,className:n,children:s,weight:i,...d},u)=>{let m=ce(e),l=r==="inherit"?"text-inherit":`text-text-${r}`,f=a__namespace.default.useMemo(()=>{let g=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return me(g)},[e]);return a__namespace.default.createElement(t||f,{ref:u,className:`font-sans antialiased ${m} ${l} ${i?`!${de[i]}`:""} ${n??""}`,...d},s)});b.displayName="Text";var $="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";var D=({value:e,label:r,onChange:t,selected:n,color:s,disabled:i,className:d})=>a__namespace.default.createElement("button",{type:"button",disabled:i,className:c("relative w-full text-left px-2 py-1.5 text-sm rounded","cursor-pointer hover:bg-gray-100","disabled:opacity-50 disabled:cursor-not-allowed",n&&"bg-gray-100","flex items-center gap-2",$,d),onClick:()=>{t?.(e);}},a__namespace.default.createElement(b,{variant:"body-default-medium",color:s==="danger"?"danger":"inherit"},r));var A=a__namespace.default.forwardRef(({children:e,type:r="button",className:t,disabled:n,...s},i)=>a__namespace.default.createElement("button",{ref:i,type:r,disabled:n,className:c("appearance-none hover:opacity-80 transition-all active:scale-95",$,n&&"opacity-50 cursor-not-allowed",t),...s},e));A.displayName="Pressable";var J=({children:e,color:r="primary",className:t,onClose:n,...s})=>{let[i,d]=a.useState(!1),u=a.useCallback(()=>{d(!0);},[]),m=a.useCallback(()=>{d(!1);},[]),l=a__namespace.default.createElement("div",{className:c("flex gap-2",n?"justify-between items-center":"items-center justify-center","hover:bg-primary-100 rounded bg-secondary-400 px-2 py-1 sm:px-3 sm:py-1.5 h-min hover:text-white",r==="primary"?"text-primary-100":"text-text",t),onMouseEnter:u,onMouseLeave:m},typeof e=="string"?a__namespace.default.createElement(b,{color:"inherit",variant:["md:body-default-medium","body-xxs-medium"],className:"truncate pt-0.5"},e):e,n&&a__namespace.default.createElement(A,{...s,onClick:n,className:"flex items-center justify-center"},a__namespace.default.createElement(x,{name:"close",size:10,color:i?"white":"primaryBlue"})));return n?l:a__namespace.default.createElement(A,{...s},l)};var X=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Y=clsx.clsx,Z=(e,r)=>t=>{var n;if(r?.variants==null)return Y(e,t?.class,t?.className);let{variants:s,defaultVariants:i}=r,d=Object.keys(s).map(l=>{let f=t?.[l],y=i?.[l];if(f===null)return null;let g=X(f)||X(y);return s[l][g]}),u=t&&Object.entries(t).reduce((l,f)=>{let[y,g]=f;return g===void 0||(l[y]=g),l},{}),m=r==null||(n=r.compoundVariants)===null||n===void 0?void 0:n.reduce((l,f)=>{let{class:y,className:g,...k}=f;return Object.entries(k).every(C=>{let[N,h]=C;return Array.isArray(h)?h.includes({...i,...u}[N]):{...i,...u}[N]===h})?[...l,y,g]:l},[]);return Y(e,d,m,t?.class,t?.className)};var be=Z("animate-spin rounded-full border-current border-t-transparent",{variants:{size:{sm:"h-4 w-4 border-3",md:"h-6 w-6 border-4",lg:"h-8 w-8 border-8"}},defaultVariants:{size:"md"}}),I=a__namespace.forwardRef(({size:e,className:r,customSize:t,...n},s)=>{let i=t?{width:t,height:t,borderWidth:Math.max(2,Math.floor(t/16))}:{};return a__namespace.createElement("div",{role:"status","aria-label":"Loading",ref:s,className:c(be({size:e}),"text-primary-100",r),style:i,...n},a__namespace.createElement("span",{className:"sr-only"},"Loading..."))});I.displayName="Spinner";var mt=({options:e,selectedValues:r,onSelectionChange:t,placeholder:n="Select items...",className:s,label:i,labelClassName:d,id:u,maxSelections:m,disabled:l,noOptionsMessage:f,loading:y,errorMessage:g,container:k})=>{let[C,N]=a.useState(!1),[h,L]=a.useState(""),[G,B]=a.useState({});a__namespace.default.useEffect(()=>{L("");},[r]);let M=a.useMemo(()=>e.length>0&&"options"in e[0],[e]),z=a.useMemo(()=>M?e.reduce((o,p)=>[...o,...p.options],[]):e,[M,e]),K=a.useMemo(()=>{if(!M){let o=e.filter(p=>!r.includes(p.value)&&(typeof p.label=="string"?p.label.toLowerCase().includes(h.toLowerCase()):typeof p.label=="number"?p.label.toString().includes(h):!1));return o.length>0?[{label:"",options:o}]:[]}return e.map(o=>({...o,options:o.options.filter(p=>!r.includes(p.value)&&(typeof p.label=="string"?p.label.toLowerCase().includes(h.toLowerCase()):typeof p.label=="number"?p.label.toString().includes(h):!1))})).filter(o=>o.options.length>0)},[M,e,r,h]),W=a.useMemo(()=>z.filter(o=>r.includes(o.value)),[z,r]),ee=a.useCallback(o=>{(!m||r.length<m)&&(t([...r,o]),L(""));},[m,t,r]),te=a.useCallback(o=>{t(r.filter(p=>p!==o)),L("");},[t,r]),re=a.useCallback(o=>{B(p=>({...p,[o]:!p[o]}));},[]);return a__namespace.default.useEffect(()=>{if(M){let o=e.reduce((p,w)=>({...p,[w.label]:!0}),{});B(o);}},[M,e]),a__namespace.default.createElement("div",{className:"py-2"},a__namespace.default.createElement(v__namespace.Root,{open:C&&!l,onOpenChange:o=>{l||(N(o),o||L(""));}},a__namespace.default.createElement("div",{className:`relative w-full font-sans text-text-secondary ${s}`},i&&a__namespace.default.createElement("div",{className:"flex justify-between items-center mb-1"},a__namespace.default.createElement(b,{variant:"label-default",className:d},i),m&&a__namespace.default.createElement(b,{variant:"body-xxs-medium",color:"secondary"},a__namespace.default.createElement(b,{as:"span",variant:"body-xxs-medium"},r.length),"/",m)),a__namespace.default.createElement(v__namespace.Trigger,{asChild:!0},a__namespace.default.createElement("div",{className:"relative flex-1"},a__namespace.default.createElement(F,{id:u,placeholder:m&&r.length>=m?`Maximum ${m} items selected`:n,value:h,onChange:o=>L(o.target.value),className:"flex-1 bg-background-0",disabled:l||!!m&&r.length>=m,end:y?a__namespace.default.createElement(I,{size:"sm"}):a__namespace.default.createElement(x,{name:"search-normal",size:["lg:24",18]}),forceShowFocusRing:C},W.length>0?a__namespace.default.createElement("div",{className:"flex flex-wrap gap-2"},W.map(o=>a__namespace.default.createElement(J,{key:o.value,onClose:()=>te(o.value)},o.label))):null))),a__namespace.default.createElement(v__namespace.Portal,{container:k},a__namespace.default.createElement(v__namespace.Content,{className:"w-[--radix-popover-trigger-width] p-1 bg-white rounded-md shadow-lg border z-[9999] data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out",sideOffset:5,side:"bottom",align:"start"},a__namespace.default.createElement("div",{className:"max-h-60 overflow-auto flex flex-col items-start"},K.length>0?K.map((o,p)=>a__namespace.default.createElement(H__namespace.Root,{key:o.label||p,className:"w-full",open:G[o.label]??!0,onOpenChange:()=>o.label&&re(o.label)},o.label&&a__namespace.default.createElement(H__namespace.Trigger,{asChild:!0},a__namespace.default.createElement("button",{className:"w-full flex items-center justify-between px-2 py-1.5 hover:bg-gray-50"},a__namespace.default.createElement(b,{variant:"body-default-bold",color:"secondary"},o.label),a__namespace.default.createElement(x,{name:"arrow-down",className:c("transition-transform",G[o.label]&&"rotate-180"),size:16}))),a__namespace.default.createElement(H__namespace.Content,{className:"data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up"},o.options.map((w,oe)=>a__namespace.default.createElement(D,{key:`${p}-${oe}`,label:w.label,value:w.value,onChange:ee,className:"pl-4"}))))):a__namespace.default.createElement(b,{variant:"label-default",className:"text-text-secondary"},f||"No results found")))))),g&&a__namespace.default.createElement(b,{variant:"label-default",color:"danger",className:"mt-2"},g))};exports.MultiSelectCombobox=mt;//# sourceMappingURL=MultiSelectCombobox.cjs.map
|
|
2
2
|
//# sourceMappingURL=MultiSelectCombobox.cjs.map
|