@deckai/deck-ui 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AboutCard.cjs +8 -2
- package/dist/components/AboutCard.cjs.map +1 -1
- package/dist/components/AboutCard.js +8 -2
- package/dist/components/AboutCard.js.map +1 -1
- package/dist/components/Accordion.cjs +7 -1
- package/dist/components/Accordion.cjs.map +1 -1
- package/dist/components/Accordion.js +7 -1
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/AddWorkCard.cjs +9 -3
- package/dist/components/AddWorkCard.cjs.map +1 -1
- package/dist/components/AddWorkCard.js +9 -3
- package/dist/components/AddWorkCard.js.map +1 -1
- package/dist/components/AutocompleteInput.cjs +8 -0
- package/dist/components/AutocompleteInput.cjs.map +1 -0
- package/dist/components/AutocompleteInput.d.cts +28 -0
- package/dist/components/AutocompleteInput.d.ts +28 -0
- package/dist/components/AutocompleteInput.js +8 -0
- package/dist/components/AutocompleteInput.js.map +1 -0
- package/dist/components/Avatar.cjs +1 -1
- package/dist/components/Avatar.cjs.map +1 -1
- package/dist/components/Avatar.d.cts +3 -1
- package/dist/components/Avatar.d.ts +3 -1
- package/dist/components/Avatar.js +1 -1
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Badge.cjs +7 -1
- package/dist/components/Badge.cjs.map +1 -1
- package/dist/components/Badge.js +7 -1
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Breadcrumbs.cjs +7 -1
- package/dist/components/Breadcrumbs.cjs.map +1 -1
- package/dist/components/Breadcrumbs.js +7 -1
- package/dist/components/Breadcrumbs.js.map +1 -1
- package/dist/components/Button.cjs +8 -2
- package/dist/components/Button.cjs.map +1 -1
- package/dist/components/Button.d.cts +2 -2
- package/dist/components/Button.d.ts +2 -2
- package/dist/components/Button.js +8 -2
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Carousel.cjs +1 -1
- package/dist/components/Carousel.cjs.map +1 -1
- package/dist/components/Carousel.d.cts +1 -3
- package/dist/components/Carousel.d.ts +1 -3
- package/dist/components/Carousel.js +1 -1
- package/dist/components/Carousel.js.map +1 -1
- package/dist/components/Collapsible.cjs +8 -2
- package/dist/components/Collapsible.cjs.map +1 -1
- package/dist/components/Collapsible.js +8 -2
- package/dist/components/Collapsible.js.map +1 -1
- package/dist/components/Combobox.cjs +7 -1
- package/dist/components/Combobox.cjs.map +1 -1
- package/dist/components/Combobox.d.cts +10 -1
- package/dist/components/Combobox.d.ts +10 -1
- package/dist/components/Combobox.js +7 -1
- package/dist/components/Combobox.js.map +1 -1
- package/dist/components/ContactItem.cjs +7 -1
- package/dist/components/ContactItem.cjs.map +1 -1
- package/dist/components/ContactItem.js +7 -1
- package/dist/components/ContactItem.js.map +1 -1
- package/dist/components/Dropdown.cjs +7 -1
- package/dist/components/Dropdown.cjs.map +1 -1
- package/dist/components/Dropdown.js +7 -1
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/EditButton.cjs +8 -2
- package/dist/components/EditButton.cjs.map +1 -1
- package/dist/components/EditButton.js +8 -2
- package/dist/components/EditButton.js.map +1 -1
- package/dist/components/Icon.cjs +1 -1
- package/dist/components/Icon.cjs.map +1 -1
- package/dist/components/Icon.d.cts +1 -1
- package/dist/components/Icon.d.ts +1 -1
- package/dist/components/Icon.js +1 -1
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/IconRenderer.cjs +1 -1
- package/dist/components/IconRenderer.cjs.map +1 -1
- package/dist/components/IconRenderer.d.cts +1 -1
- package/dist/components/IconRenderer.d.ts +1 -1
- package/dist/components/IconRenderer.js +1 -1
- package/dist/components/IconRenderer.js.map +1 -1
- package/dist/components/Input.cjs +7 -1
- package/dist/components/Input.cjs.map +1 -1
- package/dist/components/Input.d.cts +33 -2
- package/dist/components/Input.d.ts +33 -2
- package/dist/components/Input.js +7 -1
- package/dist/components/Input.js.map +1 -1
- package/dist/components/Link.cjs +7 -1
- package/dist/components/Link.cjs.map +1 -1
- package/dist/components/Link.d.cts +1 -1
- package/dist/components/Link.d.ts +1 -1
- package/dist/components/Link.js +7 -1
- package/dist/components/Link.js.map +1 -1
- package/dist/components/MultiSelectCombobox.cjs +7 -1
- package/dist/components/MultiSelectCombobox.cjs.map +1 -1
- package/dist/components/MultiSelectCombobox.d.cts +25 -4
- package/dist/components/MultiSelectCombobox.d.ts +25 -4
- package/dist/components/MultiSelectCombobox.js +7 -1
- package/dist/components/MultiSelectCombobox.js.map +1 -1
- package/dist/components/Navbar.cjs +8 -2
- package/dist/components/Navbar.cjs.map +1 -1
- package/dist/components/Navbar.d.cts +1 -1
- package/dist/components/Navbar.d.ts +1 -1
- package/dist/components/Navbar.js +8 -2
- package/dist/components/Navbar.js.map +1 -1
- package/dist/components/NavbarItem.cjs +1 -1
- package/dist/components/NavbarItem.cjs.map +1 -1
- package/dist/components/NavbarItem.d.cts +1 -1
- package/dist/components/NavbarItem.d.ts +1 -1
- package/dist/components/NavbarItem.js +1 -1
- package/dist/components/NavbarItem.js.map +1 -1
- package/dist/components/Option.cjs +7 -1
- package/dist/components/Option.cjs.map +1 -1
- package/dist/components/Option.d.cts +13 -2
- package/dist/components/Option.d.ts +13 -2
- package/dist/components/Option.js +7 -1
- package/dist/components/Option.js.map +1 -1
- package/dist/components/Pressable.cjs +1 -1
- package/dist/components/Pressable.cjs.map +1 -1
- package/dist/components/Pressable.js +1 -1
- package/dist/components/Pressable.js.map +1 -1
- package/dist/components/ProfileCard.cjs +7 -1
- package/dist/components/ProfileCard.cjs.map +1 -1
- package/dist/components/ProfileCard.js +7 -1
- package/dist/components/ProfileCard.js.map +1 -1
- package/dist/components/ProgressBar.cjs +7 -1
- package/dist/components/ProgressBar.cjs.map +1 -1
- package/dist/components/ProgressBar.d.cts +4 -0
- package/dist/components/ProgressBar.d.ts +4 -0
- package/dist/components/ProgressBar.js +7 -1
- package/dist/components/ProgressBar.js.map +1 -1
- package/dist/components/RadioGroup.cjs +8 -0
- package/dist/components/RadioGroup.cjs.map +1 -0
- package/dist/components/RadioGroup.d.cts +38 -0
- package/dist/components/RadioGroup.d.ts +38 -0
- package/dist/components/RadioGroup.js +8 -0
- package/dist/components/RadioGroup.js.map +1 -0
- package/dist/components/SegmentedTabs.cjs +8 -2
- package/dist/components/SegmentedTabs.cjs.map +1 -1
- package/dist/components/SegmentedTabs.js +8 -2
- package/dist/components/SegmentedTabs.js.map +1 -1
- package/dist/components/Sidebar.cjs +1 -1
- package/dist/components/Sidebar.cjs.map +1 -1
- package/dist/components/Sidebar.js +1 -1
- package/dist/components/Sidebar.js.map +1 -1
- package/dist/components/SlideButton.cjs +7 -1
- package/dist/components/SlideButton.cjs.map +1 -1
- package/dist/components/SlideButton.js +7 -1
- package/dist/components/SlideButton.js.map +1 -1
- package/dist/components/SocialCard.cjs +7 -1
- package/dist/components/SocialCard.cjs.map +1 -1
- package/dist/components/SocialCard.d.cts +1 -1
- package/dist/components/SocialCard.d.ts +1 -1
- package/dist/components/SocialCard.js +7 -1
- package/dist/components/SocialCard.js.map +1 -1
- package/dist/components/Switch.cjs +1 -1
- package/dist/components/Switch.cjs.map +1 -1
- package/dist/components/Switch.js +1 -1
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Tabs.cjs +8 -2
- package/dist/components/Tabs.cjs.map +1 -1
- package/dist/components/Tabs.js +8 -2
- package/dist/components/Tabs.js.map +1 -1
- package/dist/components/Tag.cjs +7 -1
- package/dist/components/Tag.cjs.map +1 -1
- package/dist/components/Tag.js +7 -1
- package/dist/components/Tag.js.map +1 -1
- package/dist/components/Text.cjs +7 -1
- package/dist/components/Text.cjs.map +1 -1
- package/dist/components/Text.d.cts +3 -3
- package/dist/components/Text.d.ts +3 -3
- package/dist/components/Text.js +7 -1
- package/dist/components/Text.js.map +1 -1
- package/dist/components/TextArea.cjs +7 -1
- package/dist/components/TextArea.cjs.map +1 -1
- package/dist/components/TextArea.d.cts +5 -1
- package/dist/components/TextArea.d.ts +5 -1
- package/dist/components/TextArea.js +7 -1
- package/dist/components/TextArea.js.map +1 -1
- package/dist/components/Toast.cjs +8 -2
- package/dist/components/Toast.cjs.map +1 -1
- package/dist/components/Toast.d.cts +24 -12
- package/dist/components/Toast.d.ts +24 -12
- package/dist/components/Toast.js +8 -2
- package/dist/components/Toast.js.map +1 -1
- package/dist/components/WorkCard.cjs +7 -1
- package/dist/components/WorkCard.cjs.map +1 -1
- package/dist/components/WorkCard.js +7 -1
- package/dist/components/WorkCard.js.map +1 -1
- package/dist/index.cjs +10 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +10 -52
- package/dist/index.js.map +1 -1
- package/dist/styles/styles.css +1 -1
- package/dist/{tailwind-CuJn6tv4.d.cts → tailwind-Cl3vNM6S.d.cts} +9 -7
- package/dist/{tailwind-CuJn6tv4.d.ts → tailwind-Cl3vNM6S.d.ts} +9 -7
- package/package.json +3 -3
- package/dist/components/Illustration.cjs +0 -50
- package/dist/components/Illustration.cjs.map +0 -1
- package/dist/components/Illustration.d.cts +0 -10
- package/dist/components/Illustration.d.ts +0 -10
- package/dist/components/Illustration.js +0 -50
- package/dist/components/Illustration.js.map +0 -1
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as e from'react';import e__default from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function h(...t){return twMerge(clsx(t))}var M="focus-visible:outline-none focus-visible:border-2 focus-visible:border-primary-100";var v={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},k=t=>{let[r,n]=t.split("-");return r==="heading"?v[n]||"p":r==="label"?"label":"p"},V={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},N=t=>t?(Array.isArray(t)?t:[t]).map(n=>{if(n.includes(":")){let[l,c]=n.split(":");return `${l}:text-${c}`}return `text-${n}`}).join(" "):"text-body-default",p=e__default.forwardRef(({variant:t="body-default",color:r="primary",as:n,className:l,children:c,weight:o,...T},i)=>{let y=N(t),a=r==="inherit"?"text-inherit":`text-${r}`,m=e__default.useMemo(()=>{let d=typeof t=="string"?t.split(":").pop():Array.isArray(t)?t[0].split(":").pop():"body-default";return k(d)},[t]);return e__default.createElement(n||m,{ref:i,className:`
|
|
2
|
+
font-sans antialiased
|
|
3
|
+
${y}
|
|
4
|
+
${a}
|
|
5
|
+
${o&&`!${V[o]}`}
|
|
6
|
+
${l}
|
|
7
|
+
`,...T},c)});p.displayName="Text";var q=({className:t,label:r,labelClassName:n,helperText:l,showCharacterCount:c,maxLength:o,id:T,value:i,defaultValue:y,error:a,errorMessage:m,onChange:g,...d})=>{let f=e.useRef(null),[u,H]=e.useState(i?.toString()||y?.toString()||"");e.useEffect(()=>{i!==void 0&&H(i.toString());},[i]);let x=e.useCallback(()=>{let s=f.current;s&&(s.style.height="auto",s.style.height=`${s.scrollHeight}px`);},[]);e.useEffect(()=>{x();},[u,x]);let E=e.useCallback(s=>{let $=s.target.value;H($),g?.(s);},[g]),L=u.length,R=c||!!o;return e.createElement("div",{className:"flex flex-col gap-1"},r&&e.createElement(p,{variant:"label-default",htmlFor:T,as:"label",color:a?"danger":"primary",className:h(n)},r),e.createElement("div",{className:"relative"},e.createElement("textarea",{ref:f,id:T,value:u,maxLength:o,onChange:E,className:h("min-h-[80px] w-full resize-none rounded-lg border bg-background-0 px-3 py-2 font-sans text-primary placeholder:text-secondary transition-colors duration-150",M,"disabled:cursor-not-allowed disabled:opacity-50",{"border-secondary-50":!a,"border-tertiary-10":a},t),"aria-invalid":a,...d}),e.createElement("div",{className:"flex justify-between gap-2"},a&&m||l?e.createElement(p,{variant:"body-xxs",color:a?"danger":"secondary",className:"mt-1"},a?m:l):null,R&&e.createElement(p,{variant:"body-xxs",color:a?"danger":"secondary",className:"text-right mt-1"},e.createElement(p,{variant:"body-xxs",as:"span",color:"primary-100",className:"font-bold"},L),o&&`/${o}`," characters"))))};export{q as TextArea};//# sourceMappingURL=TextArea.js.map
|
|
2
8
|
//# sourceMappingURL=TextArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Text.tsx","../../src/components/TextArea.tsx"],"names":["cn","inputs","twMerge","clsx","focusRingStyles","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","TextArea","label","labelClassName","helperText","showCharacterCount","maxLength","id","value","defaultValue","textValue","setTextValue","handleChange","e","newValue","characterCount","showCount"],"mappings":"mHAGO,SAASA,CAAAA,CAAAA,GAAMC,EAAsB,CAC1C,OAAOC,QAAQC,IAAKF,CAAAA,CAAM,CAAC,CAC7B,CC8DO,IAAMG,CACX,CAAA,qGAAA,CCEF,IAAMC,CAAmD,CAAA,CACvD,GAAI,IACJ,CAAA,EAAA,CAAI,KACJ,EAAI,CAAA,IAAA,CACJ,GAAI,IACJ,CAAA,EAAA,CAAI,IACN,CAEMC,CAAAA,CAAAA,CAAyBC,GAAwC,CACrE,GAAM,CAACC,CAAAA,CAAUC,CAAI,CAAIF,CAAAA,CAAAA,CAAQ,MAAM,GAAG,CAAA,CAE1C,OAAIC,CAAa,GAAA,SAAA,CACRH,EAAoBI,CAAI,CAAA,EAAK,IAGlCD,CAAa,GAAA,OAAA,CACR,QAGF,GACT,CAAA,CAIME,EAAqC,CACzC,KAAA,CAAO,aACP,OAAS,CAAA,cAAA,CACT,SAAU,eACV,CAAA,IAAA,CAAM,WACR,CA0BMC,CAAAA,CAAAA,CACJC,GAEKA,CAEgB,CAAA,CAAA,KAAA,CAAM,QAAQA,CAAQ,CAAA,CAAIA,EAAW,CAACA,CAAQ,GAGhE,GAAKL,CAAAA,CAAAA,EAAY,CAChB,GAAIA,CAAAA,CAAQ,QAAS,CAAA,GAAG,EAAG,CACzB,GAAM,CAACM,CAAYC,CAAAA,CAAe,EAAIP,CAAQ,CAAA,KAAA,CAA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ACZS,CAAAA,CAAAA,CAAAA,EACC,gBAAChB,CAAA,CAAA,CAAK,QAAQ,eAAgB,CAAA,KAAA,CAAM,UACjCgB,CACH,CAAA,CAEDY,GACC,CAAC5B,CAAAA,aAAAA,CAAAA,CAAAA,CAAA,CACC,OAAQ,CAAA,eAAA,CACR,MAAM,WACN,CAAA,SAAA,CAAU,uBAET2B,CACAT,CAAAA,CAAAA,EAAa,IAAIA,CAAS,CAAA,CAAA,CAAG,aAChC,CAEJ,CACF,CACF,CAEJ","file":"TextArea.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 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 * as React from \"react\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { Text } from \"./Text\";\n\nexport type TextAreaProps = {\n /** Additional classes for the container */\n className?: string;\n /** Label text for the textarea */\n label?: string;\n /** Additional classes for the label */\n labelClassName?: string;\n /** Helper text displayed below the textarea */\n helperText?: string;\n /** Character count display */\n showCharacterCount?: boolean;\n /** Maximum number of characters */\n maxLength?: number;\n} & React.TextareaHTMLAttributes<HTMLTextAreaElement>;\n\nexport const TextArea = ({\n className,\n label,\n labelClassName,\n helperText,\n showCharacterCount,\n maxLength,\n id,\n value = \"\",\n defaultValue,\n ...props\n}: TextAreaProps) => {\n const [textValue, setTextValue] = React.useState(\n value?.toString() || defaultValue?.toString() || \"\"\n );\n\n const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n const newValue = e.target.value;\n setTextValue(newValue);\n props.onChange?.(e);\n };\n\n const characterCount = textValue.length;\n const showCount = showCharacterCount || !!maxLength;\n\n return (\n <>\n {label && (\n <Text\n variant=\"label-default\"\n htmlFor={id}\n as=\"label\"\n className={cn(labelClassName)}\n >\n {label}\n </Text>\n )}\n <div className=\"relative\">\n <textarea\n id={id}\n value={value}\n defaultValue={defaultValue}\n maxLength={maxLength}\n onChange={handleChange}\n className={cn(\n `min-h-[80px] w-full resize-y rounded-lg border border-secondary-50 bg-background-0 px-3 py-2 font-sans text-text placeholder:text-secondary ${focusRingStyles} disabled:cursor-not-allowed disabled:opacity-50`,\n className\n )}\n {...props}\n />\n <div className=\"flex justify-between gap-2\">\n {helperText && (\n <Text variant=\"label-default\" color=\"danger\">\n {helperText}\n </Text>\n )}\n {showCount && (\n <Text\n variant=\"label-default\"\n color=\"secondary\"\n className=\"text-right self-end\"\n >\n {characterCount}\n {maxLength && `/${maxLength}`} characters\n </Text>\n )}\n </div>\n </div>\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/utils/tailwind.ts","../../src/components/Text.tsx","../../src/components/TextArea.tsx"],"names":["cn","inputs","twMerge","clsx","focusRingStyles","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","TextArea","label","labelClassName","helperText","showCharacterCount","maxLength","id","value","defaultValue","error","errorMessage","onChange","textareaRef","currentValue","setCurrentValue","adjustHeight","textarea","handleChange","e","newValue","characterCount","showCount"],"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AA,CAEV,CAACtB,CAAAA,aAAAA,CAAAA,CAAAA,CAAA,CACC,OAAA,CAAQ,UACR,CAAA,EAAA,CAAG,MACH,CAAA,KAAA,CAAM,aACN,CAAA,SAAA,CAAU,WAETiC,CAAAA,CAAAA,CACH,CACCf,CAAAA,CAAAA,EAAa,CAAIA,CAAAA,EAAAA,CAAS,CAAG,CAAA,CAAA,aAChC,CAEJ,CACF,CACF,CAEJ","file":"TextArea.js","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const noopFn = () => {};\n","import { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:border-2 focus-visible:border-primary-100\";\n\nexport const focusRingStylesCoerced = \"border-2 border-primary-100\";\n","import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\"\n | \"primary-100\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses = color === \"inherit\" ? \"text-inherit\" : `text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`\n font-sans antialiased\n ${typographyClasses}\n ${colorClasses}\n ${weight && `!${fontWeight[weight]}`}\n ${className}\n `}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import * as React from \"react\";\nimport { cn } from \"../utils\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { Text } from \"./Text\";\n\nexport type TextAreaProps = {\n /** Additional classes for the container */\n className?: string;\n /** Label text for the textarea */\n label?: string;\n /** Additional classes for the label */\n labelClassName?: string;\n /** Helper text displayed below the textarea */\n helperText?: string;\n /** Character count display */\n showCharacterCount?: boolean;\n /** Maximum number of characters */\n maxLength?: number;\n /** Error state for the textarea */\n error?: boolean;\n /** Error message to display below the textarea */\n errorMessage?: string;\n} & React.TextareaHTMLAttributes<HTMLTextAreaElement>;\n\nexport const TextArea = ({\n className,\n label,\n labelClassName,\n helperText,\n showCharacterCount,\n maxLength,\n id,\n value,\n defaultValue,\n error,\n errorMessage,\n onChange,\n ...props\n}: TextAreaProps) => {\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const [currentValue, setCurrentValue] = React.useState(\n value?.toString() || defaultValue?.toString() || \"\"\n );\n\n // Update internal value when prop changes\n React.useEffect(() => {\n if (value !== undefined) {\n setCurrentValue(value.toString());\n }\n }, [value]);\n\n const adjustHeight = React.useCallback(() => {\n const textarea = textareaRef.current;\n if (textarea) {\n textarea.style.height = \"auto\";\n textarea.style.height = `${textarea.scrollHeight}px`;\n }\n }, []);\n\n // Adjust height on mount and when content changes\n React.useEffect(() => {\n adjustHeight();\n }, [currentValue, adjustHeight]);\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n const newValue = e.target.value;\n setCurrentValue(newValue);\n onChange?.(e);\n // Don't need to call adjustHeight here as it's handled by the useEffect\n },\n [onChange]\n );\n\n const characterCount = currentValue.length;\n const showCount = showCharacterCount || !!maxLength;\n\n return (\n <div className=\"flex flex-col gap-1\">\n {label && (\n <Text\n variant=\"label-default\"\n htmlFor={id}\n as=\"label\"\n color={error ? \"danger\" : \"primary\"}\n className={cn(labelClassName)}\n >\n {label}\n </Text>\n )}\n <div className=\"relative\">\n <textarea\n ref={textareaRef}\n id={id}\n value={currentValue}\n maxLength={maxLength}\n onChange={handleChange}\n className={cn(\n \"min-h-[80px] w-full resize-none rounded-lg border bg-background-0 px-3 py-2 font-sans text-primary placeholder:text-secondary transition-colors duration-150\",\n focusRingStyles,\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n {\n \"border-secondary-50\": !error,\n \"border-tertiary-10\": error\n },\n className\n )}\n aria-invalid={error}\n {...props}\n />\n <div className=\"flex justify-between gap-2\">\n {(error && errorMessage) || helperText ? (\n <Text\n variant=\"body-xxs\"\n color={error ? \"danger\" : \"secondary\"}\n className=\"mt-1\"\n >\n {error ? errorMessage : helperText}\n </Text>\n ) : null}\n {showCount && (\n <Text\n variant=\"body-xxs\"\n color={error ? \"danger\" : \"secondary\"}\n className=\"text-right mt-1\"\n >\n <Text\n variant=\"body-xxs\"\n as=\"span\"\n color=\"primary-100\"\n className=\"font-bold\"\n >\n {characterCount}\n </Text>\n {maxLength && `/${maxLength}`} characters\n </Text>\n )}\n </div>\n </div>\n </div>\n );\n};\n"]}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var r=require('react'),l=require('@radix-ui/react-toast'),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 r__namespace=/*#__PURE__*/_interopNamespace(r);var l__namespace=/*#__PURE__*/_interopNamespace(l);function d(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var v={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888",danger:"#FF0000"},$={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},A=e=>{if(!e)return {width:"24px",height:"24px"};let i=Array.isArray(e)?e:[e],t={},o;return i.forEach(a=>{if(typeof a=="number")o=`${a}px`;else {let[s,n]=a.split(":"),p=parseInt(n,10);t[`@media (min-width: ${$[s]})`]=`${p}px`;}}),{width:o||"24px",height:o||"24px",...Object.entries(t).reduce((a,[s,n])=>({...a,[s]:{width:n,height:n}}),{})}},g=r__namespace.default.forwardRef(({name:e,size:i=24,color:t="primary",title:o,className:a,style:s={},...n},p)=>{let c=icons.IconMap[e],m=A(i);return r__namespace.default.createElement("div",{className:d("flex justify-center items-center",a),style:{...m,"--icon-stroke":v[t],...s}},r__namespace.default.createElement(c,{ref:p,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:v[t],...n}))});g.displayName="Icon";var k={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},N=e=>{let[i,t]=e.split("-");return i==="heading"?k[t]||"p":i==="label"?"label":"p"},w={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},S=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[o,a]=t.split(":");return `${o}:text-${a}`}return `text-${t}`}).join(" "):"text-body-default",y=r__namespace.default.forwardRef(({variant:e="body-default",color:i="primary",as:t,className:o,children:a,weight:s,...n},p)=>{let c=S(e),m=i==="inherit"?"text-inherit":`text-${i}`,h=r__namespace.default.useMemo(()=>{let T=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return N(T)},[e]);return r__namespace.default.createElement(t||h,{ref:p,className:`
|
|
2
|
+
font-sans antialiased
|
|
3
|
+
${c}
|
|
4
|
+
${m}
|
|
5
|
+
${s&&`!${w[s]}`}
|
|
6
|
+
${o}
|
|
7
|
+
`,...n},a)});y.displayName="Text";var R="focus-visible:outline-none focus-visible:border-2 focus-visible:border-primary-100";var B={black:"bg-primary text-white",accent:"bg-primary-100 text-white",secondary:"bg-secondary-100 text-secondary"},V={black:"border border-text text-primary",accent:"border border-primary-100 text-primary-100",secondary:"border border-text-secondary text-secondary"},f=r__namespace.forwardRef(({className:e,variant:i="filled",color:t="black",isLoading:o=!1,children:a,disabled:s,end:n,...p},c)=>r__namespace.createElement("button",{ref:c,className:d(`
|
|
2
8
|
sm:px-7 px-4
|
|
3
9
|
py-2
|
|
4
10
|
inline-flex items-center justify-center
|
|
@@ -6,5 +12,5 @@
|
|
|
6
12
|
transition-colors duration-200
|
|
7
13
|
disabled:opacity-50 disabled:pointer-events-none
|
|
8
14
|
hover:opacity-80 active:scale-95
|
|
9
|
-
truncate`,
|
|
15
|
+
truncate`,R,i==="filled"?B[t]:i==="transparent"?"bg-transparent text-text":V[t],e),disabled:s||o,type:"button",...p},typeof a=="string"?r__namespace.createElement(y,{variant:["sm:body-default-bold","body-xxs-semibold"],color:"inherit"},a):a,n));f.displayName="Button";var I={default:{icon:"information",className:"bg-gray-900 text-white"},success:{icon:"check",className:"bg-green-600 text-white"},error:{icon:"danger",className:"bg-tertiary-10 text-white"},warning:{icon:"warning-2",className:"bg-tertiary-20 text-white"}},O=r__namespace.forwardRef(({title:e,message:i,action:t,secondaryAction:o,variant:a="default",duration:s=5e3,className:n,onOpenChange:p,allowOutsideClick:c=!0,onClose:m,...h},M)=>{let T=I[a],E=r__namespace.useCallback(b=>{!c&&b===!1||(p?.(b),b||m?.());},[p,c,m]);return r__namespace.createElement(l__namespace.Root,{ref:M,onOpenChange:E,duration:s,className:d("group pointer-events-auto relative flex w-full flex-col gap-4 rounded-lg p-4 items-center","shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-right-full",T.className,n),...h},r__namespace.createElement(l__namespace.Close,{className:"absolute right-1 top-1 h-[40px] w-[40px] p-1 hover:bg-white/10 flex items-center justify-center rounded-lg","aria-label":"Close",onClick:m},r__namespace.createElement(g,{name:"close",size:16,color:"white"})),r__namespace.createElement("div",{className:"flex gap-4"},r__namespace.createElement(g,{name:T.icon,className:"h-5 w-5 shrink-0",color:"white"}),r__namespace.createElement("div",{className:"flex flex-col flex-1 gap-2"},e&&r__namespace.createElement(l__namespace.Title,{asChild:!0},r__namespace.createElement(y,{variant:"body-default-bold",color:"inherit"},e)),r__namespace.createElement(l__namespace.Description,{asChild:!0},r__namespace.createElement(y,{variant:"body-xs-medium",color:"inherit"},i)))),(t||o)&&r__namespace.createElement("div",{className:"flex gap-2 justify-end mt-2"},o&&r__namespace.createElement(l__namespace.Action,{asChild:!0,altText:o.label},r__namespace.createElement("div",{className:"min-h-[40px] flex items-center"},r__namespace.createElement(f,{variant:o.variant||"outlined",color:"black",className:"border-white text-white hover:bg-white/10",onClick:o.onClick},o.label))),t&&r__namespace.createElement(l__namespace.Action,{asChild:!0,altText:t.label},r__namespace.createElement("div",{className:"flex items-center"},r__namespace.createElement(f,{variant:t.variant||"outlined",color:"black",className:"border-white text-white hover:bg-white/10",onClick:t.onClick},t.label)))))});O.displayName="Toast";exports.Toast=O;//# sourceMappingURL=Toast.cjs.map
|
|
10
16
|
//# sourceMappingURL=Toast.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx","../../src/components/Text.tsx","../../src/components/Button.tsx","../../src/utils/tailwind.ts","../../src/components/Toast.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","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","fontWeight","processVariants","variants","typographyClass","Text","as","children","weight","typographyClasses","colorClasses","suggestedElement","baseVariant","focusRingStyles","filled","outlined","Button","y","isLoading","disabled","end","Toast","o","message","action","duration","onOpenChange","variantConfig","handleOpenChange","open","l"],"mappings":"4jBAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,qBAAQC,CAAAA,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CCcA,IAAMG,CAAwC,CAAA,CAC5C,OAAS,CAAA,SAAA,CACT,SAAW,CAAA,SAAA,CACX,KAAO,CAAA,SAAA,CACP,WAAa,CAAA,SAAA,CACb,QAAU,CAAA,SACZ,CAEMC,CAAAA,CAAAA,CAA6C,CACjD,EAAA,CAAI,OACJ,CAAA,EAAA,CAAI,OACJ,CAAA,EAAA,CAAI,QACJ,CAAA,EAAA,CAAI,QACJ,CAAA,KAAA,CAAO,QACT,CAAA,CAEMC,CACJC,CAAAA,CAAAA,EACwB,CACxB,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CAAO,CAAC,CAAA,CAAA,OAAA,CAASN,EAAO,KAC7C,CAAA,CAAAF,YAAA,CAAA,aAAA,CAAC,KACC,CAAA,IAAA,CAAAA,YAAA,CAAA,aAAA,CAACN,CAAA,CAAA,CACC,OAAQ,CAAA,UAAA,CACR,KAAM,CAAA,OAAA,CACN,SAAU,CAAA,mDAAA,CACV,OAASQ,CAAAA,CAAAA,CAAO,SAEfA,CAAO,CAAA,KACV,CACF,CACF,CAEF,CAAAF,YAAA,CAAA,aAAA,CAAgBQ,YAAf,CAAA,KAAA,CAAA,CACC,SAAU,CAAA,uBAAA,CACV,YAAW,CAAA,OAAA,CAAA,CAEXR,YAACrC,CAAAA,aAAAA,CAAAA,CAAAA,CAAA,CAAK,IAAA,CAAK,OAAQ,CAAA,IAAA,CAAM,EAAI,CAAA,KAAA,CAAM,OAAQ,CAAA,CAC7C,CACF,CACF,CAEJ,CACF,EAEAoC,CAAAA,CAAM,WAAc,CAAA,OAAA","file":"Toast.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 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 * as React from \"react\";\nimport { Text } from \"./Text\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type ButtonProps = {\n /** @default filled */\n variant?: \"filled\" | \"outlined\";\n /** @default primary */\n color?: \"black\" | \"accent\" | \"secondary\";\n isLoading?: boolean;\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n start?: React.ReactNode;\n end?: React.ReactNode;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const filled = {\n black: \"bg-text-text text-white\",\n // fade it slightly\n accent: \"bg-primary-100 text-white\",\n secondary: \"bg-secondary-100 text-secondary\"\n};\n\nexport const outlined = {\n black: \"border border-text text-text\",\n accent: \"border border-primary-100 text-primary-100\",\n secondary: \"border border-text-secondary text-secondary\"\n};\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"filled\",\n color = \"black\",\n isLoading = false,\n children,\n disabled,\n end,\n ...props\n },\n ref\n ) => (\n <button\n ref={ref}\n className={cn(\n `\n sm:px-7 px-4\n py-2\n inline-flex items-center justify-center\n rounded-lg \n transition-colors duration-200\n disabled:opacity-50 disabled:pointer-events-none\n hover:opacity-80 active:scale-95 \n truncate`,\n focusRingStyles,\n variant === \"filled\" ? filled[color] : outlined[color],\n className\n )}\n disabled={disabled || isLoading}\n type=\"button\"\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text\n variant={[\"sm:body-default-bold\", \"body-xxs-semibold\"]}\n color=\"inherit\"\n >\n {children}\n </Text>\n ) : (\n children\n )}\n {end}\n </button>\n )\n);\n\nButton.displayName = \"Button\";\n","import { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\";\n\nexport const focusRingStylesCoerced = \"ring-2 ring-ring ring-offset-2\";\n","import * as React from \"react\";\nimport * as ToastPrimitive from \"@radix-ui/react-toast\";\nimport { cn } from \"../utils\";\nimport { Icon } from \"./Icon\";\nimport { Text } from \"./Text\";\nimport { Button } from \"./Button\";\nimport { IconName } from \"@deckai/icons\";\n\nexport type ToastProps = ToastPrimitive.ToastProps & {\n /** Optional title for the toast */\n title?: string;\n /** Main message content */\n message: string;\n /** Optional action button configuration */\n action?: {\n label: string;\n onClick: () => void;\n };\n /** Optional variant to change the visual style */\n variant?: \"default\" | \"success\" | \"error\" | \"warning\";\n\n /** Optional className for custom styling */\n className?: string;\n};\n\nconst variants: Record<\n NonNullable<ToastProps[\"variant\"]>,\n {\n icon: IconName;\n className: string;\n }\n> = {\n default: {\n icon: \"information\",\n className: \"bg-gray-900 text-white\"\n },\n success: {\n icon: \"check\",\n className: \"bg-green-600 text-white\"\n },\n error: {\n icon: \"danger\",\n className: \"bg-tertiary-10 text-white\"\n },\n warning: {\n icon: \"warning-2\",\n className: \"bg-tertiary-20 text-white\"\n }\n} as const;\n\nexport const Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Root>,\n ToastProps\n>(\n (\n {\n title,\n message,\n action,\n variant = \"default\",\n duration = 5000,\n className,\n onOpenChange,\n ...props\n },\n ref\n ) => {\n const variantConfig = variants[variant];\n\n const handleOpenChange = React.useCallback(\n (open: boolean) => {\n onOpenChange?.(open);\n },\n [onOpenChange]\n );\n\n return (\n <ToastPrimitive.Root\n ref={ref}\n onOpenChange={handleOpenChange}\n duration={duration}\n className={cn(\n \"group pointer-events-auto relative flex w-full gap-4 rounded-lg p-4\",\n \"shadow-lg\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-right-full\",\n variantConfig.className,\n className\n )}\n {...props}\n >\n <Icon\n name={variantConfig.icon}\n className=\"h-5 w-5 shrink-0\"\n color=\"white\"\n />\n\n <div className=\"flex-1 gap-2\">\n {title && (\n <ToastPrimitive.Title asChild>\n <Text variant=\"body-default-bold\" color=\"inherit\">\n {title}\n </Text>\n </ToastPrimitive.Title>\n )}\n <ToastPrimitive.Description asChild>\n <Text variant=\"body-xs-medium\" color=\"inherit\">\n {message}\n </Text>\n </ToastPrimitive.Description>\n </div>\n\n <div className=\"flex gap-2\">\n {action && (\n <ToastPrimitive.Action asChild altText={action.label}>\n <div>\n <Button\n variant=\"outlined\"\n color=\"black\"\n className=\"border-white text-white hover:bg-white/10 ml-auto\"\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n </div>\n </ToastPrimitive.Action>\n )}\n <ToastPrimitive.Close\n className=\"p-2 hover:bg-white/10\"\n aria-label=\"Close\"\n >\n <Icon name=\"close\" size={16} color=\"white\" />\n </ToastPrimitive.Close>\n </div>\n </ToastPrimitive.Root>\n );\n }\n);\n\nToast.displayName = \"Toast\";\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts","../../src/components/Icon.tsx","../../src/components/Text.tsx","../../src/components/Button.tsx","../../src/utils/tailwind.ts","../../src/components/Toast.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","HEADING_ELEMENT_MAP","getElementFromVariant","variant","category","fontWeight","processVariants","variants","typographyClass","Text","as","children","weight","typographyClasses","colorClasses","suggestedElement","baseVariant","focusRingStyles","filled","outlined","Button","u","isLoading","disabled","end","Toast","r","message","action","secondaryAction","duration","onOpenChange","allowOutsideClick","onClose","variantConfig","handleOpenChange","open","l"],"mappings":"4jBAGO,SAASA,CAAMC,CAAAA,GAAAA,CAAAA,CAAsB,CAC1C,OAAOC,sBAAQC,SAAKF,CAAAA,CAAM,CAAC,CA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Value } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const noopFn = () => {};\n","import React, { SVGProps } from \"react\";\nimport { IconName, IconMap } from \"@deckai/icons\";\nimport { IconColors } from \"../types/tailwind\";\nimport { cn } from \"../utils\";\n\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveSize = number | `${Breakpoint}:${number}`;\n\nexport type IconProps = {\n name: IconName;\n /** @default 24 */\n size?: ResponsiveSize | ResponsiveSize[];\n /** @default primary */\n color?: IconColors;\n title?: string;\n className?: string;\n style?: React.CSSProperties;\n} & Omit<SVGProps<SVGSVGElement>, \"aria-hidden\" | \"aria-label\">;\n\nconst COLOR_MAP: Record<IconColors, string> = {\n primary: \"#080808\",\n secondary: \"#666666\",\n white: \"#ffffff\",\n primaryBlue: \"#089CCB\",\n disabled: \"#888888\",\n danger: \"#FF0000\"\n};\n\nconst BREAKPOINT_MAP: Record<Breakpoint, string> = {\n sm: \"640px\",\n md: \"768px\",\n lg: \"1024px\",\n xl: \"1280px\",\n \"2xl\": \"1536px\"\n};\n\nconst processSizes = (\n sizes: ResponsiveSize | ResponsiveSize[] | undefined\n): React.CSSProperties => {\n if (!sizes) return { width: \"24px\", height: \"24px\" };\n\n const sizeArray = Array.isArray(sizes) ? sizes : [sizes];\n const mediaQueries: Record<string, string> = {};\n let baseSize: string | undefined;\n\n // Process each size\n sizeArray.forEach((size) => {\n if (typeof size === \"number\") {\n baseSize = `${size}px`;\n } else {\n const [breakpoint, valueStr] = size.split(\":\") as [Breakpoint, string];\n const value = parseInt(valueStr, 10);\n mediaQueries[`@media (min-width: ${BREAKPOINT_MAP[breakpoint]})`] =\n `${value}px`;\n }\n });\n\n // Create the style object with the correct structure\n return {\n width: baseSize || \"24px\",\n height: baseSize || \"24px\",\n ...Object.entries(mediaQueries).reduce(\n (acc, [query, size]) => ({\n ...acc,\n [query]: {\n width: size,\n height: size\n }\n }),\n {}\n )\n };\n};\n\nexport const Icon = React.forwardRef<SVGSVGElement, IconProps>(\n (\n {\n name,\n size = 24,\n color = \"primary\",\n title,\n className,\n style = {},\n ...props\n },\n ref\n ) => {\n const IconComponent = IconMap[name];\n const sizeStyles = processSizes(size);\n\n return (\n <div\n className={cn(\"flex justify-center items-center\", className)}\n style={{\n ...sizeStyles,\n [\"--icon-stroke\" as string]: COLOR_MAP[color],\n ...style\n }}\n >\n <IconComponent\n ref={ref}\n aria-hidden={!title}\n aria-label={title}\n stroke={name.includes(\"filled\") ? undefined : COLOR_MAP[color]}\n {...props}\n />\n </div>\n );\n }\n);\n\nIcon.displayName = \"Icon\";\n","import React from \"react\";\nimport { Typography } from \"../types/tailwind\";\n\ntype TextElement =\n | \"p\"\n | \"span\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"strong\"\n | \"em\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"small\"\n | \"label\"\n | \"a\";\n\n// HTML element mapping type\ntype HTMLElementByTag = {\n p: HTMLParagraphElement;\n span: HTMLSpanElement;\n h1: HTMLHeadingElement;\n h2: HTMLHeadingElement;\n h3: HTMLHeadingElement;\n h4: HTMLHeadingElement;\n h5: HTMLHeadingElement;\n h6: HTMLHeadingElement;\n strong: HTMLElement;\n em: HTMLElement;\n blockquote: HTMLQuoteElement;\n pre: HTMLPreElement;\n code: HTMLElement;\n small: HTMLElement;\n label: HTMLLabelElement;\n a: HTMLAnchorElement;\n};\n\n// HTML props mapping type\ntype HTMLPropsMap = {\n p: React.HTMLAttributes<HTMLParagraphElement>;\n span: React.HTMLAttributes<HTMLSpanElement>;\n h1: React.HTMLAttributes<HTMLHeadingElement>;\n h2: React.HTMLAttributes<HTMLHeadingElement>;\n h3: React.HTMLAttributes<HTMLHeadingElement>;\n h4: React.HTMLAttributes<HTMLHeadingElement>;\n h5: React.HTMLAttributes<HTMLHeadingElement>;\n h6: React.HTMLAttributes<HTMLHeadingElement>;\n strong: React.HTMLAttributes<HTMLElement>;\n em: React.HTMLAttributes<HTMLElement>;\n blockquote: React.HTMLAttributes<HTMLQuoteElement>;\n pre: React.HTMLAttributes<HTMLPreElement>;\n code: React.HTMLAttributes<HTMLElement>;\n small: React.HTMLAttributes<HTMLElement>;\n label: React.LabelHTMLAttributes<HTMLLabelElement>;\n a: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"color\">;\n};\n\ntype TextColor =\n | \"primary\"\n | \"secondary\"\n | \"white\"\n | \"primary-blue\"\n | \"disabled\"\n | \"danger\"\n | \"inherit\"\n | \"primary-100\";\n\nconst HEADING_ELEMENT_MAP: Record<string, TextElement> = {\n xl: \"h1\",\n lg: \"h1\",\n md: \"h2\",\n sm: \"h3\",\n xs: \"h4\"\n};\n\nconst getElementFromVariant = (variant: TypographyKey): TextElement => {\n const [category, size] = variant.split(\"-\");\n\n if (category === \"heading\") {\n return HEADING_ELEMENT_MAP[size] || \"p\";\n }\n\n if (category === \"label\") {\n return \"label\";\n }\n\n return \"p\";\n};\n\ntype Weight = \"light\" | \"regular\" | \"semibold\" | \"bold\";\n\nconst fontWeight: Record<Weight, string> = {\n light: \"font-light\",\n regular: \"font-regular\",\n semibold: \"font-semibold\",\n bold: \"font-bold\"\n};\n\n// Add breakpoint types\ntype Breakpoint = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\ntype ResponsiveVariant = TypographyKey | `${Breakpoint}:${TypographyKey}`;\n\ntype TypographyCategory = keyof Typography;\ntype TypographyValue<T extends TypographyCategory> = Extract<\n keyof Typography[T],\n string | number | bigint | boolean | null | undefined\n>;\ntype TypographyKey = {\n [T in TypographyCategory]: `${T}-${TypographyValue<T>}`;\n}[TypographyCategory];\n\n// Update TextProps to use ResponsiveVariant\nexport type TextProps<T extends TextElement = \"p\"> = {\n variant?: ResponsiveVariant | ResponsiveVariant[];\n color?: TextColor;\n as?: T;\n className?: string;\n children: React.ReactNode;\n weight?: Weight;\n} & HTMLPropsMap[T];\n\n// Add helper function to process variants\nconst processVariants = (\n variants: ResponsiveVariant | ResponsiveVariant[] | undefined\n): string => {\n if (!variants) return \"text-body-default\";\n\n const variantArray = Array.isArray(variants) ? variants : [variants];\n\n return variantArray\n .map((variant) => {\n if (variant.includes(\":\")) {\n const [breakpoint, typographyClass] = variant.split(\":\");\n return `${breakpoint}:text-${typographyClass}`;\n }\n return `text-${variant}`;\n })\n .join(\" \");\n};\n\nexport const Text = React.forwardRef(\n <T extends TextElement = \"p\">(\n {\n variant = \"body-default\",\n color = \"primary\",\n as,\n className,\n children,\n weight,\n ...props\n }: TextProps<T>,\n ref: React.ForwardedRef<HTMLElementByTag[T]>\n ) => {\n // Process typography classes with breakpoints\n const typographyClasses = processVariants(variant);\n\n // Get color styles\n const colorClasses = color === \"inherit\" ? \"text-inherit\" : `text-${color}`;\n\n const suggestedElement = React.useMemo(() => {\n const baseVariant =\n typeof variant === \"string\"\n ? variant.split(\":\").pop()!\n : Array.isArray(variant)\n ? variant[0].split(\":\").pop()!\n : \"body-default\";\n return getElementFromVariant(baseVariant as TypographyKey);\n }, [variant]);\n\n const Component = (as || suggestedElement) as T;\n\n return (\n // @ts-expect-error TODO: figure this out\n <Component\n ref={ref}\n className={`\n font-sans antialiased\n ${typographyClasses}\n ${colorClasses}\n ${weight && `!${fontWeight[weight]}`}\n ${className}\n `}\n {...props}\n >\n {children}\n </Component>\n );\n }\n);\n\nText.displayName = \"Text\";\n","import * as React from \"react\";\nimport { Text } from \"./Text\";\nimport { focusRingStyles } from \"../utils/tailwind\";\nimport { cn } from \"../utils\";\n\nexport type ButtonProps = {\n /** @default filled */\n variant?: \"filled\" | \"outlined\" | \"transparent\";\n /** @default primary */\n color?: \"black\" | \"accent\" | \"secondary\";\n isLoading?: boolean;\n children: React.ReactNode;\n className?: string;\n disabled?: boolean;\n start?: React.ReactNode;\n end?: React.ReactNode;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const filled = {\n black: \"bg-primary text-white\",\n // fade it slightly\n accent: \"bg-primary-100 text-white\",\n secondary: \"bg-secondary-100 text-secondary\"\n};\n\nexport const outlined = {\n black: \"border border-text text-primary\",\n accent: \"border border-primary-100 text-primary-100\",\n secondary: \"border border-text-secondary text-secondary\"\n};\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant = \"filled\",\n color = \"black\",\n isLoading = false,\n children,\n disabled,\n end,\n ...props\n },\n ref\n ) => (\n <button\n ref={ref}\n className={cn(\n `\n sm:px-7 px-4\n py-2\n inline-flex items-center justify-center\n rounded-lg \n transition-colors duration-200\n disabled:opacity-50 disabled:pointer-events-none\n hover:opacity-80 active:scale-95 \n truncate`,\n focusRingStyles,\n variant === \"filled\"\n ? filled[color]\n : variant === \"transparent\"\n ? \"bg-transparent text-text\"\n : outlined[color],\n className\n )}\n disabled={disabled || isLoading}\n type=\"button\"\n {...props}\n >\n {typeof children === \"string\" ? (\n <Text\n variant={[\"sm:body-default-bold\", \"body-xxs-semibold\"]}\n color=\"inherit\"\n >\n {children}\n </Text>\n ) : (\n children\n )}\n {end}\n </button>\n )\n);\n\nButton.displayName = \"Button\";\n","import { Colors, Typography } from \"../types/tailwind\";\n\n// Generate safelist patterns for all color utilities so you can use any theme color variable in your code\nexport const generateSafelist = (colors: Colors, typography: Typography) => {\n const colorNames = Object.keys(colors) as (keyof Colors)[];\n const utilities = [\"bg\", \"text\", \"border\", \"ring\", \"divide\", \"outline\"];\n const variants = [\"hover:\", \"focus:\", \"active:\", \"disabled:\"];\n\n const safelist: string[] = [];\n\n colorNames.forEach((colorName) => {\n if (typeof colors[colorName] === \"object\") {\n // Handle nested color objects (with number keys)\n Object.keys(colors[colorName]).forEach((shade) => {\n utilities.forEach((utility) => {\n // Base utility\n safelist.push(`${utility}-${colorName}-${shade}`);\n\n // Variant utilities\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}-${shade}`);\n });\n });\n });\n } else {\n // Handle direct color values\n utilities.forEach((utility) => {\n safelist.push(`${utility}-${colorName}`);\n\n variants.forEach((variant) => {\n safelist.push(`${variant}${utility}-${colorName}`);\n });\n });\n }\n });\n\n // Generate typography classes\n Object.entries(typography).forEach(([family, sizes]) => {\n Object.keys(sizes).forEach((size) => {\n // Base typography classes\n safelist.push(`text-${family}-${size}`);\n\n // Add variants\n variants.forEach((variant) => {\n safelist.push(`${variant}text-${family}-${size}`);\n });\n });\n });\n\n const breakpoints = [\"sm\", \"md\", \"lg\", \"xl\", \"2xl\"];\n const typographyClasses = Object.entries(typography).flatMap(\n ([category, sizes]) =>\n Object.keys(sizes).map((size) => `text-${category}-${size}`)\n );\n\n // Generate responsive variants\n const responsiveTypographyClasses = typographyClasses.flatMap((className) =>\n breakpoints.map((breakpoint) => `${breakpoint}:${className}`)\n );\n\n return [\n ...typographyClasses,\n ...responsiveTypographyClasses\n // ... rest of your safelist\n ];\n};\n\nexport const focusRingStyles =\n \"focus-visible:outline-none focus-visible:border-2 focus-visible:border-primary-100\";\n\nexport const focusRingStylesCoerced = \"border-2 border-primary-100\";\n","import * as React from \"react\";\nimport * as ToastPrimitive from \"@radix-ui/react-toast\";\nimport { cn } from \"../utils\";\nimport { Icon } from \"./Icon\";\nimport { Text } from \"./Text\";\nimport { Button, ButtonProps } from \"./Button\";\nimport { IconName } from \"@deckai/icons\";\n\ntype ToastAction = {\n label: string;\n onClick: () => void;\n variant?: ButtonProps[\"variant\"];\n};\n\nexport type ToastProps = Omit<ToastPrimitive.ToastProps, \"action\"> & {\n /** Optional title for the toast */\n title?: string;\n /** Main message content */\n message: string;\n /** Primary action button configuration */\n action?: ToastAction;\n /** Secondary action button configuration */\n secondaryAction?: ToastAction;\n /** Optional variant to change the visual style */\n variant?: \"default\" | \"success\" | \"error\" | \"warning\";\n /** Whether to allow dismissing by clicking outside */\n allowOutsideClick?: boolean;\n /** Optional className for custom styling */\n className?: string;\n /** Optional callback when toast is closed */\n onClose?: () => void;\n};\n\nconst variants: Record<\n NonNullable<ToastProps[\"variant\"]>,\n {\n icon: IconName;\n className: string;\n }\n> = {\n default: {\n icon: \"information\",\n className: \"bg-gray-900 text-white\"\n },\n success: {\n icon: \"check\",\n className: \"bg-green-600 text-white\"\n },\n error: {\n icon: \"danger\",\n className: \"bg-tertiary-10 text-white\"\n },\n warning: {\n icon: \"warning-2\",\n className: \"bg-tertiary-20 text-white\"\n }\n} as const;\n\nexport const Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Root>,\n ToastProps\n>(\n (\n {\n title,\n message,\n action,\n secondaryAction,\n variant = \"default\",\n duration = 5000,\n className,\n onOpenChange,\n allowOutsideClick = true,\n onClose,\n ...props\n },\n ref\n ) => {\n const variantConfig = variants[variant];\n\n const handleOpenChange = React.useCallback(\n (open: boolean) => {\n // Only allow programmatic close or close button click if outside click is disabled\n if (!allowOutsideClick && open === false) {\n return;\n }\n onOpenChange?.(open);\n if (!open) {\n onClose?.();\n }\n },\n [onOpenChange, allowOutsideClick, onClose]\n );\n\n return (\n <ToastPrimitive.Root\n ref={ref}\n onOpenChange={handleOpenChange}\n duration={duration}\n className={cn(\n \"group pointer-events-auto relative flex w-full flex-col gap-4 rounded-lg p-4 items-center\",\n \"shadow-lg\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-right-full\",\n variantConfig.className,\n className\n )}\n {...props}\n >\n <ToastPrimitive.Close\n className=\"absolute right-1 top-1 h-[40px] w-[40px] p-1 hover:bg-white/10 flex items-center justify-center rounded-lg\"\n aria-label=\"Close\"\n onClick={onClose}\n >\n <Icon name=\"close\" size={16} color=\"white\" />\n </ToastPrimitive.Close>\n\n <div className=\"flex gap-4\">\n <Icon\n name={variantConfig.icon}\n className=\"h-5 w-5 shrink-0\"\n color=\"white\"\n />\n\n <div className=\"flex flex-col flex-1 gap-2\">\n {title && (\n <ToastPrimitive.Title asChild>\n <Text variant=\"body-default-bold\" color=\"inherit\">\n {title}\n </Text>\n </ToastPrimitive.Title>\n )}\n <ToastPrimitive.Description asChild>\n <Text variant=\"body-xs-medium\" color=\"inherit\">\n {message}\n </Text>\n </ToastPrimitive.Description>\n </div>\n </div>\n\n {(action || secondaryAction) && (\n <div className=\"flex gap-2 justify-end mt-2\">\n {secondaryAction && (\n <ToastPrimitive.Action asChild altText={secondaryAction.label}>\n <div className=\"min-h-[40px] flex items-center\">\n <Button\n variant={secondaryAction.variant || \"outlined\"}\n color=\"black\"\n className=\"border-white text-white hover:bg-white/10\"\n onClick={secondaryAction.onClick}\n >\n {secondaryAction.label}\n </Button>\n </div>\n </ToastPrimitive.Action>\n )}\n {action && (\n <ToastPrimitive.Action asChild altText={action.label}>\n <div className=\"flex items-center\">\n <Button\n variant={action.variant || \"outlined\"}\n color=\"black\"\n className=\"border-white text-white hover:bg-white/10\"\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n </div>\n </ToastPrimitive.Action>\n )}\n </div>\n )}\n </ToastPrimitive.Root>\n );\n }\n);\n\nToast.displayName = \"Toast\";\n"]}
|
|
@@ -1,35 +1,47 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
3
|
+
import { ButtonProps } from './Button.cjs';
|
|
3
4
|
|
|
4
|
-
type
|
|
5
|
+
type ToastAction = {
|
|
6
|
+
label: string;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
variant?: ButtonProps["variant"];
|
|
9
|
+
};
|
|
10
|
+
type ToastProps = Omit<ToastPrimitive.ToastProps, "action"> & {
|
|
5
11
|
/** Optional title for the toast */
|
|
6
12
|
title?: string;
|
|
7
13
|
/** Main message content */
|
|
8
14
|
message: string;
|
|
9
|
-
/**
|
|
10
|
-
action?:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
15
|
+
/** Primary action button configuration */
|
|
16
|
+
action?: ToastAction;
|
|
17
|
+
/** Secondary action button configuration */
|
|
18
|
+
secondaryAction?: ToastAction;
|
|
14
19
|
/** Optional variant to change the visual style */
|
|
15
20
|
variant?: "default" | "success" | "error" | "warning";
|
|
21
|
+
/** Whether to allow dismissing by clicking outside */
|
|
22
|
+
allowOutsideClick?: boolean;
|
|
16
23
|
/** Optional className for custom styling */
|
|
17
24
|
className?: string;
|
|
25
|
+
/** Optional callback when toast is closed */
|
|
26
|
+
onClose?: () => void;
|
|
18
27
|
};
|
|
19
|
-
declare const Toast: React.ForwardRefExoticComponent<ToastPrimitive.ToastProps & {
|
|
28
|
+
declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastProps, "action"> & {
|
|
20
29
|
/** Optional title for the toast */
|
|
21
30
|
title?: string;
|
|
22
31
|
/** Main message content */
|
|
23
32
|
message: string;
|
|
24
|
-
/**
|
|
25
|
-
action?:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
33
|
+
/** Primary action button configuration */
|
|
34
|
+
action?: ToastAction;
|
|
35
|
+
/** Secondary action button configuration */
|
|
36
|
+
secondaryAction?: ToastAction;
|
|
29
37
|
/** Optional variant to change the visual style */
|
|
30
38
|
variant?: "default" | "success" | "error" | "warning";
|
|
39
|
+
/** Whether to allow dismissing by clicking outside */
|
|
40
|
+
allowOutsideClick?: boolean;
|
|
31
41
|
/** Optional className for custom styling */
|
|
32
42
|
className?: string;
|
|
43
|
+
/** Optional callback when toast is closed */
|
|
44
|
+
onClose?: () => void;
|
|
33
45
|
} & React.RefAttributes<HTMLLIElement>>;
|
|
34
46
|
|
|
35
47
|
export { Toast, type ToastProps };
|
|
@@ -1,35 +1,47 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
3
|
+
import { ButtonProps } from './Button.js';
|
|
3
4
|
|
|
4
|
-
type
|
|
5
|
+
type ToastAction = {
|
|
6
|
+
label: string;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
variant?: ButtonProps["variant"];
|
|
9
|
+
};
|
|
10
|
+
type ToastProps = Omit<ToastPrimitive.ToastProps, "action"> & {
|
|
5
11
|
/** Optional title for the toast */
|
|
6
12
|
title?: string;
|
|
7
13
|
/** Main message content */
|
|
8
14
|
message: string;
|
|
9
|
-
/**
|
|
10
|
-
action?:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
15
|
+
/** Primary action button configuration */
|
|
16
|
+
action?: ToastAction;
|
|
17
|
+
/** Secondary action button configuration */
|
|
18
|
+
secondaryAction?: ToastAction;
|
|
14
19
|
/** Optional variant to change the visual style */
|
|
15
20
|
variant?: "default" | "success" | "error" | "warning";
|
|
21
|
+
/** Whether to allow dismissing by clicking outside */
|
|
22
|
+
allowOutsideClick?: boolean;
|
|
16
23
|
/** Optional className for custom styling */
|
|
17
24
|
className?: string;
|
|
25
|
+
/** Optional callback when toast is closed */
|
|
26
|
+
onClose?: () => void;
|
|
18
27
|
};
|
|
19
|
-
declare const Toast: React.ForwardRefExoticComponent<ToastPrimitive.ToastProps & {
|
|
28
|
+
declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastProps, "action"> & {
|
|
20
29
|
/** Optional title for the toast */
|
|
21
30
|
title?: string;
|
|
22
31
|
/** Main message content */
|
|
23
32
|
message: string;
|
|
24
|
-
/**
|
|
25
|
-
action?:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
33
|
+
/** Primary action button configuration */
|
|
34
|
+
action?: ToastAction;
|
|
35
|
+
/** Secondary action button configuration */
|
|
36
|
+
secondaryAction?: ToastAction;
|
|
29
37
|
/** Optional variant to change the visual style */
|
|
30
38
|
variant?: "default" | "success" | "error" | "warning";
|
|
39
|
+
/** Whether to allow dismissing by clicking outside */
|
|
40
|
+
allowOutsideClick?: boolean;
|
|
31
41
|
/** Optional className for custom styling */
|
|
32
42
|
className?: string;
|
|
43
|
+
/** Optional callback when toast is closed */
|
|
44
|
+
onClose?: () => void;
|
|
33
45
|
} & React.RefAttributes<HTMLLIElement>>;
|
|
34
46
|
|
|
35
47
|
export { Toast, type ToastProps };
|
package/dist/components/Toast.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as r from'react';import r__default from'react';import*as l from'@radix-ui/react-toast';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {IconMap}from'@deckai/icons';function d(...e){return twMerge(clsx(e))}var v={primary:"#080808",secondary:"#666666",white:"#ffffff",primaryBlue:"#089CCB",disabled:"#888888",danger:"#FF0000"},$={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},A=e=>{if(!e)return {width:"24px",height:"24px"};let i=Array.isArray(e)?e:[e],t={},o;return i.forEach(a=>{if(typeof a=="number")o=`${a}px`;else {let[s,n]=a.split(":"),p=parseInt(n,10);t[`@media (min-width: ${$[s]})`]=`${p}px`;}}),{width:o||"24px",height:o||"24px",...Object.entries(t).reduce((a,[s,n])=>({...a,[s]:{width:n,height:n}}),{})}},g=r__default.forwardRef(({name:e,size:i=24,color:t="primary",title:o,className:a,style:s={},...n},p)=>{let c=IconMap[e],m=A(i);return r__default.createElement("div",{className:d("flex justify-center items-center",a),style:{...m,"--icon-stroke":v[t],...s}},r__default.createElement(c,{ref:p,"aria-hidden":!o,"aria-label":o,stroke:e.includes("filled")?void 0:v[t],...n}))});g.displayName="Icon";var k={xl:"h1",lg:"h1",md:"h2",sm:"h3",xs:"h4"},N=e=>{let[i,t]=e.split("-");return i==="heading"?k[t]||"p":i==="label"?"label":"p"},w={light:"font-light",regular:"font-regular",semibold:"font-semibold",bold:"font-bold"},S=e=>e?(Array.isArray(e)?e:[e]).map(t=>{if(t.includes(":")){let[o,a]=t.split(":");return `${o}:text-${a}`}return `text-${t}`}).join(" "):"text-body-default",y=r__default.forwardRef(({variant:e="body-default",color:i="primary",as:t,className:o,children:a,weight:s,...n},p)=>{let c=S(e),m=i==="inherit"?"text-inherit":`text-${i}`,h=r__default.useMemo(()=>{let T=typeof e=="string"?e.split(":").pop():Array.isArray(e)?e[0].split(":").pop():"body-default";return N(T)},[e]);return r__default.createElement(t||h,{ref:p,className:`
|
|
2
|
+
font-sans antialiased
|
|
3
|
+
${c}
|
|
4
|
+
${m}
|
|
5
|
+
${s&&`!${w[s]}`}
|
|
6
|
+
${o}
|
|
7
|
+
`,...n},a)});y.displayName="Text";var R="focus-visible:outline-none focus-visible:border-2 focus-visible:border-primary-100";var B={black:"bg-primary text-white",accent:"bg-primary-100 text-white",secondary:"bg-secondary-100 text-secondary"},V={black:"border border-text text-primary",accent:"border border-primary-100 text-primary-100",secondary:"border border-text-secondary text-secondary"},f=r.forwardRef(({className:e,variant:i="filled",color:t="black",isLoading:o=!1,children:a,disabled:s,end:n,...p},c)=>r.createElement("button",{ref:c,className:d(`
|
|
2
8
|
sm:px-7 px-4
|
|
3
9
|
py-2
|
|
4
10
|
inline-flex items-center justify-center
|
|
@@ -6,5 +12,5 @@ import*as o from'react';import o__default from'react';import*as l from'@radix-ui
|
|
|
6
12
|
transition-colors duration-200
|
|
7
13
|
disabled:opacity-50 disabled:pointer-events-none
|
|
8
14
|
hover:opacity-80 active:scale-95
|
|
9
|
-
truncate`,
|
|
15
|
+
truncate`,R,i==="filled"?B[t]:i==="transparent"?"bg-transparent text-text":V[t],e),disabled:s||o,type:"button",...p},typeof a=="string"?r.createElement(y,{variant:["sm:body-default-bold","body-xxs-semibold"],color:"inherit"},a):a,n));f.displayName="Button";var I={default:{icon:"information",className:"bg-gray-900 text-white"},success:{icon:"check",className:"bg-green-600 text-white"},error:{icon:"danger",className:"bg-tertiary-10 text-white"},warning:{icon:"warning-2",className:"bg-tertiary-20 text-white"}},O=r.forwardRef(({title:e,message:i,action:t,secondaryAction:o,variant:a="default",duration:s=5e3,className:n,onOpenChange:p,allowOutsideClick:c=!0,onClose:m,...h},M)=>{let T=I[a],E=r.useCallback(b=>{!c&&b===!1||(p?.(b),b||m?.());},[p,c,m]);return r.createElement(l.Root,{ref:M,onOpenChange:E,duration:s,className:d("group pointer-events-auto relative flex w-full flex-col gap-4 rounded-lg p-4 items-center","shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-right-full",T.className,n),...h},r.createElement(l.Close,{className:"absolute right-1 top-1 h-[40px] w-[40px] p-1 hover:bg-white/10 flex items-center justify-center rounded-lg","aria-label":"Close",onClick:m},r.createElement(g,{name:"close",size:16,color:"white"})),r.createElement("div",{className:"flex gap-4"},r.createElement(g,{name:T.icon,className:"h-5 w-5 shrink-0",color:"white"}),r.createElement("div",{className:"flex flex-col flex-1 gap-2"},e&&r.createElement(l.Title,{asChild:!0},r.createElement(y,{variant:"body-default-bold",color:"inherit"},e)),r.createElement(l.Description,{asChild:!0},r.createElement(y,{variant:"body-xs-medium",color:"inherit"},i)))),(t||o)&&r.createElement("div",{className:"flex gap-2 justify-end mt-2"},o&&r.createElement(l.Action,{asChild:!0,altText:o.label},r.createElement("div",{className:"min-h-[40px] flex items-center"},r.createElement(f,{variant:o.variant||"outlined",color:"black",className:"border-white text-white hover:bg-white/10",onClick:o.onClick},o.label))),t&&r.createElement(l.Action,{asChild:!0,altText:t.label},r.createElement("div",{className:"flex items-center"},r.createElement(f,{variant:t.variant||"outlined",color:"black",className:"border-white text-white hover:bg-white/10",onClick:t.onClick},t.label)))))});O.displayName="Toast";export{O as Toast};//# sourceMappingURL=Toast.js.map
|
|
10
16
|
//# sourceMappingURL=Toast.js.map
|