@cocso-ui/react 0.0.1-beta.8 → 0.0.1-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Body/Body.d.ts +5 -3
- package/lib/components/Button/Button.d.ts +20 -0
- package/lib/components/Button/index.d.ts +1 -0
- package/lib/components/Display/Display.d.ts +6 -4
- package/lib/components/Heading/Heading.d.ts +6 -4
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/utils/cn.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type FontWeightToken } from '../../utils/tokens';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
declare const tags: readonly ["p", "a", "span", "div", "label", "li", "td", "th", "figcaption", "blockquote", "cite"];
|
|
4
|
+
type Element = (typeof tags)[number];
|
|
5
|
+
type Default = (typeof tags)[0];
|
|
6
|
+
export type BodyProps<T extends Element = Default> = {
|
|
5
7
|
as?: T;
|
|
6
8
|
size?: 'lg' | 'md' | 'sm' | 'xs';
|
|
7
9
|
color?: string;
|
|
8
10
|
fontWeight?: FontWeightToken;
|
|
9
11
|
} & Omit<React.ComponentPropsWithoutRef<T>, 'size' | 'color' | 'fontWeight'>;
|
|
10
|
-
export declare const Body: (<T extends
|
|
12
|
+
export declare const Body: (<T extends Element = "p">(props: BodyProps<T> & {
|
|
11
13
|
ref?: React.ForwardedRef<React.ComponentRef<T>>;
|
|
12
14
|
}) => React.ReactElement) & {
|
|
13
15
|
displayName: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type FontWeightToken } from '../../utils/tokens';
|
|
3
|
+
declare const tags: readonly ["button"];
|
|
4
|
+
type Element = (typeof tags)[number];
|
|
5
|
+
type Default = (typeof tags)[0];
|
|
6
|
+
export type ButtonProps<T extends Element = Default> = {
|
|
7
|
+
as?: T;
|
|
8
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'text';
|
|
9
|
+
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
color?: string;
|
|
13
|
+
fontWeight?: FontWeightToken;
|
|
14
|
+
} & Omit<React.ComponentPropsWithoutRef<T>, 'size' | 'color' | 'fontWeight'>;
|
|
15
|
+
export declare const Button: (<T extends Element = "button">(props: ButtonProps<T> & {
|
|
16
|
+
ref?: React.ForwardedRef<React.ComponentRef<T>>;
|
|
17
|
+
}) => React.ReactElement) & {
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type FontWeightToken } from '../../utils/tokens';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
declare const tags: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
4
|
+
type Element = (typeof tags)[number];
|
|
5
|
+
type Default = (typeof tags)[0];
|
|
6
|
+
export type DisplayProps<T extends Element = Default> = {
|
|
5
7
|
as?: T;
|
|
6
8
|
size?: 'lg' | 'md' | 'sm';
|
|
7
9
|
color?: string;
|
|
8
10
|
fontWeight?: FontWeightToken;
|
|
9
|
-
} & Omit<React.ComponentPropsWithoutRef<T>, 'size' | 'color'>;
|
|
10
|
-
export declare const Display: (<T extends
|
|
11
|
+
} & Omit<React.ComponentPropsWithoutRef<T>, 'size' | 'color' | 'fontWeight'>;
|
|
12
|
+
export declare const Display: (<T extends Element = "h1">(props: DisplayProps<T> & {
|
|
11
13
|
ref?: React.ForwardedRef<React.ComponentRef<T>>;
|
|
12
14
|
}) => React.ReactElement) & {
|
|
13
15
|
displayName: string;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type FontWeightToken } from '../../utils/tokens';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
declare const tags: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
4
|
+
type Element = (typeof tags)[number];
|
|
5
|
+
type Default = (typeof tags)[1];
|
|
6
|
+
export type HeadingProps<T extends Element = Default> = {
|
|
5
7
|
as?: T;
|
|
6
8
|
size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs' | '2xs';
|
|
7
9
|
color?: string;
|
|
8
10
|
fontWeight?: FontWeightToken;
|
|
9
|
-
} & Omit<React.ComponentPropsWithoutRef<T>, 'size' | 'color'>;
|
|
10
|
-
export declare const Heading: (<T extends
|
|
11
|
+
} & Omit<React.ComponentPropsWithoutRef<T>, 'size' | 'color' | 'fontWeight'>;
|
|
12
|
+
export declare const Heading: (<T extends Element = "h2">(props: HeadingProps<T> & {
|
|
11
13
|
ref?: React.ForwardedRef<React.ComponentRef<T>>;
|
|
12
14
|
}) => React.ReactElement) & {
|
|
13
15
|
displayName: string;
|
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var N=Object.create;var g=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var k=(e,t)=>{for(var o in t)g(e,o,{get:t[o],enumerable:!0})},y=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of B(t))!v.call(e,s)&&s!==o&&g(e,s,{get:()=>t[s],enumerable:!(n=w(t,s))||n.enumerable});return e};var R=(e,t,o)=>(o=e!=null?N(O(e)):{},y(t||!e||!e.__esModule?g(o,"default",{value:e,enumerable:!0}):o,e)),z=e=>y(g({},"__esModule",{value:!0}),e);var ee={};k(ee,{Body:()=>M,Button:()=>K,Display:()=>U,Heading:()=>Z});module.exports=z(ee);var u=R(require("react"),1);function c(e){if(e)return`var(--color-${e.replace(/\./g,"-")})`}var H={thin:"100","extra-light":"200",light:"300",normal:"400",medium:"500","semi-bold":"600",bold:"700","extra-bold":"800",black:"900"};function i(e){if(e)return H[e]??e}var S=(...e)=>e.filter(Boolean).join(" ").trim(),$=(e,t,o)=>`${e}--${t}_${o}`,j=(e,t)=>Object.entries(t).map(([o,n])=>$(e,o,n)).join(" "),_=(e,t)=>Object.entries(e).every(([o,n])=>t[o]===n),V=(e,t)=>{let o=Object.entries(t).map(([n,s])=>`${n}_${s}`).join("-");return`${e}--${o}`},A=(e,t,o)=>o.filter(n=>_(n,t)).map(n=>V(e,n)).join(" "),l=(e,t,o=[],...n)=>{let s=e,a=j(e,t),r=A(e,t,o);return S(s,a,r,...n)};var T=require("react/jsx-runtime"),G=["p","a","span","div","label","li","td","th","figcaption","blockquote","cite"],I=u.forwardRef(({as:e=G[0],size:t="md",color:o,fontWeight:n="normal",className:s,style:a,...r},p)=>{let m=e,d=l("cocso-body",{size:t},[],s);return(0,T.jsx)(m,{ref:p,className:d,style:{"--cocso-body-color":c(o),"--cocso-body-weight":i(n),...a},...r})}),M=Object.assign(I,{displayName:"Body"});var h=R(require("react"),1);var C=require("react/jsx-runtime"),q=["button"],J=h.forwardRef(({as:e=q[0],variant:t="primary",size:o="md",disabled:n=!1,loading:s=!1,color:a,fontWeight:r="bold",className:p,style:m,...f},d)=>{let F=e,D={variant:t,size:o,...n&&{disabled:"true"},...s&&{loading:"true"}},P=l("cocso-button",D,[],p);return(0,C.jsx)(F,{ref:d,className:P,style:{"--cocso-button-color":c(a),"--cocso-button-weight":i(r),...m},...f})}),K=Object.assign(J,{displayName:"Button"});var x=R(require("react"),1);var b=require("react/jsx-runtime"),L=["h1","h2","h3","h4","h5","h6"],Q=x.forwardRef(({as:e=L[0],size:t="md",color:o,fontWeight:n="bold",className:s,style:a,...r},p)=>{let m=e,d=l("cocso-display",{size:t},[],s);return(0,b.jsx)(m,{ref:p,className:d,style:{"--cocso-display-color":c(o),"--cocso-display-weight":i(n),...a},...r})}),U=Object.assign(Q,{displayName:"Display"});var E=R(require("react"),1);var W=require("react/jsx-runtime"),X=["h1","h2","h3","h4","h5","h6"],Y=E.forwardRef(({as:e=X[1],size:t="md",color:o,fontWeight:n="bold",className:s,style:a,...r},p)=>{let m=e,d=l("cocso-heading",{size:t},[],s);return(0,W.jsx)(m,{ref:p,className:d,style:{"--cocso-heading-color":c(o),"--cocso-heading-weight":i(n),...a},...r})}),Z=Object.assign(Y,{displayName:"Heading"});
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as g from"react";function c(e){if(e)return`var(--color-${e.replace(/\./g,"-")})`}var x={thin:"100","extra-light":"200",light:"300",normal:"400",medium:"500","semi-bold":"600",bold:"700","extra-bold":"800",black:"900"};function i(e){if(e)return x[e]??e}var b=(...e)=>e.filter(Boolean).join(" ").trim(),E=(e,t,o)=>`${e}--${t}_${o}`,W=(e,t)=>Object.entries(t).map(([o,n])=>E(e,o,n)).join(" "),F=(e,t)=>Object.entries(e).every(([o,n])=>t[o]===n),D=(e,t)=>{let o=Object.entries(t).map(([n,s])=>`${n}_${s}`).join("-");return`${e}--${o}`},P=(e,t,o)=>o.filter(n=>F(n,t)).map(n=>D(e,n)).join(" "),l=(e,t,o=[],...n)=>{let s=e,a=W(e,t),r=P(e,t,o);return b(s,a,r,...n)};import{jsx as B}from"react/jsx-runtime";var N=["p","a","span","div","label","li","td","th","figcaption","blockquote","cite"],w=g.forwardRef(({as:e=N[0],size:t="md",color:o,fontWeight:n="normal",className:s,style:a,...r},p)=>{let m=e,d=l("cocso-body",{size:t},[],s);return B(m,{ref:p,className:d,style:{"--cocso-body-color":c(o),"--cocso-body-weight":i(n),...a},...r})}),M=Object.assign(w,{displayName:"Body"});import*as R from"react";import{jsx as k}from"react/jsx-runtime";var O=["button"],v=R.forwardRef(({as:e=O[0],variant:t="primary",size:o="md",disabled:n=!1,loading:s=!1,color:a,fontWeight:r="bold",className:p,style:m,...f},d)=>{let T=e,h={variant:t,size:o,...n&&{disabled:"true"},...s&&{loading:"true"}},C=l("cocso-button",h,[],p);return k(T,{ref:d,className:C,style:{"--cocso-button-color":c(a),"--cocso-button-weight":i(r),...m},...f})}),X=Object.assign(v,{displayName:"Button"});import*as y from"react";import{jsx as S}from"react/jsx-runtime";var z=["h1","h2","h3","h4","h5","h6"],H=y.forwardRef(({as:e=z[0],size:t="md",color:o,fontWeight:n="bold",className:s,style:a,...r},p)=>{let m=e,d=l("cocso-display",{size:t},[],s);return S(m,{ref:p,className:d,style:{"--cocso-display-color":c(o),"--cocso-display-weight":i(n),...a},...r})}),se=Object.assign(H,{displayName:"Display"});import*as u from"react";import{jsx as _}from"react/jsx-runtime";var $=["h1","h2","h3","h4","h5","h6"],j=u.forwardRef(({as:e=$[1],size:t="md",color:o,fontWeight:n="bold",className:s,style:a,...r},p)=>{let m=e,d=l("cocso-heading",{size:t},[],s);return _(m,{ref:p,className:d,style:{"--cocso-heading-color":c(o),"--cocso-heading-weight":i(n),...a},...r})}),me=Object.assign(j,{displayName:"Heading"});export{M as Body,X as Button,se as Display,me as Heading};
|
package/lib/utils/cn.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export declare const cn: (...classes: (string | undefined | null | false)[]) => string;
|
|
2
|
+
export declare const createClassName: (baseClass: string, variants: Record<string, any>, compoundVariants?: Record<string, any>[], ...additionalClasses: (string | undefined | null | false)[]) => string;
|