@leaflink/stash 50.0.5 → 50.0.7
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/CurrencyInput.js +55 -50
- package/dist/CurrencyInput.js.map +1 -1
- package/dist/CurrencyInput.vue.d.ts +31 -6
- package/dist/DatePicker.js +7 -7
- package/dist/DatePicker.js.map +1 -1
- package/dist/Field.js +1 -1
- package/dist/Field.vue.d.ts +11 -0
- package/dist/Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js +88 -0
- package/dist/Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js.map +1 -0
- package/dist/FilterSelect.js +67 -56
- package/dist/FilterSelect.js.map +1 -1
- package/dist/FilterSelect.vue.d.ts +54 -2
- package/dist/Filters.vue.d.ts +162 -96
- package/dist/Input.js +97 -91
- package/dist/Input.js.map +1 -1
- package/dist/Input.vue.d.ts +31 -21
- package/dist/InputOptions.js +83 -62
- package/dist/InputOptions.js.map +1 -1
- package/dist/InputOptions.vue.d.ts +49 -16
- package/dist/ListView.vue.d.ts +231 -134
- package/dist/RadioGroup.js +67 -70
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioGroup.vue.d.ts +54 -45
- package/dist/Select.js +350 -336
- package/dist/Select.js.map +1 -1
- package/dist/Select.vue.d.ts +54 -47
- package/dist/TextEditor.js +671 -684
- package/dist/TextEditor.js.map +1 -1
- package/dist/TextEditor.vue.d.ts +54 -61
- package/dist/Textarea.js +65 -59
- package/dist/Textarea.js.map +1 -1
- package/dist/Textarea.vue.d.ts +50 -32
- package/dist/components.css +2 -2
- package/package.json +1 -1
- package/styles/backwards-compat.css +3 -3
- package/dist/Field.vue_vue_type_script_setup_true_lang-DjxUvSRF.js +0 -95
- package/dist/Field.vue_vue_type_script_setup_true_lang-DjxUvSRF.js.map +0 -1
package/dist/Field.js
CHANGED
package/dist/Field.vue.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ isRequired: boolean;
|
|
|
42
42
|
label: undefined;
|
|
43
43
|
showOptionalInLabel: boolean;
|
|
44
44
|
fieldset: boolean;
|
|
45
|
+
isDisabled: boolean;
|
|
45
46
|
disabled: boolean;
|
|
46
47
|
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FieldProps>, {
|
|
47
48
|
addBottomSpace: boolean;
|
|
@@ -53,6 +54,7 @@ isRequired: boolean;
|
|
|
53
54
|
label: undefined;
|
|
54
55
|
showOptionalInLabel: boolean;
|
|
55
56
|
fieldset: boolean;
|
|
57
|
+
isDisabled: boolean;
|
|
56
58
|
disabled: boolean;
|
|
57
59
|
}>>> & Readonly<{}>, {
|
|
58
60
|
disabled: boolean;
|
|
@@ -60,6 +62,7 @@ fieldset: boolean;
|
|
|
60
62
|
label: string;
|
|
61
63
|
id: string;
|
|
62
64
|
isRequired: boolean;
|
|
65
|
+
isDisabled: boolean;
|
|
63
66
|
addBottomSpace: boolean;
|
|
64
67
|
errorText: string;
|
|
65
68
|
hintText: string;
|
|
@@ -71,6 +74,8 @@ showOptionalInLabel: boolean;
|
|
|
71
74
|
fieldErrorId: string;
|
|
72
75
|
hasError: boolean;
|
|
73
76
|
isRequired: boolean;
|
|
77
|
+
isReadOnly: boolean;
|
|
78
|
+
disabled: boolean;
|
|
74
79
|
labelId: string;
|
|
75
80
|
showOptionalInLabel: boolean;
|
|
76
81
|
}): any;
|
|
@@ -122,6 +127,12 @@ export declare interface FieldProps {
|
|
|
122
127
|
/**
|
|
123
128
|
* Indicates whether the field is disabled.
|
|
124
129
|
*/
|
|
130
|
+
isDisabled?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Indicates whether the field is disabled.
|
|
133
|
+
*
|
|
134
|
+
* @deprecated Use `isDisabled` instead.
|
|
135
|
+
*/
|
|
125
136
|
disabled?: boolean;
|
|
126
137
|
}
|
|
127
138
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { defineComponent as B, useAttrs as I, useSlots as T, computed as t, openBlock as a, createBlock as c, resolveDynamicComponent as R, mergeProps as O, unref as i, withCtx as b, createTextVNode as k, toDisplayString as o, createCommentVNode as m, renderSlot as w, createElementBlock as r } from "vue";
|
|
2
|
+
import n from "lodash-es/uniqueId";
|
|
3
|
+
import { _ as q } from "./Label.vue_vue_type_script_setup_true_lang-C4JKdqvC.js";
|
|
4
|
+
const D = ["id"], E = {
|
|
5
|
+
key: 2,
|
|
6
|
+
class: "stash-field-hint tw-mt-1 tw-block tw-whitespace-pre-line tw-text-xs",
|
|
7
|
+
"data-test": "stash-field-hint"
|
|
8
|
+
}, S = {
|
|
9
|
+
key: 3,
|
|
10
|
+
class: "stash-field-hint tw-mt-1 tw-whitespace-pre-line tw-text-xs",
|
|
11
|
+
"data-test": "stash-field-hint"
|
|
12
|
+
}, L = /* @__PURE__ */ B({
|
|
13
|
+
inheritAttrs: !1,
|
|
14
|
+
__name: "Field",
|
|
15
|
+
props: {
|
|
16
|
+
addBottomSpace: { type: Boolean, default: !1 },
|
|
17
|
+
errorText: { default: void 0 },
|
|
18
|
+
hintText: { default: void 0 },
|
|
19
|
+
id: { default: void 0 },
|
|
20
|
+
errorId: { default: void 0 },
|
|
21
|
+
isReadOnly: { type: Boolean },
|
|
22
|
+
isRequired: { type: Boolean, default: !1 },
|
|
23
|
+
label: { default: void 0 },
|
|
24
|
+
showOptionalInLabel: { type: Boolean, default: !1 },
|
|
25
|
+
fieldset: { type: Boolean, default: !1 },
|
|
26
|
+
isDisabled: { type: Boolean, default: !1 },
|
|
27
|
+
disabled: { type: Boolean, default: !1 }
|
|
28
|
+
},
|
|
29
|
+
setup(y) {
|
|
30
|
+
const e = y, v = I(), l = T(), f = t(() => e.id || n("stash-field-")), h = t(() => e.errorId || n("stash-field-error-")), u = t(() => n("stash-field-label-")), d = t(() => !!e.errorText), x = t(() => e.fieldset ? "fieldset" : "div"), _ = t(() => {
|
|
31
|
+
const { placeholder: s, ...p } = v;
|
|
32
|
+
return p;
|
|
33
|
+
});
|
|
34
|
+
return (s, p) => (a(), c(R(x.value), O({
|
|
35
|
+
"data-test": "stash-field",
|
|
36
|
+
class: ["stash-field", [
|
|
37
|
+
{ "tw-p-0": e.fieldset },
|
|
38
|
+
{ "tw-mb-9": e.addBottomSpace && !e.errorText && !e.hintText && !i(l).hint },
|
|
39
|
+
{ "tw-mb-4": e.addBottomSpace && (e.errorText || e.hintText || i(l).hint) },
|
|
40
|
+
{ "stash-field--disabled": e.isDisabled || e.disabled },
|
|
41
|
+
{ "stash-field--is-read-only": e.isReadOnly },
|
|
42
|
+
{ "stash-field--is-required": e.isRequired },
|
|
43
|
+
{ "stash-field--has-error": d.value }
|
|
44
|
+
]]
|
|
45
|
+
}, _.value), {
|
|
46
|
+
default: b(() => [
|
|
47
|
+
e.label ? (a(), c(q, {
|
|
48
|
+
key: 0,
|
|
49
|
+
id: u.value,
|
|
50
|
+
for: f.value,
|
|
51
|
+
"has-error": d.value,
|
|
52
|
+
"is-required": s.isRequired,
|
|
53
|
+
"show-optional": e.showOptionalInLabel,
|
|
54
|
+
legend: e.fieldset,
|
|
55
|
+
disabled: e.isDisabled || e.disabled
|
|
56
|
+
}, {
|
|
57
|
+
default: b(() => [
|
|
58
|
+
k(o(e.label), 1)
|
|
59
|
+
]),
|
|
60
|
+
_: 1
|
|
61
|
+
}, 8, ["id", "for", "has-error", "is-required", "show-optional", "legend", "disabled"])) : m("", !0),
|
|
62
|
+
w(s.$slots, "default", {
|
|
63
|
+
fieldId: f.value,
|
|
64
|
+
fieldErrorId: h.value,
|
|
65
|
+
hasError: d.value,
|
|
66
|
+
isRequired: s.isRequired,
|
|
67
|
+
isReadOnly: e.isReadOnly,
|
|
68
|
+
disabled: e.isDisabled || e.disabled,
|
|
69
|
+
labelId: u.value,
|
|
70
|
+
showOptionalInLabel: e.showOptionalInLabel
|
|
71
|
+
}),
|
|
72
|
+
e.errorText ? (a(), r("span", {
|
|
73
|
+
key: 1,
|
|
74
|
+
id: h.value,
|
|
75
|
+
class: "stash-field-error tw-mt-1 tw-block tw-whitespace-pre-line tw-text-xs tw-text-red-500",
|
|
76
|
+
"data-test": "stash-field-error"
|
|
77
|
+
}, o(e.errorText), 9, D)) : e.hintText && !e.isReadOnly ? (a(), r("span", E, o(e.hintText), 1)) : i(l).hint && !e.isReadOnly ? (a(), r("div", S, [
|
|
78
|
+
w(s.$slots, "hint")
|
|
79
|
+
])) : m("", !0)
|
|
80
|
+
]),
|
|
81
|
+
_: 3
|
|
82
|
+
}, 16, ["class"]));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
export {
|
|
86
|
+
L as _
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js","sources":["../src/components/Field/Field.vue"],"sourcesContent":["<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 export interface FieldProps {\n /**\n * Adds spacing under the field that is consistent whether 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 * ID for the error text element; useful for aria-errormessage\n */\n errorId?: string;\n\n /**\n * Whether it's a readonly field.\n */\n isReadOnly?: boolean;\n\n /**\n * Whether the field is required.\n */\n isRequired?: boolean;\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 * Indicates wheter the field is a fieldset or not\n */\n fieldset?: boolean;\n\n /**\n * Indicates whether the field is disabled.\n */\n isDisabled?: boolean;\n\n /**\n * Indicates whether the field is disabled.\n *\n * @deprecated Use `isDisabled` instead.\n */\n disabled?: boolean;\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EE,UAAMA,IAAQC,GAaRC,IAAQC,KACRC,IAAQC,KACRC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/FilterSelect.js
CHANGED
|
@@ -1,116 +1,127 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { t as
|
|
3
|
-
import { _ as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as S, computed as m, openBlock as r, createBlock as $, mergeProps as C, withCtx as d, createElementVNode as s, createElementBlock as u, withDirectives as f, vModelCheckbox as v, createVNode as y, withKeys as h, createTextVNode as _, toDisplayString as x, unref as A, createCommentVNode as E, Fragment as K, renderList as N } from "vue";
|
|
2
|
+
import { t as O } from "./locale.js";
|
|
3
|
+
import { _ as D } from "./Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js";
|
|
4
|
+
import b from "./FilterChip.js";
|
|
5
|
+
const F = { class: "tw-flex tw-flex-wrap tw-gap-1.5" }, I = ["id"], T = ["for"], L = ["id", "value"], R = ["for"], j = /* @__PURE__ */ S({
|
|
6
6
|
__name: "FilterSelect",
|
|
7
7
|
props: {
|
|
8
8
|
name: {},
|
|
9
|
-
label: {},
|
|
10
9
|
options: {},
|
|
11
10
|
modelValue: {},
|
|
12
|
-
canSelectAll: { type: Boolean, default: !1 }
|
|
11
|
+
canSelectAll: { type: Boolean, default: !1 },
|
|
12
|
+
addBottomSpace: { type: Boolean },
|
|
13
|
+
errorText: {},
|
|
14
|
+
hintText: {},
|
|
15
|
+
id: {},
|
|
16
|
+
errorId: {},
|
|
17
|
+
isReadOnly: { type: Boolean },
|
|
18
|
+
isRequired: { type: Boolean },
|
|
19
|
+
label: {},
|
|
20
|
+
showOptionalInLabel: { type: Boolean },
|
|
21
|
+
fieldset: { type: Boolean },
|
|
22
|
+
isDisabled: { type: Boolean },
|
|
23
|
+
disabled: { type: Boolean }
|
|
13
24
|
},
|
|
14
25
|
emits: ["update:modelValue"],
|
|
15
|
-
setup(
|
|
16
|
-
const e =
|
|
26
|
+
setup(B, { emit: V }) {
|
|
27
|
+
const e = B, c = V, o = m({
|
|
17
28
|
get() {
|
|
18
29
|
return e.modelValue;
|
|
19
30
|
},
|
|
20
|
-
set(
|
|
21
|
-
c("update:modelValue",
|
|
31
|
+
set(t) {
|
|
32
|
+
c("update:modelValue", t);
|
|
22
33
|
}
|
|
23
|
-
}),
|
|
34
|
+
}), n = m({
|
|
24
35
|
get() {
|
|
25
36
|
return e.options.length === e.modelValue.length;
|
|
26
37
|
},
|
|
27
|
-
set(
|
|
28
|
-
c("update:modelValue",
|
|
38
|
+
set(t) {
|
|
39
|
+
c("update:modelValue", t ? e.options.map((a) => a.value) : []);
|
|
29
40
|
}
|
|
30
41
|
});
|
|
31
|
-
function
|
|
32
|
-
return `${e.name}--${
|
|
42
|
+
function i(t) {
|
|
43
|
+
return `${e.name}--${t.value}`;
|
|
33
44
|
}
|
|
34
|
-
function
|
|
35
|
-
return e.modelValue.includes(
|
|
45
|
+
function g(t) {
|
|
46
|
+
return e.modelValue.includes(t.value);
|
|
36
47
|
}
|
|
37
|
-
function
|
|
38
|
-
const a =
|
|
39
|
-
a.length ===
|
|
48
|
+
function w(t) {
|
|
49
|
+
const a = o.value.filter((l) => l !== t);
|
|
50
|
+
a.length === o.value.length && a.push(t), o.value = a;
|
|
40
51
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
52
|
+
function k() {
|
|
53
|
+
n.value = !n.value;
|
|
43
54
|
}
|
|
44
|
-
return (
|
|
55
|
+
return (t, a) => (r(), $(D, C(e, {
|
|
45
56
|
class: "stash-filter-select",
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, {
|
|
49
|
-
default:
|
|
50
|
-
s("div",
|
|
51
|
-
e.canSelectAll ? (
|
|
57
|
+
"data-test": "stash-filter-select",
|
|
58
|
+
fieldset: ""
|
|
59
|
+
}), {
|
|
60
|
+
default: d(() => [
|
|
61
|
+
s("div", F, [
|
|
62
|
+
e.canSelectAll ? (r(), u("div", {
|
|
52
63
|
key: `${e.name}--all`
|
|
53
64
|
}, [
|
|
54
65
|
f(s("input", {
|
|
55
66
|
id: `${e.name}--all`,
|
|
56
|
-
"onUpdate:modelValue": a[0] || (a[0] = (
|
|
67
|
+
"onUpdate:modelValue": a[0] || (a[0] = (l) => n.value = l),
|
|
57
68
|
class: "tw-sr-only",
|
|
58
69
|
tabindex: "-1",
|
|
59
70
|
type: "checkbox",
|
|
60
71
|
value: "all"
|
|
61
|
-
}, null, 8,
|
|
62
|
-
[v,
|
|
72
|
+
}, null, 8, I), [
|
|
73
|
+
[v, n.value]
|
|
63
74
|
]),
|
|
64
75
|
s("label", {
|
|
65
76
|
for: `${e.name}--all`
|
|
66
77
|
}, [
|
|
67
|
-
|
|
68
|
-
"is-selected":
|
|
78
|
+
y(b, {
|
|
79
|
+
"is-selected": n.value,
|
|
69
80
|
tabindex: "0",
|
|
70
|
-
onKeypress: h(
|
|
81
|
+
onKeypress: h(k, ["enter"])
|
|
71
82
|
}, {
|
|
72
|
-
default:
|
|
73
|
-
|
|
83
|
+
default: d(() => [
|
|
84
|
+
_(x(A(O)("ll.all")), 1)
|
|
74
85
|
]),
|
|
75
86
|
_: 1
|
|
76
87
|
}, 8, ["is-selected"])
|
|
77
|
-
], 8,
|
|
78
|
-
])) :
|
|
79
|
-
(
|
|
80
|
-
key:
|
|
88
|
+
], 8, T)
|
|
89
|
+
])) : E("", !0),
|
|
90
|
+
(r(!0), u(K, null, N(e.options, (l) => (r(), u("div", {
|
|
91
|
+
key: i(l)
|
|
81
92
|
}, [
|
|
82
93
|
f(s("input", {
|
|
83
|
-
id:
|
|
84
|
-
"onUpdate:modelValue": a[1] || (a[1] = (
|
|
94
|
+
id: i(l),
|
|
95
|
+
"onUpdate:modelValue": a[1] || (a[1] = (p) => o.value = p),
|
|
85
96
|
class: "tw-sr-only",
|
|
86
97
|
tabindex: "-1",
|
|
87
98
|
type: "checkbox",
|
|
88
|
-
value:
|
|
89
|
-
}, null, 8,
|
|
90
|
-
[v,
|
|
99
|
+
value: l.value
|
|
100
|
+
}, null, 8, L), [
|
|
101
|
+
[v, o.value]
|
|
91
102
|
]),
|
|
92
103
|
s("label", {
|
|
93
|
-
for:
|
|
104
|
+
for: i(l)
|
|
94
105
|
}, [
|
|
95
|
-
|
|
96
|
-
"is-selected":
|
|
106
|
+
y(b, {
|
|
107
|
+
"is-selected": g(l),
|
|
97
108
|
tabindex: "0",
|
|
98
|
-
onKeypress: h((
|
|
109
|
+
onKeypress: h((p) => w(l.value), ["enter"])
|
|
99
110
|
}, {
|
|
100
|
-
default:
|
|
101
|
-
|
|
111
|
+
default: d(() => [
|
|
112
|
+
_(x(l.label), 1)
|
|
102
113
|
]),
|
|
103
114
|
_: 2
|
|
104
115
|
}, 1032, ["is-selected", "onKeypress"])
|
|
105
|
-
], 8,
|
|
116
|
+
], 8, R)
|
|
106
117
|
]))), 128))
|
|
107
118
|
])
|
|
108
119
|
]),
|
|
109
120
|
_: 1
|
|
110
|
-
},
|
|
121
|
+
}, 16));
|
|
111
122
|
}
|
|
112
123
|
});
|
|
113
124
|
export {
|
|
114
|
-
|
|
125
|
+
j as default
|
|
115
126
|
};
|
|
116
127
|
//# sourceMappingURL=FilterSelect.js.map
|
package/dist/FilterSelect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSelect.js","sources":["../src/components/FilterSelect/FilterSelect.vue"],"sourcesContent":["<script lang=\"ts\">\n export * from './FilterSelect.types';\n</script>\n\n<script lang=\"ts\" setup>\n import { computed } from 'vue';\n\n import { t } from '../../locale';\n import Field from '../Field/Field.vue';\n import FilterChip from '../FilterChip/FilterChip.vue';\n import { FilterSelectModelValue, FilterSelectOption } from './FilterSelect.types';\n\n export interface FilterSelectProps {\n /**\n * The name attribute for the `<input>` elements. It is also used as a unique field to differentiate FilterSelect instances.\n */\n name: string;\n\n
|
|
1
|
+
{"version":3,"file":"FilterSelect.js","sources":["../src/components/FilterSelect/FilterSelect.vue"],"sourcesContent":["<script lang=\"ts\">\n export * from './FilterSelect.types';\n</script>\n\n<script lang=\"ts\" setup>\n import { computed } from 'vue';\n\n import { t } from '../../locale';\n import Field, { type FieldProps } from '../Field/Field.vue';\n import FilterChip from '../FilterChip/FilterChip.vue';\n import { FilterSelectModelValue, FilterSelectOption } from './FilterSelect.types';\n\n export interface FilterSelectProps extends FieldProps {\n /**\n * The name attribute for the `<input>` elements. It is also used as a unique field to differentiate FilterSelect instances.\n */\n name: string;\n\n options: FilterSelectOption[];\n\n modelValue: FilterSelectModelValue;\n\n /**\n * When true, this prop adds an \"All\" option for selecting all options.\n */\n canSelectAll?: boolean;\n }\n\n const props = withDefaults(defineProps<FilterSelectProps>(), {\n canSelectAll: false,\n });\n\n const emit = defineEmits<{\n (e: 'update:modelValue', value: FilterSelectModelValue): void;\n }>();\n\n /**\n * @see: https://vuejs.org/guide/components/v-model.html#component-v-model\n */\n const selected = computed({\n get() {\n return props.modelValue;\n },\n set(value) {\n emit('update:modelValue', value);\n },\n });\n\n const isAllSelected = computed({\n get() {\n return props.options.length === props.modelValue.length;\n },\n set(isChecked) {\n emit('update:modelValue', isChecked ? props.options.map((option) => option.value) : []);\n },\n });\n\n function getOptionId(option: FilterSelectOption) {\n return `${props.name}--${option.value}`;\n }\n\n function isOptionSelected(option: FilterSelectOption) {\n return props.modelValue.includes(option.value);\n }\n\n function onEnter(enteredValue: FilterSelectOption['value']) {\n const newSelected = selected.value.filter((value) => value !== enteredValue);\n\n if (newSelected.length === selected.value.length) {\n newSelected.push(enteredValue);\n }\n\n selected.value = newSelected;\n }\n\n function onEnterAll() {\n isAllSelected.value = !isAllSelected.value;\n }\n</script>\n\n<template>\n <Field v-bind=\"props\" class=\"stash-filter-select\" data-test=\"stash-filter-select\" fieldset>\n <div class=\"tw-flex tw-flex-wrap tw-gap-1.5\">\n <div v-if=\"props.canSelectAll\" :key=\"`${props.name}--all`\">\n <input\n :id=\"`${props.name}--all`\"\n v-model=\"isAllSelected\"\n class=\"tw-sr-only\"\n tabindex=\"-1\"\n type=\"checkbox\"\n value=\"all\"\n />\n <label :for=\"`${props.name}--all`\">\n <FilterChip :is-selected=\"isAllSelected\" tabindex=\"0\" @keypress.enter=\"onEnterAll\">\n {{ t('ll.all') }}\n </FilterChip>\n </label>\n </div>\n <div v-for=\"option in props.options\" :key=\"getOptionId(option)\">\n <input\n :id=\"getOptionId(option)\"\n v-model=\"selected\"\n class=\"tw-sr-only\"\n tabindex=\"-1\"\n type=\"checkbox\"\n :value=\"option.value\"\n />\n <label :for=\"getOptionId(option)\">\n <FilterChip :is-selected=\"isOptionSelected(option)\" tabindex=\"0\" @keypress.enter=\"onEnter(option.value)\">\n {{ option.label }}\n </FilterChip>\n </label>\n </div>\n </div>\n </Field>\n</template>\n"],"names":["props","__props","emit","__emit","selected","computed","value","isAllSelected","isChecked","option","getOptionId","isOptionSelected","onEnter","enteredValue","newSelected","onEnterAll"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4BE,UAAMA,IAAQC,GAIRC,IAAOC,GAOPC,IAAWC,EAAS;AAAA,MACxB,MAAM;AACJ,eAAOL,EAAM;AAAA,MACf;AAAA,MACA,IAAIM,GAAO;AACT,QAAAJ,EAAK,qBAAqBI,CAAK;AAAA,MACjC;AAAA,IAAA,CACD,GAEKC,IAAgBF,EAAS;AAAA,MAC7B,MAAM;AACJ,eAAOL,EAAM,QAAQ,WAAWA,EAAM,WAAW;AAAA,MACnD;AAAA,MACA,IAAIQ,GAAW;AACR,QAAAN,EAAA,qBAAqBM,IAAYR,EAAM,QAAQ,IAAI,CAACS,MAAWA,EAAO,KAAK,IAAI,CAAE,CAAA;AAAA,MACxF;AAAA,IAAA,CACD;AAED,aAASC,EAAYD,GAA4B;AAC/C,aAAO,GAAGT,EAAM,IAAI,KAAKS,EAAO,KAAK;AAAA,IACvC;AAEA,aAASE,EAAiBF,GAA4B;AACpD,aAAOT,EAAM,WAAW,SAASS,EAAO,KAAK;AAAA,IAC/C;AAEA,aAASG,EAAQC,GAA2C;AAC1D,YAAMC,IAAcV,EAAS,MAAM,OAAO,CAACE,MAAUA,MAAUO,CAAY;AAE3E,MAAIC,EAAY,WAAWV,EAAS,MAAM,UACxCU,EAAY,KAAKD,CAAY,GAG/BT,EAAS,QAAQU;AAAA,IACnB;AAEA,aAASC,IAAa;AACN,MAAAR,EAAA,QAAQ,CAACA,EAAc;AAAA,IACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -39,6 +39,59 @@ canSelectAll: boolean;
|
|
|
39
39
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
40
40
|
export default _default;
|
|
41
41
|
|
|
42
|
+
declare interface FieldProps {
|
|
43
|
+
/**
|
|
44
|
+
* Adds spacing under the field that is consistent whether hint/error text is displayed.
|
|
45
|
+
*/
|
|
46
|
+
addBottomSpace?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Error text to display. Replaces `hintText` (if provided) & adds error styling.
|
|
49
|
+
*/
|
|
50
|
+
errorText?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Displays text below the input; hidden when the isReadOnly prop is truthy.
|
|
53
|
+
*/
|
|
54
|
+
hintText?: string;
|
|
55
|
+
/**
|
|
56
|
+
* ID for the Label and Input; must be unique
|
|
57
|
+
*/
|
|
58
|
+
id?: string;
|
|
59
|
+
/**
|
|
60
|
+
* ID for the error text element; useful for aria-errormessage
|
|
61
|
+
*/
|
|
62
|
+
errorId?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Whether it's a readonly field.
|
|
65
|
+
*/
|
|
66
|
+
isReadOnly?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the field is required.
|
|
69
|
+
*/
|
|
70
|
+
isRequired?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Label to render above the input.
|
|
73
|
+
*/
|
|
74
|
+
label?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Show "(optional)" to the right of the label text
|
|
77
|
+
*/
|
|
78
|
+
showOptionalInLabel?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Indicates wheter the field is a fieldset or not
|
|
81
|
+
*/
|
|
82
|
+
fieldset?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Indicates whether the field is disabled.
|
|
85
|
+
*/
|
|
86
|
+
isDisabled?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Indicates whether the field is disabled.
|
|
89
|
+
*
|
|
90
|
+
* @deprecated Use `isDisabled` instead.
|
|
91
|
+
*/
|
|
92
|
+
disabled?: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
42
95
|
export declare type FilterSelectModelValue = Array<FilterSelectOption['value']>;
|
|
43
96
|
|
|
44
97
|
export declare interface FilterSelectOption {
|
|
@@ -46,12 +99,11 @@ export declare interface FilterSelectOption {
|
|
|
46
99
|
value: string;
|
|
47
100
|
}
|
|
48
101
|
|
|
49
|
-
export declare interface FilterSelectProps {
|
|
102
|
+
export declare interface FilterSelectProps extends FieldProps {
|
|
50
103
|
/**
|
|
51
104
|
* The name attribute for the `<input>` elements. It is also used as a unique field to differentiate FilterSelect instances.
|
|
52
105
|
*/
|
|
53
106
|
name: string;
|
|
54
|
-
label: string;
|
|
55
107
|
options: FilterSelectOption[];
|
|
56
108
|
modelValue: FilterSelectModelValue;
|
|
57
109
|
/**
|