@mobilestockweb/button 0.0.2 → 0.0.4
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 +10 -0
- package/dist/index.js +42 -0
- package/package.json +25 -9
- package/src/index.tsx +0 -62
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
interface PropsButton extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
text?: string;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare function Button({ isLoading, text, children, ...rest }: PropsButton): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { type PropsButton, Button as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";var y=Object.create;var s=Object.defineProperty,B=Object.defineProperties,w=Object.getOwnPropertyDescriptor,L=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertyNames,i=Object.getOwnPropertySymbols,v=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;var u=(t,r,o)=>r in t?s(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,p=(t,r)=>{for(var o in r||(r={}))m.call(r,o)&&u(t,o,r[o]);if(i)for(var o of i(r))c.call(r,o)&&u(t,o,r[o]);return t},d=(t,r)=>B(t,L(r));var f=(t,r)=>{var o={};for(var e in t)m.call(t,e)&&r.indexOf(e)<0&&(o[e]=t[e]);if(t!=null&&i)for(var e of i(t))r.indexOf(e)<0&&c.call(t,e)&&(o[e]=t[e]);return o};var H=(t,r)=>{for(var o in r)s(t,o,{get:r[o],enumerable:!0})},g=(t,r,o,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of $(r))!m.call(t,n)&&n!==o&&s(t,n,{get:()=>r[n],enumerable:!(e=w(r,n))||e.enumerable});return t};var M=(t,r,o)=>(o=t!=null?y(v(t)):{},g(r||!t||!t.__esModule?s(o,"default",{value:t,enumerable:!0}):o,t)),P=t=>g(s({},"__esModule",{value:!0}),t);var T={};H(T,{default:()=>x});module.exports=P(T);var h=require("@mui/material"),b=M(require("styled-components"));var a=require("react/jsx-runtime");function x(n){var l=n,{isLoading:t,text:r,children:o}=l,e=f(l,["isLoading","text","children"]);return(0,a.jsx)(S,d(p({},e),{children:t?(0,a.jsx)(h.CircularProgress,{className:"circular"}):(0,a.jsx)("span",{className:"emphasis",children:r||o})}))}var S=b.default.button`
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
|
|
6
|
+
width: 100%;
|
|
7
|
+
min-height: 3rem;
|
|
8
|
+
padding: 0.9rem 1rem;
|
|
9
|
+
|
|
10
|
+
font-size: 0.9rem;
|
|
11
|
+
font-family: 'Open Sans', sans-serif;
|
|
12
|
+
font-weight: 400;
|
|
13
|
+
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
|
|
16
|
+
box-shadow: 0 0.25rem 0.25rem ${({theme:t})=>t.colors.button.shadow};
|
|
17
|
+
border: none;
|
|
18
|
+
border-radius: 0.4rem;
|
|
19
|
+
background-color: ${({theme:t})=>t.colors.button.default};
|
|
20
|
+
color: ${({theme:t})=>t.colors.text.default};
|
|
21
|
+
svg {
|
|
22
|
+
font-size: 1.6rem;
|
|
23
|
+
margin-right: 0.3rem;
|
|
24
|
+
}
|
|
25
|
+
&:hover {
|
|
26
|
+
opacity: 0.8;
|
|
27
|
+
}
|
|
28
|
+
.emphasis {
|
|
29
|
+
text-transform: uppercase;
|
|
30
|
+
}
|
|
31
|
+
.circular {
|
|
32
|
+
width: 1rem !important;
|
|
33
|
+
height: 1rem !important;
|
|
34
|
+
color: ${({theme:t})=>t.colors.text.default};
|
|
35
|
+
svg {
|
|
36
|
+
margin-right: 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
&:disabled {
|
|
40
|
+
opacity: 0.7;
|
|
41
|
+
}
|
|
42
|
+
`;
|
package/package.json
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobilestockweb/button",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"main": "./
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
5
|
"files": [
|
|
6
|
-
"
|
|
6
|
+
"./dist/*"
|
|
7
7
|
],
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"default": "./
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"tsup": {
|
|
14
|
+
"entry": [
|
|
15
|
+
"src/index.tsx"
|
|
16
|
+
],
|
|
17
|
+
"minify": true,
|
|
18
|
+
"dts": true,
|
|
19
|
+
"clean": true,
|
|
20
|
+
"tsconfig": "../../../../../tsconfig.base.json",
|
|
21
|
+
"external": [
|
|
22
|
+
"react",
|
|
23
|
+
"react-dom",
|
|
24
|
+
"styled-components",
|
|
25
|
+
"@mui/material"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"prepublishOnly": "tsup"
|
|
15
30
|
},
|
|
16
31
|
"peerDependencies": {
|
|
17
|
-
"react": "
|
|
18
|
-
"react-dom": "
|
|
19
|
-
"styled-components": "
|
|
32
|
+
"react": "*",
|
|
33
|
+
"react-dom": "*",
|
|
34
|
+
"styled-components": "*",
|
|
35
|
+
"@mui/material": "*"
|
|
20
36
|
}
|
|
21
37
|
}
|
package/src/index.tsx
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { CircularProgress } from '@mui/material'
|
|
2
|
-
import { ButtonHTMLAttributes } from 'react'
|
|
3
|
-
import styled from 'styled-components'
|
|
4
|
-
|
|
5
|
-
export interface PropsButton extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
-
text?: string
|
|
7
|
-
isLoading?: boolean
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default function Button(props: PropsButton) {
|
|
11
|
-
return (
|
|
12
|
-
<ButtonStyle {...props}>
|
|
13
|
-
<span className="emphasis">
|
|
14
|
-
{props.isLoading ? <CircularProgress className="circular" /> : <>{props.text}</>}
|
|
15
|
-
</span>
|
|
16
|
-
{props.isLoading || props.children}
|
|
17
|
-
</ButtonStyle>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const ButtonStyle = styled.button`
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
justify-content: center;
|
|
25
|
-
|
|
26
|
-
width: 100%;
|
|
27
|
-
min-height: 3rem;
|
|
28
|
-
padding: 0.9rem 1rem;
|
|
29
|
-
|
|
30
|
-
font-size: 0.9rem;
|
|
31
|
-
font-family: 'Open Sans', sans-serif;
|
|
32
|
-
font-weight: 400;
|
|
33
|
-
|
|
34
|
-
cursor: pointer;
|
|
35
|
-
|
|
36
|
-
box-shadow: 0 0.25rem 0.25rem ${({ theme }) => theme.colors.button.shadow};
|
|
37
|
-
border: none;
|
|
38
|
-
border-radius: 0.4rem;
|
|
39
|
-
background-color: ${({ theme }) => theme.colors.button.default};
|
|
40
|
-
color: ${({ theme }) => theme.colors.text.default};
|
|
41
|
-
svg {
|
|
42
|
-
font-size: 1.6rem;
|
|
43
|
-
margin-right: 0.3rem;
|
|
44
|
-
}
|
|
45
|
-
&:hover {
|
|
46
|
-
opacity: 0.8;
|
|
47
|
-
}
|
|
48
|
-
.emphasis {
|
|
49
|
-
text-transform: uppercase;
|
|
50
|
-
}
|
|
51
|
-
.circular {
|
|
52
|
-
width: 1rem !important;
|
|
53
|
-
height: 1rem !important;
|
|
54
|
-
color: ${({ theme }) => theme.colors.text.default};
|
|
55
|
-
svg {
|
|
56
|
-
margin-right: 0;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
&:disabled {
|
|
60
|
-
opacity: 0.7;
|
|
61
|
-
}
|
|
62
|
-
`
|