@ptlm-azulejo/button 2.0.0-alpha.39 → 2.0.0-alpha.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +39 -30
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { defineComponent as c, computed as b, openBlock as o, createElementBlock as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as c, computed as b, openBlock as o, createElementBlock as i, normalizeClass as u, renderSlot as a, createCommentVNode as d, createElementVNode as r, normalizeStyle as y, createTextVNode as m } from "vue";
|
|
2
|
+
const p = ["disabled", "type", "aria-busy"], g = {
|
|
3
3
|
key: 0,
|
|
4
|
+
"data-testid": "button-icon",
|
|
4
5
|
class: "btn__icon"
|
|
5
6
|
}, $ = {
|
|
6
7
|
key: 1,
|
|
8
|
+
"data-testid": "button-loader",
|
|
7
9
|
class: "btn__loader",
|
|
8
10
|
"aria-hidden": "true"
|
|
9
11
|
}, f = {
|
|
10
12
|
key: 2,
|
|
13
|
+
"data-testid": "button-icon",
|
|
11
14
|
class: "btn__icon"
|
|
12
15
|
}, h = {
|
|
13
16
|
key: 4,
|
|
17
|
+
"data-testid": "button-icon",
|
|
14
18
|
class: "btn__icon"
|
|
15
19
|
}, L = /* @__PURE__ */ c({
|
|
16
20
|
__name: "index",
|
|
@@ -24,41 +28,46 @@ const g = ["disabled", "type", "aria-busy"], p = {
|
|
|
24
28
|
type: { default: "button" },
|
|
25
29
|
isLoading: { type: Boolean }
|
|
26
30
|
},
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
29
|
-
[`btn--${
|
|
30
|
-
[`btn--${
|
|
31
|
-
"btn--ghost":
|
|
32
|
-
"btn--outlined":
|
|
33
|
-
"btn--icon-only":
|
|
31
|
+
setup(t) {
|
|
32
|
+
const n = t, l = b(() => ({
|
|
33
|
+
[`btn--${n.appearance}`]: n.appearance && n.appearance !== "standard",
|
|
34
|
+
[`btn--${n.size}`]: n.size && n.size !== "m",
|
|
35
|
+
"btn--ghost": n.ghost,
|
|
36
|
+
"btn--outlined": n.outlined,
|
|
37
|
+
"btn--icon-only": n.iconPosition === "only"
|
|
34
38
|
}));
|
|
35
|
-
return (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
return (e, s) => (o(), i("button", {
|
|
40
|
+
"data-testid": "button",
|
|
41
|
+
class: u(["btn", l.value]),
|
|
42
|
+
disabled: t.disabled,
|
|
43
|
+
type: t.type,
|
|
44
|
+
"aria-busy": t.isLoading || void 0
|
|
40
45
|
}, [
|
|
41
|
-
|
|
42
|
-
a(
|
|
43
|
-
])) :
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
])) : (
|
|
46
|
+
e.$slots.icon && t.iconPosition === "left" && !t.isLoading ? (o(), i("span", g, [
|
|
47
|
+
a(e.$slots, "icon")
|
|
48
|
+
])) : d("", !0),
|
|
49
|
+
t.isLoading ? (o(), i("span", $, [...s[0] || (s[0] = [
|
|
50
|
+
r("span", {
|
|
51
|
+
"data-testid": "button-spinner",
|
|
52
|
+
class: "btn__spinner"
|
|
53
|
+
}, null, -1)
|
|
54
|
+
])])) : d("", !0),
|
|
55
|
+
e.$slots.icon && t.iconPosition === "only" && !t.isLoading ? (o(), i("span", f, [
|
|
56
|
+
a(e.$slots, "icon")
|
|
57
|
+
])) : (o(), i("span", {
|
|
50
58
|
key: 3,
|
|
59
|
+
"data-testid": "button-label",
|
|
51
60
|
class: "btn__label",
|
|
52
|
-
style: y({ visibility:
|
|
61
|
+
style: y({ visibility: t.isLoading ? "hidden" : "visible" })
|
|
53
62
|
}, [
|
|
54
|
-
a(
|
|
55
|
-
|
|
63
|
+
a(e.$slots, "default", {}, () => [
|
|
64
|
+
s[1] || (s[1] = m("Button Label", -1))
|
|
56
65
|
])
|
|
57
66
|
], 4)),
|
|
58
|
-
|
|
59
|
-
a(
|
|
60
|
-
])) :
|
|
61
|
-
], 10,
|
|
67
|
+
e.$slots.icon && t.iconPosition === "right" && !t.isLoading ? (o(), i("span", h, [
|
|
68
|
+
a(e.$slots, "icon")
|
|
69
|
+
])) : d("", !0)
|
|
70
|
+
], 10, p));
|
|
62
71
|
}
|
|
63
72
|
});
|
|
64
73
|
export {
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(o,
|
|
1
|
+
(function(o,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(o=typeof globalThis!="undefined"?globalThis:o||self,t(o.button={},o.Vue))})(this,function(o,t){"use strict";const a=["disabled","type","aria-busy"],l={key:0,"data-testid":"button-icon",class:"btn__icon"},d={key:1,"data-testid":"button-loader",class:"btn__loader","aria-hidden":"true"},c={key:2,"data-testid":"button-icon",class:"btn__icon"},r={key:4,"data-testid":"button-icon",class:"btn__icon"},b=t.defineComponent({__name:"index",props:{appearance:{default:"standard"},size:{default:"m"},disabled:{type:Boolean},ghost:{type:Boolean},outlined:{type:Boolean},iconPosition:{},type:{default:"button"},isLoading:{type:Boolean}},setup(e){const n=e,y=t.computed(()=>({[`btn--${n.appearance}`]:n.appearance&&n.appearance!=="standard",[`btn--${n.size}`]:n.size&&n.size!=="m","btn--ghost":n.ghost,"btn--outlined":n.outlined,"btn--icon-only":n.iconPosition==="only"}));return(i,s)=>(t.openBlock(),t.createElementBlock("button",{"data-testid":"button",class:t.normalizeClass(["btn",y.value]),disabled:e.disabled,type:e.type,"aria-busy":e.isLoading||void 0},[i.$slots.icon&&e.iconPosition==="left"&&!e.isLoading?(t.openBlock(),t.createElementBlock("span",l,[t.renderSlot(i.$slots,"icon")])):t.createCommentVNode("",!0),e.isLoading?(t.openBlock(),t.createElementBlock("span",d,[...s[0]||(s[0]=[t.createElementVNode("span",{"data-testid":"button-spinner",class:"btn__spinner"},null,-1)])])):t.createCommentVNode("",!0),i.$slots.icon&&e.iconPosition==="only"&&!e.isLoading?(t.openBlock(),t.createElementBlock("span",c,[t.renderSlot(i.$slots,"icon")])):(t.openBlock(),t.createElementBlock("span",{key:3,"data-testid":"button-label",class:"btn__label",style:t.normalizeStyle({visibility:e.isLoading?"hidden":"visible"})},[t.renderSlot(i.$slots,"default",{},()=>[s[1]||(s[1]=t.createTextVNode("Button Label",-1))])],4)),i.$slots.icon&&e.iconPosition==="right"&&!e.isLoading?(t.openBlock(),t.createElementBlock("span",r,[t.renderSlot(i.$slots,"icon")])):t.createCommentVNode("",!0)],10,a))}});o.AzButton=b,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|