adverich-kun-ui 0.1.201 → 0.1.202

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,170 @@
1
+ import { ref as h, watch as R, computed as m, createElementBlock as l, openBlock as a, createCommentVNode as u, createElementVNode as b, toDisplayString as i, mergeProps as E, renderSlot as p, unref as k, withModifiers as K, Fragment as j, renderList as D, createTextVNode as G } from "vue";
2
+ import { renderIconSlot as S } from "../../../../utils/renderIcon.js";
3
+ const H = { class: "relative w-full" }, L = {
4
+ key: 0,
5
+ class: "block text-sm font-medium text-gray-700 mb-1"
6
+ }, P = { key: 0 }, T = ["multiple", "disabled"], q = { class: "flex-1 truncate" }, J = { key: 0 }, O = {
7
+ key: 1,
8
+ class: "text-gray-400"
9
+ }, Q = { key: 0 }, U = { key: 0 }, W = { key: 1 }, X = {
10
+ key: 1,
11
+ class: "mt-1 text-sm"
12
+ }, Y = {
13
+ key: 0,
14
+ class: "text-red-500"
15
+ }, Z = {
16
+ key: 1,
17
+ class: "text-gray-500"
18
+ }, _ = {
19
+ key: 2,
20
+ class: "mt-1 text-xs text-gray-400 text-right"
21
+ }, ee = { key: 0 }, le = {
22
+ __name: "KunFileInput",
23
+ props: {
24
+ modelValue: [File, Array],
25
+ multiple: Boolean,
26
+ clearable: Boolean,
27
+ chips: Boolean,
28
+ showSize: [Boolean, Number],
29
+ label: String,
30
+ disabled: Boolean,
31
+ error: Boolean,
32
+ errorMessages: [String, Array],
33
+ hint: String,
34
+ persistentHint: Boolean,
35
+ counter: Boolean,
36
+ counterString: String,
37
+ counterSizeString: String,
38
+ prependIcon: String,
39
+ appendIcon: String,
40
+ clearIcon: String,
41
+ variant: {
42
+ type: String,
43
+ default: "filled"
44
+ },
45
+ rules: {
46
+ type: Array,
47
+ default: () => []
48
+ }
49
+ },
50
+ emits: [
51
+ "update:modelValue",
52
+ "click:clear",
53
+ "click:control",
54
+ "update:focused"
55
+ ],
56
+ setup(e, { expose: F, emit: A }) {
57
+ const c = e, f = A, B = h(null), y = h(!1), d = h([]), r = h([]);
58
+ R(
59
+ () => c.modelValue,
60
+ (t) => {
61
+ d.value = Array.isArray(t) ? t : t ? [t] : [];
62
+ },
63
+ { immediate: !0 }
64
+ );
65
+ function $(t) {
66
+ const n = t.target.files;
67
+ if (!n) return;
68
+ const o = Array.from(n);
69
+ d.value = c.multiple ? o : [o[0]], f("update:modelValue", c.multiple ? o : o[0]), w();
70
+ }
71
+ function x() {
72
+ d.value = [], f("update:modelValue", c.multiple ? [] : null), f("click:clear"), r.value = [];
73
+ }
74
+ function z() {
75
+ y.value = !0, f("update:focused", !0);
76
+ }
77
+ function N() {
78
+ y.value = !1, f("update:focused", !1);
79
+ }
80
+ const g = m(() => d.value.map((t) => t.name)), V = m(() => d.value.reduce((t, n) => t + n.size, 0)), I = m(() => {
81
+ const t = V.value, n = c.showSize === 1024 ? 1024 : 1e3, o = ["B", "KB", "MB", "GB"];
82
+ let s = 0, v = t;
83
+ for (; v >= n && s < o.length - 1; )
84
+ v /= n, s++;
85
+ return `${v.toFixed(1)} ${o[s]}`;
86
+ });
87
+ async function w(t = !1) {
88
+ const n = [];
89
+ for (const o of c.rules) {
90
+ const s = typeof o == "function" ? o(c.multiple ? d.value : d.value[0]) : !0;
91
+ typeof s == "string" ? n.push(s) : s === !1 && n.push("Valor inválido");
92
+ }
93
+ return r.value = n, !t && n.length && f("update:focused", !0), n;
94
+ }
95
+ async function C() {
96
+ x();
97
+ }
98
+ async function M() {
99
+ r.value = [];
100
+ }
101
+ return F({
102
+ reset: C,
103
+ resetValidation: M,
104
+ validate: w,
105
+ isValid: m(() => r.value.length === 0),
106
+ errorMessages: r
107
+ }), (t, n) => (a(), l("div", H, [
108
+ e.label ? (a(), l("label", L, i(e.label), 1)) : u("", !0),
109
+ b("div", E({
110
+ class: ["flex items-center gap-2 rounded px-3 py-2 cursor-pointer transition", [
111
+ e.variant === "outlined" ? "border border-gray-300" : e.variant === "solo" ? "bg-gray-100 shadow-inner" : "bg-white border border-gray-200",
112
+ e.disabled ? "bg-gray-100 cursor-not-allowed" : "hover:border-blue-500",
113
+ e.error || r.value.length ? "border-red-500" : "",
114
+ y.value ? "ring-2 ring-blue-500" : ""
115
+ ]]
116
+ }, t.$attrs, {
117
+ onClick: n[0] || (n[0] = () => {
118
+ var o;
119
+ return (o = B.value) == null ? void 0 : o.click();
120
+ }),
121
+ onFocusin: z,
122
+ onFocusout: N
123
+ }), [
124
+ p(t.$slots, "prepend", {}, () => [
125
+ e.prependIcon ? (a(), l("span", P, i(k(S)(e.prependIcon)), 1)) : u("", !0)
126
+ ]),
127
+ b("input", {
128
+ ref_key: "inputRef",
129
+ ref: B,
130
+ type: "file",
131
+ class: "hidden",
132
+ multiple: e.multiple,
133
+ disabled: e.disabled,
134
+ onChange: $
135
+ }, null, 40, T),
136
+ b("div", q, [
137
+ p(t.$slots, "selection", {
138
+ fileNames: g.value,
139
+ totalBytes: V.value,
140
+ totalBytesReadable: I.value
141
+ }, () => [
142
+ g.value.length ? (a(), l("span", J, i(g.value.join(", ")), 1)) : (a(), l("span", O, "Seleccionar archivo"))
143
+ ])
144
+ ]),
145
+ p(t.$slots, "append", {}, () => [
146
+ e.appendIcon ? (a(), l("span", Q, i(k(S)(e.appendIcon)), 1)) : u("", !0)
147
+ ]),
148
+ e.clearable && g.value.length ? (a(), l("button", {
149
+ key: 0,
150
+ onClick: K(x, ["stop"]),
151
+ class: "text-gray-500 hover:text-red-500"
152
+ }, [
153
+ e.clearIcon ? (a(), l("span", U, i(k(S)(e.clearIcon)), 1)) : (a(), l("span", W, "✕"))
154
+ ])) : u("", !0)
155
+ ], 16),
156
+ e.hint || r.value.length ? (a(), l("div", X, [
157
+ r.value.length ? (a(), l("div", Y, [
158
+ (a(!0), l(j, null, D(r.value, (o, s) => (a(), l("div", { key: s }, i(o), 1))), 128))
159
+ ])) : e.hint ? (a(), l("div", Z, i(e.hint), 1)) : u("", !0)
160
+ ])) : u("", !0),
161
+ e.counter ? (a(), l("div", _, [
162
+ G(i(e.counterString ?? `${g.value.length} archivo(s)`) + " ", 1),
163
+ e.showSize ? (a(), l("span", ee, " — " + i(I.value), 1)) : u("", !0)
164
+ ])) : u("", !0)
165
+ ]));
166
+ }
167
+ };
168
+ export {
169
+ le as default
170
+ };
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import o from "./components/KunAlert/src/components/KunAlert.vue.js";
3
3
  import i from "./components/KunAppbar/src/components/KunAppbar.vue.js";
