@leaflink/stash 50.0.6 → 50.0.8

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.
@@ -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--tBfZB2K.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
  /**