@caipira/tamandua 0.0.103 → 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",
@@ -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";
@@ -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 "./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";
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";
package/dist/tamandua.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as n } from "./plugins-CVA2j6EE.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;
@@ -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(): {
@@ -447,23 +447,25 @@ export default function useDialog(): {
447
447
  alerts: import('vue').Ref<{
448
448
  id: string;
449
449
  events: {
450
+ type?: "alert" | "confirm" | "type-confirm" | undefined;
450
451
  title?: string | undefined;
451
452
  message?: string | string[] | undefined;
452
- confirm?: boolean | undefined;
453
453
  closeTitle?: string | undefined;
454
454
  cancelTitle?: string | undefined;
455
455
  confirmTitle?: string | undefined;
456
- onConfirm?: (() => void) | undefined;
456
+ confirmationValue?: string | undefined;
457
+ onConfirm?: ((confirmation?: string) => void) | undefined;
457
458
  onClose?: (() => void) | undefined;
458
459
  };
459
460
  options: {
461
+ type?: "alert" | "confirm" | "type-confirm" | undefined;
460
462
  title?: string | undefined;
461
463
  message?: string | string[] | undefined;
462
- confirm?: boolean | undefined;
463
464
  closeTitle?: string | undefined;
464
465
  cancelTitle?: string | undefined;
465
466
  confirmTitle?: string | undefined;
466
- onConfirm?: (() => void) | undefined;
467
+ confirmationValue?: string | undefined;
468
+ onConfirm?: ((confirmation?: string) => void) | undefined;
467
469
  onClose?: (() => void) | undefined;
468
470
  };
469
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.103",
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
- };