@leaflink/stash 53.1.0 → 53.3.2
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/Copy.js +92 -53
- package/dist/Copy.js.map +1 -1
- package/dist/Copy.vue.d.ts +14 -6
- package/dist/Dialog.js +6 -6
- package/dist/Dialog.js.map +1 -1
- package/dist/FileUpload.js +43 -43
- package/dist/FileUpload.js.map +1 -1
- package/dist/ListView.js +78 -78
- package/dist/ListView.js.map +1 -1
- package/dist/MoreActions.js +1 -1
- package/dist/PageNavigation.js +1 -1
- package/dist/Select.js +1 -1
- package/dist/Select.js.map +1 -1
- package/dist/Tab.js +1 -1
- package/dist/Tabs.js +2 -2
- package/dist/{Tabs.vue_vue_type_script_setup_true_lang-BVTCcK6M.js → Tabs.vue_vue_type_script_setup_true_lang-BFURXY_-.js} +2 -2
- package/dist/{Tabs.vue_vue_type_script_setup_true_lang-BVTCcK6M.js.map → Tabs.vue_vue_type_script_setup_true_lang-BFURXY_-.js.map} +1 -1
- package/dist/Thumbnail.js +27 -27
- package/dist/Thumbnail.js.map +1 -1
- package/dist/ThumbnailEmpty.js +5 -5
- package/dist/ThumbnailEmpty.js.map +1 -1
- package/dist/ThumbnailGroup.js +16 -16
- package/dist/ThumbnailGroup.js.map +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-mzBLSXy3.js → Tooltip.vue_vue_type_script_setup_true_lang-CF6sw2VC.js} +2 -2
- package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-mzBLSXy3.js.map → Tooltip.vue_vue_type_script_setup_true_lang-CF6sw2VC.js.map} +1 -1
- package/dist/components.css +1 -1
- package/dist/index-B1Gkwuxd.js +277 -0
- package/dist/index-B1Gkwuxd.js.map +1 -0
- package/dist/useSortable.js +1 -1
- package/package.json +2 -2
- package/dist/index-DBV9Uz0C.js +0 -294
- package/dist/index-DBV9Uz0C.js.map +0 -1
package/dist/Copy.js
CHANGED
|
@@ -1,73 +1,112 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import { defineComponent as w, computed as r, watch as g, useCssModule as T, ref as z, createElementBlock as p, openBlock as s, normalizeClass as l, unref as d, createBlock as c, Fragment as B, renderSlot as M, createVNode as u, withCtx as a, createTextVNode as y, toDisplayString as m } from "vue";
|
|
2
|
+
import E from "@leaflink/snitch";
|
|
3
|
+
import { UI_TIMEOUT as I } from "./constants.js";
|
|
4
|
+
import { t as f } from "./locale.js";
|
|
5
|
+
import _ from "./Button.js";
|
|
6
|
+
import x from "./Icon.js";
|
|
7
|
+
import $ from "./IconLabel.js";
|
|
8
|
+
import { _ as N } from "./Tooltip.vue_vue_type_script_setup_true_lang-CF6sw2VC.js";
|
|
9
|
+
import { _ as S } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
10
|
+
const U = /* @__PURE__ */ w({
|
|
9
11
|
__name: "Copy",
|
|
10
12
|
props: {
|
|
11
13
|
text: { default: void 0 },
|
|
12
|
-
value: {
|
|
13
|
-
visible: { type: Boolean, default: !1 }
|
|
14
|
+
value: {},
|
|
15
|
+
visible: { type: Boolean, default: !1 },
|
|
16
|
+
mode: { default: "unset" }
|
|
14
17
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
emits: ["copy"],
|
|
19
|
+
setup(h, { emit: v }) {
|
|
20
|
+
const t = h, o = r(() => t.mode !== "unset" ? t.mode : t.text ? "text" : "icon");
|
|
21
|
+
g(
|
|
22
|
+
[o, () => t.text, () => t.visible],
|
|
23
|
+
() => {
|
|
24
|
+
if (!t.text && ["text", "icon-button"].includes(o.value))
|
|
25
|
+
throw new Error("Copy: text prop is required when mode is text or icon-button");
|
|
26
|
+
if (t.text && o.value === "icon")
|
|
27
|
+
throw new Error("Copy: text prop is not allowed when mode is icon");
|
|
28
|
+
o.value === "icon-button" && t.visible === !1 && E.warn("Copy: visible prop is ignored when mode is icon-button");
|
|
29
|
+
},
|
|
30
|
+
{ immediate: !0 }
|
|
31
|
+
);
|
|
32
|
+
const b = v, n = T(), e = z(!1), C = r(() => e.value ? f("ll.copy.copied") : t.text ? null : f("ll.copy.copyToClipboard"));
|
|
33
|
+
function i() {
|
|
18
34
|
navigator.clipboard.writeText(t.value), e.value = !0, setTimeout(() => {
|
|
19
35
|
e.value = !1;
|
|
20
|
-
},
|
|
36
|
+
}, I), b("copy");
|
|
21
37
|
}
|
|
22
|
-
return (
|
|
23
|
-
class: l(["stash-copy flex items-center", { [
|
|
38
|
+
return (k, L) => (s(), p("div", {
|
|
39
|
+
class: l(["stash-copy flex items-center", { [d(n).hidden]: !t.visible }]),
|
|
24
40
|
"data-test": "stash-copy"
|
|
25
41
|
}, [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
o.value !== "icon-button" ? (s(), p(B, { key: 0 }, [
|
|
43
|
+
M(k.$slots, "default"),
|
|
44
|
+
u(N, {
|
|
45
|
+
side: "top",
|
|
46
|
+
text: C.value,
|
|
47
|
+
"is-disabled": !!t.text,
|
|
48
|
+
class: l(["stash-copy__copy-zone ml-3 cursor-pointer", d(n).copy]),
|
|
49
|
+
"data-test": "stash-copy|copy-zone"
|
|
50
|
+
}, {
|
|
51
|
+
default: a(() => [
|
|
52
|
+
e.value ? (s(), c(x, {
|
|
53
|
+
key: 0,
|
|
54
|
+
class: "stash-copy__success-icon text-green-500",
|
|
55
|
+
name: "circle-check",
|
|
56
|
+
"data-test": "stash-copy|success-icon"
|
|
57
|
+
})) : o.value === "text" ? (s(), c(_, {
|
|
58
|
+
key: 1,
|
|
59
|
+
class: "stash-copy__copy-text",
|
|
60
|
+
inline: "",
|
|
61
|
+
"data-test": "stash-copy|copy-target",
|
|
62
|
+
onClick: i
|
|
63
|
+
}, {
|
|
64
|
+
default: a(() => [
|
|
65
|
+
y(m(t.text), 1)
|
|
66
|
+
]),
|
|
67
|
+
_: 1
|
|
68
|
+
})) : (s(), c(x, {
|
|
69
|
+
key: 2,
|
|
70
|
+
class: "stash-copy__copy-icon",
|
|
71
|
+
name: "copy",
|
|
72
|
+
title: "Copy to clipboard",
|
|
73
|
+
"data-test": "stash-copy|copy-target",
|
|
74
|
+
onClick: i
|
|
75
|
+
}))
|
|
76
|
+
]),
|
|
77
|
+
_: 1
|
|
78
|
+
}, 8, ["text", "is-disabled", "class"])
|
|
79
|
+
], 64)) : (s(), c(_, {
|
|
80
|
+
key: 1,
|
|
81
|
+
"icon-label": "",
|
|
82
|
+
"data-test": e.value ? "stash-copy|success-icon-button" : "stash-copy|copy-target",
|
|
83
|
+
title: t.text,
|
|
84
|
+
class: l(e.value ? "text-green-500" : ""),
|
|
85
|
+
onClick: i
|
|
33
86
|
}, {
|
|
34
|
-
default:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"data-test": "stash-copy|success-icon"
|
|
40
|
-
})) : t.text ? (o(), s(g, {
|
|
41
|
-
key: 1,
|
|
42
|
-
class: "stash-copy__copy-text",
|
|
43
|
-
inline: "",
|
|
44
|
-
"data-test": "stash-copy|copy-target",
|
|
45
|
-
onClick: a
|
|
87
|
+
default: a(() => [
|
|
88
|
+
u($, {
|
|
89
|
+
icon: e.value ? "circle-check" : "copy",
|
|
90
|
+
title: t.text,
|
|
91
|
+
stacked: ""
|
|
46
92
|
}, {
|
|
47
|
-
default:
|
|
48
|
-
|
|
93
|
+
default: a(() => [
|
|
94
|
+
y(m(t.text), 1)
|
|
49
95
|
]),
|
|
50
96
|
_: 1
|
|
51
|
-
}
|
|
52
|
-
key: 2,
|
|
53
|
-
class: "stash-copy__copy-icon",
|
|
54
|
-
name: "copy",
|
|
55
|
-
title: "Copy to clipboard",
|
|
56
|
-
"data-test": "stash-copy|copy-target",
|
|
57
|
-
onClick: a
|
|
58
|
-
}))
|
|
97
|
+
}, 8, ["icon", "title"])
|
|
59
98
|
]),
|
|
60
99
|
_: 1
|
|
61
|
-
}, 8, ["
|
|
100
|
+
}, 8, ["data-test", "title", "class"]))
|
|
62
101
|
], 2));
|
|
63
102
|
}
|
|
64
|
-
}),
|
|
65
|
-
hidden:
|
|
66
|
-
copy:
|
|
67
|
-
},
|
|
68
|
-
$style:
|
|
69
|
-
},
|
|
103
|
+
}), V = "_hidden_z4re6_3", q = "_copy_z4re6_4", D = {
|
|
104
|
+
hidden: V,
|
|
105
|
+
copy: q
|
|
106
|
+
}, F = {
|
|
107
|
+
$style: D
|
|
108
|
+
}, R = /* @__PURE__ */ S(U, [["__cssModules", F]]);
|
|
70
109
|
export {
|
|
71
|
-
|
|
110
|
+
R as default
|
|
72
111
|
};
|
|
73
112
|
//# sourceMappingURL=Copy.js.map
|
package/dist/Copy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Copy.js","sources":["../src/components/Copy/Copy.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, useCssModule } from 'vue';\n\n import { UI_TIMEOUT } from '../../constants';\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n import Tooltip from '../Tooltip/Tooltip.vue';\n\n export interface CopyProps {\n /**\n * Optional text to display instead of icon.\n */\n text?: string;\n\n /**\n * The value to copy to clipboard.\n */\n value
|
|
1
|
+
{"version":3,"file":"Copy.js","sources":["../src/components/Copy/Copy.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import { computed, ref, useCssModule, watch } from 'vue';\n\n import { UI_TIMEOUT } from '../../constants';\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n import IconLabel from '../IconLabel/IconLabel.vue';\n import Tooltip from '../Tooltip/Tooltip.vue';\n\n export interface CopyProps {\n /**\n * Optional text to display instead of icon.\n */\n text?: string;\n\n /**\n * The value to copy to clipboard.\n */\n value: string;\n\n /**\n * Sets the copy icon or text to always be visible. By default, icon/text only appears when hovering over slot content.\n */\n visible?: boolean;\n\n /**\n * Sets the mode of the copy component.\n */\n // TODO: remove unset mode eventually but it will cause a breaking change\n mode?: 'icon' | 'text' | 'icon-button' | 'unset';\n }\n\n const props = withDefaults(defineProps<CopyProps>(), {\n text: undefined,\n visible: false,\n mode: 'unset',\n });\n\n /**\n * Compute the mode based on the props for backwards compatibility. Previously the checks were done\n * in the template based on text being present. Have to calculate it here after the text prop is set.\n */\n const computedMode = computed(() => {\n // If the mode is set, use it (new behavior)\n if (props.mode !== 'unset') return props.mode;\n\n // Otherwise, determine it based on the text prop (old behavior)\n return props.text ? 'text' : 'icon';\n });\n\n watch(\n [computedMode, () => props.text, () => props.visible],\n () => {\n // Validate the mode based on the text prop. This will still pass if the mode is unset but the text prop is present.\n if (!props.text && ['text', 'icon-button'].includes(computedMode.value)) {\n throw new Error('Copy: text prop is required when mode is text or icon-button');\n } else if (props.text && computedMode.value === 'icon') {\n throw new Error('Copy: text prop is not allowed when mode is icon');\n }\n\n // If the mode is icon-button and the visible prop is false,\n // warn the user that the visible prop is ignored when mode is icon-button\n // Because we have to show the whole control\n if (computedMode.value === 'icon-button' && props.visible === false) {\n logger.warn('Copy: visible prop is ignored when mode is icon-button');\n }\n },\n { immediate: true },\n );\n\n const emit = defineEmits<{\n /**\n * Emitted when the copy action is completed.\n */\n (e: 'copy'): void;\n }>();\n\n const classes = useCssModule();\n\n // Flag to indicate whether a user successfully copied the text to their clipboard.\n // Note: We reset this flag after a timeout to allow the user to copy the text multiple times.\n const isCopied = ref(false);\n\n const tooltip = computed(() => {\n return isCopied.value ? t('ll.copy.copied') : !props.text ? t('ll.copy.copyToClipboard') : null;\n });\n\n function handleCopy() {\n navigator.clipboard.writeText(props.value);\n isCopied.value = true;\n\n // Reset the copied state after the timeout to flip the icon back\n setTimeout(() => {\n isCopied.value = false;\n }, UI_TIMEOUT);\n\n emit('copy');\n }\n</script>\n\n<template>\n <div class=\"stash-copy flex items-center\" :class=\"{ [classes.hidden]: !props.visible }\" data-test=\"stash-copy\">\n <!-- If the mode is not icon-button, render the appropriate content based on the mode -->\n <template v-if=\"computedMode !== 'icon-button'\">\n <!-- @slot Anything you want to render. This is not what will be copied to the clipboard. -->\n <slot></slot>\n <Tooltip\n side=\"top\"\n :text=\"tooltip\"\n :is-disabled=\"!!props.text\"\n class=\"stash-copy__copy-zone ml-3 cursor-pointer\"\n :class=\"classes.copy\"\n data-test=\"stash-copy|copy-zone\"\n >\n <!-- Regardless of the mode, we always render ONLY the success icon if the text has been copied \n Which is why this is the first in the `v-if` block-->\n <Icon\n v-if=\"isCopied\"\n class=\"stash-copy__success-icon text-green-500\"\n name=\"circle-check\"\n data-test=\"stash-copy|success-icon\"\n />\n <!-- If the mode is text, we render a button with the text -->\n <Button\n v-else-if=\"computedMode === 'text'\"\n class=\"stash-copy__copy-text\"\n inline\n data-test=\"stash-copy|copy-target\"\n @click=\"handleCopy\"\n >\n {{ props.text }}\n </Button>\n <!-- If the mode is icon, we render just the icon -->\n <Icon\n v-else\n class=\"stash-copy__copy-icon\"\n name=\"copy\"\n title=\"Copy to clipboard\"\n data-test=\"stash-copy|copy-target\"\n @click=\"handleCopy\"\n />\n </Tooltip>\n </template>\n <template v-else>\n <!-- If the mode is icon-button, we render an icon button with the icon and text -->\n <Button\n icon-label\n :data-test=\"isCopied ? 'stash-copy|success-icon-button' : 'stash-copy|copy-target'\"\n :title=\"props.text\"\n :class=\"isCopied ? 'text-green-500' : ''\"\n @click=\"handleCopy\"\n >\n <IconLabel :icon=\"isCopied ? 'circle-check' : 'copy'\" :title=\"props.text\" stacked>\n {{ props.text }}\n </IconLabel>\n </Button>\n </template>\n </div>\n</template>\n\n<style module>\n @layer utilities {\n .hidden {\n .copy {\n visibility: hidden;\n }\n\n &:hover {\n .copy {\n visibility: visible;\n }\n }\n }\n }\n</style>\n"],"names":["props","__props","computedMode","computed","watch","logger","emit","__emit","classes","useCssModule","isCopied","ref","tooltip","t","handleCopy","UI_TIMEOUT"],"mappings":";;;;;;;;;;;;;;;;;;;AAkCE,UAAMA,IAAQC,GAURC,IAAeC,EAAS,MAExBH,EAAM,SAAS,UAAgBA,EAAM,OAGlCA,EAAM,OAAO,SAAS,MAC9B;AAED,IAAAI;AAAA,MACE,CAACF,GAAc,MAAMF,EAAM,MAAM,MAAMA,EAAM,OAAO;AAAA,MACpD,MAAM;AAEJ,YAAI,CAACA,EAAM,QAAQ,CAAC,QAAQ,aAAa,EAAE,SAASE,EAAa,KAAK;AACpE,gBAAM,IAAI,MAAM,8DAA8D;AAChF,YAAWF,EAAM,QAAQE,EAAa,UAAU;AAC9C,gBAAM,IAAI,MAAM,kDAAkD;AAMpE,QAAIA,EAAa,UAAU,iBAAiBF,EAAM,YAAY,MAC5DK,EAAO,KAAK,wDAAwD;AAAA,MAExE;AAAA,MACA,EAAE,WAAW,GAAA;AAAA,IAAK;AAGpB,UAAMC,IAAOC,GAOPC,IAAUC,EAAA,GAIVC,IAAWC,EAAI,EAAK,GAEpBC,IAAUT,EAAS,MAChBO,EAAS,QAAQG,EAAE,gBAAgB,IAAKb,EAAM,OAAsC,OAA/Ba,EAAE,yBAAyB,CACxF;AAED,aAASC,IAAa;AACpB,gBAAU,UAAU,UAAUd,EAAM,KAAK,GACzCU,EAAS,QAAQ,IAGjB,WAAW,MAAM;AACf,QAAAA,EAAS,QAAQ;AAAA,MACnB,GAAGK,CAAU,GAEbT,EAAK,MAAM;AAAA,IACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Copy.vue.d.ts
CHANGED
|
@@ -40,24 +40,32 @@ export declare interface CopyProps {
|
|
|
40
40
|
/**
|
|
41
41
|
* The value to copy to clipboard.
|
|
42
42
|
*/
|
|
43
|
-
value
|
|
43
|
+
value: string;
|
|
44
44
|
/**
|
|
45
45
|
* Sets the copy icon or text to always be visible. By default, icon/text only appears when hovering over slot content.
|
|
46
46
|
*/
|
|
47
47
|
visible?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the mode of the copy component.
|
|
50
|
+
*/
|
|
51
|
+
mode?: 'icon' | 'text' | 'icon-button' | 'unset';
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
declare const _default: __VLS_WithTemplateSlots<DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<CopyProps>, {
|
|
51
55
|
text: undefined;
|
|
52
|
-
value: string;
|
|
53
56
|
visible: boolean;
|
|
54
|
-
|
|
57
|
+
mode: string;
|
|
58
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
59
|
+
copy: () => void;
|
|
60
|
+
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<CopyProps>, {
|
|
55
61
|
text: undefined;
|
|
56
|
-
value: string;
|
|
57
62
|
visible: boolean;
|
|
58
|
-
|
|
63
|
+
mode: string;
|
|
64
|
+
}>>> & Readonly<{
|
|
65
|
+
onCopy?: (() => any) | undefined;
|
|
66
|
+
}>, {
|
|
67
|
+
mode: "text" | "icon" | "unset" | "icon-button";
|
|
59
68
|
text: string;
|
|
60
|
-
value: string;
|
|
61
69
|
visible: boolean;
|
|
62
70
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
|
|
63
71
|
default?(_: {}): any;
|
package/dist/Dialog.js
CHANGED
|
@@ -28,7 +28,7 @@ const U = ["open", "aria-labelledby", "data-test"], W = ["id"], X = {
|
|
|
28
28
|
},
|
|
29
29
|
emits: ["update:open", "cancel"],
|
|
30
30
|
setup(M, { emit: E }) {
|
|
31
|
-
const t = M,
|
|
31
|
+
const t = M, h = E, b = H(), v = K(), n = L(), x = O("dialog-header-"), r = S(!1), c = S(), N = s(() => t.confirmText || (t.alert ? i("ll.okay") : i("ll.confirm"))), k = s(() => !!b.default || t.description), V = s(
|
|
32
32
|
() => t.status ? I[y(t.status)] : I.Info
|
|
33
33
|
), $ = s(
|
|
34
34
|
() => t.status ? g[y(t.status)] : g.Info
|
|
@@ -36,7 +36,7 @@ const U = ["open", "aria-labelledby", "data-test"], W = ["id"], X = {
|
|
|
36
36
|
() => t.status ? w[y(t.status)] : w.Info
|
|
37
37
|
), Z = s(() => t.dangerZone || t.status === g.Error);
|
|
38
38
|
function T() {
|
|
39
|
-
|
|
39
|
+
h("update:open", !1), h("cancel");
|
|
40
40
|
}
|
|
41
41
|
async function z(u) {
|
|
42
42
|
if (!r.value) {
|
|
@@ -97,7 +97,7 @@ const U = ["open", "aria-labelledby", "data-test"], W = ["id"], X = {
|
|
|
97
97
|
}, p(t.header), 11, W)
|
|
98
98
|
], 2),
|
|
99
99
|
k.value ? (l(), _("p", X, [
|
|
100
|
-
e(
|
|
100
|
+
e(b).default ? G(u.$slots, "default", { key: 0 }) : (l(), _("span", {
|
|
101
101
|
key: 1,
|
|
102
102
|
innerHTML: t.description
|
|
103
103
|
}, null, 8, tt))
|
|
@@ -146,7 +146,7 @@ const U = ["open", "aria-labelledby", "data-test"], W = ["id"], X = {
|
|
|
146
146
|
_: 3
|
|
147
147
|
}));
|
|
148
148
|
}
|
|
149
|
-
}), at = "
|
|
149
|
+
}), at = "_dialog_1t4hs_5", st = "_body_1t4hs_22", lt = "_grey_1t4hs_35", nt = "_content_1t4hs_45", rt = "_footer_1t4hs_50", dt = {
|
|
150
150
|
dialog: at,
|
|
151
151
|
body: st,
|
|
152
152
|
grey: lt,
|
|
@@ -154,8 +154,8 @@ const U = ["open", "aria-labelledby", "data-test"], W = ["id"], X = {
|
|
|
154
154
|
footer: rt
|
|
155
155
|
}, it = {
|
|
156
156
|
$style: dt
|
|
157
|
-
},
|
|
157
|
+
}, bt = /* @__PURE__ */ R(ot, [["__cssModules", it]]);
|
|
158
158
|
export {
|
|
159
|
-
|
|
159
|
+
bt as default
|
|
160
160
|
};
|
|
161
161
|
//# sourceMappingURL=Dialog.js.map
|
package/dist/Dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":["../src/components/Dialog/Dialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import capitalize from 'lodash-es/capitalize';\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, nextTick, ref, useAttrs, useCssModule, useSlots, watchEffect } from 'vue';\n\n import {\n StatusColor,\n StatusColors,\n StatusIcon,\n StatusIcons,\n StatusSeverities,\n StatusSeverity,\n } from '../../../types/statusLevels';\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n\n export interface DialogProps {\n /**\n * Shows or hides the dialog.\n * Usage: v-model:open=\"isOpen\"\n */\n open?: boolean;\n\n /**\n * Whether the confirmation button is enabled or not.\n */\n disabled?: boolean;\n\n /**\n * Is this a dangerous action? Will turn the confirmation button red.\n */\n dangerZone?: boolean;\n\n /**\n * Header text.\n */\n header?: string;\n\n /**\n * Description text.\n */\n description?: string;\n\n /**\n * Cancel button text.\n */\n cancelText?: string;\n\n /**\n * Confirm button text.\n */\n confirmText?: string;\n\n /**\n * Callback function when the confirm button is clicked.\n */\n onConfirm?: (event: Event) => Promise<void> | void;\n\n /**\n * Treats it like an Alert Dialog, with only the confirmation button showing.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/alert}\n */\n alert?: boolean;\n\n /**\n * Adds a top accent border and icon next to the header.\n * This behaves similarly to the Alert component in respect to the levels, icons, and colors\n * passing `error` will treat the dialog the same as `dangerZone`\n */\n status?: StatusSeverity;\n }\n\n const props = withDefaults(defineProps<DialogProps>(), {\n open: false,\n disabled: false,\n dangerZone: false,\n header: t('ll.areYouSure'),\n description: '',\n cancelText: t('ll.cancel'),\n confirmText: '',\n onConfirm: () => undefined,\n alert: false,\n status: undefined,\n });\n\n defineOptions({\n name: 'll-dialog',\n inheritAttrs: false,\n });\n\n const emits = defineEmits<{\n (e: 'update:open', value: boolean): void;\n (e: 'cancel'): void;\n }>();\n\n const slots = useSlots();\n const attrs = useAttrs();\n const classes = useCssModule();\n const headerId = uniqueId('dialog-header-');\n\n const isConfirming = ref(false);\n const root = ref();\n\n // Set the default confirm button text to \"Confirm\".\n // If the `alert` prop is true, the default text is \"Okay\".\n // If the `confirmText` prop is provided, `confirmText` is used whether the alert prop is true.\n const modifiedConfirmText = computed(() => props.confirmText || (props.alert ? t('ll.okay') : t('ll.confirm')));\n\n const hasDescription = computed(() => !!slots.default || props.description);\n\n const statusIcon = computed<StatusIcon>(() =>\n props.status ? StatusIcons[capitalize(props.status)] : StatusIcons.Info,\n );\n const statusTitle = computed<StatusSeverity>(() =>\n props.status ? StatusSeverities[capitalize(props.status)] : StatusSeverities.Info,\n );\n const statusColor = computed<StatusColor>(() =>\n props.status ? StatusColors[capitalize(props.status)] : StatusColors.Info,\n );\n\n const computedDangerZone = computed(() => props.dangerZone || props.status === StatusSeverities.Error);\n\n function cancel() {\n emits('update:open', false);\n emits('cancel');\n }\n\n async function handleConfirm(event: Event) {\n if (isConfirming.value) {\n return;\n }\n\n isConfirming.value = true;\n\n try {\n await props.onConfirm(event);\n } finally {\n isConfirming.value = false;\n }\n }\n\n watchEffect(() => {\n if (props.open && root.value) {\n // Move focus to confirm button\n nextTick(function () {\n root.value.focus();\n });\n }\n });\n</script>\n\n<template>\n <transition name=\"fade\">\n <dialog\n v-if=\"props.open\"\n ref=\"root\"\n :open=\"props.open\"\n tabindex=\"0\"\n :aria-labelledby=\"headerId\"\n aria-modal=\"true\"\n class=\"stash-dialog\"\n :class=\"classes.dialog\"\n :data-test=\"attrs['data-test'] || 'll-dialog'\"\n v-bind=\"attrs\"\n @keydown.esc=\"cancel\"\n >\n <div\n class=\"stash-dialog__body\"\n :class=\"[\n classes.body,\n `border-${statusColor}`,\n {\n 'border-t-6': props.status,\n },\n ]\"\n data-test=\"stash-dialog|body\"\n >\n <div class=\"stash-dialog__body__content\" :class=\"classes.content\" data-test=\"stash-dialog|body-content\">\n <div class=\"flex items-start\" :class=\"hasDescription && 'mb-1.5'\">\n <Icon\n v-if=\"props.status\"\n data-test=\"dialog-status-icon\"\n :name=\"statusIcon\"\n :title=\"statusTitle\"\n :class=\"`text-${statusColor}`\"\n />\n <h3 :id=\"headerId\" :class=\"{ 'ml-1.5 mt-px': props.status }\">{{ props.header }}</h3>\n </div>\n\n <p v-if=\"hasDescription\" class=\"mb-0\">\n <slot v-if=\"slots.default\"></slot>\n <!-- eslint-disable-next-line vue/no-v-html -->\n <span v-else v-html=\"props.description\"></span>\n </p>\n </div>\n\n <footer class=\"stash-dialog__footer\" :class=\"classes.footer\" data-test=\"stash-dialog|footer\">\n <div class=\"text-right\">\n <div :class=\"{ 'button-grid': !props.alert }\">\n <Button v-if=\"!props.alert\" data-test=\"button|cancel\" secondary @click=\"cancel\">\n {{ props.cancelText }}\n </Button>\n\n <Button\n data-test=\"button|confirm\"\n :disabled=\"props.disabled\"\n :is-loading=\"isConfirming\"\n :color=\"computedDangerZone ? 'red' : 'blue'\"\n :class=\"{\n 'w-full': props.alert,\n }\"\n @click=\"handleConfirm\"\n >\n {{ modifiedConfirmText }}\n </Button>\n </div>\n </div>\n </footer>\n </div>\n </dialog>\n </transition>\n</template>\n\n<style module>\n @reference \"../../../styles/main.css\";\n\n @layer utilities {\n .dialog {\n background: rgb(0 0 0 / 30%);\n bottom: 0;\n display: flex;\n flex-direction: column;\n left: 0;\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n place-content: center;\n position: fixed;\n right: 0;\n top: 0;\n z-index: var(--z-index-dialog);\n width: 100%;\n height: 100vh;\n }\n\n .body {\n @apply shadow-3xl;\n\n background: var(--color-white);\n color: var(--color-ice-700);\n display: flex;\n flex-direction: column;\n margin: 0 auto;\n max-height: 100vh;\n max-width: 360px;\n transition: transform 150 var(--ease-swing);\n width: 100%;\n\n &.grey {\n background: var(--color-ice-200);\n border-radius: var(--radius-sm);\n }\n\n @media (width >= theme(--breakpoint-md)) {\n border-radius: var(--radius-sm);\n }\n }\n\n .content {\n flex-grow: 1;\n padding: --spacing(6) var(--grid-gutter);\n }\n\n .footer {\n background: var(--color-ice-200);\n border-top:
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../src/components/Dialog/Dialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import capitalize from 'lodash-es/capitalize';\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, nextTick, ref, useAttrs, useCssModule, useSlots, watchEffect } from 'vue';\n\n import {\n StatusColor,\n StatusColors,\n StatusIcon,\n StatusIcons,\n StatusSeverities,\n StatusSeverity,\n } from '../../../types/statusLevels';\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n\n export interface DialogProps {\n /**\n * Shows or hides the dialog.\n * Usage: v-model:open=\"isOpen\"\n */\n open?: boolean;\n\n /**\n * Whether the confirmation button is enabled or not.\n */\n disabled?: boolean;\n\n /**\n * Is this a dangerous action? Will turn the confirmation button red.\n */\n dangerZone?: boolean;\n\n /**\n * Header text.\n */\n header?: string;\n\n /**\n * Description text.\n */\n description?: string;\n\n /**\n * Cancel button text.\n */\n cancelText?: string;\n\n /**\n * Confirm button text.\n */\n confirmText?: string;\n\n /**\n * Callback function when the confirm button is clicked.\n */\n onConfirm?: (event: Event) => Promise<void> | void;\n\n /**\n * Treats it like an Alert Dialog, with only the confirmation button showing.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/alert}\n */\n alert?: boolean;\n\n /**\n * Adds a top accent border and icon next to the header.\n * This behaves similarly to the Alert component in respect to the levels, icons, and colors\n * passing `error` will treat the dialog the same as `dangerZone`\n */\n status?: StatusSeverity;\n }\n\n const props = withDefaults(defineProps<DialogProps>(), {\n open: false,\n disabled: false,\n dangerZone: false,\n header: t('ll.areYouSure'),\n description: '',\n cancelText: t('ll.cancel'),\n confirmText: '',\n onConfirm: () => undefined,\n alert: false,\n status: undefined,\n });\n\n defineOptions({\n name: 'll-dialog',\n inheritAttrs: false,\n });\n\n const emits = defineEmits<{\n (e: 'update:open', value: boolean): void;\n (e: 'cancel'): void;\n }>();\n\n const slots = useSlots();\n const attrs = useAttrs();\n const classes = useCssModule();\n const headerId = uniqueId('dialog-header-');\n\n const isConfirming = ref(false);\n const root = ref();\n\n // Set the default confirm button text to \"Confirm\".\n // If the `alert` prop is true, the default text is \"Okay\".\n // If the `confirmText` prop is provided, `confirmText` is used whether the alert prop is true.\n const modifiedConfirmText = computed(() => props.confirmText || (props.alert ? t('ll.okay') : t('ll.confirm')));\n\n const hasDescription = computed(() => !!slots.default || props.description);\n\n const statusIcon = computed<StatusIcon>(() =>\n props.status ? StatusIcons[capitalize(props.status)] : StatusIcons.Info,\n );\n const statusTitle = computed<StatusSeverity>(() =>\n props.status ? StatusSeverities[capitalize(props.status)] : StatusSeverities.Info,\n );\n const statusColor = computed<StatusColor>(() =>\n props.status ? StatusColors[capitalize(props.status)] : StatusColors.Info,\n );\n\n const computedDangerZone = computed(() => props.dangerZone || props.status === StatusSeverities.Error);\n\n function cancel() {\n emits('update:open', false);\n emits('cancel');\n }\n\n async function handleConfirm(event: Event) {\n if (isConfirming.value) {\n return;\n }\n\n isConfirming.value = true;\n\n try {\n await props.onConfirm(event);\n } finally {\n isConfirming.value = false;\n }\n }\n\n watchEffect(() => {\n if (props.open && root.value) {\n // Move focus to confirm button\n nextTick(function () {\n root.value.focus();\n });\n }\n });\n</script>\n\n<template>\n <transition name=\"fade\">\n <dialog\n v-if=\"props.open\"\n ref=\"root\"\n :open=\"props.open\"\n tabindex=\"0\"\n :aria-labelledby=\"headerId\"\n aria-modal=\"true\"\n class=\"stash-dialog\"\n :class=\"classes.dialog\"\n :data-test=\"attrs['data-test'] || 'll-dialog'\"\n v-bind=\"attrs\"\n @keydown.esc=\"cancel\"\n >\n <div\n class=\"stash-dialog__body\"\n :class=\"[\n classes.body,\n `border-${statusColor}`,\n {\n 'border-t-6': props.status,\n },\n ]\"\n data-test=\"stash-dialog|body\"\n >\n <div class=\"stash-dialog__body__content\" :class=\"classes.content\" data-test=\"stash-dialog|body-content\">\n <div class=\"flex items-start\" :class=\"hasDescription && 'mb-1.5'\">\n <Icon\n v-if=\"props.status\"\n data-test=\"dialog-status-icon\"\n :name=\"statusIcon\"\n :title=\"statusTitle\"\n :class=\"`text-${statusColor}`\"\n />\n <h3 :id=\"headerId\" :class=\"{ 'ml-1.5 mt-px': props.status }\">{{ props.header }}</h3>\n </div>\n\n <p v-if=\"hasDescription\" class=\"mb-0\">\n <slot v-if=\"slots.default\"></slot>\n <!-- eslint-disable-next-line vue/no-v-html -->\n <span v-else v-html=\"props.description\"></span>\n </p>\n </div>\n\n <footer class=\"stash-dialog__footer\" :class=\"classes.footer\" data-test=\"stash-dialog|footer\">\n <div class=\"text-right\">\n <div :class=\"{ 'button-grid': !props.alert }\">\n <Button v-if=\"!props.alert\" data-test=\"button|cancel\" secondary @click=\"cancel\">\n {{ props.cancelText }}\n </Button>\n\n <Button\n data-test=\"button|confirm\"\n :disabled=\"props.disabled\"\n :is-loading=\"isConfirming\"\n :color=\"computedDangerZone ? 'red' : 'blue'\"\n :class=\"{\n 'w-full': props.alert,\n }\"\n @click=\"handleConfirm\"\n >\n {{ modifiedConfirmText }}\n </Button>\n </div>\n </div>\n </footer>\n </div>\n </dialog>\n </transition>\n</template>\n\n<style module>\n @reference \"../../../styles/main.css\";\n\n @layer utilities {\n .dialog {\n background: rgb(0 0 0 / 30%);\n bottom: 0;\n display: flex;\n flex-direction: column;\n left: 0;\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n place-content: center;\n position: fixed;\n right: 0;\n top: 0;\n z-index: var(--z-index-dialog);\n width: 100%;\n height: 100vh;\n }\n\n .body {\n @apply shadow-3xl;\n\n background: var(--color-white);\n color: var(--color-ice-700);\n display: flex;\n flex-direction: column;\n margin: 0 auto;\n max-height: 100vh;\n max-width: 360px;\n transition: transform 150 var(--ease-swing);\n width: 100%;\n\n &.grey {\n background: var(--color-ice-200);\n border-radius: var(--radius-sm);\n }\n\n @media (width >= theme(--breakpoint-md)) {\n border-radius: var(--radius-sm);\n }\n }\n\n .content {\n flex-grow: 1;\n padding: --spacing(6) var(--grid-gutter);\n }\n\n .footer {\n background: var(--color-ice-200);\n border-top: 1px solid var(--color-ice-500);\n display: initial; /* TEMP. Will need to fix marketplace `footer` style */\n padding: --spacing(6) var(--grid-gutter);\n\n @media (width >= theme(--breakpoint-md)) {\n border-bottom-left-radius: var(--radius-sm);\n border-bottom-right-radius: var(--radius-sm);\n }\n }\n\n :global(.fade-enter-from),\n :global(.fade-leave-active) {\n .body {\n transform: translate3d(0, --spacing(3), 0);\n }\n }\n }\n</style>\n"],"names":["props","__props","emits","__emit","slots","useSlots","attrs","useAttrs","classes","useCssModule","headerId","uniqueId","isConfirming","ref","root","modifiedConfirmText","computed","t","hasDescription","statusIcon","StatusIcons","capitalize","statusTitle","StatusSeverities","statusColor","StatusColors","computedDangerZone","cancel","handleConfirm","event","watchEffect","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EE,UAAMA,IAAQC,GAkBRC,IAAQC,GAKRC,IAAQC,EAAA,GACRC,IAAQC,EAAA,GACRC,IAAUC,EAAA,GACVC,IAAWC,EAAS,gBAAgB,GAEpCC,IAAeC,EAAI,EAAK,GACxBC,IAAOD,EAAA,GAKPE,IAAsBC,EAAS,MAAMhB,EAAM,gBAAgBA,EAAM,QAAQiB,EAAE,SAAS,IAAIA,EAAE,YAAY,EAAE,GAExGC,IAAiBF,EAAS,MAAM,CAAC,CAACZ,EAAM,WAAWJ,EAAM,WAAW,GAEpEmB,IAAaH;AAAA,MAAqB,MACtChB,EAAM,SAASoB,EAAYC,EAAWrB,EAAM,MAAM,CAAC,IAAIoB,EAAY;AAAA,IAAA,GAE/DE,IAAcN;AAAA,MAAyB,MAC3ChB,EAAM,SAASuB,EAAiBF,EAAWrB,EAAM,MAAM,CAAC,IAAIuB,EAAiB;AAAA,IAAA,GAEzEC,IAAcR;AAAA,MAAsB,MACxChB,EAAM,SAASyB,EAAaJ,EAAWrB,EAAM,MAAM,CAAC,IAAIyB,EAAa;AAAA,IAAA,GAGjEC,IAAqBV,EAAS,MAAMhB,EAAM,cAAcA,EAAM,WAAWuB,EAAiB,KAAK;AAErG,aAASI,IAAS;AAChB,MAAAzB,EAAM,eAAe,EAAK,GAC1BA,EAAM,QAAQ;AAAA,IAChB;AAEA,mBAAe0B,EAAcC,GAAc;AACzC,UAAI,CAAAjB,EAAa,OAIjB;AAAA,QAAAA,EAAa,QAAQ;AAErB,YAAI;AACF,gBAAMZ,EAAM,UAAU6B,CAAK;AAAA,QAC7B,UAAA;AACE,UAAAjB,EAAa,QAAQ;AAAA,QACvB;AAAA;AAAA,IACF;AAEA,WAAAkB,EAAY,MAAM;AAChB,MAAI9B,EAAM,QAAQc,EAAK,SAErBiB,EAAS,WAAY;AACnB,QAAAjB,EAAK,MAAM,MAAA;AAAA,MACb,CAAC;AAAA,IAEL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/FileUpload.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as q, useCssModule as K, ref as U, inject as Q, useAttrs as W, computed as g, createElementBlock as r, openBlock as n, normalizeClass as c, unref as l, withDirectives as Z, createVNode as E, withModifiers as p, withCtx as S, renderSlot as x, createTextVNode as N, toDisplayString as u, createElementVNode as v, createCommentVNode as k, Fragment as j, createBlock as ee, renderList as te, mergeProps as le, vShow as se } from "vue";
|
|
2
2
|
import ne from "@leaflink/snitch";
|
|
3
3
|
import { I as oe } from "./index-D6bxWkZ1.js";
|
|
4
4
|
import { t as f } from "./locale.js";
|
|
5
|
-
import
|
|
5
|
+
import F from "./Button.js";
|
|
6
6
|
import ae from "./Icon.js";
|
|
7
7
|
import { _ as ie } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
8
|
-
const
|
|
8
|
+
const w = {
|
|
9
9
|
CSV: {
|
|
10
10
|
EXTENSION: ["csv"],
|
|
11
11
|
MIME_TYPES: ["text/csv", "application/octet-stream", "application/vnd.ms-excel"],
|
|
@@ -41,7 +41,7 @@ var h = /* @__PURE__ */ ((m) => (m.Dense = "dense", m.Standard = "standard", m))
|
|
|
41
41
|
const re = { key: 0 }, de = { class: "text-ice-900" }, ce = {
|
|
42
42
|
key: 0,
|
|
43
43
|
class: "mt-6 text-center text-xs text-ice-700"
|
|
44
|
-
}, pe = ["disabled", "accept", "multiple"], ue = /* @__PURE__ */
|
|
44
|
+
}, pe = ["disabled", "accept", "multiple"], ue = /* @__PURE__ */ q({
|
|
45
45
|
__name: "FileUpload",
|
|
46
46
|
props: {
|
|
47
47
|
files: { default: () => [] },
|
|
@@ -52,22 +52,22 @@ const re = { key: 0 }, de = { class: "text-ice-900" }, ce = {
|
|
|
52
52
|
size: { default: "standard" }
|
|
53
53
|
},
|
|
54
54
|
emits: ["file-select", "file-delete", "file-error"],
|
|
55
|
-
setup(m, { emit:
|
|
56
|
-
const o = m, d = K(), _ =
|
|
57
|
-
const e = { ...
|
|
55
|
+
setup(m, { emit: R }) {
|
|
56
|
+
const o = m, d = K(), _ = R, y = U(!1), T = U(), b = Q("stashOptions"), M = W(), A = g(() => {
|
|
57
|
+
const e = { ...M };
|
|
58
58
|
return delete e["data-test"], delete e.class, delete e.type, delete e.accept, e;
|
|
59
59
|
});
|
|
60
60
|
function D(e, t) {
|
|
61
61
|
return e.concat(t);
|
|
62
62
|
}
|
|
63
|
-
const I = g(() => o.fileTypes.map((e) =>
|
|
63
|
+
const I = g(() => o.fileTypes.map((e) => w[e].MIME_TYPES).reduce(D)), O = g(() => o.fileTypes.map((e) => w[e].EXTENSION).reduce(D)), X = g(() => `${b == null ? void 0 : b.staticPath}/illustrations/FileUpload/${w[o.fileTypes[0]].ILLUSTRATION}.svg`);
|
|
64
64
|
function L() {
|
|
65
65
|
T.value && (T.value.value = "", T.value.click());
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function Y() {
|
|
68
68
|
y.value = !0;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function $() {
|
|
71
71
|
y.value = !1;
|
|
72
72
|
}
|
|
73
73
|
function B(e) {
|
|
@@ -76,9 +76,9 @@ const re = { key: 0 }, de = { class: "text-ice-900" }, ce = {
|
|
|
76
76
|
});
|
|
77
77
|
_("file-error", t), ne.log(e);
|
|
78
78
|
}
|
|
79
|
-
async function
|
|
79
|
+
async function V(e) {
|
|
80
80
|
if (!I.value.length) return !0;
|
|
81
|
-
const t = await Promise.all(e.map((i) =>
|
|
81
|
+
const t = await Promise.all(e.map((i) => H(i)));
|
|
82
82
|
if (!(!!t.length && t.every((i) => I.value.includes(i))))
|
|
83
83
|
throw new Error("One or more files contains an unacceptable mime type.");
|
|
84
84
|
if (!e.every((i) => {
|
|
@@ -90,27 +90,27 @@ const re = { key: 0 }, de = { class: "text-ice-900" }, ce = {
|
|
|
90
90
|
}
|
|
91
91
|
async function P(e) {
|
|
92
92
|
try {
|
|
93
|
-
await
|
|
93
|
+
await V(e), _("file-select", { files: e });
|
|
94
94
|
} catch (t) {
|
|
95
95
|
B(t);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function z(e) {
|
|
99
99
|
var s;
|
|
100
100
|
const t = [...((s = e.target) == null ? void 0 : s.files) || []];
|
|
101
101
|
P(t);
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function G(e) {
|
|
104
104
|
var s;
|
|
105
105
|
if (o.disabled)
|
|
106
106
|
return;
|
|
107
107
|
const t = [...((s = e.dataTransfer) == null ? void 0 : s.files) || []];
|
|
108
108
|
return y.value = !1, P(t);
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function J(e) {
|
|
111
111
|
_("file-delete", e);
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function H(e) {
|
|
114
114
|
return new Promise((t, s) => {
|
|
115
115
|
if (e.type)
|
|
116
116
|
return t(e.type);
|
|
@@ -125,19 +125,19 @@ const re = { key: 0 }, de = { class: "text-ice-900" }, ce = {
|
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
return (e, t) => (n(), r("div", {
|
|
128
|
-
class: c(["stash-file-upload", l(
|
|
128
|
+
class: c(["stash-file-upload", l(M).class]),
|
|
129
129
|
"data-test": "stash-file-upload"
|
|
130
130
|
}, [
|
|
131
131
|
e.buttonOnly ? (n(), r("div", re, [
|
|
132
|
-
E(
|
|
132
|
+
E(F, {
|
|
133
133
|
secondary: "",
|
|
134
134
|
type: "button",
|
|
135
135
|
disabled: o.disabled,
|
|
136
136
|
onClick: p(L, ["stop", "prevent"])
|
|
137
137
|
}, {
|
|
138
138
|
default: S(() => [
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
x(e.$slots, "submitText", {}, () => [
|
|
140
|
+
N(u(l(f)("ll.fileUpload.uploadFile")), 1)
|
|
141
141
|
])
|
|
142
142
|
]),
|
|
143
143
|
_: 3
|
|
@@ -151,31 +151,31 @@ const re = { key: 0 }, de = { class: "text-ice-900" }, ce = {
|
|
|
151
151
|
[l(d)["is-disabled"]]: o.disabled
|
|
152
152
|
}
|
|
153
153
|
]]),
|
|
154
|
-
onDragover: p(
|
|
155
|
-
onDrop: p(
|
|
156
|
-
onDragleave: p(
|
|
154
|
+
onDragover: p(Y, ["prevent"]),
|
|
155
|
+
onDrop: p(G, ["prevent"]),
|
|
156
|
+
onDragleave: p($, ["prevent"])
|
|
157
157
|
}, [
|
|
158
158
|
v("div", {
|
|
159
159
|
class: c(["flex flex-col items-center justify-center text-center", [{ "items-center md:flex-row": e.size === l(h).Dense }]])
|
|
160
160
|
}, [
|
|
161
|
-
e.files.length ? (n(!0), r(
|
|
161
|
+
e.files.length ? (n(!0), r(j, { key: 1 }, te(e.files, (s) => (n(), r("div", {
|
|
162
162
|
key: s.name
|
|
163
163
|
}, [
|
|
164
164
|
E(ae, { name: "file" }),
|
|
165
165
|
v("span", null, u(s.name), 1),
|
|
166
|
-
E(
|
|
166
|
+
E(F, {
|
|
167
167
|
class: c([l(d)["remove-button"], l(d).button]),
|
|
168
|
-
onClick: p((a) =>
|
|
168
|
+
onClick: p((a) => J(s), ["stop", "prevent"])
|
|
169
169
|
}, {
|
|
170
170
|
default: S(() => [
|
|
171
|
-
|
|
171
|
+
N(u(l(f)("ll.fileUpload.remove")), 1)
|
|
172
172
|
]),
|
|
173
173
|
_: 2
|
|
174
174
|
}, 1032, ["class", "onClick"])
|
|
175
|
-
]))), 128)) : (n(), r(
|
|
175
|
+
]))), 128)) : (n(), r(j, { key: 0 }, [
|
|
176
176
|
e.size !== l(h).Dense ? (n(), ee(l(oe), {
|
|
177
177
|
key: 0,
|
|
178
|
-
src:
|
|
178
|
+
src: X.value,
|
|
179
179
|
name: "file",
|
|
180
180
|
width: "84",
|
|
181
181
|
height: "96"
|
|
@@ -184,7 +184,7 @@ const re = { key: 0 }, de = { class: "text-ice-900" }, ce = {
|
|
|
184
184
|
v("span", {
|
|
185
185
|
class: c(e.size === l(h).Dense ? "md:ml-1.5 md:mr-3 md:my-0 my-1.5 text-ice-900" : "mt-1.5 my-1.5")
|
|
186
186
|
}, u(l(f)("ll.fileUpload.or")), 3),
|
|
187
|
-
E(
|
|
187
|
+
E(F, {
|
|
188
188
|
class: c(["mt-1.5", l(d)["file-select-button"]]),
|
|
189
189
|
secondary: "",
|
|
190
190
|
type: "button",
|
|
@@ -192,8 +192,8 @@ const re = { key: 0 }, de = { class: "text-ice-900" }, ce = {
|
|
|
192
192
|
onClick: p(L, ["stop", "prevent"])
|
|
193
193
|
}, {
|
|
194
194
|
default: S(() => [
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
x(e.$slots, "submitText", {}, () => [
|
|
196
|
+
N(u(l(f)("ll.fileUpload.uploadFile")), 1)
|
|
197
197
|
])
|
|
198
198
|
]),
|
|
199
199
|
_: 3
|
|
@@ -201,10 +201,10 @@ const re = { key: 0 }, de = { class: "text-ice-900" }, ce = {
|
|
|
201
201
|
], 64))
|
|
202
202
|
], 2),
|
|
203
203
|
e.$slots.hint && !e.files.length ? (n(), r("div", ce, [
|
|
204
|
-
|
|
204
|
+
x(e.$slots, "hint")
|
|
205
205
|
])) : k("", !0)
|
|
206
206
|
], 34)),
|
|
207
|
-
Z(v("input", le(
|
|
207
|
+
Z(v("input", le(A.value, {
|
|
208
208
|
ref_key: "fileUploadRef",
|
|
209
209
|
ref: T,
|
|
210
210
|
"data-test": "stash-file-upload|input",
|
|
@@ -212,24 +212,24 @@ const re = { key: 0 }, de = { class: "text-ice-900" }, ce = {
|
|
|
212
212
|
disabled: e.disabled,
|
|
213
213
|
accept: I.value.join(","),
|
|
214
214
|
multiple: o.multiple,
|
|
215
|
-
onChange:
|
|
215
|
+
onChange: z
|
|
216
216
|
}), null, 16, pe), [
|
|
217
217
|
[se, !1]
|
|
218
218
|
])
|
|
219
219
|
], 2));
|
|
220
220
|
}
|
|
221
|
-
}), fe = "
|
|
222
|
-
"file-dropbox": "_file-
|
|
223
|
-
"is-dragging": "_is-
|
|
224
|
-
"is-disabled": "_is-
|
|
225
|
-
"upload-icon": "_upload-
|
|
226
|
-
"remove-button": "_remove-
|
|
221
|
+
}), fe = "_button_e6txj_30", me = {
|
|
222
|
+
"file-dropbox": "_file-dropbox_e6txj_3",
|
|
223
|
+
"is-dragging": "_is-dragging_e6txj_11",
|
|
224
|
+
"is-disabled": "_is-disabled_e6txj_20",
|
|
225
|
+
"upload-icon": "_upload-icon_e6txj_25",
|
|
226
|
+
"remove-button": "_remove-button_e6txj_30",
|
|
227
227
|
button: fe
|
|
228
228
|
}, ve = {
|
|
229
229
|
$style: me
|
|
230
230
|
}, Ie = /* @__PURE__ */ ie(ue, [["__cssModules", ve]]);
|
|
231
231
|
export {
|
|
232
|
-
|
|
232
|
+
w as FILE_TYPES,
|
|
233
233
|
h as FileUploadSizes,
|
|
234
234
|
Ie as default
|
|
235
235
|
};
|