@caipira/tamandua 0.0.15 → 0.0.16

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.
@@ -0,0 +1,6 @@
1
+ import { _ as o } from "./Button.vue_vue_type_style_index_0_scoped_a7163a38_lang-D-r4SBjw.js";
2
+ import { _ as a } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
+ const s = /* @__PURE__ */ a(o, [["__scopeId", "data-v-a7163a38"]]);
4
+ export {
5
+ s as B
6
+ };
package/dist/Button.css CHANGED
@@ -1 +1 @@
1
- .transparent-button[data-v-39c3f26a]:hover{background-color:rgb(from var(--caipira-primary) r g b / 45%)}
1
+ .transparent-button[data-v-a7163a38]:hover{background-color:rgb(from var(--caipira-primary) r g b / 45%)}
package/dist/Button.js CHANGED
@@ -1,5 +1,5 @@
1
- import { B as r } from "./Button-zA2axPFA.js";
2
- import { p } from "./plugin-zLwlm_b-.js";
1
+ import { B as r } from "./Button-DeCF4Zyy.js";
2
+ import { p } from "./plugin-COLD82gG.js";
3
3
  export {
4
4
  r as Button,
5
5
  p as ButtonPlugin
@@ -0,0 +1,148 @@
1
+ import './Button.css';
2
+ import { defineComponent as D, getCurrentInstance as I, ref as v, computed as n, resolveComponent as N, openBlock as s, createBlock as f, resolveDynamicComponent as w, normalizeClass as y, unref as r, withCtx as x, renderSlot as M, createCommentVNode as p, createElementBlock as b, Fragment as F, createTextVNode as G, toDisplayString as k } from "vue";
3
+ import { u as P } from "./useDomHelpers-5CFMo6bx.js";
4
+ import { c as t, a as i, b as u, B as a } from "./ui-D3dPdT4S.js";
5
+ import "./Icon.vue_vue_type_script_setup_true_lang-CqJ-D4BM.js";
6
+ const X = ["multiple"], H = /* @__PURE__ */ D({
7
+ name: "TButton",
8
+ __name: "Button",
9
+ props: {
10
+ icon: {},
11
+ type: { default: t.BUTTON },
12
+ size: { default: i.DEFAULT },
13
+ label: { default: "" },
14
+ shape: { default: u.ROUNDED },
15
+ variant: { default: a.DEFAULT },
16
+ outline: { type: Boolean, default: !1 },
17
+ multiple: { type: Boolean, default: !1 },
18
+ disabled: { type: Boolean, default: !1 },
19
+ sizeClass: { default: "" }
20
+ },
21
+ emits: ["upload"],
22
+ setup(h, { expose: A, emit: E }) {
23
+ const e = h, L = E, c = I(), d = v(), m = v(null), { isPopoverActivator: R, onPopoverActivatorClick: T } = P(), g = n(() => {
24
+ switch (e.type) {
25
+ case t.SUBMIT:
26
+ return "submit";
27
+ case t.BUTTON:
28
+ case t.FILE:
29
+ default:
30
+ return "button";
31
+ }
32
+ }), C = n(() => e.type === t.SUBMIT ? e.label : void 0), S = n(() => {
33
+ switch (e.type) {
34
+ case t.SUBMIT:
35
+ return "input";
36
+ case t.BUTTON:
37
+ case t.FILE:
38
+ default:
39
+ return "button";
40
+ }
41
+ }), z = (o) => {
42
+ c && R(c) && T(o, c), e.type === t.SUBMIT && o.preventDefault(), e.type === t.FILE && d.value?.click();
43
+ }, U = (o) => {
44
+ o.stopPropagation();
45
+ const l = o.target.files;
46
+ !l || !l.length || L("upload", l);
47
+ }, _ = n(() => {
48
+ switch (e.size) {
49
+ case i.EXTRA_SMALL:
50
+ return 12;
51
+ case i.SMALL:
52
+ return 16;
53
+ case i.DEFAULT:
54
+ return 20;
55
+ case i.LARGE:
56
+ return 24;
57
+ case i.EXTRA_LARGE:
58
+ return 28;
59
+ default:
60
+ return 20;
61
+ }
62
+ });
63
+ return A({ iconReference: m }), (o, B) => {
64
+ const l = N("t-icon");
65
+ return s(), f(w(S.value), {
66
+ type: g.value,
67
+ value: C.value,
68
+ disabled: e.disabled,
69
+ class: y([{
70
+ // Size
71
+ "text-xs px-2 h-4": !e.sizeClass && e.size === r(i).EXTRA_SMALL,
72
+ "text-sm px-3 h-7": !e.sizeClass && e.size === r(i).SMALL,
73
+ "text-base px-4 h-9": !e.sizeClass && e.size === r(i).DEFAULT,
74
+ "text-lg px-5 h-12": !e.sizeClass && e.size === r(i).LARGE,
75
+ "text-xl px-6 h-14": !e.sizeClass && e.size === r(i).EXTRA_LARGE,
76
+ [e.sizeClass]: !0,
77
+ // Border
78
+ border: e.outline,
79
+ // Shape
80
+ "rounded-full": e.shape === r(u).CIRCLE,
81
+ "input-roundness": e.shape === r(u).ROUNDED,
82
+ // Disabled
83
+ "cursor-not-allowed opacity-50": e.disabled,
84
+ // Default color
85
+ "border-caipira-primary-inverted fill-caipira-primary-inverted": e.variant === r(a).DEFAULT,
86
+ "bg-transparent color-caipira-primary-inverted hover:bg-caipira-primary-inverted hover:color-caipira-primary hover:fill-white": e.variant === r(a).DEFAULT && e.outline,
87
+ "bg-caipira-primary-inverted color-caipira-primary": e.variant === r(a).DEFAULT && !e.outline,
88
+ // Primary color
89
+ "fill-caipira-primary": e.variant === r(a).PRIMARY,
90
+ "bg-transparent border-caipira-blue color-caipira-blue hover:bg-caipira-blue hover:color-caipira-primary hover:fill-white": e.variant === r(a).PRIMARY && e.outline,
91
+ "bg-caipira-blue color-caipira-primary": e.variant === r(a).PRIMARY && !e.outline,
92
+ // Success color
93
+ "fill-caipira-green": e.variant === r(a).SUCCESS,
94
+ "bg-transparent border-caipira-green color-caipira-green hover:bg-caipira-green hover:color-caipira-primary hover:fill-white": e.variant === r(a).SUCCESS && e.outline,
95
+ "bg-caipira-green color-caipira-primary": e.variant === r(a).SUCCESS && !e.outline,
96
+ // Warning color
97
+ "fill-caipira-yellow": e.variant === r(a).WARNING,
98
+ "bg-transparent border-caipira-yellow color-caipira-yellow hover:bg-caipira-yellow hover:color-caipira-primary hover:fill-white": e.variant === r(a).WARNING && e.outline,
99
+ "bg-caipira-yellow color-caipira-primary": e.variant === r(a).WARNING && !e.outline,
100
+ // Danger color
101
+ "fill-caipira-red": e.variant === r(a).DANGER,
102
+ "bg-transparent border-caipira-red color-caipira-red hover:bg-caipira-red hover:color-caipira-primary hover:fill-white": e.variant === r(a).DANGER && e.outline,
103
+ "bg-caipira-red color-caipira-primary": e.variant === r(a).DANGER && !e.outline,
104
+ // Link
105
+ "color-caipira-primary-inverted underline font-bold": e.variant === r(a).LINK,
106
+ // Transparent
107
+ "transparent-button": e.variant === r(a).TRANSPARENT
108
+ }, "input-outline flex items-center select-none whitespace-nowrap"]),
109
+ role: "button",
110
+ onClick: z
111
+ }, {
112
+ default: x(() => [
113
+ M(o.$slots, "default", {}, void 0, !0),
114
+ e.icon ? (s(), f(l, {
115
+ key: 0,
116
+ ref_key: "iconReference",
117
+ ref: m,
118
+ size: _.value,
119
+ icon: e.icon,
120
+ class: y({
121
+ "mr-1": e.size === r(i).EXTRA_SMALL,
122
+ "mr-1.5": e.size === r(i).SMALL,
123
+ "mr-2": e.size === r(i).DEFAULT,
124
+ "mr-2.5": e.size === r(i).LARGE,
125
+ "mr-3": e.size === r(i).EXTRA_LARGE
126
+ })
127
+ }, null, 8, ["size", "icon", "class"])) : p("", !0),
128
+ e.label && e.type !== r(t).SUBMIT ? (s(), b(F, { key: 1 }, [
129
+ G(k(e.label), 1)
130
+ ], 64)) : p("", !0),
131
+ e.type === "file" ? (s(), b("input", {
132
+ key: 2,
133
+ multiple: e.multiple,
134
+ type: "file",
135
+ ref_key: "fileInput",
136
+ ref: d,
137
+ class: "hidden",
138
+ onChange: U
139
+ }, null, 40, X)) : p("", !0)
140
+ ]),
141
+ _: 3
142
+ }, 8, ["type", "value", "disabled", "class"]);
143
+ };
144
+ }
145
+ });
146
+ export {
147
+ H as _
148
+ };
@@ -1,5 +1,5 @@
1
- import { _ as p } from "./ButtonCopy.vue_vue_type_script_setup_true_lang-hBqHMiGU.js";
2
- import { p as n } from "./plugin-CqcekUXz.js";
1
+ import { _ as p } from "./ButtonCopy.vue_vue_type_script_setup_true_lang-DmgukPA3.js";
2
+ import { p as n } from "./plugin-DUL0zZRF.js";
3
3
  export {
4
4
  p as ButtonCopy,
5
5
  n as ButtonCopyPlugin
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as u, ref as c, resolveComponent as f, openBlock as m, createBlock as y } from "vue";
2
2
  import { g as i } from "./index-CVD_wAsU.js";
3
3
  import { u as _ } from "./useClipboard-BHFD0Jvv.js";
4
- import "./Button.vue_vue_type_style_index_0_scoped_39c3f26a_lang-tn6M5dNB.js";
4
+ import "./Button.vue_vue_type_style_index_0_scoped_a7163a38_lang-D-r4SBjw.js";
5
5
  const v = /* @__PURE__ */ u({
6
6
  name: "TButtonCopy",
7
7
  __name: "ButtonCopy",
@@ -1,5 +1,5 @@
1
- import { _ as s } from "./InputPassword.vue_vue_type_script_setup_true_lang-DvHndXqE.js";
2
- import { p as a } from "./plugin-Duvcbc38.js";
1
+ import { _ as s } from "./InputPassword.vue_vue_type_script_setup_true_lang-OXLtnWrh.js";
2
+ import { p as a } from "./plugin-BT8Zxuqh.js";
3
3
  export {
4
4
  s as InputPassword,
5
5
  a as InputPasswordPlugin
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as ee, ref as S, inject as te, watch as ne, resolveComponent as O, openBlock as k, createElementBlock as L, normalizeClass as T, unref as U, createElementVNode as P, createVNode as q, createCommentVNode as N, withKeys as le, createBlock as se, toDisplayString as oe } from "vue";
2
- import { _ as ae } from "./ButtonCopy.vue_vue_type_script_setup_true_lang-hBqHMiGU.js";
2
+ import { _ as ae } from "./ButtonCopy.vue_vue_type_script_setup_true_lang-DmgukPA3.js";
3
3
  import { f as re } from "./index-CjvqeRf7.js";
4
4
  const ie = (s) => {
5
5
  let e = 0, r = 0, l = 0, i = 0, o = 0, u = 0, m = 0, p = 0, f = 0, I = 0, c = 0, x = 0, y = 0, b = 0, M = 0, _ = 0, n = 0, d = 0, A = 2, V = 2, R = 2, g = 2, E = 3, K = 3, D = 3, W = 4, Z = 4, G = 6, B = "", $ = "", j = "", C = "Too Short";
@@ -1,7 +1,7 @@
1
1
  import { _ as a } from "./Avatar.vue_vue_type_script_setup_true_lang-BZy_UetF.js";
2
2
  import { _ as p } from "./Backdrop.vue_vue_type_script_setup_true_lang-OaEBTmYK.js";
3
- import { B as s } from "./Button-zA2axPFA.js";
4
- import { _ as f } from "./ButtonCopy.vue_vue_type_script_setup_true_lang-hBqHMiGU.js";
3
+ import { B as s } from "./Button-DeCF4Zyy.js";
4
+ import { _ as f } from "./ButtonCopy.vue_vue_type_script_setup_true_lang-DmgukPA3.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-CG5aK3KH.js";
7
7
  import { D as l } from "./Drawer-omdZnBPG.js";
@@ -21,7 +21,7 @@ import { _ as H } from "./InputCheckbox.vue_vue_type_script_setup_true_lang-B5zo
21
21
  import { _ as K } from "./InputColor.vue_vue_type_script_setup_true_lang-CZ0o-B7I.js";
22
22
  import { _ as O } from "./InputDate.vue_vue_type_script_setup_true_lang-D1H0urIZ.js";
23
23
  import { _ as U } from "./InputMultiplier.vue_vue_type_script_setup_true_lang-w2RuSz1R.js";
24
- import { _ as W } from "./InputPassword.vue_vue_type_script_setup_true_lang-DvHndXqE.js";
24
+ import { _ as W } from "./InputPassword.vue_vue_type_script_setup_true_lang-OXLtnWrh.js";
25
25
  import { _ as Y } from "./InputPhone.vue_vue_type_script_setup_true_lang-uNqXphQY.js";
26
26
  import { _ as $ } from "./InputPrice.vue_vue_type_script_setup_true_lang-BBi8qKn8.js";
27
27
  import { _ as or } from "./InputRadio.vue_vue_type_script_setup_true_lang-Dqbov2kN.js";
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./InputPassword.vue_vue_type_script_setup_true_lang-DvHndXqE.js";
2
+ import { _ as s } from "./InputPassword.vue_vue_type_script_setup_true_lang-OXLtnWrh.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -1,5 +1,5 @@
1
1
  import { r as t } from "./register-component-B-fdqewb.js";
2
- import { B as r } from "./Button-zA2axPFA.js";
2
+ import { B as r } from "./Button-DeCF4Zyy.js";
3
3
  const s = {
4
4
  install(o) {
5
5
  t(o, r);
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./ButtonCopy.vue_vue_type_script_setup_true_lang-hBqHMiGU.js";
2
+ import { _ as s } from "./ButtonCopy.vue_vue_type_script_setup_true_lang-DmgukPA3.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -2,9 +2,9 @@ import "./Avatar.vue_vue_type_script_setup_true_lang-BZy_UetF.js";
2
2
  import { p } from "./plugin-DyiLV5Qf.js";
3
3
  import "vue";
4
4
  import { p as i } from "./plugin-C-iGigb_.js";
5
- import "./Button.vue_vue_type_style_index_0_scoped_39c3f26a_lang-tn6M5dNB.js";
6
- import { p as o } from "./plugin-zLwlm_b-.js";
7
- import { p as r } from "./plugin-CqcekUXz.js";
5
+ import "./Button.vue_vue_type_style_index_0_scoped_a7163a38_lang-D-r4SBjw.js";
6
+ import { p as o } from "./plugin-COLD82gG.js";
7
+ import { p as r } from "./plugin-DUL0zZRF.js";
8
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";
@@ -31,7 +31,7 @@ import { p as y } from "./plugin-DaibhM02.js";
31
31
  import { p as b } from "./plugin-DppW8rQi.js";
32
32
  import { p as d } from "./plugin-DkDbha5K.js";
33
33
  import { p as T } from "./plugin-2nTovNcx.js";
34
- import { p as C } from "./plugin-Duvcbc38.js";
34
+ import { p as C } from "./plugin-BT8Zxuqh.js";
35
35
  import { p as v } from "./plugin-CGg5IOSy.js";
36
36
  import { p as G } from "./plugin-C3tFXHbZ.js";
37
37
  import { p as S } from "./plugin-BrwUi1gG.js";
package/dist/plugins.js CHANGED
@@ -2,9 +2,9 @@ import "./Avatar.vue_vue_type_script_setup_true_lang-BZy_UetF.js";
2
2
  import { p as y } from "./plugin-DyiLV5Qf.js";
3
3
  import "vue";
4
4
  import { p as C } from "./plugin-C-iGigb_.js";
5
- import "./Button.vue_vue_type_style_index_0_scoped_39c3f26a_lang-tn6M5dNB.js";
6
- import { p as G } from "./plugin-zLwlm_b-.js";
7
- import { p as w } from "./plugin-CqcekUXz.js";
5
+ import "./Button.vue_vue_type_style_index_0_scoped_a7163a38_lang-D-r4SBjw.js";
6
+ import { p as G } from "./plugin-COLD82gG.js";
7
+ import { p as w } from "./plugin-DUL0zZRF.js";
8
8
  import "./transform-DSaNEFMr.js";
9
9
  import "./ChartLine.vue_vue_type_style_index_0_lang-DO_gKCe4.js";
10
10
  import { p as D } from "./plugin-DDXOF4cU.js";
@@ -31,7 +31,7 @@ import { p as ir } from "./plugin-DaibhM02.js";
31
31
  import { p as er } from "./plugin-DppW8rQi.js";
32
32
  import { p as mr } from "./plugin-DkDbha5K.js";
33
33
  import { p as lr } from "./plugin-2nTovNcx.js";
34
- import { p as sr } from "./plugin-Duvcbc38.js";
34
+ import { p as sr } from "./plugin-BT8Zxuqh.js";
35
35
  import { p as xr } from "./plugin-CGg5IOSy.js";
36
36
  import { p as Ir } from "./plugin-C3tFXHbZ.js";
37
37
  import { p as hr } from "./plugin-BrwUi1gG.js";
package/dist/tamandua.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as n } from "./plugins-DZGnWkJf.js";
1
+ import { p as n } from "./plugins-U8kWZ2P5.js";
2
2
  const o = {
3
3
  install(s) {
4
4
  for (const i in n)
@@ -5,9 +5,10 @@ declare const _default: {
5
5
  args: {
6
6
  label: string;
7
7
  type: string;
8
- isOutline: boolean;
8
+ outline: boolean;
9
9
  variant: ButtonVariant;
10
10
  shape: ElementShape;
11
+ sizeClass: string;
11
12
  };
12
13
  argTypes: {
13
14
  variant: {
@@ -22,7 +23,7 @@ declare const _default: {
22
23
  options: ElementShape[];
23
24
  control: string;
24
25
  };
25
- isOutline: {
26
+ outline: {
26
27
  options: boolean[];
27
28
  control: string;
28
29
  };
@@ -7,15 +7,11 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
7
7
  size: ElementSize;
8
8
  label: string;
9
9
  shape: ElementShape;
10
- target: undefined;
11
10
  variant: ButtonVariant;
11
+ outline: boolean;
12
12
  multiple: boolean;
13
- isOutline: boolean;
14
- isDisabled: boolean;
15
- injectStyle: () => {
16
- icon: string;
17
- };
18
- disableStyle: boolean;
13
+ disabled: boolean;
14
+ sizeClass: string;
19
15
  }>, {
20
16
  iconReference: import("vue").Ref<import("vue").CreateComponentPublicInstance<Readonly<any>, {
21
17
  reference: import("vue").Ref<HTMLElement | null>;
@@ -41,32 +37,23 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
41
37
  size: ElementSize;
42
38
  label: string;
43
39
  shape: ElementShape;
44
- target: undefined;
45
40
  variant: ButtonVariant;
41
+ outline: boolean;
46
42
  multiple: boolean;
47
- isOutline: boolean;
48
- isDisabled: boolean;
49
- injectStyle: () => {
50
- icon: string;
51
- };
52
- disableStyle: boolean;
43
+ disabled: boolean;
44
+ sizeClass: string;
53
45
  }>>> & {
54
46
  onUpload?: ((val: FileList) => any) | undefined;
55
47
  }, {
56
48
  size: "" | "xs" | "sm" | "lg" | "xl";
57
49
  shape: "square" | "rounded" | "circle";
58
- disableStyle: boolean;
59
50
  type: "button" | "submit" | "file";
60
51
  label: string;
61
- href: string;
62
- target: string;
63
52
  variant: "default" | "primary" | "success" | "danger" | "warning" | "link" | "transparent";
53
+ outline: boolean;
64
54
  multiple: boolean;
65
- isOutline: boolean;
66
- isDisabled: boolean;
67
- injectStyle: {
68
- icon: string;
69
- };
55
+ disabled: boolean;
56
+ sizeClass: string;
70
57
  }, {}>, {
71
58
  default?(_: {}): any;
72
59
  }>;
@@ -1,22 +1,16 @@
1
1
  import { Icon, ButtonType, ElementSize, ElementShape, ButtonVariant } from '../../enums/ui.js';
2
2
 
3
3
  export type ButtonProps = {
4
- to?: any;
5
4
  icon?: `${Icon}`;
6
- href?: string;
7
5
  type?: `${ButtonType}`;
8
6
  size?: `${ElementSize}`;
9
7
  label?: string;
10
8
  shape?: `${ElementShape}`;
11
- target?: string;
12
9
  variant?: `${ButtonVariant}`;
10
+ outline?: boolean;
13
11
  multiple?: boolean;
14
- isOutline?: boolean;
15
- isDisabled?: boolean;
16
- injectStyle?: {
17
- icon: string;
18
- };
19
- disableStyle?: boolean;
12
+ disabled?: boolean;
13
+ sizeClass?: string;
20
14
  };
21
15
  export type ButtonEvents = {
22
16
  (e: "upload", val: FileList): void;
@@ -30,10 +30,10 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
30
30
  shape: "square" | "rounded" | "circle";
31
31
  type: "button" | "submit" | "file";
32
32
  label: string;
33
- href: string;
34
- target: string;
35
33
  multiple: boolean;
34
+ href: string;
36
35
  isDisabled: boolean;
36
+ target: string;
37
37
  }, {}>;
38
38
  export default _default;
39
39
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -16,8 +16,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
16
16
  }>>>, {
17
17
  type: "default" | "router";
18
18
  label: string;
19
- target: "_self" | "_blank" | "_parent" | "_top" | "_unfencedTop";
20
19
  disabled: boolean;
20
+ target: "_self" | "_blank" | "_parent" | "_top" | "_unfencedTop";
21
21
  }, {}>, {
22
22
  default?(_: {}): any;
23
23
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caipira/tamandua",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "private": false,
5
5
  "description": "UI library for the Caipira ecosystem",
6
6
  "license": "GPL-3.0-only",
@@ -1,6 +0,0 @@
1
- import { _ as o } from "./Button.vue_vue_type_style_index_0_scoped_39c3f26a_lang-tn6M5dNB.js";
2
- import { _ as t } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
- const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-39c3f26a"]]);
4
- export {
5
- s as B
6
- };
@@ -1,156 +0,0 @@
1
- import './Button.css';
2
- import { defineComponent as w, getCurrentInstance as N, ref as v, computed as o, resolveComponent as x, openBlock as s, createBlock as m, resolveDynamicComponent as z, normalizeClass as y, unref as r, withCtx as O, renderSlot as M, createCommentVNode as p, createElementBlock as h, Fragment as F, createTextVNode as k, toDisplayString as G } from "vue";
3
- import { u as P } from "./useDomHelpers-5CFMo6bx.js";
4
- import { c as t, a, b as u, B as i } from "./ui-D3dPdT4S.js";
5
- import "./Icon.vue_vue_type_script_setup_true_lang-CqJ-D4BM.js";
6
- const X = ["multiple"], H = /* @__PURE__ */ w({
7
- name: "TButton",
8
- __name: "Button",
9
- props: {
10
- to: {},
11
- icon: {},
12
- href: { default: "" },
13
- type: { default: t.BUTTON },
14
- size: { default: a.DEFAULT },
15
- label: { default: "" },
16
- shape: { default: u.ROUNDED },
17
- target: { default: void 0 },
18
- variant: { default: i.DEFAULT },
19
- multiple: { type: Boolean, default: !1 },
20
- isOutline: { type: Boolean, default: !1 },
21
- isDisabled: { type: Boolean, default: !1 },
22
- injectStyle: { default: () => ({ icon: "" }) },
23
- disableStyle: { type: Boolean, default: !1 }
24
- },
25
- emits: ["upload"],
26
- setup(b, { expose: A, emit: E }) {
27
- const e = b, g = E, c = N(), d = v(), f = v(null), { isPopoverActivator: L, onPopoverActivatorClick: R } = P(), S = o(() => e.href ? e.href : void 0), T = o(() => {
28
- switch (e.type) {
29
- case t.SUBMIT:
30
- return "submit";
31
- case t.FILE:
32
- default:
33
- return "button";
34
- }
35
- }), D = o(() => e.type === t.SUBMIT ? e.label : void 0), U = o(() => {
36
- switch (e.type) {
37
- case t.SUBMIT:
38
- return "input";
39
- case t.FILE:
40
- case t.BUTTON:
41
- default:
42
- return "button";
43
- }
44
- }), _ = (n) => {
45
- c && L(c) && R(n, c), e.type === t.SUBMIT && n.preventDefault(), e.type === t.FILE && d.value?.click();
46
- }, B = (n) => {
47
- n.stopPropagation();
48
- const l = n.target.files;
49
- !l || !l.length || g("upload", l);
50
- }, C = o(() => {
51
- switch (e.size) {
52
- case a.EXTRA_SMALL:
53
- return 12;
54
- case a.SMALL:
55
- return 16;
56
- case a.DEFAULT:
57
- return 20;
58
- case a.LARGE:
59
- return 24;
60
- case a.EXTRA_LARGE:
61
- return 28;
62
- default:
63
- return 20;
64
- }
65
- });
66
- return A({ iconReference: f }), (n, I) => {
67
- const l = x("t-icon");
68
- return s(), m(z(U.value), {
69
- type: T.value,
70
- href: S.value,
71
- value: D.value,
72
- to: e.to,
73
- disabled: e.isDisabled,
74
- target: e.target,
75
- class: y([{
76
- "opacity-50": e.isDisabled,
77
- // Size
78
- "text-xs px-2 h-4": e.size === r(a).EXTRA_SMALL,
79
- "text-sm px-3 h-7": e.size === r(a).SMALL,
80
- "text-base px-4 h-9": e.size === r(a).DEFAULT,
81
- "text-lg px-5 h-12": e.size === r(a).LARGE,
82
- "text-xl px-6 h-14": e.size === r(a).EXTRA_LARGE,
83
- // Border
84
- border: e.isOutline,
85
- // Shape
86
- "rounded-full": e.shape === r(u).CIRCLE,
87
- "input-roundness": e.shape === r(u).ROUNDED,
88
- // Cursor
89
- "cursor-pointer": !e.isDisabled,
90
- "cursor-not-allowed": e.isDisabled,
91
- // Default color
92
- "border-caipira-primary-inverted fill-caipira-primary-inverted": e.variant === r(i).DEFAULT,
93
- "bg-transparent color-caipira-primary-inverted hover:bg-caipira-primary-inverted hover:color-caipira-primary hover:fill-white": e.variant === r(i).DEFAULT && e.isOutline,
94
- "bg-caipira-primary-inverted color-caipira-primary": e.variant === r(i).DEFAULT && !e.isOutline,
95
- // Primary color
96
- "fill-caipira-primary": e.variant === r(i).PRIMARY,
97
- "bg-transparent border-caipira-blue color-caipira-blue hover:bg-caipira-blue hover:color-caipira-primary hover:fill-white": e.variant === r(i).PRIMARY && e.isOutline,
98
- "bg-caipira-blue color-caipira-primary": e.variant === r(i).PRIMARY && !e.isOutline,
99
- // Success color
100
- "fill-caipira-green": e.variant === r(i).SUCCESS,
101
- "bg-transparent border-caipira-green color-caipira-green hover:bg-caipira-green hover:color-caipira-primary hover:fill-white": e.variant === r(i).SUCCESS && e.isOutline,
102
- "bg-caipira-green color-caipira-primary": e.variant === r(i).SUCCESS && !e.isOutline,
103
- // Warning color
104
- "fill-caipira-yellow": e.variant === r(i).WARNING,
105
- "bg-transparent border-caipira-yellow color-caipira-yellow hover:bg-caipira-yellow hover:color-caipira-primary hover:fill-white": e.variant === r(i).WARNING && e.isOutline,
106
- "bg-caipira-yellow color-caipira-primary": e.variant === r(i).WARNING && !e.isOutline,
107
- // Danger color
108
- "fill-caipira-red": e.variant === r(i).DANGER,
109
- "bg-transparent border-caipira-red color-caipira-red hover:bg-caipira-red hover:color-caipira-primary hover:fill-white": e.variant === r(i).DANGER && e.isOutline,
110
- "bg-caipira-red color-caipira-primary": e.variant === r(i).DANGER && !e.isOutline,
111
- // Link
112
- "color-caipira-primary-inverted underline font-bold": e.variant === r(i).LINK,
113
- // Transparent
114
- "transparent-button": e.variant === r(i).TRANSPARENT
115
- }, "input-outline flex items-center select-none whitespace-nowrap"]),
116
- role: "button",
117
- onClick: _
118
- }, {
119
- default: O(() => [
120
- M(n.$slots, "default", {}, void 0, !0),
121
- e.icon ? (s(), m(l, {
122
- key: 0,
123
- ref_key: "iconReference",
124
- ref: f,
125
- size: C.value,
126
- icon: e.icon,
127
- class: y({
128
- [e.injectStyle.icon]: !0,
129
- "mr-1": e.size === r(a).EXTRA_SMALL,
130
- "mr-1.5": e.size === r(a).SMALL,
131
- "mr-2": e.size === r(a).DEFAULT,
132
- "mr-2.5": e.size === r(a).LARGE,
133
- "mr-3": e.size === r(a).EXTRA_LARGE
134
- })
135
- }, null, 8, ["size", "icon", "class"])) : p("", !0),
136
- e.label && e.type !== r(t).SUBMIT ? (s(), h(F, { key: 1 }, [
137
- k(G(e.label), 1)
138
- ], 64)) : p("", !0),
139
- e.type === "file" ? (s(), h("input", {
140
- key: 2,
141
- multiple: e.multiple,
142
- type: "file",
143
- ref_key: "fileInput",
144
- ref: d,
145
- class: "hidden",
146
- onChange: B
147
- }, null, 40, X)) : p("", !0)
148
- ]),
149
- _: 3
150
- }, 8, ["type", "href", "value", "to", "disabled", "target", "class"]);
151
- };
152
- }
153
- });
154
- export {
155
- H as _
156
- };