@leaflink/stash 50.11.0 → 50.12.1
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/Accordion.js +30 -31
- package/dist/Accordion.js.map +1 -1
- package/dist/Accordion.vue.d.ts +6 -1
- package/dist/ActionsDropdown.js +2 -2
- package/dist/AddressSelect.js +2 -2
- package/dist/Alert.js +6 -6
- package/dist/AppNavigationItem.js +8 -8
- package/dist/AppNavigationItem.vue.d.ts +5 -0
- package/dist/AppSidebar.js +9 -9
- package/dist/AppSidebar.js.map +1 -1
- package/dist/AppTopbar.js +3 -3
- package/dist/Avatar.js +3 -3
- package/dist/Backdrop.js +2 -2
- package/dist/Badge.js +2 -2
- package/dist/Box.js +1 -1
- package/dist/{Box.vue_vue_type_script_setup_true_lang-DgJHq-09.js → Box.vue_vue_type_script_setup_true_lang-rFnvwLVY.js} +3 -3
- package/dist/{Box.vue_vue_type_script_setup_true_lang-DgJHq-09.js.map → Box.vue_vue_type_script_setup_true_lang-rFnvwLVY.js.map} +1 -1
- package/dist/Button.js +3 -3
- package/dist/ButtonGroup.js +4 -4
- package/dist/Card.js +7 -7
- package/dist/CardContent.js +2 -2
- package/dist/CardFooter.js +2 -2
- package/dist/CardHeader.js +4 -4
- package/dist/CardMedia.js +6 -6
- package/dist/Carousel.js +33 -33
- package/dist/Carousel.js.map +1 -1
- package/dist/Checkbox.js +7 -7
- package/dist/ChevronToggle.js +1 -1
- package/dist/{ChevronToggle.vue_vue_type_script_setup_true_lang-DuvluoTi.js → ChevronToggle.vue_vue_type_script_setup_true_lang-Ce_qOXfR.js} +3 -3
- package/dist/{ChevronToggle.vue_vue_type_script_setup_true_lang-DuvluoTi.js.map → ChevronToggle.vue_vue_type_script_setup_true_lang-Ce_qOXfR.js.map} +1 -1
- package/dist/Chip.js +7 -7
- package/dist/ConfirmationCodeInput.js +6 -6
- package/dist/ContextSwitcher.js +1 -1
- package/dist/Copy.js +1 -1
- package/dist/CurrencyInput.js +115 -111
- package/dist/CurrencyInput.js.map +1 -1
- package/dist/DataView.js +102 -98
- package/dist/DataView.js.map +1 -1
- package/dist/{DataView.keys-C7eaZg2G.js → DataView.keys-aSOnA4AD.js} +2 -1
- package/dist/DataView.keys-aSOnA4AD.js.map +1 -0
- package/dist/DataView.vue.d.ts +11 -0
- package/dist/DataViewFilters.js +4 -4
- package/dist/DataViewSortButton.js +11 -11
- package/dist/DataViewToolbar.js +61 -60
- package/dist/DataViewToolbar.js.map +1 -1
- package/dist/DatePicker.js +1080 -1037
- package/dist/DatePicker.js.map +1 -1
- package/dist/DescriptionList.js +2 -2
- package/dist/DescriptionListDetail.js +2 -2
- package/dist/DescriptionListGroup.js +2 -2
- package/dist/DescriptionListTerm.js +3 -3
- package/dist/Dialog.js +1 -1
- package/dist/Divider.js +2 -2
- package/dist/Dropdown.js +19 -19
- package/dist/Dropdown.js.map +1 -1
- package/dist/EmptyState.js +2 -2
- package/dist/Expand.js +1 -1
- package/dist/{Expand.vue_vue_type_script_setup_true_lang-D0fSAtHr.js → Expand.vue_vue_type_script_setup_true_lang-CiONJfAp.js} +5 -5
- package/dist/{Expand.vue_vue_type_script_setup_true_lang-D0fSAtHr.js.map → Expand.vue_vue_type_script_setup_true_lang-CiONJfAp.js.map} +1 -1
- package/dist/Field.js +1 -1
- package/dist/{Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js → Field.vue_vue_type_script_setup_true_lang-DRaKs9Lm.js} +6 -6
- package/dist/Field.vue_vue_type_script_setup_true_lang-DRaKs9Lm.js.map +1 -0
- package/dist/FileUpload.js +7 -7
- package/dist/FilterChip.js +1 -1
- package/dist/FilterDrawerItem.js +9 -9
- package/dist/FilterDropdown.js +2 -2
- package/dist/FilterSelect.js +4 -4
- package/dist/Filters.js +18 -18
- package/dist/Filters.js.map +1 -1
- package/dist/HttpError.js +9 -9
- package/dist/Icon.js +2 -2
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.vue.d.ts +5 -0
- package/dist/IconLabel.js +2 -2
- package/dist/IconLabel.vue.d.ts +5 -0
- package/dist/Illustration.js +2 -2
- package/dist/{Illustration.vue_vue_type_script_setup_true_lang-CYddAFtS.js → Illustration.vue_vue_type_script_setup_true_lang-BBqgoJO8.js} +3 -3
- package/dist/{Illustration.vue_vue_type_script_setup_true_lang-CYddAFtS.js.map → Illustration.vue_vue_type_script_setup_true_lang-BBqgoJO8.js.map} +1 -1
- package/dist/Image.js +2 -2
- package/dist/{Image.vue_vue_type_script_setup_true_lang-YUNunj71.js → Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js} +3 -3
- package/dist/{Image.vue_vue_type_script_setup_true_lang-YUNunj71.js.map → Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js.map} +1 -1
- package/dist/InlineEdit.js +5 -5
- package/dist/InlineEdit.js.map +1 -1
- package/dist/Input.js +2 -2
- package/dist/InputOptions.js +2 -2
- package/dist/InputOptions.js.map +1 -1
- package/dist/IntegrationIcon.js +2 -2
- package/dist/Label.js +1 -1
- package/dist/{Label.vue_vue_type_script_setup_true_lang-C4JKdqvC.js → Label.vue_vue_type_script_setup_true_lang-DPnNUfc6.js} +3 -3
- package/dist/{Label.vue_vue_type_script_setup_true_lang-C4JKdqvC.js.map → Label.vue_vue_type_script_setup_true_lang-DPnNUfc6.js.map} +1 -1
- package/dist/LicenseChip.js +2 -2
- package/dist/ListItem.js +1 -1
- package/dist/ListItemCell.js +2 -2
- package/dist/ListView.js +11 -11
- package/dist/ListView.js.map +1 -1
- package/dist/ListView.vue.d.ts +38 -13
- package/dist/Loading.js +2 -2
- package/dist/Logo.js +1 -1
- package/dist/{Logo.vue_vue_type_script_setup_true_lang-BfUU9J9O.js → Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js} +4 -4
- package/dist/{Logo.vue_vue_type_script_setup_true_lang-BfUU9J9O.js.map → Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js.map} +1 -1
- package/dist/Menu.js +2 -2
- package/dist/MenuItem.js +2 -2
- package/dist/Metric.js +5 -5
- package/dist/Modal.js +20 -20
- package/dist/Modals.js +12 -12
- package/dist/Modals.js.map +1 -1
- package/dist/Module.js +3 -3
- package/dist/ModuleContent.js +3 -3
- package/dist/ModuleFooter.js +2 -2
- package/dist/ModuleHeader.js +2 -2
- package/dist/ModuleHeader.js.map +1 -1
- package/dist/ObfuscateText.js +7 -7
- package/dist/PageContent.js +3 -3
- package/dist/PageHeader.js +6 -6
- package/dist/PageNavigation.js +1 -1
- package/dist/Paginate.js +73 -55
- package/dist/Paginate.js.map +1 -1
- package/dist/Paginate.vue.d.ts +12 -1
- package/dist/PlaidLink.js +2 -2
- package/dist/QuickAction.js +2 -2
- package/dist/QuickAction.vue.d.ts +5 -0
- package/dist/Radio.js +2 -2
- package/dist/RadioGroup.js +2 -2
- package/dist/RadioNew.js +1 -1
- package/dist/RangeInput.js +2 -2
- package/dist/SearchBar.js +4 -4
- package/dist/SearchBar.js.map +1 -1
- package/dist/Select.js +7 -7
- package/dist/Select.js.map +1 -1
- package/dist/SelectStatus.js +19 -19
- package/dist/SelectStatus.js.map +1 -1
- package/dist/SelectStatus.vue.d.ts +5 -0
- package/dist/Skeleton.js +4 -4
- package/dist/Step.js +19 -19
- package/dist/Step.js.map +1 -1
- package/dist/Stepper.js +9 -9
- package/dist/Switch.js +7 -7
- package/dist/Tab.js +4 -4
- package/dist/TabPanel.js +2 -2
- package/dist/Table.js +6 -6
- package/dist/Table.js.map +1 -1
- package/dist/TableCell.js +7 -7
- package/dist/TableHeaderCell.js +4 -4
- package/dist/TableHeaderRow.js +5 -5
- package/dist/TableRow.js +5 -5
- package/dist/TableRow.js.map +1 -1
- package/dist/TableRow.vue.d.ts +12 -8
- package/dist/Tabs.js +2 -2
- package/dist/{Tabs.vue_vue_type_script_setup_true_lang-NZm1OrRT.js → Tabs.vue_vue_type_script_setup_true_lang-CmnBP4i1.js} +4 -4
- package/dist/{Tabs.vue_vue_type_script_setup_true_lang-NZm1OrRT.js.map → Tabs.vue_vue_type_script_setup_true_lang-CmnBP4i1.js.map} +1 -1
- package/dist/TextEditor.js +3314 -3291
- package/dist/TextEditor.js.map +1 -1
- package/dist/TextEditor.vue.d.ts +5 -0
- package/dist/Textarea.js +3 -3
- package/dist/Textarea.js.map +1 -1
- package/dist/Thumbnail.js +7 -7
- package/dist/Thumbnail.js.map +1 -1
- package/dist/ThumbnailEmpty.js +3 -3
- package/dist/ThumbnailGroup.js +6 -6
- package/dist/ThumbnailGroup.js.map +1 -1
- package/dist/{ThumbnailGroup.keys-D6WL5xQ5.js → ThumbnailGroup.keys-EJ4qFNhx.js} +2 -2
- package/dist/{ThumbnailGroup.keys-D6WL5xQ5.js.map → ThumbnailGroup.keys-EJ4qFNhx.js.map} +1 -1
- package/dist/Timeline.js +2 -2
- package/dist/TimelineItem.js +3 -3
- package/dist/Toast.js +277 -280
- package/dist/Toast.js.map +1 -1
- package/dist/Toasts.js +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/components.css +1 -1
- package/dist/directives/autofocus.js +2 -2
- package/dist/directives/autofocus.js.map +1 -1
- package/dist/directives/sticky.js.map +1 -1
- package/dist/{formatDateTime-C8CYECpd.js → formatDateTime-Dz8bXV0R.js} +98 -12
- package/dist/{formatDateTime-C8CYECpd.js.map → formatDateTime-Dz8bXV0R.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/locale.js +3 -2
- package/dist/locale.js.map +1 -1
- package/dist/searchFuzzy-DRasJ33G.js +409 -0
- package/dist/{searchFuzzy-DKooyZM8.js.map → searchFuzzy-DRasJ33G.js.map} +1 -1
- package/dist/storage.js +3 -3
- package/dist/tailwind-base.js +0 -2
- package/dist/tailwind-base.js.map +1 -1
- package/dist/{toTimeZone-CVE1ZmsS.js → toTimeZone-Coq1oPTt.js} +7 -9
- package/dist/{toTimeZone-CVE1ZmsS.js.map → toTimeZone-Coq1oPTt.js.map} +1 -1
- package/dist/useModals.js.map +1 -1
- package/dist/usePaginationStats-d_q39naC.js +12 -0
- package/dist/usePaginationStats-d_q39naC.js.map +1 -0
- package/dist/useSearch.js +1 -1
- package/dist/useSelection.js +4 -1
- package/dist/useSelection.js.map +1 -1
- package/dist/useValidation.js +39 -36
- package/dist/useValidation.js.map +1 -1
- package/dist/utils/formatDateTime.js +2 -2
- package/dist/utils/helpers.js +29 -29
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/searchFuzzy.js +1 -1
- package/dist/utils/toTimeZone.js +1 -1
- package/package.json +42 -20
- package/tailwind-base.ts +0 -2
- package/types/jsonApi.ts +8 -8
- package/dist/DataView.keys-C7eaZg2G.js.map +0 -1
- package/dist/Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js.map +0 -1
- package/dist/searchFuzzy-DKooyZM8.js +0 -407
package/dist/utils/helpers.js
CHANGED
|
@@ -4,24 +4,24 @@ import g from "lodash-es/isFinite";
|
|
|
4
4
|
import C from "lodash-es/isPlainObject";
|
|
5
5
|
import { INBOUND_LEADS as b, SELLER_STATUSES as y, ORDER as S, LICENSE_COLORS as N } from "../constants.js";
|
|
6
6
|
const L = "BULK", f = ".mount-point-container";
|
|
7
|
-
function k(
|
|
8
|
-
return Object.keys(e).length ?
|
|
7
|
+
function k(r, e) {
|
|
8
|
+
return Object.keys(e).length ? r.filter((t) => {
|
|
9
9
|
for (const c in e) {
|
|
10
10
|
const s = e[c], l = s.filterBy;
|
|
11
|
-
let i = a(
|
|
12
|
-
if (C(i) && (i =
|
|
13
|
-
if (!s.customFilter(l, i,
|
|
11
|
+
let i = a(t, c.split("."));
|
|
12
|
+
if (C(i) && (i = t[c].id), "customFilter" in s) {
|
|
13
|
+
if (!s.customFilter(l, i, t))
|
|
14
14
|
return !1;
|
|
15
15
|
} else if (!Array.isArray(i) && !~l.indexOf(i))
|
|
16
16
|
return !1;
|
|
17
17
|
}
|
|
18
18
|
return !0;
|
|
19
|
-
}) :
|
|
19
|
+
}) : r;
|
|
20
20
|
}
|
|
21
|
-
function w(
|
|
22
|
-
const { sortBy:
|
|
23
|
-
return !
|
|
24
|
-
let o = a(m,
|
|
21
|
+
function w(r, e) {
|
|
22
|
+
const { sortBy: t, sortDesc: c, customSorter: s, locale: l = "en" } = e, i = r.length && typeof r[0] == "object";
|
|
23
|
+
return !t && i ? r : [...r].sort((m, p) => {
|
|
24
|
+
let o = a(m, t) || m, n = a(p, t) || p;
|
|
25
25
|
if (c && ([o, n] = [n, o]), s)
|
|
26
26
|
return s(o, n);
|
|
27
27
|
if ([o, n] = [o, n].map((u) => (u || "").toString().toLocaleLowerCase()), o !== n) {
|
|
@@ -32,46 +32,46 @@ function w(t, e) {
|
|
|
32
32
|
return 0;
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
function B(
|
|
36
|
-
return g(
|
|
35
|
+
function B(r) {
|
|
36
|
+
return g(r) && (r = r.toString()), !r || typeof r != "string" ? "" : r.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
37
37
|
}
|
|
38
|
-
function D(
|
|
39
|
-
return
|
|
38
|
+
function D(r) {
|
|
39
|
+
return r.split("").reduce((e, t) => (e = (e << 5) - e + t.charCodeAt(0), e & e), 0);
|
|
40
40
|
}
|
|
41
41
|
function I() {
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
42
|
+
const r = document.querySelector(f);
|
|
43
|
+
if (!r) {
|
|
44
44
|
const e = document.createElement("div");
|
|
45
45
|
return e.className = f.slice(1, f.length), document.body.appendChild(e);
|
|
46
46
|
}
|
|
47
|
-
return
|
|
47
|
+
return r;
|
|
48
48
|
}
|
|
49
|
-
function R(
|
|
50
|
-
let e =
|
|
49
|
+
function R(r) {
|
|
50
|
+
let e = r;
|
|
51
51
|
return e.substring(0, 2) !== "--" && (e = `--${e}`), getComputedStyle(document.documentElement).getPropertyValue(e);
|
|
52
52
|
}
|
|
53
|
-
function O(
|
|
54
|
-
const e =
|
|
53
|
+
function O(r = "") {
|
|
54
|
+
const e = r.toUpperCase();
|
|
55
55
|
return e === L ? e : e.slice(0, 3);
|
|
56
56
|
}
|
|
57
|
-
function _(
|
|
58
|
-
let
|
|
57
|
+
function _(r, e) {
|
|
58
|
+
let t;
|
|
59
59
|
try {
|
|
60
|
-
switch (
|
|
60
|
+
switch (r) {
|
|
61
61
|
case "license":
|
|
62
|
-
e = O(e),
|
|
62
|
+
e = O(e), t = N[e];
|
|
63
63
|
break;
|
|
64
64
|
case "order":
|
|
65
|
-
|
|
65
|
+
t = "tw-bg-" + S[e.toUpperCase()].color;
|
|
66
66
|
break;
|
|
67
67
|
case "certified-seller":
|
|
68
|
-
|
|
68
|
+
t = y[d(e)].color;
|
|
69
69
|
break;
|
|
70
70
|
case "inbound-leads":
|
|
71
|
-
|
|
71
|
+
t = b[e.toUpperCase()].color;
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return t || "tw-bg-ice-500";
|
|
75
75
|
} catch {
|
|
76
76
|
return "tw-bg-ice-500";
|
|
77
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../src/utils/helpers.ts"],"sourcesContent":["import camelCase from 'lodash-es/camelCase';\nimport get from 'lodash-es/get';\nimport isFinite from 'lodash-es/isFinite';\nimport isPlainObject from 'lodash-es/isPlainObject';\n\nimport { INBOUND_LEADS, LICENSE_COLORS, ORDER, SELLER_STATUSES } from '../constants';\n\nconst BULK = 'BULK';\nconst MOUNT_POINT_CLASS = '.mount-point-container';\n\n/**\n * Filters the list of `items` based on options selected in the `filters` object\n * @param {array} items A list of items to filter\n * @param {IFilter} options an options object for the filtering configuration\n */\nexport function filterItems(items, filters) {\n if (!Object.keys(filters).length) {\n return items;\n }\n\n return items.filter((item) => {\n for (const key in filters) {\n // eg. `brand`, `category`, `status`...\n const filter = filters[key]; // IFilter;\n const filterValues = filter.filterBy; // eg. ['1906', 'LuvBuds'], ['vape', 'pen', 'flower']\n let itemValue = get(item, key.split('.')); // eg `LuvBuds`, 'vape'\n\n // TODO take care of this upstream. ie write custom filter function if itemValue is an object\n // ie. if (typeof itemValue !== 'string' || typeof itemValue !== 'number' )\n if (isPlainObject(itemValue)) {\n itemValue = item[key].id;\n }\n\n if ('customFilter' in filter) {\n // custom function should return `false` when the filter logic does not match\n if (!filter.customFilter(filterValues, itemValue, item)) {\n return false;\n }\n } else {\n if (!Array.isArray(itemValue) && !~filterValues.indexOf(itemValue)) {\n return false;\n }\n }\n }\n\n return true;\n });\n}\n\n/**\n * Sorts an array of items\n * @param {Array} items the list of things to sort\n * @param {ISort} options an options object for the sorting configuration\n * sortBy: the object key to sort on\n * sortDesc: whether to sort descending or not\n * customSorter: a custom sorting function\n *\n * https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/util/helpers.ts#L381\n */\nexport function sortItems(items, options) {\n const { sortBy, sortDesc, customSorter, locale = 'en' } = options;\n const isObject = items.length && typeof items[0] === 'object';\n\n if (!sortBy && isObject) {\n return items;\n }\n\n return [...items].sort((a, b) => {\n let sortA = get(a, sortBy) || a;\n let sortB = get(b, sortBy) || b;\n\n if (sortDesc) {\n [sortA, sortB] = [sortB, sortA];\n }\n\n if (customSorter) {\n return customSorter(sortA, sortB);\n }\n\n [sortA, sortB] = [sortA, sortB].map((s) => (s || '').toString().toLocaleLowerCase());\n\n if (sortA !== sortB) {\n const sortResult =\n !isNaN(sortA) && !isNaN(sortB) ? Number(sortA) - Number(sortB) : sortA.localeCompare(sortB, locale);\n\n if (sortResult) {\n return sortResult;\n }\n }\n\n return 0;\n });\n}\n\n/**\n * Removes all accents/diacritics and converts to lower case\n * @param {string} text to normalize\n */\nexport function normalizeText(text) {\n if (isFinite(text)) {\n text = text.toString();\n }\n\n if (!text || typeof text !== 'string') {\n return '';\n }\n\n /**\n * NFD splits the canonical form and the regex removed only accent characters\n * see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize for more detail.\n */\n return text\n .toLowerCase()\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n}\n\n/**\n * Generates a hash code from a string\n * @param {string} s The string to generate a hash from\n * @see https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript/52171480\n */\nexport function hashCode(s) {\n return s.split('').reduce((a, b) => {\n a = (a << 5) - a + b.charCodeAt(0);\n return a & a;\n }, 0);\n}\n\n/**\n * Returns the mount point for elements that will reattach themselves, or creates one if not available\n */\nexport function getMountPoint() {\n const el = document.querySelector(MOUNT_POINT_CLASS);\n\n if (!el) {\n const div = document.createElement('div');\n\n div.className = MOUNT_POINT_CLASS.slice(1, MOUNT_POINT_CLASS.length);\n return document.body.appendChild(div);\n }\n\n return el;\n}\n\n/**\n * Retrieves the value of a css variable\n *\n * @param {string} name name of the css var, with or without `--`\n * @return {string} value of the css var\n */\nexport function getCssVar(name) {\n let variable = name;\n\n if (variable.substring(0, 2) !== '--') {\n variable = `--${variable}`;\n }\n\n return getComputedStyle(document.documentElement).getPropertyValue(variable);\n}\n\n/**\n * Format the license type text to display\n * @param {string} licenseType the first three characters of the licenseType\n */\nexport function formatLicenseTypeText(licenseType = '') {\n const type = licenseType.toUpperCase();\n\n return type === BULK ? type : type.slice(0, 3);\n}\n\nexport function generateColorClass(type, value) {\n let color;\n\n try {\n switch (type) {\n case 'license':\n value = formatLicenseTypeText(value);\n color = LICENSE_COLORS[value];\n break;\n case 'order':\n color = 'tw-bg-' + ORDER[value.toUpperCase()].color;\n break;\n case 'certified-seller':\n color = SELLER_STATUSES[camelCase(value)].color;\n break;\n case 'inbound-leads':\n color = INBOUND_LEADS[value.toUpperCase()].color;\n break;\n }\n\n return color || 'tw-bg-ice-500';\n } catch (
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../src/utils/helpers.ts"],"sourcesContent":["import camelCase from 'lodash-es/camelCase';\nimport get from 'lodash-es/get';\nimport isFinite from 'lodash-es/isFinite';\nimport isPlainObject from 'lodash-es/isPlainObject';\n\nimport { INBOUND_LEADS, LICENSE_COLORS, ORDER, SELLER_STATUSES } from '../constants';\n\nconst BULK = 'BULK';\nconst MOUNT_POINT_CLASS = '.mount-point-container';\n\n/**\n * Filters the list of `items` based on options selected in the `filters` object\n * @param {array} items A list of items to filter\n * @param {IFilter} options an options object for the filtering configuration\n */\nexport function filterItems(items, filters) {\n if (!Object.keys(filters).length) {\n return items;\n }\n\n return items.filter((item) => {\n for (const key in filters) {\n // eg. `brand`, `category`, `status`...\n const filter = filters[key]; // IFilter;\n const filterValues = filter.filterBy; // eg. ['1906', 'LuvBuds'], ['vape', 'pen', 'flower']\n let itemValue = get(item, key.split('.')); // eg `LuvBuds`, 'vape'\n\n // TODO take care of this upstream. ie write custom filter function if itemValue is an object\n // ie. if (typeof itemValue !== 'string' || typeof itemValue !== 'number' )\n if (isPlainObject(itemValue)) {\n itemValue = item[key].id;\n }\n\n if ('customFilter' in filter) {\n // custom function should return `false` when the filter logic does not match\n if (!filter.customFilter(filterValues, itemValue, item)) {\n return false;\n }\n } else {\n if (!Array.isArray(itemValue) && !~filterValues.indexOf(itemValue)) {\n return false;\n }\n }\n }\n\n return true;\n });\n}\n\n/**\n * Sorts an array of items\n * @param {Array} items the list of things to sort\n * @param {ISort} options an options object for the sorting configuration\n * sortBy: the object key to sort on\n * sortDesc: whether to sort descending or not\n * customSorter: a custom sorting function\n *\n * https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/util/helpers.ts#L381\n */\nexport function sortItems(items, options) {\n const { sortBy, sortDesc, customSorter, locale = 'en' } = options;\n const isObject = items.length && typeof items[0] === 'object';\n\n if (!sortBy && isObject) {\n return items;\n }\n\n return [...items].sort((a, b) => {\n let sortA = get(a, sortBy) || a;\n let sortB = get(b, sortBy) || b;\n\n if (sortDesc) {\n [sortA, sortB] = [sortB, sortA];\n }\n\n if (customSorter) {\n return customSorter(sortA, sortB);\n }\n\n [sortA, sortB] = [sortA, sortB].map((s) => (s || '').toString().toLocaleLowerCase());\n\n if (sortA !== sortB) {\n const sortResult =\n !isNaN(sortA) && !isNaN(sortB) ? Number(sortA) - Number(sortB) : sortA.localeCompare(sortB, locale);\n\n if (sortResult) {\n return sortResult;\n }\n }\n\n return 0;\n });\n}\n\n/**\n * Removes all accents/diacritics and converts to lower case\n * @param {string} text to normalize\n */\nexport function normalizeText(text) {\n if (isFinite(text)) {\n text = text.toString();\n }\n\n if (!text || typeof text !== 'string') {\n return '';\n }\n\n /**\n * NFD splits the canonical form and the regex removed only accent characters\n * see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize for more detail.\n */\n return text\n .toLowerCase()\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n}\n\n/**\n * Generates a hash code from a string\n * @param {string} s The string to generate a hash from\n * @see https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript/52171480\n */\nexport function hashCode(s) {\n return s.split('').reduce((a, b) => {\n a = (a << 5) - a + b.charCodeAt(0);\n return a & a;\n }, 0);\n}\n\n/**\n * Returns the mount point for elements that will reattach themselves, or creates one if not available\n */\nexport function getMountPoint() {\n const el = document.querySelector(MOUNT_POINT_CLASS);\n\n if (!el) {\n const div = document.createElement('div');\n\n div.className = MOUNT_POINT_CLASS.slice(1, MOUNT_POINT_CLASS.length);\n return document.body.appendChild(div);\n }\n\n return el;\n}\n\n/**\n * Retrieves the value of a css variable\n *\n * @param {string} name name of the css var, with or without `--`\n * @return {string} value of the css var\n */\nexport function getCssVar(name) {\n let variable = name;\n\n if (variable.substring(0, 2) !== '--') {\n variable = `--${variable}`;\n }\n\n return getComputedStyle(document.documentElement).getPropertyValue(variable);\n}\n\n/**\n * Format the license type text to display\n * @param {string} licenseType the first three characters of the licenseType\n */\nexport function formatLicenseTypeText(licenseType = '') {\n const type = licenseType.toUpperCase();\n\n return type === BULK ? type : type.slice(0, 3);\n}\n\nexport function generateColorClass(type, value) {\n let color;\n\n try {\n switch (type) {\n case 'license':\n value = formatLicenseTypeText(value);\n color = LICENSE_COLORS[value];\n break;\n case 'order':\n color = 'tw-bg-' + ORDER[value.toUpperCase()].color;\n break;\n case 'certified-seller':\n color = SELLER_STATUSES[camelCase(value)].color;\n break;\n case 'inbound-leads':\n color = INBOUND_LEADS[value.toUpperCase()].color;\n break;\n }\n\n return color || 'tw-bg-ice-500';\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (err) {\n return 'tw-bg-ice-500';\n }\n}\n"],"names":["BULK","MOUNT_POINT_CLASS","filterItems","items","filters","item","key","filter","filterValues","itemValue","get","isPlainObject","sortItems","options","sortBy","sortDesc","customSorter","locale","isObject","a","b","sortA","sortB","s","sortResult","normalizeText","text","isFinite","hashCode","getMountPoint","el","div","getCssVar","name","variable","formatLicenseTypeText","licenseType","type","generateColorClass","value","color","LICENSE_COLORS","ORDER","SELLER_STATUSES","camelCase","INBOUND_LEADS"],"mappings":"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"}
|
package/dist/utils/toTimeZone.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leaflink/stash",
|
|
3
|
-
"version": "50.
|
|
3
|
+
"version": "50.12.1",
|
|
4
4
|
"description": "LeafLink's design system.",
|
|
5
5
|
"homepage": "https://stash.leaflink.com",
|
|
6
6
|
"main": "./dist/index.ts",
|
|
@@ -103,38 +103,38 @@
|
|
|
103
103
|
"@vueuse/core": "^11.2.0",
|
|
104
104
|
"date-fns": "3.6.0",
|
|
105
105
|
"date-fns-tz": "3.1.3",
|
|
106
|
-
"dompurify": "3.
|
|
106
|
+
"dompurify": "3.2.4",
|
|
107
107
|
"flat": "6.0.1",
|
|
108
108
|
"fuzzysort": "3.0.2",
|
|
109
109
|
"sanitize-html": "2.13.0",
|
|
110
110
|
"v-calendar": "3.1.2",
|
|
111
|
-
"vue": "3.5.
|
|
111
|
+
"vue": "3.5.13",
|
|
112
112
|
"vue-currency-input": "3.1.0",
|
|
113
113
|
"vue-inline-svg": "3.1.4",
|
|
114
114
|
"vue3-carousel": "0.3.4",
|
|
115
115
|
"vue3-touch-events": "4.2.0"
|
|
116
116
|
},
|
|
117
117
|
"devDependencies": {
|
|
118
|
-
"@babel/core": "
|
|
119
|
-
"@babel/preset-env": "
|
|
120
|
-
"@babel/preset-typescript": "
|
|
118
|
+
"@babel/core": "7.26.10",
|
|
119
|
+
"@babel/preset-env": "7.26.9",
|
|
120
|
+
"@babel/preset-typescript": "7.26.0",
|
|
121
|
+
"@leaflink/eslint-config": "^4.1.0",
|
|
121
122
|
"@rollup/pluginutils": "^5.1.1",
|
|
122
123
|
"@testing-library/jest-dom": "^6.6.3",
|
|
123
124
|
"@testing-library/user-event": "^14.5.2",
|
|
124
125
|
"@testing-library/vue": "^8.1.0",
|
|
125
|
-
"@types/dompurify": "
|
|
126
|
+
"@types/dompurify": "3.2.0",
|
|
126
127
|
"@types/google.maps": "^3.58.1",
|
|
127
128
|
"@types/lodash-es": "^4.17.12",
|
|
128
129
|
"@types/plaid-link": "^2.0.15",
|
|
129
|
-
"@vitejs/plugin-vue": "
|
|
130
|
-
"@vitejs/plugin-vue-jsx": "
|
|
131
|
-
"@vitest/coverage-v8": "
|
|
132
|
-
"@vue/babel-plugin-jsx": "
|
|
130
|
+
"@vitejs/plugin-vue": "5.2.1",
|
|
131
|
+
"@vitejs/plugin-vue-jsx": "4.1.1",
|
|
132
|
+
"@vitest/coverage-v8": "3.0.8",
|
|
133
|
+
"@vue/babel-plugin-jsx": "1.4.0",
|
|
133
134
|
"@vue/test-utils": "^2.4.6",
|
|
134
135
|
"autoprefixer": "^10.4.20",
|
|
135
136
|
"doctoc": "^2.2.1",
|
|
136
|
-
"eslint": "^
|
|
137
|
-
"eslint-config-leaflink": "^3.4.0",
|
|
137
|
+
"eslint": "^9.17.0",
|
|
138
138
|
"husky": "^9.1.6",
|
|
139
139
|
"jsdom": "^25.0.1",
|
|
140
140
|
"lint-staged": "^15.2.10",
|
|
@@ -145,19 +145,20 @@
|
|
|
145
145
|
"postcss-preset-env": "^10.0.5",
|
|
146
146
|
"quill": "^2.0.2",
|
|
147
147
|
"rollup-plugin-copy": "^3.5.0",
|
|
148
|
-
"stylelint": "^
|
|
148
|
+
"stylelint": "^16.12.0",
|
|
149
|
+
"stylelint-config-standard-scss": "^14.0.0",
|
|
149
150
|
"stylelint-config-standard-vue": "^1.0.0",
|
|
150
151
|
"svg-sprite": "^2.0.4",
|
|
151
152
|
"tailwindcss": "^3.4.13",
|
|
152
153
|
"typescript": "5.4.2",
|
|
153
|
-
"vite": "
|
|
154
|
+
"vite": "6.2.2",
|
|
154
155
|
"vite-plugin-dts": "3.9.1",
|
|
155
156
|
"vite-svg-loader": "^5.1.0",
|
|
156
|
-
"vitepress": "
|
|
157
|
-
"vitest": "
|
|
158
|
-
"vue-component-meta": "
|
|
157
|
+
"vitepress": "1.6.3",
|
|
158
|
+
"vitest": "3.0.8",
|
|
159
|
+
"vue-component-meta": "2.2.8",
|
|
159
160
|
"vue-eslint-parser": "^9.4.3",
|
|
160
|
-
"vue-tsc": "2.
|
|
161
|
+
"vue-tsc": "2.2.8"
|
|
161
162
|
},
|
|
162
163
|
"peerDependencies": {
|
|
163
164
|
"lodash-es": "^4.x.x",
|
|
@@ -174,11 +175,32 @@
|
|
|
174
175
|
},
|
|
175
176
|
"lint-staged": {
|
|
176
177
|
"{README,CONTRIBUTING,ARCHITECTURE}.md": [
|
|
177
|
-
"prettier --write --config ./node_modules/eslint-config
|
|
178
|
+
"prettier --write --config ./node_modules/@leaflink/eslint-config/prettier.js",
|
|
178
179
|
"doctoc --title '## Table of Contents'"
|
|
179
180
|
]
|
|
180
181
|
},
|
|
181
182
|
"volta": {
|
|
182
183
|
"node": "22.8.0"
|
|
184
|
+
},
|
|
185
|
+
"stylelint": {
|
|
186
|
+
"extends": [
|
|
187
|
+
"@leaflink/eslint-config/stylelint"
|
|
188
|
+
],
|
|
189
|
+
"rules": {
|
|
190
|
+
"value-keyword-case": [
|
|
191
|
+
"lower",
|
|
192
|
+
{
|
|
193
|
+
"ignoreFunctions": [
|
|
194
|
+
"theme",
|
|
195
|
+
"v-bind"
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"commitlint": {
|
|
202
|
+
"extends": [
|
|
203
|
+
"@leaflink/eslint-config/commitlint"
|
|
204
|
+
]
|
|
183
205
|
}
|
|
184
206
|
}
|
package/tailwind-base.ts
CHANGED
|
@@ -416,8 +416,6 @@ export default {
|
|
|
416
416
|
container: false,
|
|
417
417
|
preflight: false,
|
|
418
418
|
},
|
|
419
|
-
// TODO: update prettier/eslint to support TS 4.9+ so we can use the `satisfies` operator and still know we have a semicolon 🙄
|
|
420
|
-
// eslint-disable-next-line
|
|
421
419
|
} satisfies Config;
|
|
422
420
|
|
|
423
421
|
/**
|
package/types/jsonApi.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* The base data structure for a JSON api response
|
|
9
9
|
* @see https://jsonapi.org/format/#document-structure
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
export interface IJsonDocument {
|
|
13
13
|
data?: IJsonResource | IJsonResource[];
|
|
14
14
|
errors?: IJsonError[];
|
|
@@ -24,7 +24,7 @@ export interface IJsonDocument {
|
|
|
24
24
|
/**
|
|
25
25
|
* Contains a list of errors
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
export interface IJsonErrorDocument extends IJsonDocument {
|
|
29
29
|
errors: IJsonError[];
|
|
30
30
|
}
|
|
@@ -33,7 +33,7 @@ export interface IJsonErrorDocument extends IJsonDocument {
|
|
|
33
33
|
* A resource object
|
|
34
34
|
* @see https://jsonapi.org/format/#document-resource-objects
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
export interface IJsonResource<T = unknown> {
|
|
38
38
|
id: string;
|
|
39
39
|
type: string;
|
|
@@ -48,7 +48,7 @@ export interface IJsonResource<T = unknown> {
|
|
|
48
48
|
* @see https://jsonapi.org/format/#error-objects
|
|
49
49
|
* @see https://jsonapi.org/examples/#error-objects
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
export interface IJsonError {
|
|
53
53
|
id: string;
|
|
54
54
|
links?: IJsonLinks;
|
|
@@ -67,7 +67,7 @@ export interface IJsonError {
|
|
|
67
67
|
* An attributes object
|
|
68
68
|
* @see https://jsonapi.org/format/#document-resource-object-attributes
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
export interface IJsonAttributes<T = unknown> {
|
|
72
72
|
[key: string]: T;
|
|
73
73
|
}
|
|
@@ -76,7 +76,7 @@ export interface IJsonAttributes<T = unknown> {
|
|
|
76
76
|
* A relationships object
|
|
77
77
|
* @see https://jsonapi.org/format/#document-resource-object-relationships
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
export interface IJsonRelationship {
|
|
81
81
|
links: IJsonLinks;
|
|
82
82
|
data?: IJsonResource;
|
|
@@ -87,7 +87,7 @@ export interface IJsonRelationship {
|
|
|
87
87
|
* A links object
|
|
88
88
|
* @see https://jsonapi.org/format/#document-links
|
|
89
89
|
*/
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
export interface IJsonLinks {
|
|
92
92
|
about: string;
|
|
93
93
|
self?: string;
|
|
@@ -101,7 +101,7 @@ export interface IJsonLinks {
|
|
|
101
101
|
* A meta object
|
|
102
102
|
* @see https://jsonapi.org/format/#document-meta
|
|
103
103
|
*/
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
export interface IJsonMeta<T = unknown> {
|
|
106
106
|
[key: string]: Partial<T>;
|
|
107
107
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataView.keys-C7eaZg2G.js","sources":["../src/components/DataView/DataView.constants.ts","../src/components/DataView/DataView.keys.ts"],"sourcesContent":["export const DEFAULT_PAGE_SIZE = 12;\n","import { computed, ref } from 'vue';\n\nimport { InjectionWithDefaults } from '../../../types/utils';\nimport { DEFAULT_PAGE_SIZE } from './DataView.constants';\nimport { DataViewInjection } from './DataView.types';\n\n// See: https://vuejs.org/guide/typescript/composition-api.html#typing-provide-inject\n\n/**\n * Miscellaneous data that is not related to pagination, sorting, or searching.\n * TODO: merge all DataView injections into one. https://leaflink.atlassian.net/browse/STASH-507\n */\nexport const DATA_VIEW_INJECTION: InjectionWithDefaults<DataViewInjection> = Object.freeze({\n key: Symbol('DATA_VIEW_INJECTION_KEY'),\n defaults: Object.freeze({\n // Pagination\n currentPage: computed(() => 1),\n isPaginationEnabled: computed(() => false),\n pageCount: computed(() => 1),\n pageSize: computed(() => DEFAULT_PAGE_SIZE),\n totalDataCount: computed(() => 0),\n setPage() {},\n goPrevPage() {},\n goNextPage() {},\n\n // Sorting\n currentSortId: computed(() => undefined),\n currentSortOrder: computed(() => undefined),\n updateCurrentSort() {},\n\n // Search\n currentSearch: computed(() => ''),\n updateCurrentSearch() {},\n\n // Miscellanous\n density: computed(() => undefined),\n isEmpty: computed(() => false),\n isLoading: computed(() => false),\n isSelectable: ref(false),\n isWithinModule: computed(() => false),\n variant: computed(() => undefined),\n }),\n});\n"],"names":["DEFAULT_PAGE_SIZE","DATA_VIEW_INJECTION","computed","ref"],"mappings":";AAAO,MAAMA,IAAoB,ICYpBC,IAAgE,OAAO,OAAO;AAAA,EACzF,KAAK,OAAO,yBAAyB;AAAA,EACrC,UAAU,OAAO,OAAO;AAAA;AAAA,IAEtB,aAAaC,EAAS,MAAM,CAAC;AAAA,IAC7B,qBAAqBA,EAAS,MAAM,EAAK;AAAA,IACzC,WAAWA,EAAS,MAAM,CAAC;AAAA,IAC3B,UAAUA,EAAS,MAAMF,CAAiB;AAAA,IAC1C,gBAAgBE,EAAS,MAAM,CAAC;AAAA,IAChC,UAAU;AAAA,IAAC;AAAA,IACX,aAAa;AAAA,IAAC;AAAA,IACd,aAAa;AAAA,IAAC;AAAA;AAAA,IAGd,eAAeA,EAAS,MAAM;AAAA,KAAS;AAAA,IACvC,kBAAkBA,EAAS,MAAM;AAAA,KAAS;AAAA,IAC1C,oBAAoB;AAAA,IAAC;AAAA;AAAA,IAGrB,eAAeA,EAAS,MAAM,EAAE;AAAA,IAChC,sBAAsB;AAAA,IAAC;AAAA;AAAA,IAGvB,SAASA,EAAS,MAAM;AAAA,KAAS;AAAA,IACjC,SAASA,EAAS,MAAM,EAAK;AAAA,IAC7B,WAAWA,EAAS,MAAM,EAAK;AAAA,IAC/B,cAAcC,EAAI,EAAK;AAAA,IACvB,gBAAgBD,EAAS,MAAM,EAAK;AAAA,IACpC,SAASA,EAAS,MAAA;AAAA,KAAe;AAAA,EAClC,CAAA;AACH,CAAC;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js","sources":["../src/components/Field/Field.vue"],"sourcesContent":["<script lang=\"ts\">\n import { FieldProps } from './Field.types';\n\n export * from './Field.types';\n</script>\n\n<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, useAttrs, useSlots } from 'vue';\n\n import Label from '../Label/Label.vue';\n\n defineOptions({\n inheritAttrs: false,\n });\n\n const props = withDefaults(defineProps<FieldProps>(), {\n addBottomSpace: false,\n errorText: undefined,\n hintText: undefined,\n id: undefined,\n errorId: undefined,\n isRequired: false,\n label: undefined,\n showOptionalInLabel: false,\n fieldset: false,\n isDisabled: false,\n disabled: false,\n });\n const attrs = useAttrs();\n const slots = useSlots();\n const fieldId = computed(() => props.id || uniqueId('stash-field-'));\n const fieldErrorId = computed(() => props.errorId || uniqueId('stash-field-error-'));\n const labelId = computed(() => uniqueId('stash-field-label-'));\n const hasError = computed(() => !!props.errorText);\n const wrapperElement = computed(() => (props.fieldset ? 'fieldset' : 'div'));\n\n // Any attributes that are unique to form elements, you want to exclude from\n // being bound from the root element.\n const rootAttrs = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { placeholder, ...otherAttrs } = attrs;\n\n return otherAttrs;\n });\n</script>\n\n<template>\n <component\n :is=\"wrapperElement\"\n data-test=\"stash-field\"\n class=\"stash-field\"\n :class=\"[\n { 'tw-p-0': props.fieldset },\n { 'tw-mb-9': props.addBottomSpace && !props.errorText && !props.hintText && !slots.hint },\n { 'tw-mb-4': props.addBottomSpace && (props.errorText || props.hintText || slots.hint) },\n { 'stash-field--disabled': props.isDisabled || props.disabled },\n { 'stash-field--is-read-only': props.isReadOnly },\n { 'stash-field--is-required': props.isRequired },\n { 'stash-field--has-error': hasError },\n ]\"\n v-bind=\"rootAttrs\"\n >\n <Label\n v-if=\"props.label\"\n :id=\"labelId\"\n :for=\"fieldId\"\n :has-error=\"hasError\"\n :is-required=\"isRequired\"\n :show-optional=\"props.showOptionalInLabel\"\n :legend=\"props.fieldset\"\n :disabled=\"props.isDisabled || props.disabled\"\n >\n {{ props.label }}\n </Label>\n\n <!-- @slot for the form field; the Label can also be rendered here instead of using the label prop -->\n <slot\n :field-id=\"fieldId\"\n :field-error-id=\"fieldErrorId\"\n :has-error=\"hasError\"\n :is-required=\"isRequired\"\n :is-read-only=\"props.isReadOnly\"\n :disabled=\"props.isDisabled || props.disabled\"\n :label-id=\"labelId\"\n :show-optional-in-label=\"props.showOptionalInLabel\"\n ></slot>\n\n <span\n v-if=\"props.errorText\"\n :id=\"fieldErrorId\"\n class=\"stash-field-error tw-mt-1 tw-block tw-whitespace-pre-line tw-text-xs tw-text-red-500\"\n data-test=\"stash-field-error\"\n >\n {{ props.errorText }}\n </span>\n\n <span\n v-else-if=\"props.hintText && !props.isReadOnly\"\n class=\"stash-field-hint tw-mt-1 tw-block tw-whitespace-pre-line tw-text-xs\"\n data-test=\"stash-field-hint\"\n >\n {{ props.hintText }}\n </span>\n\n <div\n v-else-if=\"slots.hint && !props.isReadOnly\"\n class=\"stash-field-hint tw-mt-1 tw-whitespace-pre-line tw-text-xs\"\n data-test=\"stash-field-hint\"\n >\n <!-- @slot for displaying hint text below the field -->\n <slot name=\"hint\"></slot>\n </div>\n </component>\n</template>\n"],"names":["props","__props","attrs","useAttrs","slots","useSlots","fieldId","computed","uniqueId","fieldErrorId","labelId","hasError","wrapperElement","rootAttrs","placeholder","otherAttrs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBE,UAAMA,IAAQC,GAaRC,IAAQC,EAAS,GACjBC,IAAQC,EAAS,GACjBC,IAAUC,EAAS,MAAMP,EAAM,MAAMQ,EAAS,cAAc,CAAC,GAC7DC,IAAeF,EAAS,MAAMP,EAAM,WAAWQ,EAAS,oBAAoB,CAAC,GAC7EE,IAAUH,EAAS,MAAMC,EAAS,oBAAoB,CAAC,GACvDG,IAAWJ,EAAS,MAAM,CAAC,CAACP,EAAM,SAAS,GAC3CY,IAAiBL,EAAS,MAAOP,EAAM,WAAW,aAAa,KAAM,GAIrEa,IAAYN,EAAS,MAAM;AAE/B,YAAM,EAAE,aAAAO,GAAa,GAAGC,EAAA,IAAeb;AAEhC,aAAAa;AAAA,IAAA,CACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|