4
4
  import a from "./components/KunAppbarTitle/src/components/KunAppbarTitle.vue.js";
5
5
  import t from "./components/KunAutocomplete/src/components/KunAutocomplete.vue.js";
6
- import s from "./components/KunAvatar/src/components/KunAvatar.vue.js";
7
- import u from "./components/KunBtn/src/components/KunBtn.vue.js";
6
+ import u from "./components/KunAvatar/src/components/KunAvatar.vue.js";
7
+ import s from "./components/KunBtn/src/components/KunBtn.vue.js";
8
8
  import f from "./components/KunBadge/src/components/KunBadge.vue.js";
9
9
  import K from "./components/KunCard/src/components/KunCard.vue.js";
10
10
  import _ from "./components/KunCardActions/src/components/KunCardActions.vue.js";
@@ -19,48 +19,49 @@ import b from "./components/KunCurrency/src/components/KunCurrency.vue.js";
19
19
  import C from "./components/KunDialog/src/components/KunDialog.vue.js";
20
20
  import L from "./components/KunDivider/src/components/KunDivider.vue.js";
21
21
  import I from "./components/KunDrawer/src/components/KunDrawer.vue.js";
22
- import A from "./components/KunForm/src/components/KunForm.vue.js";
22
+ import A from "./components/KunFileInput/src/components/KunFileInput.vue.js";
23
+ import F from "./components/KunForm/src/components/KunForm.vue.js";
23
24
  import S from "./components/KunIcon/src/components/KunIcon.vue.js";
