@mobilestockweb/button 1.0.6 → 1.0.7
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/index.js +7 -7
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var at=Object.create;var h=Object.defineProperty,st=Object.defineProperties,ct=Object.getOwnPropertyDescriptor,lt=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertyNames,
|
|
1
|
+
"use strict";var at=Object.create;var h=Object.defineProperty,st=Object.defineProperties,ct=Object.getOwnPropertyDescriptor,lt=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertyNames,y=Object.getOwnPropertySymbols,ut=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var F=(t,e,o)=>e in t?h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,U=(t,e)=>{for(var o in e||(e={}))$.call(e,o)&&F(t,o,e[o]);if(y)for(var o of y(e))X.call(e,o)&&F(t,o,e[o]);return t},V=(t,e)=>st(t,lt(e));var O=(t,e)=>{var o={};for(var i in t)$.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&y)for(var i of y(t))e.indexOf(i)<0&&X.call(t,i)&&(o[i]=t[i]);return o};var ft=(t,e)=>{for(var o in e)h(t,o,{get:e[o],enumerable:!0})},W=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of dt(e))!$.call(t,s)&&s!==o&&h(t,s,{get:()=>e[s],enumerable:!(i=ct(e,s))||i.enumerable});return t};var p=(t,e,o)=>(o=t!=null?at(ut(t)):{},W(e||!t||!t.__esModule?h(o,"default",{value:t,enumerable:!0}):o,t)),pt=t=>W(h({},"__esModule",{value:!0}),t);var yt={};ft(yt,{Button:()=>tt});module.exports=pt(yt);var b=p(require("react")),d=p(require("styled-components")),Y=require("@mobilestockweb/clickable"),T=require("@mobilestockweb/container"),q=p(require("@mobilestockweb/tools")),Q=require("@mobilestockweb/typography");var C=p(require("chroma-js")),n=require("styled-components"),A=p(require("@mobilestockweb/tools"));function E(t,e){let o=t.split("_"),i=500;if(o.length>1)switch(o[1]){case"LIGHT":i=400;break;case"DARK":i=600;break}return A.default.getColorWithLuminosity(e.colors.button[o[0].toLowerCase()],i)}function H(t,e,o){let i=E(e,o);switch(t){case"DEFAULT":return n.css`
|
|
2
2
|
background-color: ${(0,C.default)(i).shade(.5).css()};
|
|
3
3
|
`;case"OUTLINE":return n.css`
|
|
4
4
|
border: 2px solid ${(0,C.default)(i).shade(.5).css()};
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
`}}function j(t,e,o){let i=3;e&&(i=4);let a={XS:{padding:"0.25rem 0.75rem",borderRadius:`${parseFloat(o.borderRadius.default)+1}px`},SM:{padding:"0.5rem 1rem",borderRadius:`${parseFloat(o.borderRadius.default)+1}px`},MD:{padding:"0.75rem 1.25rem",borderRadius:`${parseFloat(o.borderRadius.default)+3}px`},LG:{padding:"1rem 1.75rem",borderRadius:`${parseFloat(o.borderRadius.default)+3}px`},XL:{padding:"1.25rem 2.25rem",borderRadius:`${parseFloat(o.borderRadius.default)+5}px`},"2XL":{padding:"1.5rem 2.75rem",borderRadius:`${parseFloat(o.borderRadius.default)+7}px`},"3XL":{padding:"1.75rem 3.25rem",borderRadius:`${parseFloat(o.borderRadius.default)+9}px`}}[t],x=n.css`
|
|
50
50
|
padding: ${e?"0":a.padding};
|
|
51
51
|
border-radius: ${e?o.borderRadius.rounded:a.borderRadius};
|
|
52
|
-
`;if(e){let
|
|
52
|
+
`;if(e){let R=`${i*parseFloat(o.spacing[t.toLowerCase()])}rem`;return n.css`
|
|
53
53
|
${x}
|
|
54
|
-
width: ${
|
|
55
|
-
min-height: ${
|
|
54
|
+
width: ${R};
|
|
55
|
+
min-height: ${R};
|
|
56
56
|
`}return x}var S=require("@mobilestockweb/icons");var g=p(require("styled-components")),G=p(require("@mobilestockweb/tools")),J=require("@mobilestockweb/typography"),P=require("react/jsx-runtime");function m(t){return(0,P.jsx)(mt,{$position:t.notificationPosition,$size:t.size,children:(0,P.jsx)(Tt,{size:t.size,weight:"BOLD",children:t.notification>99?"99+":t.notification})})}var gt={XS:{top:"-10px",right:"-10px"},SM:{top:"-12px",right:"-11px"},MD:{top:"-13px",right:"-12px"},LG:{top:"-15px",right:"-10px"},XL:{top:"-20px",right:"-15px"},"2XL":{top:"-20px",right:"-15px"},"3XL":{top:"-25px",right:"-13px"}},mt=g.default.div`
|
|
57
57
|
position: absolute;
|
|
58
58
|
background-color: ${({theme:t})=>t.colors.alert.urgent};
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
`}}
|
|
68
68
|
`,Tt=(0,g.default)(J.Typography)`
|
|
69
69
|
color: ${({theme:t})=>G.default.defineTextColor(t.colors.alert.urgent)} !important;
|
|
70
|
-
`;var c=require("react/jsx-runtime");function L(t){let e=t.notification&&t.notificationPosition==="ICON";return t.icon?e?(0,c.jsxs)(
|
|
70
|
+
`;var c=require("react/jsx-runtime");function L(t){let e=t.notification&&t.notificationPosition==="ICON";return t.icon?e?(0,c.jsxs)(N,{children:[(0,c.jsx)(S.Icon,{name:t.icon,size:t.size}),(0,c.jsx)(m,{notification:t.notification,notificationPosition:t.notificationPosition,size:t.size})]}):(0,c.jsx)(S.Icon,{name:t.icon,size:t.size}):(0,c.jsx)(c.Fragment,{})}var I=require("@mobilestockweb/typography");var l=require("react/jsx-runtime");function z(t){return t.text?t.notification&&t.notificationPosition==="TEXT"?(0,l.jsxs)(N,{children:[(0,l.jsx)(I.Typography,{align:"CENTER",weight:t.fontWeight,size:t.size,withUnderline:t.withUnderline,children:t.text}),(0,l.jsx)(m,{notification:t.notification,notificationPosition:t.notificationPosition,size:t.size})]}):(0,l.jsx)(I.Typography,{align:"CENTER",weight:t.fontWeight,size:t.size,withUnderline:t.withUnderline,children:t.text}):(0,l.jsx)(l.Fragment,{})}var r=require("react/jsx-runtime"),Z=[{name:"div",component:"div"},{name:"Container",component:T.Container},{name:"Container.Vertical",component:T.Container.Vertical},{name:"Container.Horizontal",component:T.Container.Horizontal},{name:"Typography",component:Q.Typography}],xt=Z.map(t=>t.component),tt=b.default.memo(function(Nt){var v=Nt,{variant:e="DEFAULT",size:o="MD",iconAlign:i="BEFORE-TEXT",backgroundColor:s="DEFAULT",notificationPosition:a="ICON",fontWeight:x="REGULAR",textAlign:R="CENTER",circular:D=!1,notification:u,text:f,isLoading:k,icon:w,disabled:ot,padding:et}=v,it=O(v,["variant","size","iconAlign","backgroundColor","notificationPosition","fontWeight","textAlign","circular","notification","text","isLoading","icon","disabled","padding"]);let nt=(0,b.useRef)(null);if(typeof f!="string"&&f&&!q.default.validateJSXTree(f,xt))throw new Error(`Invalid jsx text props. Expected one of ${Z.map(rt=>rt.name).join(", ")}, but received: ${f.type.target||f.type}`);return(0,r.jsx)(ht,V(U({},it),{ref:nt,isLoading:k,disabled:ot||k,size:o,$backgroundColor:s,$variant:e,$circular:D,children:(0,r.jsxs)(Ct,{padding:et,gap:o,align:"CENTER",$textAlign:R,$iconAlign:i,children:[i!=="START"&&i!=="END"?(0,r.jsxs)(Et,{gap:i==="ABOVE-TEXT"?"NONE":o,align:"CENTER",$iconAlign:i,children:[(0,r.jsx)(L,{icon:w,size:o,notification:u,notificationPosition:a}),(0,r.jsx)(z,{text:f,fontWeight:x,size:o,withUnderline:e==="LINK",notification:u,notificationPosition:a})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L,{icon:w,size:o,notification:u,notificationPosition:a}),(0,r.jsx)(z,{text:f,fontWeight:x,size:o,withUnderline:e==="LINK",notification:u,notificationPosition:a})]}),!!u&&a==="END"&&(0,r.jsx)(m,{notification:u,notificationPosition:a,size:o}),!u&&(i==="START"||i==="END")&&!D&&(0,r.jsx)(Rt,{})]})}))}),ht=(0,d.default)(Y.Clickable)`
|
|
71
71
|
flex: 1;
|
|
72
72
|
user-select: none;
|
|
73
73
|
${({$variant:t,$backgroundColor:e,theme:o})=>_(t,e,o)}
|
|
@@ -92,10 +92,10 @@
|
|
|
92
92
|
`,Ct=(0,d.default)(T.Container)`
|
|
93
93
|
${({$textAlign:t})=>K(t)};
|
|
94
94
|
${({$iconAlign:t})=>t==="START"||t==="END"?B(t):""};
|
|
95
|
-
`,
|
|
95
|
+
`,N=d.default.div`
|
|
96
96
|
position: relative;
|
|
97
97
|
display: inline-flex;
|
|
98
98
|
align-items: center;
|
|
99
99
|
`,Et=(0,d.default)(T.Container)`
|
|
100
100
|
${({$iconAlign:t})=>B(t)};
|
|
101
|
-
`,
|
|
101
|
+
`,Rt=d.default.div``;0&&(module.exports={Button});
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobilestockweb/button",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"chroma-js": "^3.1.2",
|
|
7
|
-
"@mobilestockweb/container": "^0.0.3",
|
|
8
7
|
"@mobilestockweb/clickable": "^1.0.4",
|
|
8
|
+
"@mobilestockweb/container": "^0.0.3",
|
|
9
9
|
"@mobilestockweb/icons": "^0.0.6",
|
|
10
10
|
"@mobilestockweb/typography": "^0.0.6",
|
|
11
11
|
"@mobilestockweb/tools": "^0.0.16"
|