@quidgest/ui 0.25.0 → 0.26.0

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,15 +1,16 @@
1
1
  import { provideDefaults as e } from "../../composables/defaults.js";
2
2
  import { useGroup as t } from "../../composables/useGroup/index.js";
3
3
  import { QOverflow as n } from "../QOverflow/index.js";
4
- import { TabsSymbol as r } from "./context.js";
5
- import { computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, mergeModels as u, nextTick as d, normalizeClass as f, normalizeStyle as p, onBeforeUnmount as m, openBlock as h, provide as g, ref as _, renderSlot as v, shallowRef as y, toRef as b, unref as x, useModel as S, useTemplateRef as C, watch as w, withCtx as T } from "vue";
4
+ import { useEnabledSelection as r } from "../../composables/useEnabledSelection/index.js";
5
+ import { TabsSymbol as i } from "./context.js";
6
+ import { computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, mergeModels as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as h, openBlock as g, provide as _, ref as v, renderSlot as y, shallowRef as b, toRef as x, unref as S, useModel as C, useTemplateRef as w, watch as T, withCtx as E } from "vue";
6
7
  //#region src/components/QTabs/QTabs.vue?vue&type=script&setup=true&lang.ts
7
- var E = ["id"], D = {
8
+ var D = ["id"], O = {
8
9
  ref: "tabListHost",
9
10
  class: "q-tabs__list"
10
- }, O = { class: "q-tabs__panels" }, k = /*@__PURE__*/ l({
11
+ }, k = { class: "q-tabs__panels" }, A = /*@__PURE__*/ u({
11
12
  __name: "QTabs",
12
- props: /*@__PURE__*/ u({
13
+ props: /*@__PURE__*/ d({
13
14
  id: {},
14
15
  class: {},
15
16
  direction: { default: "horizontal" },
@@ -21,188 +22,181 @@ var E = ["id"], D = {
21
22
  modelModifiers: {}
22
23
  }),
23
24
  emits: ["update:modelValue"],
24
- setup(l) {
25
- let u = l, k = S(l, "modelValue"), A = C("tabListHost"), j = C("overflowRef"), M = i(() => j.value?.contentEl ?? null), N = y([]), P = _({
25
+ setup(u) {
26
+ let d = u, A = C(u, "modelValue"), j = w("tabListHost"), M = w("overflowRef"), N = a(() => M.value?.contentEl ?? null), P = b([]), F = v({
26
27
  width: "0",
27
28
  height: "0",
28
29
  transform: "translate(0, 0)",
29
30
  opacity: "0"
30
- }), F = _(!1), I = null, { active: L } = t({
31
- active: k,
31
+ }), I = v(!1), L = null, { active: R } = t({
32
+ active: A,
32
33
  required: !0
33
34
  });
34
- w(L, (e) => {
35
- k.value = e;
36
- }), e({ QTab: { disabled: b(u, "disabled") } });
37
- let R = i(() => [
35
+ T(R, (e) => {
36
+ A.value = e;
37
+ }), e({ QTab: { disabled: x(d, "disabled") } });
38
+ let z = a(() => [
38
39
  "q-tabs",
39
- `q-tabs--${u.direction}`,
40
- `q-tabs--${u.variant}`,
41
- `q-tabs--align-${u.align}`,
42
- F.value ? "q-tabs--indicator-ready" : void 0,
43
- u.class
40
+ `q-tabs--${d.direction}`,
41
+ `q-tabs--${d.variant}`,
42
+ `q-tabs--align-${d.align}`,
43
+ I.value ? "q-tabs--indicator-ready" : void 0,
44
+ d.class
44
45
  ]);
45
- function z() {
46
- let e = M.value;
47
- e && (e.setAttribute("role", "tablist"), e.setAttribute("aria-orientation", u.direction));
46
+ function B() {
47
+ let e = N.value;
48
+ e && (e.setAttribute("role", "tablist"), e.setAttribute("aria-orientation", d.direction));
48
49
  }
49
- function B(e) {
50
+ function V(e) {
50
51
  let t = e.tabRef.value;
51
52
  return t ? "$el" in t ? t.$el : t : null;
52
53
  }
53
- function V() {
54
- F.value = !1, P.value = {
55
- ...P.value,
54
+ function H() {
55
+ I.value = !1, F.value = {
56
+ ...F.value,
56
57
  opacity: "0",
57
58
  width: "0",
58
59
  height: "0"
59
60
  };
60
61
  }
61
- function H() {
62
- if (u.variant !== "line" || !k.value) {
63
- V();
62
+ function U() {
63
+ if (d.variant !== "line" || !A.value) {
64
+ H();
64
65
  return;
65
66
  }
66
- let e = N.value.find((e) => e.value === k.value);
67
+ let e = P.value.find((e) => e.value === A.value);
67
68
  if (!e) {
68
- V();
69
+ H();
69
70
  return;
70
71
  }
71
- let t = B(e);
72
+ let t = V(e);
72
73
  if (!t) {
73
- V();
74
+ H();
74
75
  return;
75
76
  }
76
- let n = u.direction === "horizontal", r = F.value;
77
- n ? P.value = {
77
+ let n = d.direction === "horizontal", r = I.value;
78
+ n ? F.value = {
78
79
  width: `${t.offsetWidth}px`,
79
80
  height: "var(--q-tabs-indicator-thickness)",
80
81
  transform: `translate(${t.offsetLeft}px, 0)`,
81
82
  opacity: "1"
82
- } : P.value = {
83
+ } : F.value = {
83
84
  width: "var(--q-tabs-indicator-thickness)",
84
85
  height: `${t.offsetHeight}px`,
85
86
  transform: `translate(0, ${t.offsetTop}px)`,
86
87
  opacity: "1"
87
- }, r || d(() => {
88
- P.value.opacity === "1" && (F.value = !0);
88
+ }, r || f(() => {
89
+ F.value.opacity === "1" && (I.value = !0);
89
90
  });
90
91
  }
91
- function U() {
92
- if (!k.value) return;
93
- let e = N.value.find((e) => e.value === k.value);
92
+ function W() {
93
+ if (!A.value) return;
94
+ let e = P.value.find((e) => e.value === A.value);
94
95
  if (!e) return;
95
- let t = B(e);
96
- t && j.value?.scrollElementIntoView(t);
96
+ let t = V(e);
97
+ t && M.value?.scrollElementIntoView(t);
97
98
  }
98
- function W() {
99
- if (u.variant !== "line") {
100
- I?.disconnect();
99
+ function G() {
100
+ if (d.variant !== "line") {
101
+ L?.disconnect();
101
102
  return;
102
103
  }
103
- I ? I.disconnect() : I = new ResizeObserver(() => {
104
- H();
104
+ L ? L.disconnect() : L = new ResizeObserver(() => {
105
+ U();
105
106
  });
106
- let e = A.value;
107
- e && I.observe(e);
108
- for (let e of N.value) {
109
- let t = B(e);
110
- t && I.observe(t);
107
+ let e = j.value;
108
+ e && L.observe(e);
109
+ for (let e of P.value) {
110
+ let t = V(e);
111
+ t && L.observe(t);
111
112
  }
112
113
  }
113
- function G() {
114
- return N.value.filter((e) => !x(e.disabled));
115
- }
116
- function K() {
117
- let e = G();
118
- e.length && (e.some((e) => e.value === k.value) || (k.value = e[0].value));
119
- }
120
- let q;
121
- function J() {
122
- q ||= d(() => {
123
- q = void 0, K();
114
+ let { enabledItems: K, ensureSelection: q } = r(() => P.value, A), J;
115
+ function Y() {
116
+ J ||= f(() => {
117
+ J = void 0, q();
124
118
  });
125
119
  }
126
- function Y(e) {
127
- if (N.value = [...N.value, e], !k.value) {
128
- K();
120
+ function X(e) {
121
+ if (P.value = [...P.value, e], !A.value) {
122
+ q();
129
123
  return;
130
124
  }
131
- J();
125
+ Y();
132
126
  }
133
- function X(e) {
134
- N.value = N.value.filter((t) => t.value !== e);
127
+ function Z(e) {
128
+ P.value = P.value.filter((t) => t.value !== e);
135
129
  }
136
- function Z(e, t) {
130
+ function Q(e, t) {
137
131
  if (e === t) return;
138
- let n = N.value.findIndex((t) => t.value === e);
132
+ let n = P.value.findIndex((t) => t.value === e);
139
133
  if (n !== -1) {
140
- if (N.value = N.value.map((e, r) => r === n ? {
134
+ if (P.value = P.value.map((e, r) => r === n ? {
141
135
  ...e,
142
136
  value: t
143
- } : e), k.value === e || k.value === t) {
144
- k.value = t;
137
+ } : e), A.value === e || A.value === t) {
138
+ A.value = t;
145
139
  return;
146
140
  }
147
- K();
141
+ q();
148
142
  }
149
143
  }
150
- function Q(e, t) {
151
- let n = G();
144
+ function $(e, t) {
145
+ let n = K.value;
152
146
  if (!n.length) return;
153
147
  let r = n.findIndex((t) => t.value === e), i = n[r === -1 ? 0 : (r + t + n.length) % n.length];
154
148
  i.select(), i.focus();
155
149
  }
156
- function $() {
157
- let e = G()[0];
150
+ function ee() {
151
+ let e = K.value[0];
158
152
  e && (e.select(), e.focus());
159
153
  }
160
- function ee() {
161
- let e = G(), t = e[e.length - 1];
154
+ function te() {
155
+ let e = K.value, t = e[e.length - 1];
162
156
  t && (t.select(), t.focus());
163
157
  }
164
- return w(() => N.value.map((e) => [e.value, x(e.disabled)]), () => J()), w(() => [
165
- k.value,
166
- N.value.length,
167
- u.direction,
168
- u.variant,
169
- u.align
170
- ], () => d(() => {
171
- H(), U();
172
- }), { immediate: !0 }), w(() => [N.value.length, u.variant], () => d(W), { immediate: !0 }), w(() => [M.value, u.direction], () => z(), {
158
+ return T(() => P.value.map((e) => [e.value, S(e.disabled)]), () => Y()), T(() => [
159
+ A.value,
160
+ P.value.length,
161
+ d.direction,
162
+ d.variant,
163
+ d.align
164
+ ], () => f(() => {
165
+ U(), W();
166
+ }), { immediate: !0 }), T(() => [P.value.length, d.variant], () => f(G), { immediate: !0 }), T(() => [N.value, d.direction], () => B(), {
173
167
  immediate: !0,
174
168
  flush: "post"
175
- }), m(() => {
176
- I?.disconnect(), I = null;
177
- }), g(r, {
178
- tabListEl: M,
179
- direction: i(() => u.direction),
180
- register: Y,
181
- unregister: X,
182
- updateValue: Z,
183
- focusAdjacent: Q,
184
- focusFirst: $,
185
- focusLast: ee
186
- }), (e, t) => (h(), o("div", {
187
- id: u.id,
188
- class: f(R.value)
189
- }, [s("div", D, [c(x(n), {
169
+ }), h(() => {
170
+ L?.disconnect(), L = null;
171
+ }), _(i, {
172
+ tabListEl: N,
173
+ direction: a(() => d.direction),
174
+ register: X,
175
+ unregister: Z,
176
+ updateValue: Q,
177
+ focusAdjacent: $,
178
+ focusFirst: ee,
179
+ focusLast: te
180
+ }), (e, t) => (g(), s("div", {
181
+ id: d.id,
182
+ class: p(z.value)
183
+ }, [c("div", O, [l(S(n), {
190
184
  ref_key: "overflowRef",
191
- ref: j,
185
+ ref: M,
192
186
  class: "q-tabs__overflow",
193
- direction: u.direction,
187
+ direction: d.direction,
194
188
  "scroll-mode": "item",
195
189
  "content-class": "q-tabs__tablist"
196
190
  }, {
197
- default: T(() => [u.variant === "line" ? (h(), o("div", {
191
+ default: E(() => [d.variant === "line" ? (g(), s("div", {
198
192
  key: 0,
199
193
  class: "q-tabs__indicator",
200
194
  "aria-hidden": "true",
201
- style: p(P.value)
202
- }, null, 4)) : a("v-if", !0)]),
195
+ style: m(F.value)
196
+ }, null, 4)) : o("v-if", !0)]),
203
197
  _: 1
204
- }, 8, ["direction"])], 512), s("div", O, [v(e.$slots, "default")])], 10, E));
198
+ }, 8, ["direction"])], 512), c("div", k, [y(e.$slots, "default")])], 10, D));
205
199
  }
206
200
  });
207
201
  //#endregion
208
- export { k as default };
202
+ export { A as default };
@@ -1 +1 @@
1
- {"version":3,"file":"QTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/components/QTextArea/QTextArea.vue"],"names":[],"mappings":"AAiDA;AA4HC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,GAAG,CAAA;AAKvC,KAAK,WAAW,GAAG,cAAc,CAAC;AA2DnC,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,WAAW,CAAC;AAKhB,iBAAS,cAAc;WA4GT,OAAO,IAA6B;;iCAhBb,GAAG;gCACJ,GAAG;yBACV,GAAG;wBACJ,GAAG;wBACF,GAAG;;;;;;EAiB/B;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;OASnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"QTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/components/QTextArea/QTextArea.vue"],"names":[],"mappings":"AAkDA;AA+HC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,GAAG,CAAA;AAKvC,KAAK,WAAW,GAAG,cAAc,CAAC;AA6DnC,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,WAAW,CAAC;AAKhB,iBAAS,cAAc;WA8GT,OAAO,IAA6B;;iCAhBb,GAAG;gCACJ,GAAG;yBACV,GAAG;wBACJ,GAAG;wBACF,GAAG;;;;;;EAiB/B;AAiBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;OASnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -49,13 +49,14 @@ var C = [
49
49
  }
50
50
  });
51
51
  b(w, (e) => T.value = e, { immediate: !0 });
52
- let E = e(g(c, "id")), D = r(() => c.readonly || c.disabled ? void 0 : c.placeholder), O = r(() => ({ input: c.autosize ? A : null })), k = p(), { triggerResize: A, stop: j } = n({
53
- element: r(() => c.autosize ? k.value : void 0),
52
+ let E = e(g(c, "id")), D = r(() => c.readonly || c.disabled ? void 0 : c.placeholder), O = r(() => `${E.value}_input`), k = r(() => ({ input: c.autosize ? j : null })), A = p(), { triggerResize: j, stop: M } = n({
53
+ element: r(() => c.autosize ? A.value : void 0),
54
54
  styleProp: "minHeight"
55
55
  });
56
- return d(j), (e, n) => (f(), i(_(t), {
56
+ return d(M), (e, n) => (f(), i(_(t), {
57
+ id: _(E),
57
58
  class: u(["q-text-area", c.class]),
58
- for: _(E),
59
+ for: O.value,
59
60
  label: c.label,
60
61
  "label-position": c.labelPosition,
61
62
  size: c.size,
@@ -66,9 +67,9 @@ var C = [
66
67
  "label.prepend": x(() => [m(e.$slots, "label.prepend")]),
67
68
  "label.append": x(() => [m(e.$slots, "label.append")]),
68
69
  default: x(() => [S(a("textarea", l({
69
- id: _(E),
70
+ id: O.value,
70
71
  ref_key: "textareaRef",
71
- ref: k,
72
+ ref: A,
72
73
  "onUpdate:modelValue": n[0] ||= (e) => T.value = e,
73
74
  class: "q-text-area__input",
74
75
  required: c.required,
@@ -80,7 +81,7 @@ var C = [
80
81
  cols: c.cols,
81
82
  resize: c.resize,
82
83
  wrap: c.wrap
83
- }, e.$attrs, h(O.value, !0)), null, 16, C), [[y, T.value]])]),
84
+ }, e.$attrs, h(k.value, !0)), null, 16, C), [[y, T.value]])]),
84
85
  _: 2
85
86
  }, [
86
87
  e.$slots.prepend ? {
@@ -99,6 +100,7 @@ var C = [
99
100
  key: "2"
100
101
  } : void 0
101
102
  ]), 1032, [
103
+ "id",
102
104
  "class",
103
105
  "for",
104
106
  "label",
@@ -1 +1 @@
1
- {"version":3,"file":"QTextField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/QTextField/QTextField.vue"],"names":[],"mappings":"AAqDA;AAsIC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,GAAG,CAAA;AAKxC,KAAK,WAAW,GAAG,eAAe,CAAC;AAoEpC,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,WAAW,CAAC;AAKhB,iBAAS,cAAc;WAqIT,OAAO,IAA6B;;iCAjBb,GAAG;gCACJ,GAAG;yBACV,GAAG;wBACH,GAAG;wBACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAmE81d,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;EAjDn/d;AAiBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA+By2d,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;OArBl/d,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"QTextField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/QTextField/QTextField.vue"],"names":[],"mappings":"AAsDA;AAyIC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,GAAG,CAAA;AAKxC,KAAK,WAAW,GAAG,eAAe,CAAC;AAsEpC,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,WAAW,CAAC;AAKhB,iBAAS,cAAc;WAuIT,OAAO,IAA6B;;iCAjBb,GAAG;gCACJ,GAAG;yBACV,GAAG;wBACH,GAAG;wBACH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAoE8nd,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;EAlDnxd;AAkBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA+Byod,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;OArBlxd,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -44,17 +44,18 @@ var S = [
44
44
  }
45
45
  });
46
46
  y(E, (e) => D.value = e, { immediate: !0 });
47
- let O = e(m(w, "id")), k = _("field"), A = _("input"), j = r(() => w.readonly || w.disabled ? void 0 : w.placeholder), M = r(() => w.clearable && !w.readonly && !w.disabled), N = r(() => M.value && E.value);
48
- function P(e) {
49
- M.value && (E.value = "", T("click:clear", e));
47
+ let O = e(m(w, "id")), k = _("field"), A = _("input"), j = r(() => `${O.value}_input`), M = r(() => w.readonly || w.disabled ? void 0 : w.placeholder), N = r(() => w.clearable && !w.readonly && !w.disabled), P = r(() => N.value && E.value);
48
+ function F(e) {
49
+ N.value && (E.value = "", T("click:clear", e));
50
50
  }
51
51
  return l({
52
52
  fieldRef: r(() => k.value?.fieldRef),
53
53
  inputRef: A
54
54
  }), (e, r) => (f(), i(h(t), {
55
+ id: h(O),
55
56
  ref: "field",
56
57
  class: d(["q-text-field", w.class]),
57
- for: h(O),
58
+ for: j.value,
58
59
  label: w.label,
59
60
  "label-position": w.labelPosition,
60
61
  size: w.size,
@@ -66,14 +67,14 @@ var S = [
66
67
  "label.prepend": b(() => [p(e.$slots, "label.prepend")]),
67
68
  "label.append": b(() => [p(e.$slots, "label.append")]),
68
69
  default: b(() => [x(o("input", u({
69
- id: h(O),
70
+ id: j.value,
70
71
  ref: "input",
71
72
  "onUpdate:modelValue": r[0] ||= (e) => D.value = e,
72
73
  class: "q-text-field__input",
73
74
  type: w.type,
74
75
  maxlength: w.maxLength,
75
76
  required: w.required,
76
- placeholder: j.value,
77
+ placeholder: M.value,
77
78
  readonly: w.readonly,
78
79
  disabled: w.disabled
79
80
  }, e.$attrs), null, 16, S), [[v, D.value]])]),
@@ -84,13 +85,13 @@ var S = [
84
85
  fn: b(() => [p(e.$slots, "prepend")]),
85
86
  key: "0"
86
87
  } : void 0,
87
- e.$slots.append || N.value ? {
88
+ e.$slots.append || P.value ? {
88
89
  name: "append",
89
- fn: b(() => [p(e.$slots, "append"), N.value ? (f(), i(h(n), {
90
+ fn: b(() => [p(e.$slots, "append"), P.value ? (f(), i(h(n), {
90
91
  key: 0,
91
92
  "data-testid": "q-text-field__clear-button",
92
93
  texts: w.texts,
93
- onClick: P
94
+ onClick: F
94
95
  }, null, 8, ["texts"])) : a("v-if", !0)]),
95
96
  key: "1"
96
97
  } : void 0,
@@ -100,6 +101,7 @@ var S = [
100
101
  key: "2"
101
102
  } : void 0
102
103
  ]), 1032, [
104
+ "id",
103
105
  "class",
104
106
  "for",
105
107
  "label",
@@ -0,0 +1,33 @@
1
+ import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
2
+ /**
3
+ * Minimal shape required from an item to participate in {@link useEnabledSelection}.
4
+ */
5
+ export type QEnabledSelectionItem = {
6
+ /** Identity matched against the `v-model` ref. */
7
+ value: string;
8
+ /** Whether the item is disabled and therefore excluded from selection. */
9
+ disabled?: MaybeRefOrGetter<boolean | undefined>;
10
+ };
11
+ export interface QUseEnabledSelectionReturn<T extends QEnabledSelectionItem> {
12
+ /** Items with `disabled` excluded, in their original order. */
13
+ enabledItems: ComputedRef<T[]>;
14
+ /**
15
+ * Snaps `model` onto an enabled item's value when it doesn't currently match one.
16
+ * No-ops when there is no enabled item to fall back to.
17
+ */
18
+ ensureSelection: () => void;
19
+ }
20
+ /**
21
+ * Shared "enabled item" selection logic for list-like components with a
22
+ * `value`/`disabled` item shape and a single-value `v-model` (e.g. `QTabs`, `QSteps`).
23
+ *
24
+ * Filters out disabled items and keeps `model` snapped to an enabled one: whenever
25
+ * the current `model` value doesn't match an enabled item,
26
+ * {@link QUseEnabledSelectionReturn.ensureSelection} resets it to the first
27
+ * enabled item's value.
28
+ *
29
+ * @param items - Getter returning the current ordered list of items.
30
+ * @param model - The `v-model` ref to keep in sync with `items`.
31
+ */
32
+ export declare function useEnabledSelection<T extends QEnabledSelectionItem>(items: () => T[], model: Ref<string | undefined>): QUseEnabledSelectionReturn<T>;
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useEnabledSelection/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAK7D;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IACnC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAA;IAEb,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,gBAAgB,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;CAChD,CAAA;AAED,MAAM,WAAW,0BAA0B,CAAC,CAAC,SAAS,qBAAqB;IAC1E,+DAA+D;IAC/D,YAAY,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAA;IAE9B;;;OAGG;IACH,eAAe,EAAE,MAAM,IAAI,CAAA;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,qBAAqB,EAClE,KAAK,EAAE,MAAM,CAAC,EAAE,EAChB,KAAK,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,GAC5B,0BAA0B,CAAC,CAAC,CAAC,CAc/B"}
@@ -0,0 +1,15 @@
1
+ import { computed as e, toValue as t } from "vue";
2
+ //#region src/composables/useEnabledSelection/index.ts
3
+ function n(n, r) {
4
+ let i = e(() => n().filter((e) => !t(e.disabled)));
5
+ function a() {
6
+ let e = i.value;
7
+ e.length && (e.some((e) => e.value === r.value) || (r.value = e[0].value));
8
+ }
9
+ return {
10
+ enabledItems: i,
11
+ ensureSelection: a
12
+ };
13
+ }
14
+ //#endregion
15
+ export { n as useEnabledSelection };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quidgest/ui",
3
3
  "description": "Quidgest's UI framework",
4
- "version": "0.25.0",
4
+ "version": "0.26.0",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "author": "Quidgest",