cic-kit 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +100 -41
- package/package.json +3 -4
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),B=require("vue-router"),E=["id"],_={class:"accordion-item"},N={class:"accordion-header"},V=["data-bs-target","aria-controls","disabled"],$=["id","data-bs-parent"],C={class:"accordion-body"},S={key:0},D=e.defineComponent({inheritAttrs:!1,__name:"AccordionCmp",props:{id:{},title:{},defaultOpen:{type:Boolean},disabled:{type:Boolean}},emits:["open"],setup(o,{emit:l}){const t=o,i=l,c=e.useSlots(),p=e.useAttrs(),r=e.computed(()=>t.id??"accordionDefault"),u=e.computed(()=>!!t.disabled),f=e.computed(()=>!!c.default?.().length),m=e.computed(()=>!!c.header?.().length);function d(s){if(u.value){s.preventDefault(),s.stopPropagation();return}i("open",s)}return(s,b)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({class:"accordion",id:r.value},e.unref(p)),[e.createElementVNode("div",_,[e.createElementVNode("h2",N,[e.createElementVNode("button",{class:"accordion-button collapsed p-2",type:"button","data-bs-toggle":"collapse","data-bs-target":`#collapseOne-${r.value}`,"aria-expanded":"false","aria-controls":`collapseOne-${r.value}`,disabled:u.value,onClick:d},[m.value?e.renderSlot(s.$slots,"header",{key:0}):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.title??"- default -"),1)],64))],8,V)]),e.createElementVNode("div",{id:`collapseOne-${r.value}`,class:"accordion-collapse collapse","data-bs-parent":`#${r.value}`},[e.createElementVNode("div",C,[f.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("p",S,[...b[0]||(b[0]=[e.createTextVNode(" - ",-1),e.createElementVNode("span",{class:"material-symbols-outlined text-warning"}," warning ",-1),e.createTextVNode(" - ",-1)])])),e.renderSlot(s.$slots,"default")])],8,$)])],16,E))}});async function x({url:o,text:l,title:t}){if(navigator.share)try{await navigator.share({title:t??"Condividi",text:l??"",url:o})}catch{await navigator.clipboard.writeText(o)}else await navigator.clipboard.writeText(o)}const w=["type","disabled","aria-busy"],T={class:"material-symbols-outlined","aria-hidden":"true"},A=e.defineComponent({inheritAttrs:!1,__name:"BtnCmp",props:{variant:{},color:{},size:{},block:{type:Boolean},disabled:{type:Boolean},type:{},to:{},loading:{type:Boolean},icon:{},share:{}},emits:["click"],setup(o,{emit:l}){const t=o,i=l,c=e.useSlots(),p=e.useAttrs(),r=B.useRouter(),u=e.computed(()=>!!t.disabled||!!t.loading),f=e.computed(()=>{const a=t.color??"dark",v=(t.variant??"solid")==="solid"?`btn-${a}`:`btn-outline-${a}`,g=t.variant==="ghost"?"border-0":"",k=t.size?`btn-${t.size}`:"",y=t.block?"w-100":"",h=t.variant==="link"?"btn-ms-link":"";return["btn",v,h,g,k,y].filter(Boolean).join(" ")}),m=e.computed(()=>!!c.default?.().length),d=e.computed(()=>{if(t.icon&&t.icon.trim().length>0)return t.icon.trim();if(!m.value)return"error"});function s(n){if(u.value){n.preventDefault(),n.stopPropagation();return}i("click",n),t.share&&x(t.share),t.to&&(t.type==="submit"&&n.preventDefault(),n.stopPropagation(),r.push(t.to))}const b=e.computed(()=>t.to?"button":t.type??"button");return(n,a)=>(e.openBlock(),e.createElementBlock("button",e.mergeProps(e.unref(p),{class:[f.value,e.unref(p).class],type:b.value,disabled:u.value,"aria-busy":o.loading||void 0,onClick:s}),[o.loading&&d.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a[0]||(a[0]=e.createElementVNode("span",{class:"me-2 d-inline-flex align-middle"},[e.createElementVNode("span",{class:"spinner-border spinner-border-sm align-middle",role:"status","aria-hidden":"true"})],-1)),e.renderSlot(n.$slots,"default",{},void 0,!0)],64)):o.loading&&!d.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[a[1]||(a[1]=e.createElementVNode("span",{class:"spinner-border spinner-border-sm align-middle",role:"status","aria-hidden":"true"},null,-1)),a[2]||(a[2]=e.createElementVNode("span",{class:"visually-hidden"},"Loading…",-1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[d.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(`${m.value?"me-2 ":""}d-inline-flex align-middle`)},[e.createElementVNode("span",T,e.toDisplayString(d.value),1)],2)):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"default",{},void 0,!0)],64))],16,w))}}),O=(o,l)=>{const t=o.__vccOpts||o;for(const[i,c]of l)t[i]=c;return t},P=O(A,[["__scopeId","data-v-1fbd412d"]]);exports.AccordionCmp=D;exports.BtnCmp=P;
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,69 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
|
|
1
|
+
import { defineComponent as C, useSlots as B, useAttrs as D, computed as n, openBlock as l, createElementBlock as r, mergeProps as w, unref as $, createElementVNode as o, renderSlot as y, Fragment as h, createTextVNode as _, toDisplayString as x, createCommentVNode as S, normalizeClass as N } from "vue";
|
|
2
|
+
import { useRouter as V } from "vue-router";
|
|
3
|
+
const E = ["id"], I = { class: "accordion-item" }, L = { class: "accordion-header" }, j = ["data-bs-target", "aria-controls", "disabled"], F = ["id", "data-bs-parent"], H = { class: "accordion-body" }, R = { key: 0 }, W = /* @__PURE__ */ C({
|
|
4
|
+
inheritAttrs: !1,
|
|
5
|
+
__name: "AccordionCmp",
|
|
6
|
+
props: {
|
|
7
|
+
id: {},
|
|
8
|
+
title: {},
|
|
9
|
+
defaultOpen: { type: Boolean },
|
|
10
|
+
disabled: { type: Boolean }
|
|
11
|
+
},
|
|
12
|
+
emits: ["open"],
|
|
13
|
+
setup(e, { emit: d }) {
|
|
14
|
+
const t = e, u = d, p = B(), f = D(), c = n(() => t.id ?? "accordionDefault"), m = n(() => !!t.disabled), k = n(() => !!p.default?.().length), v = n(() => !!p.header?.().length);
|
|
15
|
+
function b(i) {
|
|
16
|
+
if (m.value) {
|
|
17
|
+
i.preventDefault(), i.stopPropagation();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
u("open", i);
|
|
21
|
+
}
|
|
22
|
+
return (i, g) => (l(), r("div", w({
|
|
23
|
+
class: "accordion",
|
|
24
|
+
id: c.value
|
|
25
|
+
}, $(f)), [
|
|
26
|
+
o("div", I, [
|
|
27
|
+
o("h2", L, [
|
|
28
|
+
o("button", {
|
|
29
|
+
class: "accordion-button collapsed p-2",
|
|
30
|
+
type: "button",
|
|
31
|
+
"data-bs-toggle": "collapse",
|
|
32
|
+
"data-bs-target": `#collapseOne-${c.value}`,
|
|
33
|
+
"aria-expanded": "false",
|
|
34
|
+
"aria-controls": `collapseOne-${c.value}`,
|
|
35
|
+
disabled: m.value,
|
|
36
|
+
onClick: b
|
|
37
|
+
}, [
|
|
38
|
+
v.value ? y(i.$slots, "header", { key: 0 }) : (l(), r(h, { key: 1 }, [
|
|
39
|
+
_(x(t.title ?? "- default -"), 1)
|
|
40
|
+
], 64))
|
|
41
|
+
], 8, j)
|
|
42
|
+
]),
|
|
43
|
+
o("div", {
|
|
44
|
+
id: `collapseOne-${c.value}`,
|
|
45
|
+
class: "accordion-collapse collapse",
|
|
46
|
+
"data-bs-parent": `#${c.value}`
|
|
47
|
+
}, [
|
|
48
|
+
o("div", H, [
|
|
49
|
+
k.value ? S("", !0) : (l(), r("p", R, [...g[0] || (g[0] = [
|
|
50
|
+
_(" - ", -1),
|
|
51
|
+
o("span", { class: "material-symbols-outlined text-warning" }, " warning ", -1),
|
|
52
|
+
_(" - ", -1)
|
|
53
|
+
])])),
|
|
54
|
+
y(i.$slots, "default")
|
|
55
|
+
])
|
|
56
|
+
], 8, F)
|
|
57
|
+
])
|
|
58
|
+
], 16, E));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
async function q({ url: e, text: d, title: t }) {
|
|
4
62
|
if (navigator.share)
|
|
5
63
|
try {
|
|
6
64
|
await navigator.share({
|
|
7
65
|
title: t ?? "Condividi",
|
|
8
|
-
text:
|
|
66
|
+
text: d ?? "",
|
|
9
67
|
url: e
|
|
10
68
|
});
|
|
11
69
|
} catch {
|
|
@@ -14,10 +72,10 @@ async function N({ url: e, text: s, title: t }) {
|
|
|
14
72
|
else
|
|
15
73
|
await navigator.clipboard.writeText(e);
|
|
16
74
|
}
|
|
17
|
-
const
|
|
75
|
+
const G = ["type", "disabled", "aria-busy"], J = {
|
|
18
76
|
class: "material-symbols-outlined",
|
|
19
77
|
"aria-hidden": "true"
|
|
20
|
-
},
|
|
78
|
+
}, K = /* @__PURE__ */ C({
|
|
21
79
|
inheritAttrs: !1,
|
|
22
80
|
__name: "BtnCmp",
|
|
23
81
|
props: {
|
|
@@ -33,64 +91,65 @@ const V = ["type", "disabled", "aria-busy"], _ = {
|
|
|
33
91
|
share: {}
|
|
34
92
|
},
|
|
35
93
|
emits: ["click"],
|
|
36
|
-
setup(e, { emit:
|
|
37
|
-
const t = e,
|
|
38
|
-
const
|
|
39
|
-
return ["btn",
|
|
40
|
-
}),
|
|
94
|
+
setup(e, { emit: d }) {
|
|
95
|
+
const t = e, u = d, p = B(), f = D(), c = V(), m = n(() => !!t.disabled || !!t.loading), k = n(() => {
|
|
96
|
+
const s = t.color ?? "dark", z = (t.variant ?? "solid") === "solid" ? `btn-${s}` : `btn-outline-${s}`, A = t.variant === "ghost" ? "border-0" : "", O = t.size ? `btn-${t.size}` : "", P = t.block ? "w-100" : "", T = t.variant === "link" ? "btn-ms-link" : "";
|
|
97
|
+
return ["btn", z, T, A, O, P].filter(Boolean).join(" ");
|
|
98
|
+
}), v = n(() => !!p.default?.().length), b = n(() => {
|
|
41
99
|
if (t.icon && t.icon.trim().length > 0) return t.icon.trim();
|
|
42
|
-
if (!
|
|
100
|
+
if (!v.value) return "error";
|
|
43
101
|
});
|
|
44
|
-
function
|
|
45
|
-
if (
|
|
46
|
-
|
|
102
|
+
function i(a) {
|
|
103
|
+
if (m.value) {
|
|
104
|
+
a.preventDefault(), a.stopPropagation();
|
|
47
105
|
return;
|
|
48
106
|
}
|
|
49
|
-
|
|
107
|
+
u("click", a), t.share && q(t.share), t.to && (t.type === "submit" && a.preventDefault(), a.stopPropagation(), c.push(t.to));
|
|
50
108
|
}
|
|
51
|
-
const
|
|
109
|
+
const g = n(
|
|
52
110
|
() => t.to ? "button" : t.type ?? "button"
|
|
53
111
|
);
|
|
54
|
-
return (
|
|
55
|
-
class: [k.value,
|
|
56
|
-
type:
|
|
57
|
-
disabled:
|
|
112
|
+
return (a, s) => (l(), r("button", w($(f), {
|
|
113
|
+
class: [k.value, $(f).class],
|
|
114
|
+
type: g.value,
|
|
115
|
+
disabled: m.value,
|
|
58
116
|
"aria-busy": e.loading || void 0,
|
|
59
|
-
onClick:
|
|
117
|
+
onClick: i
|
|
60
118
|
}), [
|
|
61
|
-
e.loading &&
|
|
62
|
-
|
|
63
|
-
|
|
119
|
+
e.loading && b.value ? (l(), r(h, { key: 0 }, [
|
|
120
|
+
s[0] || (s[0] = o("span", { class: "me-2 d-inline-flex align-middle" }, [
|
|
121
|
+
o("span", {
|
|
64
122
|
class: "spinner-border spinner-border-sm align-middle",
|
|
65
123
|
role: "status",
|
|
66
124
|
"aria-hidden": "true"
|
|
67
125
|
})
|
|
68
126
|
], -1)),
|
|
69
|
-
|
|
70
|
-
], 64)) : e.loading && !
|
|
71
|
-
|
|
127
|
+
y(a.$slots, "default", {}, void 0, !0)
|
|
128
|
+
], 64)) : e.loading && !b.value ? (l(), r(h, { key: 1 }, [
|
|
129
|
+
s[1] || (s[1] = o("span", {
|
|
72
130
|
class: "spinner-border spinner-border-sm align-middle",
|
|
73
131
|
role: "status",
|
|
74
132
|
"aria-hidden": "true"
|
|
75
133
|
}, null, -1)),
|
|
76
|
-
|
|
77
|
-
], 64)) : (
|
|
78
|
-
|
|
134
|
+
s[2] || (s[2] = o("span", { class: "visually-hidden" }, "Loading…", -1))
|
|
135
|
+
], 64)) : (l(), r(h, { key: 2 }, [
|
|
136
|
+
b.value ? (l(), r("span", {
|
|
79
137
|
key: 0,
|
|
80
|
-
class:
|
|
138
|
+
class: N(`${v.value ? "me-2 " : ""}d-inline-flex align-middle`)
|
|
81
139
|
}, [
|
|
82
|
-
|
|
83
|
-
], 2)) :
|
|
84
|
-
|
|
140
|
+
o("span", J, x(b.value), 1)
|
|
141
|
+
], 2)) : S("", !0),
|
|
142
|
+
y(a.$slots, "default", {}, void 0, !0)
|
|
85
143
|
], 64))
|
|
86
|
-
], 16,
|
|
144
|
+
], 16, G));
|
|
87
145
|
}
|
|
88
|
-
}),
|
|
146
|
+
}), M = (e, d) => {
|
|
89
147
|
const t = e.__vccOpts || e;
|
|
90
|
-
for (const [
|
|
91
|
-
t[
|
|
148
|
+
for (const [u, p] of d)
|
|
149
|
+
t[u] = p;
|
|
92
150
|
return t;
|
|
93
|
-
},
|
|
151
|
+
}, X = /* @__PURE__ */ M(K, [["__scopeId", "data-v-1fbd412d"]]);
|
|
94
152
|
export {
|
|
95
|
-
|
|
153
|
+
W as AccordionCmp,
|
|
154
|
+
X as BtnCmp
|
|
96
155
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cic-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "vue-tsc --noEmit && vite build",
|
|
25
|
-
"
|
|
26
|
-
"start": "npm run prepublish && npm publish"
|
|
25
|
+
"start": "npm run build && node ./script/bumpVersion.js && npm pack && node ./script/gitPush.js"
|
|
27
26
|
},
|
|
28
27
|
"peerDependencies": {
|
|
29
28
|
"vue": "^3.3.0",
|
|
@@ -43,4 +42,4 @@
|
|
|
43
42
|
"publishConfig": {
|
|
44
43
|
"access": "public"
|
|
45
44
|
}
|
|
46
|
-
}
|
|
45
|
+
}
|