@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.
Files changed (37) hide show
  1. package/dist/CurrencyInput.js +55 -50
  2. package/dist/CurrencyInput.js.map +1 -1
  3. package/dist/CurrencyInput.vue.d.ts +31 -6
  4. package/dist/DatePicker.js +7 -7
  5. package/dist/DatePicker.js.map +1 -1
  6. package/dist/Field.js +1 -1
  7. package/dist/Field.vue.d.ts +11 -0
  8. package/dist/Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js +88 -0
  9. package/dist/Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js.map +1 -0
  10. package/dist/FilterSelect.js +67 -56
  11. package/dist/FilterSelect.js.map +1 -1
  12. package/dist/FilterSelect.vue.d.ts +54 -2
  13. package/dist/Filters.vue.d.ts +162 -96
  14. package/dist/Input.js +97 -91
  15. package/dist/Input.js.map +1 -1
  16. package/dist/Input.vue.d.ts +31 -21
  17. package/dist/InputOptions.js +83 -62
  18. package/dist/InputOptions.js.map +1 -1
  19. package/dist/InputOptions.vue.d.ts +49 -16
  20. package/dist/ListView.vue.d.ts +231 -134
  21. package/dist/RadioGroup.js +67 -70
  22. package/dist/RadioGroup.js.map +1 -1
  23. package/dist/RadioGroup.vue.d.ts +54 -45
  24. package/dist/Select.js +350 -336
  25. package/dist/Select.js.map +1 -1
  26. package/dist/Select.vue.d.ts +54 -47
  27. package/dist/TextEditor.js +671 -684
  28. package/dist/TextEditor.js.map +1 -1
  29. package/dist/TextEditor.vue.d.ts +54 -61
  30. package/dist/Textarea.js +65 -59
  31. package/dist/Textarea.js.map +1 -1
  32. package/dist/Textarea.vue.d.ts +50 -32
  33. package/dist/components.css +2 -2
  34. package/package.json +1 -1
  35. package/styles/backwards-compat.css +3 -3
  36. package/dist/Field.vue_vue_type_script_setup_true_lang-DjxUvSRF.js +0 -95
  37. package/dist/Field.vue_vue_type_script_setup_true_lang-DjxUvSRF.js.map +0 -1
package/dist/Field.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./Field.vue_vue_type_script_setup_true_lang-DjxUvSRF.js";
1
+ import { _ as f } from "./Field.vue_vue_type_script_setup_true_lang-DEizIcDo.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,116 +1,127 @@
1
- import { defineComponent as $, computed as p, openBlock as u, createBlock as C, withCtx as i, createElementVNode as s, createElementBlock as d, withDirectives as f, vModelCheckbox as v, createVNode as _, withKeys as h, createTextVNode as b, toDisplayString as x, unref as A, createCommentVNode as B, Fragment as E, renderList as K } from "vue";
2
- import { t as N } from "./locale.js";
3
- import { _ as F } from "./Field.vue_vue_type_script_setup_true_lang-DjxUvSRF.js";
4
- import y from "./FilterChip.js";
5
- const D = { class: "tw-flex tw-flex-wrap tw-gap-1.5" }, O = ["id"], U = ["for"], I = ["id", "value"], L = ["for"], z = /* @__PURE__ */ $({
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(V, { emit: g }) {
16
- const e = V, c = g, n = p({
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(l) {
21
- c("update:modelValue", l);
31
+ set(t) {
32
+ c("update:modelValue", t);
22
33
  }
23
- }), o = p({
34
+ }), n = m({
24
35
  get() {
25
36
  return e.options.length === e.modelValue.length;
26
37
  },
27
- set(l) {
28
- c("update:modelValue", l ? e.options.map((a) => a.value) : []);
38
+ set(t) {
39
+ c("update:modelValue", t ? e.options.map((a) => a.value) : []);
29
40
  }
30
41
  });
31
- function r(l) {
32
- return `${e.name}--${l.value}`;
42
+ function i(t) {
43
+ return `${e.name}--${t.value}`;
33
44
  }
34
- function w(l) {
35
- return e.modelValue.includes(l.value);
45
+ function g(t) {
46
+ return e.modelValue.includes(t.value);
36
47
  }
37
- function k(l) {
38
- const a = n.value.filter((t) => t !== l);
39
- a.length === n.value.length && a.push(l), n.value = a;
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 S() {
42
- o.value = !o.value;
52
+ function k() {
53
+ n.value = !n.value;
43
54
  }
44
- return (l, a) => (u(), C(F, {
55
+ return (t, a) => (r(), $(D, C(e, {
45
56
  class: "stash-filter-select",
46
- fieldset: "",
47
- label: e.label
48
- }, {
49
- default: i(() => [
50
- s("div", D, [
51
- e.canSelectAll ? (u(), d("div", {
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] = (t) => o.value = t),
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, O), [
62
- [v, o.value]
72
+ }, null, 8, I), [
73
+ [v, n.value]
63
74
  ]),
64
75
  s("label", {
65
76
  for: `${e.name}--all`
66
77
  }, [
67
- _(y, {
68
- "is-selected": o.value,
78
+ y(b, {
79
+ "is-selected": n.value,
69
80
  tabindex: "0",
70
- onKeypress: h(S, ["enter"])
81
+ onKeypress: h(k, ["enter"])
71
82
  }, {
72
- default: i(() => [
73
- b(x(A(N)("ll.all")), 1)
83
+ default: d(() => [
84
+ _(x(A(O)("ll.all")), 1)
74
85
  ]),
75
86
  _: 1
76
87
  }, 8, ["is-selected"])
77
- ], 8, U)
78
- ])) : B("", !0),
79
- (u(!0), d(E, null, K(e.options, (t) => (u(), d("div", {
80
- key: r(t)
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: r(t),
84
- "onUpdate:modelValue": a[1] || (a[1] = (m) => n.value = m),
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: t.value
89
- }, null, 8, I), [
90
- [v, n.value]
99
+ value: l.value
100
+ }, null, 8, L), [
101
+ [v, o.value]
91
102
  ]),
92
103
  s("label", {
93
- for: r(t)
104
+ for: i(l)
94
105
  }, [
95
- _(y, {
96
- "is-selected": w(t),
106
+ y(b, {
107
+ "is-selected": g(l),
97
108
  tabindex: "0",
98
- onKeypress: h((m) => k(t.value), ["enter"])
109
+ onKeypress: h((p) => w(l.value), ["enter"])
99
110
  }, {
100
- default: i(() => [
101
- b(x(t.label), 1)
111
+ default: d(() => [
112
+ _(x(l.label), 1)
102
113
  ]),
103
114
  _: 2
104
115
  }, 1032, ["is-selected", "onKeypress"])
105
- ], 8, L)
116
+ ], 8, R)
106
117
  ]))), 128))
107
118
  ])
108
119
  ]),
109
120
  _: 1
110
- }, 8, ["label"]));
121
+ }, 16));
111
122
  }
112
123
  });
113
124
  export {
114
- z as default
125
+ j as default
115
126
  };
116
127
  //# sourceMappingURL=FilterSelect.js.map
@@ -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 label: 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 class=\"stash-filter-select\" fieldset :label=\"props.label\">\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":";;;;;;;;;;;;;;;AA8BE,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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
  /**