@tayelemma/button 1.0.1
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/index.d.ts +18 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +38 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { ComponentPropsWithRef } from 'react';
|
|
2
|
+
|
|
3
|
+
type ButtonVariant = 'PRIMARY' | 'BORDERED' | 'BORDERLESS' | 'ICON';
|
|
4
|
+
interface ButtonProps extends ComponentPropsWithRef<'button'> {
|
|
5
|
+
buttonVariant?: ButtonVariant;
|
|
6
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
7
|
+
className?: string;
|
|
8
|
+
invertedColor?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface ButtonLinkProps {
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
to: string;
|
|
15
|
+
}
|
|
16
|
+
declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
|
|
18
|
+
export { Button, ButtonLinkProps, ButtonProps, ButtonVariant };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var i=Object.defineProperty,h=Object.defineProperties,v=Object.getOwnPropertyDescriptor,C=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertyNames,a=Object.getOwnPropertySymbols;var s=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;var p=(t,o,n)=>o in t?i(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,f=(t,o)=>{for(var n in o||(o={}))s.call(o,n)&&p(t,n,o[n]);if(a)for(var n of a(o))c.call(o,n)&&p(t,n,o[n]);return t},d=(t,o)=>h(t,C(o));var R=(t,o)=>{var n={};for(var r in t)s.call(t,r)&&o.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&a)for(var r of a(t))o.indexOf(r)<0&&c.call(t,r)&&(n[r]=t[r]);return n};var V=(t,o)=>{for(var n in o)i(t,n,{get:o[n],enumerable:!0})},A=(t,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of E(o))!s.call(t,e)&&e!==n&&i(t,e,{get:()=>o[e],enumerable:!(r=v(o,e))||r.enumerable});return t};var L=t=>A(i({},"__esModule",{value:!0}),t);var k={};V(k,{Button:()=>u});module.exports=L(k);var b=require("react");function m(t){var o,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var e=t.length;for(o=0;o<e;o++)t[o]&&(n=m(t[o]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function _(){for(var t,o,n=0,r="",e=arguments.length;n<e;n++)(t=arguments[n])&&(o=m(t))&&(r&&(r+=" "),r+=o);return r}var B=_;var x=require("react/jsx-runtime"),u=(0,b.forwardRef)((t,o)=>{let l=t,{className:n,buttonVariant:r="PRIMARY",invertedColor:e,disabled:N,children:P}=l,y=R(l,["className","buttonVariant","invertedColor","disabled","children"]),g=B(`button__${r}`,e&&`button__${r}--inverted`,n);return(0,x.jsx)("button",d(f({ref:o,className:g,disabled:N},y),{children:P}))});u.displayName="Button";0&&(module.exports={Button});
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/Button.tsx","../../../node_modules/clsx/dist/clsx.mjs"],"sourcesContent":["export { Button, ButtonVariant } from './Button';\r\nexport type { ButtonProps, ButtonLinkProps } from './Button';\r\n","import React, { ComponentPropsWithRef, forwardRef } from 'react';\r\nimport clsx from 'clsx';\r\nexport type ButtonVariant = 'PRIMARY' | 'BORDERED' | 'BORDERLESS' | 'ICON';\r\n\r\n\r\nexport interface ButtonProps extends ComponentPropsWithRef<'button'> {\r\n\tbuttonVariant?: ButtonVariant;\r\n\tchildren?: React.ReactNode | React.ReactNode[];\r\n\tclassName?: string;\r\n\tinvertedColor?: boolean;\r\n}\r\n\r\nexport interface ButtonLinkProps {\r\n\tchildren?: React.ReactNode;\r\n\tonClick?: () => void;\r\n\tdisabled?: boolean;\r\n\tto: string;\r\n}\r\n\r\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\r\n\t(props, ref) => {\r\n\t\tconst {\r\n\t\t\tclassName,\r\n\t\t\tbuttonVariant = 'PRIMARY',\r\n\t\t\tinvertedColor,\r\n\t\t\tdisabled,\r\n\t\t\tchildren,\r\n\t\t\t...rest\r\n\t\t} = props;\r\n\r\n\t\tconst finalClassName = clsx(\r\n\t\t\t`button__${buttonVariant}`,\r\n\t\t\tinvertedColor && `button__${buttonVariant}--inverted`,\r\n\t\t\tclassName\r\n\t\t);\r\n\t\treturn (\r\n\t\t\t<button\r\n\t\t\t\tref={ref}\r\n\t\t\t\tclassName={finalClassName}\r\n\t\t\t\tdisabled={disabled}\r\n\t\t\t\t{...rest}\r\n\t\t\t>\r\n\t\t\t\t{children}\r\n\t\t\t</button>\r\n\t\t);\r\n\t}\r\n);\r\n\r\nButton.displayName = 'Button';\r\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;"],"mappings":"y5BAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAyD,iBCAzD,SAASC,EAAEC,EAAE,CAAC,IAAIC,EAAEC,EAAEC,EAAE,GAAG,GAAa,OAAOH,GAAjB,UAA8B,OAAOA,GAAjB,SAAmBG,GAAGH,UAAoB,OAAOA,GAAjB,SAAmB,GAAG,MAAM,QAAQA,CAAC,EAAE,CAAC,IAAII,EAAEJ,EAAE,OAAO,IAAIC,EAAE,EAAEA,EAAEG,EAAEH,IAAID,EAAEC,CAAC,IAAIC,EAAEH,EAAEC,EAAEC,CAAC,CAAC,KAAKE,IAAIA,GAAG,KAAKA,GAAGD,OAAQ,KAAIA,KAAKF,EAAEA,EAAEE,CAAC,IAAIC,IAAIA,GAAG,KAAKA,GAAGD,GAAG,OAAOC,CAAC,CAAQ,SAASE,GAAM,CAAC,QAAQL,EAAEC,EAAEC,EAAE,EAAEC,EAAE,GAAGC,EAAE,UAAU,OAAOF,EAAEE,EAAEF,KAAKF,EAAE,UAAUE,CAAC,KAAKD,EAAEF,EAAEC,CAAC,KAAKG,IAAIA,GAAG,KAAKA,GAAGF,GAAG,OAAOE,CAAC,CAAC,IAAOG,EAAQD,EDoC5X,IAAAE,EAAA,6BAjBUC,KAAS,cACrB,CAACC,EAAOC,IAAQ,CACf,IAOIC,EAAAF,EANH,WAAAG,EACA,cAAAC,EAAgB,UAChB,cAAAC,EACA,SAAAC,EACA,SAAAC,CA1BH,EA4BML,EADAM,EAAAC,EACAP,EADA,CALH,YACA,gBACA,gBACA,WACA,aAIKQ,EAAiBC,EACtB,WAAWP,IACXC,GAAiB,WAAWD,cAC5BD,CACD,EACA,SACC,OAAC,SAAAS,EAAAC,EAAA,CACA,IAAKZ,EACL,UAAWS,EACX,SAAUJ,GACNE,GAJJ,CAMC,SAAAD,GACF,CAEF,CACD,EAEAR,EAAO,YAAc","names":["src_exports","__export","Button","__toCommonJS","import_react","r","e","t","f","n","o","clsx","clsx_default","import_jsx_runtime","Button","props","ref","_a","className","buttonVariant","invertedColor","disabled","children","rest","__objRest","finalClassName","clsx_default","__spreadProps","__spreadValues"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var P=Object.defineProperty,y=Object.defineProperties;var g=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;var s=(t,o,n)=>o in t?P(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,p=(t,o)=>{for(var n in o||(o={}))u.call(o,n)&&s(t,n,o[n]);if(a)for(var n of a(o))l.call(o,n)&&s(t,n,o[n]);return t},c=(t,o)=>y(t,g(o));var f=(t,o)=>{var n={};for(var r in t)u.call(t,r)&&o.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&a)for(var r of a(t))o.indexOf(r)<0&&l.call(t,r)&&(n[r]=t[r]);return n};import{forwardRef as v}from"react";function d(t){var o,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var e=t.length;for(o=0;o<e;o++)t[o]&&(n=d(t[o]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function h(){for(var t,o,n=0,r="",e=arguments.length;n<e;n++)(t=arguments[n])&&(o=d(t))&&(r&&(r+=" "),r+=o);return r}var R=h;import{jsx as C}from"react/jsx-runtime";var m=v((t,o)=>{let i=t,{className:n,buttonVariant:r="PRIMARY",invertedColor:e,disabled:B,children:b}=i,x=f(i,["className","buttonVariant","invertedColor","disabled","children"]),N=R(`button__${r}`,e&&`button__${r}--inverted`,n);return C("button",c(p({ref:o,className:N,disabled:B},x),{children:b}))});m.displayName="Button";export{m as Button};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Button.tsx","../../../node_modules/clsx/dist/clsx.mjs"],"sourcesContent":["import React, { ComponentPropsWithRef, forwardRef } from 'react';\r\nimport clsx from 'clsx';\r\nexport type ButtonVariant = 'PRIMARY' | 'BORDERED' | 'BORDERLESS' | 'ICON';\r\n\r\n\r\nexport interface ButtonProps extends ComponentPropsWithRef<'button'> {\r\n\tbuttonVariant?: ButtonVariant;\r\n\tchildren?: React.ReactNode | React.ReactNode[];\r\n\tclassName?: string;\r\n\tinvertedColor?: boolean;\r\n}\r\n\r\nexport interface ButtonLinkProps {\r\n\tchildren?: React.ReactNode;\r\n\tonClick?: () => void;\r\n\tdisabled?: boolean;\r\n\tto: string;\r\n}\r\n\r\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\r\n\t(props, ref) => {\r\n\t\tconst {\r\n\t\t\tclassName,\r\n\t\t\tbuttonVariant = 'PRIMARY',\r\n\t\t\tinvertedColor,\r\n\t\t\tdisabled,\r\n\t\t\tchildren,\r\n\t\t\t...rest\r\n\t\t} = props;\r\n\r\n\t\tconst finalClassName = clsx(\r\n\t\t\t`button__${buttonVariant}`,\r\n\t\t\tinvertedColor && `button__${buttonVariant}--inverted`,\r\n\t\t\tclassName\r\n\t\t);\r\n\t\treturn (\r\n\t\t\t<button\r\n\t\t\t\tref={ref}\r\n\t\t\t\tclassName={finalClassName}\r\n\t\t\t\tdisabled={disabled}\r\n\t\t\t\t{...rest}\r\n\t\t\t>\r\n\t\t\t\t{children}\r\n\t\t\t</button>\r\n\t\t);\r\n\t}\r\n);\r\n\r\nButton.displayName = 'Button';\r\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;"],"mappings":"+kBAAA,OAAuC,cAAAA,MAAkB,QCAzD,SAASC,EAAEC,EAAE,CAAC,IAAIC,EAAEC,EAAEC,EAAE,GAAG,GAAa,OAAOH,GAAjB,UAA8B,OAAOA,GAAjB,SAAmBG,GAAGH,UAAoB,OAAOA,GAAjB,SAAmB,GAAG,MAAM,QAAQA,CAAC,EAAE,CAAC,IAAII,EAAEJ,EAAE,OAAO,IAAIC,EAAE,EAAEA,EAAEG,EAAEH,IAAID,EAAEC,CAAC,IAAIC,EAAEH,EAAEC,EAAEC,CAAC,CAAC,KAAKE,IAAIA,GAAG,KAAKA,GAAGD,OAAQ,KAAIA,KAAKF,EAAEA,EAAEE,CAAC,IAAIC,IAAIA,GAAG,KAAKA,GAAGD,GAAG,OAAOC,CAAC,CAAQ,SAASE,GAAM,CAAC,QAAQL,EAAEC,EAAEC,EAAE,EAAEC,EAAE,GAAGC,EAAE,UAAU,OAAOF,EAAEE,EAAEF,KAAKF,EAAE,UAAUE,CAAC,KAAKD,EAAEF,EAAEC,CAAC,KAAKG,IAAIA,GAAG,KAAKA,GAAGF,GAAG,OAAOE,CAAC,CAAC,IAAOG,EAAQD,EDoC5X,cAAAE,MAAA,oBAjBI,IAAMC,EAASC,EACrB,CAACC,EAAOC,IAAQ,CACf,IAOIC,EAAAF,EANH,WAAAG,EACA,cAAAC,EAAgB,UAChB,cAAAC,EACA,SAAAC,EACA,SAAAC,CA1BH,EA4BML,EADAM,EAAAC,EACAP,EADA,CALH,YACA,gBACA,gBACA,WACA,aAIKQ,EAAiBC,EACtB,WAAWP,IACXC,GAAiB,WAAWD,cAC5BD,CACD,EACA,OACCN,EAAC,SAAAe,EAAAC,EAAA,CACA,IAAKZ,EACL,UAAWS,EACX,SAAUJ,GACNE,GAJJ,CAMC,SAAAD,GACF,CAEF,CACD,EAEAT,EAAO,YAAc","names":["forwardRef","r","e","t","f","n","o","clsx","clsx_default","jsx","Button","forwardRef","props","ref","_a","className","buttonVariant","invertedColor","disabled","children","rest","__objRest","finalClassName","clsx_default","__spreadProps","__spreadValues"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tayelemma/button",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "./dist/index.js",
|
|
5
|
+
"module": "./dist/index.mjs",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsup",
|
|
19
|
+
"dev": "tsup --watch --onSuccess \"yalc push --sig --changed\""
|
|
20
|
+
},
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/react": "^18.0.15",
|
|
25
|
+
"esbuild-sass-plugin": "^2.10.0",
|
|
26
|
+
"sass": "^1.54.0",
|
|
27
|
+
"tsup": "^6.7.0",
|
|
28
|
+
"typescript": "^5.0.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@floating-ui/react": "^0.24.1",
|
|
32
|
+
"@react-spring/web": "^9.7.2"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": ">=16.8.0",
|
|
36
|
+
"react-dom": ">=16.8.0"
|
|
37
|
+
}
|
|
38
|
+
}
|