adverich-kun-ui 0.1.117 → 0.1.118

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,177 @@
1
+ import { getCurrentInstance as F, createElementBlock as s, openBlock as l, createCommentVNode as i, createElementVNode as d, normalizeClass as u, unref as t, toDisplayString as p, mergeProps as M, Fragment as N, renderList as B } from "vue";
2
+ import { KunNumberFieldProps as K } from "../composables/KunNumberFieldProps.js";
3
+ import { useKunNumberField as A } from "../composables/useKunNumberFieldComposable.js";
4
+ const D = { class: "w-full flex flex-col relative" }, z = {
5
+ key: 0,
6
+ class: "h-full"
7
+ }, E = ["disabled"], P = {
8
+ key: 1,
9
+ class: "mr-2"
10
+ }, $ = {
11
+ key: 2,
12
+ class: "flex items-center justify-center min-w-[32px] h-full px-1"
13
+ }, H = ["value", "placeholder", "readonly", "disabled", "maxlength", "aria-invalid"], L = ["disabled"], S = {
14
+ key: 4,
15
+ class: "flex items-center h-full"
16
+ }, q = ["disabled"], G = ["disabled"], J = {
17
+ key: 5,
18
+ class: "flex flex-col items-center justify-center border-l border-slate-600"
19
+ }, O = ["disabled"], Q = ["disabled"], R = {
20
+ key: 6,
21
+ class: "flex items-center justify-center min-w-[32px] h-full px-1 cursor-pointer"
22
+ }, T = {
23
+ key: 7,
24
+ class: "h-full"
25
+ }, U = ["disabled"], W = {
26
+ key: 8,
27
+ class: "ml-2"
28
+ }, X = {
29
+ key: 0,
30
+ class: "h-[1.25rem]"
31
+ }, Y = {
32
+ key: 0,
33
+ class: "text-red-500 text-sm text-center"
34
+ }, Z = { key: 0 }, _ = { key: 1 }, ee = {
35
+ key: 1,
36
+ class: "text-xs text-center"
37
+ }, se = {
38
+ __name: "KunNumberField",
39
+ props: K,
40
+ emits: ["update:modelValue"],
41
+ setup(m, { emit: v }) {
42
+ const g = m, w = v, b = `number-input-${F().uid}`, {
43
+ inputValue: y,
44
+ numberInput: C,
45
+ inputKey: x,
46
+ updateValue: I,
47
+ onIncrement: n,
48
+ onDecrement: a,
49
+ onClear: c,
50
+ focus: f,
51
+ handleFocus: h,
52
+ isActive: V,
53
+ handleBlur: k
54
+ } = A(g, w);
55
+ return (e, o) => (l(), s("div", D, [
56
+ e.label ? (l(), s("label", {
57
+ key: 0,
58
+ for: b,
59
+ class: u([
60
+ e.labelColor,
61
+ "absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
62
+ t(V) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
63
+ ])
64
+ }, p(e.label), 3)) : i("", !0),
65
+ d("div", M({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
66
+ d("div", {
67
+ class: u(["flex items-center w-full h-full border", [
68
+ e.bgInput,
69
+ e.rounded,
70
+ t(f) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
71
+ e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
72
+ e.error ? "bg-red-200 dark:bg-red-900" : ""
73
+ ]])
74
+ }, [
75
+ e.controlVariant === "split" ? (l(), s("div", z, [
76
+ d("button", {
77
+ type: "button",
78
+ class: "p-3 text-lg border-r border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
79
+ onClick: o[0] || (o[0] = (...r) => t(a) && t(a)(...r)),
80
+ disabled: e.disabled || e.readonly
81
+ }, "−", 8, E)
82
+ ])) : i("", !0),
83
+ e.prefix ? (l(), s("div", P, p(e.prefix), 1)) : i("", !0),
84
+ e.prependIcon ? (l(), s("div", $, [
85
+ d("i", {
86
+ class: u(e.prependIcon)
87
+ }, null, 2)
88
+ ])) : i("", !0),
89
+ (l(), s("input", {
90
+ id: b,
91
+ ref_key: "numberInput",
92
+ ref: C,
93
+ key: t(x),
94
+ type: "text",
95
+ value: t(y),
96
+ placeholder: e.placeholder,
97
+ readonly: e.readonly,
98
+ disabled: e.disabled,
99
+ maxlength: e.maxlength,
100
+ autocomplete: "off",
101
+ class: u(["w-full h-full bg-transparent rounded focus:outline-none p-3", [e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
102
+ "aria-invalid": e.error ? "true" : "false",
103
+ onInput: o[1] || (o[1] = (r) => t(I)(r.target.value)),
104
+ onFocus: o[2] || (o[2] = (...r) => t(h) && t(h)(...r)),
105
+ onBlur: o[3] || (o[3] = (...r) => t(k) && t(k)(...r))
106
+ }, null, 42, H)),
107
+ e.clearable && t(y) != null ? (l(), s("button", {
108
+ key: 3,
109
+ type: "button",
110
+ onClick: o[4] || (o[4] = (...r) => t(c) && t(c)(...r)),
111
+ class: u(["ml-2", e.textColor]),
112
+ disabled: e.disabled || e.readonly
113
+ }, " × ", 10, L)) : i("", !0),
114
+ e.controlVariant === "default" ? (l(), s("div", S, [
115
+ d("button", {
116
+ type: "button",
117
+ class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
118
+ onClick: o[5] || (o[5] = (...r) => t(n) && t(n)(...r)),
119
+ disabled: e.disabled || e.readonly
120
+ }, " ▲ ", 8, q),
121
+ d("button", {
122
+ type: "button",
123
+ class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
124
+ onClick: o[6] || (o[6] = (...r) => t(a) && t(a)(...r)),
125
+ disabled: e.disabled || e.readonly
126
+ }, " ▼ ", 8, G)
127
+ ])) : e.controlVariant === "stacked" ? (l(), s("div", J, [
128
+ d("div", {
129
+ class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
130
+ onClick: o[7] || (o[7] = (...r) => t(n) && t(n)(...r))
131
+ }, [
132
+ d("button", {
133
+ type: "button",
134
+ class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
135
+ disabled: e.disabled || e.readonly
136
+ }, "▲", 8, O)
137
+ ]),
138
+ d("div", {
139
+ class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
140
+ onClick: o[8] || (o[8] = (...r) => t(a) && t(a)(...r))
141
+ }, [
142
+ d("button", {
143
+ type: "button",
144
+ class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
145
+ disabled: e.disabled || e.readonly
146
+ }, "▼", 8, Q)
147
+ ])
148
+ ])) : i("", !0),
149
+ e.appendIcon ? (l(), s("div", R, [
150
+ d("i", {
151
+ class: u(e.appendIcon)
152
+ }, null, 2)
153
+ ])) : i("", !0),
154
+ e.controlVariant === "split" ? (l(), s("div", T, [
155
+ d("button", {
156
+ type: "button",
157
+ class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
158
+ onClick: o[9] || (o[9] = (...r) => t(n) && t(n)(...r)),
159
+ disabled: e.disabled || e.readonly
160
+ }, "+", 8, U)
161
+ ])) : i("", !0),
162
+ e.suffix ? (l(), s("div", W, p(e.suffix), 1)) : i("", !0)
163
+ ], 2),
164
+ e.hideDetails ? i("", !0) : (l(), s("div", X, [
165
+ e.error || e.errorMessages ? (l(), s("div", Y, [
166
+ Array.isArray(e.errorMessages) ? (l(), s("div", Z, [
167
+ (l(!0), s(N, null, B(e.errorMessages, (r, j) => (l(), s("div", { key: j }, p(r), 1))), 128))
168
+ ])) : typeof e.errorMessages == "string" ? (l(), s("div", _, p(e.errorMessages), 1)) : i("", !0)
169
+ ])) : e.hint && (e.persistentHint || t(f)) ? (l(), s("div", ee, p(e.hint), 1)) : i("", !0)
170
+ ]))
171
+ ], 16)
172
+ ]));
173
+ }
174
+ };
175
+ export {
176
+ se as default
177
+ };
@@ -0,0 +1,48 @@
1
+ const e = {
2
+ // Core
3
+ modelValue: { type: [Number, String], default: null },
4
+ type: { type: String, default: "text" },
5
+ placeholder: { type: String, default: "" },
6
+ label: { type: String, default: "" },
7
+ dirty: { type: Boolean, default: !1 },
8
+ // Decoradores
9
+ prefix: { type: String, default: "" },
10
+ suffix: { type: String, default: "" },
11
+ prependIcon: String,
12
+ appendIcon: String,
13
+ // Estilo y diseño
14
+ rounded: { type: String, default: "rounded" },
15
+ borderColor: { type: String, default: "border-gray-300 dark:border-gray-700" },
16
+ textColor: { type: String, default: "text-black dark:text-white" },
17
+ labelColor: { type: String, default: "text-black/80 dark:text-white/80" },
18
+ placeholderColor: { type: String, default: "placeholder-black/60 dark:placeholder-white/60" },
19
+ bgInput: { type: String, default: "bg-slate-200 dark:bg-slate-800" },
20
+ textCenter: { type: Boolean, default: !1 },
21
+ controlVariant: { type: String, default: "default" },
22
+ // Estado
23
+ error: { type: Boolean, default: !1 },
24
+ errorMessages: [String, Array],
25
+ rules: { type: Array, default: () => [] },
26
+ disabled: { type: Boolean, default: !1 },
27
+ readonly: { type: Boolean, default: !1 },
28
+ clearable: { type: Boolean, default: !1 },
29
+ maxlength: { type: [Number, String], default: null },
30
+ counter: { type: Boolean, default: !1 },
31
+ debounce: { type: Number, default: 300 },
32
+ // Ayuda y detalles
33
+ hint: { type: String, default: "" },
34
+ persistentHint: { type: Boolean, default: !1 },
35
+ hideDetails: { type: Boolean, default: !1 },
36
+ validateOnBlur: { type: Boolean, default: !1 },
37
+ // Reglas numéricas
38
+ min: { type: Number, default: -1 / 0 },
39
+ max: { type: Number, default: 1 / 0 },
40
+ step: { type: Number, default: 1 },
41
+ locale: { type: String, default: "es-AR" },
42
+ separator: { type: String, default: "." },
43
+ useGrouping: { type: Boolean, default: !0 },
44
+ precision: { type: Number, default: 2 }
45
+ };
46
+ export {
47
+ e as KunNumberFieldProps
48
+ };
@@ -0,0 +1,7 @@
1
+ function n(r, l = ",") {
2
+ const e = r.replace(/[^\d.,]/g, "");
3
+ return l === "," ? e.replace(/\./g, ",") : e.replace(/,/g, ".");
4
+ }
5
+ export {
6
+ n as normalizeNumber
7
+ };
@@ -0,0 +1,60 @@
1
+ import { ref as a, computed as p, watch as b, nextTick as g } from "vue";
2
+ import { normalizeNumber as y } from "./numberFormatUtils.js";
3
+ function F(u, o) {
4
+ const e = a(u.modelValue), r = a(null), f = a(0);
5
+ function i(n) {
6
+ if (!n) {
7
+ e.value = "0", o("update:modelValue", 0);
8
+ return;
9
+ }
10
+ const t = y(n, u.separator).split(u.separator);
11
+ if (t.length > 2) {
12
+ d();
13
+ return;
14
+ }
15
+ t.length === 2 && t[1].length > u.precision && (t[1] = t[1].slice(0, u.precision));
16
+ const c = t.join(u.separator);
17
+ c === e.value ? d() : e.value = c, o("update:modelValue", c || 0);
18
+ }
19
+ function d() {
20
+ f.value++, g(() => {
21
+ var n;
22
+ (n = r.value) == null || n.focus();
23
+ });
24
+ }
25
+ function m() {
26
+ i((e.value || 0) + u.step);
27
+ }
28
+ function s() {
29
+ i((e.value || 0) - u.step);
30
+ }
31
+ function v() {
32
+ e.value = null, o("update:modelValue", null);
33
+ }
34
+ const l = a(!1);
35
+ function V() {
36
+ l.value = !0, e.value || (e.value = "");
37
+ }
38
+ function h() {
39
+ l.value = !1, e.value || (e.value = 0);
40
+ }
41
+ const I = p(() => l.value || !!u.modelValue || u.dirty);
42
+ return b(() => u.modelValue, (n) => {
43
+ e.value = n;
44
+ }), {
45
+ inputValue: e,
46
+ numberInput: r,
47
+ inputKey: f,
48
+ updateValue: i,
49
+ onIncrement: m,
50
+ onDecrement: s,
51
+ onClear: v,
52
+ focus: l,
53
+ handleFocus: V,
54
+ isActive: I,
55
+ handleBlur: h
56
+ };
57
+ }
58
+ export {
59
+ F as useKunNumberField
60
+ };
package/dist/index.js CHANGED
@@ -8,8 +8,8 @@ import u from "./components/KunBudge/src/components/KunBudge.vue.js";
8
8
  import f from "./components/KunCard/src/components/KunCard.vue.js";
9
9
  import K from "./components/KunCardActions/src/components/KunCardActions.vue.js";
10
10
  import _ from "./components/KunCardItem/src/components/KunCardItem.vue.js";
11
- import p from "./components/KunCardSubtitle/src/components/KunCardSubtitle.vue.js";
12
- import e from "./components/KunCardText/src/components/KunCardText.vue.js";
11
+ import e from "./components/KunCardSubtitle/src/components/KunCardSubtitle.vue.js";
12
+ import p from "./components/KunCardText/src/components/KunCardText.vue.js";
13
13
  import c from "./components/KunCardTitle/src/components/KunCardTitle.vue.js";
14
14
  import $ from "./components/KunChip/src/components/KunChip.vue.js";
15
15
  import l from "./components/KunCol/src/components/KunCol.vue.js";
@@ -25,17 +25,18 @@ import x from "./components/KunListItem/src/components/KunListItem.vue.js";
25
25
  import h from "./components/KunListItemAction/src/components/KunListItemAction.vue.js";
26
26
  import g from "./components/KunListItemAvatar/src/components/KunListItemAvatar.vue.js";
27
27
  import w from "./components/KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
28
- import v from "./components/KunListItemTitle/src/components/KunListItemTitle.vue.js";
29
- import B from "./components/KunListItemText/src/components/KunListItemText.vue.js";
30
- import F from "./components/KunListSubheader/src/components/KunListSubheader.vue.js";
28
+ import F from "./components/KunListItemTitle/src/components/KunListItemTitle.vue.js";
29
+ import v from "./components/KunListItemText/src/components/KunListItemText.vue.js";
30
+ import B from "./components/KunListSubheader/src/components/KunListSubheader.vue.js";
31
31
  import y from "./components/kunMenu/src/components/kunMenu.vue.js";
32
- import D from "./components/KunLoaderCircular/src/components/KunLoaderCircular.vue.js";
33
- import G from "./components/KunRow/src/components/KunRow.vue.js";
34
- import R from "./components/KunSlider/src/components/KunSlider.vue.js";
35
- import j from "./components/KunSpacer/src/components/KunSpacer.vue.js";
36
- import k from "./components/KunSwitch/src/components/KunSwitch.vue.js";
37
- import q from "./components/KunTextField/src/components/KunTextField.vue.js";
38
- import M from "./components/KunToolbar/src/components/KunToolbar.vue.js";
32
+ import D from "./components/KunNumberField/src/components/KunNumberField.vue.js";
33
+ import G from "./components/KunLoaderCircular/src/components/KunLoaderCircular.vue.js";
34
+ import R from "./components/KunRow/src/components/KunRow.vue.js";
35
+ import j from "./components/KunSlider/src/components/KunSlider.vue.js";
36
+ import k from "./components/KunSpacer/src/components/KunSpacer.vue.js";
37
+ import q from "./components/KunSwitch/src/components/KunSwitch.vue.js";
38
+ import M from "./components/KunTextField/src/components/KunTextField.vue.js";
39
+ import N from "./components/KunToolbar/src/components/KunToolbar.vue.js";
39
40
  import z from "./components/KunTooltip/src/components/KunTooltip.vue.js";
40
41
  const n = {
41
42
  KunAlert: r,
@@ -47,9 +48,9 @@ const n = {
47
48
  KunCard: f,
48
49
  KunCardActions: K,
49
50
  KunCardItem: _,
50
- KunCardSubtitle: p,
51
- KunListItemTitle: v,
52
- KunCardText: e,
51
+ KunCardSubtitle: e,
52
+ KunListItemTitle: F,
53
+ KunCardText: p,
53
54
  KunCardTitle: c,
54
55
  KunChip: $,
55
56
  KunCol: l,
@@ -65,19 +66,20 @@ const n = {
65
66
  KunListItemAction: h,
66
67
  KunListItemAvatar: g,
67
68
  KunListItemSubtitle: w,
68
- KunListItemText: B,
69
- KunListSubheader: F,
69
+ KunListItemText: v,
70
+ KunListSubheader: B,
70
71
  KunMenu: y,
71
- KunLoaderCircular: D,
72
- KunRow: G,
73
- KunSlider: R,
74
- KunSpacer: j,
75
- KunSwitch: k,
76
- KunTextField: q,
77
- KunToolbar: M,
72
+ KunNumberField: D,
73
+ KunLoaderCircular: G,
74
+ KunRow: R,
75
+ KunSlider: j,
76
+ KunSpacer: k,
77
+ KunSwitch: q,
78
+ KunTextField: M,
79
+ KunToolbar: N,
78
80
  KunTooltip: z
79
81
  };
80
- function hm(i) {
82
+ function wm(i) {
81
83
  for (const m in n)
82
84
  i.component(m, n[m]);
83
85
  }
@@ -91,8 +93,8 @@ export {
91
93
  f as KunCard,
92
94
  K as KunCardActions,
93
95
  _ as KunCardItem,
94
- p as KunCardSubtitle,
95
- e as KunCardText,
96
+ e as KunCardSubtitle,
97
+ p as KunCardText,
96
98
  c as KunCardTitle,
97
99
  $ as KunChip,
98
100
  l as KunCol,
@@ -108,17 +110,17 @@ export {
108
110
  h as KunListItemAction,
109
111
  g as KunListItemAvatar,
110
112
  w as KunListItemSubtitle,
111
- B as KunListItemText,
112
- v as KunListItemTitle,
113
- F as KunListSubheader,
114
- D as KunLoaderCircular,
113
+ v as KunListItemText,
114
+ F as KunListItemTitle,
115
+ B as KunListSubheader,
116
+ G as KunLoaderCircular,
115
117
  y as KunMenu,
116
- G as KunRow,
117
- R as KunSlider,
118
- j as KunSpacer,
119
- k as KunSwitch,
120
- q as KunTextField,
121
- M as KunToolbar,
118
+ R as KunRow,
119
+ j as KunSlider,
120
+ k as KunSpacer,
121
+ q as KunSwitch,
122
+ M as KunTextField,
123
+ N as KunToolbar,
122
124
  z as KunTooltip,
123
- hm as install
125
+ wm as install
124
126
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.117",
3
+ "version": "0.1.118",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",