24
25
  import x from "./components/KunList/src/components/KunList.vue.js";
25
- import F from "./components/KunListGroup/src/components/KunListGroup.vue.js";
26
- import g from "./components/KunListImg/src/components/KunListImg.vue.js";
27
- import M from "./components/KunListItem/src/components/KunListItem.vue.js";
28
- import h from "./components/KunListItemAction/src/components/KunListItemAction.vue.js";
29
- import v from "./components/KunListItemAvatar/src/components/KunListItemAvatar.vue.js";
30
- import w from "./components/KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
31
- import D from "./components/KunListItemTitle/src/components/KunListItemTitle.vue.js";
32
- import B from "./components/KunListItemText/src/components/KunListItemText.vue.js";
33
- import y from "./components/KunListSubheader/src/components/KunListSubheader.vue.js";
34
- import G from "./components/kunMenu/src/components/kunMenu.vue.js";
35
- import R from "./components/KunModalFooter/src/components/KunModalFooter.vue.js";
36
- import j from "./components/KunModalFooter/src/components/KunMultipleModalFooter.vue.js";
37
- import k from "./components/KunNumberField/src/components/KunNumberField.vue.js";
38
- import q from "./components/KunLoaderCircular/src/components/KunLoaderCircular.vue.js";
39
- import z from "./components/KunRow/src/components/KunRow.vue.js";
40
- import E from "./components/KunSlider/src/components/KunSlider.vue.js";
41
- import N from "./components/KunSpacer/src/components/KunSpacer.vue.js";
42
- import H from "./components/KunSwitch/src/components/KunSwitch.vue.js";
43
- import J from "./components/KunTable/src/components/KunTable.vue.js";
44
- import O from "./components/KunTabs/src/components/KunTab.vue.js";
45
- import P from "./components/KunTabs/src/components/KunTabs.vue.js";
46
- import Q from "./components/KunTextarea/src/components/KunTextarea.vue.js";
47
- import U from "./components/KunTextField/src/components/KunTextField.vue.js";
48
- import V from "./components/KunToolbar/src/components/KunToolbar.vue.js";
49
- import W from "./components/KunToolbar/src/components/KunToolbarTitle.vue.js";
50
- import X from "./components/KunTooltip/src/components/KunTooltip.vue.js";
26
+ import g from "./components/KunListGroup/src/components/KunListGroup.vue.js";
27
+ import M from "./components/KunListImg/src/components/KunListImg.vue.js";
28
+ import h from "./components/KunListItem/src/components/KunListItem.vue.js";
29
+ import v from "./components/KunListItemAction/src/components/KunListItemAction.vue.js";
30
+ import w from "./components/KunListItemAvatar/src/components/KunListItemAvatar.vue.js";
31
+ import D from "./components/KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
32
+ import B from "./components/KunListItemTitle/src/components/KunListItemTitle.vue.js";
33
+ import y from "./components/KunListItemText/src/components/KunListItemText.vue.js";
34
+ import G from "./components/KunListSubheader/src/components/KunListSubheader.vue.js";
35
+ import R from "./components/kunMenu/src/components/kunMenu.vue.js";
36
+ import j from "./components/KunModalFooter/src/components/KunModalFooter.vue.js";
37
+ import k from "./components/KunModalFooter/src/components/KunMultipleModalFooter.vue.js";
38
+ import q from "./components/KunNumberField/src/components/KunNumberField.vue.js";
39
+ import z from "./components/KunLoaderCircular/src/components/KunLoaderCircular.vue.js";
40
+ import E from "./components/KunRow/src/components/KunRow.vue.js";
41
+ import N from "./components/KunSlider/src/components/KunSlider.vue.js";
42
+ import H from "./components/KunSpacer/src/components/KunSpacer.vue.js";
43
+ import J from "./components/KunSwitch/src/components/KunSwitch.vue.js";
44
+ import O from "./components/KunTable/src/components/KunTable.vue.js";
45
+ import P from "./components/KunTabs/src/components/KunTab.vue.js";
46
+ import Q from "./components/KunTabs/src/components/KunTabs.vue.js";
47
+ import U from "./components/KunTextarea/src/components/KunTextarea.vue.js";
48
+ import V from "./components/KunTextField/src/components/KunTextField.vue.js";
49
+ import W from "./components/KunToolbar/src/components/KunToolbar.vue.js";
50
+ import X from "./components/KunToolbar/src/components/KunToolbarTitle.vue.js";
51
+ import Y from "./components/KunTooltip/src/components/KunTooltip.vue.js";
51
52
  const n = {
52
53
  KunAlert: o,
53
54
  KunAppbar: i,
54
55
  KunAppbarTitle: a,
55
56
  KunAutocomplete: t,
56
- KunAvatar: s,
57
- KunBtn: u,
57
+ KunAvatar: u,
58
+ KunBtn: s,
58
59
  KunBadge: f,
59
60
  KunCard: K,
60
61
  KunCardActions: _,
61
62
  KunCardItem: e,
62
63
  KunCardSubtitle: p,
63
- KunListItemTitle: D,
64
+ KunListItemTitle: B,
64
65
  KunCardText: c,
65
66
  KunCardTitle: l,
66
67
  KunChip: $,
@@ -70,36 +71,37 @@ const n = {
70
71
  KunDialog: C,
71
72
  KunDivider: L,
72
73
  KunDrawer: I,
73
- KunForm: A,
74
+ KunFileInput: A,
75
+ KunForm: F,
74
76
  KunIcon: S,
75
77
  KunList: x,
76
- KunListGroup: F,
77
- KunListImg: g,
78
- KunListItem: M,
79
- KunListItemAction: h,
80
- KunListItemAvatar: v,
81
- KunListItemSubtitle: w,
82
- KunListItemText: B,
83
- KunListSubheader: y,
84
- KunMenu: G,
85
- KunModalFooter: R,
86
- KunMultipleModalFooter: j,
87
- KunNumberField: k,
88
- KunLoaderCircular: q,
89
- KunRow: z,
90
- KunSlider: E,
91
- KunSpacer: N,
92
- KunSwitch: H,
93
- KunTable: J,
94
- KunTab: O,
95
- KunTabs: P,
96
- KunTextarea: Q,
97
- KunTextField: U,
98
- KunToolbar: V,
99
- KunToolbarTitle: W,
100
- KunTooltip: X
78
+ KunListGroup: g,
79
+ KunListImg: M,
80
+ KunListItem: h,
81
+ KunListItemAction: v,
82
+ KunListItemAvatar: w,
83
+ KunListItemSubtitle: D,
84
+ KunListItemText: y,
85
+ KunListSubheader: G,
86
+ KunMenu: R,
87
+ KunModalFooter: j,
88
+ KunMultipleModalFooter: k,
89
+ KunNumberField: q,
90
+ KunLoaderCircular: z,
91
+ KunRow: E,
92
+ KunSlider: N,
93
+ KunSpacer: H,
94
+ KunSwitch: J,
95
+ KunTable: O,
96
+ KunTab: P,
97
+ KunTabs: Q,
98
+ KunTextarea: U,
99
+ KunTextField: V,
100
+ KunToolbar: W,
101
+ KunToolbarTitle: X,
102
+ KunTooltip: Y
101
103
  };
102
- function Um(r) {
104
+ function Wm(r) {
103
105
  for (const m in n)
104
106
  r.component(m, n[m]);
105
107
  }
@@ -108,9 +110,9 @@ export {
108
110
  i as KunAppbar,
109
111
  a as KunAppbarTitle,
110
112
  t as KunAutocomplete,
111
- s as KunAvatar,
113
+ u as KunAvatar,
112
114
  f as KunBadge,
113
- u as KunBtn,
115
+ s as KunBtn,
114
116
  K as KunCard,
115
117
  _ as KunCardActions,
116
118
  e as KunCardItem,
@@ -124,33 +126,34 @@ export {
124
126
  C as KunDialog,
125
127
  L as KunDivider,
126
128
  I as KunDrawer,
127
- A as KunForm,
129
+ A as KunFileInput,
130
+ F as KunForm,
128
131
  S as KunIcon,
129
132
  x as KunList,
130
- F as KunListGroup,
131
- g as KunListImg,
132
- M as KunListItem,
133
- h as KunListItemAction,
134
- v as KunListItemAvatar,
135
- w as KunListItemSubtitle,
136
- B as KunListItemText,
137
- D as KunListItemTitle,
138
- y as KunListSubheader,
139
- q as KunLoaderCircular,
140
- G as KunMenu,
141
- R as KunModalFooter,
142
- j as KunMultipleModalFooter,
143
- z as KunRow,
144
- E as KunSlider,
145
- N as KunSpacer,
146
- H as KunSwitch,
147
- O as KunTab,
148
- J as KunTable,
149
- P as KunTabs,
150
- U as KunTextField,
151
- Q as KunTextarea,
152
- V as KunToolbar,
153
- W as KunToolbarTitle,
154
- X as KunTooltip,
155
- Um as install
133
+ g as KunListGroup,
134
+ M as KunListImg,
135
+ h as KunListItem,
136
+ v as KunListItemAction,
137
+ w as KunListItemAvatar,
138
+ D as KunListItemSubtitle,
139
+ y as KunListItemText,
140
+ B as KunListItemTitle,
141
+ G as KunListSubheader,
142
+ z as KunLoaderCircular,
143
+ R as KunMenu,
144
+ j as KunModalFooter,
145
+ k as KunMultipleModalFooter,
146
+ E as KunRow,
147
+ N as KunSlider,
148
+ H as KunSpacer,
149
+ J as KunSwitch,
150
+ P as KunTab,
151
+ O as KunTable,
152
+ Q as KunTabs,
153
+ V as KunTextField,
154
+ U as KunTextarea,
155
+ W as KunToolbar,
156
+ X as KunToolbarTitle,
157
+ Y as KunTooltip,
158
+ Wm as install
156
159
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.201",
3
+ "version": "0.1.202",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",