@caipira/tamandua 0.0.102 → 0.0.104

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/Alert.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as o } from "./Alert.vue_vue_type_script_setup_true_lang-CAGHRWvs.js";
2
- import { p as l } from "./plugin-W9_PLHv4.js";
1
+ import { _ as o } from "./Alert.vue_vue_type_script_setup_true_lang-BBRsz4y8.js";
2
+ import { p as l } from "./plugin-BXHzcN55.js";
3
3
  export {
4
4
  o as Alert,
5
5
  l as AlertPlugin
@@ -0,0 +1,88 @@
1
+ import { defineComponent as V, ref as w, computed as x, resolveComponent as n, openBlock as t, createBlock as A, withCtx as m, createElementBlock as a, Fragment as p, createVNode as o, renderSlot as N, createElementVNode as s, toDisplayString as _, createTextVNode as y, withKeys as B, createCommentVNode as D } from "vue";
2
+ const E = {
3
+ key: 1,
4
+ class: "p-4"
5
+ }, H = { class: "font-semibold" }, K = ["innerHTML"], L = {
6
+ key: 2,
7
+ class: "p-4 flex flex-col gap-2"
8
+ }, M = { class: "select-all italic" }, S = /* @__PURE__ */ s("div", null, null, -1), j = /* @__PURE__ */ V({
9
+ name: "TAlert",
10
+ __name: "Alert",
11
+ props: {
12
+ type: { default: "alert" },
13
+ title: { default: "Confirm action" },
14
+ message: { default: "Do you want to proceed with this action?" },
15
+ closeTitle: { default: "Close" },
16
+ cancelTitle: { default: "Cancel" },
17
+ confirmTitle: { default: "Confirm" },
18
+ confirmationValue: { default: "confirm" }
19
+ },
20
+ emits: ["closed", "confirmed"],
21
+ setup(h, { emit: b }) {
22
+ const e = h, d = b, c = w(""), i = () => {
23
+ d("closed");
24
+ }, u = () => {
25
+ const l = e.type === "type-confirm" ? c.value : void 0;
26
+ d("confirmed", l);
27
+ }, C = x(() => Array.isArray(e.message) ? e.message.join("<br /><br />") : e.message || "");
28
+ return (l, f) => {
29
+ const v = n("t-graphy-label"), k = n("t-input-text"), r = n("t-button"), T = n("t-modal");
30
+ return t(), A(T, {
31
+ "show-header": !1,
32
+ "can-close": !1,
33
+ onClosed: i
34
+ }, {
35
+ footer: m(() => [
36
+ ["confirm", "type-confirm"].includes(e.type) ? (t(), a(p, { key: 0 }, [
37
+ o(r, {
38
+ variant: "transparent",
39
+ label: e.cancelTitle,
40
+ onClick: i
41
+ }, null, 8, ["label"]),
42
+ o(r, {
43
+ variant: "default",
44
+ label: e.confirmTitle,
45
+ onClick: u
46
+ }, null, 8, ["label"])
47
+ ], 64)) : (t(), a(p, { key: 1 }, [
48
+ S,
49
+ o(r, {
50
+ variant: "transparent",
51
+ label: e.closeTitle,
52
+ onClick: i
53
+ }, null, 8, ["label"])
54
+ ], 64))
55
+ ]),
56
+ default: m(() => [
57
+ l.$slots.default ? N(l.$slots, "default", { key: 0 }) : (t(), a("div", E, [
58
+ s("h3", H, _(e.title), 1),
59
+ s("p", {
60
+ innerHTML: C.value,
61
+ class: "mt-4"
62
+ }, null, 8, K)
63
+ ])),
64
+ e.type === "type-confirm" ? (t(), a("div", L, [
65
+ o(v, null, {
66
+ default: m(() => [
67
+ y(" To confirm, type "),
68
+ s("b", M, _(e.confirmationValue), 1),
69
+ y(" below: ")
70
+ ]),
71
+ _: 1
72
+ }),
73
+ o(k, {
74
+ modelValue: c.value,
75
+ "onUpdate:modelValue": f[0] || (f[0] = (g) => c.value = g),
76
+ placeholder: e.confirmationValue,
77
+ onKeyup: B(u, ["enter"])
78
+ }, null, 8, ["modelValue", "placeholder"])
79
+ ])) : D("", !0)
80
+ ]),
81
+ _: 3
82
+ });
83
+ };
84
+ }
85
+ });
86
+ export {
87
+ j as _
88
+ };
@@ -1,5 +1,5 @@
1
- import { _ as i } from "./DialogProvider.vue_vue_type_script_setup_true_lang-DdpepOBn.js";
2
- import { p as e } from "./plugin-NlTwzbQb.js";
1
+ import { _ as i } from "./DialogProvider.vue_vue_type_script_setup_true_lang-ByNINsSh.js";
2
+ import { p as e } from "./plugin-ndofoJoM.js";
3
3
  export {
4
4
  i as DialogProvider,
5
5
  e as DialogProviderPlugin
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as p, resolveComponent as t, openBlock as e, createElementBlock as n, Fragment as r, renderList as l, unref as s, createBlock as m, mergeProps as i } from "vue";
2
- import { u as d } from "./useDialog-BOJPIAnz.js";
2
+ import { u as d } from "./useDialog-jyWJVydI.js";
3
3
  const B = /* @__PURE__ */ p({
4
4
  name: "TDialogProvider",
5
5
  __name: "DialogProvider",
package/dist/Modal.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as r } from "./Modal.vue_vue_type_script_setup_true_lang-BULzzlLD.js";
2
- import { p } from "./plugin-BbE8ivq1.js";
1
+ import { _ as r } from "./Modal.vue_vue_type_script_setup_true_lang-NiSnflAO.js";
2
+ import { p } from "./plugin-CrSztC5r.js";
3
3
  export {
4
4
  r as Modal,
5
5
  p as ModalPlugin
@@ -1,18 +1,19 @@
1
- import { defineComponent as b, ref as h, onMounted as k, provide as v, resolveComponent as _, openBlock as t, createElementBlock as a, normalizeClass as r, withKeys as w, createBlock as n, createCommentVNode as l, createElementVNode as u, toDisplayString as C, renderSlot as i, resolveDynamicComponent as B, mergeProps as S } from "vue";
2
- import { _ as $ } from "./Backdrop.vue_vue_type_script_setup_true_lang-Dyo6_-EM.js";
3
- const x = {
1
+ import { defineComponent as b, ref as h, onMounted as k, provide as v, resolveComponent as _, openBlock as t, createElementBlock as a, normalizeClass as r, withKeys as w, createBlock as n, createCommentVNode as l, createElementVNode as u, toDisplayString as C, renderSlot as d, resolveDynamicComponent as B, mergeProps as S, toHandlers as $ } from "vue";
2
+ import { _ as x } from "./Backdrop.vue_vue_type_script_setup_true_lang-Dyo6_-EM.js";
3
+ const j = {
4
4
  key: 1,
5
5
  class: "p-4 border-b border-color"
6
- }, j = {
6
+ }, g = {
7
7
  key: 0,
8
8
  class: "block font-semibold uppercase"
9
- }, g = ["id"];
10
- let z = 0;
9
+ }, z = ["id"];
10
+ let H = 0;
11
11
  const F = /* @__PURE__ */ b({
12
12
  name: "TModal",
13
13
  __name: "Modal",
14
14
  props: {
15
15
  is: { default: void 0 },
16
+ on: { default: () => ({}) },
16
17
  props: { default: () => ({}) },
17
18
  title: { default: "" },
18
19
  canClose: { type: Boolean, default: !0 },
@@ -24,11 +25,11 @@ const F = /* @__PURE__ */ b({
24
25
  },
25
26
  emits: ["closed"],
26
27
  setup(p, { emit: f }) {
27
- const e = p, m = f, d = h(null), c = `tamandua-modal-${++z}`, s = (o) => {
28
+ const e = p, m = f, i = h(null), c = `tamandua-modal-${++H}`, s = (o) => {
28
29
  o?.stopPropagation(), m("closed");
29
30
  };
30
31
  return k(() => {
31
- d.value?.focus();
32
+ i.value?.focus();
32
33
  }), v("tamandua-modal-id", c), (o, M) => {
33
34
  const y = _("t-button");
34
35
  return t(), a("div", {
@@ -38,10 +39,10 @@ const F = /* @__PURE__ */ b({
38
39
  }]),
39
40
  tabindex: "-1",
40
41
  ref_key: "modal",
41
- ref: d,
42
+ ref: i,
42
43
  onKeyup: w(s, ["esc"])
43
44
  }, [
44
- e.hasBackdrop ? (t(), n($, {
45
+ e.hasBackdrop ? (t(), n(x, {
45
46
  key: 0,
46
47
  class: "z-10",
47
48
  onClick: s
@@ -60,9 +61,9 @@ const F = /* @__PURE__ */ b({
60
61
  class: "absolute justify-center top-0 right-0 h-14 w-14",
61
62
  onClick: s
62
63
  })) : l("", !0),
63
- e.showHeader ? (t(), a("div", x, [
64
- e.title ? (t(), a("span", j, C(e.title), 1)) : l("", !0),
65
- o.$slots.header ? i(o.$slots, "header", { key: 1 }) : l("", !0)
64
+ e.showHeader ? (t(), a("div", j, [
65
+ e.title ? (t(), a("span", g, C(e.title), 1)) : l("", !0),
66
+ o.$slots.header ? d(o.$slots, "header", { key: 1 }) : l("", !0)
66
67
  ])) : l("", !0),
67
68
  u("div", {
68
69
  class: r(["flex flex-col flex-1 overflow-y-auto scrollbar", {
@@ -70,15 +71,15 @@ const F = /* @__PURE__ */ b({
70
71
  }]),
71
72
  style: { "max-height": "80vh" }
72
73
  }, [
73
- e.is ? (t(), n(B(e.is), S({ key: 0 }, e.props, { onClosed: s }), null, 16)) : i(o.$slots, "default", { key: 1 })
74
+ e.is ? (t(), n(B(e.is), S({ key: 0 }, e.props, $(e.on), { onClosed: s }), null, 16)) : d(o.$slots, "default", { key: 1 })
74
75
  ], 2),
75
76
  e.showFooter || o.$slots.footer ? (t(), a("div", {
76
77
  key: 2,
77
78
  class: "flex flex-row items-center justify-between p-4 border-t border-color",
78
79
  id: `${c}-footer`
79
80
  }, [
80
- i(o.$slots, "footer")
81
- ], 8, g)) : l("", !0)
81
+ d(o.$slots, "footer")
82
+ ], 8, z)) : l("", !0)
82
83
  ], 2)
83
84
  ], 34);
84
85
  };
@@ -1,10 +1,10 @@
1
- import { _ as e } from "./Alert.vue_vue_type_script_setup_true_lang-CAGHRWvs.js";
1
+ import { _ as e } from "./Alert.vue_vue_type_script_setup_true_lang-BBRsz4y8.js";
2
2
  import { _ as p } from "./Avatar.vue_vue_type_script_setup_true_lang-ruTtveHD.js";
3
3
  import { _ as s } from "./Backdrop.vue_vue_type_script_setup_true_lang-Dyo6_-EM.js";
4
4
  import { _ as f } from "./Button.vue_vue_type_script_setup_true_lang-zvMC7Ucn.js";
5
5
  import { _ as n } from "./ChartLine.vue_vue_type_style_index_0_lang-DO_gKCe4.js";
6
6
  import { _ as u } from "./ChartTreemap.vue_vue_type_script_setup_true_lang-CLi_IXfP.js";
7
- import { _ as l } from "./DialogProvider.vue_vue_type_script_setup_true_lang-DdpepOBn.js";
7
+ import { _ as l } from "./DialogProvider.vue_vue_type_script_setup_true_lang-ByNINsSh.js";
8
8
  import { D as c } from "./Drawer-y5xBARd2.js";
9
9
  import { _ as T } from "./Dropdown.vue_vue_type_script_setup_true_lang-BSnpkGOU.js";
10
10
  import { _ as d } from "./FileDrop.vue_vue_type_script_setup_true_lang-Bq0lAgZ7.js";
@@ -32,7 +32,7 @@ import { _ as sr } from "./InputSwitch.vue_vue_type_script_setup_true_lang-BVGfQ
32
32
  import { _ as fr } from "./InputText.vue_vue_type_script_setup_true_lang-D2cGaq7X.js";
33
33
  import { _ as nr } from "./InputTextarea.vue_vue_type_script_setup_true_lang-C8f2hfeZ.js";
34
34
  import { _ as ur } from "./Link.vue_vue_type_script_setup_true_lang-BFFw1dPV.js";
35
- import { _ as lr } from "./Modal.vue_vue_type_script_setup_true_lang-BULzzlLD.js";
35
+ import { _ as lr } from "./Modal.vue_vue_type_script_setup_true_lang-NiSnflAO.js";
36
36
  import { _ as cr } from "./ModalForm.vue_vue_type_script_setup_true_lang-C1Xl4TmQ.js";
37
37
  import { _ as Tr } from "./Pagination.vue_vue_type_script_setup_true_lang-BCQUrEVO.js";
38
38
  import { _ as dr } from "./Popconfirm.vue_vue_type_script_setup_true_lang-CR0OJ8Ao.js";
@@ -1,6 +1,6 @@
1
1
  import { ref as o, getCurrentInstance as l } from "vue";
2
2
  import { u as O } from "./useClipboard-BHFD0Jvv.js";
3
- import { u as R } from "./useDialog-BOJPIAnz.js";
3
+ import { u as R } from "./useDialog-jyWJVydI.js";
4
4
  const f = 640, d = 768, c = 1024, n = o(window.innerWidth), s = o(!1), i = o(!1), a = o(!1), u = (e) => {
5
5
  n.value = e ? e.target.innerWidth : window.innerWidth, s.value = n.value >= f, i.value = n.value >= d, a.value = n.value >= c;
6
6
  };
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./Alert.vue_vue_type_script_setup_true_lang-CAGHRWvs.js";
2
+ import { _ as s } from "./Alert.vue_vue_type_script_setup_true_lang-BBRsz4y8.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./Modal.vue_vue_type_script_setup_true_lang-BULzzlLD.js";
2
+ import { _ as s } from "./Modal.vue_vue_type_script_setup_true_lang-NiSnflAO.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./DialogProvider.vue_vue_type_script_setup_true_lang-DdpepOBn.js";
2
+ import { _ as s } from "./DialogProvider.vue_vue_type_script_setup_true_lang-ByNINsSh.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -1,5 +1,5 @@
1
1
  import "vue";
2
- import { p } from "./plugin-W9_PLHv4.js";
2
+ import { p } from "./plugin-BXHzcN55.js";
3
3
  import "./Avatar.vue_vue_type_script_setup_true_lang-ruTtveHD.js";
4
4
  import { p as i } from "./plugin-BFtH9rXg.js";
5
5
  import { p as r } from "./plugin-AU2qI2I9.js";
@@ -9,8 +9,8 @@ import "./transform-DSaNEFMr.js";
9
9
  import "./ChartLine.vue_vue_type_style_index_0_lang-DO_gKCe4.js";
10
10
  import { p as n } from "./plugin-DDXOF4cU.js";
11
11
  import { p as m } from "./plugin-CyDnzy2n.js";
12
- import "./useDialog-BOJPIAnz.js";
13
- import { p as t } from "./plugin-NlTwzbQb.js";
12
+ import "./useDialog-jyWJVydI.js";
13
+ import { p as t } from "./plugin-ndofoJoM.js";
14
14
  import "./Drawer-y5xBARd2.js";
15
15
  import { p as u } from "./plugin-JMSzJgz5.js";
16
16
  import "./Dropdown.vue_vue_type_script_setup_true_lang-BSnpkGOU.js";
@@ -49,7 +49,7 @@ import { p as F } from "./plugin-cOJ_nFaw.js";
49
49
  import "./Link.vue_vue_type_script_setup_true_lang-BFFw1dPV.js";
50
50
  import { p as A } from "./plugin-bSqyo8FU.js";
51
51
  import { p as L } from "./plugin-uxc8N8iO.js";
52
- import { p as M } from "./plugin-BbE8ivq1.js";
52
+ import { p as M } from "./plugin-CrSztC5r.js";
53
53
  import { p as _ } from "./plugin-jyvJNavM.js";
54
54
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-CR0OJ8Ao.js";
55
55
  import { p as j } from "./plugin-Bhokj2iJ.js";
package/dist/plugins.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "vue";
2
- import { p as D } from "./plugin-W9_PLHv4.js";
2
+ import { p as D } from "./plugin-BXHzcN55.js";
3
3
  import "./Avatar.vue_vue_type_script_setup_true_lang-ruTtveHD.js";
4
4
  import { p as S } from "./plugin-BFtH9rXg.js";
5
5
  import { p as w } from "./plugin-AU2qI2I9.js";
@@ -9,8 +9,8 @@ import "./transform-DSaNEFMr.js";
9
9
  import "./ChartLine.vue_vue_type_style_index_0_lang-DO_gKCe4.js";
10
10
  import { p as M } from "./plugin-DDXOF4cU.js";
11
11
  import { p as E } from "./plugin-CyDnzy2n.js";
12
- import "./useDialog-BOJPIAnz.js";
13
- import { p as j } from "./plugin-NlTwzbQb.js";
12
+ import "./useDialog-jyWJVydI.js";
13
+ import { p as j } from "./plugin-ndofoJoM.js";
14
14
  import "./Drawer-y5xBARd2.js";
15
15
  import { p as z } from "./plugin-JMSzJgz5.js";
16
16
  import "./Dropdown.vue_vue_type_script_setup_true_lang-BSnpkGOU.js";
@@ -49,7 +49,7 @@ import { p as Mr } from "./plugin-cOJ_nFaw.js";
49
49
  import "./Link.vue_vue_type_script_setup_true_lang-BFFw1dPV.js";
50
50
  import { p as Er } from "./plugin-bSqyo8FU.js";
51
51
  import { p as jr } from "./plugin-uxc8N8iO.js";
52
- import { p as zr } from "./plugin-BbE8ivq1.js";
52
+ import { p as zr } from "./plugin-CrSztC5r.js";
53
53
  import { p as Jr } from "./plugin-jyvJNavM.js";
54
54
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-CR0OJ8Ao.js";
55
55
  import { p as Nr } from "./plugin-Bhokj2iJ.js";
package/dist/tamandua.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as n } from "./plugins-iuR3SgQL.js";
1
+ import { p as n } from "./plugins-DVANxwGD.js";
2
2
  const o = {
3
3
  install(s) {
4
4
  for (const i in n)
@@ -9,9 +9,9 @@ export declare const Alert: (args: any) => {
9
9
  open: import('vue').Ref<boolean>;
10
10
  title: import('vue').Ref<string>;
11
11
  message: import('vue').Ref<string>;
12
- confirm: import('vue').Ref<boolean>;
12
+ type: string;
13
13
  alert: (options: import('./types.js').AlertProps & {
14
- onConfirm?: () => void;
14
+ onConfirm?: (confirmation?: string) => void;
15
15
  onClose?: () => void;
16
16
  }) => void;
17
17
  };
@@ -4,32 +4,35 @@ declare function __VLS_template(): {
4
4
  default?(_: {}): any;
5
5
  };
6
6
  declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<AlertProps>, {
7
+ type: string;
7
8
  title: string;
8
9
  message: string;
9
- confirm: boolean;
10
10
  closeTitle: string;
11
11
  cancelTitle: string;
12
12
  confirmTitle: string;
13
+ confirmationValue: string;
13
14
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
15
  closed: (val?: any) => void;
15
- confirmed: () => void;
16
+ confirmed: (val?: string | undefined) => void;
16
17
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<AlertProps>, {
18
+ type: string;
17
19
  title: string;
18
20
  message: string;
19
- confirm: boolean;
20
21
  closeTitle: string;
21
22
  cancelTitle: string;
22
23
  confirmTitle: string;
24
+ confirmationValue: string;
23
25
  }>>> & {
24
26
  onClosed?: ((val?: any) => any) | undefined;
25
- onConfirmed?: (() => any) | undefined;
27
+ onConfirmed?: ((val?: string | undefined) => any) | undefined;
26
28
  }, {
29
+ type: "alert" | "confirm" | "type-confirm";
27
30
  title: string;
28
31
  message: string | string[];
29
- confirm: boolean;
30
32
  closeTitle: string;
31
33
  cancelTitle: string;
32
34
  confirmTitle: string;
35
+ confirmationValue: string;
33
36
  }, {}>;
34
37
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
35
38
  export default _default;
@@ -1,12 +1,42 @@
1
1
  export type AlertProps = {
2
+ /**
3
+ * Type of alert.
4
+ *
5
+ * 'alert' - Simple alert with a close button.
6
+ * 'confirm' - Confirmation alert with confirm and cancel buttons.
7
+ * 'type-confirm' - Confirmation alert where the user must type a
8
+ * specific value to confirm the action.
9
+ */
10
+ type?: "alert" | "confirm" | "type-confirm";
11
+ /**
12
+ * Alert title.
13
+ */
2
14
  title?: string;
15
+ /**
16
+ * Alert message.
17
+ */
3
18
  message?: string | string[];
4
- confirm?: boolean;
19
+ /**
20
+ * Title for the close button, in case of 'alert' type.
21
+ */
5
22
  closeTitle?: string;
23
+ /**
24
+ * Title for the cancel button, in case of 'confirm' or 'type-confirm'
25
+ * type.
26
+ */
6
27
  cancelTitle?: string;
28
+ /**
29
+ * Title for the confirm button, in case of 'confirm' or 'type-confirm'
30
+ * type.
31
+ */
7
32
  confirmTitle?: string;
33
+ /**
34
+ * If type is 'type-confirm', the user must type this value to confirm
35
+ * the action.
36
+ */
37
+ confirmationValue?: string;
8
38
  };
9
39
  export type AlertEvents = {
10
40
  (e: "closed", val?: any): void;
11
- (e: "confirmed"): void;
41
+ (e: "confirmed", val?: string): void;
12
42
  };
@@ -21,7 +21,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
21
21
  "onUpdate:model-value"?: ((value: any[]) => any) | undefined;
22
22
  }, {
23
23
  size: `${FormControlSize}`;
24
- component: import("vue").Component | "t-input-text" | "t-input-phone";
24
+ component: "t-input-text" | import("vue").Component | "t-input-phone";
25
25
  inputProps: any;
26
26
  listeners: {
27
27
  [key: string]: (...args: any[]) => void;
@@ -2,6 +2,7 @@ import { ModalProps } from './types.js';
2
2
 
3
3
  declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ModalProps>, {
4
4
  is: undefined;
5
+ on: () => {};
5
6
  props: () => {};
6
7
  title: string;
7
8
  canClose: boolean;
@@ -18,6 +19,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
18
19
  closed: () => void;
19
20
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ModalProps>, {
20
21
  is: undefined;
22
+ on: () => {};
21
23
  props: () => {};
22
24
  title: string;
23
25
  canClose: boolean;
@@ -36,6 +38,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
36
38
  title: string;
37
39
  props: Record<string, any>;
38
40
  is: import("vue").Component;
41
+ on: Record<string, (...args: any[]) => void>;
39
42
  canClose: boolean;
40
43
  showHeader: boolean;
41
44
  showFooter: boolean;
@@ -5,6 +5,10 @@ export type ModalProps = {
5
5
  * Component to be rendered inside the modal body
6
6
  */
7
7
  is?: Component;
8
+ /**
9
+ * Events to be bound to the body component
10
+ */
11
+ on?: Record<string, (...args: any[]) => void>;
8
12
  /**
9
13
  * Body component props
10
14
  */
@@ -5,7 +5,7 @@ type ModalOptions = ModalProps & {
5
5
  onClose?: () => void;
6
6
  };
7
7
  type AlertOptions = AlertProps & {
8
- onConfirm?: () => void;
8
+ onConfirm?: (confirmation?: string) => void;
9
9
  onClose?: () => void;
10
10
  };
11
11
  export default function useDialog(): {
@@ -216,6 +216,7 @@ export default function useDialog(): {
216
216
  }[] | undefined;
217
217
  __INTLIFY_META__?: string | undefined;
218
218
  } | undefined;
219
+ on?: Record<string, (...args: any[]) => void> | undefined;
219
220
  props?: Record<string, any> | undefined;
220
221
  title?: string | undefined;
221
222
  canClose?: boolean | undefined;
@@ -431,6 +432,7 @@ export default function useDialog(): {
431
432
  }[] | undefined;
432
433
  __INTLIFY_META__?: string | undefined;
433
434
  } | undefined;
435
+ on?: Record<string, (...args: any[]) => void> | undefined;
434
436
  props?: Record<string, any> | undefined;
435
437
  title?: string | undefined;
436
438
  canClose?: boolean | undefined;
@@ -445,23 +447,25 @@ export default function useDialog(): {
445
447
  alerts: import('vue').Ref<{
446
448
  id: string;
447
449
  events: {
450
+ type?: "alert" | "confirm" | "type-confirm" | undefined;
448
451
  title?: string | undefined;
449
452
  message?: string | string[] | undefined;
450
- confirm?: boolean | undefined;
451
453
  closeTitle?: string | undefined;
452
454
  cancelTitle?: string | undefined;
453
455
  confirmTitle?: string | undefined;
454
- onConfirm?: (() => void) | undefined;
456
+ confirmationValue?: string | undefined;
457
+ onConfirm?: ((confirmation?: string) => void) | undefined;
455
458
  onClose?: (() => void) | undefined;
456
459
  };
457
460
  options: {
461
+ type?: "alert" | "confirm" | "type-confirm" | undefined;
458
462
  title?: string | undefined;
459
463
  message?: string | string[] | undefined;
460
- confirm?: boolean | undefined;
461
464
  closeTitle?: string | undefined;
462
465
  cancelTitle?: string | undefined;
463
466
  confirmTitle?: string | undefined;
464
- onConfirm?: (() => void) | undefined;
467
+ confirmationValue?: string | undefined;
468
+ onConfirm?: ((confirmation?: string) => void) | undefined;
465
469
  onClose?: (() => void) | undefined;
466
470
  };
467
471
  }[]>;
@@ -1,6 +1,6 @@
1
- import { ref as c, markRaw as r } from "vue";
1
+ import { ref as c, markRaw as d } from "vue";
2
2
  const i = c([]), t = c([]);
3
- function u() {
3
+ function m() {
4
4
  const a = () => Date.now().toString(), l = (e, n) => {
5
5
  const s = e.findIndex((o) => o.id === n);
6
6
  s !== -1 && e.splice(s, 1);
@@ -14,7 +14,7 @@ function u() {
14
14
  e?.onClose && e.onClose(), l(i.value, n);
15
15
  }
16
16
  }, o = { ...e };
17
- delete o?.onClose, "is" in o && o.is && (o.is = r(o.is)), i.value.push({
17
+ delete o?.onClose, "is" in o && o.is && (o.is = d(o.is)), i.value.push({
18
18
  id: n,
19
19
  events: s,
20
20
  options: o
@@ -25,8 +25,8 @@ function u() {
25
25
  onClose: () => {
26
26
  e?.onClose && e.onClose(), l(t.value, n);
27
27
  },
28
- onConfirm: () => {
29
- e?.onConfirm && e.onConfirm(), l(t.value, n);
28
+ onConfirm: (r) => {
29
+ e?.onConfirm && e.onConfirm(r), l(t.value, n);
30
30
  }
31
31
  }, o = { ...e };
32
32
  delete o?.onClose, delete o?.onConfirm, t.value.push({
@@ -38,5 +38,5 @@ function u() {
38
38
  };
39
39
  }
40
40
  export {
41
- u
41
+ m as u
42
42
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caipira/tamandua",
3
- "version": "0.0.102",
3
+ "version": "0.0.104",
4
4
  "private": false,
5
5
  "description": "UI library for the Caipira ecosystem",
6
6
  "license": "GPL-3.0-only",
@@ -13,6 +13,10 @@
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/caipira-io/tamandua.git"
15
15
  },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "registry": "https://registry.npmjs.org/"
19
+ },
16
20
  "type": "module",
17
21
  "typesVersions": {
18
22
  "*": {
@@ -1,67 +0,0 @@
1
- import { defineComponent as b, computed as h, resolveComponent as i, openBlock as t, createBlock as k, withCtx as m, createElementBlock as n, Fragment as d, createVNode as a, renderSlot as y, createElementVNode as s, toDisplayString as T } from "vue";
2
- const g = {
3
- key: 1,
4
- class: "p-4"
5
- }, v = { class: "font-semibold" }, w = ["innerHTML"], A = /* @__PURE__ */ s("div", null, null, -1), E = /* @__PURE__ */ b({
6
- name: "TAlert",
7
- __name: "Alert",
8
- props: {
9
- title: { default: "Confirm action" },
10
- message: { default: "Do you want to proceed with this action?" },
11
- confirm: { type: Boolean, default: !1 },
12
- closeTitle: { default: "Close" },
13
- cancelTitle: { default: "Cancel" },
14
- confirmTitle: { default: "Confirm" }
15
- },
16
- emits: ["closed", "confirmed"],
17
- setup(f, { emit: u }) {
18
- const e = f, c = u, o = () => {
19
- c("closed");
20
- }, p = () => {
21
- c("confirmed");
22
- }, _ = h(() => Array.isArray(e.message) ? e.message.join("<br /><br />") : e.message || "");
23
- return (r, B) => {
24
- const l = i("t-button"), C = i("t-modal");
25
- return t(), k(C, {
26
- "show-header": !1,
27
- "can-close": !1,
28
- onClosed: o
29
- }, {
30
- footer: m(() => [
31
- e.confirm ? (t(), n(d, { key: 0 }, [
32
- a(l, {
33
- variant: "transparent",
34
- label: e.cancelTitle,
35
- onClick: o
36
- }, null, 8, ["label"]),
37
- a(l, {
38
- variant: "default",
39
- label: e.confirmTitle,
40
- onClick: p
41
- }, null, 8, ["label"])
42
- ], 64)) : (t(), n(d, { key: 1 }, [
43
- A,
44
- a(l, {
45
- variant: "transparent",
46
- label: e.closeTitle,
47
- onClick: o
48
- }, null, 8, ["label"])
49
- ], 64))
50
- ]),
51
- default: m(() => [
52
- r.$slots.default ? y(r.$slots, "default", { key: 0 }) : (t(), n("div", g, [
53
- s("h3", v, T(e.title), 1),
54
- s("p", {
55
- innerHTML: _.value,
56
- class: "mt-4"
57
- }, null, 8, w)
58
- ]))
59
- ]),
60
- _: 3
61
- });
62
- };
63
- }
64
- });
65
- export {
66
- E as _
67
- };