@leaflink/stash 49.3.2 → 49.3.3
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/AddressSelect.js +2 -2
- package/dist/Badge.vue.d.ts +1 -1
- package/dist/CurrencyInput.js +4 -3
- package/dist/CurrencyInput.js.map +1 -1
- package/dist/CurrencyInput.vue.d.ts +4 -0
- package/dist/DataViewFilters.js +2 -2
- package/dist/DatePicker.js +2 -2
- package/dist/Field.js +2 -2
- package/dist/Field.vue.d.ts +7 -0
- package/dist/{Field.vue_vue_type_script_setup_true_lang-e1e4ff03.js → Field.vue_vue_type_script_setup_true_lang-3ea26741.js} +22 -19
- package/dist/Field.vue_vue_type_script_setup_true_lang-3ea26741.js.map +1 -0
- package/dist/FilterSelect.js +2 -2
- package/dist/Filters.js +2 -2
- package/dist/Filters.vue.d.ts +38 -0
- package/dist/InlineEdit.js +2 -2
- package/dist/Input.js +61 -59
- package/dist/Input.js.map +1 -1
- package/dist/Input.vue.d.ts +7 -0
- package/dist/InputOptions.js +52 -49
- package/dist/InputOptions.js.map +1 -1
- package/dist/InputOptions.vue.d.ts +7 -0
- package/dist/Label.js +1 -1
- package/dist/Label.vue.d.ts +6 -0
- package/dist/Label.vue_vue_type_script_setup_true_lang-b6ba2f02.js +43 -0
- package/dist/Label.vue_vue_type_script_setup_true_lang-b6ba2f02.js.map +1 -0
- package/dist/ListView.js +2 -2
- package/dist/ListView.vue.d.ts +76 -19
- package/dist/RadioGroup.js +2 -2
- package/dist/SearchBar.js +2 -2
- package/dist/Select.js +82 -81
- package/dist/Select.js.map +1 -1
- package/dist/SelectStatus.js +2 -2
- package/dist/TextEditor.js +6 -6
- package/dist/TextEditor.js.map +1 -1
- package/dist/Textarea.js +38 -34
- package/dist/Textarea.js.map +1 -1
- package/dist/Textarea.vue.d.ts +7 -0
- package/dist/components.css +2 -2
- package/package.json +1 -1
- package/dist/Field.vue_vue_type_script_setup_true_lang-e1e4ff03.js.map +0 -1
- package/dist/Label.vue_vue_type_script_setup_true_lang-4b02087f.js +0 -38
- package/dist/Label.vue_vue_type_script_setup_true_lang-4b02087f.js.map +0 -1
package/dist/Filters.vue.d.ts
CHANGED
|
@@ -496,6 +496,10 @@ declare const _default: DefineComponent<any, {
|
|
|
496
496
|
type: PropType<string>;
|
|
497
497
|
default: string;
|
|
498
498
|
};
|
|
499
|
+
disabled: {
|
|
500
|
+
type: PropType<boolean>;
|
|
501
|
+
default: boolean;
|
|
502
|
+
};
|
|
499
503
|
label: {
|
|
500
504
|
type: PropType<string>;
|
|
501
505
|
default: undefined;
|
|
@@ -547,6 +551,10 @@ declare const _default: DefineComponent<any, {
|
|
|
547
551
|
type: PropType<string>;
|
|
548
552
|
default: string;
|
|
549
553
|
};
|
|
554
|
+
disabled: {
|
|
555
|
+
type: PropType<boolean>;
|
|
556
|
+
default: boolean;
|
|
557
|
+
};
|
|
550
558
|
label: {
|
|
551
559
|
type: PropType<string>;
|
|
552
560
|
default: undefined;
|
|
@@ -588,6 +596,7 @@ declare const _default: DefineComponent<any, {
|
|
|
588
596
|
"onUpdate:model-value"?: ((v: string | number) => any) | undefined;
|
|
589
597
|
}>, {
|
|
590
598
|
type: string;
|
|
599
|
+
disabled: boolean;
|
|
591
600
|
label: string;
|
|
592
601
|
id: string;
|
|
593
602
|
errorText: string;
|
|
@@ -607,6 +616,10 @@ declare const _default: DefineComponent<any, {
|
|
|
607
616
|
type: PropType<string>;
|
|
608
617
|
default: string;
|
|
609
618
|
};
|
|
619
|
+
disabled: {
|
|
620
|
+
type: PropType<boolean>;
|
|
621
|
+
default: boolean;
|
|
622
|
+
};
|
|
610
623
|
label: {
|
|
611
624
|
type: PropType<string>;
|
|
612
625
|
default: undefined;
|
|
@@ -650,6 +663,7 @@ declare const _default: DefineComponent<any, {
|
|
|
650
663
|
inputEl: Ref<HTMLInputElement | undefined, HTMLInputElement | undefined>;
|
|
651
664
|
}, {}, {}, {}, {
|
|
652
665
|
type: string;
|
|
666
|
+
disabled: boolean;
|
|
653
667
|
label: string;
|
|
654
668
|
id: string;
|
|
655
669
|
errorText: string;
|
|
@@ -666,6 +680,10 @@ declare const _default: DefineComponent<any, {
|
|
|
666
680
|
type: PropType<string>;
|
|
667
681
|
default: string;
|
|
668
682
|
};
|
|
683
|
+
disabled: {
|
|
684
|
+
type: PropType<boolean>;
|
|
685
|
+
default: boolean;
|
|
686
|
+
};
|
|
669
687
|
label: {
|
|
670
688
|
type: PropType<string>;
|
|
671
689
|
default: undefined;
|
|
@@ -714,6 +732,7 @@ declare const _default: DefineComponent<any, {
|
|
|
714
732
|
blur: (evt: Event) => void;
|
|
715
733
|
}, string, {
|
|
716
734
|
type: string;
|
|
735
|
+
disabled: boolean;
|
|
717
736
|
label: string;
|
|
718
737
|
id: string;
|
|
719
738
|
errorText: string;
|
|
@@ -734,6 +753,10 @@ declare const _default: DefineComponent<any, {
|
|
|
734
753
|
type: PropType<string>;
|
|
735
754
|
default: string;
|
|
736
755
|
};
|
|
756
|
+
disabled: {
|
|
757
|
+
type: PropType<boolean>;
|
|
758
|
+
default: boolean;
|
|
759
|
+
};
|
|
737
760
|
label: {
|
|
738
761
|
type: PropType<string>;
|
|
739
762
|
default: undefined;
|
|
@@ -795,6 +818,10 @@ declare const _default: DefineComponent<any, {
|
|
|
795
818
|
type: PropType<string>;
|
|
796
819
|
default: string;
|
|
797
820
|
};
|
|
821
|
+
disabled: {
|
|
822
|
+
type: PropType<boolean>;
|
|
823
|
+
default: boolean;
|
|
824
|
+
};
|
|
798
825
|
label: {
|
|
799
826
|
type: PropType<string>;
|
|
800
827
|
default: undefined;
|
|
@@ -840,6 +867,7 @@ declare const _default: DefineComponent<any, {
|
|
|
840
867
|
}) => any) | undefined;
|
|
841
868
|
}>, {
|
|
842
869
|
type: string;
|
|
870
|
+
disabled: boolean;
|
|
843
871
|
label: string;
|
|
844
872
|
errorText: string;
|
|
845
873
|
hintText: string;
|
|
@@ -861,6 +889,10 @@ declare const _default: DefineComponent<any, {
|
|
|
861
889
|
type: PropType<string>;
|
|
862
890
|
default: string;
|
|
863
891
|
};
|
|
892
|
+
disabled: {
|
|
893
|
+
type: PropType<boolean>;
|
|
894
|
+
default: boolean;
|
|
895
|
+
};
|
|
864
896
|
label: {
|
|
865
897
|
type: PropType<string>;
|
|
866
898
|
default: undefined;
|
|
@@ -906,6 +938,7 @@ declare const _default: DefineComponent<any, {
|
|
|
906
938
|
}) => any) | undefined;
|
|
907
939
|
}>, {}, {}, {}, {}, {
|
|
908
940
|
type: string;
|
|
941
|
+
disabled: boolean;
|
|
909
942
|
label: string;
|
|
910
943
|
errorText: string;
|
|
911
944
|
hintText: string;
|
|
@@ -924,6 +957,10 @@ declare const _default: DefineComponent<any, {
|
|
|
924
957
|
type: PropType<string>;
|
|
925
958
|
default: string;
|
|
926
959
|
};
|
|
960
|
+
disabled: {
|
|
961
|
+
type: PropType<boolean>;
|
|
962
|
+
default: boolean;
|
|
963
|
+
};
|
|
927
964
|
label: {
|
|
928
965
|
type: PropType<string>;
|
|
929
966
|
default: undefined;
|
|
@@ -982,6 +1019,7 @@ declare const _default: DefineComponent<any, {
|
|
|
982
1019
|
}) => void;
|
|
983
1020
|
}, string, {
|
|
984
1021
|
type: string;
|
|
1022
|
+
disabled: boolean;
|
|
985
1023
|
label: string;
|
|
986
1024
|
errorText: string;
|
|
987
1025
|
hintText: string;
|
package/dist/InlineEdit.js
CHANGED
|
@@ -5,9 +5,9 @@ import "./constants.js";
|
|
|
5
5
|
import "./locale.js";
|
|
6
6
|
import "lodash-es/get";
|
|
7
7
|
import "lodash-es/isNil";
|
|
8
|
-
import "./Field.vue_vue_type_script_setup_true_lang-
|
|
8
|
+
import "./Field.vue_vue_type_script_setup_true_lang-3ea26741.js";
|
|
9
9
|
import "lodash-es/uniqueId";
|
|
10
|
-
import "./Label.vue_vue_type_script_setup_true_lang-
|
|
10
|
+
import "./Label.vue_vue_type_script_setup_true_lang-b6ba2f02.js";
|
|
11
11
|
import "./Icon.js";
|
|
12
12
|
import "./index-9e1095ef.js";
|
|
13
13
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
package/dist/Input.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as U, useSlots as G, useCssModule as L, useAttrs as O, ref as f, computed as v, watchEffect as W, onMounted as j, openBlock as m, createBlock as
|
|
2
|
-
import
|
|
3
|
-
import { convertDecimal as
|
|
4
|
-
import { _ as Q } from "./Field.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { defineComponent as U, useSlots as G, useCssModule as L, useAttrs as O, ref as f, computed as v, watchEffect as W, onMounted as j, openBlock as m, createBlock as V, mergeProps as k, unref as a, createSlots as q, withCtx as N, createElementVNode as x, withDirectives as H, vModelDynamic as J, createElementBlock as B, normalizeClass as y, renderSlot as b, createCommentVNode as C } from "vue";
|
|
2
|
+
import I from "lodash-es/isNil";
|
|
3
|
+
import { convertDecimal as $, sanitizeDecimal as K, decimalSeparator as _ } from "./utils/i18n.js";
|
|
4
|
+
import { _ as Q } from "./Field.vue_vue_type_script_setup_true_lang-3ea26741.js";
|
|
5
5
|
import R from "./Icon.js";
|
|
6
6
|
import { _ as X } from "./_plugin-vue_export-helper-dad06003.js";
|
|
7
7
|
import "./constants.js";
|
|
8
8
|
import "./locale.js";
|
|
9
9
|
import "lodash-es/get";
|
|
10
10
|
import "lodash-es/uniqueId";
|
|
11
|
-
import "./Label.vue_vue_type_script_setup_true_lang-
|
|
11
|
+
import "./Label.vue_vue_type_script_setup_true_lang-b6ba2f02.js";
|
|
12
12
|
import "./index-9e1095ef.js";
|
|
13
13
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
14
|
-
const Y = { class: "tw-relative" }, Z = ["id", "aria-errormessage", "aria-invalid", "autocomplete", "type"], ee = /* @__PURE__ */ U({
|
|
14
|
+
const Y = { class: "tw-relative" }, Z = ["id", "aria-errormessage", "aria-invalid", "autocomplete", "type", "disabled"], ee = /* @__PURE__ */ U({
|
|
15
15
|
name: "ll-input",
|
|
16
16
|
inheritAttrs: !1,
|
|
17
17
|
__name: "Input",
|
|
@@ -25,30 +25,31 @@ const Y = { class: "tw-relative" }, Z = ["id", "aria-errormessage", "aria-invali
|
|
|
25
25
|
autocomplete: { default: "off" },
|
|
26
26
|
modelValue: { default: "" },
|
|
27
27
|
value: { default: null },
|
|
28
|
-
type: { default: "text" }
|
|
28
|
+
type: { default: "text" },
|
|
29
|
+
disabled: { type: Boolean, default: !1 }
|
|
29
30
|
},
|
|
30
31
|
emits: ["update:model-value", "change", "focus", "blur"],
|
|
31
32
|
setup(E, { expose: S, emit: D }) {
|
|
32
|
-
const
|
|
33
|
+
const o = E, d = D, r = G(), l = L(), c = O(), h = f();
|
|
33
34
|
S({ inputEl: h });
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const p = f(!1), i = v(() =>
|
|
35
|
+
const n = f(o.modelValue);
|
|
36
|
+
o.type === "number" && (o.modelValue || o.modelValue === 0) && (n.value = $(o.modelValue, _));
|
|
37
|
+
const p = f(!1), i = v(() => o.type === "number"), M = v(() => {
|
|
37
38
|
const t = { ...c };
|
|
38
39
|
return delete t.class, t;
|
|
39
|
-
}), A = v(() => i.value ||
|
|
40
|
+
}), A = v(() => i.value || o.type === "password" && p.value ? "text" : o.type);
|
|
40
41
|
W(() => {
|
|
41
|
-
|
|
42
|
+
n.value = g(o.modelValue);
|
|
42
43
|
});
|
|
43
|
-
function
|
|
44
|
+
function w(t = "", s = !1) {
|
|
44
45
|
if (!i.value)
|
|
45
46
|
return t;
|
|
46
47
|
let e = t;
|
|
47
|
-
if (
|
|
48
|
+
if (I(e) || `${e}`.length === 0)
|
|
48
49
|
return "";
|
|
49
|
-
if (_ !== "." && (e =
|
|
50
|
+
if (_ !== "." && (e = $(e, ".")), s && (e === "." && (e = "0."), e.toString().startsWith("0.")))
|
|
50
51
|
return e;
|
|
51
|
-
if (
|
|
52
|
+
if (!I(e) && `${e}`.length)
|
|
52
53
|
e = Intl.NumberFormat("en-US", {
|
|
53
54
|
style: "decimal",
|
|
54
55
|
maximumFractionDigits: 7,
|
|
@@ -58,94 +59,95 @@ const Y = { class: "tw-relative" }, Z = ["id", "aria-errormessage", "aria-invali
|
|
|
58
59
|
return "";
|
|
59
60
|
return isNaN(Number(e)) ? "" : parseFloat(e);
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function g(t) {
|
|
62
63
|
return i.value ? K(t, _) : t;
|
|
63
64
|
}
|
|
64
65
|
function F() {
|
|
65
|
-
const t = i.value ?
|
|
66
|
+
const t = i.value ? w(n.value) : n.value;
|
|
66
67
|
d("change", t);
|
|
67
68
|
}
|
|
68
69
|
function T(t) {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const e = i.value ?
|
|
70
|
+
const s = t.target.value;
|
|
71
|
+
n.value = g(s);
|
|
72
|
+
const e = i.value ? w(n.value, !0) : s;
|
|
72
73
|
d("update:model-value", e);
|
|
73
74
|
}
|
|
74
75
|
return j(() => {
|
|
75
|
-
if (
|
|
76
|
+
if (o.value !== null)
|
|
76
77
|
throw new Error("ll-input: use :model-value or v-model instead of :value.");
|
|
77
78
|
if (c.onInput)
|
|
78
79
|
throw new Error("ll-input: use the @update:model-value event instead of @input");
|
|
79
|
-
}), (t,
|
|
80
|
-
class: ["stash-input", [
|
|
80
|
+
}), (t, s) => (m(), V(Q, k(o, {
|
|
81
|
+
class: ["stash-input", [a(l).root, a(c).class]],
|
|
81
82
|
"data-test": "ll-input"
|
|
82
83
|
}), q({
|
|
83
|
-
default:
|
|
84
|
-
|
|
85
|
-
H(
|
|
84
|
+
default: N(({ fieldId: e, fieldErrorId: z, hasError: P }) => [
|
|
85
|
+
x("div", Y, [
|
|
86
|
+
H(x("input", k(M.value, {
|
|
86
87
|
id: e,
|
|
87
88
|
ref_key: "inputEl",
|
|
88
89
|
ref: h,
|
|
89
|
-
"onUpdate:modelValue":
|
|
90
|
+
"onUpdate:modelValue": s[0] || (s[0] = (u) => n.value = u),
|
|
90
91
|
"aria-errormessage": z,
|
|
91
92
|
"aria-invalid": P,
|
|
92
93
|
autocomplete: t.autocomplete,
|
|
93
94
|
class: [
|
|
94
|
-
{ [
|
|
95
|
-
{ [
|
|
96
|
-
{ [
|
|
95
|
+
{ [a(l)["input-prepended"]]: !!a(r).prepend },
|
|
96
|
+
{ [a(l)["input-appended"]]: !!a(r).append || o.type === "password" },
|
|
97
|
+
{ [a(l)["has-error"]]: !!o.errorText }
|
|
97
98
|
],
|
|
98
99
|
type: A.value,
|
|
100
|
+
disabled: o.disabled,
|
|
99
101
|
onChange: F,
|
|
100
102
|
onInput: T,
|
|
101
|
-
onBlur:
|
|
102
|
-
onFocus:
|
|
103
|
+
onBlur: s[1] || (s[1] = (u) => d("blur", u)),
|
|
104
|
+
onFocus: s[2] || (s[2] = (u) => d("focus", u))
|
|
103
105
|
}), null, 16, Z), [
|
|
104
|
-
[J,
|
|
106
|
+
[J, n.value]
|
|
105
107
|
]),
|
|
106
|
-
|
|
108
|
+
a(r).prepend ? (m(), B("div", {
|
|
107
109
|
key: 0,
|
|
108
|
-
class:
|
|
110
|
+
class: y(["stash-input-prepend font-semibold", [a(l).symbol, a(l)["symbol--prepend"]]])
|
|
109
111
|
}, [
|
|
110
|
-
|
|
111
|
-
], 2)) :
|
|
112
|
-
|
|
112
|
+
b(t.$slots, "prepend")
|
|
113
|
+
], 2)) : C("", !0),
|
|
114
|
+
a(r).append || o.type === "password" ? (m(), B("div", {
|
|
113
115
|
key: 1,
|
|
114
|
-
class:
|
|
116
|
+
class: y(["stash-input-append font-semibold", [a(l).symbol, a(l)["symbol--append"]]])
|
|
115
117
|
}, [
|
|
116
|
-
|
|
118
|
+
a(r).append ? b(t.$slots, "append", { key: 0 }) : (m(), V(R, {
|
|
117
119
|
key: 1,
|
|
118
120
|
name: p.value ? "hide" : "show",
|
|
119
|
-
class: "tw-cursor-pointer",
|
|
121
|
+
class: y(["tw-cursor-pointer", { "tw-text-ice-500": o.disabled }]),
|
|
120
122
|
"data-test": p.value ? "hide-password-icon" : "show-password-icon",
|
|
121
|
-
onClick:
|
|
122
|
-
}, null, 8, ["name", "data-test"]))
|
|
123
|
-
], 2)) :
|
|
123
|
+
onClick: s[3] || (s[3] = (u) => p.value = !p.value)
|
|
124
|
+
}, null, 8, ["name", "class", "data-test"]))
|
|
125
|
+
], 2)) : C("", !0)
|
|
124
126
|
])
|
|
125
127
|
]),
|
|
126
128
|
_: 2
|
|
127
129
|
}, [
|
|
128
|
-
|
|
130
|
+
a(r).hint ? {
|
|
129
131
|
name: "hint",
|
|
130
|
-
fn:
|
|
131
|
-
|
|
132
|
+
fn: N(() => [
|
|
133
|
+
b(t.$slots, "hint")
|
|
132
134
|
]),
|
|
133
135
|
key: "0"
|
|
134
136
|
} : void 0
|
|
135
137
|
]), 1040, ["class"]));
|
|
136
138
|
}
|
|
137
|
-
}), te = "
|
|
139
|
+
}), te = "_root_12641_2", oe = "_symbol_12641_46", ae = {
|
|
138
140
|
root: te,
|
|
139
|
-
"has-error": "_has-
|
|
140
|
-
"input-prepended": "_input-
|
|
141
|
-
"input-appended": "_input-
|
|
141
|
+
"has-error": "_has-error_12641_34",
|
|
142
|
+
"input-prepended": "_input-prepended_12641_38",
|
|
143
|
+
"input-appended": "_input-appended_12641_42",
|
|
142
144
|
symbol: oe,
|
|
143
|
-
"symbol--prepend": "_symbol--
|
|
144
|
-
"symbol--append": "_symbol--
|
|
145
|
-
},
|
|
146
|
-
$style:
|
|
147
|
-
},
|
|
145
|
+
"symbol--prepend": "_symbol--prepend_12641_57",
|
|
146
|
+
"symbol--append": "_symbol--append_12641_63"
|
|
147
|
+
}, se = {
|
|
148
|
+
$style: ae
|
|
149
|
+
}, _e = /* @__PURE__ */ X(ee, [["__cssModules", se]]);
|
|
148
150
|
export {
|
|
149
|
-
|
|
151
|
+
_e as default
|
|
150
152
|
};
|
|
151
153
|
//# sourceMappingURL=Input.js.map
|
package/dist/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../src/components/Input/Input.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import isNil from 'lodash-es/isNil';\n import { computed, onMounted, ref, useAttrs, useCssModule, useSlots, watchEffect } from 'vue';\n\n import { convertDecimal, decimalSeparator, sanitizeDecimal } from '../../utils/i18n';\n import Field from '../Field/Field.vue';\n import Icon from '../Icon/Icon.vue';\n\n export type InputValue = string | number | undefined;\n\n export interface InputProps {\n /**\n * Adds spacing under the field that is consistent whether or not hint/error text is displayed.\n */\n addBottomSpace?: boolean;\n\n /**\n * Error text to display. Replaces `hintText` (if provided) & adds error styling.\n */\n errorText?: string;\n\n /**\n * Displays text below the input; hidden when the isReadOnly prop is truthy.\n */\n hintText?: string;\n\n /**\n * ID for the Label and Input; must be unique\n */\n id?: string;\n\n /**\n * Label to render above the input.\n */\n label?: string;\n\n /**\n * Show \"(optional)\" to the right of the label text\n */\n showOptionalInLabel?: boolean;\n\n /**\n * Autocomplete takes in a string of off or on\n */\n autocomplete?: string;\n\n /**\n * Value for the input element.\n */\n modelValue?: string | number;\n\n /**\n * @deprecated Use :model-value or v-model instead of :value.\n */\n value?: string | number | null;\n\n /**\n * Input type. Excludes certain types that have a dedicated component.\n *\n * Note: For distinguishing between text & number internally, passing `number`\n * will still render an input with a type of `text` (for localization).\n */\n type?: string extends 'button' | 'checkbox' | 'radio' | 'submit' ? never : string;\n }\n\n defineOptions({\n name: 'll-input',\n inheritAttrs: false,\n });\n\n const props = withDefaults(defineProps<InputProps>(), {\n autocomplete: 'off',\n type: 'text',\n modelValue: '',\n value: null,\n errorText: undefined,\n hintText: undefined,\n label: undefined,\n id: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the input value changes.\n */\n (e: 'update:model-value', v: string | number): void;\n /**\n * Emitted when the input value changes.\n */\n (e: 'change', v: string | number): void;\n /**\n * Emitted when the input is focused\n */\n (e: 'focus', evt: Event): void;\n /**\n * Emitted when the input is blurred\n */\n (e: 'blur', evt: Event): void;\n }>();\n\n const slots = useSlots();\n const classes = useCssModule();\n const attrs = useAttrs();\n\n // declare a ref to hold the element reference\n // the name must match template ref value\n const inputEl = ref<HTMLInputElement>();\n\n // this exposes the input ref to any parent that renders the `Input` component\n // and gives it a template ref, giving parent components access to the DOM element.\n defineExpose({ inputEl });\n\n const internalValue = ref<string | number>(props.modelValue);\n\n if (props.type === 'number' && (props.modelValue || props.modelValue === 0)) {\n internalValue.value = convertDecimal(props.modelValue, decimalSeparator);\n }\n\n const showPassword = ref(false);\n\n const isNumber = computed(() => props.type === 'number');\n\n const inputAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs.class;\n\n return tempAttrs;\n });\n\n const inputType = computed(() => {\n // type 'number' is a special use case and requires\n // that the type be 'text' to support internationalization\n if (isNumber.value) {\n return 'text';\n }\n\n if (props.type === 'password' && showPassword.value) {\n return 'text';\n }\n\n return props.type;\n });\n\n watchEffect(() => {\n internalValue.value = format(props.modelValue);\n });\n\n /**\n * Converts the localized number to a valid number (to emit). i.e. 12,50 > 12.50\n *\n * @param {string|number} value - Number you want to parse.\n * @returns {number|string} number or empty string (for empty input)\n */\n function parseNumber(value: string | number = '', isUserTyping = false): string | number {\n // If this isn't a number input, we shouldn't be calling this function\n if (!isNumber.value) {\n return value;\n }\n\n let tempValue = value;\n\n // If blank, just stop\n if (isNil(tempValue) || `${tempValue}`.length === 0) return '';\n\n // clean out different locale decimals\n if (decimalSeparator !== '.') {\n tempValue = convertDecimal(tempValue, '.');\n }\n\n // If the user is in the middle of an input, let them finish the number\n if (isUserTyping) {\n // Prefix values with a 0 if the user starts with a decimal point\n if (tempValue === '.') tempValue = '0.';\n\n // This is to prevent the parsing from correcting 0. to 0 and causing the value to be reset\n if (tempValue.toString().startsWith('0.')) return tempValue;\n }\n\n // Empty or null values convert to 0 with NumberFormat, so return '';\n if (!isNil(tempValue) && `${tempValue}`.length) {\n tempValue = Intl.NumberFormat('en-US', {\n style: 'decimal',\n maximumFractionDigits: 7,\n useGrouping: false,\n }).format(Number(tempValue));\n } else {\n return '';\n }\n\n // Ensure valid number, otherwise clear value\n return isNaN(Number(tempValue)) ? '' : parseFloat(tempValue);\n }\n\n /**\n * Formats the input based on conditions\n *\n * @param {number|string} value - The value to format.\n */\n function format(value: string | number) {\n if (isNumber.value) {\n return sanitizeDecimal(value, decimalSeparator);\n }\n\n return value;\n }\n\n /**\n * Fire after focusing out of input, if value has changed.\n */\n function handleChange() {\n // Parse the final value on blur\n const parsedValue = isNumber.value ? parseNumber(internalValue.value) : internalValue.value;\n emit('change', parsedValue);\n }\n\n /**\n * Fired when typing on input.\n */\n function handleInput(e: Event) {\n const value = (e.target as HTMLInputElement).value;\n\n // Update the internal value with a sanitized version\n internalValue.value = format(value);\n\n const parsedValue = isNumber.value ? parseNumber(internalValue.value, true) : value;\n\n emit('update:model-value', parsedValue);\n }\n\n onMounted(() => {\n if (props.value !== null) {\n throw new Error('ll-input: use :model-value or v-model instead of :value.');\n }\n\n if (attrs.onInput) {\n throw new Error('ll-input: use the @update:model-value event instead of @input');\n }\n });\n</script>\n\n<template>\n <Field v-bind=\"props\" class=\"stash-input\" :class=\"[classes.root, attrs.class]\" data-test=\"ll-input\">\n <template #default=\"{ fieldId, fieldErrorId, hasError }\">\n <div class=\"tw-relative\">\n <input\n v-bind=\"inputAttrs\"\n :id=\"fieldId\"\n ref=\"inputEl\"\n v-model=\"internalValue\"\n :aria-errormessage=\"fieldErrorId\"\n :aria-invalid=\"hasError\"\n :autocomplete=\"autocomplete\"\n :class=\"[\n { [classes['input-prepended']]: !!slots.prepend },\n { [classes['input-appended']]: !!slots.append || props.type === 'password' },\n { [classes['has-error']]: !!props.errorText },\n ]\"\n :type=\"inputType\"\n @change=\"handleChange\"\n @input=\"handleInput\"\n @blur=\"(evt) => emit('blur', evt)\"\n @focus=\"(evt) => emit('focus', evt)\"\n />\n\n <div\n v-if=\"slots.prepend\"\n class=\"stash-input-prepend font-semibold\"\n :class=\"[classes.symbol, classes['symbol--prepend']]\"\n >\n <!-- @slot renders content on the left side of the input -->\n <slot name=\"prepend\"> </slot>\n </div>\n\n <div\n v-if=\"slots.append || props.type === 'password'\"\n class=\"stash-input-append font-semibold\"\n :class=\"[classes.symbol, classes['symbol--append']]\"\n >\n <!-- @slot renders content on the right side of the input -->\n <slot v-if=\"slots.append\" name=\"append\"></slot>\n <Icon\n v-else\n :name=\"showPassword ? 'hide' : 'show'\"\n class=\"tw-cursor-pointer\"\n :data-test=\"showPassword ? 'hide-password-icon' : 'show-password-icon'\"\n @click=\"showPassword = !showPassword\"\n />\n </div>\n </div>\n </template>\n <template v-if=\"slots.hint\" #hint>\n <slot name=\"hint\"></slot>\n </template>\n </Field>\n</template>\n\n<style module>\n .root {\n position: relative;\n }\n\n .root input {\n background: var(--color-white);\n border: 1px solid var(--color-ice-500);\n border-radius: theme('borderRadius.DEFAULT');\n color: var(--color-ice-700);\n display: block;\n height: theme('height.input');\n font-size: theme('fontSize.sm');\n font-weight: theme('fontWeight.normal');\n outline: none;\n padding: 0 theme('spacing.3');\n width: 100%;\n }\n\n .root input:hover {\n border-color: var(--color-ice-500);\n }\n\n .root input:active,\n .root input:focus {\n border-color: var(--color-blue-500);\n }\n\n .root input::placeholder {\n color: var(--color-ice-500);\n opacity: 1;\n }\n\n .root input.has-error:not(:focus) {\n border-color: var(--color-red-500);\n }\n\n .root input.input-prepended {\n padding-left: 36px;\n }\n\n .root input.input-appended {\n padding-right: 36px;\n }\n\n .root input[disabled],\n .root input[readonly] {\n background-color: var(--color-ice-200) !important;\n border-color: var(--color-ice-500) !important;\n color: var(--color-ice-700) !important;\n pointer-events: none;\n }\n\n .root input[disabled]:active,\n .root input[readonly]:active,\n .root input[disabled]:focus,\n .root input[readonly]:focus {\n box-shadow: none !important;\n }\n\n .root input[disabled]::placeholder,\n .root input[readonly]::placeholder {\n text-transform: none;\n }\n\n .symbol {\n align-items: center;\n display: flex;\n height: theme('height.input');\n justify-content: center;\n overflow: hidden;\n position: absolute;\n top: 0;\n width: theme('height.input');\n }\n\n .symbol--prepend {\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n border-top-left-radius: theme('borderRadius.DEFAULT');\n left: 0;\n }\n\n .symbol--append {\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n border-top-right-radius: theme('borderRadius.DEFAULT');\n right: 0;\n }\n</style>\n"],"names":["props","__props","emit","__emit","slots","useSlots","classes","useCssModule","attrs","useAttrs","inputEl","ref","__expose","internalValue","convertDecimal","decimalSeparator","showPassword","isNumber","computed","inputAttrs","tempAttrs","inputType","watchEffect","format","parseNumber","value","isUserTyping","tempValue","isNil","sanitizeDecimal","handleChange","parsedValue","handleInput","e","onMounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEE,UAAMA,IAAQC,GAWRC,IAAOC,GAmBPC,IAAQC,KACRC,IAAUC,KACVC,IAAQC,KAIRC,IAAUC;AAIH,IAAAC,EAAA,EAAE,SAAAF,GAAS;AAElB,UAAAG,IAAgBF,EAAqBX,EAAM,UAAU;AAE3D,IAAIA,EAAM,SAAS,aAAaA,EAAM,cAAcA,EAAM,eAAe,OACvEa,EAAc,QAAQC,EAAed,EAAM,YAAYe,CAAgB;AAGnE,UAAAC,IAAeL,EAAI,EAAK,GAExBM,IAAWC,EAAS,MAAMlB,EAAM,SAAS,QAAQ,GAEjDmB,IAAaD,EAAS,MAAM;AAC1B,YAAAE,IAAY,EAAE,GAAGZ;AAEvB,oBAAOY,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAYH,EAAS,MAGrBD,EAAS,SAITjB,EAAM,SAAS,cAAcgB,EAAa,QACrC,SAGFhB,EAAM,IACd;AAED,IAAAsB,EAAY,MAAM;AACF,MAAAT,EAAA,QAAQU,EAAOvB,EAAM,UAAU;AAAA,IAAA,CAC9C;AAQD,aAASwB,EAAYC,IAAyB,IAAIC,IAAe,IAAwB;AAEnF,UAAA,CAACT,EAAS;AACL,eAAAQ;AAGT,UAAIE,IAAYF;AAGhB,UAAIG,EAAMD,CAAS,KAAK,GAAGA,IAAY,WAAW;AAAU,eAAA;AAQ5D,UALIZ,MAAqB,QACXY,IAAAb,EAAea,GAAW,GAAG,IAIvCD,MAEEC,MAAc,QAAiBA,IAAA,OAG/BA,EAAU,WAAW,WAAW,IAAI;AAAU,eAAAA;AAIpD,UAAI,CAACC,EAAMD,CAAS,KAAK,GAAGA,IAAY;AAC1B,QAAAA,IAAA,KAAK,aAAa,SAAS;AAAA,UACrC,OAAO;AAAA,UACP,uBAAuB;AAAA,UACvB,aAAa;AAAA,QACd,CAAA,EAAE,OAAO,OAAOA,CAAS,CAAC;AAAA;AAEpB,eAAA;AAIT,aAAO,MAAM,OAAOA,CAAS,CAAC,IAAI,KAAK,WAAWA,CAAS;AAAA,IAC7D;AAOA,aAASJ,EAAOE,GAAwB;AACtC,aAAIR,EAAS,QACJY,EAAgBJ,GAAOV,CAAgB,IAGzCU;AAAA,IACT;AAKA,aAASK,IAAe;AAEtB,YAAMC,IAAcd,EAAS,QAAQO,EAAYX,EAAc,KAAK,IAAIA,EAAc;AACtF,MAAAX,EAAK,UAAU6B,CAAW;AAAA,IAC5B;AAKA,aAASC,EAAYC,GAAU;AACvB,YAAAR,IAASQ,EAAE,OAA4B;AAG/B,MAAApB,EAAA,QAAQU,EAAOE,CAAK;AAElC,YAAMM,IAAcd,EAAS,QAAQO,EAAYX,EAAc,OAAO,EAAI,IAAIY;AAE9E,MAAAvB,EAAK,sBAAsB6B,CAAW;AAAA,IACxC;AAEA,WAAAG,EAAU,MAAM;AACV,UAAAlC,EAAM,UAAU;AACZ,cAAA,IAAI,MAAM,0DAA0D;AAG5E,UAAIQ,EAAM;AACF,cAAA,IAAI,MAAM,+DAA+D;AAAA,IACjF,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Input.js","sources":["../src/components/Input/Input.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import isNil from 'lodash-es/isNil';\n import { computed, onMounted, ref, useAttrs, useCssModule, useSlots, watchEffect } from 'vue';\n\n import { convertDecimal, decimalSeparator, sanitizeDecimal } from '../../utils/i18n';\n import Field from '../Field/Field.vue';\n import Icon from '../Icon/Icon.vue';\n\n export type InputValue = string | number | undefined;\n\n export interface InputProps {\n /**\n * Adds spacing under the field that is consistent whether or not hint/error text is displayed.\n */\n addBottomSpace?: boolean;\n\n /**\n * Error text to display. Replaces `hintText` (if provided) & adds error styling.\n */\n errorText?: string;\n\n /**\n * Displays text below the input; hidden when the isReadOnly prop is truthy.\n */\n hintText?: string;\n\n /**\n * ID for the Label and Input; must be unique\n */\n id?: string;\n\n /**\n * Label to render above the input.\n */\n label?: string;\n\n /**\n * Show \"(optional)\" to the right of the label text\n */\n showOptionalInLabel?: boolean;\n\n /**\n * Autocomplete takes in a string of off or on\n */\n autocomplete?: string;\n\n /**\n * Value for the input element.\n */\n modelValue?: string | number;\n\n /**\n * @deprecated Use :model-value or v-model instead of :value.\n */\n value?: string | number | null;\n\n /**\n * Input type. Excludes certain types that have a dedicated component.\n *\n * Note: For distinguishing between text & number internally, passing `number`\n * will still render an input with a type of `text` (for localization).\n */\n type?: string extends 'button' | 'checkbox' | 'radio' | 'submit' ? never : string;\n\n /**\n * Indicates whether the input is disabled.\n */\n disabled?: boolean;\n }\n\n defineOptions({\n name: 'll-input',\n inheritAttrs: false,\n });\n\n const props = withDefaults(defineProps<InputProps>(), {\n autocomplete: 'off',\n type: 'text',\n modelValue: '',\n value: null,\n errorText: undefined,\n hintText: undefined,\n label: undefined,\n id: undefined,\n disabled: false,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the input value changes.\n */\n (e: 'update:model-value', v: string | number): void;\n /**\n * Emitted when the input value changes.\n */\n (e: 'change', v: string | number): void;\n /**\n * Emitted when the input is focused\n */\n (e: 'focus', evt: Event): void;\n /**\n * Emitted when the input is blurred\n */\n (e: 'blur', evt: Event): void;\n }>();\n\n const slots = useSlots();\n const classes = useCssModule();\n const attrs = useAttrs();\n\n // declare a ref to hold the element reference\n // the name must match template ref value\n const inputEl = ref<HTMLInputElement>();\n\n // this exposes the input ref to any parent that renders the `Input` component\n // and gives it a template ref, giving parent components access to the DOM element.\n defineExpose({ inputEl });\n\n const internalValue = ref<string | number>(props.modelValue);\n\n if (props.type === 'number' && (props.modelValue || props.modelValue === 0)) {\n internalValue.value = convertDecimal(props.modelValue, decimalSeparator);\n }\n\n const showPassword = ref(false);\n\n const isNumber = computed(() => props.type === 'number');\n\n const inputAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs.class;\n\n return tempAttrs;\n });\n\n const inputType = computed(() => {\n // type 'number' is a special use case and requires\n // that the type be 'text' to support internationalization\n if (isNumber.value) {\n return 'text';\n }\n\n if (props.type === 'password' && showPassword.value) {\n return 'text';\n }\n\n return props.type;\n });\n\n watchEffect(() => {\n internalValue.value = format(props.modelValue);\n });\n\n /**\n * Converts the localized number to a valid number (to emit). i.e. 12,50 > 12.50\n *\n * @param {string|number} value - Number you want to parse.\n * @returns {number|string} number or empty string (for empty input)\n */\n function parseNumber(value: string | number = '', isUserTyping = false): string | number {\n // If this isn't a number input, we shouldn't be calling this function\n if (!isNumber.value) {\n return value;\n }\n\n let tempValue = value;\n\n // If blank, just stop\n if (isNil(tempValue) || `${tempValue}`.length === 0) return '';\n\n // clean out different locale decimals\n if (decimalSeparator !== '.') {\n tempValue = convertDecimal(tempValue, '.');\n }\n\n // If the user is in the middle of an input, let them finish the number\n if (isUserTyping) {\n // Prefix values with a 0 if the user starts with a decimal point\n if (tempValue === '.') tempValue = '0.';\n\n // This is to prevent the parsing from correcting 0. to 0 and causing the value to be reset\n if (tempValue.toString().startsWith('0.')) return tempValue;\n }\n\n // Empty or null values convert to 0 with NumberFormat, so return '';\n if (!isNil(tempValue) && `${tempValue}`.length) {\n tempValue = Intl.NumberFormat('en-US', {\n style: 'decimal',\n maximumFractionDigits: 7,\n useGrouping: false,\n }).format(Number(tempValue));\n } else {\n return '';\n }\n\n // Ensure valid number, otherwise clear value\n return isNaN(Number(tempValue)) ? '' : parseFloat(tempValue);\n }\n\n /**\n * Formats the input based on conditions\n *\n * @param {number|string} value - The value to format.\n */\n function format(value: string | number) {\n if (isNumber.value) {\n return sanitizeDecimal(value, decimalSeparator);\n }\n\n return value;\n }\n\n /**\n * Fire after focusing out of input, if value has changed.\n */\n function handleChange() {\n // Parse the final value on blur\n const parsedValue = isNumber.value ? parseNumber(internalValue.value) : internalValue.value;\n emit('change', parsedValue);\n }\n\n /**\n * Fired when typing on input.\n */\n function handleInput(e: Event) {\n const value = (e.target as HTMLInputElement).value;\n\n // Update the internal value with a sanitized version\n internalValue.value = format(value);\n\n const parsedValue = isNumber.value ? parseNumber(internalValue.value, true) : value;\n\n emit('update:model-value', parsedValue);\n }\n\n onMounted(() => {\n if (props.value !== null) {\n throw new Error('ll-input: use :model-value or v-model instead of :value.');\n }\n\n if (attrs.onInput) {\n throw new Error('ll-input: use the @update:model-value event instead of @input');\n }\n });\n</script>\n\n<template>\n <Field v-bind=\"props\" class=\"stash-input\" :class=\"[classes.root, attrs.class]\" data-test=\"ll-input\">\n <template #default=\"{ fieldId, fieldErrorId, hasError }\">\n <div class=\"tw-relative\">\n <input\n v-bind=\"inputAttrs\"\n :id=\"fieldId\"\n ref=\"inputEl\"\n v-model=\"internalValue\"\n :aria-errormessage=\"fieldErrorId\"\n :aria-invalid=\"hasError\"\n :autocomplete=\"autocomplete\"\n :class=\"[\n { [classes['input-prepended']]: !!slots.prepend },\n { [classes['input-appended']]: !!slots.append || props.type === 'password' },\n { [classes['has-error']]: !!props.errorText },\n ]\"\n :type=\"inputType\"\n :disabled=\"props.disabled\"\n @change=\"handleChange\"\n @input=\"handleInput\"\n @blur=\"(evt) => emit('blur', evt)\"\n @focus=\"(evt) => emit('focus', evt)\"\n />\n\n <div\n v-if=\"slots.prepend\"\n class=\"stash-input-prepend font-semibold\"\n :class=\"[classes.symbol, classes['symbol--prepend']]\"\n >\n <!-- @slot renders content on the left side of the input -->\n <slot name=\"prepend\"> </slot>\n </div>\n\n <div\n v-if=\"slots.append || props.type === 'password'\"\n class=\"stash-input-append font-semibold\"\n :class=\"[classes.symbol, classes['symbol--append']]\"\n >\n <!-- @slot renders content on the right side of the input -->\n <slot v-if=\"slots.append\" name=\"append\"></slot>\n <Icon\n v-else\n :name=\"showPassword ? 'hide' : 'show'\"\n class=\"tw-cursor-pointer\"\n :class=\"{ 'tw-text-ice-500': props.disabled }\"\n :data-test=\"showPassword ? 'hide-password-icon' : 'show-password-icon'\"\n @click=\"showPassword = !showPassword\"\n />\n </div>\n </div>\n </template>\n <template v-if=\"slots.hint\" #hint>\n <slot name=\"hint\"></slot>\n </template>\n </Field>\n</template>\n\n<style module>\n .root {\n position: relative;\n }\n\n .root input {\n background: var(--color-white);\n border: 1px solid var(--color-ice-500);\n border-radius: theme('borderRadius.DEFAULT');\n color: var(--color-ice-700);\n display: block;\n height: theme('height.input');\n font-size: theme('fontSize.sm');\n font-weight: theme('fontWeight.normal');\n outline: none;\n padding: 0 theme('spacing.3');\n width: 100%;\n }\n\n .root input:hover {\n border-color: var(--color-ice-500);\n }\n\n .root input:active,\n .root input:focus {\n border-color: var(--color-blue-500);\n }\n\n .root input::placeholder {\n color: var(--color-ice-500);\n opacity: 1;\n }\n\n .root input.has-error:not(:focus) {\n border-color: var(--color-red-500);\n }\n\n .root input.input-prepended {\n padding-left: 36px;\n }\n\n .root input.input-appended {\n padding-right: 36px;\n }\n\n .symbol {\n align-items: center;\n display: flex;\n height: theme('height.input');\n justify-content: center;\n overflow: hidden;\n position: absolute;\n top: 0;\n width: theme('height.input');\n }\n\n .symbol--prepend {\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n border-top-left-radius: theme('borderRadius.DEFAULT');\n left: 0;\n }\n\n .symbol--append {\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n border-top-right-radius: theme('borderRadius.DEFAULT');\n right: 0;\n }\n\n .root input[disabled],\n .root input[readonly] {\n background-color: var(--color-ice-100) !important;\n border-color: var(--color-ice-500) !important;\n color: var(--color-ice-500) !important;\n pointer-events: none;\n outline-color: var(--color-ice-500) !important;\n\n & + .symbol--prepend,\n & + .symbol--append {\n color: var(--color-ice-500);\n }\n }\n\n .root input[disabled]:active,\n .root input[readonly]:active,\n .root input[disabled]:focus,\n .root input[readonly]:focus {\n box-shadow: none !important;\n }\n\n .root input[disabled]::placeholder,\n .root input[readonly]::placeholder {\n text-transform: none;\n }\n</style>\n"],"names":["props","__props","emit","__emit","slots","useSlots","classes","useCssModule","attrs","useAttrs","inputEl","ref","__expose","internalValue","convertDecimal","decimalSeparator","showPassword","isNumber","computed","inputAttrs","tempAttrs","inputType","watchEffect","format","parseNumber","value","isUserTyping","tempValue","isNil","sanitizeDecimal","handleChange","parsedValue","handleInput","e","onMounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EE,UAAMA,IAAQC,GAYRC,IAAOC,GAmBPC,IAAQC,KACRC,IAAUC,KACVC,IAAQC,KAIRC,IAAUC;AAIH,IAAAC,EAAA,EAAE,SAAAF,GAAS;AAElB,UAAAG,IAAgBF,EAAqBX,EAAM,UAAU;AAE3D,IAAIA,EAAM,SAAS,aAAaA,EAAM,cAAcA,EAAM,eAAe,OACvEa,EAAc,QAAQC,EAAed,EAAM,YAAYe,CAAgB;AAGnE,UAAAC,IAAeL,EAAI,EAAK,GAExBM,IAAWC,EAAS,MAAMlB,EAAM,SAAS,QAAQ,GAEjDmB,IAAaD,EAAS,MAAM;AAC1B,YAAAE,IAAY,EAAE,GAAGZ;AAEvB,oBAAOY,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAYH,EAAS,MAGrBD,EAAS,SAITjB,EAAM,SAAS,cAAcgB,EAAa,QACrC,SAGFhB,EAAM,IACd;AAED,IAAAsB,EAAY,MAAM;AACF,MAAAT,EAAA,QAAQU,EAAOvB,EAAM,UAAU;AAAA,IAAA,CAC9C;AAQD,aAASwB,EAAYC,IAAyB,IAAIC,IAAe,IAAwB;AAEnF,UAAA,CAACT,EAAS;AACL,eAAAQ;AAGT,UAAIE,IAAYF;AAGhB,UAAIG,EAAMD,CAAS,KAAK,GAAGA,IAAY,WAAW;AAAU,eAAA;AAQ5D,UALIZ,MAAqB,QACXY,IAAAb,EAAea,GAAW,GAAG,IAIvCD,MAEEC,MAAc,QAAiBA,IAAA,OAG/BA,EAAU,WAAW,WAAW,IAAI;AAAU,eAAAA;AAIpD,UAAI,CAACC,EAAMD,CAAS,KAAK,GAAGA,IAAY;AAC1B,QAAAA,IAAA,KAAK,aAAa,SAAS;AAAA,UACrC,OAAO;AAAA,UACP,uBAAuB;AAAA,UACvB,aAAa;AAAA,QACd,CAAA,EAAE,OAAO,OAAOA,CAAS,CAAC;AAAA;AAEpB,eAAA;AAIT,aAAO,MAAM,OAAOA,CAAS,CAAC,IAAI,KAAK,WAAWA,CAAS;AAAA,IAC7D;AAOA,aAASJ,EAAOE,GAAwB;AACtC,aAAIR,EAAS,QACJY,EAAgBJ,GAAOV,CAAgB,IAGzCU;AAAA,IACT;AAKA,aAASK,IAAe;AAEtB,YAAMC,IAAcd,EAAS,QAAQO,EAAYX,EAAc,KAAK,IAAIA,EAAc;AACtF,MAAAX,EAAK,UAAU6B,CAAW;AAAA,IAC5B;AAKA,aAASC,EAAYC,GAAU;AACvB,YAAAR,IAASQ,EAAE,OAA4B;AAG/B,MAAApB,EAAA,QAAQU,EAAOE,CAAK;AAElC,YAAMM,IAAcd,EAAS,QAAQO,EAAYX,EAAc,OAAO,EAAI,IAAIY;AAE9E,MAAAvB,EAAK,sBAAsB6B,CAAW;AAAA,IACxC;AAEA,WAAAG,EAAU,MAAM;AACV,UAAAlC,EAAM,UAAU;AACZ,cAAA,IAAI,MAAM,0DAA0D;AAG5E,UAAIQ,EAAM;AACF,cAAA,IAAI,MAAM,+DAA+D;AAAA,IACjF,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Input.vue.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<ExtractPropTypes
|
|
|
42
42
|
hintText: undefined;
|
|
43
43
|
label: undefined;
|
|
44
44
|
id: undefined;
|
|
45
|
+
disabled: boolean;
|
|
45
46
|
}>>, {
|
|
46
47
|
inputEl: Ref<HTMLInputElement | undefined, HTMLInputElement | undefined>;
|
|
47
48
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
@@ -58,6 +59,7 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<ExtractPropTypes
|
|
|
58
59
|
hintText: undefined;
|
|
59
60
|
label: undefined;
|
|
60
61
|
id: undefined;
|
|
62
|
+
disabled: boolean;
|
|
61
63
|
}>>> & Readonly<{
|
|
62
64
|
onBlur?: ((evt: Event) => any) | undefined;
|
|
63
65
|
onChange?: ((v: string | number) => any) | undefined;
|
|
@@ -65,6 +67,7 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<ExtractPropTypes
|
|
|
65
67
|
"onUpdate:model-value"?: ((v: string | number) => any) | undefined;
|
|
66
68
|
}>, {
|
|
67
69
|
type: string;
|
|
70
|
+
disabled: boolean;
|
|
68
71
|
label: string;
|
|
69
72
|
id: string;
|
|
70
73
|
errorText: string;
|
|
@@ -123,6 +126,10 @@ export declare interface InputProps {
|
|
|
123
126
|
* will still render an input with a type of `text` (for localization).
|
|
124
127
|
*/
|
|
125
128
|
type?: string extends 'button' | 'checkbox' | 'radio' | 'submit' ? never : string;
|
|
129
|
+
/**
|
|
130
|
+
* Indicates whether the input is disabled.
|
|
131
|
+
*/
|
|
132
|
+
disabled?: boolean;
|
|
126
133
|
}
|
|
127
134
|
|
|
128
135
|
export declare type InputValue = string | number | undefined;
|
package/dist/InputOptions.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { _ as N } from "./Field.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { defineComponent as B, useAttrs as S, useSlots as k, useCssModule as T, ref as d, computed as c, watchEffect as $, watch as v, openBlock as E, createBlock as A, mergeProps as m, createSlots as M, withCtx as f, createElementVNode as O, normalizeClass as z, unref as i, createVNode as h, renderSlot as F } from "vue";
|
|
2
|
+
import { _ as N } from "./Field.vue_vue_type_script_setup_true_lang-3ea26741.js";
|
|
3
3
|
import U from "./Input.js";
|
|
4
4
|
import P from "./Select.js";
|
|
5
5
|
import { _ as j } from "./_plugin-vue_export-helper-dad06003.js";
|
|
6
6
|
import "lodash-es/uniqueId";
|
|
7
|
-
import "./Label.vue_vue_type_script_setup_true_lang-
|
|
7
|
+
import "./Label.vue_vue_type_script_setup_true_lang-b6ba2f02.js";
|
|
8
8
|
import "./locale.js";
|
|
9
9
|
import "lodash-es/get";
|
|
10
10
|
import "lodash-es/isNil";
|
|
@@ -29,7 +29,7 @@ import "./directives/clickoutside.js";
|
|
|
29
29
|
import "./MenusPlugin-9288029a.js";
|
|
30
30
|
import "./Chip.js";
|
|
31
31
|
import "./utils/colorScheme.js";
|
|
32
|
-
const q = /* @__PURE__ */
|
|
32
|
+
const q = /* @__PURE__ */ B({
|
|
33
33
|
name: "ll-input-options",
|
|
34
34
|
__name: "InputOptions",
|
|
35
35
|
props: {
|
|
@@ -39,99 +39,102 @@ const q = /* @__PURE__ */ S({
|
|
|
39
39
|
modelValue: { default: () => ({ value: "", option: void 0 }) },
|
|
40
40
|
type: { default: "text" },
|
|
41
41
|
noTruncate: { type: Boolean, default: !1 },
|
|
42
|
-
options: { default: () => [] }
|
|
42
|
+
options: { default: () => [] },
|
|
43
|
+
disabled: { type: Boolean, default: !1 }
|
|
43
44
|
},
|
|
44
45
|
emits: ["update:model-value", "change"],
|
|
45
|
-
setup(_, { emit:
|
|
46
|
-
const
|
|
47
|
-
const { disabled: e, placeholder:
|
|
48
|
-
return { disabled: e, placeholder:
|
|
46
|
+
setup(_, { emit: y }) {
|
|
47
|
+
const t = _, a = y, s = S(), g = k(), u = T(), n = d(), p = d(!1), o = d(), w = c(() => {
|
|
48
|
+
const { disabled: e, placeholder: l } = s;
|
|
49
|
+
return { disabled: e, placeholder: l };
|
|
49
50
|
}), V = c(() => {
|
|
50
|
-
const { disabled: e, displayBy:
|
|
51
|
-
return { disabled: e, displayBy:
|
|
51
|
+
const { disabled: e, displayBy: l, trackBy: r } = s;
|
|
52
|
+
return { disabled: e, displayBy: l, trackBy: r };
|
|
52
53
|
});
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
value:
|
|
56
|
-
option:
|
|
54
|
+
function b(e) {
|
|
55
|
+
n.value = String(e), a("update:model-value", {
|
|
56
|
+
value: n.value,
|
|
57
|
+
option: o.value,
|
|
57
58
|
isValueChange: !0,
|
|
58
59
|
type: "input"
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function C() {
|
|
62
63
|
a("change", {
|
|
63
|
-
value:
|
|
64
|
-
option:
|
|
64
|
+
value: n.value,
|
|
65
|
+
option: o.value,
|
|
65
66
|
isValueChange: !0,
|
|
66
67
|
type: "input"
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
71
|
-
value:
|
|
72
|
-
option:
|
|
70
|
+
function x(e) {
|
|
71
|
+
o.value = e, a("change", {
|
|
72
|
+
value: n.value,
|
|
73
|
+
option: o.value,
|
|
73
74
|
isValueChange: !1,
|
|
74
75
|
type: "select"
|
|
75
76
|
}), a("update:model-value", {
|
|
76
|
-
value:
|
|
77
|
-
option:
|
|
77
|
+
value: n.value,
|
|
78
|
+
option: o.value,
|
|
78
79
|
isValueChange: !1,
|
|
79
80
|
type: "select"
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
|
-
if (
|
|
83
|
-
|
|
83
|
+
if ($(() => {
|
|
84
|
+
o.value || (o.value = t.options[0]);
|
|
84
85
|
}), v(
|
|
85
|
-
() =>
|
|
86
|
+
() => t.modelValue.value,
|
|
86
87
|
() => {
|
|
87
|
-
|
|
88
|
+
n.value = t.modelValue.value;
|
|
88
89
|
},
|
|
89
90
|
{ immediate: !0 }
|
|
90
91
|
), v(
|
|
91
|
-
() =>
|
|
92
|
+
() => t.modelValue.option,
|
|
92
93
|
() => {
|
|
93
|
-
|
|
94
|
+
o.value = t.modelValue.option;
|
|
94
95
|
},
|
|
95
96
|
{ immediate: !0 }
|
|
96
97
|
), s.value)
|
|
97
98
|
throw new Error("ll-input-options: use :model-value or v-model instead of :value.");
|
|
98
99
|
if (s.onInput)
|
|
99
100
|
throw new Error("ll-input-options: use the @update:model-value event instead of @input");
|
|
100
|
-
return (e,
|
|
101
|
+
return (e, l) => (E(), A(N, m(t, {
|
|
101
102
|
class: "stash-input-options",
|
|
102
103
|
"data-test": "stash-input-options"
|
|
103
104
|
}), M({
|
|
104
105
|
default: f(({ fieldId: r }) => [
|
|
105
106
|
O("div", {
|
|
106
|
-
class: z(["tw-flex", { [u
|
|
107
|
+
class: z(["tw-flex", { [i(u)["has-error"]]: !!t.errorText }])
|
|
107
108
|
}, [
|
|
108
|
-
h(U,
|
|
109
|
+
h(U, m(w.value, {
|
|
109
110
|
id: r,
|
|
110
|
-
class: ["stash-input-options__input -tw-mr-[1px] tw-inline-block tw-flex-1", [u
|
|
111
|
+
class: ["stash-input-options__input -tw-mr-[1px] tw-inline-block tw-flex-1", [i(u).input, { "tw-z-control": p.value }]],
|
|
111
112
|
"data-test": "stash-input-options|input",
|
|
112
|
-
type:
|
|
113
|
-
"model-value":
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
type: t.type,
|
|
114
|
+
"model-value": n.value,
|
|
115
|
+
disabled: t.disabled,
|
|
116
|
+
onChange: C,
|
|
117
|
+
"onUpdate:modelValue": b,
|
|
118
|
+
onBlur: l[0] || (l[0] = (I) => p.value = !1),
|
|
119
|
+
onFocus: l[1] || (l[1] = (I) => p.value = !0)
|
|
120
|
+
}), null, 16, ["id", "class", "type", "model-value", "disabled"]),
|
|
121
|
+
h(P, m(V.value, {
|
|
120
122
|
single: "",
|
|
121
123
|
"hide-search": "",
|
|
122
124
|
"prevent-empty": "",
|
|
123
|
-
class: ["stash-input-options__select tw-min-w-20", u
|
|
125
|
+
class: ["stash-input-options__select tw-min-w-20", i(u).select],
|
|
124
126
|
"data-test": "stash-input-options|select",
|
|
125
127
|
"no-truncate": e.noTruncate,
|
|
126
128
|
options: e.options,
|
|
127
|
-
"model-value":
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
"model-value": o.value,
|
|
130
|
+
disabled: t.disabled,
|
|
131
|
+
"onUpdate:modelValue": x
|
|
132
|
+
}), null, 16, ["class", "no-truncate", "options", "model-value", "disabled"])
|
|
130
133
|
], 2)
|
|
131
134
|
]),
|
|
132
135
|
_: 2
|
|
133
136
|
}, [
|
|
134
|
-
|
|
137
|
+
i(g).hint ? {
|
|
135
138
|
name: "hint",
|
|
136
139
|
fn: f(() => [
|
|
137
140
|
F(e.$slots, "hint")
|
|
@@ -146,8 +149,8 @@ const q = /* @__PURE__ */ S({
|
|
|
146
149
|
"has-error": "_has-error_gn7he_16"
|
|
147
150
|
}, J = {
|
|
148
151
|
$style: H
|
|
149
|
-
},
|
|
152
|
+
}, Ce = /* @__PURE__ */ j(q, [["__cssModules", J]]);
|
|
150
153
|
export {
|
|
151
|
-
|
|
154
|
+
Ce as default
|
|
152
155
|
};
|
|
153
156
|
//# sourceMappingURL=InputOptions.js.map
|