@leaflink/stash 44.0.0-beta.7 → 44.0.0-beta.9
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/README.md +107 -39
- package/dist/ActionsDropdown.js +2 -2
- package/dist/ActionsDropdown.js.map +1 -1
- package/dist/AddressSelect.js +2 -2
- package/dist/AppNavigationItem.js +1 -1
- package/dist/AppSidebar.js +13 -13
- package/dist/AppSidebar.js.map +1 -1
- package/dist/Badge.vue.d.ts +1 -1
- package/dist/Button.js +1 -1
- package/dist/Button.js.map +1 -1
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js +17 -0
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js.map +1 -0
- package/dist/ButtonGroup.js +19 -19
- package/dist/ButtonGroup.js.map +1 -1
- package/dist/Checkbox.js +57 -46
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.vue.d.ts +2 -0
- package/dist/Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js +9 -0
- package/dist/Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js.map +1 -0
- package/dist/ChevronToggle.js +1 -1
- package/dist/Copy.js +1 -1
- package/dist/CurrencyInput.js +2 -2
- package/dist/DataView.js +1 -1
- package/dist/DataViewFilters.js +4 -4
- package/dist/DataViewSortButton.js +47 -38
- package/dist/DataViewSortButton.js.map +1 -1
- package/dist/DataViewToolbar.js +2 -2
- package/dist/DatePicker.js +8 -8
- package/dist/DatePicker.js.map +1 -1
- package/dist/DescriptionListTerm.js +1 -1
- package/dist/DescriptionListTerm.js.map +1 -1
- package/dist/Dialog.js +33 -33
- package/dist/Dialog.js.map +1 -1
- package/dist/Divider.js +4 -4
- package/dist/Divider.js.map +1 -1
- package/dist/Expand.js +1 -1
- package/dist/{Expand.vue_vue_type_script_setup_true_lang-b6a57ae9.js → Expand.vue_vue_type_script_setup_true_lang-1751f4a6.js} +12 -13
- package/dist/Expand.vue_vue_type_script_setup_true_lang-1751f4a6.js.map +1 -0
- package/dist/Field.js +2 -2
- package/dist/Field.vue.d.ts +1 -1
- package/dist/{Field.vue_vue_type_script_setup_true_lang-4483019d.js → Field.vue_vue_type_script_setup_true_lang-42ba3c5a.js} +2 -2
- package/dist/Field.vue_vue_type_script_setup_true_lang-42ba3c5a.js.map +1 -0
- package/dist/FileUpload.js +7 -7
- package/dist/FileUpload.js.map +1 -1
- package/dist/FilterChip.js +30 -30
- package/dist/FilterChip.js.map +1 -1
- package/dist/FilterDropdown.js +2 -2
- package/dist/FilterSelect.js +2 -2
- package/dist/Filters.js +39 -39
- package/dist/Filters.js.map +1 -1
- package/dist/HttpError.js +6 -6
- package/dist/IconLabel.js +6 -6
- package/dist/IconLabel.js.map +1 -1
- package/dist/IconLabel.vue.d.ts +1 -1
- package/dist/Illustration.js +10 -60
- package/dist/Illustration.js.map +1 -1
- package/dist/Illustration.vue_vue_type_script_setup_true_lang-d6a94e17.js +56 -0
- package/dist/Illustration.vue_vue_type_script_setup_true_lang-d6a94e17.js.map +1 -0
- package/dist/Image.js +67 -72
- package/dist/Image.js.map +1 -1
- package/dist/InlineEdit.js +2 -2
- package/dist/Input.js +53 -53
- package/dist/Input.js.map +1 -1
- package/dist/InputOptions.js +2 -2
- package/dist/Label.js +1 -1
- package/dist/Label.vue.d.ts +13 -2
- package/dist/{Label.vue_vue_type_script_setup_true_lang-2de35913.js → Label.vue_vue_type_script_setup_true_lang-4b02087f.js} +12 -11
- package/dist/Label.vue_vue_type_script_setup_true_lang-4b02087f.js.map +1 -0
- package/dist/ListItem.js +11 -11
- package/dist/ListItem.js.map +1 -1
- package/dist/ListItemCell.js +9 -9
- package/dist/ListItemCell.js.map +1 -1
- package/dist/ListView.js +83 -80
- package/dist/ListView.js.map +1 -1
- package/dist/Loading.js +17 -10
- package/dist/Loading.js.map +1 -1
- package/dist/Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js +8 -0
- package/dist/Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js.map +1 -0
- package/dist/MenuItem.js +20 -14
- package/dist/MenuItem.js.map +1 -1
- package/dist/Modal.js +2 -2
- package/dist/Modal.js.map +1 -1
- package/dist/ObfuscateText.js +30 -32
- package/dist/ObfuscateText.js.map +1 -1
- package/dist/ObfuscateText.vue.d.ts +1 -1
- package/dist/PageContent.js +9 -9
- package/dist/PageContent.js.map +1 -1
- package/dist/PageHeader.js +22 -22
- package/dist/PageHeader.js.map +1 -1
- package/dist/Paginate.js +1 -1
- package/dist/Paginate.js.map +1 -1
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js +11 -0
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js.map +1 -0
- package/dist/Radio.js +24 -19
- package/dist/Radio.js.map +1 -1
- package/dist/RadioGroup.js +43 -43
- package/dist/RadioGroup.js.map +1 -1
- package/dist/SearchBar.js +32 -32
- package/dist/SearchBar.js.map +1 -1
- package/dist/Select.js +5 -5
- package/dist/Select.js.map +1 -1
- package/dist/SelectStatus.js +2 -2
- package/dist/Switch.js +41 -34
- package/dist/Switch.js.map +1 -1
- package/dist/Table.js +6 -6
- package/dist/Table.keys-cf93df19.js +27 -0
- package/dist/{Table.keys-75e99266.js.map → Table.keys-cf93df19.js.map} +1 -1
- package/dist/TableCell.js +5 -5
- package/dist/TableCell.js.map +1 -1
- package/dist/TableHeaderCell.js +32 -32
- package/dist/TableHeaderCell.js.map +1 -1
- package/dist/TableHeaderRow.js +10 -10
- package/dist/TableHeaderRow.js.map +1 -1
- package/dist/TableRow.js +6 -6
- package/dist/TableRow.js.map +1 -1
- package/dist/Textarea.js +49 -41
- package/dist/Textarea.js.map +1 -1
- package/dist/Toast.js +23 -23
- package/dist/Toast.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/constants.d.ts +26 -19
- package/dist/constants.js +41 -26
- package/dist/constants.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/tailwind-base.d.ts +16 -16
- package/dist/tailwind-base.js +7 -4
- package/dist/tailwind-base.js.map +1 -1
- package/package.json +1 -1
- package/styles/backwards-compat.css +41 -104
- package/styles/base.css +258 -112
- package/tailwind-base.ts +3 -0
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-b2ee90e6.js +0 -17
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-b2ee90e6.js.map +0 -1
- package/dist/Checkbox.vue_vue_type_style_index_0_scoped_dbd26d7f_lang-4ed993c7.js +0 -2
- package/dist/Checkbox.vue_vue_type_style_index_0_scoped_dbd26d7f_lang-4ed993c7.js.map +0 -1
- package/dist/Expand.vue_vue_type_script_setup_true_lang-b6a57ae9.js.map +0 -1
- package/dist/Field.vue_vue_type_script_setup_true_lang-4483019d.js.map +0 -1
- package/dist/Label.vue_vue_type_script_setup_true_lang-2de35913.js.map +0 -1
- package/dist/Loading.vue_vue_type_style_index_0_scoped_bb8d5f15_lang-4ed993c7.js +0 -2
- package/dist/Loading.vue_vue_type_style_index_0_scoped_bb8d5f15_lang-4ed993c7.js.map +0 -1
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-1a2084f9.js +0 -11
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-1a2084f9.js.map +0 -1
- package/dist/Table.keys-75e99266.js +0 -27
- package/styles/_base.scss +0 -493
- package/styles/elements/_links.scss +0 -32
- package/styles/elements/_lists.scss +0 -31
- package/styles/elements/_misc.scss +0 -16
- package/styles/main.scss +0 -38
package/dist/Input.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as P, useSlots as U, useCssModule as G, useAttrs as L, ref as f, computed as v, watchEffect as O, onMounted as W, openBlock as m, createBlock as g, mergeProps as V, unref as o, createSlots as j, withCtx as k, createElementVNode as N, withDirectives as q, vModelDynamic as H, createElementBlock as x, normalizeClass as C, renderSlot as y, createCommentVNode as I } from "vue";
|
|
2
2
|
import $ from "lodash-es/isNil";
|
|
3
|
-
import { convertDecimal as
|
|
4
|
-
import { _ as K } from "./Field.vue_vue_type_script_setup_true_lang-
|
|
3
|
+
import { convertDecimal as B, sanitizeDecimal as J, decimalSeparator as _ } from "./utils/i18n.js";
|
|
4
|
+
import { _ as K } from "./Field.vue_vue_type_script_setup_true_lang-42ba3c5a.js";
|
|
5
5
|
import Q from "./Icon.js";
|
|
6
6
|
import { _ as R } 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-4b02087f.js";
|
|
12
12
|
import "./index-79ce320f.js";
|
|
13
13
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
14
|
-
const X = { class: "tw-relative" }, Y = ["id", "aria-errormessage", "aria-invalid", "autocomplete", "type"], Z = /* @__PURE__ */
|
|
14
|
+
const X = { class: "tw-relative" }, Y = ["id", "aria-errormessage", "aria-invalid", "autocomplete", "type"], Z = /* @__PURE__ */ P({
|
|
15
15
|
name: "ll-input",
|
|
16
16
|
inheritAttrs: !1,
|
|
17
17
|
__name: "Input",
|
|
@@ -28,25 +28,25 @@ const X = { class: "tw-relative" }, Y = ["id", "aria-errormessage", "aria-invali
|
|
|
28
28
|
type: { default: "text" }
|
|
29
29
|
},
|
|
30
30
|
emits: ["update:model-value", "change", "focus", "blur"],
|
|
31
|
-
setup(
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const p = f(!1), i = v(() =>
|
|
31
|
+
setup(E, { expose: S, emit: d }) {
|
|
32
|
+
const s = E, r = U(), n = G(), c = L(), h = f();
|
|
33
|
+
S({ inputEl: h });
|
|
34
|
+
const a = f(s.modelValue);
|
|
35
|
+
s.type === "number" && (s.modelValue || s.modelValue === 0) && (a.value = B(s.modelValue, _));
|
|
36
|
+
const p = f(!1), i = v(() => s.type === "number"), D = v(() => {
|
|
37
37
|
const t = { ...c };
|
|
38
38
|
return delete t.class, t;
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
}), M = v(() => i.value || s.type === "password" && p.value ? "text" : s.type);
|
|
40
|
+
O(() => {
|
|
41
|
+
a.value = w(s.modelValue);
|
|
42
42
|
});
|
|
43
|
-
function b(t = "",
|
|
43
|
+
function b(t = "", l = !1) {
|
|
44
44
|
if (!i.value)
|
|
45
45
|
return t;
|
|
46
46
|
let e = t;
|
|
47
47
|
if ($(e) || `${e}`.length === 0)
|
|
48
48
|
return "";
|
|
49
|
-
if (_ !== "." && (e =
|
|
49
|
+
if (_ !== "." && (e = B(e, ".")), l && (e === "." && (e = "0."), e.toString().startsWith("0.")))
|
|
50
50
|
return e;
|
|
51
51
|
if (!$(e) && `${e}`.length)
|
|
52
52
|
e = Intl.NumberFormat("en-US", {
|
|
@@ -61,64 +61,64 @@ const X = { class: "tw-relative" }, Y = ["id", "aria-errormessage", "aria-invali
|
|
|
61
61
|
function w(t) {
|
|
62
62
|
return i.value ? J(t, _) : t;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const t = i.value ? b(
|
|
64
|
+
function A() {
|
|
65
|
+
const t = i.value ? b(a.value) : a.value;
|
|
66
66
|
d("change", t);
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const e = i.value ? b(
|
|
68
|
+
function F(t) {
|
|
69
|
+
const l = t.target.value;
|
|
70
|
+
a.value = w(l);
|
|
71
|
+
const e = i.value ? b(a.value, !0) : l;
|
|
72
72
|
d("update:model-value", e);
|
|
73
73
|
}
|
|
74
|
-
return
|
|
75
|
-
if (
|
|
74
|
+
return W(() => {
|
|
75
|
+
if (s.value !== null)
|
|
76
76
|
throw new Error("ll-input: use :model-value or v-model instead of :value.");
|
|
77
77
|
if (c.onInput)
|
|
78
78
|
throw new Error("ll-input: use the @update:model-value event instead of @input");
|
|
79
|
-
}), (t,
|
|
80
|
-
class: ["stash-input", [o(
|
|
79
|
+
}), (t, l) => (m(), g(K, V(s, {
|
|
80
|
+
class: ["stash-input", [o(n).root, o(c).class]],
|
|
81
81
|
"data-test": "ll-input"
|
|
82
|
-
}),
|
|
83
|
-
default: k(({ fieldId: e, fieldErrorId:
|
|
82
|
+
}), j({
|
|
83
|
+
default: k(({ fieldId: e, fieldErrorId: T, hasError: z }) => [
|
|
84
84
|
N("div", X, [
|
|
85
|
-
q(N("input", V(
|
|
85
|
+
q(N("input", V(D.value, {
|
|
86
86
|
id: e,
|
|
87
87
|
ref_key: "inputEl",
|
|
88
88
|
ref: h,
|
|
89
|
-
"onUpdate:modelValue":
|
|
90
|
-
"aria-errormessage":
|
|
91
|
-
"aria-invalid":
|
|
89
|
+
"onUpdate:modelValue": l[0] || (l[0] = (u) => a.value = u),
|
|
90
|
+
"aria-errormessage": T,
|
|
91
|
+
"aria-invalid": z,
|
|
92
92
|
autocomplete: t.autocomplete,
|
|
93
93
|
class: [
|
|
94
|
-
{ [o(
|
|
95
|
-
{ [o(
|
|
96
|
-
{ [o(
|
|
94
|
+
{ [o(n)["input-prepended"]]: !!o(r).prepend },
|
|
95
|
+
{ [o(n)["input-appended"]]: !!o(r).append || s.type === "password" },
|
|
96
|
+
{ [o(n)["has-error"]]: !!s.errorText }
|
|
97
97
|
],
|
|
98
|
-
type:
|
|
99
|
-
onChange:
|
|
100
|
-
onInput:
|
|
101
|
-
onBlur:
|
|
102
|
-
onFocus:
|
|
98
|
+
type: M.value,
|
|
99
|
+
onChange: A,
|
|
100
|
+
onInput: F,
|
|
101
|
+
onBlur: l[1] || (l[1] = (u) => d("blur", u)),
|
|
102
|
+
onFocus: l[2] || (l[2] = (u) => d("focus", u))
|
|
103
103
|
}), null, 16, Y), [
|
|
104
|
-
[H,
|
|
104
|
+
[H, a.value]
|
|
105
105
|
]),
|
|
106
106
|
o(r).prepend ? (m(), x("div", {
|
|
107
107
|
key: 0,
|
|
108
|
-
class: C(["stash-input-prepend font-semibold", [o(
|
|
108
|
+
class: C(["stash-input-prepend font-semibold", [o(n).symbol, o(n)["symbol--prepend"]]])
|
|
109
109
|
}, [
|
|
110
110
|
y(t.$slots, "prepend")
|
|
111
111
|
], 2)) : I("", !0),
|
|
112
|
-
o(r).append ||
|
|
112
|
+
o(r).append || s.type === "password" ? (m(), x("div", {
|
|
113
113
|
key: 1,
|
|
114
|
-
class: C(["stash-input-append font-semibold", [o(
|
|
114
|
+
class: C(["stash-input-append font-semibold", [o(n).symbol, o(n)["symbol--append"]]])
|
|
115
115
|
}, [
|
|
116
116
|
o(r).append ? y(t.$slots, "append", { key: 0 }) : (m(), g(Q, {
|
|
117
117
|
key: 1,
|
|
118
118
|
name: p.value ? "hide" : "show",
|
|
119
119
|
class: "tw-cursor-pointer",
|
|
120
120
|
"data-test": p.value ? "hide-password-icon" : "show-password-icon",
|
|
121
|
-
onClick:
|
|
121
|
+
onClick: l[3] || (l[3] = (u) => p.value = !p.value)
|
|
122
122
|
}, null, 8, ["name", "data-test"]))
|
|
123
123
|
], 2)) : I("", !0)
|
|
124
124
|
])
|
|
@@ -134,17 +134,17 @@ const X = { class: "tw-relative" }, Y = ["id", "aria-errormessage", "aria-invali
|
|
|
134
134
|
} : void 0
|
|
135
135
|
]), 1040, ["class"]));
|
|
136
136
|
}
|
|
137
|
-
}), ee = "
|
|
137
|
+
}), ee = "_root_1slou_2", te = "_symbol_1slou_66", oe = {
|
|
138
138
|
root: ee,
|
|
139
|
-
"has-error": "_has-
|
|
140
|
-
"input-prepended": "_input-
|
|
141
|
-
"input-appended": "_input-
|
|
139
|
+
"has-error": "_has-error_1slou_34",
|
|
140
|
+
"input-prepended": "_input-prepended_1slou_38",
|
|
141
|
+
"input-appended": "_input-appended_1slou_42",
|
|
142
142
|
symbol: te,
|
|
143
|
-
"symbol--prepend": "_symbol--
|
|
144
|
-
"symbol--append": "_symbol--
|
|
145
|
-
},
|
|
143
|
+
"symbol--prepend": "_symbol--prepend_1slou_77",
|
|
144
|
+
"symbol--append": "_symbol--append_1slou_83"
|
|
145
|
+
}, se = {
|
|
146
146
|
$style: oe
|
|
147
|
-
}, _e = /* @__PURE__ */ R(Z, [["__cssModules",
|
|
147
|
+
}, _e = /* @__PURE__ */ R(Z, [["__cssModules", se]]);
|
|
148
148
|
export {
|
|
149
149
|
_e as default
|
|
150
150
|
};
|
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 =\n 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: var(--border-radius);\n color: var(--color-ice-700);\n display: block;\n height: var(--input-height);\n font-size: var(--input-font-size);\n font-weight: var(--font-weight-normal);\n outline: none;\n padding: 0 var(--ll-space-2);\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: var(--input-height);\n justify-content: center;\n overflow: hidden;\n position: absolute;\n top: 0;\n width: var(--input-height);\n }\n\n .symbol--prepend {\n border-bottom-left-radius: var(--border-radius);\n border-top-left-radius: var(--border-radius);\n left: 0;\n }\n\n .symbol--append {\n border-bottom-right-radius: var(--border-radius);\n border-top-right-radius: var(--border-radius);\n right: 0;\n }\n</style>\n"],"names":["slots","useSlots","classes","useCssModule","attrs","useAttrs","inputEl","ref","__expose","internalValue","props","convertDecimal","decimalSeparator","showPassword","isNumber","computed","inputAttrs","tempAttrs","inputType","watchEffect","format","parseNumber","value","isUserTyping","tempValue","isNil","sanitizeDecimal","handleChange","parsedValue","emit","handleInput","e","onMounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqGQA,IAAQC,KACRC,IAAUC,KACVC,IAAQC,KAIRC,IAAUC;AAIH,IAAAC,EAAA,EAAE,SAAAF,GAAS;AAElB,UAAAG,IAAgBF,EAAqBG,EAAM,UAAU;AAE3D,IAAIA,EAAM,SAAS,aAAaA,EAAM,cAAcA,EAAM,eAAe,OACvED,EAAc,QAAQE,EAAeD,EAAM,YAAYE,CAAgB;AAGnE,UAAAC,IAAeN,EAAI,EAAK,GAExBO,IAAWC,EAAS,MAAML,EAAM,SAAS,QAAQ,GAEjDM,IAAaD,EAAS,MAAM;AAC1B,YAAAE,IAAY,EAAE,GAAGb;AAEvB,oBAAOa,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAYH,EAAS,MAGrBD,EAAS,SAITJ,EAAM,SAAS,cAAcG,EAAa,QACrC,SAGFH,EAAM,IACd;AAED,IAAAS,EAAY,MAAM;AACF,MAAAV,EAAA,QAAQW,EAAOV,EAAM,UAAU;AAAA,IAAA,CAC9C;AAQD,aAASW,EAAYC,IAAyB,IAAIC,IAAe,IAAwB;AAEnF,UAAA,CAACT,EAAS;AACL,eAAAQ;AAGT,UAAIE,IAAYF;AAGhB,UAAIG,EAAMD,CAAS,KAAK,GAAGA,CAAS,GAAG,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,CAAS,GAAG;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,EAAYZ,EAAc,KAAK,IAAIA,EAAc;AACtF,MAAAoB,EAAK,UAAUD,CAAW;AAAA,IAC5B;AAKA,aAASE,EAAYC,GAAU;AACvB,YAAAT,IAASS,EAAE,OAA4B;AAG/B,MAAAtB,EAAA,QAAQW,EAAOE,CAAK;AAElC,YAAMM,IAAcd,EAAS,QAAQO,EAAYZ,EAAc,OAAO,EAAI,IAAIa;AAE9E,MAAAO,EAAK,sBAAsBD,CAAW;AAAA,IACxC;AAEA,WAAAI,EAAU,MAAM;AACV,UAAAtB,EAAM,UAAU;AACZ,cAAA,IAAI,MAAM,0DAA0D;AAG5E,UAAIN,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 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 =\n 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":["slots","useSlots","classes","useCssModule","attrs","useAttrs","inputEl","ref","__expose","internalValue","props","convertDecimal","decimalSeparator","showPassword","isNumber","computed","inputAttrs","tempAttrs","inputType","watchEffect","format","parseNumber","value","isUserTyping","tempValue","isNil","sanitizeDecimal","handleChange","parsedValue","emit","handleInput","e","onMounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqGQA,IAAQC,KACRC,IAAUC,KACVC,IAAQC,KAIRC,IAAUC;AAIH,IAAAC,EAAA,EAAE,SAAAF,GAAS;AAElB,UAAAG,IAAgBF,EAAqBG,EAAM,UAAU;AAE3D,IAAIA,EAAM,SAAS,aAAaA,EAAM,cAAcA,EAAM,eAAe,OACvED,EAAc,QAAQE,EAAeD,EAAM,YAAYE,CAAgB;AAGnE,UAAAC,IAAeN,EAAI,EAAK,GAExBO,IAAWC,EAAS,MAAML,EAAM,SAAS,QAAQ,GAEjDM,IAAaD,EAAS,MAAM;AAC1B,YAAAE,IAAY,EAAE,GAAGb;AAEvB,oBAAOa,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAYH,EAAS,MAGrBD,EAAS,SAITJ,EAAM,SAAS,cAAcG,EAAa,QACrC,SAGFH,EAAM,IACd;AAED,IAAAS,EAAY,MAAM;AACF,MAAAV,EAAA,QAAQW,EAAOV,EAAM,UAAU;AAAA,IAAA,CAC9C;AAQD,aAASW,EAAYC,IAAyB,IAAIC,IAAe,IAAwB;AAEnF,UAAA,CAACT,EAAS;AACL,eAAAQ;AAGT,UAAIE,IAAYF;AAGhB,UAAIG,EAAMD,CAAS,KAAK,GAAGA,CAAS,GAAG,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,CAAS,GAAG;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,EAAYZ,EAAc,KAAK,IAAIA,EAAc;AACtF,MAAAoB,EAAK,UAAUD,CAAW;AAAA,IAC5B;AAKA,aAASE,EAAYC,GAAU;AACvB,YAAAT,IAASS,EAAE,OAA4B;AAG/B,MAAAtB,EAAA,QAAQW,EAAOE,CAAK;AAElC,YAAMM,IAAcd,EAAS,QAAQO,EAAYZ,EAAc,OAAO,EAAI,IAAIa;AAE9E,MAAAO,EAAK,sBAAsBD,CAAW;AAAA,IACxC;AAEA,WAAAI,EAAU,MAAM;AACV,UAAAtB,EAAM,UAAU;AACZ,cAAA,IAAI,MAAM,0DAA0D;AAG5E,UAAIN,EAAM;AACF,cAAA,IAAI,MAAM,+DAA+D;AAAA,IACjF,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/InputOptions.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent as B, useAttrs as S, useSlots as T, useCssModule as $, ref as d, computed as c, watchEffect as k, watch as v, openBlock as E, createBlock as b, mergeProps as m, createSlots as A, withCtx as f, createElementVNode as M, normalizeClass as z, unref as s, createVNode as h, renderSlot as F } from "vue";
|
|
2
|
-
import { _ as N } from "./Field.vue_vue_type_script_setup_true_lang-
|
|
2
|
+
import { _ as N } from "./Field.vue_vue_type_script_setup_true_lang-42ba3c5a.js";
|
|
3
3
|
import O from "./Input.js";
|
|
4
4
|
import U from "./Select.js";
|
|
5
5
|
import { _ as P } 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-4b02087f.js";
|
|
8
8
|
import "./locale.js";
|
|
9
9
|
import "lodash-es/get";
|
|
10
10
|
import "lodash-es/isNil";
|
package/dist/Label.js
CHANGED
package/dist/Label.vue.d.ts
CHANGED
|
@@ -57,13 +57,24 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaul
|
|
|
57
57
|
export default _default;
|
|
58
58
|
|
|
59
59
|
export declare interface LabelProps {
|
|
60
|
+
/**
|
|
61
|
+
* The `id` of the input element that this label is associated with.
|
|
62
|
+
*/
|
|
60
63
|
for?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Indicates whether the label should be styled as an error.
|
|
66
|
+
*/
|
|
61
67
|
hasError?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Indicates whether the input element that this label is associated with is required.
|
|
70
|
+
*/
|
|
62
71
|
isRequired?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Indicates whether the label should show that the input is optional.
|
|
74
|
+
*/
|
|
63
75
|
showOptional?: boolean;
|
|
64
76
|
/**
|
|
65
|
-
* Indicates whether the wrapper element to be rendered
|
|
66
|
-
* should be a label or a legend.
|
|
77
|
+
* Indicates whether the wrapper element to be rendered should be a label or a legend.
|
|
67
78
|
*/
|
|
68
79
|
legend?: boolean;
|
|
69
80
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as r, computed as n, openBlock as t, createBlock as i, resolveDynamicComponent as d, normalizeClass as c, withCtx as f, renderSlot as p, createElementBlock as o, toDisplayString as u, unref as m, createCommentVNode as w } from "vue";
|
|
2
2
|
import { t as h } from "./locale.js";
|
|
3
3
|
const _ = {
|
|
4
4
|
key: 0,
|
|
5
|
-
class: "font-
|
|
5
|
+
class: "tw-font-semibold tw-text-red-500",
|
|
6
6
|
title: "Required",
|
|
7
7
|
"aria-label": "required"
|
|
8
8
|
}, y = {
|
|
9
9
|
key: 1,
|
|
10
10
|
class: "tw-text-ice-700"
|
|
11
|
-
},
|
|
11
|
+
}, x = /* @__PURE__ */ r({
|
|
12
12
|
__name: "Label",
|
|
13
13
|
props: {
|
|
14
14
|
for: { default: void 0 },
|
|
@@ -19,19 +19,20 @@ const _ = {
|
|
|
19
19
|
},
|
|
20
20
|
setup(a) {
|
|
21
21
|
const e = a, l = n(() => e.legend ? "legend" : "label");
|
|
22
|
-
return (
|
|
23
|
-
class: c(["stash-label tw-block tw-truncate tw-text-sm tw-font-medium tw-leading-6 tw-text-ice-900", { "animate-shake": e.hasError }]),
|
|
24
|
-
for: e.for
|
|
22
|
+
return (s, b) => (t(), i(d(l.value), {
|
|
23
|
+
class: c(["stash-label tw-block tw-truncate tw-text-sm tw-font-medium tw-leading-6 tw-text-ice-900", { "tw-animate-shake": e.hasError }]),
|
|
24
|
+
for: e.for,
|
|
25
|
+
"data-test": "stash-label"
|
|
25
26
|
}, {
|
|
26
|
-
default:
|
|
27
|
-
|
|
28
|
-
e.isRequired ? (t(), o("span", _, " * ")) : e.showOptional ? (t(), o("span", y, " (" + u(m(h)("ll.optional")) + ")
|
|
27
|
+
default: f(() => [
|
|
28
|
+
p(s.$slots, "default"),
|
|
29
|
+
e.isRequired ? (t(), o("span", _, " * ")) : e.showOptional ? (t(), o("span", y, " (" + u(m(h)("ll.optional")) + ")", 1)) : w("", !0)
|
|
29
30
|
]),
|
|
30
31
|
_: 3
|
|
31
32
|
}, 8, ["class", "for"]));
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
x as _
|
|
36
37
|
};
|
|
37
|
-
//# sourceMappingURL=Label.vue_vue_type_script_setup_true_lang-
|
|
38
|
+
//# sourceMappingURL=Label.vue_vue_type_script_setup_true_lang-4b02087f.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.vue_vue_type_script_setup_true_lang-4b02087f.js","sources":["../src/components/Label/Label.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue';\n\n import { t } from '../../locale';\n\n export interface LabelProps {\n /**\n * The `id` of the input element that this label is associated with.\n */\n for?: string;\n\n /**\n * Indicates whether the label should be styled as an error.\n */\n hasError?: boolean;\n\n /**\n * Indicates whether the input element that this label is associated with is required.\n */\n isRequired?: boolean;\n\n /**\n * Indicates whether the label should show that the input is optional.\n */\n showOptional?: boolean;\n\n /**\n * Indicates whether the wrapper element to be rendered should be a label or a legend.\n */\n legend?: boolean;\n }\n\n const props = withDefaults(defineProps<LabelProps>(), {\n for: undefined,\n hasError: false,\n isRequired: false,\n showOptional: false,\n legend: false,\n });\n\n const is = computed(() => {\n return props.legend ? 'legend' : 'label';\n });\n</script>\n\n<template>\n <component\n :is=\"is\"\n class=\"stash-label tw-block tw-truncate tw-text-sm tw-font-medium tw-leading-6 tw-text-ice-900\"\n :class=\"{ 'tw-animate-shake': props.hasError }\"\n :for=\"props.for\"\n data-test=\"stash-label\"\n >\n <!-- @slot The label text -->\n <slot></slot>\n <span v-if=\"props.isRequired\" class=\"tw-font-semibold tw-text-red-500\" title=\"Required\" aria-label=\"required\">\n *\n </span>\n <span v-else-if=\"props.showOptional\" class=\"tw-text-ice-700\"> ({{ t('ll.optional') }})</span>\n </component>\n</template>\n"],"names":["is","computed","props"],"mappings":";;;;;;;;;;;;;;;;;;;;iBAwCQA,IAAKC,EAAS,MACXC,EAAM,SAAS,WAAW,OAClC;;;;;;;;;;;;;;"}
|
package/dist/ListItem.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import a from "./Checkbox.js";
|
|
2
|
-
import { resolveComponent as n, openBlock as l, createElementBlock as i, normalizeClass as
|
|
2
|
+
import { resolveComponent as n, openBlock as l, createElementBlock as i, normalizeClass as c, createBlock as d, createCommentVNode as m, renderSlot as b } from "vue";
|
|
3
3
|
import { _ as r } from "./_plugin-vue_export-helper-dad06003.js";
|
|
4
4
|
import "@leaflink/snitch";
|
|
5
5
|
import "lodash-es/uniqueId";
|
|
6
|
-
import "./Checkbox.
|
|
7
|
-
const
|
|
8
|
-
item:
|
|
9
|
-
"is-selectable": "_is-
|
|
10
|
-
"not-actionable": "_not-
|
|
11
|
-
checkbox:
|
|
6
|
+
import "./Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js";
|
|
7
|
+
const f = "_item_1v8cf_2", _ = "_checkbox_1v8cf_56", h = {
|
|
8
|
+
item: f,
|
|
9
|
+
"is-selectable": "_is-selectable_1v8cf_41",
|
|
10
|
+
"not-actionable": "_not-actionable_1v8cf_46",
|
|
11
|
+
checkbox: _
|
|
12
12
|
}, k = {
|
|
13
13
|
name: "ll-list-item",
|
|
14
14
|
components: {
|
|
@@ -71,15 +71,15 @@ const _ = "_item_1ivse_2", f = "_checkbox_1ivse_56", h = {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
function u(e, y, t, B, x, o) {
|
|
74
|
-
const
|
|
74
|
+
const s = n("ll-checkbox");
|
|
75
75
|
return l(), i("li", {
|
|
76
|
-
class:
|
|
76
|
+
class: c(["shadow-low", [e.$style.item, { [e.$style["is-selectable"]]: t.isSelectable, [e.$style["not-actionable"]]: t.notActionable }]])
|
|
77
77
|
}, [
|
|
78
|
-
t.isSelectable ? (l(), d(
|
|
78
|
+
t.isSelectable ? (l(), d(s, {
|
|
79
79
|
key: 0,
|
|
80
80
|
"data-test": "checkbox|select-item",
|
|
81
81
|
checked: t.selected,
|
|
82
|
-
class:
|
|
82
|
+
class: c(e.$style.checkbox),
|
|
83
83
|
disabled: t.disabled || null,
|
|
84
84
|
indeterminate: t.isIndeterminate,
|
|
85
85
|
"onUpdate:checked": o.onSelect
|
package/dist/ListItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","sources":["../src/components/ListItem/ListItem.vue"],"sourcesContent":["<script>\n import Checkbox from '../Checkbox/Checkbox.vue';\n\n export default {\n name: 'll-list-item',\n\n components: {\n 'll-checkbox': Checkbox,\n },\n\n props: {\n /**\n * The item to be selected\n */\n item: {\n type: Object,\n default: () => ({}),\n },\n\n /**\n * Whether this row can be selected.\n */\n isSelectable: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether this row's checkbox should be indeterminite\n */\n isIndeterminate: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether this row has an actions column or not. By default list items will\n * be styled to include actions. Use `not-actionable` to restyle a row that\n * has no actions.\n */\n notActionable: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether this row is selected.\n */\n selected: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Disables the checkbox\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: ['select'],\n\n methods: {\n /**\n * @param {boolean} value emit change event when item is selected\n */\n onSelect(value) {\n this.$emit('select', { item: this.item, value });\n },\n },\n };\n</script>\n\n<template>\n <li\n class=\"shadow-low\"\n :class=\"[$style.item, { [$style['is-selectable']]: isSelectable, [$style['not-actionable']]: notActionable }]\"\n >\n <ll-checkbox\n v-if=\"isSelectable\"\n data-test=\"checkbox|select-item\"\n :checked=\"selected\"\n :class=\"$style.checkbox\"\n :disabled=\"disabled || null\"\n :indeterminate=\"isIndeterminate\"\n @update:checked=\"onSelect\"\n />\n <slot></slot>\n </li>\n</template>\n\n<style module>\n .item {\n background: var(--color-white);\n border-radius:
|
|
1
|
+
{"version":3,"file":"ListItem.js","sources":["../src/components/ListItem/ListItem.vue"],"sourcesContent":["<script>\n import Checkbox from '../Checkbox/Checkbox.vue';\n\n export default {\n name: 'll-list-item',\n\n components: {\n 'll-checkbox': Checkbox,\n },\n\n props: {\n /**\n * The item to be selected\n */\n item: {\n type: Object,\n default: () => ({}),\n },\n\n /**\n * Whether this row can be selected.\n */\n isSelectable: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether this row's checkbox should be indeterminite\n */\n isIndeterminate: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether this row has an actions column or not. By default list items will\n * be styled to include actions. Use `not-actionable` to restyle a row that\n * has no actions.\n */\n notActionable: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Whether this row is selected.\n */\n selected: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Disables the checkbox\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: ['select'],\n\n methods: {\n /**\n * @param {boolean} value emit change event when item is selected\n */\n onSelect(value) {\n this.$emit('select', { item: this.item, value });\n },\n },\n };\n</script>\n\n<template>\n <li\n class=\"shadow-low\"\n :class=\"[$style.item, { [$style['is-selectable']]: isSelectable, [$style['not-actionable']]: notActionable }]\"\n >\n <ll-checkbox\n v-if=\"isSelectable\"\n data-test=\"checkbox|select-item\"\n :checked=\"selected\"\n :class=\"$style.checkbox\"\n :disabled=\"disabled || null\"\n :indeterminate=\"isIndeterminate\"\n @update:checked=\"onSelect\"\n />\n <slot></slot>\n </li>\n</template>\n\n<style module>\n .item {\n background: var(--color-white);\n border-radius: theme('borderRadius.DEFAULT');\n column-gap: var(--grid-gutter);\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n margin-bottom: theme('spacing.6');\n padding: theme('spacing.3');\n padding-top: theme('spacing.12');\n position: relative;\n row-gap: var(--grid-gutter);\n }\n\n @media screen('md') {\n .item {\n grid-template-columns: repeat(8, 1fr);\n }\n }\n\n @media screen('lg') {\n .item {\n align-items: center;\n border-bottom: 1px solid var(--color-ice-200);\n border-radius: 0;\n box-shadow: none;\n grid-template-columns: repeat(12, 1fr);\n margin-bottom: 0;\n padding: theme('spacing.6');\n row-gap: 0;\n }\n\n .item:last-child {\n border: 0;\n border-bottom-left-radius: theme('borderRadius.DEFAULT');\n border-bottom-right-radius: theme('borderRadius.DEFAULT');\n }\n }\n\n @media screen('lg') {\n .is-selectable {\n grid-template-columns: theme('spacing[1.5]') repeat(12, 1fr);\n }\n }\n\n .not-actionable {\n padding-top: theme('spacing.3');\n }\n\n @media screen('lg') {\n .not-actionable {\n padding-top: theme('spacing.6');\n }\n }\n\n .checkbox {\n left: theme('spacing.3');\n position: absolute !important;\n top: 0;\n }\n\n @media screen('lg') {\n .checkbox {\n left: 0;\n position: relative !important;\n }\n\n .checkbox label {\n padding: 10px;\n }\n\n .checkbox label::before,\n .checkbox input:checked + label::after {\n top: 0;\n }\n }\n</style>\n"],"names":["_sfc_main","Checkbox","value","_createElementBlock","_normalizeClass","_ctx","$props","_createBlock","_component_ll_checkbox","$options","_renderSlot"],"mappings":";;;;;;;;;;;GAGOA,IAAU;AAAA,EACb,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,eAAeC;AAAA,EAChB;AAAA,EAED,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS,OAAO,CAAA;AAAA,IACjB;AAAA;AAAA;AAAA;AAAA,IAKD,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA,IAKD,iBAAiB;AAAA,MACf,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOD,eAAe;AAAA,MACb,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA,IAKD,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA,IAKD,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,EACF;AAAA,EAED,OAAO,CAAC,QAAQ;AAAA,EAEhB,SAAS;AAAA;AAAA;AAAA;AAAA,IAIP,SAASC,GAAO;AACd,WAAK,MAAM,UAAU,EAAE,MAAM,KAAK,MAAM,OAAAA,EAAI,CAAG;AAAA,IAChD;AAAA,EACF;;;;cAKHC,EAcK,MAAA;AAAA,IAbH,OAAMC,EAAA,CAAA,cACG,CAAAC,EAAA,OAAO,MAAS,EAAA,CAAAA,EAAA,OAA0B,eAAA,CAAA,GAAAC,EAAA,cAAe,CAAAD,EAAA,2BAA2BC,EAAa,cAAA,CAAA,CAAA,CAAA;AAAA;IAGlGA,EAAY,qBADpBC,EAQEC,GAAA;AAAA;MANA,aAAU;AAAA,MACT,SAASF,EAAQ;AAAA,MACjB,OAAKF,EAAEC,EAAM,OAAC,QAAQ;AAAA,MACtB,UAAUC,EAAQ,YAAA;AAAA,MAClB,eAAeA,EAAe;AAAA,MAC9B,oBAAgBG,EAAQ;AAAA;IAE3BC,EAAaL,EAAA,QAAA,SAAA;AAAA;;;;;"}
|
package/dist/ListItemCell.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { openBlock as
|
|
1
|
+
import { openBlock as s, createElementBlock as t, normalizeClass as l, renderSlot as c } from "vue";
|
|
2
2
|
import { _ as n } from "./_plugin-vue_export-helper-dad06003.js";
|
|
3
|
-
const
|
|
4
|
-
cell:
|
|
5
|
-
action:
|
|
3
|
+
const a = "_cell_3gkxo_2", i = "_action_3gkxo_21", r = {
|
|
4
|
+
cell: a,
|
|
5
|
+
action: i
|
|
6
6
|
}, _ = {
|
|
7
7
|
name: "ll-list-item-cell",
|
|
8
8
|
props: {
|
|
@@ -12,17 +12,17 @@ const i = "_cell_1izqq_176", a = "_action_1izqq_194", r = {
|
|
|
12
12
|
isAction: Boolean
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
function m(e, p,
|
|
16
|
-
return
|
|
17
|
-
class: o
|
|
15
|
+
function m(e, p, o, f, u, $) {
|
|
16
|
+
return s(), t("div", {
|
|
17
|
+
class: l(o.isAction ? e.$style.action : e.$style.cell)
|
|
18
18
|
}, [
|
|
19
19
|
c(e.$slots, "default")
|
|
20
20
|
], 2);
|
|
21
21
|
}
|
|
22
22
|
const d = {
|
|
23
23
|
$style: r
|
|
24
|
-
},
|
|
24
|
+
}, B = /* @__PURE__ */ n(_, [["render", m], ["__cssModules", d]]);
|
|
25
25
|
export {
|
|
26
|
-
|
|
26
|
+
B as default
|
|
27
27
|
};
|
|
28
28
|
//# sourceMappingURL=ListItemCell.js.map
|
package/dist/ListItemCell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemCell.js","sources":["../src/components/ListItemCell/ListItemCell.vue"],"sourcesContent":["<script>\n export default {\n name: 'll-list-item-cell',\n\n props: {\n /**\n * Is this cell for the Action column\n */\n isAction: Boolean,\n },\n };\n</script>\n\n<template>\n <div :class=\"isAction ? $style.action : $style.cell\">\n <slot></slot>\n </div>\n</template>\n\n<style
|
|
1
|
+
{"version":3,"file":"ListItemCell.js","sources":["../src/components/ListItemCell/ListItemCell.vue"],"sourcesContent":["<script>\n export default {\n name: 'll-list-item-cell',\n\n props: {\n /**\n * Is this cell for the Action column\n */\n isAction: Boolean,\n },\n };\n</script>\n\n<template>\n <div :class=\"isAction ? $style.action : $style.cell\">\n <slot></slot>\n </div>\n</template>\n\n<style module>\n .cell {\n background-color: var(--color-ice-100);\n border-radius: theme('borderRadius.DEFAULT');\n padding: theme('spacing[1.5]');\n\n :global(.stash-label) {\n font-size: theme('fontSize.xs');\n }\n\n @media screen('lg') {\n background: none;\n padding: 0;\n\n :global(.stash-label) {\n display: none !important;\n }\n }\n }\n\n .action {\n position: absolute;\n right: 0;\n top: 0;\n\n @media screen('lg') {\n position: initial;\n }\n }\n</style>\n"],"names":["_sfc_main","_createElementBlock","_normalizeClass","$props","_ctx","_renderSlot"],"mappings":";;;;;GACOA,IAAU;AAAA,EACb,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,UAAU;AAAA,EACX;;;cAKHC,EAEM,OAAA;AAAA,IAFA,OAAKC,EAAEC,aAAWC,EAAA,OAAO,SAASA,EAAM,OAAC,IAAI;AAAA;IACjDC,EAAaD,EAAA,QAAA,SAAA;AAAA;;;;;"}
|