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 CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),h=require("vue-router");async function E({url:n,text:r,title:t}){if(navigator.share)try{await navigator.share({title:t??"Condividi",text:r??"",url:n})}catch{await navigator.clipboard.writeText(n)}else await navigator.clipboard.writeText(n)}const C=["type","disabled","aria-busy"],S={class:"material-symbols-outlined","aria-hidden":"true"},w=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(n,{emit:r}){const t=n,s=r,l=e.useSlots(),c=e.useAttrs(),p=h.useRouter(),d=e.computed(()=>!!t.disabled||!!t.loading),m=e.computed(()=>{const a=t.color??"dark",f=(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":"",B=t.variant==="link"?"btn-ms-link":"";return["btn",f,B,g,k,y].filter(Boolean).join(" ")}),u=e.computed(()=>!!l.default?.().length),i=e.computed(()=>{if(t.icon&&t.icon.trim().length>0)return t.icon.trim();if(!u.value)return"error"});function b(o){if(d.value){o.preventDefault(),o.stopPropagation();return}s("click",o),t.share&&E(t.share),t.to&&(t.type==="submit"&&o.preventDefault(),o.stopPropagation(),p.push(t.to))}const v=e.computed(()=>t.to?"button":t.type??"button");return(o,a)=>(e.openBlock(),e.createElementBlock("button",e.mergeProps(e.unref(c),{class:[m.value,e.unref(c).class],type:v.value,disabled:d.value,"aria-busy":n.loading||void 0,onClick:b}),[n.loading&&i.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(o.$slots,"default",{},void 0,!0)],64)):n.loading&&!i.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},[i.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(`${u.value?"me-2 ":""}d-inline-flex align-middle`)},[e.createElementVNode("span",S,e.toDisplayString(i.value),1)],2)):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"default",{},void 0,!0)],64))],16,C))}}),N=(n,r)=>{const t=n.__vccOpts||n;for(const[s,l]of r)t[s]=l;return t},V=N(w,[["__scopeId","data-v-1fbd412d"]]);exports.BtnCmp=V;
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 D, useSlots as S, useAttrs as P, computed as a, openBlock as i, createElementBlock as r, mergeProps as T, unref as v, Fragment as p, createElementVNode as l, renderSlot as g, normalizeClass as A, toDisplayString as E, createCommentVNode as I } from "vue";
2
- import { useRouter as L } from "vue-router";
3
- async function N({ url: e, text: s, title: t }) {
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: s ?? "",
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 V = ["type", "disabled", "aria-busy"], _ = {
75
+ const G = ["type", "disabled", "aria-busy"], J = {
18
76
  class: "material-symbols-outlined",
19
77
  "aria-hidden": "true"
20
- }, j = /* @__PURE__ */ D({
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: s }) {
37
- const t = e, d = s, u = S(), m = P(), y = L(), b = a(() => !!t.disabled || !!t.loading), k = a(() => {
38
- const o = t.color ?? "dark", C = (t.variant ?? "solid") === "solid" ? `btn-${o}` : `btn-outline-${o}`, w = t.variant === "ghost" ? "border-0" : "", x = t.size ? `btn-${t.size}` : "", $ = t.block ? "w-100" : "", z = t.variant === "link" ? "btn-ms-link" : "";
39
- return ["btn", C, z, w, x, $].filter(Boolean).join(" ");
40
- }), f = a(() => !!u.default?.().length), c = a(() => {
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 (!f.value) return "error";
100
+ if (!v.value) return "error";
43
101
  });
44
- function h(n) {
45
- if (b.value) {
46
- n.preventDefault(), n.stopPropagation();
102
+ function i(a) {
103
+ if (m.value) {
104
+ a.preventDefault(), a.stopPropagation();
47
105
  return;
48
106
  }
49
- d("click", n), t.share && N(t.share), t.to && (t.type === "submit" && n.preventDefault(), n.stopPropagation(), y.push(t.to));
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 B = a(
109
+ const g = n(
52
110
  () => t.to ? "button" : t.type ?? "button"
53
111
  );
54
- return (n, o) => (i(), r("button", T(v(m), {
55
- class: [k.value, v(m).class],
56
- type: B.value,
57
- disabled: b.value,
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: h
117
+ onClick: i
60
118
  }), [
61
- e.loading && c.value ? (i(), r(p, { key: 0 }, [
62
- o[0] || (o[0] = l("span", { class: "me-2 d-inline-flex align-middle" }, [
63
- l("span", {
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
- g(n.$slots, "default", {}, void 0, !0)
70
- ], 64)) : e.loading && !c.value ? (i(), r(p, { key: 1 }, [
71
- o[1] || (o[1] = l("span", {
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
- o[2] || (o[2] = l("span", { class: "visually-hidden" }, "Loading…", -1))
77
- ], 64)) : (i(), r(p, { key: 2 }, [
78
- c.value ? (i(), r("span", {
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: A(`${f.value ? "me-2 " : ""}d-inline-flex align-middle`)
138
+ class: N(`${v.value ? "me-2 " : ""}d-inline-flex align-middle`)
81
139
  }, [
82
- l("span", _, E(c.value), 1)
83
- ], 2)) : I("", !0),
84
- g(n.$slots, "default", {}, void 0, !0)
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, V));
144
+ ], 16, G));
87
145
  }
88
- }), F = (e, s) => {
146
+ }), M = (e, d) => {
89
147
  const t = e.__vccOpts || e;
90
- for (const [d, u] of s)
91
- t[d] = u;
148
+ for (const [u, p] of d)
149
+ t[u] = p;
92
150
  return t;
93
- }, q = /* @__PURE__ */ F(j, [["__scopeId", "data-v-1fbd412d"]]);
151
+ }, X = /* @__PURE__ */ M(K, [["__scopeId", "data-v-1fbd412d"]]);
94
152
  export {
95
- q as BtnCmp
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.1",
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
- "prepublish": "npm run build && npm pack",
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
+ }