@mozaic-ds/web-components 0.29.1 → 0.30.0-beta.0
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/package.json +1 -1
- package/public/adeo/components/button/Button.js +1 -1
- package/public/adeo/components/button/Button.js.map +1 -1
- package/public/adeo/components/button/Button.svelte +46 -22
- package/public/adeo/components/fileuploader/FileUploader.js +1 -1
- package/public/adeo/components/fileuploader/FileUploader.js.map +1 -1
- package/public/adeo/components/fileuploader/FileUploader.svelte +9 -5
- package/public/adeo/components/menu/Menu.js +1 -1
- package/public/adeo/components/menu/Menu.js.map +1 -1
- package/public/adeo/components/menu/Menu.svelte +17 -6
- package/public/adeo/components/menu/menu.types.d.ts +1 -0
- package/public/adeo/components/menu/menu.types.d.ts.map +1 -1
- package/public/adeo/utilities/components/menu/menu.types.d.ts +1 -0
- package/public/adeo/utilities/components/menu/menu.types.d.ts.map +1 -1
- package/public/adeo/utilities/stories/button/Button.stories.d.ts +1 -0
- package/public/adeo/utilities/stories/button/Button.stories.d.ts.map +1 -1
- package/public/bricoman/components/button/Button.js +1 -1
- package/public/bricoman/components/button/Button.js.map +1 -1
- package/public/bricoman/components/button/Button.svelte +46 -22
- package/public/bricoman/components/fileuploader/FileUploader.js +1 -1
- package/public/bricoman/components/fileuploader/FileUploader.js.map +1 -1
- package/public/bricoman/components/fileuploader/FileUploader.svelte +9 -5
- package/public/bricoman/components/menu/Menu.js +1 -1
- package/public/bricoman/components/menu/Menu.js.map +1 -1
- package/public/bricoman/components/menu/Menu.svelte +17 -6
- package/public/bricoman/components/menu/menu.types.d.ts +1 -0
- package/public/bricoman/components/menu/menu.types.d.ts.map +1 -1
- package/public/bricoman/utilities/components/menu/menu.types.d.ts +1 -0
- package/public/bricoman/utilities/components/menu/menu.types.d.ts.map +1 -1
- package/public/bricoman/utilities/stories/button/Button.stories.d.ts +1 -0
- package/public/bricoman/utilities/stories/button/Button.stories.d.ts.map +1 -1
- package/public/components/button/Button.js +1 -1
- package/public/components/button/Button.js.map +1 -1
- package/public/components/button/Button.svelte +46 -22
- package/public/components/fileuploader/FileUploader.js +1 -1
- package/public/components/fileuploader/FileUploader.js.map +1 -1
- package/public/components/fileuploader/FileUploader.svelte +9 -5
- package/public/components/menu/Menu.js +1 -1
- package/public/components/menu/Menu.js.map +1 -1
- package/public/components/menu/Menu.svelte +17 -6
- package/public/components/menu/menu.types.d.ts +1 -0
- package/public/components/menu/menu.types.d.ts.map +1 -1
- package/public/utilities/components/menu/menu.types.d.ts +1 -0
- package/public/utilities/components/menu/menu.types.d.ts.map +1 -1
- package/public/utilities/stories/button/Button.stories.d.ts +1 -0
- package/public/utilities/stories/button/Button.stories.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S as t,i as o,a as e,g as i,b as n,f as r,s as m,c,e as l,d,n as a,j as s,t as b,k as u,N as h,B as f,z as g,A as p,l as x,m as w,o as _,p as $,q as y,u as v,h as k,C as z,T as j,E as q,F as C,G as E,v as N,y as R,a4 as A}from"../../index-c222d0b7.js";import{c as F}from"../../EventForward-c4c8cd29.js";import O from"../loader/Loader.nested.js";function S(t){let o,e,i,r;const m=[J,G,B],c=[];function d(t,o){return t[13]&&"left"===t[12]?0:t[16].icon?1:t[5]?2:-1}return~(e=d(t))&&(i=c[e]=m[e](t)),{c(){o=l("span"),i&&i.c(),k(o,"class","mc-button__icon")},m(t,i){n(t,o,i),~e&&c[e].m(o,null),r=!0},p(t,n){let r=e;e=d(t),e===r?~e&&c[e].p(t,n):(i&&(z(),g(c[r],1,1,(()=>{c[r]=null})),p()),~e?(i=c[e],i?i.p(t,n):(i=c[e]=m[e](t),i.c()),f(i,1),i.m(o,null)):i=null)},i(t){r||(f(i),r=!0)},o(t){g(i),r=!1},d(t){t&&w(o),~e&&c[e].d()}}}function B(t){let o,e,i=`<${X(t[2],t[6],t[5])} />`;return{c(){o=new A(!1),e=j(),o.a=e},m(t,r){o.m(i,t,r),n(t,e,r)},p(t,e){100&e&&i!==(i=`<${X(t[2],t[6],t[5])} />`)&&o.p(i)},i:a,o:a,d(t){t&&w(e),t&&o.d()}}}function G(t){let o;return{c(){o=l("slot"),k(o,"name","icon")},m(t,e){n(t,o,e)},p:a,i:a,o:a,d(t){t&&w(o)}}}function J(t){let o,e;return o=new O({props:{size:"s",theme:t[11],text:""}}),{c(){q(o.$$.fragment)},m(t,i){C(o,t,i),e=!0},p(t,e){const i={};2048&e&&(i.theme=t[11]),o.$set(i)},i(t){e||(f(o.$$.fragment,t),e=!0)},o(t){g(o.$$.fragment,t),e=!1},d(t){E(o,t)}}}function L(t){let o,e,i,r,m,c,a=t[13]&&"left"===t[12]&&!t[5]&&!t[16].icon&&D(t),s=t[13]&&"right"===t[12]&&!t[5]&&!t[16].icon&&H(t);return{c(){a&&a.c(),o=d(),e=l("span"),i=N(t[4]),r=d(),s&&s.c(),m=j(),k(e,"class","mc-button__label")},m(t,l){a&&a.m(t,l),n(t,o,l),n(t,e,l),u(e,i),n(t,r,l),s&&s.m(t,l),n(t,m,l),c=!0},p(t,e){!t[13]||"left"!==t[12]||t[5]||t[16].icon?a&&(z(),g(a,1,1,(()=>{a=null})),p()):a?(a.p(t,e),77856&e&&f(a,1)):(a=D(t),a.c(),f(a,1),a.m(o.parentNode,o)),(!c||16&e)&&R(i,t[4]),!t[13]||"right"!==t[12]||t[5]||t[16].icon?s&&(z(),g(s,1,1,(()=>{s=null})),p()):s?(s.p(t,e),77856&e&&f(s,1)):(s=H(t),s.c(),f(s,1),s.m(m.parentNode,m))},i(t){c||(f(a),f(s),c=!0)},o(t){g(a),g(s),c=!1},d(t){a&&a.d(t),t&&w(o),t&&w(e),t&&w(r),s&&s.d(t),t&&w(m)}}}function T(t){let o,e,i,r;const m=[M,K,I],c=[];function d(t,o){return t[13]?0:t[16].icon?1:t[5]?2:-1}return~(e=d(t))&&(i=c[e]=m[e](t)),{c(){o=l("span"),i&&i.c(),k(o,"class","mc-button__icon")},m(t,i){n(t,o,i),~e&&c[e].m(o,null),r=!0},p(t,n){let r=e;e=d(t),e===r?~e&&c[e].p(t,n):(i&&(z(),g(c[r],1,1,(()=>{c[r]=null})),p()),~e?(i=c[e],i?i.p(t,n):(i=c[e]=m[e](t),i.c()),f(i,1),i.m(o,null)):i=null)},i(t){r||(f(i),r=!0)},o(t){g(i),r=!1},d(t){t&&w(o),~e&&c[e].d()}}}function D(t){let o,e,i;return e=new O({props:{size:"s",theme:t[11],text:""}}),{c(){o=l("span"),q(e.$$.fragment),k(o,"class","mc-button__icon")},m(t,r){n(t,o,r),C(e,o,null),i=!0},p(t,o){const i={};2048&o&&(i.theme=t[11]),e.$set(i)},i(t){i||(f(e.$$.fragment,t),i=!0)},o(t){g(e.$$.fragment,t),i=!1},d(t){t&&w(o),E(e)}}}function H(t){let o,e,i;return e=new O({props:{size:"s",theme:t[11],text:""}}),{c(){o=l("span"),q(e.$$.fragment),k(o,"class","mc-button__icon")},m(t,r){n(t,o,r),C(e,o,null),i=!0},p(t,o){const i={};2048&o&&(i.theme=t[11]),e.$set(i)},i(t){i||(f(e.$$.fragment,t),i=!0)},o(t){g(e.$$.fragment,t),i=!1},d(t){t&&w(o),E(e)}}}function I(t){let o,e,i=`<${X(t[2],t[6],t[5])} />`;return{c(){o=new A(!1),e=j(),o.a=e},m(t,r){o.m(i,t,r),n(t,e,r)},p(t,e){100&e&&i!==(i=`<${X(t[2],t[6],t[5])} />`)&&o.p(i)},i:a,o:a,d(t){t&&w(e),t&&o.d()}}}function K(t){let o;return{c(){o=l("slot"),k(o,"name","icon")},m(t,e){n(t,o,e)},p:a,i:a,o:a,d(t){t&&w(o)}}}function M(t){let o,e;return o=new O({props:{size:"m",theme:t[11],text:""}}),{c(){q(o.$$.fragment)},m(t,i){C(o,t,i),e=!0},p(t,e){const i={};2048&e&&(i.theme=t[11]),o.$set(i)},i(t){e||(f(o.$$.fragment,t),e=!0)},o(t){g(o.$$.fragment,t),e=!1},d(t){E(o,t)}}}function P(t){let o,e,i,r;const m=[V,U,Q],c=[];function d(t,o){return t[13]&&"right"===t[12]?0:t[16].icon?1:t[5]?2:-1}return~(e=d(t))&&(i=c[e]=m[e](t)),{c(){o=l("span"),i&&i.c(),k(o,"class","mc-button__icon")},m(t,i){n(t,o,i),~e&&c[e].m(o,null),r=!0},p(t,n){let r=e;e=d(t),e===r?~e&&c[e].p(t,n):(i&&(z(),g(c[r],1,1,(()=>{c[r]=null})),p()),~e?(i=c[e],i?i.p(t,n):(i=c[e]=m[e](t),i.c()),f(i,1),i.m(o,null)):i=null)},i(t){r||(f(i),r=!0)},o(t){g(i),r=!1},d(t){t&&w(o),~e&&c[e].d()}}}function Q(t){let o,e,i=`<${X(t[2],t[6],t[5])} />`;return{c(){o=new A(!1),e=j(),o.a=e},m(t,r){o.m(i,t,r),n(t,e,r)},p(t,e){100&e&&i!==(i=`<${X(t[2],t[6],t[5])} />`)&&o.p(i)},i:a,o:a,d(t){t&&w(e),t&&o.d()}}}function U(t){let o;return{c(){o=l("slot"),k(o,"name","icon")},m(t,e){n(t,o,e)},p:a,i:a,o:a,d(t){t&&w(o)}}}function V(t){let o,e;return o=new O({props:{size:"s",theme:t[11],text:""}}),{c(){q(o.$$.fragment)},m(t,i){C(o,t,i),e=!0},p(t,e){const i={};2048&e&&(i.theme=t[11]),o.$set(i)},i(t){e||(f(o.$$.fragment,t),e=!0)},o(t){g(o.$$.fragment,t),e=!1},d(t){E(o,t)}}}function W(t){let o,e,i,r,m,_,$,y,v,k=(t[5]||t[16].icon)&&"left"===t[6]&&S(t);const j=[T,L],q=[];function C(t,o){return(t[5]||t[16].icon)&&"only"===t[6]?0:1}i=C(t),r=q[i]=j[i](t);let E=(t[5]||t[16].icon)&&"right"===t[6]&&P(t),N=[{type:t[8]},{class:_=t[15](t[1],t[0],t[2],t[3])+" "+t[10]},{disabled:t[7]},t[9]],R={};for(let t=0;t<N.length;t+=1)R=c(R,N[t]);return{c(){o=l("button"),k&&k.c(),e=d(),r.c(),m=d(),E&&E.c(),this.c=a,s(o,R),b(o,"mc-button--square","only"==t[6])},m(r,c){n(r,o,c),k&&k.m(o,null),u(o,e),q[i].m(o,null),u(o,m),E&&E.m(o,null),o.autofocus&&o.focus(),$=!0,y||(v=h(t[14].call(null,o)),y=!0)},p(t,[n]){(t[5]||t[16].icon)&&"left"===t[6]?k?(k.p(t,n),65632&n&&f(k,1)):(k=S(t),k.c(),f(k,1),k.m(o,e)):k&&(z(),g(k,1,1,(()=>{k=null})),p());let c=i;i=C(t),i===c?q[i].p(t,n):(z(),g(q[c],1,1,(()=>{q[c]=null})),p(),r=q[i],r?r.p(t,n):(r=q[i]=j[i](t),r.c()),f(r,1),r.m(o,m)),(t[5]||t[16].icon)&&"right"===t[6]?E?(E.p(t,n),65632&n&&f(E,1)):(E=P(t),E.c(),f(E,1),E.m(o,null)):E&&(z(),g(E,1,1,(()=>{E=null})),p()),s(o,R=x(N,[(!$||256&n)&&{type:t[8]},(!$||1039&n&&_!==(_=t[15](t[1],t[0],t[2],t[3])+" "+t[10]))&&{class:_},(!$||128&n)&&{disabled:t[7]},512&n&&t[9]])),b(o,"mc-button--square","only"==t[6])},i(t){$||(f(k),f(r),f(E),$=!0)},o(t){g(k),g(r),g(E),$=!1},d(t){t&&w(o),k&&k.d(),q[i].d(),E&&E.d(),y=!1,v()}}}function X(t,o,e){const i="only"===o;let n;switch(t){case"s":n="24px";break;case"m":n=i?"32px":"24px";break;case"l":n=i?"100%":"32px"}return`${e} size="${n}" class="no"`}function Y(t,o,e){let i,n,r,m,l,d;const a=["bordered","theme","size","full","label","iconname","iconmode","disabled","responsivesize","responsivewidth","type","loader"];let s=_(o,a),{$$slots:b={},$$scope:u}=o;const h=$(b);var f,g,p;let{bordered:x=!1}=o,{theme:w}=o,{size:k="m"}=o,{full:z=!1}=o,{label:j}=o,{iconname:q}=o,{iconmode:C}=o,{disabled:E=!1}=o,{responsivesize:N}=o,{responsivewidth:R}=o,{type:A="button"}=o,{loader:O}=o;const S=F(y());return t.$$set=t=>{e(25,o=c(c({},o),v(t))),e(24,s=_(o,a)),"bordered"in t&&e(0,x=t.bordered),"theme"in t&&e(1,w=t.theme),"size"in t&&e(2,k=t.size),"full"in t&&e(3,z=t.full),"label"in t&&e(4,j=t.label),"iconname"in t&&e(5,q=t.iconname),"iconmode"in t&&e(6,C=t.iconmode),"disabled"in t&&e(7,E=t.disabled),"responsivesize"in t&&e(17,N=t.responsivesize),"responsivewidth"in t&&e(18,R=t.responsivewidth),"type"in t&&e(8,A=t.type),"loader"in t&&e(19,O=t.loader)},t.$$.update=()=>{524288&t.$$.dirty&&e(23,i=O?JSON.parse(O):void 0),9437184&t.$$.dirty&&e(13,n=null!==e(20,f=null==i?void 0:i.enabled)&&void 0!==f&&f),10485760&t.$$.dirty&&e(12,r=null!==e(21,g=null==i?void 0:i.position)&&void 0!==g?g:"left"),12582912&t.$$.dirty&&e(11,m=null!==e(22,p=null==i?void 0:i.theme)&&void 0!==p?p:"primary"),e(10,l=o.class),e(9,d=Object.assign({},s)),512&t.$$.dirty&&delete d.class},o=v(o),[x,w,k,z,j,q,C,E,A,d,l,m,r,n,S,function(t,o,e,i){const n=["mc-button"],r=function(t,o){if(!o&&!t)return"";const e=o?"bordered":"solid";return t?`mc-button--${e}-${t}`:`mc-button--${e}`}(t,o);return r&&n.push(r),e&&n.push(`mc-button--${e}`),i?n.push("mc-button--full"):n.push("mc-button--fit"),"only"===C&&n.push("mc-button--square"),N&&n.push(`mc-button--${N}`),R&&n.push(`mc-button--${R}`),n.join(" ")},h,N,R,O,f,g,p,i]}class Z extends t{constructor(t){super();const c=document.createElement("style");c.textContent='.mc-button{margin:0;-webkit-box-shadow:none;box-shadow:none;text-decoration:none;outline:none;border:none;cursor:pointer;padding:0;color:#ffffff;background-color:#007f8c;font-family:"Roboto", sans-serif;font-weight:700;font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem;cursor:pointer;border-radius:4px;text-align:center;border:2px solid transparent;-webkit-transition:all ease 200ms;transition:all ease 200ms;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;vertical-align:middle;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;-webkit-box-sizing:border-box;box-sizing:border-box;fill:currentColor}.mc-button.is-hover,.mc-button:hover{background-color:#006974;color:#ffffff}.mc-button.is-active,.mc-button:active{background-color:#006974}.mc-button:disabled,.mc-button.is-disabled,.mc-button[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button .mc-button__icon:first-child,.mc-button .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button.is-focus,.mc-button:focus{-webkit-box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #758992;box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #758992}.mc-button--s{font-size:0.875rem;line-height:1.2857142857;padding:0.3125rem 1rem;min-height:2rem;min-width:2rem}.mc-button--s .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--s .mc-button__icon:first-child,.mc-button--s .mc-button__icon:last-child{margin-bottom:-0.1875rem;margin-top:-0.1875rem}.mc-button--s .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:1.5rem;height:1.5rem}.mc-button--m{font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem}.mc-button--m .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--m .mc-button__icon:first-child,.mc-button--m .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button--m .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--l{font-size:1.125rem;line-height:1.3333333333;padding:0.875rem 1.5rem;min-height:3.5rem;min-width:3.5rem}.mc-button--l .mc-button__icon{width:2rem;height:2rem}.mc-button--l .mc-button__icon:first-child,.mc-button--l .mc-button__icon:last-child{margin-bottom:-0.25rem;margin-top:-0.25rem}.mc-button--l .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--fit{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:auto}.mc-button--full{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}@supports (width: -webkit-fill-available) or (width: -moz-available) or (width: stretch){.mc-button--full{width:-webkit-fill-available;width:-moz-available;width:stretch}}.mc-button--square{-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:0;padding:0}.mc-button__icon{-ms-flex-negative:0;flex-shrink:0}.mc-button__icon:last-child{margin-left:0.5rem;margin-right:-0.25rem}.mc-button__icon:first-child{margin-right:0.5rem;margin-left:-0.25rem}.mc-button__icon:only-child{margin:0}.mc-button__label{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;pointer-events:none}.mc-button--solid-primary-02{background-color:#6a7081}.mc-button--solid-primary-02.is-hover,.mc-button--solid-primary-02:hover{background-color:#242938}.mc-button--solid-primary-02.is-active,.mc-button--solid-primary-02:active{background-color:#171b26}.mc-button--solid-primary-02:disabled,.mc-button--solid-primary-02.is-disabled,.mc-button--solid-primary-02[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--solid-neutral{background-color:#333333}.mc-button--solid-neutral.is-hover,.mc-button--solid-neutral:hover{background-color:#191919}.mc-button--solid-neutral.is-active,.mc-button--solid-neutral:active{background-color:#333333}.mc-button--solid-neutral:disabled,.mc-button--solid-neutral.is-disabled,.mc-button--solid-neutral[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--solid-danger{background-color:#c61112}.mc-button--solid-danger.is-hover,.mc-button--solid-danger:hover{background-color:#8c0003}.mc-button--solid-danger.is-active,.mc-button--solid-danger:active{background-color:#8c0003}.mc-button--solid-danger:disabled,.mc-button--solid-danger.is-disabled,.mc-button--solid-danger[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--bordered{color:#007f8c;border-color:#007f8c;background-color:#ffffff}.mc-button--bordered.is-hover,.mc-button--bordered:hover{background-color:#d9f0f3;color:#006974}.mc-button--bordered.is-active,.mc-button--bordered:active{background-color:#91d5db;color:#004e57}.mc-button--bordered.is-active,.mc-button--bordered:active{background-color:#91d5db;color:#004e57}.mc-button--bordered:disabled,.mc-button--bordered.is-disabled,.mc-button--bordered[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--bordered-primary-02{color:#6a7081;border-color:#6a7081;background-color:#ffffff}.mc-button--bordered-primary-02.is-hover,.mc-button--bordered-primary-02:hover{background-color:#eeeff1;color:#6a7081}.mc-button--bordered-primary-02.is-active,.mc-button--bordered-primary-02:active{background-color:#cfd2d8}.mc-button--bordered-primary-02:disabled,.mc-button--bordered-primary-02.is-disabled,.mc-button--bordered-primary-02[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--bordered-neutral{color:#333333;border-color:#333333;background-color:#ffffff}.mc-button--bordered-neutral.is-hover,.mc-button--bordered-neutral:hover{background-color:#e6e6e6;color:#333333}.mc-button--bordered-neutral.is-active,.mc-button--bordered-neutral:active{background-color:#cccccc}.mc-button--bordered-neutral:disabled,.mc-button--bordered-neutral.is-disabled,.mc-button--bordered-neutral[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--bordered-danger{color:#c61112;border-color:#c61112;background-color:#ffffff}.mc-button--bordered-danger.is-hover,.mc-button--bordered-danger:hover{background-color:#fdeaea;color:#8c0003}.mc-button--bordered-danger.is-active,.mc-button--bordered-danger:active{background-color:#f8bcbb;color:#530000}.mc-button--bordered-danger.is-active,.mc-button--bordered-danger:active{background-color:#f8bcbb;color:#530000}.mc-button--bordered-danger:disabled,.mc-button--bordered-danger.is-disabled,.mc-button--bordered-danger[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}@media screen and (min-width: 680px){.mc-button--s\\@from-m{font-size:0.875rem;line-height:1.2857142857;padding:0.3125rem 1rem;min-height:2rem;min-width:2rem}.mc-button--s\\@from-m .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--s\\@from-m .mc-button__icon:first-child,.mc-button--s\\@from-m .mc-button__icon:last-child{margin-bottom:-0.1875rem;margin-top:-0.1875rem}.mc-button--s\\@from-m .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:1.5rem;height:1.5rem}.mc-button--m\\@from-m{font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem}.mc-button--m\\@from-m .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--m\\@from-m .mc-button__icon:first-child,.mc-button--m\\@from-m .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button--m\\@from-m .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--l\\@from-m{font-size:1.125rem;line-height:1.3333333333;padding:0.875rem 1.5rem;min-height:3.5rem;min-width:3.5rem}.mc-button--l\\@from-m .mc-button__icon{width:2rem;height:2rem}.mc-button--l\\@from-m .mc-button__icon:first-child,.mc-button--l\\@from-m .mc-button__icon:last-child{margin-bottom:-0.25rem;margin-top:-0.25rem}.mc-button--l\\@from-m .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--fit\\@from-m{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:auto}.mc-button--full\\@from-m{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}@supports (width: -webkit-fill-available) or (width: -moz-available) or (width: stretch){.mc-button--full\\@from-m{width:-webkit-fill-available;width:-moz-available;width:stretch}}}@media screen and (min-width: 1024px){.mc-button--s\\@from-l{font-size:0.875rem;line-height:1.2857142857;padding:0.3125rem 1rem;min-height:2rem;min-width:2rem}.mc-button--s\\@from-l .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--s\\@from-l .mc-button__icon:first-child,.mc-button--s\\@from-l .mc-button__icon:last-child{margin-bottom:-0.1875rem;margin-top:-0.1875rem}.mc-button--s\\@from-l .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:1.5rem;height:1.5rem}.mc-button--m\\@from-l{font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem}.mc-button--m\\@from-l .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--m\\@from-l .mc-button__icon:first-child,.mc-button--m\\@from-l .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button--m\\@from-l .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--l\\@from-l{font-size:1.125rem;line-height:1.3333333333;padding:0.875rem 1.5rem;min-height:3.5rem;min-width:3.5rem}.mc-button--l\\@from-l .mc-button__icon{width:2rem;height:2rem}.mc-button--l\\@from-l .mc-button__icon:first-child,.mc-button--l\\@from-l .mc-button__icon:last-child{margin-bottom:-0.25rem;margin-top:-0.25rem}.mc-button--l\\@from-l .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--fit\\@from-l{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:auto}.mc-button--full\\@from-l{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}@supports (width: -webkit-fill-available) or (width: -moz-available) or (width: stretch){.mc-button--full\\@from-l{width:-webkit-fill-available;width:-moz-available;width:stretch}}.mc-button--square{padding:0}}@media screen and (min-width: 1280px){.mc-button--s\\@from-xl{font-size:0.875rem;line-height:1.2857142857;padding:0.3125rem 1rem;min-height:2rem;min-width:2rem}.mc-button--s\\@from-xl .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--s\\@from-xl .mc-button__icon:first-child,.mc-button--s\\@from-xl .mc-button__icon:last-child{margin-bottom:-0.1875rem;margin-top:-0.1875rem}.mc-button--s\\@from-xl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:1.5rem;height:1.5rem}.mc-button--m\\@from-xl{font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem}.mc-button--m\\@from-xl .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--m\\@from-xl .mc-button__icon:first-child,.mc-button--m\\@from-xl .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button--m\\@from-xl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--l\\@from-xl{font-size:1.125rem;line-height:1.3333333333;padding:0.875rem 1.5rem;min-height:3.5rem;min-width:3.5rem}.mc-button--l\\@from-xl .mc-button__icon{width:2rem;height:2rem}.mc-button--l\\@from-xl .mc-button__icon:first-child,.mc-button--l\\@from-xl .mc-button__icon:last-child{margin-bottom:-0.25rem;margin-top:-0.25rem}.mc-button--l\\@from-xl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--fit\\@from-xl{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:auto}.mc-button--full\\@from-xl{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}@supports (width: -webkit-fill-available) or (width: -moz-available) or (width: stretch){.mc-button--full\\@from-xl{width:-webkit-fill-available;width:-moz-available;width:stretch}}}@media screen and (min-width: 1920px){.mc-button--s\\@from-xxl{font-size:0.875rem;line-height:1.2857142857;padding:0.3125rem 1rem;min-height:2rem;min-width:2rem}.mc-button--s\\@from-xxl .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--s\\@from-xxl .mc-button__icon:first-child,.mc-button--s\\@from-xxl .mc-button__icon:last-child{margin-bottom:-0.1875rem;margin-top:-0.1875rem}.mc-button--s\\@from-xxl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:1.5rem;height:1.5rem}.mc-button--m\\@from-xxl{font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem}.mc-button--m\\@from-xxl .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--m\\@from-xxl .mc-button__icon:first-child,.mc-button--m\\@from-xxl .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button--m\\@from-xxl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--l\\@from-xxl{font-size:1.125rem;line-height:1.3333333333;padding:0.875rem 1.5rem;min-height:3.5rem;min-width:3.5rem}.mc-button--l\\@from-xxl .mc-button__icon{width:2rem;height:2rem}.mc-button--l\\@from-xxl .mc-button__icon:first-child,.mc-button--l\\@from-xxl .mc-button__icon:last-child{margin-bottom:-0.25rem;margin-top:-0.25rem}.mc-button--l\\@from-xxl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--fit\\@from-xxl{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:auto}.mc-button--full\\@from-xxl{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}@supports (width: -webkit-fill-available) or (width: -moz-available) or (width: stretch){.mc-button--full\\@from-xxl{width:-webkit-fill-available;width:-moz-available;width:stretch}}}.mc-button__icon{pointer-events:none}',this.shadowRoot.appendChild(c),o(this,{target:this.shadowRoot,props:{...e(this.attributes),$$slots:i(this)},customElement:!0},Y,W,m,{bordered:0,theme:1,size:2,full:3,label:4,iconname:5,iconmode:6,disabled:7,responsivesize:17,responsivewidth:18,type:8,loader:19},null),t&&(t.target&&n(t.target,this,t.anchor),t.props&&(this.$set(t.props),r()))}static get observedAttributes(){return["bordered","theme","size","full","label","iconname","iconmode","disabled","responsivesize","responsivewidth","type","loader"]}get bordered(){return this.$$.ctx[0]}set bordered(t){this.$$set({bordered:t}),r()}get theme(){return this.$$.ctx[1]}set theme(t){this.$$set({theme:t}),r()}get size(){return this.$$.ctx[2]}set size(t){this.$$set({size:t}),r()}get full(){return this.$$.ctx[3]}set full(t){this.$$set({full:t}),r()}get label(){return this.$$.ctx[4]}set label(t){this.$$set({label:t}),r()}get iconname(){return this.$$.ctx[5]}set iconname(t){this.$$set({iconname:t}),r()}get iconmode(){return this.$$.ctx[6]}set iconmode(t){this.$$set({iconmode:t}),r()}get disabled(){return this.$$.ctx[7]}set disabled(t){this.$$set({disabled:t}),r()}get responsivesize(){return this.$$.ctx[17]}set responsivesize(t){this.$$set({responsivesize:t}),r()}get responsivewidth(){return this.$$.ctx[18]}set responsivewidth(t){this.$$set({responsivewidth:t}),r()}get type(){return this.$$.ctx[8]}set type(t){this.$$set({type:t}),r()}get loader(){return this.$$.ctx[19]}set loader(t){this.$$set({loader:t}),r()}}export{Z as default};
|
|
1
|
+
import{S as t,i as o,a as e,g as n,b as i,f as r,s as m,c,e as l,d as a,n as d,j as s,t as b,k as u,N as h,B as f,z as p,A as g,l as _,m as x,o as w,p as $,q as y,u as v,T as k,C as z,h as L,J as T,E as H,F as M,G as j,v as N,y as q}from"../../index-c222d0b7.js";import{c as C}from"../../EventForward-c4c8cd29.js";import E from"../loader/Loader.nested.js";function R(t){let o,e,n,r;const m=[O,J,F,A],c=[];function l(t,o){return t[14]&&"left"===t[13]?0:t[9]?1:t[17].icon?2:t[5]?3:-1}return~(o=l(t))&&(e=c[o]=m[o](t)),{c(){e&&e.c(),n=k()},m(t,e){~o&&c[o].m(t,e),i(t,n,e),r=!0},p(t,i){let r=o;o=l(t),o===r?~o&&c[o].p(t,i):(e&&(z(),p(c[r],1,1,(()=>{c[r]=null})),g()),~o?(e=c[o],e?e.p(t,i):(e=c[o]=m[o](t),e.c()),f(e,1),e.m(n.parentNode,n)):e=null)},i(t){r||(f(e),r=!0)},o(t){p(e),r=!1},d(t){~o&&c[o].d(t),t&&x(n)}}}function A(t){let o,e=`<${tt(t[2],t[6],t[5])} />`;return{c(){o=l("span"),L(o,"class","mc-button__icon")},m(t,n){i(t,o,n),o.innerHTML=e},p(t,n){100&n&&e!==(e=`<${tt(t[2],t[6],t[5])} />`)&&(o.innerHTML=e)},i:d,o:d,d(t){t&&x(o)}}}function F(t){let o;return{c(){o=l("span"),o.innerHTML='<slot name="icon"></slot>',L(o,"class","mc-button__icon")},m(t,e){i(t,o,e)},p:d,i:d,o:d,d(t){t&&x(o)}}}function J(t){let o,e;return{c(){o=T("svg"),e=T("use"),L(e,"href",t[9]),L(o,"class","mc-button__icon")},m(t,n){i(t,o,n),u(o,e)},p(t,o){512&o&&L(e,"href",t[9])},i:d,o:d,d(t){t&&x(o)}}}function O(t){let o,e,n;return e=new E({props:{size:"s",theme:t[12],text:""}}),{c(){o=l("span"),H(e.$$.fragment),L(o,"class","mc-button__icon")},m(t,r){i(t,o,r),M(e,o,null),n=!0},p(t,o){const n={};4096&o&&(n.theme=t[12]),e.$set(n)},i(t){n||(f(e.$$.fragment,t),n=!0)},o(t){p(e.$$.fragment,t),n=!1},d(t){t&&x(o),j(e)}}}function S(t){let o,e,n,r,m,c,d=t[14]&&"left"===t[13]&&!t[5]&&!t[17].icon&&G(t),s=t[14]&&"right"===t[13]&&!t[5]&&!t[17].icon&&D(t);return{c(){d&&d.c(),o=a(),e=l("span"),n=N(t[4]),r=a(),s&&s.c(),m=k(),L(e,"class","mc-button__label")},m(t,l){d&&d.m(t,l),i(t,o,l),i(t,e,l),u(e,n),i(t,r,l),s&&s.m(t,l),i(t,m,l),c=!0},p(t,e){!t[14]||"left"!==t[13]||t[5]||t[17].icon?d&&(z(),p(d,1,1,(()=>{d=null})),g()):d?(d.p(t,e),155680&e&&f(d,1)):(d=G(t),d.c(),f(d,1),d.m(o.parentNode,o)),(!c||16&e)&&q(n,t[4]),!t[14]||"right"!==t[13]||t[5]||t[17].icon?s&&(z(),p(s,1,1,(()=>{s=null})),g()):s?(s.p(t,e),155680&e&&f(s,1)):(s=D(t),s.c(),f(s,1),s.m(m.parentNode,m))},i(t){c||(f(d),f(s),c=!0)},o(t){p(d),p(s),c=!1},d(t){d&&d.d(t),t&&x(o),t&&x(e),t&&x(r),s&&s.d(t),t&&x(m)}}}function B(t){let o,e,n,r;const m=[Q,P,K,I],c=[];function l(t,o){return t[14]?0:t[17].icon?1:t[9]?2:t[5]?3:-1}return~(o=l(t))&&(e=c[o]=m[o](t)),{c(){e&&e.c(),n=k()},m(t,e){~o&&c[o].m(t,e),i(t,n,e),r=!0},p(t,i){let r=o;o=l(t),o===r?~o&&c[o].p(t,i):(e&&(z(),p(c[r],1,1,(()=>{c[r]=null})),g()),~o?(e=c[o],e?e.p(t,i):(e=c[o]=m[o](t),e.c()),f(e,1),e.m(n.parentNode,n)):e=null)},i(t){r||(f(e),r=!0)},o(t){p(e),r=!1},d(t){~o&&c[o].d(t),t&&x(n)}}}function G(t){let o,e,n;return e=new E({props:{size:"s",theme:t[12],text:""}}),{c(){o=l("span"),H(e.$$.fragment),L(o,"class","mc-button__icon")},m(t,r){i(t,o,r),M(e,o,null),n=!0},p(t,o){const n={};4096&o&&(n.theme=t[12]),e.$set(n)},i(t){n||(f(e.$$.fragment,t),n=!0)},o(t){p(e.$$.fragment,t),n=!1},d(t){t&&x(o),j(e)}}}function D(t){let o,e,n;return e=new E({props:{size:"s",theme:t[12],text:""}}),{c(){o=l("span"),H(e.$$.fragment),L(o,"class","mc-button__icon")},m(t,r){i(t,o,r),M(e,o,null),n=!0},p(t,o){const n={};4096&o&&(n.theme=t[12]),e.$set(n)},i(t){n||(f(e.$$.fragment,t),n=!0)},o(t){p(e.$$.fragment,t),n=!1},d(t){t&&x(o),j(e)}}}function I(t){let o,e=`<${tt(t[2],t[6],t[5])} />`;return{c(){o=l("span"),L(o,"class","mc-button__icon")},m(t,n){i(t,o,n),o.innerHTML=e},p(t,n){100&n&&e!==(e=`<${tt(t[2],t[6],t[5])} />`)&&(o.innerHTML=e)},i:d,o:d,d(t){t&&x(o)}}}function K(t){let o,e;return{c(){o=T("svg"),e=T("use"),L(e,"href",t[9]),L(o,"class","mc-button__icon")},m(t,n){i(t,o,n),u(o,e)},p(t,o){512&o&&L(e,"href",t[9])},i:d,o:d,d(t){t&&x(o)}}}function P(t){let o;return{c(){o=l("span"),o.innerHTML='<slot name="icon"></slot>',L(o,"class","mc-button__icon")},m(t,e){i(t,o,e)},p:d,i:d,o:d,d(t){t&&x(o)}}}function Q(t){let o,e,n;return e=new E({props:{size:"m",theme:t[12],text:""}}),{c(){o=l("span"),H(e.$$.fragment),L(o,"class","mc-button__icon")},m(t,r){i(t,o,r),M(e,o,null),n=!0},p(t,o){const n={};4096&o&&(n.theme=t[12]),e.$set(n)},i(t){n||(f(e.$$.fragment,t),n=!0)},o(t){p(e.$$.fragment,t),n=!1},d(t){t&&x(o),j(e)}}}function U(t){let o,e,n,r;const m=[Y,X,W,V],c=[];function l(t,o){return t[14]&&"right"===t[13]?0:t[9]?1:t[17].icon?2:t[5]?3:-1}return~(o=l(t))&&(e=c[o]=m[o](t)),{c(){e&&e.c(),n=k()},m(t,e){~o&&c[o].m(t,e),i(t,n,e),r=!0},p(t,i){let r=o;o=l(t),o===r?~o&&c[o].p(t,i):(e&&(z(),p(c[r],1,1,(()=>{c[r]=null})),g()),~o?(e=c[o],e?e.p(t,i):(e=c[o]=m[o](t),e.c()),f(e,1),e.m(n.parentNode,n)):e=null)},i(t){r||(f(e),r=!0)},o(t){p(e),r=!1},d(t){~o&&c[o].d(t),t&&x(n)}}}function V(t){let o,e=`<${tt(t[2],t[6],t[5])} />`;return{c(){o=l("span"),L(o,"class","mc-button__icon")},m(t,n){i(t,o,n),o.innerHTML=e},p(t,n){100&n&&e!==(e=`<${tt(t[2],t[6],t[5])} />`)&&(o.innerHTML=e)},i:d,o:d,d(t){t&&x(o)}}}function W(t){let o;return{c(){o=l("span"),o.innerHTML='<slot name="icon"></slot>',L(o,"class","mc-button__icon")},m(t,e){i(t,o,e)},p:d,i:d,o:d,d(t){t&&x(o)}}}function X(t){let o,e;return{c(){o=T("svg"),e=T("use"),L(e,"href",t[9]),L(o,"class","mc-button__icon")},m(t,n){i(t,o,n),u(o,e)},p(t,o){512&o&&L(e,"href",t[9])},i:d,o:d,d(t){t&&x(o)}}}function Y(t){let o,e,n;return e=new E({props:{size:"s",theme:t[12],text:""}}),{c(){o=l("span"),H(e.$$.fragment),L(o,"class","mc-button__icon")},m(t,r){i(t,o,r),M(e,o,null),n=!0},p(t,o){const n={};4096&o&&(n.theme=t[12]),e.$set(n)},i(t){n||(f(e.$$.fragment,t),n=!0)},o(t){p(e.$$.fragment,t),n=!1},d(t){t&&x(o),j(e)}}}function Z(t){let o,e,n,r,m,w,$,y,v,k=(t[5]||t[17].icon||t[9])&&"left"===t[6]&&R(t);const L=[B,S],T=[];function H(t,o){return(t[5]||t[17].icon||t[9])&&"only"===t[6]?0:1}n=H(t),r=T[n]=L[n](t);let M=(t[5]||t[17].icon||t[9])&&"right"===t[6]&&U(t),j=[{type:t[8]},{class:w=t[16](t[1],t[0],t[2],t[3])+" "+t[11]},{disabled:t[7]},t[10]],N={};for(let t=0;t<j.length;t+=1)N=c(N,j[t]);return{c(){o=l("button"),k&&k.c(),e=a(),r.c(),m=a(),M&&M.c(),this.c=d,s(o,N),b(o,"mc-button--square","only"==t[6])},m(r,c){i(r,o,c),k&&k.m(o,null),u(o,e),T[n].m(o,null),u(o,m),M&&M.m(o,null),o.autofocus&&o.focus(),$=!0,y||(v=h(t[15].call(null,o)),y=!0)},p(t,[i]){(t[5]||t[17].icon||t[9])&&"left"===t[6]?k?(k.p(t,i),131680&i&&f(k,1)):(k=R(t),k.c(),f(k,1),k.m(o,e)):k&&(z(),p(k,1,1,(()=>{k=null})),g());let c=n;n=H(t),n===c?T[n].p(t,i):(z(),p(T[c],1,1,(()=>{T[c]=null})),g(),r=T[n],r?r.p(t,i):(r=T[n]=L[n](t),r.c()),f(r,1),r.m(o,m)),(t[5]||t[17].icon||t[9])&&"right"===t[6]?M?(M.p(t,i),131680&i&&f(M,1)):(M=U(t),M.c(),f(M,1),M.m(o,null)):M&&(z(),p(M,1,1,(()=>{M=null})),g()),s(o,N=_(j,[(!$||256&i)&&{type:t[8]},(!$||2063&i&&w!==(w=t[16](t[1],t[0],t[2],t[3])+" "+t[11]))&&{class:w},(!$||128&i)&&{disabled:t[7]},1024&i&&t[10]])),b(o,"mc-button--square","only"==t[6])},i(t){$||(f(k),f(r),f(M),$=!0)},o(t){p(k),p(r),p(M),$=!1},d(t){t&&x(o),k&&k.d(),T[n].d(),M&&M.d(),y=!1,v()}}}function tt(t,o,e){const n="only"===o;let i;switch(t){case"s":i="24px";break;case"m":i=n?"32px":"24px";break;case"l":i=n?"100%":"32px"}return`${e} size="${i}" class="no"`}function ot(t,o,e){let n,i,r,m,l,a;const d=["bordered","theme","size","full","label","iconname","iconmode","disabled","responsivesize","responsivewidth","type","loader","iconpath"];let s=w(o,d),{$$slots:b={},$$scope:u}=o;const h=$(b);var f,p,g;let{bordered:_=!1}=o,{theme:x}=o,{size:k="m"}=o,{full:z=!1}=o,{label:L}=o,{iconname:T}=o,{iconmode:H}=o,{disabled:M=!1}=o,{responsivesize:j}=o,{responsivewidth:N}=o,{type:q="button"}=o,{loader:E}=o,{iconpath:R}=o;const A=C(y());return t.$$set=t=>{e(26,o=c(c({},o),v(t))),e(25,s=w(o,d)),"bordered"in t&&e(0,_=t.bordered),"theme"in t&&e(1,x=t.theme),"size"in t&&e(2,k=t.size),"full"in t&&e(3,z=t.full),"label"in t&&e(4,L=t.label),"iconname"in t&&e(5,T=t.iconname),"iconmode"in t&&e(6,H=t.iconmode),"disabled"in t&&e(7,M=t.disabled),"responsivesize"in t&&e(18,j=t.responsivesize),"responsivewidth"in t&&e(19,N=t.responsivewidth),"type"in t&&e(8,q=t.type),"loader"in t&&e(20,E=t.loader),"iconpath"in t&&e(9,R=t.iconpath)},t.$$.update=()=>{1048576&t.$$.dirty&&e(24,n=E?JSON.parse(E):void 0),18874368&t.$$.dirty&&e(14,i=null!==e(21,f=null==n?void 0:n.enabled)&&void 0!==f&&f),20971520&t.$$.dirty&&e(13,r=null!==e(22,p=null==n?void 0:n.position)&&void 0!==p?p:"left"),25165824&t.$$.dirty&&e(12,m=null!==e(23,g=null==n?void 0:n.theme)&&void 0!==g?g:"primary"),e(11,l=o.class),e(10,a=Object.assign({},s)),1024&t.$$.dirty&&delete a.class},o=v(o),[_,x,k,z,L,T,H,M,q,R,a,l,m,r,i,A,function(t,o,e,n){const i=["mc-button"],r=function(t,o){if(!o&&!t)return"";const e=o?"bordered":"solid";return t?`mc-button--${e}-${t}`:`mc-button--${e}`}(t,o);return r&&i.push(r),e&&i.push(`mc-button--${e}`),n?i.push("mc-button--full"):i.push("mc-button--fit"),"only"===H&&i.push("mc-button--square"),j&&i.push(`mc-button--${j}`),N&&i.push(`mc-button--${N}`),i.join(" ")},h,j,N,E,f,p,g,n]}class et extends t{constructor(t){super();const c=document.createElement("style");c.textContent='.mc-button{margin:0;-webkit-box-shadow:none;box-shadow:none;text-decoration:none;outline:none;border:none;cursor:pointer;padding:0;color:#ffffff;background-color:#007f8c;font-family:"Roboto", sans-serif;font-weight:700;font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem;cursor:pointer;border-radius:4px;text-align:center;border:2px solid transparent;-webkit-transition:all ease 200ms;transition:all ease 200ms;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;vertical-align:middle;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;-webkit-box-sizing:border-box;box-sizing:border-box;fill:currentColor}.mc-button.is-hover,.mc-button:hover{background-color:#006974;color:#ffffff}.mc-button.is-active,.mc-button:active{background-color:#006974}.mc-button:disabled,.mc-button.is-disabled,.mc-button[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button .mc-button__icon:first-child,.mc-button .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button.is-focus,.mc-button:focus{-webkit-box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #758992;box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #758992}.mc-button--s{font-size:0.875rem;line-height:1.2857142857;padding:0.3125rem 1rem;min-height:2rem;min-width:2rem}.mc-button--s .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--s .mc-button__icon:first-child,.mc-button--s .mc-button__icon:last-child{margin-bottom:-0.1875rem;margin-top:-0.1875rem}.mc-button--s .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:1.5rem;height:1.5rem}.mc-button--m{font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem}.mc-button--m .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--m .mc-button__icon:first-child,.mc-button--m .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button--m .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--l{font-size:1.125rem;line-height:1.3333333333;padding:0.875rem 1.5rem;min-height:3.5rem;min-width:3.5rem}.mc-button--l .mc-button__icon{width:2rem;height:2rem}.mc-button--l .mc-button__icon:first-child,.mc-button--l .mc-button__icon:last-child{margin-bottom:-0.25rem;margin-top:-0.25rem}.mc-button--l .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--fit{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:auto}.mc-button--full{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}@supports (width: -webkit-fill-available) or (width: -moz-available) or (width: stretch){.mc-button--full{width:-webkit-fill-available;width:-moz-available;width:stretch}}.mc-button--square{-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:0;padding:0}.mc-button__icon{-ms-flex-negative:0;flex-shrink:0}.mc-button__icon:last-child{margin-left:0.5rem;margin-right:-0.25rem}.mc-button__icon:first-child{margin-right:0.5rem;margin-left:-0.25rem}.mc-button__icon:only-child{margin:0}.mc-button__label{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;pointer-events:none}.mc-button--solid-primary-02{background-color:#6a7081}.mc-button--solid-primary-02.is-hover,.mc-button--solid-primary-02:hover{background-color:#242938}.mc-button--solid-primary-02.is-active,.mc-button--solid-primary-02:active{background-color:#171b26}.mc-button--solid-primary-02:disabled,.mc-button--solid-primary-02.is-disabled,.mc-button--solid-primary-02[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--solid-neutral{background-color:#333333}.mc-button--solid-neutral.is-hover,.mc-button--solid-neutral:hover{background-color:#191919}.mc-button--solid-neutral.is-active,.mc-button--solid-neutral:active{background-color:#333333}.mc-button--solid-neutral:disabled,.mc-button--solid-neutral.is-disabled,.mc-button--solid-neutral[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--solid-danger{background-color:#c61112}.mc-button--solid-danger.is-hover,.mc-button--solid-danger:hover{background-color:#8c0003}.mc-button--solid-danger.is-active,.mc-button--solid-danger:active{background-color:#8c0003}.mc-button--solid-danger:disabled,.mc-button--solid-danger.is-disabled,.mc-button--solid-danger[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--bordered{color:#007f8c;border-color:#007f8c;background-color:#ffffff}.mc-button--bordered.is-hover,.mc-button--bordered:hover{background-color:#d9f0f3;color:#006974}.mc-button--bordered.is-active,.mc-button--bordered:active{background-color:#91d5db;color:#004e57}.mc-button--bordered.is-active,.mc-button--bordered:active{background-color:#91d5db;color:#004e57}.mc-button--bordered:disabled,.mc-button--bordered.is-disabled,.mc-button--bordered[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--bordered-primary-02{color:#6a7081;border-color:#6a7081;background-color:#ffffff}.mc-button--bordered-primary-02.is-hover,.mc-button--bordered-primary-02:hover{background-color:#eeeff1;color:#6a7081}.mc-button--bordered-primary-02.is-active,.mc-button--bordered-primary-02:active{background-color:#cfd2d8}.mc-button--bordered-primary-02:disabled,.mc-button--bordered-primary-02.is-disabled,.mc-button--bordered-primary-02[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--bordered-neutral{color:#333333;border-color:#333333;background-color:#ffffff}.mc-button--bordered-neutral.is-hover,.mc-button--bordered-neutral:hover{background-color:#e6e6e6;color:#333333}.mc-button--bordered-neutral.is-active,.mc-button--bordered-neutral:active{background-color:#cccccc}.mc-button--bordered-neutral:disabled,.mc-button--bordered-neutral.is-disabled,.mc-button--bordered-neutral[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-button--bordered-danger{color:#c61112;border-color:#c61112;background-color:#ffffff}.mc-button--bordered-danger.is-hover,.mc-button--bordered-danger:hover{background-color:#fdeaea;color:#8c0003}.mc-button--bordered-danger.is-active,.mc-button--bordered-danger:active{background-color:#f8bcbb;color:#530000}.mc-button--bordered-danger.is-active,.mc-button--bordered-danger:active{background-color:#f8bcbb;color:#530000}.mc-button--bordered-danger:disabled,.mc-button--bordered-danger.is-disabled,.mc-button--bordered-danger[aria-disabled=true]{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}@media screen and (min-width: 680px){.mc-button--s\\@from-m{font-size:0.875rem;line-height:1.2857142857;padding:0.3125rem 1rem;min-height:2rem;min-width:2rem}.mc-button--s\\@from-m .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--s\\@from-m .mc-button__icon:first-child,.mc-button--s\\@from-m .mc-button__icon:last-child{margin-bottom:-0.1875rem;margin-top:-0.1875rem}.mc-button--s\\@from-m .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:1.5rem;height:1.5rem}.mc-button--m\\@from-m{font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem}.mc-button--m\\@from-m .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--m\\@from-m .mc-button__icon:first-child,.mc-button--m\\@from-m .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button--m\\@from-m .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--l\\@from-m{font-size:1.125rem;line-height:1.3333333333;padding:0.875rem 1.5rem;min-height:3.5rem;min-width:3.5rem}.mc-button--l\\@from-m .mc-button__icon{width:2rem;height:2rem}.mc-button--l\\@from-m .mc-button__icon:first-child,.mc-button--l\\@from-m .mc-button__icon:last-child{margin-bottom:-0.25rem;margin-top:-0.25rem}.mc-button--l\\@from-m .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--fit\\@from-m{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:auto}.mc-button--full\\@from-m{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}@supports (width: -webkit-fill-available) or (width: -moz-available) or (width: stretch){.mc-button--full\\@from-m{width:-webkit-fill-available;width:-moz-available;width:stretch}}}@media screen and (min-width: 1024px){.mc-button--s\\@from-l{font-size:0.875rem;line-height:1.2857142857;padding:0.3125rem 1rem;min-height:2rem;min-width:2rem}.mc-button--s\\@from-l .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--s\\@from-l .mc-button__icon:first-child,.mc-button--s\\@from-l .mc-button__icon:last-child{margin-bottom:-0.1875rem;margin-top:-0.1875rem}.mc-button--s\\@from-l .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:1.5rem;height:1.5rem}.mc-button--m\\@from-l{font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem}.mc-button--m\\@from-l .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--m\\@from-l .mc-button__icon:first-child,.mc-button--m\\@from-l .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button--m\\@from-l .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--l\\@from-l{font-size:1.125rem;line-height:1.3333333333;padding:0.875rem 1.5rem;min-height:3.5rem;min-width:3.5rem}.mc-button--l\\@from-l .mc-button__icon{width:2rem;height:2rem}.mc-button--l\\@from-l .mc-button__icon:first-child,.mc-button--l\\@from-l .mc-button__icon:last-child{margin-bottom:-0.25rem;margin-top:-0.25rem}.mc-button--l\\@from-l .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--fit\\@from-l{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:auto}.mc-button--full\\@from-l{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}@supports (width: -webkit-fill-available) or (width: -moz-available) or (width: stretch){.mc-button--full\\@from-l{width:-webkit-fill-available;width:-moz-available;width:stretch}}.mc-button--square{padding:0}}@media screen and (min-width: 1280px){.mc-button--s\\@from-xl{font-size:0.875rem;line-height:1.2857142857;padding:0.3125rem 1rem;min-height:2rem;min-width:2rem}.mc-button--s\\@from-xl .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--s\\@from-xl .mc-button__icon:first-child,.mc-button--s\\@from-xl .mc-button__icon:last-child{margin-bottom:-0.1875rem;margin-top:-0.1875rem}.mc-button--s\\@from-xl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:1.5rem;height:1.5rem}.mc-button--m\\@from-xl{font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem}.mc-button--m\\@from-xl .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--m\\@from-xl .mc-button__icon:first-child,.mc-button--m\\@from-xl .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button--m\\@from-xl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--l\\@from-xl{font-size:1.125rem;line-height:1.3333333333;padding:0.875rem 1.5rem;min-height:3.5rem;min-width:3.5rem}.mc-button--l\\@from-xl .mc-button__icon{width:2rem;height:2rem}.mc-button--l\\@from-xl .mc-button__icon:first-child,.mc-button--l\\@from-xl .mc-button__icon:last-child{margin-bottom:-0.25rem;margin-top:-0.25rem}.mc-button--l\\@from-xl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--fit\\@from-xl{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:auto}.mc-button--full\\@from-xl{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}@supports (width: -webkit-fill-available) or (width: -moz-available) or (width: stretch){.mc-button--full\\@from-xl{width:-webkit-fill-available;width:-moz-available;width:stretch}}}@media screen and (min-width: 1920px){.mc-button--s\\@from-xxl{font-size:0.875rem;line-height:1.2857142857;padding:0.3125rem 1rem;min-height:2rem;min-width:2rem}.mc-button--s\\@from-xxl .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--s\\@from-xxl .mc-button__icon:first-child,.mc-button--s\\@from-xxl .mc-button__icon:last-child{margin-bottom:-0.1875rem;margin-top:-0.1875rem}.mc-button--s\\@from-xxl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:1.5rem;height:1.5rem}.mc-button--m\\@from-xxl{font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem}.mc-button--m\\@from-xxl .mc-button__icon{width:1.5rem;height:1.5rem}.mc-button--m\\@from-xxl .mc-button__icon:first-child,.mc-button--m\\@from-xxl .mc-button__icon:last-child{margin-bottom:-1px;margin-top:-1px}.mc-button--m\\@from-xxl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--l\\@from-xxl{font-size:1.125rem;line-height:1.3333333333;padding:0.875rem 1.5rem;min-height:3.5rem;min-width:3.5rem}.mc-button--l\\@from-xxl .mc-button__icon{width:2rem;height:2rem}.mc-button--l\\@from-xxl .mc-button__icon:first-child,.mc-button--l\\@from-xxl .mc-button__icon:last-child{margin-bottom:-0.25rem;margin-top:-0.25rem}.mc-button--l\\@from-xxl .mc-button__icon:only-child{margin-bottom:0;margin-top:0;width:2rem;height:2rem}.mc-button--fit\\@from-xxl{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:auto}.mc-button--full\\@from-xxl{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}@supports (width: -webkit-fill-available) or (width: -moz-available) or (width: stretch){.mc-button--full\\@from-xxl{width:-webkit-fill-available;width:-moz-available;width:stretch}}}.mc-button__icon{pointer-events:none}',this.shadowRoot.appendChild(c),o(this,{target:this.shadowRoot,props:{...e(this.attributes),$$slots:n(this)},customElement:!0},ot,Z,m,{bordered:0,theme:1,size:2,full:3,label:4,iconname:5,iconmode:6,disabled:7,responsivesize:18,responsivewidth:19,type:8,loader:20,iconpath:9},null),t&&(t.target&&i(t.target,this,t.anchor),t.props&&(this.$set(t.props),r()))}static get observedAttributes(){return["bordered","theme","size","full","label","iconname","iconmode","disabled","responsivesize","responsivewidth","type","loader","iconpath"]}get bordered(){return this.$$.ctx[0]}set bordered(t){this.$$set({bordered:t}),r()}get theme(){return this.$$.ctx[1]}set theme(t){this.$$set({theme:t}),r()}get size(){return this.$$.ctx[2]}set size(t){this.$$set({size:t}),r()}get full(){return this.$$.ctx[3]}set full(t){this.$$set({full:t}),r()}get label(){return this.$$.ctx[4]}set label(t){this.$$set({label:t}),r()}get iconname(){return this.$$.ctx[5]}set iconname(t){this.$$set({iconname:t}),r()}get iconmode(){return this.$$.ctx[6]}set iconmode(t){this.$$set({iconmode:t}),r()}get disabled(){return this.$$.ctx[7]}set disabled(t){this.$$set({disabled:t}),r()}get responsivesize(){return this.$$.ctx[18]}set responsivesize(t){this.$$set({responsivesize:t}),r()}get responsivewidth(){return this.$$.ctx[19]}set responsivewidth(t){this.$$set({responsivewidth:t}),r()}get type(){return this.$$.ctx[8]}set type(t){this.$$set({type:t}),r()}get loader(){return this.$$.ctx[20]}set loader(t){this.$$set({loader:t}),r()}get iconpath(){return this.$$.ctx[9]}set iconpath(t){this.$$set({iconpath:t}),r()}}export{et as default};
|
|
2
2
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../src/components/button/Button.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n import { get_current_component } from 'svelte/internal';\n import { createEventForwarder } from '../../utilities/EventForward';\n import Loader from '../loader/Loader.nested.svelte';\n import type {\n ButtonIconMode,\n ButtonSize,\n ButtonTheme,\n ButtonResponsiveSize,\n ButtonResponsiveWidth,\n ButtonType,\n ButtonLoader,\n } from './button.types';\n\n export let bordered = false;\n export let theme: ButtonTheme | undefined = undefined;\n export let size: ButtonSize = 'm';\n export let full = false;\n export let label: string;\n export let iconname: string | undefined;\n export let iconmode: ButtonIconMode | undefined;\n export let disabled = false;\n export let responsivesize: ButtonResponsiveSize = undefined;\n export let responsivewidth: ButtonResponsiveWidth = undefined;\n export let type: ButtonType = 'button';\n export let loader: string;\n\n const forwardEvents = createEventForwarder(get_current_component());\n\n $: loaderOpts = loader ? (JSON.parse(loader) as ButtonLoader) : undefined;\n $: isLoading = loaderOpts?.enabled ?? false;\n $: loaderPosition = loaderOpts?.position ?? 'left';\n $: loaderTheme = loaderOpts?.theme ?? 'primary';\n $: userClass = $$props.class;\n $: attributes = { ...$$restProps };\n $: delete attributes.class;\n\n function generateIconName(\n size: ButtonSize,\n iconMode: ButtonIconMode,\n iconName: string,\n ): string {\n const isIconOnly = iconMode === 'only';\n let iconSize: string;\n\n switch (size) {\n case 's':\n iconSize = '24px';\n break;\n case 'm':\n iconSize = isIconOnly ? '32px' : '24px';\n break;\n case 'l':\n iconSize = isIconOnly ? '100%' : '32px';\n break;\n }\n\n return `${iconName} size=\"${iconSize}\" class=\"no\"`;\n }\n\n function getAppearanceClass(theme: ButtonTheme, isBordered: boolean): string {\n if (!isBordered && !theme) {\n return '';\n }\n\n const type = isBordered ? 'bordered' : 'solid';\n\n if (theme) {\n return `mc-button--${type}-${theme}`;\n }\n return `mc-button--${type}`;\n }\n\n function getClasses(\n theme: ButtonTheme,\n isBordered: boolean,\n size: ButtonSize,\n isFull: boolean,\n ): string {\n const classes = ['mc-button'];\n\n const appearanceClass = getAppearanceClass(theme, isBordered);\n if (appearanceClass) {\n classes.push(appearanceClass);\n }\n\n if (size) {\n classes.push(`mc-button--${size}`);\n }\n\n if (isFull) {\n classes.push(`mc-button--full`);\n } else {\n classes.push(`mc-button--fit`);\n }\n\n if (iconmode === 'only') {\n classes.push('mc-button--square');\n }\n\n if (responsivesize) {\n classes.push(`mc-button--${responsivesize}`);\n }\n\n if (responsivewidth) {\n classes.push(`mc-button--${responsivewidth}`);\n }\n\n return classes.join(' ');\n }\n</script>\n\n<button\n use:forwardEvents\n {type}\n class=\"{getClasses(theme, bordered, size, full)} {userClass}\"\n class:mc-button--square={iconmode == 'only'}\n {disabled}\n {...attributes}\n>\n {#if (iconname || $$slots.icon) && iconmode === 'left'}\n <span class=\"mc-button__icon\">\n {#if isLoading && loaderPosition === 'left'}\n <Loader size=\"s\" theme={loaderTheme} text=\"\" />\n {:else if $$slots.icon}\n <slot name=\"icon\" />\n {:else if iconname}\n {@html `<${generateIconName(size, iconmode, iconname)} />`}\n {/if}\n </span>\n {/if}\n\n {#if (iconname || $$slots.icon) && iconmode === 'only'}\n <span class=\"mc-button__icon\">\n {#if isLoading}\n <Loader size=\"m\" theme={loaderTheme} text=\"\" />\n {:else if $$slots.icon}\n <slot name=\"icon\" />\n {:else if iconname}\n {@html `<${generateIconName(size, iconmode, iconname)} />`}\n {/if}\n </span>\n {:else}\n {#if isLoading && loaderPosition === 'left' && !iconname && !$$slots.icon}\n <span class=\"mc-button__icon\">\n <Loader size=\"s\" theme={loaderTheme} text=\"\" />\n </span>\n {/if}\n <span class=\"mc-button__label\">{label}</span>\n {#if isLoading && loaderPosition === 'right' && !iconname && !$$slots.icon}\n <span class=\"mc-button__icon\">\n <Loader size=\"s\" theme={loaderTheme} text=\"\" />\n </span>\n {/if}\n {/if}\n\n {#if (iconname || $$slots.icon) && iconmode === 'right'}\n <span class=\"mc-button__icon\">\n {#if isLoading && loaderPosition === 'right'}\n <Loader size=\"s\" theme={loaderTheme} text=\"\" />\n {:else if $$slots.icon}\n <slot name=\"icon\" />\n {:else if iconname}\n {@html `<${generateIconName(size, iconmode, iconname)} />`}\n {/if}\n </span>\n {/if}\n</button>\n\n<style lang=\"scss\">\n @import '@mozaic-ds/styles/settings-tools/_all-settings';\n @import '@mozaic-ds/styles/components/c.button';\n\n .mc-button__icon {\n pointer-events: none;\n }\n</style>\n"],"names":["ctx","icon","insert","target","span","anchor","raw_value","generateIconName","dirty","html_tag","p","slot","create_if_block_9","create_if_block_8","if_block0","create_if_block_10","if_block2","create_if_block","toggle_class","button","class","button_class_value","size","iconMode","iconName","isIconOnly","iconSize","_a","_b","_c","bordered","$$props","theme","full","label","iconname","iconmode","disabled","responsivesize","responsivewidth","type","loader","forwardEvents","createEventForwarder","get_current_component","$$invalidate","loaderOpts","JSON","parse","undefined","isLoading","enabled","loaderPosition","position","loaderTheme","userClass","attributes","Object","assign","$$restProps","isBordered","isFull","classes","appearanceClass","getAppearanceClass","push","join"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../src/components/button/Button.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n import { get_current_component } from 'svelte/internal';\n import { createEventForwarder } from '../../utilities/EventForward';\n import Loader from '../loader/Loader.nested.svelte';\n import type {\n ButtonIconMode,\n ButtonSize,\n ButtonTheme,\n ButtonResponsiveSize,\n ButtonResponsiveWidth,\n ButtonType,\n ButtonLoader,\n } from './button.types';\n\n export let bordered = false;\n export let theme: ButtonTheme | undefined = undefined;\n export let size: ButtonSize = 'm';\n export let full = false;\n export let label: string;\n export let iconname: string | undefined;\n export let iconmode: ButtonIconMode | undefined;\n export let disabled = false;\n export let responsivesize: ButtonResponsiveSize = undefined;\n export let responsivewidth: ButtonResponsiveWidth = undefined;\n export let type: ButtonType = 'button';\n export let loader: string;\n export let iconpath: string;\n const forwardEvents = createEventForwarder(get_current_component());\n\n $: loaderOpts = loader ? (JSON.parse(loader) as ButtonLoader) : undefined;\n $: isLoading = loaderOpts?.enabled ?? false;\n $: loaderPosition = loaderOpts?.position ?? 'left';\n $: loaderTheme = loaderOpts?.theme ?? 'primary';\n $: userClass = $$props.class;\n $: attributes = { ...$$restProps };\n $: delete attributes.class;\n\n function generateIconName(\n size: ButtonSize,\n iconMode: ButtonIconMode,\n iconName: string,\n ): string {\n const isIconOnly = iconMode === 'only';\n let iconSize: string;\n\n switch (size) {\n case 's':\n iconSize = '24px';\n break;\n case 'm':\n iconSize = isIconOnly ? '32px' : '24px';\n break;\n case 'l':\n iconSize = isIconOnly ? '100%' : '32px';\n break;\n }\n\n return `${iconName} size=\"${iconSize}\" class=\"no\"`;\n }\n\n function getAppearanceClass(theme: ButtonTheme, isBordered: boolean): string {\n if (!isBordered && !theme) {\n return '';\n }\n\n const type = isBordered ? 'bordered' : 'solid';\n\n if (theme) {\n return `mc-button--${type}-${theme}`;\n }\n return `mc-button--${type}`;\n }\n\n function getClasses(\n theme: ButtonTheme,\n isBordered: boolean,\n size: ButtonSize,\n isFull: boolean,\n ): string {\n const classes = ['mc-button'];\n\n const appearanceClass = getAppearanceClass(theme, isBordered);\n if (appearanceClass) {\n classes.push(appearanceClass);\n }\n\n if (size) {\n classes.push(`mc-button--${size}`);\n }\n\n if (isFull) {\n classes.push(`mc-button--full`);\n } else {\n classes.push(`mc-button--fit`);\n }\n\n if (iconmode === 'only') {\n classes.push('mc-button--square');\n }\n\n if (responsivesize) {\n classes.push(`mc-button--${responsivesize}`);\n }\n\n if (responsivewidth) {\n classes.push(`mc-button--${responsivewidth}`);\n }\n\n return classes.join(' ');\n }\n</script>\n\n<button\n use:forwardEvents\n {type}\n class=\"{getClasses(theme, bordered, size, full)} {userClass}\"\n class:mc-button--square={iconmode == 'only'}\n {disabled}\n {...attributes}\n>\n {#if (iconname || $$slots.icon || iconpath) && iconmode === 'left'}\n {#if isLoading && loaderPosition === 'left'}\n <span class=\"mc-button__icon\">\n <Loader size=\"s\" theme={loaderTheme} text=\"\" />\n </span>\n {:else if iconpath}\n <svg class=\"mc-button__icon\">\n <use href={iconpath} />\n </svg>\n {:else if $$slots.icon}\n <span class=\"mc-button__icon\">\n <slot name=\"icon\" />\n </span>\n {:else if iconname}\n <span class=\"mc-button__icon\">\n {@html `<${generateIconName(size, iconmode, iconname)} />`}\n </span>\n {/if}\n {/if}\n\n {#if (iconname || $$slots.icon || iconpath) && iconmode === 'only'}\n {#if isLoading}\n <span class=\"mc-button__icon\">\n <Loader size=\"m\" theme={loaderTheme} text=\"\" />\n </span>\n {:else if $$slots.icon}\n <span class=\"mc-button__icon\">\n <slot name=\"icon\" />\n </span>\n {:else if iconpath}\n <svg class=\"mc-button__icon\">\n <use href={iconpath} />\n </svg>\n {:else if iconname}\n <span class=\"mc-button__icon\">\n {@html `<${generateIconName(size, iconmode, iconname)} />`}\n </span>\n {/if}\n {:else}\n {#if isLoading && loaderPosition === 'left' && !iconname && !$$slots.icon}\n <span class=\"mc-button__icon\">\n <Loader size=\"s\" theme={loaderTheme} text=\"\" />\n </span>\n {/if}\n <span class=\"mc-button__label\">{label}</span>\n {#if isLoading && loaderPosition === 'right' && !iconname && !$$slots.icon}\n <span class=\"mc-button__icon\">\n <Loader size=\"s\" theme={loaderTheme} text=\"\" />\n </span>\n {/if}\n {/if}\n\n {#if (iconname || $$slots.icon || iconpath) && iconmode === 'right'}\n {#if isLoading && loaderPosition === 'right'}\n <span class=\"mc-button__icon\">\n <Loader size=\"s\" theme={loaderTheme} text=\"\" />\n </span>\n {:else if iconpath}\n <svg class=\"mc-button__icon\">\n <use href={iconpath} />\n </svg>\n {:else if $$slots.icon}\n <span class=\"mc-button__icon\">\n <slot name=\"icon\" />\n </span>\n {:else if iconname}\n <span class=\"mc-button__icon\">\n {@html `<${generateIconName(size, iconmode, iconname)} />`}\n </span>\n {/if}\n {/if}\n</button>\n\n<style lang=\"scss\">\n @import '@mozaic-ds/styles/settings-tools/_all-settings';\n @import '@mozaic-ds/styles/components/c.button';\n\n .mc-button__icon {\n pointer-events: none;\n }\n</style>\n"],"names":["ctx","icon","raw_value","generateIconName","insert","target","span","anchor","dirty","innerHTML","svg","append","use","create_if_block_11","create_if_block_10","create_if_block_12","create_if_block","toggle_class","button","class","button_class_value","size","iconMode","iconName","isIconOnly","iconSize","_a","_b","_c","bordered","$$props","theme","full","label","iconname","iconmode","disabled","responsivesize","responsivewidth","type","loader","iconpath","forwardEvents","createEventForwarder","get_current_component","$$invalidate","loaderOpts","JSON","parse","undefined","isLoading","enabled","loaderPosition","position","loaderTheme","userClass","attributes","Object","assign","$$restProps","isBordered","isFull","classes","appearanceClass","getAppearanceClass","push","join"],"mappings":"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"}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
export let responsivewidth: ButtonResponsiveWidth = undefined;
|
|
27
27
|
export let type: ButtonType = 'button';
|
|
28
28
|
export let loader: string;
|
|
29
|
-
|
|
29
|
+
export let iconpath: string;
|
|
30
30
|
const forwardEvents = createEventForwarder(get_current_component());
|
|
31
31
|
|
|
32
32
|
$: loaderOpts = loader ? (JSON.parse(loader) as ButtonLoader) : undefined;
|
|
@@ -120,28 +120,44 @@
|
|
|
120
120
|
{disabled}
|
|
121
121
|
{...attributes}
|
|
122
122
|
>
|
|
123
|
-
{#if (iconname || $$slots.icon) && iconmode === 'left'}
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
{#if (iconname || $$slots.icon || iconpath) && iconmode === 'left'}
|
|
124
|
+
{#if isLoading && loaderPosition === 'left'}
|
|
125
|
+
<span class="mc-button__icon">
|
|
126
126
|
<Loader size="s" theme={loaderTheme} text="" />
|
|
127
|
-
|
|
127
|
+
</span>
|
|
128
|
+
{:else if iconpath}
|
|
129
|
+
<svg class="mc-button__icon">
|
|
130
|
+
<use href={iconpath} />
|
|
131
|
+
</svg>
|
|
132
|
+
{:else if $$slots.icon}
|
|
133
|
+
<span class="mc-button__icon">
|
|
128
134
|
<slot name="icon" />
|
|
129
|
-
|
|
135
|
+
</span>
|
|
136
|
+
{:else if iconname}
|
|
137
|
+
<span class="mc-button__icon">
|
|
130
138
|
{@html `<${generateIconName(size, iconmode, iconname)} />`}
|
|
131
|
-
|
|
132
|
-
|
|
139
|
+
</span>
|
|
140
|
+
{/if}
|
|
133
141
|
{/if}
|
|
134
142
|
|
|
135
|
-
{#if (iconname || $$slots.icon) && iconmode === 'only'}
|
|
136
|
-
|
|
137
|
-
|
|
143
|
+
{#if (iconname || $$slots.icon || iconpath) && iconmode === 'only'}
|
|
144
|
+
{#if isLoading}
|
|
145
|
+
<span class="mc-button__icon">
|
|
138
146
|
<Loader size="m" theme={loaderTheme} text="" />
|
|
139
|
-
|
|
147
|
+
</span>
|
|
148
|
+
{:else if $$slots.icon}
|
|
149
|
+
<span class="mc-button__icon">
|
|
140
150
|
<slot name="icon" />
|
|
141
|
-
|
|
151
|
+
</span>
|
|
152
|
+
{:else if iconpath}
|
|
153
|
+
<svg class="mc-button__icon">
|
|
154
|
+
<use href={iconpath} />
|
|
155
|
+
</svg>
|
|
156
|
+
{:else if iconname}
|
|
157
|
+
<span class="mc-button__icon">
|
|
142
158
|
{@html `<${generateIconName(size, iconmode, iconname)} />`}
|
|
143
|
-
|
|
144
|
-
|
|
159
|
+
</span>
|
|
160
|
+
{/if}
|
|
145
161
|
{:else}
|
|
146
162
|
{#if isLoading && loaderPosition === 'left' && !iconname && !$$slots.icon}
|
|
147
163
|
<span class="mc-button__icon">
|
|
@@ -156,16 +172,24 @@
|
|
|
156
172
|
{/if}
|
|
157
173
|
{/if}
|
|
158
174
|
|
|
159
|
-
{#if (iconname || $$slots.icon) && iconmode === 'right'}
|
|
160
|
-
|
|
161
|
-
|
|
175
|
+
{#if (iconname || $$slots.icon || iconpath) && iconmode === 'right'}
|
|
176
|
+
{#if isLoading && loaderPosition === 'right'}
|
|
177
|
+
<span class="mc-button__icon">
|
|
162
178
|
<Loader size="s" theme={loaderTheme} text="" />
|
|
163
|
-
|
|
179
|
+
</span>
|
|
180
|
+
{:else if iconpath}
|
|
181
|
+
<svg class="mc-button__icon">
|
|
182
|
+
<use href={iconpath} />
|
|
183
|
+
</svg>
|
|
184
|
+
{:else if $$slots.icon}
|
|
185
|
+
<span class="mc-button__icon">
|
|
164
186
|
<slot name="icon" />
|
|
165
|
-
|
|
187
|
+
</span>
|
|
188
|
+
{:else if iconname}
|
|
189
|
+
<span class="mc-button__icon">
|
|
166
190
|
{@html `<${generateIconName(size, iconmode, iconname)} />`}
|
|
167
|
-
|
|
168
|
-
|
|
191
|
+
</span>
|
|
192
|
+
{/if}
|
|
169
193
|
{/if}
|
|
170
194
|
</button>
|
|
171
195
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S as e,i as l,a as t,b as s,f as i,s as a,e as r,d as o,v as n,n as d,h as c,k as p,x as
|
|
1
|
+
import{S as e,i as l,a as t,b as s,f as i,s as a,e as r,d as o,v as n,n as d,h as c,k as p,x as f,y as m,B as u,z as b,A as h,m as $,q as x,r as g,E as v,F as w,G as _,C as k,K as y}from"../../index-c222d0b7.js";import{E}from"../../EventHandler-f7ee47ca.js";import C from"./fileuploader-result.nested.js";function z(e){let l,t;return l=new C({props:{files:e[8],allowedExtensions:e[11],disabled:e[6],maxSize:e[12],removelabel:e[7],errorLabels:e[13]}}),l.$on("file-removed",e[15]),{c(){v(l.$$.fragment)},m(e,s){w(l,e,s),t=!0},p(e,t){const s={};256&t&&(s.files=e[8]),2048&t&&(s.allowedExtensions=e[11]),64&t&&(s.disabled=e[6]),4096&t&&(s.maxSize=e[12]),128&t&&(s.removelabel=e[7]),8192&t&&(s.errorLabels=e[13]),l.$set(s)},i(e){t||(u(l.$$.fragment,e),t=!0)},o(e){b(l.$$.fragment,e),t=!1},d(e){_(l,e)}}}function S(e){let l,t;return l=new C({props:{files:e[10],allowedExtensions:e[11],disabled:e[6],maxSize:e[12],removelabel:e[7],errorLabels:e[13]}}),l.$on("file-removed",e[16]),{c(){v(l.$$.fragment)},m(e,s){w(l,e,s),t=!0},p(e,t){const s={};1024&t&&(s.files=e[10]),2048&t&&(s.allowedExtensions=e[11]),64&t&&(s.disabled=e[6]),4096&t&&(s.maxSize=e[12]),128&t&&(s.removelabel=e[7]),8192&t&&(s.errorLabels=e[13]),l.$set(s)},i(e){t||(u(l.$$.fragment,e),t=!0)},o(e){b(l.$$.fragment,e),t=!1},d(e){_(l,e)}}}function P(e){let l,t,i,a,x,g,v,w,_,y,E,C=e[0]&&e[8]&&e[8].length>0&&z(e),P=e[10].length>0&&S(e);return{c(){l=r("div"),t=r("input"),i=o(),a=r("label"),x=r("span"),g=n(e[3]),v=o(),C&&C.c(),w=o(),P&&P.c(),this.c=d,c(t,"id",e[1]),c(t,"name",e[2]),c(t,"type","file"),c(t,"class","mc-fileuploader__input"),c(t,"accept",e[4]),t.multiple=e[5],t.disabled=e[6],c(x,"class","mc-fileuploader__label--center"),c(a,"for",e[1]),c(a,"class","mc-fileuploader__label"),c(l,"class","mc-fileuploader")},m(r,o){s(r,l,o),p(l,t),p(l,i),p(l,a),p(a,x),p(x,g),p(l,v),C&&C.m(l,null),p(l,w),P&&P.m(l,null),e[23](l),_=!0,y||(E=f(t,"change",e[14]),y=!0)},p(e,[s]){(!_||2&s)&&c(t,"id",e[1]),(!_||4&s)&&c(t,"name",e[2]),(!_||16&s)&&c(t,"accept",e[4]),(!_||32&s)&&(t.multiple=e[5]),(!_||64&s)&&(t.disabled=e[6]),(!_||8&s)&&m(g,e[3]),(!_||2&s)&&c(a,"for",e[1]),e[0]&&e[8]&&e[8].length>0?C?(C.p(e,s),257&s&&u(C,1)):(C=z(e),C.c(),u(C,1),C.m(l,w)):C&&(k(),b(C,1,1,(()=>{C=null})),h()),e[10].length>0?P?(P.p(e,s),1024&s&&u(P,1)):(P=S(e),P.c(),u(P,1),P.m(l,null)):P&&(k(),b(P,1,1,(()=>{P=null})),h())},i(e){_||(u(C),u(P),_=!0)},o(e){b(C),b(P),_=!1},d(t){t&&$(l),C&&C.d(),P&&P.d(),e[23](null),y=!1,E()}}}function A(e,l){const t=Array.from(e),s=t.indexOf(l);if(-1!==s&&t.splice(s,1),l instanceof File){const e=new DataTransfer;return t.forEach((l=>e.items.add(l))),e.files}return t}function M(e,l,t){let s,i,a,r,o,n,{id:d}=l,{name:c}=l,{label:p}=l,{accept:f}=l,{multiple:m=!0}=l,{allowedextensions:u}=l,{maxsize:b}=l,{displayfileslist:h=!1}=l,{disabled:$=!1}=l,{removelabel:v="Remove"}=l,{uploadedfiles:w}=l,{errorlabels:_}=l,{stateless:k}=l,{keepPrevious:C}=l,z=new E(x(),g());return e.$$set=e=>{"id"in e&&t(1,d=e.id),"name"in e&&t(2,c=e.name),"label"in e&&t(3,p=e.label),"accept"in e&&t(4,f=e.accept),"multiple"in e&&t(5,m=e.multiple),"allowedextensions"in e&&t(17,u=e.allowedextensions),"maxsize"in e&&t(18,b=e.maxsize),"displayfileslist"in e&&t(0,h=e.displayfileslist),"disabled"in e&&t(6,$=e.disabled),"removelabel"in e&&t(7,v=e.removelabel),"uploadedfiles"in e&&t(19,w=e.uploadedfiles),"errorlabels"in e&&t(20,_=e.errorlabels),"stateless"in e&&t(21,k=e.stateless),"keepPrevious"in e&&t(22,C=e.keepPrevious)},e.$$.update=()=>{131072&e.$$.dirty&&t(11,s=u?JSON.parse(u):[]),524288&e.$$.dirty&&t(10,i=w?JSON.parse(w):[]),e.$$.dirty,262144&e.$$.dirty&&t(12,a=b||void 0),1048576&e.$$.dirty&&t(13,r=_?JSON.parse(_):[])},[h,d,c,p,f,m,$,v,o,n,i,s,a,r,function(e){const l=e.target;if(C&&(null==o?void 0:o.length)>0){const e=[...o],s=[...l.files],i=new DataTransfer;e.forEach((e=>i.items.add(e))),s.forEach((e=>i.items.add(e))),t(8,o=i.files)}else t(8,o=l.files);t(0,h=!0);const i=[];[...o].forEach(((e,l)=>{const t=e.name,r=e.size,o=function(e){if(s&&s.length>0){const l=e.slice(2+(e.lastIndexOf(".")-1>>>0));if(s&&!s.includes(String(l)))return!1}return!0}(t),n=function(e){return!(a&&e/1024/1024>a)}(r);let d="";o||(d="invalid-extension"),n||(d="invalid-size"),o&&n||i.push({index:l,fileName:t,fileSize:r,errorType:d})})),i.length>0&&z.dispatch(x(),"invalid-files",i),z.dispatch("change",o);const r=n.querySelector(".mc-fileuploader__input");k?r.value="":r.files=o},function(e){t(8,o=A(o,e.detail)),n.querySelector(".mc-fileuploader__input").files=o,z.dispatch("change",o),z.dispatch("file-removed",e.detail)},function(e){const l=A(i,e.detail);t(10,i=l),z.dispatch("uploaded-file-removed",e.detail)},u,b,w,_,k,C,function(e){y[e?"unshift":"push"]((()=>{n=e,t(9,n)}))}]}class O extends e{constructor(e){super();const r=document.createElement("style");r.textContent=".mc-fileuploader{position:relative;display:block}.mc-fileuploader__input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0;visibility:visible;white-space:nowrap}.mc-fileuploader__label{font-family:\"Roboto\", sans-serif;font-weight:700;cursor:pointer;border-radius:4px;text-align:center;border:2px solid transparent;-webkit-transition:all ease 200ms;transition:all ease 200ms;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;vertical-align:middle;font-size:1rem;line-height:1.375;padding:0.6875rem 1.5rem;min-height:3rem;min-width:3rem;color:#007f8c;border-color:#007f8c;background-color:#ffffff;margin:0;-webkit-box-shadow:none;box-shadow:none;text-decoration:none;outline:none;-webkit-box-sizing:border-box;box-sizing:border-box}.mc-fileuploader__label:hover{background-color:#d9f0f3;color:#006974}.mc-fileuploader__label:active{background-color:#91d5db;color:#004e57}.mc-fileuploader__label:active{background-color:#91d5db;color:#004e57}.mc-fileuploader__label:disabled{background-color:#cccccc;border-color:transparent;color:#666666;cursor:not-allowed}.mc-fileuploader__label::before{content:\"\";width:1.5rem;height:1.5rem;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:transparent url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1.5rem' width='1.5rem' fill='%23007f8c' viewBox='0 0 24 24'%3E%3Ctitle%3EMedia_Upload_24px%3C/title%3E%3Cpath d='M8.71,7.71,11,5.41V16a1,1,0,0,0,2,0V5.41l2.29,2.3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42l-4-4a1,1,0,0,0-1.42,0l-4,4A1,1,0,1,0,8.71,7.71Z'/%3E%3Cpath d='M16.22,12.44a1,1,0,0,0-1.2.77,1,1,0,0,0,.76,1.19C18.55,15,20,16.17,20,17c0,1.22-3.12,3-8,3s-8-1.78-8-3c0-.83,1.45-2,4.22-2.6A1,1,0,0,0,9,13.21a1,1,0,0,0-1.2-.77C4.16,13.25,2,15,2,17c0,2.85,4.3,5,10,5s10-2.15,10-5C22,15,19.84,13.25,16.22,12.44Z'/%3E%3C/svg%3E\") no-repeat;background-size:1.5rem;margin-right:0.5rem;margin-left:-0.5rem}:focus+.mc-fileuploader__label{-webkit-box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #758992;box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #758992}:hover+.mc-fileuploader__label{color:#006974;background-color:#d9f0f3}:disabled+.mc-fileuploader__label{color:#666666;background-color:#cccccc;border-color:transparent;cursor:not-allowed}:disabled+.mc-fileuploader__label::before{background:transparent url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1.5rem' width='1.5rem' fill='%23666666' viewBox='0 0 24 24'%3E%3Ctitle%3EMedia_Upload_24px%3C/title%3E%3Cpath d='M8.71,7.71,11,5.41V16a1,1,0,0,0,2,0V5.41l2.29,2.3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42l-4-4a1,1,0,0,0-1.42,0l-4,4A1,1,0,1,0,8.71,7.71Z'/%3E%3Cpath d='M16.22,12.44a1,1,0,0,0-1.2.77,1,1,0,0,0,.76,1.19C18.55,15,20,16.17,20,17c0,1.22-3.12,3-8,3s-8-1.78-8-3c0-.83,1.45-2,4.22-2.6A1,1,0,0,0,9,13.21a1,1,0,0,0-1.2-.77C4.16,13.25,2,15,2,17c0,2.85,4.3,5,10,5s10-2.15,10-5C22,15,19.84,13.25,16.22,12.44Z'/%3E%3C/svg%3E\") no-repeat}",this.shadowRoot.appendChild(r),l(this,{target:this.shadowRoot,props:t(this.attributes),customElement:!0},M,P,a,{id:1,name:2,label:3,accept:4,multiple:5,allowedextensions:17,maxsize:18,displayfileslist:0,disabled:6,removelabel:7,uploadedfiles:19,errorlabels:20,stateless:21,keepPrevious:22},null),e&&(e.target&&s(e.target,this,e.anchor),e.props&&(this.$set(e.props),i()))}static get observedAttributes(){return["id","name","label","accept","multiple","allowedextensions","maxsize","displayfileslist","disabled","removelabel","uploadedfiles","errorlabels","stateless","keepPrevious"]}get id(){return this.$$.ctx[1]}set id(e){this.$$set({id:e}),i()}get name(){return this.$$.ctx[2]}set name(e){this.$$set({name:e}),i()}get label(){return this.$$.ctx[3]}set label(e){this.$$set({label:e}),i()}get accept(){return this.$$.ctx[4]}set accept(e){this.$$set({accept:e}),i()}get multiple(){return this.$$.ctx[5]}set multiple(e){this.$$set({multiple:e}),i()}get allowedextensions(){return this.$$.ctx[17]}set allowedextensions(e){this.$$set({allowedextensions:e}),i()}get maxsize(){return this.$$.ctx[18]}set maxsize(e){this.$$set({maxsize:e}),i()}get displayfileslist(){return this.$$.ctx[0]}set displayfileslist(e){this.$$set({displayfileslist:e}),i()}get disabled(){return this.$$.ctx[6]}set disabled(e){this.$$set({disabled:e}),i()}get removelabel(){return this.$$.ctx[7]}set removelabel(e){this.$$set({removelabel:e}),i()}get uploadedfiles(){return this.$$.ctx[19]}set uploadedfiles(e){this.$$set({uploadedfiles:e}),i()}get errorlabels(){return this.$$.ctx[20]}set errorlabels(e){this.$$set({errorlabels:e}),i()}get stateless(){return this.$$.ctx[21]}set stateless(e){this.$$set({stateless:e}),i()}get keepPrevious(){return this.$$.ctx[22]}set keepPrevious(e){this.$$set({keepPrevious:e}),i()}}export{O as default};
|
|
2
2
|
//# sourceMappingURL=FileUploader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUploader.js","sources":["../../../../src/components/fileuploader/FileUploader.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n // @ts-nocheck\n import {\n get_current_component,\n createEventDispatcher,\n } from 'svelte/internal';\n import { EventHandler } from '../../utilities/EventHandler';\n import ResultFile from './fileuploader-result.nested.svelte';\n\n export let id: string;\n export let name: string;\n export let label: string;\n export let accept: string;\n export let multiple = true;\n export let allowedextensions: string;\n export let maxsize: number;\n export let displayfileslist = false;\n export let disabled = false;\n export let removelabel = 'Remove';\n export let uploadedfiles: string;\n export let errorlabels: string;\n export let stateless: false;\n export let keepPrevious: boolean;\n\n let files: FileList;\n let root: HTMLElement;\n let eventHandler = new EventHandler(\n get_current_component(),\n createEventDispatcher(),\n );\n\n $: allowedExtensions = allowedextensions ? JSON.parse(allowedextensions) : [];\n $: uploadedFiles = uploadedfiles ? JSON.parse(uploadedfiles) : [];\n $: files;\n $: maxSize = maxsize ? maxsize : undefined;\n $: errorLabels = errorlabels ? JSON.parse(errorlabels) : [];\n\n function checkFileSize(fileSize: number): boolean {\n const fileSizeMB = fileSize / 1024 / 1024; // in MB\n if (maxSize && fileSizeMB > maxSize) {\n return false; // invalid\n }\n\n return true; // valid\n }\n function checkFileExtension(fileName: string): boolean {\n if (allowedExtensions && allowedExtensions.length > 0) {\n const extension: string = fileName.slice(\n ((fileName.lastIndexOf('.') - 1) >>> 0) + 2,\n );\n if (allowedExtensions && !allowedExtensions.includes(String(extension))) {\n return false; // invalid\n }\n }\n\n return true; // valid\n }\n function handleChange(e: Event): void {\n const target = e.target as HTMLInputElement;\n\n if(keepPrevious && files?.length > 0){\n const previousSelection: File[] = [...files]\n const newSelection: File[] = [...target.files as FileList]\n const dataTransfer: DataTransfer = new DataTransfer()\n previousSelection.forEach((item) => dataTransfer.items.add(item))\n newSelection.forEach((item) => dataTransfer.items.add(item))\n\n files = dataTransfer.files\n\n } else {\n files = target.files as FileList;\n }\n\n displayfileslist = true;\n const invalidFiles: Array<any> = [];\n const fileList = [...files];\n\n fileList.forEach((file, index) => {\n const fileName = file.name;\n const fileSize = file.size;\n const validExtension = checkFileExtension(fileName);\n const validSize = checkFileSize(fileSize);\n let errorType = '';\n\n if (!validExtension) {\n errorType = 'invalid-extension';\n }\n\n if (!validSize) {\n errorType = 'invalid-size';\n }\n\n if (!validExtension || !validSize) {\n invalidFiles.push({\n index: index,\n fileName: fileName,\n fileSize: fileSize,\n errorType: errorType,\n });\n }\n });\n\n if (invalidFiles.length > 0) {\n eventHandler.dispatch(\n get_current_component(),\n 'invalid-files',\n invalidFiles,\n );\n }\n eventHandler.dispatch('change', files);\n\n const fileuploader = root.querySelector(\n '.mc-fileuploader__input',\n ) as HTMLInputElement;\n if (stateless) {\n fileuploader.value = '';\n } else {\n fileuploader.files = files\n }\n }\n\n function removeFromArray(fileList: FileList, value: File): FileList {\n const array = Array.from(fileList);\n const idx = array.indexOf(value);\n if (idx !== -1) {\n array.splice(idx, 1);\n }\n\n const dataTransfer: DataTransfer = new DataTransfer()\n
|
|
1
|
+
{"version":3,"file":"FileUploader.js","sources":["../../../../src/components/fileuploader/FileUploader.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n // @ts-nocheck\n import {\n get_current_component,\n createEventDispatcher,\n } from 'svelte/internal';\n import { EventHandler } from '../../utilities/EventHandler';\n import ResultFile from './fileuploader-result.nested.svelte';\n\n export let id: string;\n export let name: string;\n export let label: string;\n export let accept: string;\n export let multiple = true;\n export let allowedextensions: string;\n export let maxsize: number;\n export let displayfileslist = false;\n export let disabled = false;\n export let removelabel = 'Remove';\n export let uploadedfiles: string;\n export let errorlabels: string;\n export let stateless: false;\n export let keepPrevious: boolean;\n\n let files: FileList;\n let root: HTMLElement;\n let eventHandler = new EventHandler(\n get_current_component(),\n createEventDispatcher(),\n );\n\n $: allowedExtensions = allowedextensions ? JSON.parse(allowedextensions) : [];\n $: uploadedFiles = uploadedfiles ? JSON.parse(uploadedfiles) : [];\n $: files;\n $: maxSize = maxsize ? maxsize : undefined;\n $: errorLabels = errorlabels ? JSON.parse(errorlabels) : [];\n\n function checkFileSize(fileSize: number): boolean {\n const fileSizeMB = fileSize / 1024 / 1024; // in MB\n if (maxSize && fileSizeMB > maxSize) {\n return false; // invalid\n }\n\n return true; // valid\n }\n function checkFileExtension(fileName: string): boolean {\n if (allowedExtensions && allowedExtensions.length > 0) {\n const extension: string = fileName.slice(\n ((fileName.lastIndexOf('.') - 1) >>> 0) + 2,\n );\n if (allowedExtensions && !allowedExtensions.includes(String(extension))) {\n return false; // invalid\n }\n }\n\n return true; // valid\n }\n function handleChange(e: Event): void {\n const target = e.target as HTMLInputElement;\n\n if(keepPrevious && files?.length > 0){\n const previousSelection: File[] = [...files]\n const newSelection: File[] = [...target.files as FileList]\n const dataTransfer: DataTransfer = new DataTransfer()\n previousSelection.forEach((item) => dataTransfer.items.add(item))\n newSelection.forEach((item) => dataTransfer.items.add(item))\n\n files = dataTransfer.files\n\n } else {\n files = target.files as FileList;\n }\n\n displayfileslist = true;\n const invalidFiles: Array<any> = [];\n const fileList = [...files];\n\n fileList.forEach((file, index) => {\n const fileName = file.name;\n const fileSize = file.size;\n const validExtension = checkFileExtension(fileName);\n const validSize = checkFileSize(fileSize);\n let errorType = '';\n\n if (!validExtension) {\n errorType = 'invalid-extension';\n }\n\n if (!validSize) {\n errorType = 'invalid-size';\n }\n\n if (!validExtension || !validSize) {\n invalidFiles.push({\n index: index,\n fileName: fileName,\n fileSize: fileSize,\n errorType: errorType,\n });\n }\n });\n\n if (invalidFiles.length > 0) {\n eventHandler.dispatch(\n get_current_component(),\n 'invalid-files',\n invalidFiles,\n );\n }\n eventHandler.dispatch('change', files);\n\n const fileuploader = root.querySelector(\n '.mc-fileuploader__input',\n ) as HTMLInputElement;\n if (stateless) {\n fileuploader.value = '';\n } else {\n fileuploader.files = files\n }\n }\n\n function removeFromArray(fileList: FileList, value: File): FileList {\n const array = Array.from(fileList);\n const idx = array.indexOf(value);\n if (idx !== -1) {\n array.splice(idx, 1);\n }\n \n if(value instanceof File) {\n const dataTransfer: DataTransfer = new DataTransfer()\n array.forEach((item) => dataTransfer.items.add(item))\n return dataTransfer.files\n }\n else {\n return array\n }\n }\n\n function deleteFile(e: CustomEvent): void {\n files = removeFromArray(files, e.detail);\n const fileuploader = root.querySelector(\n '.mc-fileuploader__input',\n ) as HTMLInputElement;\n fileuploader.files = files;\n\n eventHandler.dispatch('change', files);\n eventHandler.dispatch('file-removed', e.detail);\n }\n\n function deleteUploadedFile(e: CustomEvent): void {\n const files = removeFromArray(uploadedFiles, e.detail);\n uploadedFiles = files;\n eventHandler.dispatch('uploaded-file-removed', e.detail);\n }\n\n function hasInvalidFiles(e: CustomEvent): void {\n eventHandler.dispatch('invalid-files', e.detail);\n }\n</script>\n\n<div class=\"mc-fileuploader\" bind:this={root}>\n <input\n {id}\n {name}\n type=\"file\"\n class=\"mc-fileuploader__input\"\n {accept}\n {multiple}\n {disabled}\n on:change={handleChange}\n />\n <label for={id} class=\"mc-fileuploader__label\">\n <span class=\"mc-fileuploader__label--center\">\n {label}\n </span>\n </label>\n {#if displayfileslist && files && files.length > 0}\n <ResultFile\n {files}\n {allowedExtensions}\n {disabled}\n {maxSize}\n {removelabel}\n {errorLabels}\n on:file-removed={deleteFile}\n />\n {/if}\n {#if uploadedFiles.length > 0}\n <ResultFile\n files={uploadedFiles}\n {allowedExtensions}\n {disabled}\n {maxSize}\n {removelabel}\n {errorLabels}\n on:file-removed={deleteUploadedFile}\n />\n {/if}\n</div>\n\n<style lang=\"scss\">\n @import '@mozaic-ds/styles/settings-tools/all-settings';\n @import '@mozaic-ds/styles/components/c.file-uploader';\n</style>\n"],"names":["ctx","if_block0","length","create_if_block_1","create_if_block","insert","target","div","anchor","append","input","label_1","span","removeFromArray","fileList","value","array","Array","from","idx","indexOf","splice","File","dataTransfer","DataTransfer","forEach","item","items","add","files","root","id","$$props","name","label","accept","multiple","allowedextensions","maxsize","displayfileslist","disabled","removelabel","uploadedfiles","errorlabels","stateless","keepPrevious","eventHandler","EventHandler","get_current_component","createEventDispatcher","$$invalidate","allowedExtensions","JSON","parse","uploadedFiles","maxSize","undefined","errorLabels","e","previousSelection","newSelection","invalidFiles","file","index","fileName","fileSize","size","validExtension","extension","slice","lastIndexOf","includes","String","checkFileExtension","validSize","checkFileSize","errorType","push","dispatch","fileuploader","querySelector","detail","$$value"],"mappings":"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"}
|
|
@@ -127,11 +127,15 @@
|
|
|
127
127
|
if (idx !== -1) {
|
|
128
128
|
array.splice(idx, 1);
|
|
129
129
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
|
|
131
|
+
if(value instanceof File) {
|
|
132
|
+
const dataTransfer: DataTransfer = new DataTransfer()
|
|
133
|
+
array.forEach((item) => dataTransfer.items.add(item))
|
|
134
|
+
return dataTransfer.files
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
return array
|
|
138
|
+
}
|
|
135
139
|
}
|
|
136
140
|
|
|
137
141
|
function deleteFile(e: CustomEvent): void {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{S as e,i as t,a as i,g as n,b as s,f as o,s as a,e as l,n as
|
|
1
|
+
import{S as e,i as t,a as i,g as n,b as s,f as o,s as a,e as l,n as m,h as r,k as c,m as d,R as u,p as f,q as h,r as b,d as g,v as p,t as _,x as w,y as x,J as k,M as v}from"../../index-c222d0b7.js";import{E as $}from"../../EventHandler-f7ee47ca.js";function y(e,t,i){const n=e.slice();return n[8]=t[i],n[10]=i,n}function E(e){let t,i=`<${L(e[8].iconName,e[0]===e[10])} />`;return{c(){t=l("span"),r(t,"class","mc-menu__icon")},m(e,n){s(e,t,n),t.innerHTML=i},p(e,n){3&n&&i!==(i=`<${L(e[8].iconName,e[0]===e[10])} />`)&&(t.innerHTML=i)},d(e){e&&d(t)}}}function C(e){let t,i,n;return{c(){t=l("span"),i=l("slot"),r(i,"prop",n=e[8]),r(i,"name","icon"),r(t,"class","mc-menu__icon")},m(e,n){s(e,t,n),c(t,i)},p(e,t){2&t&&n!==(n=e[8])&&r(i,"prop",n)},d(e){e&&d(t)}}}function z(e){let t,i,n,o;return{c(){t=k("svg"),i=k("use"),r(i,"href",n=e[8].iconPath),r(t,"class","mc-menu__icon"),r(t,"fill",o=e[0]===e[10]?"white":""),v(t,"width","2rem")},m(e,n){s(e,t,n),c(t,i)},p(e,s){2&s&&n!==(n=e[8].iconPath)&&r(i,"href",n),1&s&&o!==(o=e[0]===e[10]?"white":"")&&r(t,"fill",o)},d(e){e&&d(t)}}}function M(e){let t,i,n,o,a,m,u,f,h,b,k=e[8].label+"",v=e[8].iconName&&E(e),$=e[3].icon&&C(e),y=e[8].iconPath&&z(e);function M(){return e[6](e[10],e[8])}return{c(){t=l("li"),i=l("div"),v&&v.c(),n=g(),$&&$.c(),o=g(),y&&y.c(),a=g(),m=l("span"),u=p(k),f=g(),r(m,"class","mc-menu__label"),r(i,"class","mc-menu__link"),_(i,"is-active",e[0]===e[10]),_(i,"is-disabled",e[8].disabled),r(t,"class","mc-menu__item")},m(e,l){s(e,t,l),c(t,i),v&&v.m(i,null),c(i,n),$&&$.m(i,null),c(i,o),y&&y.m(i,null),c(i,a),c(i,m),c(m,u),c(t,f),h||(b=w(i,"click",M),h=!0)},p(t,s){(e=t)[8].iconName?v?v.p(e,s):(v=E(e),v.c(),v.m(i,n)):v&&(v.d(1),v=null),e[3].icon?$?$.p(e,s):($=C(e),$.c(),$.m(i,o)):$&&($.d(1),$=null),e[8].iconPath?y?y.p(e,s):(y=z(e),y.c(),y.m(i,a)):y&&(y.d(1),y=null),2&s&&k!==(k=e[8].label+"")&&x(u,k),1&s&&_(i,"is-active",e[0]===e[10]),2&s&&_(i,"is-disabled",e[8].disabled)},d(e){e&&d(t),v&&v.d(),$&&$.d(),y&&y.d(),h=!1,b()}}}function N(e){let t,i,n=e[1],o=[];for(let t=0;t<n.length;t+=1)o[t]=M(y(e,n,t));return{c(){t=l("nav"),i=l("ul");for(let e=0;e<o.length;e+=1)o[e].c();this.c=m,r(i,"class","mc-menu__list"),r(t,"class","mc-menu"),r(t,"aria-label","menu")},m(e,n){s(e,t,n),c(t,i);for(let e=0;e<o.length;e+=1)o[e]&&o[e].m(i,null)},p(e,[t]){if(15&t){let s;for(n=e[1],s=0;s<n.length;s+=1){const a=y(e,n,s);o[s]?o[s].p(a,t):(o[s]=M(a),o[s].c(),o[s].m(i,null))}for(;s<o.length;s+=1)o[s].d(1);o.length=n.length}},i:m,o:m,d(e){e&&d(t),u(o,e)}}}function L(e,t){return t?`${e} fill="white" `:`${e} `}function R(e,t,i){let n,s,{$$slots:o={},$$scope:a}=t;const l=f(o);let{items:m}=t,{selected:r}=t,c=new $(h(),b());function d(e,t){i(0,s=e),c.dispatch("item-selected",{index:e,item:t})}return e.$$set=e=>{"items"in e&&i(4,m=e.items),"selected"in e&&i(5,r=e.selected)},e.$$.update=()=>{16&e.$$.dirty&&i(1,n=m?JSON.parse(m):[]),32&e.$$.dirty&&i(0,s=r?Number(r):"")},[s,n,d,l,m,r,(e,t)=>d(e,t)]}class P extends e{constructor(e){super();const l=document.createElement("style");l.textContent=".mc-menu,.mc-menu *{-webkit-box-sizing:border-box;box-sizing:border-box}.mc-menu__list{list-style:none;padding:0;margin:0}.mc-menu__item{position:relative}.mc-menu__item:not(:last-child) .mc-menu__link::after{background:#b3b3b3;content:\"\";display:block;margin:0 auto;height:1px;width:100%}.mc-menu__item:not(:last-child) .mc-menu__link::after{bottom:0;position:absolute;left:0}.mc-menu__item:not(:last-child) .mc-menu__link.is-active::after{display:none}.mc-menu__item:first-of-type .mc-menu__link{border-radius:0.25rem 0.25rem 0 0}.mc-menu__item:last-of-type .mc-menu__link{border-radius:0 0 0.25rem 0.25rem}.mc-menu__link{font-weight:400;position:relative;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:#ffffff;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1rem' width='1rem' viewBox='0 0 16 16' fill='%23191919'%3E%3Cpath d='M5.5 14a1 1 0 01-.71-.29 1 1 0 010-1.42L9.09 8l-4.3-4.29a1 1 0 011.42-1.42l5 5a1 1 0 010 1.42l-5 5a1 1 0 01-.71.29z'/%3E%3C/svg%3E\");background-position:center right 1rem;background-repeat:no-repeat;background-size:1rem;border:none;cursor:pointer;color:#191919;display:-webkit-box;display:-ms-flexbox;display:flex;gap:0.5rem;height:3.5rem;font-family:inherit;padding-right:3rem;padding-left:1rem;position:relative;text-decoration:none;outline:none;width:100%}.mc-menu__link::before{border-radius:2px;-webkit-box-shadow:0 0 0 0 transparent;box-shadow:0 0 0 0 transparent;content:\"\";display:block;pointer-events:none;position:absolute;top:0;right:0;bottom:0;left:0;-webkit-transition:-webkit-box-shadow 200ms ease;transition:-webkit-box-shadow 200ms ease;transition:box-shadow 200ms ease;transition:box-shadow 200ms ease, -webkit-box-shadow 200ms ease;z-index:var(--menu-link-z-index, 1)}.mc-menu__link.is-active,.mc-menu__link.is-disabled{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1rem' width='1rem' viewBox='0 0 16 16' fill='%23ffffff'%3E%3Cpath d='M5.5 14a1 1 0 01-.71-.29 1 1 0 010-1.42L9.09 8l-4.3-4.29a1 1 0 011.42-1.42l5 5a1 1 0 010 1.42l-5 5a1 1 0 01-.71.29z'/%3E%3C/svg%3E\");color:#ffffff}.mc-menu__link:hover{background-color:#eeedea}.mc-menu__link:active{background-color:#dddcd5}.mc-menu__link:focus::before{-webkit-box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #758992;box-shadow:0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #758992}.mc-menu__link.is-active{background-color:#007f8c;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1rem' width='1rem' viewBox='0 0 16 16' fill='%23ffffff'%3E%3Cpath d='M5.5 14a1 1 0 01-.71-.29 1 1 0 010-1.42L9.09 8l-4.3-4.29a1 1 0 011.42-1.42l5 5a1 1 0 010 1.42l-5 5a1 1 0 01-.71.29z'/%3E%3C/svg%3E\");color:#ffffff}.mc-menu__link.is-active .mc-menu__label{font-family:\"Roboto\", sans-serif;font-weight:700}.mc-menu__link.is-disabled{background-color:#e6e6e6;cursor:not-allowed}.mc-menu__icon{-ms-flex-negative:0;flex-shrink:0}.mc-menu__label{font-size:1rem;line-height:1.375;font-family:\"Roboto\", sans-serif;font-weight:400;display:-webkit-box;max-height:2.75rem;overflow:hidden;text-align:left;-webkit-line-clamp:2;-webkit-box-orient:vertical}",this.shadowRoot.appendChild(l),t(this,{target:this.shadowRoot,props:{...i(this.attributes),$$slots:n(this)},customElement:!0},R,N,a,{items:4,selected:5},null),e&&(e.target&&s(e.target,this,e.anchor),e.props&&(this.$set(e.props),o()))}static get observedAttributes(){return["items","selected"]}get items(){return this.$$.ctx[4]}set items(e){this.$$set({items:e}),o()}get selected(){return this.$$.ctx[5]}set selected(e){this.$$set({selected:e}),o()}}export{P as default};
|
|
2
2
|
//# sourceMappingURL=Menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","sources":["../../../../src/components/menu/Menu.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n import {\n get_current_component,\n createEventDispatcher,\n } from 'svelte/internal';\n import { EventHandler } from '../../utilities/EventHandler';\n import type { menuType } from './menu.types';\n export let items: string;\n export let selected: string;\n $: menuItems = items ? (JSON.parse(items) as menuType[]) : [];\n $: itemSelected = selected ? Number(selected) : '';\n\n let eventHandler = new EventHandler(\n get_current_component(),\n createEventDispatcher(),\n );\n\n function generateIconName(\n iconName: string | undefined,\n isActive: boolean,\n ): string {\n if (isActive) return `${iconName} fill=\"white\" `;\n else return `${iconName} `;\n }\n\n function manageMenu(index: any, item: any) {\n itemSelected = index;\n eventHandler.dispatch('item-selected', {\n index,\n item,\n });\n }\n</script>\n\n<nav class=\"mc-menu\" aria-label=\"menu\">\n <ul class=\"mc-menu__list\">\n {#each menuItems as item, index}\n <li class=\"mc-menu__item\">\n <!-- svelte-ignore a11y-click-events-have-key-events -->\n <div\n class=\"mc-menu__link\"\n class:is-active={itemSelected === index}\n class:is-disabled={item.disabled}\n on:click={() => manageMenu(index, item)}\n >\n <span class=\"mc-menu__icon\">\n
|
|
1
|
+
{"version":3,"file":"Menu.js","sources":["../../../../src/components/menu/Menu.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n import {\n get_current_component,\n createEventDispatcher,\n } from 'svelte/internal';\n import { EventHandler } from '../../utilities/EventHandler';\n import type { menuType } from './menu.types';\n export let items: string;\n export let selected: string;\n $: menuItems = items ? (JSON.parse(items) as menuType[]) : [];\n $: itemSelected = selected ? Number(selected) : '';\n\n let eventHandler = new EventHandler(\n get_current_component(),\n createEventDispatcher(),\n );\n\n function generateIconName(\n iconName: string | undefined,\n isActive: boolean,\n ): string {\n if (isActive) return `${iconName} fill=\"white\" `;\n else return `${iconName} `;\n }\n\n function manageMenu(index: any, item: any) {\n itemSelected = index;\n eventHandler.dispatch('item-selected', {\n index,\n item,\n });\n }\n</script>\n\n<nav class=\"mc-menu\" aria-label=\"menu\">\n <ul class=\"mc-menu__list\">\n {#each menuItems as item, index}\n <li class=\"mc-menu__item\">\n <!-- svelte-ignore a11y-click-events-have-key-events -->\n <div\n class=\"mc-menu__link\"\n class:is-active={itemSelected === index}\n class:is-disabled={item.disabled}\n on:click={() => manageMenu(index, item)}\n >\n {#if item.iconName}\n <span class=\"mc-menu__icon\">\n {@html `<${generateIconName(\n item.iconName,\n itemSelected === index,\n )} />`}\n </span>\n {/if}\n {#if $$slots.icon}\n <span class=\"mc-menu__icon\"><slot prop={item} name=\"icon\" /></span>\n {/if}\n {#if item.iconPath}\n <svg\n class=\"mc-menu__icon\"\n fill={itemSelected === index ? 'white' : ''}\n style=\"width: 2rem\"\n >\n <use href={item.iconPath} />\n </svg>\n {/if}\n <span class=\"mc-menu__label\">{item.label}</span>\n </div>\n </li>\n {/each}\n </ul>\n</nav>\n\n<style lang=\"scss\">\n @import '@mozaic-ds/styles/settings-tools/all-settings';\n @import '@mozaic-ds/styles/components/c.menu';\n</style>\n"],"names":["raw_value","generateIconName","ctx","iconName","insert","target","span","anchor","dirty","innerHTML","append","slot","attr","use","use_href_value","iconPath","svg","svg_fill_value","t3_value","label","if_block0","create_if_block_2","if_block1","icon","create_if_block_1","if_block2","create_if_block","toggle_class","div","disabled","li","set_data","t3","length","i","nav","ul","isActive","items","$$props","selected","eventHandler","EventHandler","get_current_component","createEventDispatcher","manageMenu","index","item","$$invalidate","itemSelected","dispatch","menuItems","JSON","parse","Number"],"mappings":"4UAiDyBA,EAAA,IAAAC,EACTC,EAAI,GAACC,SACLD,OAAiBA,EAAK,sEAH1BE,EAKMC,EAAAC,EAAAC,yBAJO,EAAAC,GAAAR,KAAAA,EAAA,IAAAC,EACTC,EAAI,GAACC,SACLD,OAAiBA,EAAK,aAAAI,EAAAG,UAAAT,2FAKcE,EAAI,4DAA5CE,EAAkEC,EAAAC,EAAAC,GAAtCG,EAAgCJ,EAAAK,uBAApBT,EAAI,8FAQ/BU,EAAAC,EAAA,OAAAC,EAAAZ,KAAKa,uCAHVH,EAAAI,EAAA,OAAAC,EAAAf,OAAiBA,EAAK,IAAG,QAAU,gCAF3CE,EAMKC,EAAAW,EAAAT,GADHG,EAA2BM,EAAAH,WAAhB,EAAAL,GAAAM,KAAAA,EAAAZ,KAAKa,yBAHV,EAAAP,GAAAS,KAAAA,EAAAf,OAAiBA,EAAK,IAAG,QAAU,yEAMfgB,EAAAhB,KAAKiB,MAAK,GApBnCC,EAAAlB,KAAKC,UAAQkB,EAAAnB,GAQboB,EAAApB,KAAQqB,MAAIC,EAAAtB,GAGZuB,EAAAvB,KAAKa,UAAQW,EAAAxB,yMAfDyB,EAAAC,EAAA,YAAA1B,OAAiBA,EAAK,KACpByB,EAAAC,EAAA,cAAA1B,KAAK2B,+CAL5BzB,EA8BIC,EAAAyB,EAAAvB,GA5BFG,EA2BKoB,EAAAF,qEADHlB,EAA+CkB,EAAAtB,6DApBrCH,+DAQLD,KAAQqB,2DAGRrB,KAAKa,+DASoB,EAAAP,GAAAU,KAAAA,EAAAhB,KAAKiB,MAAK,KAAAY,EAAAC,EAAAd,QAxBvBS,EAAAC,EAAA,YAAA1B,OAAiBA,EAAK,UACpByB,EAAAC,EAAA,cAAA1B,KAAK2B,sFANvB3B,EAAS,wBAAd+B,OAAIC,GAAA,sLAFV9B,EAoCKC,EAAA8B,EAAA5B,GAnCHG,EAkCIyB,EAAAC,mFAjCKlC,EAAS,WAAd+B,OAAIC,GAAA,EAAA,iHAAJD,gDAnBKhC,EACPE,EACAkC,UAEIA,EAAQ,GAAYlC,kBAAQ,GACjBA,iFAfNmC,GAAaC,YACbC,GAAgBD,EAIvBE,EAAmB,IAAAC,EACrBC,IACAC,cAWOC,EAAWC,EAAYC,GAC9BC,EAAA,EAAAC,EAAeH,GACfL,EAAaS,SAAS,gBACpB,CAAAJ,QACAC,2HApBHC,EAAA,EAAEG,EAAYb,EAASc,KAAKC,MAAMf,GAAK,mBACvCU,EAAA,EAAEC,EAAeT,EAAWc,OAAOd,GAAY,yBAiCxBK,EAAWC,EAAOC"}
|
|
@@ -45,15 +45,26 @@
|
|
|
45
45
|
class:is-disabled={item.disabled}
|
|
46
46
|
on:click={() => manageMenu(index, item)}
|
|
47
47
|
>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
{#if item.iconName}
|
|
49
|
+
<span class="mc-menu__icon">
|
|
50
|
+
{@html `<${generateIconName(
|
|
51
|
+
item.iconName,
|
|
52
|
+
itemSelected === index,
|
|
53
|
+
)} />`}
|
|
54
|
+
</span>
|
|
55
|
+
{/if}
|
|
54
56
|
{#if $$slots.icon}
|
|
55
57
|
<span class="mc-menu__icon"><slot prop={item} name="icon" /></span>
|
|
56
58
|
{/if}
|
|
59
|
+
{#if item.iconPath}
|
|
60
|
+
<svg
|
|
61
|
+
class="mc-menu__icon"
|
|
62
|
+
fill={itemSelected === index ? 'white' : ''}
|
|
63
|
+
style="width: 2rem"
|
|
64
|
+
>
|
|
65
|
+
<use href={item.iconPath} />
|
|
66
|
+
</svg>
|
|
67
|
+
{/if}
|
|
57
68
|
<span class="mc-menu__label">{item.label}</span>
|
|
58
69
|
</div>
|
|
59
70
|
</li>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.types.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC"}
|
|
1
|
+
{"version":3,"file":"menu.types.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.types.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC"}
|
|
1
|
+
{"version":3,"file":"menu.types.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC"}
|
|
@@ -7,4 +7,5 @@ export declare const IconLeft: Story<import("@storybook/types").Args>;
|
|
|
7
7
|
export declare const IconRight: Story<import("@storybook/types").Args>;
|
|
8
8
|
export declare const IconOnly: Story<import("@storybook/types").Args>;
|
|
9
9
|
export declare const WithLoading: Story<import("@storybook/types").Args>;
|
|
10
|
+
export declare const WithIconPath: Story<import("@storybook/types").Args>;
|
|
10
11
|
//# sourceMappingURL=Button.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/button/Button.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;;AAUnD,wBA+EU;
|
|
1
|
+
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/button/Button.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;;AAUnD,wBA+EU;AAoGV,eAAO,MAAM,KAAK,wCAAoB,CAAC;AAGvC,eAAO,MAAM,QAAQ,wCAAoB,CAAC;AAK1C,eAAO,MAAM,QAAQ,wCAAoB,CAAC;AAc1C,eAAO,MAAM,SAAS,wCAAoB,CAAC;AAc3C,eAAO,MAAM,QAAQ,wCAAoB,CAAC;AAmB1C,eAAO,MAAM,WAAW,wCAAoB,CAAC;AAK7C,eAAO,MAAM,YAAY,wCAAoB,CAAC"}
|